szehon-ho commented on code in PR #52866:
URL: https://github.com/apache/spark/pull/52866#discussion_r2512494134


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -892,11 +892,40 @@ case class MergeIntoTable(
     case _ => false
   }
 
+  private lazy val sourceSchemaForEvolution: StructType =
+    MergeIntoTable.sourceSchemaForSchemaEvolution(this)
+
+  lazy val schemaChangesNonEmpty: Boolean =
+    MergeIntoTable.schemaChanges(targetTable.schema, 
sourceSchemaForEvolution).nonEmpty
+
   lazy val needSchemaEvolution: Boolean =
     schemaEvolutionEnabled &&
-      MergeIntoTable.schemaChanges(targetTable.schema, 
sourceTable.schema).nonEmpty
+      canEvaluateSchemaEvolution &&
+      schemaChangesNonEmpty

Review Comment:
   moved.  Actually future rules still need this condition to run only if no 
schema evolution needed, so keep the flag for those.  But simplified the 
ResovleMergeIntoSchemaEvolution condition



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