cloud-fan commented on code in PR #52866:
URL: https://github.com/apache/spark/pull/52866#discussion_r2505136593


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -892,9 +892,13 @@ case class MergeIntoTable(
     case _ => false
   }
 
-  lazy val needSchemaEvolution: Boolean =
+  private lazy val sourceSchemaForEvolution: StructType =
+    MergeIntoTable.sourceSchemaForSchemaEvolution(this)
+
+  lazy val needSchemaEvolution: Boolean = {

Review Comment:
   I think the rule `ResolveMergeIntoSchemaEvolution` should be triggered as 
long as `MergeIntoTable#schemaEvolutionEnabled` is true. These complicated 
logic should be moved into `ResolveMergeIntoSchemaEvolution` and the rule 
returns the merge command unchanged if schema evolution is not needed.
   
   To make `ResolveMergeIntoSchemaEvolution` more reliable about rule orders, 
we should wait for the merge assignment values to be resolved before entering 
the rule. At the beginning of the rule, resolve the merge assignment keys again 
to make sure rule order does not matter. We can stop earlier if the assignment 
values are not pure field reference.



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