Skip to content

Commit

Permalink
update the code as feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghao-intel committed Apr 27, 2015
1 parent 81a731f commit 493775c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.spark.sql.catalyst

import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan

/**
Expand All @@ -25,6 +26,7 @@ import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
* interface for advanced user.
*
*/
@DeveloperApi
abstract class Dialect {
// this is the main function that will be implemented by sql parser.
def parse(sqlText: String): LogicalPlan
Expand Down
7 changes: 4 additions & 3 deletions sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ import org.apache.spark.{Partition, SparkContext}
private[spark] class DefaultDialect extends Dialect {
@transient
protected val sqlParser = {
val fallback = new catalyst.SqlParser
new SparkSQLParser(fallback.parse)
val catalystSqlParser = new catalyst.SqlParser
new SparkSQLParser(catalystSqlParser.parse)
}

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

Expand Down

0 comments on commit 493775c

Please sign in to comment.