`make_array` should support pure null array
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
DataFusion supports now heterogeneous arrays (i.e. containing `NULL` with another data type), but does not support pure null array.
### To Reproduce
DataFusion:
```
❯ select make_array(NULL, NULL, NULL);
+----------------------------+
| make_array(NULL,NULL,NULL) |
+----------------------------+
| [] |
+----------------------------+
```
```
❯ select make_array(NULL, 1, NULL, 2, NULL);
+----------------------------------------------+
| make_array(NULL,Int64(1),NULL,Int64(2),NULL) |
+----------------------------------------------+
| [, 1, , 2, ] |
+----------------------------------------------+
```
### Expected behavior
The output should be equal like in other databases (DuckDB, ClickHouse, PostgreSQL):
DuckDB:
```
D select list_value(NULL, NULL, NULL);
┌──────────────────────────────┐
│ list_value(NULL, NULL, NULL) │
│ int32[] │
├──────────────────────────────┤
│ [NULL, NULL, NULL] │
└──────────────────────────────┘
```
```
D select list_value(NULL, 1, NULL, 2, NULL);
┌────────────────────────────────────┐
│ list_value(NULL, 1, NULL, 2, NULL) │
│ int32[] │
├────────────────────────────────────┤
│ [NULL, 1, NULL, 2, NULL] │
└────────────────────────────────────┘
```
ClickHouse:
```
SELECT [NULL, NULL, NULL]
Query id: fe6008c8-7d4c-4c1e-96c4-852c900e5530
┌─[NULL, NULL, NULL]─┐
│ [NULL,NULL,NULL] │
└────────────────────┘
1 row in set. Elapsed: 0.001 sec.
```
```
SELECT [NULL, 1, NULL, 2, NULL]
Query id: 24391d20-dc13-4624-9df1-befb01edab4a
┌─[NULL, 1, NULL, 2, NULL]─┐
│ [NULL,1,NULL,2,NULL] │
└──────────────────────────┘
1 row in set. Elapsed: 0.001 sec.
```
PostgreSQL:
```
postgres=# select array[NULL, NULL, NULL];
array
------------------
{NULL,NULL,NULL}
(1 row)
```
```
postgres=# select array[NULL, 1, NULL, 2, NULL];
array
----------------------
{NULL,1,NULL,2,NULL}
(1 row)
```
### Additional context
_No response_
Contributor guide
Research direction
Start by locating the make_array implementation and its existing tests in DataFusion, then reproduce both the all-NULL and mixed NULL/non-NULL queries. Update the behavior so pure NULL inputs preserve their elements, and add or adjust tests covering the expected array results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100