Repository navigation
Conversation
…it is An Iceberg partition field summary keeps its bounds in the single-value serialization of the partition field's own type, and for the `day`, `month`, `year` and `hour` transforms that type is a signed `int` counting units from 1970. ClickHouse models those transforms in the partition key with `toRelativeDayNum`, `toMonthNumSinceEpoch`, `toYearNumSinceEpoch` and `toRelativeHourNum`, whose result types are unsigned, so `ManifestListPruner::canBePruned` read a bound from before 1970 as a huge unsigned number. For a manifest that spans 1969 and 2024 the lower bound then came out above the upper bound, and `KeyCondition::checkInRange` hit `chassert(key_order.compareTuples(left_keys, right_keys, used_key_size) <= 0)`, which aborts a build with assertions. That is why `test_storage_iceberg_with_spark/test_partition_pruning_with_functions.py::test_partition_pruning_with_functions_before_epoch` started failing on master in `Integration tests (amd_tsan, 3/6)` and `Integration tests (amd_msan, 8/8)`: the `toDate32` monotonicity that #118606 gave a `Nullable` column made the filter of that test reach the pruner. A bound of an unsigned key column is now read as the signed number Iceberg wrote, and a negative one leaves the whole field unknown: the ClickHouse functions that stand for those transforms cannot return a negative number - they map every point before 1970 to zero - so nothing about the key's value space follows from such a bound and no range of it may be pruned on. A pair of bounds that comes out inverted now drops the field with a warning instead of being pruned on, the same as `ManifestFileIterator` already does for the min/max bounds of a data file. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=290309210c5b2f0e01c13fd0fbae6577fb5cb9cd&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29 Related: #118606 Related: #116499 Related: #116604 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [4a93198] Summary: ❌
AI ReviewSummaryThis PR fixes the exception path in Findings
Tests
Final VerdictStatus: LLVM Coverage ReportMeasured on commit 4a93198.
Changed lines: Changed C/C++ lines covered: 33/42 (78.57%) · Uncovered code |
|
|
||
| std::optional<Field> lower; | ||
| std::optional<Field> upper; | ||
| if (WhichDataType(non_nullable_type).isUInt()) |
There was a problem hiding this comment.
Using isUInt() as the selector is too coarse here. The special case is not "all unsigned keys"; it is the four epoch-count transforms whose ClickHouse implementations clamp pre-1970 results to 0. For those transforms, a negative Iceberg summary bound is still informative: [-10, -1] maps to [0, 0], and [-10, 5] maps to [0, 5] in the key space that KeyCondition sees. Returning {} for any negative value fixes the assertion, but it also disables manifest-list pruning for historical manifests on predicates like toDate32(ts) > toDate32('1970-01-01') or toYear(d) > 1969 that are still safely prunable.
This helper needs the partition transform (or an explicit "clamped epoch-count" flag) instead of inferring from the result type, and the added tests should cover a strict > predicate so this regression is visible.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes20 object files changed (+21.95 KiB total), 0 added.
716 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 units7 translation units recompiled, 9 s compile time in total, 7 of them have a recent master baseline. |
|
Superseded by #119302, which brings back #118606 together with this fix in one pull request.
|
Related: #118606
Related: #116499
Related: #116604
An Iceberg partition field summary keeps its bounds in the single-value serialization of the partition field's own type, and for the
day,month,yearandhourtransforms that type is a signedintcounting units from 1970. ClickHouse models those transforms in the partition key withtoRelativeDayNum,toMonthNumSinceEpoch,toYearNumSinceEpochandtoRelativeHourNum, whose result types are unsigned, soManifestListPruner::canBePrunedread a bound from before 1970 as a huge unsigned number. For a manifest that spans 1969 and 2024 the lower bound then came out above the upper bound, andKeyCondition::checkInRangehitchassert(key_order.compareTuples(left_keys, right_keys, used_key_size) <= 0), which aborts a build with assertions.That is what broke
test_storage_iceberg_with_spark/test_partition_pruning_with_functions.py::test_partition_pruning_with_functions_before_epochon master inIntegration tests (amd_tsan, 3/6)andIntegration tests (amd_msan, 8/8): #118606 gavetoDate32its monotonicity on aNullablecolumn, which let the filter of that test reach the pruner. No open issue tracks this failure. The release builds pass becausechassertcompiles out there and the unusable range keeps the manifest instead of pruning it.A bound of an unsigned key column is now read as the signed number Iceberg wrote, and a negative one leaves the whole field unknown: the ClickHouse functions standing for those transforms cannot return a negative number - they map every point before 1970 to zero - so nothing about the key's value space follows from such a bound and no range of it may be pruned on. A pair of bounds that still comes out inverted drops the field with a warning instead of being pruned on, which is what
ManifestFileIteratoralready does for the min/max bounds of a data file. One decodable bound of a pair no longer stands on its own either: the other side of the field is unknown then, andKeyConditiontakes the whole universe of the column for it anyway.test_partition_pruning_with_functions_before_epochcovers the abort. The newtest_partition_pruning_with_functions_before_epoch_separate_commitscommits the pre-1970 rows separately, so the summaries of that manifest are negative on both sides, and pins that such a manifest is not pruned away.Tested locally with
python3 -m ci.praktika run "integration" --test "test_storage_iceberg_with_spark/test_partition_pruning_with_functions.py": 6 passed.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/119292]