neilconway opened a new issue, #25948:
URL: https://github.com/apache/datafusion/issues/25948
### Describe the bug
`array_concat` fails on several kinds of nested-list arguments:
- **Non-default inner lists.** If the inner lists are `LargeList`, or the
inner list field has a non-default name, the query fails: the result's type
doesn't match the declared type.
- **All-NULL arguments.** If all arguments are NULL and have different
nesting depths, planning fails with an internal error.
- **Non-nullable inner elements.** If the inner list has non-nullable
elements and is concatenated with a one-dimensional array, the process panics.
The same queries work on lists with default inner fields.
### To Reproduce
```sql
CREATE TABLE t AS SELECT
make_array(arrow_cast([1, 2], 'LargeList(Int64)')) AS a,
arrow_cast([[1]], 'List(List(Int64, field: ''element''), field:
''element'')') AS b,
arrow_cast(make_array(make_array(1)), 'List(List(non-null Int64))') AS c;
SELECT array_concat(a, a) FROM t;
-- Arrow error: Invalid argument error: column types must match schema
types, expected List(List(Int64)) but found List(LargeList(Int64)) at column
index 0
SELECT array_concat(b, b) FROM t;
-- Arrow error: Invalid argument error: column types must match schema
types, expected List(List(Int64)) but found List(List(Int64, field: 'element'))
at column index 0
SELECT array_concat(arrow_cast(NULL, 'List(Int64)'), arrow_cast(NULL,
'List(List(Int64))'));
-- Optimizer rule 'optimize_projections' failed
-- caused by
-- Check optimizer-specific invariants after optimizer rule:
optimize_projections
-- caused by
-- Internal error: Assertion failed: compatible: Failed due to a difference
in schemas: ...
SELECT array_concat(c, make_array(2)) FROM t;
-- thread 'main' panicked at arrow-data-60.0.0/src/transform/mod.rs:464:13:
-- assertion `left == right` failed: Arrays with inconsistent types passed
to MutableArrayData
-- left: List(Field { data_type: Int64 })
-- right: List(Field { data_type: Int64, nullable: true })
```
In a debug build, the first three queries instead fail with `Internal error:
Assertion failed: result_data_type == *expected_type: Function 'array_concat'
returned value of type ... while the following type was promised at planning
time ...`. The last query panics in both builds.
### Expected behavior
All four queries succeed, as they do on lists with default inner fields:
- With `a` built as `make_array(make_array(1, 2))`, `array_concat(a, a)`
returns `[[1, 2], [1, 2]]`.
- With `c` built as `make_array(make_array(1))`, `array_concat(c,
make_array(2))` returns `[[1], [2]]`.
- Two NULL `List(List(Int64))` arguments return `NULL`.
### Additional context
Reproduced on `main` at commit 2b1fcae86, in both release and debug builds.
#22366 reports the same `MutableArrayData` panic in `make_array`.
*This bug report was generated by Claude.*
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]