Repository navigation
[client-v2] Native reader: decode Int8, strided, Nullable and Array QBit columns - #3403
Open
polyglotAI-bot wants to merge 1 commit into
Open
polyglotAI-bot wants to merge 1 commit into
polyglotAI-bot wants to merge 1 commit into
Conversation
…Bit columns The Native reader decoded only a plain QBit(Float32|Float64|BFloat16, N) and rejected the other QBit columns. It now also decodes QBit(Int8, N), strided QBit(E, N, S) (element_size bit planes for each of the N / S stride groups, group after group), Nullable(QBit), Array(QBit) and Array(Nullable(QBit)), to the same values as the RowBinary readers. Implements: #2980 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on b61f2ea. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2980
The
Nativereader now decodes the QBit columns that it rejected before:QBit(Int8, N), stridedQBit(E, N, S),Nullable(QBit(...)),Array(QBit(...))andArray(Nullable(QBit(...))). Each value is the same as overRowBinaryWithNamesAndTypes(byte[]forInt8, and the same array class for anArrayrow).#2983 decoded only a plain
QBit(Float32|Float64|BFloat16, N). ClickHouse 26.7 added theInt8element type and the stride (ClickHouse/ClickHouse#108105, #108103). A strided column haselement_sizebit planes for each of itsN / Sstride groups, group after group, and each plane hasceil(S / 8)bytes per row (SerializationQBit::deserializeFloatsToQBit).BinaryStreamReader#readQBitNativereadselement_size * (N / S)planes and puts each group's elements atg * S + j. A stride that does not divideNgives aClientException.NativeFormatReaderreads the null map of aNullableQBit, and the offsets of a one-levelArrayof QBit, before the planes. AnArrayrow has the item class thatBinaryStreamReader#readArraygives overRowBinary.Tuple,Map,Variantor multi-levelArrayis still rejected with aClientException. The Native reader does not decode these containers column-major ([client-v2] Native format: nested columns (Tuple/Map/Nested/Variant, Array of Nullable/Array/LowCardinality) are decoded row-wise and misread #3156).LowCardinality(QBit)stays rejected; the server does not create this type.Compatibility
Additive. A column that failed with a
ClientExceptionis now read. No change for the QBit columns that were already decoded, or forRowBinaryformats. No public API change.Test
DataTypeTests#testQBitNativeFormatShapes(@DataProvider, 6 types:Int8, stridedFloat32andFloat64,Nullable(BFloat16)with a null row,Arraywith an empty row,Array(Nullable(Int8))): 3 rows between two fixed-width columns, with the expected values and the same Java array class overNativeand overRowBinaryWithNamesAndTypes. TheInt8and strided rows skip on servers before 26.7.BinaryStreamReaderTestsandNativeFormatReaderTest: the same shapes from Native bytes captured from server 26.10, so that the decode is also tested where the integration tests skip. Also a stride that does not divide the dimension, and the shapes that stay rejected.Int8, strided andNullableQBit moved from the rejected list to the decoded tests; the unsupported-element guard now usesQBit(Int16, 3).Checklist
history/latest/2980.md)docs/changes_checklist.md: binary read path (each value has the class of theRowBinaryread, also forNullableand emptyArrayrows; a fixed-width column after the QBit column in the tests); exception handling (the message of the existing rejection changes; newClientExceptions for an invalid stride and for decreasing array offsets);docs/features.mdanddocs/qbit-encoding.mdupdated🤖 Generated with Claude Code
Note
Medium Risk
Changes low-level Native block parsing for QBit; mis-decoding could desynchronize following columns, but behavior is additive with explicit rejection for unsupported shapes and broad golden-byte and integration tests.
Overview
The Native format reader no longer throws on several
QBitcolumn shapes that used to be rejected. It now decodesQBit(Int8|BFloat16|Float32|Float64, …), including strided types,Nullable(QBit(...)), and one-levelArray(QBit(...))/Array(Nullable(QBit(...))), returning the same Java values and array classes asRowBinaryWithNamesAndTypes.BinaryStreamReader#readQBitNativewas extended forInt8vectors, stride groups (group-major bit planes, stride must divide dimension), and updated rejection rules.NativeFormatReaderroutes throughreadQBitColumn(nullable null map first) andreadQBitArrayColumn(offsets then flattened QBit elements).Tuple, Map, Variant, multi-level Array, LowCardinality, and unsupported element types still fail with
ClientException. Docs, changelog, and unit/integration tests (including golden Native bytes from 26.10) were added or updated.Reviewed by Cursor Bugbot for commit b61f2ea. Bugbot is set up for automated code reviews on this repo. Configure here.