Lstarsky0 commented on issue #10781:
URL: https://github.com/apache/arrow-rs/issues/10781#issuecomment-5383833586
Reproduced, and it is narrower than the title suggests — it needs two or
more arrays that are *all* empty:
```rust
let empty = || RunArray::try_new(
&Int32Array::from(Vec::<i32>::new()),
&Int32Array::from(Vec::<i32>::new()),
).unwrap();
concat(&[&empty()]) // Ok(0)
concat(&[&empty(), &empty()]) // Err
concat(&[&empty(), &nonempty()]) // Ok(4)
```
```
PROBE one empty: Ok(0)
PROBE two empties: Err(ComputeError("concat requires input of at least one
array"))
PROBE empty+nonempty: Ok(4)
```
A single array never reaches `concat_run_arrays` — `concat` short-circuits
at `arrays.len() == 1` and returns a slice. One empty alongside a non-empty is
fine because the filter at `concat.rs:424` drops it and one survives.
The mechanism is the other way round from the description: the empty arrays
are not passed into `concat`, they are filtered out by that same line, and it
is the resulting *empty slice* that `concat` rejects at `concat.rs:458`.
That distinction matters for the fix. `concat` cannot accept the empty slice
— it has no data type to build a result from. The early return has to be in
`concat_run_arrays`, and its data type has to come from `arrays[0]` rather than
`run_arrays[0]`, which is empty in exactly this case.
There is also a second landmine two lines later: `run_arrays[0].data_type()`
at `concat.rs:460` panics on the same input. Today `?` on line 458 returns
first, so a fix that only makes line 458 tolerate an empty slice would turn the
error into a panic.
`concat_dictionaries` does not have this shape — it has no filter, so it
never ends up with fewer arrays than it started with.
--
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]