Repository navigation
Conversation
…ry constants directly For `=` and `IN` on an INT32/INT64 column whose dictionary page stores the decoded integers, the v3 reader's dictionary filter no longer copies and hashes every dictionary value: it compares the stored values with the physical values of the query constants, recorded with their hashes when the condition is prepared (at most 256 per column). Each constant is compared with a dictionary at most once, however many conditions on the column probe it: one vectorized pass each for the first 32, then one pass with a branchless binary search over all the remaining ones. More constants, other types and other dictionary encodings keep the hashed value set. Proposed by snelheidai in ClickHouse#124669 (analysis and patch). The patch's per-lookup pass budget is replaced by comparing each constant at most once per dictionary, which avoids building the hashed value set after the budget was spent when several conditions on one column probe the same dictionary. Tests: new 05345 (every integer width and sign, extreme values, Nullable output and `input_format_null_as_default`, which condition holds a found constant); 04614, 04615 and 05317 keep testing the hashed path; 04615 also checks the direct comparison under a memory budget the hashed value set does not fit; the performance test gains queries that reach the dictionary filter. Closes: ClickHouse#124669 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop design narration and motivation from the comments added by the dictionary filter change; keep the invariants (null handling, the cast parquetTryHashColumn applies, hash collisions). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 3 rounds, 4 findings) plus my own review (6 findings), at dd78cf0.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261009-155000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261009-114600 |
|
Workflow [PR], commit [b56741f] Summary: ❌
AI ReviewSummaryThe PR speeds up Missing context / blind spots
Final VerdictStatus: ✅ Approve based on the current code, regression coverage, and reported performance evidence. No new inline findings. |
|
📊 Cloud Performance Report ✅ AI verdict: This PR only changes the Parquet v3 reader's row-group dictionary filter: integer dictionaries are now compared directly against query constants instead of hashing every dictionary value. Neither clickbench nor tpch_adapted_1_official reads Parquet files, so no change is expected and no query is flagged. The one suppressed row, clickbench Q31 (-13.1%, 297 ms to 258 ms), is consistent with that. Master shifted on 2026-10-09, and the PR's median sits inside master's current range of 241 to 357 ms. The effect of this change would show in the parquet_dictionary_filter performance test rather than in these benchmarks. clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Build profile diff (arm_release)Commit See the job log for details. |
CI finish ledger - 9122fe9Every 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-230008 |
…filter-physical-constants Co-Authored-By: Claude Opus 5.5 <[email protected]>
…filter-physical-constants Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #124669
Related: #123579
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Row group pruning by dictionaries in the
Parquetreader is faster for=andINconditions on integer columns, such as ClickBench q20 (WHERE UserID = ...): the dictionary values are compared with the query constants directly instead of being copied and hashed, also when several conditions on the column check the same dictionary.Description
Proposed by @ snelheidai in #124669 (analysis and patch); the numbers below are my own.
For
=/IN, the dictionary filter copied and hashed every value of a column chunk's dictionary and, abovemax(8, log2(n))probes, sorted the hashes. An INT32/INT64 dictionary stores the decoded integers, so the constants can be compared with them directly.Change.
prepareBloomFilterConditionrecords the physical value of each hashed integer constant (at most 256 per column).DictionaryLookupcompares the stored values with them, each constant at most once per dictionary however many conditions probe it: one vectorized pass each for the first 32, then one binary-search pass over the rest. Other types, encodings and more constants keep the hashed value set.Measured (ThinLTO release,
clickhouse localon 4 CPUs, 12-20 alternating pairs; outputs andParquetReadPagesidentical):hits.parquetUserID = cUserID IN(20 constants)INs of 32, 32, 33INs of 31INof 257 (hashed set)100 files: q20 0.79x, 20 constants 0.47x. Synthetic dictionaries of 256-65536 values: nothing slower; of 16: within 3%.
Validation. New test
05345_parquet_v3_dictionary_filter_physical_constantscompares counts androws_readwith the filter on and off for every integer width and sign, extreme values,Nullablewithinput_format_null_as_default, and conditions holding different found constants. 04615 also prunes by the comparison under a memory budget the hashed set does not fit. 04614/04615 (301 constants) and 05317 (aStringcolumn) keep testing the hashed set. The perf test gains queries that reach the filter.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124951]