Repository navigation
Conversation
…ull_in With transform_null_in = 1 a NULL is an ordinary matchable value of IN. createBlockFromCollection and getSetElementsForConstantValue kept a constant member that converted to NULL only when the key type (or tuple element type) was isNullable(). A Variant stores NULL in its discriminator and is not Nullable, and neither is a LowCardinality(Nullable) element of a Nullable(Tuple) key, so the NULL member was silently dropped: `v IN (NULL, 1)` gave 0 for a Variant NULL (NOT IN gave 1), while the same set written as a subquery, and a Nullable NULL, matched. Use canContainNull at the four sites (single key, multi-column key, Nullable(Tuple) element loop, the all-NULL tuple-literal reading of `Nullable(Tuple) IN (NULL, NULL)`). It is the predicate convertColumnToTypeOrNull already applies: it yields a NULL column only for a NULL source into a type that can hold NULL and skips the member otherwise, so a NULL can enter the set only from a genuine NULL member. The transform_null_in = 0 arm is unchanged. Related: ClickHouse#123745 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).
Severity: ❌ blocker / Session id: cron:clickhouse-review-self-slot-58:20261109-051000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20261109-044300 |
|
cc @yakov-olkhovskiy @CurtizJ, could you review this and add the |
|
Workflow [PR], commit [a380958] Summary: ✅
AI ReviewSummaryThe PR preserves genuine 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 units7 translation units recompiled, 5 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - b2563e9Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261109-103003 |
…ll-constant-in-set-transform-null-in # Conflicts: # src/Analyzer/SetUtils.cpp
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
INwith a constant list, array or tuple undertransform_null_in = 1when the left side is aVariant(or a multi-column key with aVariantelement): aNULLmember of the set was dropped, soWHERE v IN (NULL, 1)skipped the rows wherevisNULLandNOT INreturned them. Constant sets now matchNULLlike a subquery set and aNullablecolumn already did.Description
Related: #123745 (lists this case as an open risk)
Related: #119183
On 26.3 and 26.10,
SELECT id FROM t WHERE v IN (NULL, 1) SETTINGS transform_null_in = 1on aVariant(UInt64, String)column drops the rows wherevisNULL, andNOT INkeeps them, while the same set written as a subquery matches them.createBlockFromCollectionkeeps a member that converted toNULLonly when the key typeisNullable(). AVariantstoresNULLin its discriminator and is notNullable, so the member was dropped. The single-key and multi-key checks now usecanContainNull, the predicateconvertColumnToTypeOrNullalready applies, so aNULLenters the set only from a realNULLmember.transform_null_in = 0is unchanged. TheNullable(Tuple)key cases are handled on master since #119183; the test keeps them.Validation: the new test covers single and multi-column keys,
Nullable(Tuple)keys, andMemoryandMergeTreetables (with asetskip index on and off), next to the subquery results. 20 of its 40 lines are wrong on master, and reverting either changed line turns its own lines red. It passes 50/50 with random settings; the existingINandtransform_null_intests pass unchanged.Not changed here: with
transform_null_in = 0a multi-column key holding aVariantNULLstill differs ((v, 1) IN ((NULL, 1))gives 0, the subquery 1).Workflow [PR]
Sync PR [sync-upstream/pr/130261]