Skip to content

Revert "Revert "Evaluate PREWHERE functions of a dictionary-encoded Parquet column once per value"" - #126397

Merged
alexey-milovidov merged 6 commits into
masterfrom
revert-126396-revert-124131-parquet-prewhere-dictionary-replicated
Oct 22, 2026
Merged

alexey-milovidov merged 6 commits into
masterfrom
revert-126396-revert-124131-parquet-prewhere-dictionary-replicated

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Reverts #126396

Re-applies #124131 together with the fix for 05339_string_filters_during_scan_parquet_short_dictionary_values that broke master after it was merged.

Related: #124131
Related: #126384


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

Version info

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

@clickhouse-gh

clickhouse-gh Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2104867]

Summary: ✅


AI Review

Summary

This PR restores evaluation of single-column PREWHERE expressions over dictionary-encoded Parquet values, excludes columns eligible for cache writes, and adjusts the string-filter regression tests. No actionable findings remain after reviewing the current diff and discussion.

Missing context / blind spots
  • ⚠️ Local execution used the preceding PR commit, 151f4d07674b1422d7fbdd276cc272cc482aa4ac: all 32 result assertions from 05331 and focused mixed-page checks passed. The query-log counter assertions were not run locally, and the current-head CI run was still in progress. Its completed results would close this validation gap.
Final Verdict

✅ Approve, subject to the current CI run completing successfully.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label 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 and others added 3 commits October 18, 2026 14:16
…t-124131-parquet-prewhere-dictionary-replicated

Conflicts with the `Parquet` columns cache (#123008):
- `ReadManager::read`: keep `convertToFullColumnIfReplicated` with the new `getOrFormOutputColumn(row_group, ...)` signature.
- `Reader.cpp`: keep both sets of profile events.
- `05055` and `05339`: keep `AND id < 100000` from this PR and `use_columns_cache = 0` from master.
… written to the columns cache

After merging master, the column read by the last `PREWHERE` step could be both
decoded as a `ColumnReplicated` of dictionary values (`decode_dictionary_as_replicated`)
and written to the columns cache (#123008), which would put a `ColumnReplicated`
into the cache. Skip `decode_dictionary_as_replicated` for such a column, the same
way `string_value_filter` is skipped for it.

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

`clickhouse-test` randomizes `use_columns_cache`, and a column that can be written to
the columns cache is not decoded as dictionary indexes, which would change the
`ParquetRowsDecodedAsDictionaryIndexes` counts the test checks.

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

Copy link
Copy Markdown
Member Author

🕵 Merged master and pushed 151f4d07674.

  • The previous red was infrastructure: the targeted stateless job failed to load the test selection because the CIDB query hit a memory limit (MEMORY_LIMIT_EXCEEDED), and the remaining builds were dropped.
  • Conflicts with the new Parquet columns cache (UNIQUE KEY: read #123008) were resolved in ReadManager::read, the profile events, 05055, and 05339.
  • decode_dictionary_as_replicated is now skipped for a column that can be written to the columns cache, so that a ColumnReplicated never gets into the cache. This matches how string_value_filter is already skipped for such columns.
  • 05331 now pins use_columns_cache = 0, because clickhouse-test randomizes it.

Locally, 05331, 05339, 05055, and the columns cache tests 05338, 05340, 05395, and 05404 passed 5/5 runs each with randomized settings.

# Conflicts:
#	src/Processors/Formats/Impl/Parquet/Reader.cpp
#	src/Processors/Formats/Impl/Parquet/Reader.h
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and pushed 2104867ff4f.

  • The only red was 03821_drop_workload_during_query_race in Stateless tests (arm_binary, ParallelReplicas, s3 storage, sequential). It is unrelated, and its fix (741c1e5fbdf, "Fix flaky test 03821_drop_workload_during_query_race") is already on master, so the merge pulls it in.
  • Conflicts in Parquet/Reader.{h,cpp} with new profile events and the column_chunks members on master were resolved by keeping both sides.
  • clickhouse builds. Locally, 05331_parquet_prewhere_dictionary_values_once, 05339_string_filters_during_scan_parquet_short_dictionary_values, 05055_string_filters_during_scan_parquet, 05338_parquet_columns_cache_local_file, 05340_parquet_columns_cache_access, and 03821 passed 3/3 runs.

@clickhouse-gh

clickhouse-gh Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2104867ff with master 69553a30f (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of e4f63d9ce; 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.

Compile time of recompiled translation units

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

Job report

@alexey-milovidov alexey-milovidov self-assigned this Oct 21, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 21, 2026
Merged via the queue into master with commit 9390c79 Oct 22, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the revert-126396-revert-124131-parquet-prewhere-dictionary-replicated branch October 22, 2026 02:06
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 22, 2026
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-not-for-changelog This PR should not be mentioned in the changelog 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