You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/07 21:58:23 UTC

[GitHub] [iceberg] kbendick commented on a change in pull request #3804: Spark: Implement copy-on-write MERGE

kbendick commented on a change in pull request #3804:
URL: https://github.com/apache/iceberg/pull/3804#discussion_r780550300



##########
File path: spark/v3.2/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/AlignRowLevelCommandAssignments.scala
##########
@@ -34,5 +41,73 @@ object AlignRowLevelCommandAssignments
   override def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
     case u: UpdateIcebergTable if u.resolved && !u.aligned =>
       u.copy(assignments = alignAssignments(u.table, u.assignments))
+
+    case m: MergeIntoIcebergTable if m.resolved && !m.aligned =>
+      val alignedMatchedActions = m.matchedActions.map {
+        case u @ UpdateAction(_, assignments) =>
+          u.copy(assignments = alignAssignments(m.targetTable, assignments))

Review comment:
       Do we need to handle `UpdateStarAction`?

##########
File path: spark/v3.2/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/AlignRowLevelCommandAssignments.scala
##########
@@ -34,5 +41,73 @@ object AlignRowLevelCommandAssignments
   override def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
     case u: UpdateIcebergTable if u.resolved && !u.aligned =>
       u.copy(assignments = alignAssignments(u.table, u.assignments))
+
+    case m: MergeIntoIcebergTable if m.resolved && !m.aligned =>
+      val alignedMatchedActions = m.matchedActions.map {
+        case u @ UpdateAction(_, assignments) =>
+          u.copy(assignments = alignAssignments(m.targetTable, assignments))
+        case d: DeleteAction =>
+          d
+        case _ =>
+          throw new AnalysisException("Matched actions can only contain UPDATE or DELETE")
+      }
+
+      val alignedNotMatchedActions = m.notMatchedActions.map {
+        case i @ InsertAction(_, assignments) =>

Review comment:
       Same question regarding `InsertStarAction`.




-- 
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: issues-unsubscribe@iceberg.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org