Skip to content

Incorrect results of aggregation with grouping sets with single target partition #16965

Closed

Description

@mpurins-coralogix

Describe the bug

When datafusion.execution.target_partitions is set to 1 then following query gives incorrect results -- select id from (select 'id' as id union all select 'id' as id order by id) group by grouping sets ((id), ());

To Reproduce

Run following in datafusion-cli

DataFusion CLI v49.0.0
> set datafusion.execution.target_partitions = 1;
0 row(s) fetched.
Elapsed 0.013 seconds.

> select id from (select 'id' as id union all select 'id' as id order by id) group by grouping sets ((id), ());
+------+
| id   |
+------+
| id   |
| NULL |
| id   |
+------+
3 row(s) fetched.
Elapsed 0.016 seconds.

Expected behavior

Query should give following result

+------+
| id   |
+------+
| id   |
| NULL |
+------+

Additional context

Postgres gives following

psql (17.5 (Homebrew))
Type "help" for help.

postgres=# select id from (select 'id' as id union all select 'id' as id) group by grouping sets ((id), ());
 id
----

 id
(2 rows)

Activity

  1. chenkovsky commented on Jul 30, 2025

    @chenkovsky
    Contributor

    take

  2. added a commit that references this issue on Oct 30, 2026
    5f5418e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions