cloud-fan commented on a change in pull request #31835:
URL: https://github.com/apache/spark/pull/31835#discussion_r594888061



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
##########
@@ -671,6 +671,19 @@ class AnalysisSuite extends AnalysisTest with Matchers {
       Project(Seq(UnresolvedAttribute("temp0.a"), 
UnresolvedAttribute("temp1.a")), join))
   }
 
+  test("SPARK-34741: Avoid ambiguous reference in MergeIntoTable") {
+    val cond = 'a > 1
+    assertAnalysisError(

Review comment:
       Think about `UPDATE SET a = source.a * 2 + target.a`, without this fix, 
both `source.a` and `target.a` refer to the column `a` from the source table, 
which is wrong. With this fix to dedup the self-merge, the column `a` can be 
correctly resolved, because the column `a` from source and target table have 
different expr IDs.
   
   For `UPDATE SET a = source.a`, I think it works before and after this fix. 
@Ngone51 can you confirm?




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to