You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2024/08/02 15:24:01 UTC

[I] Aggregate SQL query with filter not working in datafusion CLI [datafusion]

2010YOUY01 opened a new issue, #11783:
URL: https://github.com/apache/datafusion/issues/11783

   ### Describe the bug
   
   Aggregate function with filter is supported, see this [testcase](https://github.com/apache/datafusion/blob/0332eb569a5428ac385fe892ce7b5fb40d52c8c0/datafusion/sqllogictest/test_files/aggregate.slt#L4246-L4256)
   But the same query can't run in datafusion-cli
   ```
   DataFusion CLI v40.0.0
   > CREATE TABLE test_table (c1 INT, c2 INT, c3 INT);
   0 row(s) fetched.
   Elapsed 0.115 seconds.
   
   > INSERT INTO test_table VALUES
     (1, 10, 50),
     (1, 20, 60),
     (2, 10, 70),
     (2, 20, 80),
     (3, 10, NULL);
   +-------+
   | count |
   +-------+
   | 5     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.064 seconds.
   
   > SELECT c1, SUM(c2) FILTER (WHERE c2 >= 20), SUM(c2) FILTER (WHERE c2 < 1) FROM test_table GROUP BY c1;
     🤔 Invalid statement: sql parser error: Expected end of statement, found: (
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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-unsubscribe@datafusion.apache.org.apache.org

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


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


Re: [I] Aggregate SQL query with filter not working in datafusion CLI [datafusion]

Posted by "haohuaijin (via GitHub)" <gi...@apache.org>.
haohuaijin commented on issue #11783:
URL: https://github.com/apache/datafusion/issues/11783#issuecomment-2268074180

   For an aggregate function with a filter, you should enable PostgreSQL dialect by using `set datafusion.sql_parser.dialect = 'Postgres';`


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [I] Aggregate SQL query with filter not working in datafusion CLI [datafusion]

Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 commented on issue #11783:
URL: https://github.com/apache/datafusion/issues/11783#issuecomment-2268950476

   > For an aggregate function with a filter, you should enable PostgreSQL dialect by using `set datafusion.sql_parser.dialect = 'Postgres';`
   
   I see, thank you


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [I] Aggregate SQL query with filter not working in datafusion CLI [datafusion]

Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 closed issue #11783: Aggregate SQL query with filter not working in datafusion CLI
URL: https://github.com/apache/datafusion/issues/11783


-- 
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-unsubscribe@datafusion.apache.org

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


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