Repository navigation
Conversation
Iceberg float lower_bounds/upper_bounds exclude NaN by spec, and NaN presence is recorded only in the optional nan_value_counts (field 137). ClickHouse never read that field, and the manifest pruner evaluated a plain KeyCondition over the bounds as if they covered every value. A hidden NaN satisfies no ordering comparison, so it makes a negated atom true (`!=`, `NOT (x < 10)`, `NOT IN`) and a monotonic chain can map it anywhere (`round(x) != 3`): such predicates pruned a data file holding the NaN and its rows were lost. Reproduced on 26.3.42.3, 26.8.18.2, 26.9.16.11 and master with a pyiceberg-written file `x = [3, NaN, 3]`: `WHERE x != 3` returned 0 with pruning on and 1 with it off. Parse nan_value_counts into ColumnInfo. For a column whose type may hide a NaN, the pruner also builds a copy of the min/max condition relaxed by KeyCondition::relaxAtomsOverNaNHidingColumns, the mechanism MergeTree minmax, skip indexes and the statistics pruner already use for NaN-excluding bounds, and uses it unless the data file's nan_value_counts for the column is 0 (Iceberg Java's mayContainNaN). Positive comparisons keep pruning. The inverted-bounds check from ClickHouse#116604 orders NaN last, so `(NaN, 5)` is already dropped as inverted, but an upper NaN bound (`(5, NaN)`, `(NaN, NaN)`, which Iceberg Java's ORC metrics report when a file's first value is NaN) passed and pruned on `x = 3`. Drop a column's bounds when either endpoint is NaN. OPTIMIZE TABLE ... MANIFEST copies the source entries' statistics verbatim; carry nan_value_counts over as well, otherwise compaction would demote every column of a table written by Iceberg Java to the relaxed condition. Closes ClickHouse#118112 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…resence The compaction stats test inserted no NaN, so every source nan_value_counts entry was 0 and the test read only the map length. The reader treats a count of exactly 0 as proof that strict min/max pruning is safe, so a rewrite that zeroed a positive count, or copied the null count into the NaN map, passed the test and would re-enable the wrong prune. One source file now holds a NaN, and the per-file NaN counts of the rewritten manifest must equal those of the source manifests. 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 rounds, 2 findings) plus my own cold review.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-48:20261015-165600 |
|
Workflow [PR], commit [1181255] Summary: ✅
AI ReviewSummaryReviewed PR #126078 at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No new inline findings; current-head CI still needs to finish. |
|
cc @scanhex12 @SmitaRKulkarni, could you review this and add |
CI finish ledger - 4a3bdd0Every 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-230015 |
|
Fixing PR for the Upgrade check (amd_release) dictionary UNKNOWN_IDENTIFIER error created: #126169 |
The stress phase runs many tests in one shared database per worker, and a test that is stopped before its last statement leaves its row policies behind. A database-level one (`02703_row_policy_for_database.sh`: `ON * USING x=1 TO ALL` on `test_1`) filters every table of that database, so after the upgrade the eager dictionary of `04365_dictionary_lazy_load` over `test_1.src`, which has no column `x`, fails to load in the background with `UNKNOWN_IDENTIFIER` and the log scan fails the job (seen on ClickHouse#126078). The old server fails the same way, so it is leftover test state, not an upgrade incompatibility. 15 row policies were alive when the old server stopped in that run, two of them created by the AST fuzzer. Drop every row policy not defined in `users.xml` before the upgrade and fail the job when one survives, as is done for leftover mutations (ClickHouse#120978). Neutralizing them instead does not work: the test config sets `throw_on_unmatched_row_policies`, so a table whose policies apply to nobody throws for every reader. The statements are generated server-side from `system.row_policies.name`, so no name passes through the shell. The drop takes away the policies that happened to cross the upgrade, so one is created deliberately (`k < 3` on a 10-row table) and the new server has to apply it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iceberg-nan-manifest-pruning Resolve conflicts with master's extraction of getDataFileHyperrectangles and the require_ready_sets argument of the min/max KeyCondition: the NaN-bound guard moves into getDataFileHyperrectangles, and the NaN-relaxed condition copies the condition built with master's arguments. 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 Object file sizes9 object files changed (+44.86 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units82 translation units recompiled, 902 s compile time in total, 82 of them have a recent master baseline. |
…-iceberg-nan-manifest-pruning Master ClickHouse#123553 moved the per-column bound decoding of getDataFileHyperrectangles into decodeColumnBounds, which returns std::optional<ColumnBounds>. The NaN-bound guard now lives there, so it returns std::nullopt instead of continuing the old loop, and it also covers the new getDataFileColumnBounds caller (manifest column statistics), which must not report a NaN as a column minimum or maximum. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master: #123553 moved the bound decoding into |
CI finish ledger - 1fb8a58Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Apart from the expected Session id: cron:our-pr-ci-monitor:20261104-030003 |
|
@groeneai we have conflicts :( Please merge master again. |
…-iceberg-nan-manifest-pruning Master ClickHouse#128880 moved the per-entry statistics copy of the manifest-only rewrite (OPTIMIZE TABLE ... MANIFEST) into getColumnStatisticsForRewrite. The nan_value_counts carry now lives in that helper; no other change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master in 1181255. The only conflict was in |
Fails until PR ClickHouse#126078 is merged: without it, min/max pruning drops a file whose only matching row is NaN, now that float bounds are written. The expected output is the correct one, checked with that PR applied locally, so the test fails until then. Related: ClickHouse#126078 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a filtered query over an Iceberg table missing rows that hold a NaN in a
Float32/Float64column, for exampleWHERE x != 3skipping a data file that holds3, NaN, 3. Iceberg float bounds leave NaN out, so min/max pruning dropped such a file on a negated or chained predicate. It now prunes on such predicates only when the manifest'snan_value_countsshows the column holds no NaN, and it ignores a bound that is NaN. Closes #118112.Description
Closes: #118112
Related: #116725
On 26.3.42.3, 26.8.18.2 and 26.9.16.11,
SELECT count() FROM icebergLocal(...) WHERE x != 3 SETTINGS input_format_parquet_filter_push_down = 0returns 0 instead of 1 for a pyiceberg-written file holdingx = [3, NaN, 3].By the Iceberg spec float
lower_bounds/upper_boundsexclude NaN, which is counted only innan_value_counts. ClickHouse never read that field and evaluated the filter as if the bounds covered every value, so a negated atom (!=,NOT (x < 10),NOT IN) or a chain (round(x) != 3) pruned the file. Separately, a(NaN, NaN)bound pair, which Iceberg Java writes for an ORC file whose first value is NaN, passes the inverted-bounds check from #116604 and prunes the file onx = 3.For float columns the pruner now also builds a condition relaxed by
KeyCondition::relaxAtomsOverNaNHidingColumns, as MergeTree minmax does, and uses it unless the file'snan_value_countsfor the column is 0 (Iceberg Java'smayContainNaN). Bounds with a NaN endpoint are dropped.OPTIMIZE TABLE ... MANIFESTnow carriesnan_value_countsover. The price: for files withoutnan_value_counts(pyiceberg), negated and chained float predicates no longer prune; positive comparisons still do. At full defaults the Parquet row-group layer also drops the row (#118110); #116725 fixes that.Validation: the new
test_iceberg_nan_manifest_boundsfails on master at every assertion except the control;test_optimize_manifest_files_preserves_statsgains a double column and fails on master withnan_value_counts dropped: 0.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/126078]
Version info
26.11.1.1773-master(included in26.11and later)