agubichev commented on code in PR #47388:
URL: https://github.com/apache/spark/pull/47388#discussion_r1690160319
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -905,26 +905,29 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog with QueryErrorsB
// SPARK-18504/SPARK-18814: Block cases where GROUP BY columns
// are not part of the correlated columns.
- // Note: groupByCols does not contain outer refs - grouping by an outer
ref is always ok
- val groupByCols =
AttributeSet(agg.groupingExpressions.flatMap(_.references))
- // Collect the inner query attributes that are guaranteed to have a
single value for each
- // outer row. See comment on getCorrelatedEquivalentInnerColumns.
- val correlatedEquivalentCols = getCorrelatedEquivalentInnerColumns(query)
- val nonEquivalentGroupByCols = groupByCols -- correlatedEquivalentCols
+ // Collect the inner query expressions that are guaranteed to have a
single value for each
+ // outer row. See comment on getCorrelatedEquivalentInnerExpressions.
+ val correlatedEquivalentExprs =
getCorrelatedEquivalentInnerExpressions(query)
+ // Unlike 'groupByCols', preserve the entire grouping expression.
Review Comment:
nice! just rephrased the comment
--
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]