Skip to content

Commit 493775c

Browse files
update the code as feedback
1 parent 81a731f commit 493775c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/Dialect.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.spark.sql.catalyst
1919

20+
import org.apache.spark.annotation.DeveloperApi
2021
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
2122

2223
/**
@@ -25,6 +26,7 @@ import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
2526
* interface for advanced user.
2627
*
2728
*/
29+
@DeveloperApi
2830
abstract class Dialect {
2931
// this is the main function that will be implemented by sql parser.
3032
def parse(sqlText: String): LogicalPlan

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ import org.apache.spark.{Partition, SparkContext}
7777
private[spark] class DefaultDialect extends Dialect {
7878
@transient
7979
protected val sqlParser = {
80-
val fallback = new catalyst.SqlParser
81-
new SparkSQLParser(fallback.parse)
80+
val catalystSqlParser = new catalyst.SqlParser
81+
new SparkSQLParser(catalystSqlParser.parse)
8282
}
8383

8484
override def parse(sqlText: String): LogicalPlan = {
@@ -189,7 +189,8 @@ class SQLContext(@transient val sparkContext: SparkContext)
189189
conf.unsetConf(SQLConf.DIALECT)
190190
// throw out the exception, and the default sql dialect will take effect for next query.
191191
throw new DialectException(
192-
s"Unsupported SQL alias: $dialect, will set it as '${conf.dialect}'", e)
192+
s"""Instantiating dialect '$dialect' failed.
193+
|Reverting to default dialect '${conf.dialect}'""".stripMargin, e)
193194
}
194195
}
195196

0 commit comments

Comments
 (0)