zhoulii commented on code in PR #9489:
URL: https://github.com/apache/paimon/pull/9489#discussion_r3892786210


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/commands/MergeIntoPaimonDataEvolutionTable.scala:
##########
@@ -150,25 +151,65 @@ case class MergeIntoPaimonDataEvolutionTable(
    *
    * without any extra shuffle, join, or sort.
    */
-  private lazy val isSelfMergeOnRowId: Boolean = {
+  private case class SelfMergeSpec(residualCondition: Option[Expression])
+
+  private lazy val sameSourceAndTargetTable: Boolean = {

Review Comment:
   Thanks for pointing this out.  This issue actually existed in the original 
`_ROW_ID`-only self-merge shortcut as well: it could unwrap a computed 
`Project`, remove the source plan, and rewrite source attributes to target 
attributes by name, thereby losing expressions such as `b + 1 AS b`.
   
   I fixed it by enabling the shortcut only for a direct Paimon relation or a 
verified passthrough projection. Computed projections and other transformed 
source plans now fall back to the regular MERGE path. A regression test has 
also been added for this case.



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

Reply via email to