`flatten` mishandles NULL values with non-empty offset ranges
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
See #25222, #25223, #25210 for related bugs.
### To Reproduce
```sql
CREATE TABLE t AS VALUES ([1,2,3], [1,2,3], 1), ([4,5,6], [7], 2);
CREATE VIEW v AS SELECT column3 AS id, column1 AS l, NULLIF(column1, column2) AS nl FROM t;
SELECT id, flatten(array_append([[9]], nl)) FROM v ORDER BY id;
-- row 1: [9, 1, 2, 3] expected [9]
SELECT id, array_agg(nl) AS agg, flatten(array_agg(nl)) FROM v GROUP BY id ORDER BY id;
-- row 1: agg = [NULL], flatten = [1, 2, 3] expected []
SELECT flatten([arrow_cast([1,2,3], 'FixedSizeList(3, Int64)'), arrow_cast(NULL, 'FixedSizeList(3, Int64)')]);
-- [1, 2, 3, NULL, NULL, NULL] expected [1, 2, 3]
```
### Expected behavior
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.