alamb commented on code in PR #16066:
URL: https://github.com/apache/datafusion/pull/16066#discussion_r2237680006


##########
datafusion/sqllogictest/test_files/aggregate.slt:
##########
@@ -690,6 +690,31 @@ SELECT c2, var_samp(c12) FILTER (WHERE c12 > 0.95) FROM 
aggregate_test_100 GROUP
 4 NULL
 5 NULL
 
+statement ok
+CREATE TABLE t (
+  a DOUBLE,
+  b BIGINT,
+  c INT
+) AS VALUES
+(1.0, 10, -5),
+(2.0, 20, -5),
+(3.0, 20, 4);
+
+# https://github.com/apache/datafusion/issues/15291

Review Comment:
   Nm, I can get it to reproduce like this
   
   ```sql
   > set datafusion.sql_parser.dialect = 'postgres';
   0 row(s) fetched.
   Elapsed 0.000 seconds.
   
   > CREATE TABLE t (
     a DOUBLE,
     b BIGINT,
     c INT
   ) AS VALUES
   (1.0, 10, -5),
   (2.0, 20, -5),
   (3.0, 20, 4);
   0 row(s) fetched.
   Elapsed 0.002 seconds.
   
   > WITH s AS (
       SELECT
           COUNT(a) FILTER (WHERE (b * b) - 3600 <= b),
        COUNT(a) FILTER (WHERE (b * b) - 3000 <= b AND (c >= 0)),
        COUNT(a) FILTER (WHERE (b * b) - 3000 <= b AND (c >= 0) AND (c >= 0))
       FROM t
   ) SELECT * FROM s
   ;
   Optimizer rule 'common_sub_expression_eliminate' failed
   caused by
   Schema error: No field named "count(t.a) FILTER (WHERE t.b * t.b - 
Int64(3600) <= t.b)". Did you mean 'count(t.a) FILTER (WHERE __common_expr_1 AS 
t.b * t.b - Int64(3600) <= t.b)'?.
   ```



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