Repository navigation
Conversation
A comparison such as `y >= X` could not use a sorting or partition key on `ifNull(y, c)` or `coalesce(y, c)`, because these functions are not monotonic on `Nullable` input in general. Pushing the constant through them for a relaxed atom is sound, by the same argument already used for `assumeNotNull`: a row that satisfies the predicate has a non-NULL `y`, for which the key value is `y` itself (possibly converted to the common supertype, which preserves order), and a NULL row gets the key value `c`, which can only keep a granule as a false positive. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The common type of `ifNull(y, c)` may order the values of `y` differently: for
`y` of type `Enum8('z' = 1, 'a' = 2)` and `c = ''` the key is a `String`, so
`y > 'z'` was pushed through as `ifNull(y, '') >= 'z'` and pruned the parts with
`'a'`. Accept these functions only when the common type is the type of `y` or
both are numbers.
Found by a local codex review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
For pattern predicates (`LIKE`, `startsWith`, `match`) the constant is not a value of the key domain: converting it to the argument type can change it (a prefix `'a'` becomes `'a\0\0'` for `FixedString(3)`), and in `ifNull(c, y)` it is replaced by `c`. Both pruned matching rows. Restrict the `ifNull` / `coalesce` case to order comparisons, which is what it was added for. Found by a local codex review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ll` on `y` A pattern on `y` is pushed through `ifNull(y, c)` / `coalesce(y, c)` when both `y` and the key are `String`, so the pattern passes through unchanged. The function must have `y` as its first argument: `ifNull(c, y)` is `c`. `isNull(y)` implies `key = c` for such a key, so it becomes a relaxed atom `key = c` instead of a full scan. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nsform
Casting a `FixedString` to `String` drops its trailing zero bytes, so
`y <= toFixedString('abc', 4)` became `ifNull(y, '') <= 'abc'` and pruned rows
with `y = 'abc\0'`. The same happened for an `assumeNotNull(y)` key.
Found by a local codex review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… key transform" This reverts commit 3ef0f70.
`y <=> NULL` is the same as `isNull(y)`, so it gets the same relaxed `key = c` atom. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ifNull(y, c) and coalesce(y, c) keys for comparisons on yifNull(y, c) and coalesce(y, c) keys for comparisons, patterns and IS NULL on y
|
Workflow [PR], commit [16747ea] Summary: ✅
AI ReviewSummaryThis PR lets comparisons, string patterns, and null checks use index keys built with Final VerdictStatus: ✅ Approve |
A range, a `LIKE` and an `isNull` condition, each of which read the whole table before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units342 translation units recompiled, 3594 s compile time in total, 342 of them have a recent master baseline. |
|
📊 Cloud Performance Report
Baseline selected using StressHouse version hint 26.10.1.41020; measured build ancestry could not be verified. Measured differences are not attributed to this PR. ⚙️ 1 flagged delta falls inside the range master itself produced for the same query over the last 7 days — environment variance, not attributable to this PR. PR verdict: not_sure. 2 measured difference(s) not attributable to this PR. clickbench Q20: The measured difference cannot be attributed to this PR from the available source evidence. clickbench Q32: The measured difference cannot be attributed to this PR from the available source evidence. 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
|
…ull-constant # Conflicts: # src/Storages/MergeTree/KeyCondition.cpp # src/Storages/MergeTree/KeyCondition.h
… strict bound master now tightens Master pushes a strict integer bound through the key chain as the inclusive bound next to it, so `y < 3` now shows as `(-Inf, 2]`. The selected granules are the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A predicate on a column
ycan now use a primary key, partition key or skipping index onifNull(y, c)orcoalesce(y, c):y >= 5,y BETWEEN ...), when convertingyto the key type preserves order (same type, or numbers);LIKE/startsWith/match, whenyand the key areString;isNull(y)andy <=> NULL, askey = c.A row satisfying the predicate has a non-NULL
y, for which the key value isyitself; NULL rows only cause extra reading, never wrong results.Should be merged after #123868, which fixes a
FixedStringconversion bug that this change would otherwise expose forifNullkeys.Related: #123868
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Comparisons,
LIKE/startsWith/match,IS NULLand<=> NULLon aNullablecolumnycan now use a primary key, partition key or skipping index onifNull(y, c)orcoalesce(y, c).Workflow [PR]
Sync PR [sync-upstream/pr/123858]