yaooqinn commented on code in PR #42453:
URL: https://github.com/apache/spark/pull/42453#discussion_r1291416529
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -1113,9 +1113,12 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog with QueryErrorsB
private def simplifyPlanForCollectedMetrics(plan: LogicalPlan): LogicalPlan
= {
plan.resolveOperators {
case p: Project if p.projectList.size == p.child.output.size =>
- val assignExprIdOnly = p.projectList.zip(p.child.output).forall {
- case (left: Alias, right: Attribute) =>
- left.child.semanticEquals(right) && right.name == left.name
+ val assignExprIdOnly = p.projectList.zipWithIndex.forall {
+ case (Alias(attr: AttributeReference, _), index) =>
+ // The input plan of this method is already canonicalized. The
attribute id becomes the
+ // ordinal of this attribute in the child outputs. So an
alias-only Project means the
+ // the id of the aliased attribute is the same as its index in the
project list.
Review Comment:
nit: duplicated `the` but might not be worth fixing
--
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]