Repository navigation
Cherry pick #119302 to 26.7: Revert "Revert "Proper partition pruning with dates"" - #121352
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""
|
Dear @alexey-milovidov, @scanhex12, this cherry-pick PR has not been updated for 3d0h2m41s. 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 conflicts of the cherry-pick of #119302 to 26.7. 26.7 had the original backport of #118606 merged and then reverted (#119253, #119431), so the resolution reapplies that 26.7 backport (reverts `d10ac36aeab8`) and then applies the follow-up commits of #119302 on top of it. 26.7 has no `ManifestListPruning.cpp` (manifest-list level pruning is not on this branch), so the hunks of #119302 for that file are dropped, and with them the `deserializeDecimalFromBinaryRepr` refactoring of `213367fdc76a`, which only existed to share the decimal decoding with that file; 26.7 keeps its own `decodePartitionDecimalByType`. The `ManifestFilesPruning.cpp` interval helpers, the `05054` test and the `test_partition_pruning_with_functions.py` integration test match master. Related: #119302 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🕵 Resolved the conflicts in 7f95b05 (merge of |
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