Repository navigation
Number the monotonic chain functions in KeyCondition instead of keying their cached results by address - #127658
Conversation
…g their cache by address `applyFunction` caches the result of a chain function, computed over a whole column of the in-memory primary index, in the block the `FieldRef` points to, under the name `_<function address>_<column>`. Every function of every chain now gets a number when the `KeyCondition` is built (one pass at the end of the constructor; the chains of a set index are numbered after its atom, so `MergeTreeSetIndex::checkInRange` takes the first number), and the name is `_<function number>_<column>`. A short numbered name could match a key column name (a key column named `_0_1`), which the address could not, so the columns that `markRangesFromPKRange` and the text index put into the block are now unnamed. Follow-up to ClickHouse#127495. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the two parameter comments on first_function_number; the numbering is documented on RPNElement::first_function_number. 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; 2 findings; 1 full pass), plus my own review (0 findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261023-222600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261023-202900 |
|
cc @nihalzp @shankar-iyer, could you review this and add the |
|
Workflow [PR], commit [37cad99] Summary: ✅
AI ReviewSummary
Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units392 translation units recompiled, 4215 s compile time in total, 392 of them have a recent master baseline. |
9a15930
Related: #127495
Related: #68354
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Index analysis names the cached results of monotonic key functions by a number assigned when the condition is built, instead of by the function address.
Description
Follow-up to #127495, as asked in #127495 (comment).
applyFunctioncaches the result of a monotonic key function, computed over a whole index column, in the block theFieldRefpoints to, under the name_<function address>_<column>. The address came from #68354: the earlier_<function name>_<column>letintDiv(a, 50)andintDiv(a, 50000)share an entry, because a function with a constant argument reports only its bare name.Now every function of every chain gets a number when the
KeyConditionis built (one pass at the end of the constructor; the chains of a set atom are numbered after it, soMergeTreeSetIndex::checkInRangetakes the first number), and the name is_<function number>_<column>, still formatted on the stack.A short numbered name can equal a key column name, for example a key column named
_0_1, which the address could not. So the columns thatmarkRangesFromPKRangeand the text index put into the block are now unnamed; nothing reads those names.Validation: the new test has a key column named
_0_1and two chains with different constants on one key column (a range and a set), on both primary key analysis paths. It passes on master, and fails if either block keeps its column names, if the set chains are numbered from 0, or if every chain is numbered from 0. In a RelWithDebInfo build, the primary key analysis time of thelong_primary_keyqueries is within 2% of the base.Workflow [PR]
Sync PR [sync-upstream/pr/127658]
Version info
26.11.1.725-master(included in26.11and later)