cloud-fan commented on a change in pull request #32470:
URL: https://github.com/apache/spark/pull/32470#discussion_r649223245



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -839,9 +839,7 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog {
     def checkMixedReferencesInsideAggregateExpr(expr: Expression): Unit = {
       expr.foreach {
         case a: AggregateExpression if containsOuter(a) =>
-          val outer = a.collect { case OuterReference(e) => e.toAttribute }
-          val local = a.references -- outer

Review comment:
       `Expression.references` doesn't count outer refs, so this is 
unnecessary. It can cause problems if the outer ref is the same as local ref 
(e.g. the outer query and inner query select from the same table)




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to