Repository navigation
Fix NULL handling for Variant/Dynamic - #2817
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses RowBinary NULL-handling edge cases for Variant and Dynamic columns in the client-v2 serializer/reader, matching ClickHouse’s on-wire encoding (notably the 0xFF Variant NULL discriminator and defaults-protocol preambles).
Changes:
- Fix
Variantdecoding to treat discriminator0xFFasNULLand read the discriminator as unsigned. - Fix
DynamicNULL serialization underRowBinaryWithDefaultsby always writing the required “no default” preamble byte. - Add unit/integration tests covering
Variant(NULL)reads andDynamic(NULL)writes with defaults and POJO mapping.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java | Reads Variant discriminator as unsigned and returns null on 0xFF. |
| client-v2/src/main/java/com/clickhouse/client/api/data_formats/RowBinaryFormatSerializer.java | Writes the required defaults-protocol preamble byte for Dynamic when value is null. |
| client-v2/src/test/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReaderTests.java | Adds unit test ensuring 0xFF Variant discriminator yields null. |
| client-v2/src/test/java/com/clickhouse/client/internal/SerializerUtilsTests.java | Adds unit test validating Dynamic(null) with defaults writes the preamble + Nothing tag bytes. |
| client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java | Adds integration regressions for Variant(NULL) and Dynamic(NULL) with defaults + POJO scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
Member
|
@codex[agent] review |
Restored empty-password handling for basic auth and re-enabled the coverage in 246ce9f. |
chernser
force-pushed
the
03/31/26/fix_null_values
branch
from
April 2, 2026 17:18
246ce9f to
70c0c33
Compare
|
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
0for notNull preamble of Dynamic with defaults and handles Variant0xFFas NULLCloses: #2789
Closes: #2791
Checklist
Delete items not relevant to your PR: