Skip to content

[GLUTEN-12174][CH] Fix flatten nullable inner array row handling#12175

Merged
zzcclp merged 1 commit into
mainfrom
bug_array_flatten_null_rows
May 29, 2026
Merged

[GLUTEN-12174][CH] Fix flatten nullable inner array row handling#12175
zzcclp merged 1 commit into
mainfrom
bug_array_flatten_null_rows

Conversation

@lgbo-ustc
Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

SparkArrayFlatten handled Array(Nullable(Array(T))) by scanning all nested inner arrays and returning a fully-null result column as soon as any inner array was null. That made unrelated rows null, even though Spark flatten semantics only null the outer row that contains a null inner array.

Build a result null map per outer row, mark only rows containing null inner arrays as null, and keep non-null rows using the flattened array offsets. Add a ClickHouse backend regression test where the first row contains a null inner array and the second row remains non-null.

closed #12174

How was this patch tested?

UTs

Was this patch authored or co-authored using generative AI tooling?

co-authored using generative AI tooling

SparkArrayFlatten handled Array(Nullable(Array(T))) by scanning all nested inner arrays and returning a fully-null result column as soon as any inner array was null. That made unrelated rows null, even though Spark flatten semantics only null the outer row that contains a null inner array.

Build a result null map per outer row, mark only rows containing null inner arrays as null, and keep non-null rows using the flattened array offsets. Add a ClickHouse backend regression test where the first row contains a null inner array and the second row remains non-null.
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Copy link
Copy Markdown
Contributor

@zzcclp zzcclp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zzcclp zzcclp merged commit b8bb3b2 into main May 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CH] Fix flatten nullable inner array row handling

2 participants