cloud-fan commented on code in PR #52866:
URL: https://github.com/apache/spark/pull/52866#discussion_r2511282662
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveMergeIntoSchemaEvolution.scala:
##########
@@ -34,24 +35,104 @@ import
org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
object ResolveMergeIntoSchemaEvolution extends Rule[LogicalPlan] {
override def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
- case m @ MergeIntoTable(_, _, _, _, _, _, _)
- if m.needSchemaEvolution =>
+ // This rule should run only if all assignments are resolved, except those
+ // that will be satisfied by schema evolution
+ case m @ MergeIntoTable(_, _, _, _, _, _, _) if m.needSchemaEvolution =>
val newTarget = m.targetTable.transform {
- case r : DataSourceV2Relation => performSchemaEvolution(r,
m.sourceTable)
+ case r : DataSourceV2Relation => performSchemaEvolution(r, m)
}
- m.copy(targetTable = newTarget)
+
+ // Unresolve all references based on old target output
Review Comment:
This is tricky, I think we can just update their attribute ids? See
`QueryPlan#transformUpWithNewOutput`
--
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]