Repository navigation
Cherry pick #119302 to 26.8: Revert "Revert "Proper partition pruning with dates"" - #121353
Merged
robot-ch-test-poll2 merged 12 commits intoSep 26, 2026
Merged
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]>
The `day`, `month` and `year` transforms of the Iceberg specification count from 1970-01-01 with no timezone applied, so inverting one of their values back into a range of the source column must use the `UTC` calendar and must ignore the timezone declared on the `DateTime64` that an Iceberg `timestamp` is read into. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…n shape `EXPLAIN indexes = 1` prints two lines that contain `Granules:`: the `Parts: 1 | Granules: 2` summary of the `ReadFromMergeTree` step and the `Granules: 2/10` of the primary key index analysis. The test grepped for both and stripped the indentation with `trimLeft`, which made it depend on the shape of the plan around them: - with `make_distributed_plan = 1` the step summary is not printed at all, so the test lost three lines; - with parallel replicas the whole subtree is printed under a `│` prefix, which `trimLeft` does not strip, so all six lines came out prefixed. The granule count is now read with `extract(explain, 'Granules: \d+/\d+')`, which picks the index analysis line out of any indentation or prefix and does not match the step summary at all. That is also the line the test is about: it says the index analysis narrowed ten granules down to two. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119302&sha=323a1976ae947f4c28bca9cea92d08d6913e4f86&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 Related: #118606 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…6-iceberg_partition_pruning_todate Revert "Revert "Proper partition pruning with dates""
Member
|
Dear @alexey-milovidov, @scanhex12, this cherry-pick PR has not been updated for 3d0h2m11s. Please resolve the conflicts to backport #119302, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity. |
Resolve the cherry-pick of #119302 onto 26.8. The resolution starts from the earlier 26.8 backport of #118606 (ff6b795), which already adapted `FunctionsConversion.h` and `ManifestFilesPruning.cpp` to 26.8, and then applies the follow-up commits of the reland that touch those files (323a197, bad2875, 9bb3a34) plus the updated tests. Dropped, because 26.8 does not have the code they modify: - `ManifestListPruning.cpp` (manifest-list pruning is not on 26.8), which carried the pre-1970 summary-bound fix of 039006e; - the `deserializeDecimalFromBinaryRepr` helper of 213367f in `IcebergFieldParseHelpers`: that commit only deduplicated the decimal decoding, 26.8 keeps the equivalent local `decodePartitionDecimal` in `ManifestFilesPruning.cpp`; - the `getPreimage` of `ToDateMonotonicity`, which is master-only. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Member
|
🕵 Resolved the conflicts in ef53542; the PR is now mergeable.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #119302
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