Skip to content

Commit aab0b0b

Browse files
polish the code a little bit
1 parent 49b9d81 commit aab0b0b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
193193
}
194194
}
195195

196-
protected[sql] def parseSql(sql: String): LogicalPlan = ddlParser(sql, false)
196+
protected[sql] def parseSql(sql: String): LogicalPlan = ddlParser.parse(sql, false)
197197

198198
protected[sql] def executeSql(sql: String): this.QueryExecution = executePlan(parseSql(sql))
199199

@@ -207,8 +207,6 @@ class SQLContext(@transient val sparkContext: SparkContext)
207207
@transient
208208
protected[sql] val defaultSession = createSession()
209209

210-
// Sub class may need to overwrite the following 2 functions custom sql dialect parser support
211-
212210
protected[sql] def dialectClassName = if (conf.dialect == "sql") {
213211
classOf[DefaultDialect].getCanonicalName
214212
} else {

sql/core/src/main/scala/org/apache/spark/sql/sources/ddl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private[sql] class DDLParser(
3838
parseQuery: String => LogicalPlan)
3939
extends AbstractSparkSQLParser with DataTypeParser with Logging {
4040

41-
def apply(input: String, exceptionOnError: Boolean): LogicalPlan = {
41+
def parse(input: String, exceptionOnError: Boolean): LogicalPlan = {
4242
try {
4343
parse(input)
4444
} catch {

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark.sql.hive.execution
1919

2020
import org.apache.spark.sql.catalyst.analysis.EliminateSubQueries
21+
import org.apache.spark.sql.catalyst.errors.DialectException
2122
import org.apache.spark.sql.DefaultDialect
2223
import org.apache.spark.sql.{AnalysisException, QueryTest, Row, SQLConf}
2324
import org.apache.spark.sql.hive.MetastoreRelation
@@ -256,7 +257,7 @@ class SQLQuerySuite extends QueryTest {
256257
getSQLDialect().getClass === classOf[HiveQLDialect]
257258

258259
sql("SET spark.sql.dialect=MyTestClass")
259-
intercept[Exception] {
260+
intercept[DialectException] {
260261
sql("SELECT 1")
261262
}
262263
// test if the dialect set back to HiveQLDialect

0 commit comments

Comments
 (0)