cloud-fan commented on code in PR #52866:
URL: https://github.com/apache/spark/pull/52866#discussion_r2511296977
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1691,18 +1701,31 @@ class Analyzer(override val catalogManager:
CatalogManager) extends RuleExecutor
UpdateAction(
resolvedUpdateCondition,
// The update value can access columns from both target and
source tables.
- resolveAssignments(assignments, m, MergeResolvePolicy.BOTH))
+ resolveAssignments(assignments, m, MergeResolvePolicy.BOTH,
+ throws = throws))
case UpdateStarAction(updateCondition) =>
- // Use only source columns. Missing columns in target will be
handled in
- // ResolveRowLevelCommandAssignments.
- val assignments = targetTable.output.flatMap{ targetAttr =>
- sourceTable.output.find(
- sourceCol => conf.resolver(sourceCol.name,
targetAttr.name))
- .map(Assignment(targetAttr, _))}
+ // Expand star to top level source columns. If source has
less columns than target,
+ // assignments will be added by
ResolveRowLevelCommandAssignments later.
+ val assignments = if (m.schemaEvolutionEnabled) {
+ // For schema evolution case, generate assignments for
missing target columns.
+ // These columns will be added by
ResolveMergeIntoTableSchemaEvolution later.
+ sourceTable.output.map(sourceAttr =>
+ findAttrInTarget(sourceAttr.name).map(
Review Comment:
```
val key =
findAttrInTarget(sourceAttr.name).getOrElse(UnresolvedAttribute(sourceAttr.name))
Assignment(key, ...)
```
--
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]