shivadarshan-devadiga commented on code in PR #60756:
URL: https://github.com/apache/spark/pull/60756#discussion_r4651835709
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -712,7 +712,8 @@ case class Union(
!(byName || allowMissingCol) &&
childrenResolved &&
allChildrenCompatible &&
- (!conf.unionIsResolvedWhenDuplicatesPerChildResolved ||
duplicatesResolvedPerBranch)
+ (!conf.unionIsResolvedWhenDuplicatesPerChildResolved ||
duplicatesResolvedPerBranch) &&
+ SetOperationCharPadding.isAligned(children)
Review Comment:
Thanks, fixed. `SetOperationCharPadding.isAligned` now checks the CHAR
lengths only during analysis (`AnalysisHelper.isInAnalyzer`, a new accessor for
the existing `inAnalyzer` thread-local), and is true otherwise. Only analysis
pads the children, so an optimizer rule such as `PushProjectionThroughUnion`,
which can give the children different metadata again, no longer makes the union
unresolved. The set-operations test has your example: a union of two CHAR(5)
tables with a projection that has explicit `char(10)` metadata runs and returns
its rows.
--
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]