pan3793 commented on code in PR #44352:
URL: https://github.com/apache/spark/pull/44352#discussion_r1427525939


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala:
##########
@@ -323,12 +323,14 @@ trait ColumnResolutionHelper extends Logging with 
DataTypeErrorsBase {
   }
 
   // Resolves `UnresolvedAttribute` to `TempResolvedColumn` via 
`plan.child.output` if plan is an
-  // `Aggregate`. If `TempResolvedColumn` doesn't end up as aggregate function 
input or grouping
-  // column, we will undo the column resolution later to avoid confusing error 
message. E,g,, if
+  // `Aggregate` or `Filter(_, Aggregate)`.
+  // If `TempResolvedColumn` doesn't end up as aggregate function input or 
grouping
+  // column, we will undo the column resolution later to avoid confusing error 
message. E.g., if
   // a table `t` has columns `c1` and `c2`, for query `SELECT ... FROM t GROUP 
BY c1 HAVING c2 = 0`,
   // even though we can resolve column `c2` here, we should undo it and fail 
with
   // "Column c2 not found".
   protected def resolveColWithAgg(e: Expression, plan: LogicalPlan): 
Expression = plan match {
+    case Filter(_, agg: Aggregate) => resolveColWithAgg(e, agg)

Review Comment:
   Thanks, changed as suggested



-- 
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: reviews-unsubscr...@spark.apache.org

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