From a6d1f537e3a4fee7b9fb913de0ab531fc8d4be83 Mon Sep 17 00:00:00 2001 From: KnightChess <981159963@qq.com> Date: Wed, 7 Sep 2022 22:23:46 +0800 Subject: [PATCH] [HUDI-4799] improve analyzer exception tip when can not resolve expression --- .../apache/spark/sql/hudi/analysis/HoodieAnalysis.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala b/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala index 4f4446ac281c..24280c23ee55 100644 --- a/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala +++ b/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala @@ -268,6 +268,14 @@ case class HoodieResolveReferences(sparkSession: SparkSession) extends Rule[Logi if sparkAdapter.isHoodieTable(target, sparkSession) && target.resolved => val resolver = sparkSession.sessionState.conf.resolver val resolvedSource = analyzer.execute(source) + try { + analyzer.checkAnalysis(resolvedSource) + } catch { + case e: AnalysisException => + val ae = new AnalysisException(e.message, e.line, e.startPosition, Option(resolvedSource)) + ae.setStackTrace(e.getStackTrace) + throw ae + } def isInsertOrUpdateStar(assignments: Seq[Assignment]): Boolean = { if (assignments.isEmpty) {