Repository navigation
Conversation
…join-runtime-filter-row-group-pruning
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]>
…ere skipped A read that skipped row groups by a JOIN runtime filter counts only the rows it decoded, and the per-file row count cache is shared with `s3()` reads of the same object, so such a read must not record its count. Test case Q2 (`IcebergS3`); an Iceberg copy of `orders` (one data file, 20 row groups) and one query in `join_runtime_filter.xml`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds, nothing open)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261106-100900 |
|
cc @grantholly-clickhouse @kssenii, could you review this and add the |
|
Workflow [PR], commit [8dc31eb] Summary: ✅
AI ReviewSummaryExtends Iceberg Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units381 translation units recompiled, 3774 s compile time in total, 381 of them have a recent master baseline. |
CI finish ledger - 7d36e15Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261106-173005 |
…-row-group-pruning # Conflicts: # src/Processors/Formats/Impl/Parquet/Reader.cpp # src/Processors/QueryPlan/ReadFromObjectStorageStep.cpp # src/Processors/QueryPlan/RuntimeFilterLookup.h
…and Parquet row groups Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntime filter reads Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… each setup Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Public CI on 8dc31eb has no failures: 125 checks passed, 59 skipped, I have no access to the private sync PR, so I can't see its 2 failures. If either one is in |
The row groups of an Iceberg data file are skipped by a finished JOIN runtime filter since ClickHouse#129717, but inside a row group that is kept every page of every read column was still decoded: page pruning (`applyColumnIndex`) only received the single-column conditions of the query's own filter and of spatial predicates, never of the runtime `KeyCondition`. Give the page index the single-column conditions of the same runtime `KeyCondition`, appended after the static and spatial ones, the way spatial conditions are added. A page counts as pruned by the runtime filter only when the first condition that rules it out is a runtime one, i.e. every other condition of the column passed (the same rule as for row groups). The counter is atomic because `applyColumnIndex` runs concurrently for different row groups and columns, and `isJoinRuntimeFilterApplied` now also reports pruned pages, so a read that skipped pages writes neither a query condition cache entry (a row group whose pages were all skipped would be cached as unmatched) nor a cached row count. Malformed page statistics of a column that only runtime conditions use do not fail the read; the column is just not pruned, as for its row group statistics. No new setting; `input_format_parquet_page_filter_push_down` disables it. New profile event `ParquetRuntimeFilterPrunedPages`. Test 05457_iceberg_join_runtime_filter_page_pruning, and one query on a file with 20,000-row pages in join_runtime_filter.xml. Related: ClickHouse#128108 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #128108
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg reads skip the Parquet row groups that cannot match a JOIN runtime filter. Controlled by the setting
use_join_runtime_filters_for_iceberg_pruning.Description
#128145 skips whole Iceberg data files that cannot match a JOIN runtime filter. A file that is read is still decoded in full: the Parquet reader prunes row groups only by the filter known at planning time, and the runtime filter exists only once the build side has finished. This PR applies the same check to the row groups of each file read:
RuntimeFilterLookupsBeforeBuildFinished= 0 in the runs below). A file opened earlier is read in full.input_format_parquet_filter_push_down. New profile eventParquetRuntimeFilterPrunedRowGroups.TPC-DS SF1 on Iceberg, release build, each fact table one data file sorted by the date key, 100k-row row groups: the 99 queries 13.7 → 11.0 s at 4 threads, 10.7 → 9.5 s at 16 threads; 81 queries skip row groups (q72 1886 → 328 ms); results equal. Same tables unsorted: geomean 0.99x / 0.98x. CI perf: one query in
join_runtime_filter.xml(locally 27 → 12 ms).Not covered: plain Parquet files, other data lakes, ORC.
Workflow [PR]
Sync PR [sync-upstream/pr/129717]
Version info
26.11.1.2054-master(included in26.11and later)