Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
CTTY committed Jun 27, 2022
1 parent 0282375 commit 33e0f12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,23 @@ import org.apache.spark.sql.catalyst.{FunctionIdentifier, TableIdentifier}
import org.apache.spark.sql.types._
import org.apache.spark.sql.{AnalysisException, SparkSession}

import scala.util.control.NonFatal

class HoodieSpark3_2ExtendedSqlParser(session: SparkSession, delegate: ParserInterface)
extends ParserInterface with Logging {

private lazy val conf = session.sqlContext.conf
private lazy val builder = new HoodieSpark3_2ExtendedSqlAstBuilder(conf, delegate)

override def parsePlan(sqlText: String): LogicalPlan = parse(sqlText) { parser =>
builder.visit(parser.singleStatement()) match {
case plan: LogicalPlan => plan
case _=> delegate.parsePlan(sqlText)
try {
builder.visit(parser.singleStatement()) match {
case plan: LogicalPlan => plan
case _=> delegate.parsePlan(sqlText)
}
} catch {
case NonFatal(_) =>
delegate.parsePlan(sqlText)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import org.apache.spark.sql.catalyst.{FunctionIdentifier, TableIdentifier}
import org.apache.spark.sql.types._
import org.apache.spark.sql.{AnalysisException, SparkSession}

import scala.util.control.NonFatal

class HoodieSpark3_3ExtendedSqlParser(session: SparkSession, delegate: ParserInterface)
extends ParserInterface with Logging {

Expand All @@ -50,7 +52,7 @@ class HoodieSpark3_3ExtendedSqlParser(session: SparkSession, delegate: ParserInt
}
}

override def parseQuery(sqlText: String): LogicalPlan = deletgate.parseQuery(sqlText)
def parseQuery(sqlText: String): LogicalPlan = delegate.parseQuery(sqlText)

override def parseExpression(sqlText: String): Expression = delegate.parseExpression(sqlText)

Expand Down

0 comments on commit 33e0f12

Please sign in to comment.