From dc3b22bf8fd36f71ae226817a50d635d85006164 Mon Sep 17 00:00:00 2001 From: KnightChess <981159963@qq.com> Date: Mon, 31 Oct 2022 15:41:21 +0800 Subject: [PATCH] [HUDI-4799] improve analyzer exception tip when cannot resolve expression (#6625) --- .../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 c8add030981b9..820891ce956e4 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 @@ -264,6 +264,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) {