Repository navigation
Conversation
A hash JOIN records the build-side keys (or their range) in a runtime filter, and MergeTree prunes granules by them. An Iceberg read only filtered rows with it after opening every data file: the read step's filter is fixed by applyFilters before tryAddJoinRuntimeFilter adds the __applyFilter step, and collectAppliedJoinRuntimeFilters registered the applied filters on ReadFromMergeTree only. collectAppliedJoinRuntimeFilters now also registers them on ReadFromObjectStorageStep, which passes them to the file iterator through IObjectIterator::setJoinRuntimeFilters (forwarded by ObjectIteratorWithPathAndFileFilter, a no-op for other iterators). Once every filter is finished, IcebergIterator builds `key IN (...)` or a key range with buildRuntimeRangePredicate and skips the data files whose manifest bounds ManifestFilesPruner shows cannot match. Files requested before every filter is finished are read as before. The lookup is taken from the thread's query context, like the build side does. findAppliedRuntimeFilters now reports whether the key sits under two or more casts (key_under_nested_casts). The pruning predicate re-applies only one cast, so such a key would be pruned by values of the wrong type (ClickHouse#124679); it is not registered for object storage. MergeTree consumers do not use the field yet. New setting use_join_runtime_filters_for_iceberg_pruning (on by default; needs enable_join_runtime_filters_index_analysis and use_iceberg_partition_pruning) and profile event IcebergRuntimeFilterPrunedFiles. A perf query on tpch_ice10.lineitem joins on l_shipdate with a few days on the build side (83 of 84 files skipped). Analysis and first version of the patch in ClickHouse#128108. Closes ClickHouse#128108 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shorten the RuntimeFilterFilePruning class comment and the addJoinRuntimeFilterIndexAnalysisOnDataRead doc; drop the getPruner and runtime_filter_pruning member comments that restate the code. 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; 3 rounds, 7 findings) plus my own review (1 finding).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261029-121200 |
|
Workflow [PR], commit [dcced38] Summary: ❌
AI ReviewSummaryThe PR lets Iceberg reads skip data files using completed Missing context / blind spots
Final VerdictStatus: ✅ Approve. No new inline findings; final-head CI remains pending. |
This comment was marked as resolved.
This comment was marked as resolved.
Build profile diff (arm_release)Comparing commit See the job log for details. |
This comment was marked as resolved.
This comment was marked as resolved.
…ime-filter-file-pruning
- Drop the nested-cast flag from RuntimeFilterIndexAnalysisDescriptor: ClickHouse#128128 leaves a key under two casts out of findAppliedRuntimeFilters for every reader, so the object storage read needs no special case. - Annotate RuntimeFilterFilePruning state with TSA_GUARDED_BY, split the pruner emplace, rename unusable to no_pruning_predicate. - Add the RuntimeFilterIndexAnalysisDescriptors alias. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
CI finish ledger - bf0ac99Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other 84 jobs were dropped after these failures, so they have not run on this head. CIDB has no other Session id: cron:our-pr-ci-monitor:20261106-063005 |
This comment was marked as resolved.
This comment was marked as resolved.
…e-filter-file-pruning Resolve the conflict in `collectAppliedJoinRuntimeFilters` with ClickHouse#129677, which added `is_global_row_index` to the MergeTree registration: MergeTree gets the new argument, object storage reads skip global row index descriptors (`_part_starting_offset + _part_offset` is a MergeTree key, not a column of the data files). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Head branch was pushed to by a user without write access
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…timeFilters The early return already makes the `else` branch an object storage read, so this does not change behaviour: it only makes the branch say which step it is for. Global row index descriptors are still skipped there, because their key `_part_starting_offset + _part_offset` is the MergeTree row index and not a column of the data files. Review: ClickHouse#128145 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-filter-file-pruning ClickHouse#129933 added a `PartitionSpecification` parameter to the `ManifestFilesPruner` constructor, so the runtime filter pruner in `IcebergIterator.cpp` no longer compiled on the merge commit (`Build (arm_tidy, 3/4)`). It passes no partition key, and the specification is only read together with one, so pass an empty one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - dcced38Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261111-020006 |
a62d3fd
…-row-group-pruning # Conflicts: # src/Processors/Formats/Impl/Parquet/Reader.cpp # src/Processors/QueryPlan/ReadFromObjectStorageStep.cpp # src/Processors/QueryPlan/RuntimeFilterLookup.h
ClickHouse#128145 skips whole Iceberg data files whose manifest bounds cannot contain a key of a hash JOIN's runtime filter. Inside the files that are read, the Parquet reader still decoded every row group: its only statistics-based row-group pruning input is `FormatFilterInfo::key_condition`, built once from the plan-time `filter_actions_dag`, which never contains the runtime filter (that is moved into PREWHERE as `__applyFilter`, which `KeyCondition` cannot interpret anyway). The read now hands the runtime filters to the format through `FormatFilterInfo::join_runtime_filters`. Once every filter is built, one `KeyCondition` per `FormatFilterInfo` is built from them with `buildRuntimeRangePredicate` (the `key IN (exact values)` / `key BETWEEN min AND max` predicate that MergeTree and ClickHouse#128145 use), on the column layout of `key_condition`, and `Reader::prefilterAndInitRowGroups` drops the row groups whose statistics cannot satisfy it, next to the static `key_condition` check. The probe-side reader opens its first file only after the build side has finished (`JoiningTransform::prepare` does not pull the probe input before), so the check at file open sees finished filters; a reader that opened a file earlier would not prune it. Iceberg only, gated by `use_join_runtime_filters_for_iceberg_pruning`, `enable_join_runtime_filters_index_analysis` and `input_format_parquet_filter_push_down`; no new setting. A file whose row groups were skipped writes no query condition cache entry (plain and TopK keys), because the skipped row groups may still match the cached predicate. The per-file copies of `FormatFilterInfo` carry the filters only where the reader uses the current column names: not under a schema transform, where a current name can denote another column of the old file, and not with the `rows_to_read` of lazy materialization. The per-file count cache needs no guard: a count of an Iceberg table never reads it back. New profile event `ParquetRuntimeFilterPrunedRowGroups`. Test `05457_iceberg_join_runtime_filter_row_group_pruning`: one data file of 16 row groups. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #128108
Depends on: #128128
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg reads skip data files that cannot match a JOIN runtime filter. Controlled by the new setting
use_join_runtime_filters_for_iceberg_pruning, enabled by default.Description
JOIN runtime filters skip MergeTree granules, but an Iceberg read only filtered rows with them after opening every data file.
collectAppliedJoinRuntimeFiltersnow also registers the runtime filters onReadFromObjectStorageStep, which hands them to the file iterator (IObjectIterator::setJoinRuntimeFilters).IcebergIteratorskips data files whose manifest min/max bounds exclude every key (key IN (...)or the key range). Files requested earlier are read as before.IcebergRuntimeFilterPrunedFiles.Needs #128128 first: without it, a key under two casts would prune with the wrong predicate.
TPC-DS SF1 on Iceberg, sales tables partitioned by
icebergTruncate(30, sold_date_sk): all 99 queries 23.3 s → 16.2 s (q42 57 → 24 ms, 240 of 254 files skipped; q72 869 → 252 ms). Queries that skip nothing: 0.97–1.06x.Not covered: other data lakes, plain Parquet files, cluster table functions.
Workflow [PR]
Sync PR [sync-upstream/pr/128145]
Version info
26.11.1.1920-master(included in26.11and later)