Skip to content

Apply string filters during scan to DELTA_BYTE_ARRAY Parquet pages (follow-up to #115848) - #124503

Merged
alexey-milovidov merged 4 commits into
masterfrom
string-filter-scan-pushdown-review-followup
Oct 8, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
string-filter-scan-pushdown-review-followup

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #115848, which handles the two review comments left on it after it entered the merge queue (the queued branch cannot be updated). This branch sits on top of the head of #115848. Once that PR merges, the diff here shrinks to the two commits below.

  • DeltaByteArrayDecoder now receives the string value filter. Before this, apply_string_filters_during_scan did nothing for Parquet BYTE_ARRAY pages in the DELTA_BYTE_ARRAY encoding. Each value still has to be rebuilt, because it depends on the previous one, but values that do not match are inserted as empty strings and the filter's selectivity statistics are updated. The new test uses a small file written by pyarrow.
  • MergeTreeWhereOptimizer now maps the columns read before the filter (existing PREWHERE, row policy, __topKFilter) to their storage columns before deciding on the relaxed move to PREWHERE. This matches how the reader decides when to turn the filter off.

Related: #115848

Changelog category (leave one):

  • Performance Improvement

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

apply_string_filters_during_scan now also applies to Parquet string pages in the DELTA_BYTE_ARRAY encoding.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1868-master (included in 26.10 and later)

alexey-milovidov and others added 2 commits October 7, 2026 22:04
`columns_read_before_filter` holds the names of the inputs of the existing `PREWHERE`,
the row policy and `__topKFilter`, which may be subcolumns (e.g. `payload.size0`), while
the reader disables the scan-time string filter per storage column. Resolve these names
to storage columns before checking whether a condition is suitable for the relaxed move
to `PREWHERE`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`PageDecoderInfo::makeDecoder` did not pass the string value filter to
`DeltaByteArrayDecoder`, so `apply_string_filters_during_scan` had no effect on
`BYTE_ARRAY` pages in the `DELTA_BYTE_ARRAY` encoding. The values still have to be
reconstructed (each one depends on the previous one), but the ones that do not match
the filter are now inserted as empty strings, and the selectivity statistics are updated.

The test uses a small file written by pyarrow, because ClickHouse does not write this encoding.

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

clickhouse-gh Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e7f6c27]

Summary: ✅


AI Review

Summary

This PR closes the two follow-up gaps from #115848: it aligns MergeTreeWhereOptimizer with the reader’s storage-column granularity when deciding whether a condition can use scan-time string filtering, and it threads the same scan-time StringValueFilter through Parquet DELTA_BYTE_ARRAY BYTE_ARRAY pages. I did not find a correctness or performance issue in the current diff; the new decoder path follows the same empty-string-substitution contract already used by the other Parquet string decoders, and the optimizer-side storage-column mapping now matches the reader-side suppression rule for subcolumns.

Missing context / blind spots
  • ⚠️ I reviewed the diff and current code only. I did not run the new Parquet fixture locally because this checkout has no local build artifacts, and broader PR CI was still pending on 2026-10-08 (Build (arm_tidy, 1/4..4/4), PR, CH Inc sync).
Final Verdict

✅ No new findings. The current diff looks correct to me; merge once the remaining CI finishes green.

LLVM Coverage Report

Measured on commit e7f6c27.

Metric Baseline Current Δ
Lines 88.30% 88.30% +0.00%
Functions 92.10% 91.80% -0.30%
Branches 79.70% 79.70% +0.00%

Changed lines: Changed C/C++ lines covered: 62/78 (79.49%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added pr-performance Pull request with some performance improvements comp-parquet-reader-v3 Issues related to the native Parquet reader. labels Oct 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

⚠️ AI verdict: not_sure — no significant changes across 32 queries analysed

This PR does two things: it applies PREWHERE string filters inside the Parquet DELTA_BYTE_ARRAY decoder, and it makes MergeTreeWhereOptimizer match columns read before the filter by their storage name, so subcolumns such as payload.size0 count for their parent column. ClickBench reads a MergeTree table with plain String columns. The Parquet decoder is never used there, and for flat columns the storage name is the same as the column name, so the planner change does not alter which filters apply. Neither flagged query can be tied to the diff. Q28 (+6.3%) falls inside master's normal range and its PR runs were noisy. Q33 (-6.6%) is marked not_sure because master's timings for it recently shifted. No query in clickbench or tpch_adapted_1_official shows a change caused by this PR.

clickbench

⚠️ 2 inconclusive

Flagged queries (2 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 28 not_sure 1018 1082 +6.3% <0.0001 Median of 1082.5 ms is inside master's current range of 990-1185 ms, and the PR runs were very noisy. The planner change keeps ClickBench's plain String columns on the same path, so nothing ties this +6.3% to the PR.
⚠️ 33 not_sure 1143 1068 -6.6% <0.0001 aggregation: Master's own timings for this query shifted recently, so the baseline is not reliable. This -6.6% sits on a group-by path that neither the Parquet decoder nor the PREWHERE planner change touches.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 3718203f-5965-46d6-bd6e-a759f563a295
  • MIRAI run: 9b712e1e-56c2-4640-8226-2661fb57bdfe
  • PR check IDs:
    • clickbench_390093_1791476297
    • clickbench_390106_1791476297
    • clickbench_390112_1791476297
    • tpch_adapted_1_official_390122_1791476297
    • tpch_adapted_1_official_390149_1791476297
    • tpch_adapted_1_official_390163_1791476297

@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit e7f6c2726d8ad4ef509b03652d08d5d35c690d32 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception; stopped retrying after the 1250 s read budget).

See the job log for details.

alexey-milovidov added a commit that referenced this pull request Oct 8, 2026
…ad without the string filter

`PageDecoderInfo::makeDecoder` does not pass the `StringValueFilter` to
`DeltaByteArrayDecoder`, so the setting is a no-op for such pages until
#124503 is merged. Narrow the
advertised support accordingly.

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

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

@alexey-milovidov alexey-milovidov self-assigned this Oct 8, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 8, 2026
Merged via the queue into master with commit fa4879c Oct 8, 2026
152 checks passed
@alexey-milovidov
alexey-milovidov deleted the string-filter-scan-pushdown-review-followup branch October 8, 2026 21:45
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 8, 2026
alexey-milovidov added a commit that referenced this pull request Oct 8, 2026
…rging master

Master now applies the string filter to `DELTA_BYTE_ARRAY` Parquet pages
(#124503), so the setting
description no longer says that such pages are read without it.

The dictionary pruning case of `05055_string_filters_during_scan_parquet` is
restored to the version from master: dictionary-encoded rows no longer
participate in the short value cutoff, so the longer non-matching values are
not needed.

The new test is renumbered to `05339`, because master added another `05338` test.

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

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.

2 participants