vladimirg-db commented on code in PR #50410:
URL: https://github.com/apache/spark/pull/50410#discussion_r2018428695


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2804,44 +2809,51 @@ class Analyzer(override val catalogManager: 
CatalogManager) extends RuleExecutor
    * and group by expressions from them.
    */
   object ResolveAggregateFunctions extends Rule[LogicalPlan] {
-    def apply(plan: LogicalPlan): LogicalPlan = 
plan.resolveOperatorsUpWithPruning(
-      _.containsPattern(AGGREGATE), ruleId) {
-      case UnresolvedHaving(cond, agg: Aggregate) if agg.resolved && 
cond.resolved =>
-        resolveOperatorWithAggregate(Seq(cond), agg, (newExprs, newChild) => {
-          val newCond = newExprs.head
-          if (newCond.resolved) {
-            Filter(newCond, newChild)
-          } else {
-            // The condition can be unresolved after the resolution, as we may 
mark
-            // `TempResolvedColumn` as unresolved if it's not aggregate 
function inputs or grouping
-            // expressions. We should remain `UnresolvedHaving` as the rule 
`ResolveReferences` can
-            // re-resolve `TempResolvedColumn` and `UnresolvedHaving` has a 
special column
-            // resolution order.
-            UnresolvedHaving(newCond, newChild)
-          }
-        })
+    def apply(plan: LogicalPlan): LogicalPlan = {

Review Comment:
   Good point, done



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

Reply via email to