aokolnychyi commented on a change in pull request #2189:
URL: https://github.com/apache/iceberg/pull/2189#discussion_r568829114



##########
File path: 
spark3-extensions/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteMergeInto.scala
##########
@@ -68,6 +70,37 @@ case class RewriteMergeInto(spark: SparkSession) extends 
Rule[LogicalPlan] with
 
   override def apply(plan: LogicalPlan): LogicalPlan = {
     plan resolveOperators {
+      case MergeIntoTable(target: DataSourceV2Relation, source, cond, 
matchedActions, notMatchedActions)
+          if matchedActions.isEmpty && notMatchedActions.size == 1 && 
isIcebergRelation(target) =>
+
+        val targetTableScan = buildSimpleScanPlan(target, cond)
+
+        val insertAction = notMatchedActions match {

Review comment:
       Done.

##########
File path: 
spark3-extensions/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteMergeInto.scala
##########
@@ -68,6 +70,37 @@ case class RewriteMergeInto(spark: SparkSession) extends 
Rule[LogicalPlan] with
 
   override def apply(plan: LogicalPlan): LogicalPlan = {
     plan resolveOperators {
+      case MergeIntoTable(target: DataSourceV2Relation, source, cond, 
matchedActions, notMatchedActions)
+          if matchedActions.isEmpty && notMatchedActions.size == 1 && 
isIcebergRelation(target) =>
+
+        val targetTableScan = buildSimpleScanPlan(target, cond)
+
+        val insertAction = notMatchedActions match {
+          case Seq(action: InsertAction) =>
+            action
+          case _ =>
+            throw new AnalysisException("Only insert actions are supported in 
NOT MATCHED clauses")

Review comment:
       Yep, removed.




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



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

Reply via email to