Skip to content

fix: ensure nullable binary arrays return boxed type arrays instead of Object[]#2920

Open
kishansinghifs1 wants to merge 1 commit into
ClickHouse:mainfrom
kishansinghifs1:fix-nullable-binary-arrays
Open

fix: ensure nullable binary arrays return boxed type arrays instead of Object[]#2920
kishansinghifs1 wants to merge 1 commit into
ClickHouse:mainfrom
kishansinghifs1:fix-nullable-binary-arrays

Conversation

@kishansinghifs1

Copy link
Copy Markdown

Summary

BinaryStreamReader.readArrayItem used Object.class as the element type for all nullable array columns, so Array(Nullable(Float64)) returned Object[] instead of Double[]. This splits the nullable check from the Variant/Dynamic/Geometry fallback and derives the correct boxed wrapper class via getObjectClass(). Added unit test to verify the component type is Double.class for Array(Nullable(Float64)).

Closes : #2846

Checklist

Delete items not relevant to your PR:

@github-actions

Copy link
Copy Markdown

Repository collaborators can run the JMH benchmark suite against this PR by commenting:

/benchmark

Optional regression threshold override (Δ% on Time or Alloc/op; defaults to 10%):

/benchmark threshold=15

Only one benchmark run per PR is active at a time — issuing a new /benchmark comment cancels the previous run. After the run finishes a separate comment will be posted comparing it against the latest scheduled run on main; the PR check fails if any benchmark regresses by more than the threshold.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 24530a7. Configure here.

array = new ArrayValue(itemClass == null ? Object.class : itemClass, len);
for (int i = 0; i < len; i++) {
array.set(i, readValue(itemTypeColumn));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nullable Variant breaks Object fallback

High Severity

The new nullable branch in readArrayItem determines array component types using itemTypeColumn.getDataType().getObjectClass(). This can mismatch the actual Java types returned by readValue for nullable Variant, unsigned, and Enum types, causing Array.set to fail with IllegalArgumentException during row decoding.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 24530a7. Configure here.

@chernser

Copy link
Copy Markdown
Contributor

@kishansinghifs1

Thank you for the contribution!

I will review next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BinaryStreamReader.ArrayValue wrong return type

2 participants