aokolnychyi commented on code in PR #41577:
URL: https://github.com/apache/spark/pull/41577#discussion_r1228461106


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/RewriteMergeIntoTable.scala:
##########
@@ -310,6 +417,26 @@ object RewriteMergeIntoTable extends 
RewriteRowLevelCommand with PredicateHelper
     }
   }
 
+  // converts a MERGE action into an instruction on top of the joined plan for 
group-based plans
+  private def toInstruction(action: MergeAction, metadataAttrs: 
Seq[Attribute]): Instruction = {
+    action match {
+      case UpdateAction(cond, assignments) =>
+        val output = assignments.map(_.value) ++ metadataAttrs
+        Keep(cond.getOrElse(TrueLiteral), output)
+
+      case DeleteAction(cond) =>
+        Discard(cond.getOrElse(TrueLiteral))

Review Comment:
   Unlike delta-based plans, we discard deleted records.



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

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to