Repository navigation
Fix low_cardinality_allow_in_native_format=0 handling in parallel blocks marshalling - #107319
Merged
Merged
Conversation
…locks marshalling
With `enable_parallel_blocks_marshalling` enabled (the default) and
`low_cardinality_allow_in_native_format = 0`, distributed queries over
`LowCardinality` columns returned corrupted data or failed on the
initiator with:
Code: 33. DB::Exception: Cannot read all data. Bytes read: 1. Bytes expected: 4. (CANNOT_READ_ALL_DATA)
`convertColumnsToBLOBs` serialized columns into `ColumnBLOB` on the
remote replica using their actual types (e.g. `LowCardinality(String)`),
ignoring the setting. `NativeWriter::write` then applied
`recursiveRemoveLowCardinality` only to the type (it is a no-op for a
`ColumnBLOB` column) and announced the stripped type (`String`) on the
wire, so the initiator deserialized the `LowCardinality`-formatted blob
with the plain type's serialization.
Strip `LowCardinality` from the column before serializing it into the
blob, mirroring what `NativeWriter` does for regular columns.
Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
Workflow [PR], commit [2603a4d] Summary: ❌
AI ReviewSummaryThis PR fixes Missing context / blind spots
Final VerdictStatus: ✅ Approve |
nickitat
approved these changes
Jun 12, 2026
azat
enabled auto-merge
June 12, 2026 13:22
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 21/32 (65.62%) | Lost baseline coverage: none · Uncovered code |
Merged
via the queue into
ClickHouse:master
with commit Jun 12, 2026
02a5100
164 of 166 checks passed
azat
added a commit
to azat/chdig
that referenced
this pull request
Jun 12, 2026
alexey-milovidov
added a commit
that referenced
this pull request
Jun 13, 2026
…r cap `arrayResize` read its size argument via `IColumn::getInt`, which for a `Decimal` column returns the raw unscaled value rather than the logical one. As a result `arrayResize([1, 2, 3], 1.5::Decimal(2, 1))` resized to 15 elements instead of 1, inconsistently with `Float` and integer sizes (which truncate towards zero). A tiny fractional value such as `-0.000000000000000000000006116852::Decimal(38, 30)` has a raw value of `-6116852`, so the array was padded with millions of elements. Convert a `Decimal` size to a plain integer before resizing, so its real (rounded towards zero) value is used. This was found by `FunctionsStress.stress` (`function_prop_fuzzer`), where the above query made a worker pad ~6 million elements one by one and get reported as stuck. The existing `arrayResize` argument cap did not prevent it: it only bounds the value from above (`value > limit`), so a large-magnitude negative size slips through, and for a `Decimal` it compares the logical value while the function used the raw one. Make the cap bound the magnitude instead (`abs(value) > limit`) so large negative sizes are clamped too. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107319&sha=2603a4dd53466ae560f080b1a55ed3009d28fa9e&name_0=PR&name_1=Unit%20tests%20%28asan_ubsan%2C%20function_prop_fuzzer%29 Related: #107319 Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 task
This was referenced Jul 27, 2026
azat
added a commit
to azat-archive/chdig
that referenced
this pull request
Aug 12, 2026
clickhouse-rs does not support Map(LowCardinality), but we do not have such type in our queries, so we do not need to touch low_cardinality_allow_in_native_format, besides there is [1] [1]: ClickHouse/ClickHouse#107319 So instead of tunning 2 settings, better tune 0.
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.
Note, I need this for
chdig, since the driver I'm using does not support readingLowCardinalityChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
low_cardinality_allow_in_native_format=0handling in parallel blocks marshallingWith
enable_parallel_blocks_marshallingenabled (the default) andlow_cardinality_allow_in_native_format = 0, distributed queries overLowCardinalitycolumns returned corrupted data or failed on the initiator with:convertColumnsToBLOBsserialized columns intoColumnBLOBon the remote replica using their actual types (e.g.LowCardinality(String)), ignoring the setting.NativeWriter::writethen appliedrecursiveRemoveLowCardinalityonly to the type (it is a no-op for aColumnBLOBcolumn) and announced the stripped type (String) on the wire, so the initiator deserialized theLowCardinality-formatted blob with the plain type's serialization.Strip
LowCardinalityfrom the column before serializing it into the blob, mirroring whatNativeWriterdoes for regular columns.