jonahgao commented on code in PR #11897:
URL: https://github.com/apache/datafusion/pull/11897#discussion_r1711677343


##########
datafusion/sql/src/select.rs:
##########
@@ -778,9 +777,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         // Rewrite the HAVING expression to use the columns produced by the
         // aggregation.
         let having_expr_post_aggr = if let Some(having_expr) = having_expr_opt 
{
-            let having_expr_post_aggr =
-                rebase_expr(having_expr, &aggr_projection_exprs, input)?;
-
+            let having_expr_post_aggr = match having_expr {
+                Expr::Literal(ScalarValue::Boolean(Some(false))) => {
+                    having_expr.to_owned()

Review Comment:
   Can it fix for other constant expressions 🤔, such as
   ```sql
   SELECT AVG(v1) FROM t1 GROUP BY 1 != 1 having 1 != 1;
   ```
   Looks like this is also an issue related to PushdownFilter.



-- 
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: github-unsubscr...@datafusion.apache.org

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


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

Reply via email to