Issue - BinaryStreamReader.ArrayValue wrong return type
What problem is being solve ?
The problem is that BinaryStreamReader was treating every nullable array element as Object, so
Array(Nullable(Float64))and similar columns came back asObject[]nstead of a boxed numeric array likeDouble[]. That is a real user-visible type regression because callers that inspect the returned array type, component type, or rely on boxed element semantics see the wrong shape.
What user visible behavior will change?
When querying ClickHouse for columns containing arrays of nullable primitives (e.g.,
Array(Nullable(Float64)),Array(Nullable(Int32))), the v2 Java client will now return correctly typed boxed arrays (e.g.,Double[],Integer[]) instead ofObject[]. This fixes a regression where downstream applications relying on the specific component type could experience runtime cast exceptions or logic failures.
What is the compatability risk?
Very low
What test will prove the behaviour?
A new unit test
testNullableArrayValueUsesBoxedComponentTypewill be added toBinaryStreamReaderTests.java. The test mocks a binary stream containing anArray(Nullable(Float64))column and verifies that thecomponentTypeof the returned array object is exactlyDouble.class, rather than falling back toObject.class.
What documentation,CHANGELOG or doc/feature.md need to be change?
CHANGELOG.md
What is the proposed changes?
In
BinaryStreamReader.java'sreadArrayItemmethod, we updated the condition handling nullable element types. Previously, it blindly usedObject.classfor arrays containing nullable elements. We now correctly derive the boxed wrapper class usingitemTypeColumn.getDataType().getObjectClass(). For complex unstructured types (Variant,Dynamic,Geometry), it continues to gracefully useObject.classas intended.