You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/06/23 14:11:47 UTC

[GitHub] [hudi] cxzl25 commented on a diff in pull request #5947: [HUDI-4309] Spark3.2 custom parser should not throw exception

cxzl25 commented on code in PR #5947:
URL: https://github.com/apache/hudi/pull/5947#discussion_r905073625


##########
hudi-spark-datasource/hudi-spark3/src/main/scala/org/apache/spark/sql/parser/HoodieSpark3_2ExtendedSqlParser.scala:
##########
@@ -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(_) =>

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org