Repository navigation
Conversation
…ay, Map or JSON `Array`, `Map` and `JSON` values compare with `IColumn::compareAt`, which orders a `NULL` element after every value (`['x'] < [NULL]` is 1), while `Field` order, which orders the endpoints of a key range, puts `Null` before every value. For a comparison constant such as `[NULL]` the range `(-Inf, [NULL]]` then excludes every non-empty array, so partition pruning, the primary key and `minmax` skip indexes dropped rows: on a table `PARTITION BY a` over `Array(String)`, `WHERE NOT (a > [NULL])` returned 0 rows instead of all of them. Decline the atom when the converted constant holds such a `NULL`, at the same place where a `NaN` in a constant is already declined. A `NULL` directly inside a `Tuple` is not screened here: a tuple comparison is three-valued, which is a different case. Found by the AST fuzzer TLP DISTINCT oracle on ClickHouse#100535. 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; 0 findings) plus my own cold review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261008-173200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261008-164058 |
|
Workflow [PR], commit [373b11b] Summary: ❌
AI ReviewSummaryReviewed #124700 at Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
CI finish ledger - 36167c0Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All 152 check runs completed and Session id: cron:our-pr-ci-monitor:20261009-030006 |
|
Fixing PR for the |
…ion-null-in-array-map-constant # Conflicts: # src/Storages/MergeTree/KeyCondition.cpp
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, 24 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 373b11bEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261022-200007 |
Related: #100535
Related: #118944
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed rows being silently dropped by partition pruning, primary key analysis or a
minmaxskip index when a comparison constant is anArray,MaporJSONvalue that holds aNULL. For example,SELECT count() FROM t WHERE NOT (a > [NULL])over a tablePARTITION BY awith anArray(String)column returned0instead of the number of rows.Description
Found by the AST fuzzer TLP oracle on #100535 (report).
On 26.3.42.3, 26.8.18.2 and master this returns
0instead of3(3withuse_partition_pruning = 0).Array,MapandJSONvalues compare withIColumn::compareAt, which orders aNULLelement after every value (['x'] < [NULL]is1). Key ranges are ordered byField, which putsNullbefore every value, so the atoma in (-Inf, [NULL]]excludes every non-empty array. The same happens for a primary key or aminmaxindex onArray(Nullable(String)), aminmaxindex onJSON, and aTuplekey with anArrayelement.The atom is now declined when the converted constant holds such a
NULL, at the same place where aNaNin a constant is already declined (#116763). ANULLdirectly inside aTupleis a different, three-valued case handled by #118944.The new test fails on master (20/20 randomized runs) and passes 50/50 here; removing the new condition makes it fail again. Constants without a
NULLprune exactly as before, which the test also checks.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124700]