mpurins opened a new issue, #15734: URL: https://github.com/apache/datafusion/issues/15734
### Describe the bug Hello, it seems that there is inconsistent behaviour for select queries with group by on constant when there are no input rows. When I have no aggregation functions then result of such query is empty, but as soon as I add some aggregation function I get single row result. ### To Reproduce Run following query in datafusion-cli ``` > select 'wat' as key, count(1) as count from (select * from unnest(array[]::text[])) as b(field) group by key; +-----+-------+ | key | count | +-----+-------+ | wat | 0 | +-----+-------+ 1 row(s) fetched. Elapsed 0.004 seconds. ``` ### Expected behavior Empty result ### Additional context Query with no aggregation functions gives empty result ``` DataFusion CLI v46.0.1 > select 'wat' as key from (select * from unnest(array[]::text[])) as b(field) group by key; +-----+ | key | +-----+ +-----+ 0 row(s) fetched. Elapsed 0.004 seconds. ``` Postgres gives empty results in both cases ``` psql (17.4 (Homebrew)) Type "help" for help. postgres=# select 'wat' as key from (select * from unnest(array[]::text[])) as b(field) group by key; key ----- (0 rows) postgres=# select 'wat' as key, count(1) as count from (select * from unnest(array[]::text[])) as b(field) group by key; key | count -----+------- (0 rows) ``` -- 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