Repository navigation
Cherry pick #112934 to 26.3: Keep Iceberg statistics for supported columns when a field type is unsupported - #121532
Conversation
…supported An INSERT into an Iceberg table whose schema contains a column that cannot be serialized into a statistics bound wrote no lower_bounds/upper_bounds at all for the data file, losing the bounds of every supported column too. Those maps drive min/max file pruning, so one Array/Map/Tuple/Decimal/Float/UInt* column silently disabled file-level pruning for the whole table, for ClickHouse's own reader and for external readers alike. canWriteStatistics was a whole-vector predicate: it returned false on the first field whose bound canDumpIcebergStats rejects, and its two callers used that as an all-or-nothing gate. Skipping set_fields leaves the Avro union on its null branch, which surfaces as an empty map. A column that is entirely NULL trips the same veto, because ColumnNullable::getExtremes yields POSITIVE_INFINITY, a Field of type Null. Replace it with filterWritableStatistics, which returns the subset of bounds that can be serialized; the callers write that subset when it is non-empty. An omitted field is simply absent from the map, which readers already treat as "bound unknown" and skip (ManifestFileIterator, ManifestFilesPruning), and the compaction path already emits such partial maps. The partition-summary path in this same file already performs the identical per-field skip with the same predicate, so the data-file path becomes consistent with its sibling. When no field is serializable, nothing is written, exactly as before. The gate deliberately stays canDumpIcebergStats rather than "does dumpFieldToBytes support it": the byte dumper handles a strictly wider set and throws LOGICAL_ERROR on the rest, so filtering now guarantees that precondition by construction instead of relying on the veto having covered every element. Measured per release branch: 26.7, 26.6, 26.5 and 26.3 reproduce; 25.8 has no allow_insert_into_iceberg. The introducing commit is not identified. Closes #112706 Co-Authored-By: Claude Fable 5 <[email protected]>
Resolves the conflict with #112414, which merged first and renamed the statistics source in generateManifestFile from data_file_statistics to effective_statistics. The resolution keeps this branch's per-field filterWritableStatistics mechanism and applies it to the new source, so both call sites read effective_statistics->getLowerBounds()/getUpperBounds() through the filter. #112414 added 04652_iceberg_insert_per_file_statistics, whose reference asserted the all-or-nothing output this branch fixes: the two data files holding an all-NULL score recorded lower=[] upper=[], dropping the bound of the id column along with it. Those two rows now carry the id bound, [(1,2)] and [(1,3)]. Its comments described that loss as pre-existing behaviour asserted rather than fixed, which no longer holds, so they now state the per-field rule instead. Renamed the new test from 04693 to 04739. Master took 04693 for five unrelated tests while this branch was open, and check_gaps_in_tests_numbers only flags gaps, never collisions, so a duplicate number ships silently under green CI. 04739 is free on master, across all 2077 open pull requests and in the fleet worktrees. Co-Authored-By: Claude Opus 5 <[email protected]>
…tatistics-bounds Keep Iceberg statistics for supported columns when a field type is unsupported
|
The "the bot re-tries this cherry-pick" note above does not apply here, so this one will not resolve itself. Both conflicting regions are #112414 content, and #112414's own 26.3 cherry-pick (#119455) was closed unmerged on 2026-09-14. 26.3 has neither The bug itself is present on 26.3 though. That makes 26.3 an adaptation rather than a conflict resolution, so the call is the owner's and I will do either. If 26.3 is wanted, I will push a resolved 26.7 (#121533), 26.8 (#121534) and 26.9 (#121535) already carry #112414 and need nothing from me. |
One conflict, at the two call sites in `IcebergWrites.cpp`. The helper rename and its all-or-nothing to per-field change merged on their own; only the callers collided, because master reads `effective_statistics` (the per-file statistics this branch does not have) where this branch reads `data_file_statistics`, and master wraps the `if` bodies in braces where this branch does not. Resolved to the branch's variable and brace style over the new `filterWritableStatistics`. `04652_iceberg_insert_per_file_statistics` does not exist on this branch, so its half of the change is dropped. Nothing is lost: that hunk only re-baselines an existing test's expectations and comments to the new per-field bounds, while the coverage for the change itself is the new `04739_iceberg_insert_partial_statistics_bounds`, which carries over unchanged. Checked for the new test: `allow_insert_into_iceberg` and `USER_FILES_PATH` are both here, and `canDumpIcebergStats` differs from master's only by the four `Decimal*` cases, which the test does not exercise. No other test on this branch asserts written Iceberg bounds, so the all-or-nothing to per-field flip cannot break one silently. The source resolution is byte-identical to the one on private release/26.4. Upstream: #112934 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Original pull-request #112934
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job