You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/10/17 05:06:59 UTC

[I] `WITHIN GROUP` needs to be more strict [datafusion]

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

   ### Describe the bug
   
   This should not work:
   
   ```sql
   > select sum(num) within group (order by num) from '/Users/jeffrey/Downloads/test.csv';
   +------------------------------------------------------------------------------------------------------------+
   | sum(/Users/jeffrey/Downloads/test.csv.num) ORDER BY [/Users/jeffrey/Downloads/test.csv.num ASC NULLS LAST] |
   +------------------------------------------------------------------------------------------------------------+
   | 750                                                                                                        |
   +------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched.
   Elapsed 0.011 seconds.
   ```
   
   `WITHIN GROUP` should be allowed only for ordered set aggregate functions (see #12824)
   
   Postgres for reference:
   
   ```sql
   postgres=# select sum(salary) within group (order by salary) from employees;
   ERROR:  function sum(numeric, numeric) does not exist
   LINE 1: select sum(salary) within group (order by salary) from emplo...
                  ^
   HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
   postgres=# select sum() within group (order by salary) from employees;
   ERROR:  sum is not an ordered-set aggregate, so it cannot have WITHIN GROUP
   LINE 1: select sum() within group (order by salary) from employees;
   ```
   
   ### 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] `WITHIN GROUP` needs to be more strict [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #18109: `WITHIN GROUP` needs to be more strict
URL: https://github.com/apache/datafusion/issues/18109


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