Repository navigation
Conversation
… type-aware ClickHouse#118899 relaxed `IN` and declined `NOT IN` for every transformed Tuple key re-packed against the transform input, because `toString` then claimed injectivity for every type while it folds NaN payloads and fall-back hours. ClickHouse#117238 made that claim type-aware, so `analyzeKeyExpressionForSetIndex` already relaxes those atoms through `is_injective`, and a relaxed `NOT IN` atom never prunes on its own. Removing the block lets an injective transform such as `toString` of `Tuple(Int64, String)` keep an exact atom. Follow-up to ClickHouse#118899 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Their text form saturates (`DateTime64` outside `0000-01-01`..`9999-12-31`, `Time`/`Time64` beyond `999:59:59`), so distinct values render alike, as for `Date32`. With the re-pack block gone, an exact atom over `ORDER BY toString(k)` would otherwise miscount `IN` and `NOT IN` for them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runner turns the setting off in some runs, and then the default-settings line of each pair computes the truth even with the old claim, so the pair would not catch a reverted claim. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`QBit` does not expose its element type to the type walk, so distinct `NaN` payloads, which render alike, were treated as distinct strings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Marking every `DateTime64` as collapsing makes the `!=` atom over `ORDER BY toString(d)` inexact, while `05164_key_condition_lossy_constant_not_equals` checks that it prunes. A `DateTime64` outside `0000-01-01`..`9999-12-31` still renders alike, as on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (click to expand)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261008-173703 |
|
Workflow [PR], commit [2155fe8] Summary: ❌
AI ReviewSummaryPR #124831 preserves exact index atoms for injective transforms of Final Verdict✅ Approve |
CI finish ledger - c461abaEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All check runs completed. The other three Session id: cron:our-pr-ci-monitor:20261009-070003 |
…ctive-key-transform-over-tuple-key Co-Authored-By: Claude Opus 5.5 <[email protected]>
The block guarded the blanket injectivity claim `toString` used to make for every argument type. That claim is type-aware now and already drives `is_relaxed` for every set-atom candidate, so the block only cost exactness for `IN` and `has` over an injective whole-tuple transform such as `ORDER BY toString(k)` with `k Tuple(Int64, String)`, and declined complement atoms that are sound when relaxed. The `allow_relaxed_pruning` parameter of `tryPrepareSetAtom` was used only there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Values past `9999-12-31` render alike, as for `Date32`, so `toString` of a `DateTime64` is not injective whatever the time zone. `05164` keys its `toString` tables on `DateTime` columns, so its pruning and lossy-normalization checks stay live. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a DateTime key a fractional String spelling does not survive key analysis's conversion, which parses with the basic format (ClickHouse#120113), so the String-spelling checks use the T spelling: both parsers accept it and it still renders back differently. A DateTime64 constant past 9999-12-31 reaches a parallel replica as text and saturates there, so arm 18 runs without parallel replicas, as arm 16 does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (click to expand)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261015-153300 |
CI finish ledger - e362a8fEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261015-200013 |
|
Dear @nihalzp, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
23fe1fa
Backport #124831 to 26.10: Keep an exact index atom for an injective key transform over a Tuple key
|
@groeneai @nihalzp @fm4v — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Index analysis now keeps an exact condition for
IN,NOT INandhason aTuplecolumn under an injective key expression such asORDER BY toString(k), soNOT INandNOT hascan skip parts and granules.toStringofTime,Time64,DateTime64and of aQBitof floating-point elements is no longer treated as injective, since distinct values can render to the same string (aTimebeyond999:59:59, aDateTime64past9999-12-31,NaNpayloads), soGROUP BY,uniq*and index analysis no longer rely on that claim for them.Description
Follow-up to #118899 (comment).
Closes: #124704
Related: #117238
#118899 lets
ORDER BY toString(k)withk Tuple(...)reach index analysis, relaxed everyINatom and declinedNOT IN; #96225 moved that block intotryPrepareSetAtomand extended it tohas. #117238 madetoString'sisInjectivetype-aware, so the folding cases are already relaxed throughis_injective.This PR removes the block: exactness over the re-packed layout follows the transform's injectivity claim. A relaxed complement atom never prunes on its own, since every evaluator sets
can_be_falsefor it before the inversion. Example:k Tuple(Int64, String),ORDER BY toString(k),k NOT IN ((1, 'a'))readParts: 2/2; it now readsParts: 1/2.#117238's list missed values that render alike:
Time/Time64beyond999:59:59,DateTime64past9999-12-31andQBitNaN payloads. This layout would miscount them, so they are now marked as collapsing. The cost: theGROUP BY/uniqrewrites no longer apply totoStringof these types (GROUP BY toString(DateTime64)3.7x slower on a debug build), and thetoString-keyed tables of05164_key_condition_lossy_constant_not_equals(#118957) now read aDateTimecolumn, so its pruning and lossy-normalization checks stay live. If thatDateTime64pruning matters more than out-of-range values, theDateTime64part reverts cleanly.Validation:
05063_key_transform_tuple_key_in_setarms 14-18 cover the example,NOT has, a saturatingTime,QBitNaN payloads and aDateTime64past9999-12-31;05227_injective_claims_tostring_datetime_and_tofixedstringcovers the new claims.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124831]
Version info
26.11.1.2753-master(included in26.11and later)26.10.7.11