AngersZhuuuu commented on a change in pull request #28107: [SPARK-31334][SQL] 
Don't ResolveReference/ResolveMissingReference when Filter condition with 
aggregate expression
URL: https://github.com/apache/spark/pull/28107#discussion_r403061139
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -1391,11 +1391,30 @@ class Analyzer(
               notMatchedActions = newNotMatchedActions)
         }
 
+      case f @ Filter(cond, _) if containsAggregate(cond) => f
       case q: LogicalPlan =>
         logTrace(s"Attempting to resolve 
${q.simpleString(SQLConf.get.maxToStringFields)}")
+        //        q.mapExpressions { e =>
+        //          q match {
+        //            case _: Filter if containsAggregate(e) =>
+        //              e
+        //            case _ =>
+        //              resolveExpressionTopDown(e, q)
+        //          }
+        //        }
         q.mapExpressions(resolveExpressionTopDown(_, q))
     }
 
+    def containsAggregate(e: Expression): Boolean = {
 
 Review comment:
   > why can't we reuse `ResolveAggregateFunctions.containsAggregate`?
   
   Since here function is still UnresolvedFunction, we can't just reuse this.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to