Skip to content

Evaluate PREWHERE functions of a dictionary-encoded Parquet column once per value - #124131

Merged
grantholly-clickhouse merged 7 commits into
ClickHouse:masterfrom
groeneai:parquet-prewhere-dictionary-replicated
Oct 16, 2026
Merged

grantholly-clickhouse merged 7 commits into
ClickHouse:masterfrom
groeneai:parquet-prewhere-dictionary-replicated

Conversation

@groeneai

@groeneai groeneai commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: #124030

Changelog category (leave one):

  • Performance Improvement

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

In a PREWHERE condition on a single dictionary-encoded column of a Parquet file (strings and other values wider than 8 bytes), the functions applied to that column are now evaluated once per dictionary value instead of once per row, and only the rows that pass are materialized. ClickBench Q11 (WHERE MobilePhoneModel <> '') over hits.parquet is about 22% faster.

Description

For a PREWHERE step over one dictionary-encoded column the v3 reader gathered every row's value and evaluated the condition on every row, although a hits.parquet row group holds about 40 distinct MobilePhoneModel values.

When the last PREWHERE step has a single input column that no earlier step reads, its dictionary-encoded pages are read as indexes, and the step gets a ColumnReplicated over the chunk's dictionary values, compacted to the entries the subgroup's rows reference. IExecutableFunction then evaluates each function of that column once per value; a narrow result, such as a comparison's UInt8, is gathered back to rows, and functions of it run per row. The compaction means the step never sees a value of a row an earlier step rejected, without relying on canThrow. Per-row evaluation is kept for expressions sensitive to the evaluation count, for values of at most 8 bytes (most numbers, Bool, short FixedString), for Nullable and array columns, for large dictionaries, and from the first non-dictionary page of a chunk on. New profile event ParquetRowsDecodedAsDictionaryIndexes. The unfiltered dictionary-index decode now rejects a page that indexes an empty dictionary, as the filtered and fused decodes already did. That column is not checked against the apply_string_filters_during_scan filter, so 05055 moves its dictionary cases to an earlier step.

Validation (x86, max_threads = 4, max_parsing_threads = 4, 8 paired runs, 95% CI):

  • Q11 0.777 [0.704, 0.857], Q12 0.771 [0.732, 0.812]; no ClickBench query with a PREWHERE regresses, result hashes identical.
  • Three new queries in parquet_prewhere_dictionary_encoded.xml: 0.45 to 0.58; the existing five unchanged.
  • New stateless test, including values that throw in rows an earlier step rejects; a 4,680-query differential run against master over pyarrow-written files (V1/V2 pages, page index, mid-chunk dictionary fallback, nullable): no differences.

The issue's fused mask is not part of this change.


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

Version info

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

groeneai and others added 5 commits October 5, 2026 19:20
For a PREWHERE condition over one dictionary-encoded column, such as ClickBench
q11 `WHERE MobilePhoneModel <> ''`, the v3 Parquet reader gathered the string of
every row and then evaluated the condition on every row, although a row group
holds only a few dozen distinct values.

When the last PREWHERE step has a single input column that no earlier step reads,
read its dictionary-encoded pages as dictionary indexes and pass the step a
`ColumnReplicated` over the chunk's dictionary values, so that
`IExecutableFunction` evaluates each function once per value. The values are
first compacted to the entries the subgroup's (already filtered) rows reference,
so the step evaluates only values of rows it would see anyway; this does not
rely on `canThrow`, which has false negatives (e.g. `addDays(String, ...)`).
Steps whose expression is sensitive to the evaluation count (stateful,
side effects, not deterministic in the query) keep the per-row path, as do
types for which lazy replication does not pay (`isLazyReplicationUseful`),
nullable and array columns, and chunks whose dictionary is large relative to
the subgroup. A page that is not dictionary-encoded (a dictionary that fell back
to PLAIN in the middle of a chunk) materializes what was read and continues as
before. All outputs are materialized right after the last step, and delivery
converts any remaining `ColumnReplicated`.

New profile event `ParquetRowsDecodedAsDictionaryIndexes`.

Based on the analysis in ClickHouse#124030.
Closes ClickHouse#124030

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pty dictionary, as the filtered and fused decodes already do; the new path relies on it.

