This is an automated email from the ASF dual-hosted git repository.

taowang pushed a commit to branch 
revert-3722-fix_indexOutOfB_merge_into_bug_when_partial_update
in repository https://gitbox.apache.org/repos/asf/amoro.git

commit 3ec061dff476d24ebab136dd18dbd6acd4c22e5c
Author: Wang Tao <[email protected]>
AuthorDate: Wed Aug 13 10:29:12 2025 +0800

    Revert "[AMORO-3713] fix bug of merging into when selecting less columns 
from…"
    
    This reverts commit 28a6415d1ae6f93db7add669eb68172231c833b6.
---
 .../analysis/RewriteMixedFormatMergeIntoTable.scala         | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/src/main/scala/org/apache/amoro/spark/sql/catalyst/analysis/RewriteMixedFormatMergeIntoTable.scala
 
b/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/src/main/scala/org/apache/amoro/spark/sql/catalyst/analysis/RewriteMixedFormatMergeIntoTable.scala
index 6268a0c4d..ccaa23468 100644
--- 
a/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/src/main/scala/org/apache/amoro/spark/sql/catalyst/analysis/RewriteMixedFormatMergeIntoTable.scala
+++ 
b/amoro-format-mixed/amoro-mixed-spark/v3.3/amoro-mixed-spark-3.3/src/main/scala/org/apache/amoro/spark/sql/catalyst/analysis/RewriteMixedFormatMergeIntoTable.scala
@@ -132,10 +132,10 @@ case class RewriteMixedFormatMergeIntoTable(spark: 
SparkSession) extends Rule[Lo
         Some(ProjectingInternalRow.newProjectInternalRow(plan, targetRowAttrs, 
isFront = true, 0))
       val backRowProjection =
         ProjectingInternalRow.newProjectInternalRow(
-          plan,
+          source,
           targetRowAttrs,
           isFront = false,
-          rowIdAttrs.size)
+          1 + rowIdAttrs.size)
       (frontRowProjection, backRowProjection)
     } else {
       val frontRowProjection =
@@ -187,8 +187,7 @@ case class RewriteMixedFormatMergeIntoTable(spark: 
SparkSession) extends Rule[Lo
     // also disable broadcasts for the target table to perform the cardinality 
check
     val joinType = if (notMatchedActions.isEmpty) Inner else RightOuter
     val joinHint = JoinHint(leftHint = 
Some(HintInfo(Some(NO_BROADCAST_HASH))), rightHint = None)
-    val joinPlan =
-      Join(NoStatsUnaryNode(targetTableProj), sourceTableProj, joinType, 
Some(cond), joinHint)
+    val joinPlan = Join(targetTableProj, sourceTableProj, joinType, 
Some(cond), joinHint)
 
     val matchedConditions = matchedActions.map(actionCondition)
     val matchedOutputs =
@@ -265,16 +264,14 @@ case class RewriteMixedFormatMergeIntoTable(spark: 
SparkSession) extends Rule[Lo
 
     action match {
       case u: UpdateAction =>
-//        val finalSourceOutput = rebuildAttribute(sourceOutput, u.assignments)
-        val finalSourceOutput = u.assignments.map(_.value)
+        val finalSourceOutput = rebuildAttribute(sourceOutput, u.assignments)
         Seq(Literal(UPDATE_OPERATION)) ++ targetOutput ++ finalSourceOutput
 
       case _: DeleteAction =>
         Seq(Literal(DELETE_OPERATION)) ++ targetOutput ++ sourceOutput
 
       case i: InsertAction =>
-//        val finalSourceOutput = rebuildAttribute(sourceOutput, i.assignments)
-        val finalSourceOutput = i.assignments.map(_.value)
+        val finalSourceOutput = rebuildAttribute(sourceOutput, i.assignments)
         Seq(Literal(INSERT_OPERATION)) ++ targetOutput ++ finalSourceOutput
 
       case other =>

Reply via email to