Skip to content

Commit

Permalink
polish the code a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghao-intel committed Apr 24, 2015
1 parent 49b9d81 commit aab0b0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
}
}

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

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

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

// Sub class may need to overwrite the following 2 functions custom sql dialect parser support

protected[sql] def dialectClassName = if (conf.dialect == "sql") {
classOf[DefaultDialect].getCanonicalName
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private[sql] class DDLParser(
parseQuery: String => LogicalPlan)
extends AbstractSparkSQLParser with DataTypeParser with Logging {

def apply(input: String, exceptionOnError: Boolean): LogicalPlan = {
def parse(input: String, exceptionOnError: Boolean): LogicalPlan = {
try {
parse(input)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.spark.sql.hive.execution

import org.apache.spark.sql.catalyst.analysis.EliminateSubQueries
import org.apache.spark.sql.catalyst.errors.DialectException
import org.apache.spark.sql.DefaultDialect
import org.apache.spark.sql.{AnalysisException, QueryTest, Row, SQLConf}
import org.apache.spark.sql.hive.MetastoreRelation
Expand Down Expand Up @@ -256,7 +257,7 @@ class SQLQuerySuite extends QueryTest {
getSQLDialect().getClass === classOf[HiveQLDialect]

sql("SET spark.sql.dialect=MyTestClass")
intercept[Exception] {
intercept[DialectException] {
sql("SELECT 1")
}
// test if the dialect set back to HiveQLDialect
Expand Down

0 comments on commit aab0b0b

Please sign in to comment.