Repository navigation
Conversation
…resize per call `BitPackedRLEDecoder::decodeAndIndex` appended every RLE or bit-packed run separately through `Dictionary::appendRepeated` / `appendIndexes`. Each of those calls switches on the dictionary mode, grows the column through the virtual `IColumn::insertRawUninitialized` and switches on the value size. Runs are short (about 39 values per bit-packed run and 91 per RLE run on `hits.parquet`), so this fixed cost was a large part of decoding numeric columns. ClickHouse#115819 named this as a follow-up ("batching the per-run `insertRawUninitialized` bookkeeping"). For `Dictionary::Mode::FixedSize` with value size 1, 2, 3, 4, 8 or 16 (the sizes `appendIndexes` / `appendRepeated` already specialize), the new `decodeAndIndexFixedSize<value_size>` resizes the column once per call and fills each run in place: an RLE run from a local copy of the dictionary value, a bit-packed run by unpacking and gathering in one loop with the bit position, data pointer and bit width in locals. Each index is clamped to `limit - 1` before the gather, so a corrupt index never reads outside the dictionary, and the run is still rejected afterwards with the same `INCORRECT_DATA` error as before. String dictionaries, `Mode::Column`, other value sizes, `bit_width == 0` and an empty dictionary keep the existing per-run path (the latter rejects every index without reading the dictionary, so errors are unchanged). As in `Int96Converter` and `DeltaBinaryPackedDecoder`, an exception leaves an uninitialized tail in the column; the read is aborted in that case. Analysis and the original patch by @ snelheidai in ClickHouse#124666. Closes ClickHouse#124666 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fixed-size path gathers through a clamped index and rejects the run afterwards, so a regression test must feed it an index past the end of the dictionary. The test writes a 3-entry Int32 dictionary column, checks that the bit-packed pattern for indexes 0,1,2 is present, overwrites one byte of it with 0xFF (four copies of index 3) through `RawBLOB`, and expects `INCORRECT_DATA`. No binary file is committed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dictionary The fixed-size path gathers each bit-packed value through an index clamped to the last dictionary entry and rejects the run only after the gather. The existing corrupt case uses index 3 of a 3-entry dictionary, whose unclamped read still lands inside the prefetched column chunk, so it passes with or without the clamp. The new case rewrites the first data page's run to a 32-bit-wide bit-packed group whose first index is 0xFFFFFFFF: with the clamp the read stays inside the dictionary and the run is rejected with `INCORRECT_DATA`; without it the read lands about 16 GiB past the dictionary. A guard query fails the test if the writer stops producing the patched layout. Also update the `PageDecoder::decodeAndIndex` comment: bit-packed indexes are no longer always gathered from a stack buffer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shorten two comments in decodeAndIndexFixedSize to bare invariants (drop the design notes). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (rounds 1-3): 3 fixed, 1 disputed, 1 noted; round 3 clean
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261009-035400 |
|
Workflow [PR], commit [755db44] Summary: ❌
AI ReviewSummaryThe PR sizes the output column once per decoded range for fixed-size Parquet dictionaries, then fills RLE runs or gathers bounds-checked batches of bit-packed indexes. No actionable findings at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; full CI results remain pending. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 15 s compile time in total, 7 of them have a recent master baseline. |
|
📊 Cloud Performance Report ✅ AI verdict: This PR only changes the Parquet reader: it adds a specialised loop that decodes and looks up fixed-size dictionary values in BitPackedRLEDecoder, plus new tests. The three flagged ClickBench queries (Q28, Q33, Q34) are heavy GROUP BY queries on the hits table and do not run that code. I'm assuming the clickbench benchmark reads the MergeTree hits table, not hits.parquet; I didn't check the benchmark setup. Their similar +7-9% slowdowns most likely come from two source runs sharing one machine and from Q33/Q34 already being noisy on master. So I downgraded the Q33 regression to not_sure, and agree with the automatic hold-back on Q34 (inside master's recent range) and Q28 (the tests disagree). The benchmarks used here don't cover the PR's intended Parquet speedup; to measure it, use the new parquet_dictionary_decode performance test. clickbenchFlagged queries (3 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
CI finish ledger - d3c7f91Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261009-140011 |
|
Fixing PR for |
…fixed-size-decode # Conflicts: # src/Processors/Formats/Impl/Parquet/Decoding.cpp
…dSize Use the bit-width-specialized `unpack` from ClickHouse#128262 for the bit-packed runs of the fixed-size dictionary path: unpack up to 256 indexes into a stack buffer, check the batch maximum against the dictionary size, then gather. The check now precedes the gather, so the per-value clamp is no longer needed. Patch proposed by snelheidai in ClickHouse#128262 (comment). The `Decoding.h` comment is restored to the master wording, which describes both paths again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
I merged master (it conflicted with #128262 in x86 re-measurement: Xeon 6975P-C, release,
Q12 is not slower here. In its profile 05339 (both corrupt-index cases), 05482 and 05320 pass. With the batch check removed, the |
CI finish ledger - 755db44Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261102-193004 |
|
Fixing PR for 04011_predicate_statistics_log created: #128769 |
Closes: #124666
Related: #115819
Related: #128262
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reading dictionary-encoded numeric Parquet columns is faster: the output column is now sized once per decoded range instead of once per RLE or bit-packed run. ClickBench queries over
hits.parquetthat read numeric columns, such asSELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits, are 5-8% faster.Description
BitPackedRLEDecoder::decodeAndIndex(#115819) appends every RLE or bit-packed run throughDictionary::appendRepeated/appendIndexes, and each call switches on the dictionary mode, grows the column through the virtualIColumn::insertRawUninitializedand switches on the value size. Runs are short (39 to 91 values on average onhits.parquet); #115819 named this as a follow-up.For fixed-size dictionaries with 1, 2, 3, 4, 8 or 16-byte values, the column is now resized once per call and each run is filled in place: an RLE run from a local copy of the value, a bit-packed run unpacked in batches of up to 256 indexes with
unpackfrom #128262, checked against the dictionary size, then gathered. A corrupt index is rejected with the sameINCORRECT_DATAerror as before. Other dictionaries keep the existing path.ClickBench
hits.parquet, release build, Xeon 6975P-C, oneclickhouse-localper run, 1 core, 24 alternating pairs, NUMA-local binaries; patched/master (fd1c83b13f53), geometric mean with 95% CI:SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth)AVG(UserID)ResolutionWidth)4-core runs on this shared host agree with wide intervals (q4 0.951 [0.911, 0.992]). All 77 non-String
hits.parquetcolumns hash identically with and without the patch. A new stateless test covers every specialized value size,Nullable, runs split between calls and corrupt indexes;parquet_dictionary_decode.xmlis a new performance test.Analysis and patch by @ snelheidai in #124666 and #128262.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124859]