Skip to content

Skip Parquet pages of Iceberg data files by JOIN runtime filters - #130906

Merged
murphy-4o merged 8 commits into
ClickHouse:masterfrom
groeneai:iceberg-join-runtime-filter-page-pruning
Nov 13, 2026
Merged

murphy-4o merged 8 commits into
ClickHouse:masterfrom
groeneai:iceberg-join-runtime-filter-page-pruning

Conversation

@groeneai

@groeneai groeneai commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #128108
Related: #129717

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Iceberg reads now skip the Parquet pages of data files whose page index shows they cannot contain a key of a JOIN runtime filter. Controlled by the setting use_join_runtime_filters_for_iceberg_pruning.

Description

Depends on #129717; only the last two commits are new.

#129717 skips the row groups of an Iceberg data file that cannot match a finished JOIN runtime filter. In a kept row group every page is still decoded, even where the page index proves it cannot hold a key: page pruning only got the query's own filter and spatial predicates. This PR adds the single-column conditions of the runtime KeyCondition, so applyColumnIndex skips those pages and the other columns read only the remaining rows.

  • New profile event ParquetRuntimeFilterPrunedPages.
  • A read that skipped pages writes no query condition cache entry or cached row count, as for row groups.
  • Malformed page statistics of a column only the runtime filter uses do not fail the read; that column is not pruned.
  • No new setting; it needs input_format_parquet_filter_push_down and input_format_parquet_page_filter_push_down (both on by default).

The gain needs several pages per row group: Spark and other parquet-mr writers start a page every 20,000 rows (Iceberg write.parquet.page-row-limit); ClickHouse cuts pages by size, often one per row group for a sorted key.

TPC-DS SF1 on Iceberg, release build vs #129717, each fact table one data file sorted by the date key with 1M-row row groups and 20,000-row pages: 99 queries 11.9 -> 10.4 s at 4 threads (geomean 0.85), 10.9 -> 9.8 s at 16 threads (0.87); 83 queries skip pages (q72 0.58x, q31 0.60x); results equal; peak memory geomean 0.83. Nothing to skip (#129717's layout, or unsorted facts): geomean 0.975 / 0.985 / 0.991, memory 0.99 to 1.005. CI perf: a new query in join_runtime_filter.xml (locally 20 -> 13 ms, 999 of 1000 pages skipped).

New test 05457_iceberg_join_runtime_filter_page_pruning, with a data file whose page index of the join key cannot be parsed: the read keeps every page and returns the same rows.


Workflow [PR]
Sync PR [sync-upstream/pr/130906]

Version info

  • Merged into: 26.11.1.2159-master (included in 26.11 and later)

groeneai and others added 2 commits November 11, 2026 15:22
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]>
…uning

05457 gets a case with a data file whose column index of the join key is
overwritten with bytes that cannot be parsed (same size, so the manifest
still matches): the runtime filter skips no page of it and the read returns
the same rows, while the query's own filter on that column still fails with
INCORRECT_DATA, as before.

Case W now has a filter of the query on the join key too, so a page that the
query's filter rules out first is not counted as pruned by the runtime filter
(13 of the 14 pages of `k`).

Comment of the query condition cache guard: it covers pages too.

Related: ClickHouse#128108

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 3 findings in the first pass, 0 in the delta recheck of the fix round).

# Sev Finding Verdict Evidence / action
1 ⚠️ No test runs the fallback for a malformed page index of a column only the runtime filter uses AGREE, fixed @ 4453fdf Case M overwrites the column index of the join key in place: the read keeps every page and returns the same rows; with the old catch condition it fails with INCORRECT_DATA
2 ⚠️ That fallback also hides non-statistics exceptions (e.g. a failed read of the column index) DISAGREE Without this PR that column index is never requested, so failing on it would fail a query that works today; a failed read is rethrown to every range of its read task, the data pages are read outside the fallback, and the fallback keeps every row. Same catch scope as the existing spatial fallback
3 💡 The changelog names two settings, but the runtime filter is also gated by input_format_parquet_filter_push_down AGREE, fixed in the PR description Both format settings are named there

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-11:20261111-171300

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: 05457_iceberg_join_runtime_filter_page_pruning (100-row pages pinned by table settings) shows 0 runtime-pruned pages on the base and 14 with the fix, every run.
b Root cause explained? Page pruning reads only column_index_conditions, which were built from the query's own filter and spatial predicates, never from the JOIN runtime filter's KeyCondition.
c Fix matches root cause? Yes: the runtime condition is given to the existing page-index pruning the same way spatial conditions are; nothing is widened or guarded around.
d Test intent preserved / new tests added? New stateless test (12 cases); removing the new conditions, the cache guard, the page attribution or the malformed-index fallback reddens it (the cache guard as a wrong count() from the query condition cache). One appended perf query.
e Both directions demonstrated? Yes: red on the base binary, green with the fix, four mutants red, 50/50 randomized runs green.
f Fix is general across code paths? Every reader of the shared runtime predicate checked: the three cache guards read the one widened function, position-delete reads prune (tested), schema-transform and lazy-materialization reads do not get the predicate (unchanged); static and spatial page pruning unchanged (geo page tests green).
g Fix generalizes across inputs (params/datatypes/wrappers)? Exact set, min/max range, Nullable key with an all-NULL page, one cast, two casts (no pruning), LEFT ANTI (no pruning), static filters on the join key and on another column, a page index of the join key that cannot be parsed, 4 threads, IcebergS3.
h Backward compatible? (maintainer-approved exception only) Yes: no setting, default or format change; input_format_parquet_page_filter_push_down = 0 or use_join_runtime_filters_for_iceberg_pruning = 0 turns it off.
i Invariants and contracts preserved? A page is skipped only if the runtime filters cannot match it; runtime conditions are last, so a page counts as runtime-pruned only when every other condition passed; conditions are built once per file and only read afterwards; the counter is atomic.

