alamb opened a new issue, #5007:
URL: https://github.com/apache/arrow-datafusion/issues/5007
**Describe the bug**
Calling the `avg` function with all null values should be null, not 0
**To Reproduce**
with `datafusion-cli`
```sql
❯ create table foo as values (null::bigint, 1);
0 rows in set. Query took 0.002 seconds.
❯ select avg(column1) from foo group by column2;
+------------------+
| AVG(foo.column1) |
+------------------+
| 0 |
+------------------+
```
**Expected behavior**
`AVG` of all nulls should be null
```sql
postgres=# create table foo as values (null::bigint, 1);
SELECT 1
postgres=# select avg(column1) from foo group by column2;
avg
-----
(1 row)
```
**Additional context**
Found when upgrading IOx in
https://github.com/influxdata/influxdb_iox/pull/6639
I think the issue is that there was a bug in the Row evaluator that was not
being used until after https://github.com/apache/arrow-datafusion/pull/4924 was
merged
I have a fix and will get it up shortly
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]