You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "eejbyfeldt (via GitHub)" <gi...@apache.org> on 2024/09/21 09:23:05 UTC
[I] Incorrect results when using grouping sets with data containing nulls [datafusion]
eejbyfeldt opened a new issue, #12570:
URL: https://github.com/apache/datafusion/issues/12570
### Describe the bug
When doing a grouping set on columns with null values we produce the incorrect result.
### To Reproduce
Run the following in query in datafusion-cli
```
> CREATE TABLE integers_with_nulls (value INT) as VALUES (1), (NULL);
0 row(s) fetched.
Elapsed 0.016 seconds.
> SELECT value, min(value) FROM integers_with_nulls GROUP BY CUBE(value);
+-------+--------------------------------+
| value | min(integers_with_nulls.value) |
+-------+--------------------------------+
| 1 | 1 |
| | 1 |
+-------+--------------------------------+
```
### Expected behavior
The expected bevahior is that the null in the data creates a different group from the nulls from the grouping set. The exected results are
```
> SELECT value, min(value) FROM integers_with_nulls GROUP BY CUBE(value);
+-------+--------------------------------+
| value | min(integers_with_nulls.value) |
+-------+--------------------------------+
| 1 | 1 |
| | 1 |
| | |
+-------+--------------------------------+
```
This is the behavior in PostgresSQL, Spark and DuckDB (and most likely other query engines).
### 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