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.

@chernser

Copy link
Copy Markdown
Contributor

@kishansinghifs1

Thank you for the contribution!

I will review next week.

@kishansinghifs1 kishansinghifs1 force-pushed the fix-nullable-binary-arrays branch from 24530a7 to 8d13865 Compare July 11, 2026 09:51

@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 8d13865. Configure here.

ArrayValue array;
if (itemTypeColumn.isNullable()
|| itemTypeColumn.getDataType() == ClickHouseDataType.Variant
if (itemTypeColumn.isNullable()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty nullable array typing

Medium Severity

When a nullable array has length zero, readArray still uses getPrimitiveClass (e.g. double for Float64) instead of the boxed types used in readArrayItem. The same column can yield primitive empty arrays but boxed non-empty arrays.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8d13865. Configure here.

@kishansinghifs1

Copy link
Copy Markdown
Author

Hiii @chernser,
thank you for the opportunity ,
no worries.

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