mohammadnaqvi04 commented on code in PR #25391:
URL: https://github.com/apache/datafusion/pull/25391#discussion_r4328556980


##########
datafusion/optimizer/src/decorrelate.rs:
##########
@@ -426,6 +433,50 @@ impl TreeNodeRewriter for PullUpCorrelatedExpr {
                     None
                 };
 
+                if self.exists_sub_query
+                    && self.pull_up_having_expr.is_some()
+                    && let Some(expr) = conjunction(subquery_filters.clone())
+                {
+                    let unqualified_expr = expr

Review Comment:
   Thanks for catching this, fixed. This now requalifies every column in 
`pull_up_having_expr` with the alias at the top of `build_join_with_count_bug`. 
Verified against your repro, now returns `1, 3`.



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