apache / apache/datafusion

unexpected output for `concat` for arrays

Open
#18,020 15 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Describe the bug

`concat` builtin in function should concat arrays like `array_concat`, currently the output is wrong

```
> select concat(make_array(1, 2, 3), make_array(4, 5));
+------------------------------------------------------------------------------+
| concat(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5))) |
+------------------------------------------------------------------------------+
| [1, 2, 3][4, 5] |
+------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.012 seconds.

> select array_concat(make_array(1, 2, 3), make_array(4, 5));
+------------------------------------------------------------------------------------+
| array_concat(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5))) |
+------------------------------------------------------------------------------------+
| [1, 2, 3, 4, 5] |
+------------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.014 seconds.

```

`concat` for array should return same as `array_concat`

### To Reproduce

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the concat and array_concat function entry points in DataFusion and compare the array behavior shown in the reproduction. Add or update coverage for concat(make_array(1, 2, 3), make_array(4, 5)) so its result matches array_concat and returns [1, 2, 3, 4, 5].

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.