Session id: cron:clickhouse-impl-slot-6:20261111-165100

@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2732bb4]

Summary: ✅


AI Review

Summary

Reviewed #130906 at 2732bb4cea0fa2bb5dcf5c178997b72e996f5c65, including all prior discussion. The PR extends Iceberg JOIN runtime filtering to Parquet page indexes, tracks runtime-pruned pages, and prevents those reads from populating query-condition and row-count caches. No actionable findings. The committed regression covers page skipping, static-filter interaction, cache correctness, and an unreadable column index; the CI report for 0a7ed239 records passing file-, row-group-, and page-pruning tests. The PR supplies before/after performance measurements and a focused performance query. No local build or tests were run.

Final Verdict

✅ Approve — no new inline findings or existing review threads requiring action.

@clickhouse-gh clickhouse-gh Bot added pr-performance Pull request with some performance improvements can be tested Allows running workflows for external contributors comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2732bb4ce with master acd88ab8f (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.63, programs/clickhouse-keeper ×0.63 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse _ZN6detail10static_forITk7is_enumN2DB23AttributeUnderlyingTypeEZNS1_29callOnDictionaryAttributeType… 3.6 s 7.8 s +5.5 s (+244%)
Compile time of recompiled translation units

19 translation units recompiled, 168 s compile time in total, 19 of them have a recent master baseline.

Job report

@murphy-4o murphy-4o self-assigned this Nov 12, 2026
murphy-4o and others added 2 commits November 12, 2026 16:00
…hout parallel replicas

The query of the layout counted ParquetPrunedPages of the initial query, which reads nothing when parallel
replicas read the table, so it was 0 in the ParallelReplicas job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-parquet-reader-v3 Issues related to the native Parquet reader. and removed comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 12, 2026
murphy-4o and others added 2 commits November 12, 2026 20:12
Each of `column_conditions` and `join_runtime_filter_column_conditions` is filled once, so the conditions are
extracted at the call sites and the lambda only wires them to the columns.

The test keeps the cases of the page level: an exact set of keys, together with a filter of the query, the
query condition cache and a page index that cannot be parsed. The cases of the runtime KeyCondition (the
min/max range, casts, a Nullable key, LEFT ANTI, more threads, position deletes, the row count cache) are
covered by 05457_iceberg_join_runtime_filter_row_group_pruning; the page level consumes the same condition.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 0a7ed23

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Performance Comparison (amd_release, master_head, 2/6) / Query join_runtime_filter #20 time keeps growing with each run not caused by this PR: query #20 is unchanged here and did the same work in every run (same rows and marks, CPU time within 5%). The slower last 4 runs are OS CPU wait (OSCPUWaitMicroseconds 28-56 ms in runs 0-2, 235-598 ms in runs 3-6) that hit both servers in the same 4-second window, so it is CPU contention on the host, which the run-trend check of #129330 reads as growth a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR praktika rollups of the row above a fix task is created (investigating at full effort, fixing-PR link to follow here)

CIDB has no other FAIL or ERROR row on this head.

Session id: cron:clickhouse-maint-slot-19:20261112-202200

…ime-filter-page-pruning

# Conflicts:
#	src/Core/Settings.cpp
@murphy-4o
murphy-4o enabled auto-merge November 13, 2026 03:55
@murphy-4o

Copy link
Copy Markdown
Member

@groeneai, please investigate the CI failures in this PR (commit 2732bb4) and fix them, or link existing fixes.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=130906&sha=2732bb4cea0fa2bb5dcf5c178997b72e996f5c65&name_0=PR

Also, 11 failures in the private sync PR.

@murphy-4o
murphy-4o added this pull request to the merge queue Nov 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Public CI on 2732bb4 has no failures: the linked report shows 112 jobs OK, 87 skipped and 0 failed, and CIDB has no failed test rows for this commit.

I don't have access to the private sync PR, so I can't see those 11 failures. If you paste the failing test names or their report links here, I'll check them against this change (Parquet page filtering of Iceberg reads by JOIN runtime filters) and fix them or link existing fixes.

Merged via the queue into ClickHouse:master with commit 6ab5d5c Nov 13, 2026
204 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the join_runtime_filter #20 run-trend red: #131251

huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Nov 14, 2026
…eberg_pruning docs

The description of `use_join_runtime_filters_for_iceberg_pruning`, extended in
ClickHouse#130906, linked the format setting `input_format_parquet_page_filter_push_down`
with a bare `#anchor`. The docs generator resolves a bare fragment only within
the page's own settings family, so it was emitted as
`/reference/settings/session-settings/other#input_format_parquet_page_filter_push_down`,
a page without that heading, and the link check of the daily reference-docs
regeneration PR failed:

    [./reference/settings/session-settings/use.mdx]:
    [ERROR] reference/settings/session-settings/other#input_format_parquet_page_filter_push_down (at 175:425) | Cannot find fragment

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131561&sha=7b75bf04b887453e5e5380b7b979224f0182829c&name_0=PR&name_1=Docs%20check%20%28Mintlify%29

Use the absolute shard route, as the first link of the same sentence already
does, and repair the garbled clause "pages that and": page pruning by the
runtime filter needs both Parquet filter push-down settings.

Validated by regenerating the docs locally with the generator the robot runs
and running `lychee_check.py --mode links`: 1 error (the one above) with the
base binary, 0 errors with the fixed one.

Related: ClickHouse#130906
Related: ClickHouse#131561

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-parquet-reader-v3 Issues related to the native Parquet reader. pr-performance Pull request with some performance improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants