Skip to content

[GLUTEN-12169][CH] Fix str_to_map nullable input null-map access#12170

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

[GLUTEN-12169][CH] Fix str_to_map nullable input null-map access#12170
zzcclp merged 1 commit into
mainfrom
bug_12169

Conversation

@lgbo-ustc
Copy link
Copy Markdown
Contributor

@lgbo-ustc lgbo-ustc commented May 28, 2026

What changes are proposed in this pull request?

SparkFunctionStrToMap iterates rows with index i, but the nullable string path checked null_map[n], where n is offsets.size(). For any non-empty nullable input this reads one element past the null map and can produce an incorrect null decision, undefined behavior, or a crash.

Use the current row index when reading the nullable null map. Add a ClickHouse backend regression test that evaluates str_to_map over a nullable string expression containing both null and non-null rows, then compares the result with vanilla Spark.

closed #12169

How was this patch tested?

UT

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

co-authored using generative AI tooling

SparkFunctionStrToMap iterates rows with index i, but the nullable string path checked null_map[n], where n is offsets.size(). For any non-empty nullable input this reads one element past the null map and can produce an incorrect null decision, undefined behavior, or a crash.

Use the current row index when reading the nullable null map. Add a ClickHouse backend regression test that evaluates str_to_map over a nullable string expression containing both null and non-null rows, then compares the result with vanilla Spark.
@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 ed8af63 into main May 29, 2026
9 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] undefined behavior, or a crash in SparkFunctionStrToMap

2 participants