The ParquetReaderPrewhere gtest fixture gives its primitive columns the root level that SchemaConverter always sets.
05331 checks that the page-index query C is read as dictionary indexes.
05331 adds a FixedString(16) column and a PREWHERE over it, read as dictionary indexes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A UInt32, a Nullable(String) with a zero null_count statistic, an Array(String) and a String whose
dictionary is larger than half the rows each get a PREWHERE query with a hash oracle and a zero
routing row. The Nullable query also checks that the file records null_count = 0, so the static
output_nullable check is the only thing keeping that column off the dictionary-index path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… of the column

A narrow result, such as the UInt8 of a comparison, is gathered back to rows,
so functions applied to it still run per row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the applyPrewhere comment that restates the lambda, shorten the preparePrewhere one to one line, and backtick class and function names in the added comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-issue PR origin: picked up an external GitHub issue labels Oct 6, 2026
@groeneai

groeneai commented Oct 6, 2026

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, then 1, 2 and 0 on the re-reviews) plus my own review (1 blocker, 3 nits).

# Sev Finding Verdict Evidence / action
1 ❌ A 0-entry dictionary with a bit-width-0 index page reached the new unfiltered index decode, which skipped the limit == 0 check (Decoding.cpp skipOrDecode) AGREE, fixed @ 0e33e38 the check now applies to every non-skip decode; crafted file gives INCORRECT_DATA as on master
2 ⚠️ ParquetReaderPrewhere.* gtests reach levels.back() on an empty fixture vector AGREE, fixed @ 0e33e38 fixture gets the root level production always has
3 ⚠️ Page-index query had no routing assertion AGREE, fixed @ 0e33e38 05331:c routing row; a mutation disabling the page-index path flips it
4 ⚠️ No committed test for the fixed-size dictionary mode AGREE, fixed @ 0e33e38 FixedString(16) query + routing row; a String-only mutation flips it
5 💡 Mid-chunk PLAIN fallback not reachable with ClickHouse-written files noted, not blocking covered by a local differential run over pyarrow files
6 💡 Cached decoded dictionary copy is not charged to the reader's memory budget noted, not blocking same as the data-path dictionary on master; one copy per chunk
7 ⚠️ No test pinned the exclusions (values of at most 8 bytes, Nullable, Array, large dictionary) AGREE, fixed @ 62840ce four queries with zero-routing rows; a mutation removing each exclusion flips only its row
8 ⚠️ Title, changelog and profile event said the whole condition runs once per dictionary value, but a narrow result (e.g. a comparison's UInt8) is gathered back to rows, so functions of it run per row AGREE, fixed @ ce0dc26 wording narrowed to the functions applied to the column; keeping narrow results replicated would change the lazy replication policy shared with joins (isLazyReplicationUseful)
9 ⚠️ No test pins the nondeterminism and side-effect parts of the evaluation-count guard DISAGREE a nondeterministic call already gets its replicated arguments materialized (IFunction.cpp:716, isCallDeterministicInScopeOfQuery), and sleep/sleepEachRow, the only functions with observable side effects, need a constant argument (sleep.cpp:127), so neither can be deduplicated; the stateful part, which the function layer does not guard, is pinned by query S4
10 💡 The replicated decode is not governed by enable_lazy_columns_replication noted, not blocking that setting covers JOIN, ARRAY JOIN and lambda captures; disabling PREWHERE (optimize_move_to_prewhere, query_plan_optimize_prewhere) turns the path off

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

@groeneai

groeneai commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. hits.parquet, ClickBench Q11, max_threads = 4, max_parsing_threads = 4: base 439 ms, fix 340 ms; ParquetRowsDecodedAsDictionaryIndexes = 99,997,497 on every run. The new test asserts the routing counts on demand.
b Root cause explained? The reader gathered every row's value of the PREWHERE column and evaluated the condition per row. A CPU profile of Q11 on base: Dictionary::appendRepeated 21% self time, plus notEmpty and the string filter, for a column with ~40 values per row group.
c Fix matches root cause? Yes. The step sees a ColumnReplicated over the dictionary values, so each function applied to the column runs once per value and only passing rows are gathered. No test was weakened.
d Test intent preserved / new tests added? New stateless test 05331_parquet_prewhere_dictionary_values_once (correctness, throwing values in rejected rows, routing counts including the page-index and FixedString(16) paths) and three queries in parquet_prewhere_dictionary_encoded.xml.
e Both directions demonstrated? Q11 fix/base 0.777 [0.704, 0.857] over 8 paired runs. On master the new test differs only in the routing rows (0 instead of 10000-30000), every result row matches. A crafted file whose dictionary is empty and whose index page has bit width 0: master throws INCORRECT_DATA, the unfiltered index decode without the new check returned 0 for PREWHERE s != '', the fix throws INCORRECT_DATA again (debug and ASan).
f Fix is general across code paths? Both decode loops (filter in decoder, row ranges), the all-pass shortcut, page index, a dictionary that falls back to PLAIN mid-chunk, both exits of applyPrewhere, delivery. The unfiltered dictionary-index decode now has the empty-dictionary check that the filtered and fused decodes have. Columns read by an earlier step, derived outputs and evaluation-count-sensitive steps stay on the old path (tested, and mutation arms for each turn the test red).
g Fix generalizes across inputs (params/datatypes/wrappers)? String, wide FixedString and Decimal128 are routed; numbers, Bool and short FixedString are excluded by isLazyReplicationUseful; Nullable and arrays are excluded; the test pins each exclusion (UInt32, Nullable(String) with null_count = 0, Array(String), a dictionary larger than half the rows) with a zero routing row that its mutation arm turns red. 4,680-query differential run against master over String/FixedString(4)/FixedString(16)/Decimal(38,2), V1/V2 pages, page index, nullable, block sizes 777/1000/65409: no differences.
h Backward compatible? (maintainer-approved exception only) Yes. No setting or format change; one new profile event. ParquetRowsFilterExpression is unchanged (the six assertions of test_parquet_prewhere.py reproduce identically).
i Invariants and contracts preserved? The routed column equals the old decoded column row by row, and no ColumnReplicated leaves the reader (materialized after the last step and at delivery). The cached per-chunk values are never mutated; a chunk is decoded by one task at a time. ASan+UBSan: new test and the Parquet suite, no reports.

Session id: cron:clickhouse-impl-slot-6:20261005-155700

@clickhouse-gh

clickhouse-gh Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [32e261a]

Summary: ✅


AI Review

Summary

This PR speeds up the Parquet v3 reader by keeping the last single-column PREWHERE step on dictionary indexes and evaluating functions on compacted dictionary values instead of on every row. The optimization is promising, but one blocker remains: it still changes observable semantics for short-circuit expressions, so a query can now raise an exception from dictionary values that no surviving row would evaluate on the existing row-wise path.

Findings

❌ Blockers

  • [src/Processors/Formats/Impl/Parquet/Reader.cpp:1669] The new decode_dictionary_as_replicated gate only excludes expressions that are sensitive to evaluation count, but it still admits short-circuit DAGs such as if, multiIf, and, and or. That is not enough to preserve PREWHERE semantics: maskedExecute filters a lazy branch by filtering only the ColumnReplicated indexes (src/Columns/MaskOperations.cpp:300, src/Columns/ColumnReplicated.cpp:366) and then reduce executes the branch on the un-compacted nested dictionary payload. As a result, a masked branch can still evaluate unreachable dictionary values and throw on them, even though row-wise short-circuit execution would suppress the exception. A query like PREWHERE if(d = 'garbage', 0, addDays(d, 1) > toDateTime('2020-01-03 00:00:00')) on a dictionary-encoded String column still has that problem. Please either disable decode_dictionary_as_replicated for DAGs that contain short-circuit functions, or compact replicated captures after maskedExecute before reducing the branch.
Final Verdict

❌ Not ready to merge: the replicated dictionary path is still unsound for short-circuit PREWHERE expressions and can surface exceptions that the preexisting execution model does not.

PrimitiveColumnInfo & pc = primitive_columns.at(output_info.primitive_start);
if (pc.first_step_to_calculate == steps.size() && !pc.output_nullable && !pc.group_nullable && pc.levels.back().rep == 0
&& isLazyReplicationUseful(pc.decoded_type->createColumn()))
pc.decode_dictionary_as_replicated = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This optimization still admits short-circuit expressions such as if, multiIf, and and or, but the compaction in decodePrimitiveColumn only drops dictionary values rejected by earlier PREWHERE steps. Inside the last step, lazy short-circuit execution goes through maskedExecute/ColumnFunction::filter, which keeps the original nested ColumnReplicated dictionary and only filters its indexes. If a masked branch contains a false-negative canThrow function — the PR description already calls out addDays(String, ...) — IExecutableFunction::execute can still evaluate that branch on dictionary entries that no surviving row will ever touch, and raise an exception that row-wise short-circuit execution would suppress.

A concrete repro is a single-column last step like PREWHERE if(d = 'garbage', 0, addDays(d, 1) > toDateTime('2020-01-03 00:00:00')) on a dictionary-encoded String column d: rows with d = 'garbage' should never evaluate addDays, but this path still can. Please either exclude DAGs with short-circuit functions from decode_dictionary_as_replicated, or re-compact filtered replicated captures after maskedExecute before reducing the branch.

@clickhouse-gh clickhouse-gh Bot added the comp-parquet-reader-v3 Issues related to the native Parquet reader. label Oct 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 31 queries analysed

No query showed a performance change that can be traced to this PR. The only flagged row is clickbench Q33. Its +5.1% (1025.5 ms to 1078 ms) falls inside master's normal range of 960-1243 ms, the query's history is noisy, and it remains not_sure. The PR only changes the Parquet PREWHERE path, which now reads dictionary-encoded columns as dictionary indexes. Q33 is a GROUP BY over a native table and never runs that code, so the result is consistent with the diff and there was no reason to override it.

clickbench

⚠️ 1 inconclusive

Flagged queries (1 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 33 not_sure 1026 1078 +5.1% <0.0001 aggregation: Q33 is a heavy high-cardinality GROUP BY on a native table and never runs the Parquet reader this PR changes. The +5.1% falls inside master's normal range, and this query's history is noisy.

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: fb36cbbe-8f09-4746-ad68-f1d1cd1cb16d
  • MIRAI run: 350185eb-dac2-4c18-8d77-8cf604fbcfcf
  • PR check IDs:
    • clickbench_789500_1791672438
    • clickbench_789513_1791672438
    • clickbench_789519_1791672438
    • tpch_adapted_1_official_789526_1791672438
    • tpch_adapted_1_official_789556_1791672438
    • tpch_adapted_1_official_789571_1791672438

…d once per value

`getDictionaryValues` materializes each dictionary entry once per column
chunk. With `apply_string_filters_during_scan` it went through
`Dictionary::index` with the string filter mask, which also reported every
entry to the shared `StringValueFilter`, so its adaptive disable and its
profile counters were driven by the dictionary's cardinality rather than by
the rows the scan sees. The values evaluated by the last PREWHERE step do not
need the mask, so gather them unmasked, as the dictionary pruning path does.

When a chunk falls back from dictionary to PLAIN pages, the indexes already
decoded for the subgroup are now gathered through `Dictionary::index`, as the
per-row path does, so those rows are masked and counted like the rest of the
subgroup instead of being copied from the cached values.

Measured with `StringValueFilterValuesChecked`: on a file with one
dictionary-encoded and two PLAIN row groups it was 20020 (20 dictionary
entries plus 20000 PLAIN values) and is now 20000; on pyarrow files whose
`late` column falls back mid-chunk it is 60000, same as master (29000 without
the second change). Results are unchanged (4,446-query differential against
master with the filter enabled).

05055 checked that the filter is applied to dictionary-encoded pages with a
single-column PREWHERE, which now takes the replicated path and so only passed
through the counters this commit removes. A second conjunct on `id` keeps `s`
in an earlier step, where the masked per-row decoding is used.

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

Copy link
Copy Markdown
Contributor

@groeneai can you check if this will conflict with #124186?

@groeneai

Copy link
Copy Markdown
Collaborator Author

I checked: they don't conflict, and they can merge in either order with no follow-up change.

  • Textually: both heads (32e261a2 here, 813572fd in Speed up reading Parquet columns after a PREWHERE step #124186) merge cleanly with each other and with current master.
  • Semantically there is one interaction: Speed up reading Parquet columns after a PREWHERE step #124186 returns early from Reader::applyPrewhere when every row passes a step, which skips the materialize_replicated() call this PR adds after the last step's filter. That is still correct, because ReadManager::read calls convertToFullColumnIfReplicated on every output column before it builds the chunk, so the gather just moves to delivery, over the same rows.
  • Measured on a debug build of the merge: 05331_parquet_prewhere_dictionary_values_once, 05331_parquet_prewhere_plain_fixed_size and 05055_string_filters_during_scan_parquet pass without random settings and in 20 randomized runs each. PREWHERE queries whose last step passes every row (s != 'zzz', k < 1000000 AND s != 'zzz', k < 1000000 AND upper(s) != 'ZZZ') take the dictionary path (ParquetRowsDecodedAsDictionaryIndexes = 30000) and return the same results as master.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 32e261a

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
Fast test (arm_darwin) / 05238_pretty_squash_broken_pipe not from this PR (it changes the Parquet reader only): the first subtest renders its whole first squashed table before the first write, so on the macOS runner it exits 241 (MEMORY_LIMIT_EXCEEDED) instead of 75. 14 PRs show it on this check since 2026-10-10 #125102 (mine, open)
Mergeable Check, PR praktika rollups of the row above #125102 (mine, open)

Session id: cron:our-pr-ci-monitor:20261011-020007

@grantholly-clickhouse

grantholly-clickhouse commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

@al13n321 I could use your help reviewing this PR

This PR #124186 looks very similar, and is a smaller more focused set of changes. I think it would be best to merge that one first. Do you think #124186 makes this PR unnecessary?

@alexey-milovidov alexey-milovidov self-assigned this Oct 16, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

Let's also ask the same question @groeneai

@groeneai

Copy link
Copy Markdown
Collaborator Author

No. The two PRs speed up different parts of the read, and the gains add up.

Measured on current master 973247c8 (it includes #124186), Release builds, ClickBench hits.parquet, max_threads = max_parsing_threads = 4, 16 paired runs, 95% CI:

query master master + this PR ratio
q11 (MobilePhoneModel <> '') 419 ms 288 ms 0.69 (0.63-0.76)
q12 483 ms 387 ms 0.80 (0.74-0.88)
sum(UserID), sum(WatchID) WHERE EventDate >= '2013-07-01' (the all-pass query of #124186) 570 ms 593 ms 1.04 (0.94-1.15)
q3 (control) 179 ms 186 ms 1.04 (0.96-1.12)

With #124186 reverted on the same master, q11 does not change (1.04, 0.96-1.13) while its own query takes 1.77x as long. So #124186 does not move q11, and this PR does not move the query #124186 targets. Query results are identical across the three builds.

The PR merges cleanly with current master, and 05331_parquet_prewhere_dictionary_values_once, 05331_parquet_prewhere_plain_fixed_size and 05055_string_filters_during_scan_parquet pass on the merged build, with and without random settings (10 randomized runs each).

alexey-milovidov pushed a commit that referenced this pull request Oct 17, 2026
Since #124131, the only input of the last PREWHERE step on a dictionary-encoded
Parquet `String` column is read as dictionary indexes when no earlier step
reads it (`decode_dictionary_as_replicated`), and its dictionary values come
from `Reader::getDictionaryValues` with `use_string_value_filter = false`. So a
single-column `PREWHERE s LIKE '%R%'` no longer passes through
`StringValueFilter` and `StringValueFilterValuesReplaced` stays 0, which made
the last line of 05339 print 0 on every master run since d64fd50.

#124131 adapted 05055 for the same reason (32e261a), but 05339 was added
by #124507 after #124131's last CI run, so it was never adapted.

Add the same always-true conjunct `AND id < 100000` to the three PREWHERE
queries: the conjunct order is kept, so `s` is read by the first of two steps
and goes through the masked `Dictionary::appendIndexes` path the test checks.
It goes on the two `apply_string_filters_during_scan = 0/1` comparison queries
too, because with the single-column shape both arms read indexes and the
comparison compared nothing. The reference does not change.

Validated on a debug build of d64fd50: the old test fails 6/6, the new one
passes 50/50 randomized (66667 replaced, 0 rows read as indexes). Reporting the
mask lookups through `updateStats` instead of `updateStatsWithoutPerValueChecks`
makes the new test fail 8/8 (5712-6384 replaced).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit to groeneai/ClickHouse that referenced this pull request Oct 17, 2026
…-tuple-all-shapes

Master reverted ClickHouse#124131 (`ColumnReplicated` decoding of dictionary-encoded PREWHERE columns).
Dropped the previous resolution's combination of `decode_dictionary_as_replicated` with
`group_null_maps` in `Reader::decodePrimitiveColumn` and the adapted gate in
`Reader::preparePrewhere`; the PR's own `group_null_maps` logic is kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit to groeneai/ClickHouse that referenced this pull request Oct 17, 2026
…-chunks

Master reverted ClickHouse#124131, removing `getDictionaryValues` next to the PR's `column_chunks` and
`cached_column_chunks` members in `Reader.h`; kept only the PR's members.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit that referenced this pull request Oct 17, 2026
Master reverted #124131, so the Parquet reader no longer produces `ColumnReplicated`: dropped the
`convertToFullColumnIfReplicated` calls after `getOrFormOutputColumn` in `ReadManager::read` and in
`Reader::addToColumnsCacheWrite`, and the `ParquetRowsDecodedAsDictionaryIndexes` declaration.
In `05055_string_filters_during_scan_parquet.sh`, took master's queries and kept `use_columns_cache = 0`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fm4v added a commit that referenced this pull request Oct 17, 2026
…argeted checks

The coverage selection cannot see a test until a `master` coverage run records it, so a test that landed on `master` after the PR's last CI run escapes it. The `Config Workflow` job of the merge queue (which unshallows the repository) now finds the stateless tests and integration test modules changed on the first-parent history of the queue base after the PR head commit time (or after the merge base, if the PR merged `master` since), keeps the 30 stateless and 10 integration ones whose names share most words with the files the PR changes, and stores them. Both merge-queue targeted checks add them to the selection as mandatory tests. The window and ranking follow #126406.

Replayed on the merge-queue commits of the two known cases: for #117198 the integration selection includes `test_storage_delta/test_writes_interop.py` and `test_storage_delta/test.py`; for #124131 the stateless selection includes `05339_string_filters_during_scan_parquet_short_dictionary_values`.

The merge-queue targeted jobs are no longer cached: their selection depends on the queue entry and the attempt, neither of which is in the digest.
clickhouse-gh Bot pushed a commit that referenced this pull request Oct 18, 2026
Edited by the nightly changelog CI job following .claude/skills/edit-changelog/SKILL.md.

Changelog-revert: 126396 124131 Revert "Evaluate PREWHERE functions of a dictionary-encoded Parquet column once per value"
Changelog-deleted-entry: 124131 [Performance Improvement] [section] * In a `PREWHERE` condition on a single dictionary-encoded column of a `Parquet` file (strings and other values wider than eight bytes), the functions applied to that column are now evaluated once per dictionary value instead of once per row, and only the rows that pass are materialized. ClickBench Q11 (`WHERE MobilePhoneModel <> ''`) over `hits.parquet` is about 22% faster. [#124131](#124131) ([Groene AI](https://github.com/groeneai)).
alexprabhat99 pushed a commit to alexprabhat99/ClickHouse that referenced this pull request Oct 19, 2026
The merge-queue flaky check reran only the PR's own new/changed tests. That
catches a `master` change breaking the PR's tests, but not the reverse: the PR
breaking a test that landed on `master` after the PR's last CI run. This is how
ClickHouse#124131 broke
`05339_string_filters_during_scan_parquet_short_dictionary_values` from
ClickHouse#124507 and was reverted by
ClickHouse#126396.

The `Config Workflow` job of the merge queue, which has the commit history, now
finds the tests changed on the first-parent history of the queue base after the
PR head commit time (or after the merge base, if the PR merged `master` since),
and stores them for the flaky check. When there are more than 30, the ones whose
names share more words with the names of the files changed by the PR come first.

For the merge-queue commit of ClickHouse#124131 (`d64fd503b42e`), the range has 819 tests,
and 05339 is selected second.

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. groeneai-origin-issue PR origin: picked up an external GitHub issue 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.

Parquet: a single-column PREWHERE condition is tested on every row; testing each dictionary value once makes ClickBench q11 22% faster

4 participants