tdas commented on a change in pull request #27265: [SPARK-30555][SQL] MERGE 
INTO insert action should only access columns from source table
URL: https://github.com/apache/spark/pull/27265#discussion_r369275455
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
 ##########
 @@ -1055,6 +1060,49 @@ class PlanResolutionSuite extends AnalysisTest {
   }
 
   test("MERGE INTO TABLE") {
+    def checkResolution(
+        target: LogicalPlan,
+        source: LogicalPlan,
+        mergeCondition: Expression,
+        deleteCondAttr: Option[AttributeReference],
+        updateCondAttr: Option[AttributeReference],
+        insertCondAttr: Option[AttributeReference],
+        updateAssigns: Seq[Assignment],
+        insertAssigns: Seq[Assignment],
+        starInUpdate: Boolean = false): Unit = {
+      val ti = target.output.find(_.name == 
"i").get.asInstanceOf[AttributeReference]
+      val ts = target.output.find(_.name == 
"s").get.asInstanceOf[AttributeReference]
+      val si = source.output.find(_.name == 
"i").get.asInstanceOf[AttributeReference]
+      val ss = source.output.find(_.name == 
"s").get.asInstanceOf[AttributeReference]
+
+      mergeCondition match {
+        case EqualTo(l: AttributeReference, r: AttributeReference) =>
+          assert(l.sameRef(ti) && r.sameRef(si))
+        case other => fail("unexpected merge condition" + other)
 
 Review comment:
   nit: space after 'condition' 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to