findepi opened a new issue, #16515:
URL: https://github.com/apache/datafusion/issues/16515

   ### Describe the bug
   
   When parsing an array_agg with Postgres dialect, one can specify ordering of 
values within group. 
   The syntax is accepted but apparently takes no effect on the aggregation 
being executed.
   
   At the very least syntax should be rejected as unsupported (then this 
becomes a missing feature), or be supported.
   
   ### To Reproduce
   
   Here the expected values were created with `cargo test --test sqllogictests 
-- aggregate.slt --complete`, showing the bug
   
   ```
   statement ok
   set datafusion.sql_parser.dialect = 'Postgres';
   
   query ?
   SELECT array_agg(a_varchar) within group (order by a_varchar)
   FROM (VALUES ('a'), ('d'), ('c'), ('a')) t(a_varchar);
   ----
   [a, d, c, a]
   
   query ?
   SELECT array_agg(DISTINCT a_varchar) within group (order by a_varchar)
   FROM (VALUES ('a'), ('d'), ('c'), ('a')) t(a_varchar);
   ----
   [d, a, c]
   ```
   
   ### Expected behavior
   
   ```
   statement ok
   set datafusion.sql_parser.dialect = 'Postgres';
   
   query ?
   SELECT array_agg(a_varchar) within group (order by a_varchar)
   FROM (VALUES ('a'), ('d'), ('c'), ('a')) t(a_varchar);
   ----
   [a, a, c, d]
   
   query ?
   SELECT array_agg(DISTINCT a_varchar) within group (order by a_varchar)
   FROM (VALUES ('a'), ('d'), ('c'), ('a')) t(a_varchar);
   ----
   [a, c, d]
   ```
   
   ### 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-unsubscr...@datafusion.apache.org.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