Skip to content

Columns cache for Parquet - #124531

Merged
alexey-milovidov merged 27 commits into
masterfrom
parquet-columns-cache
Oct 18, 2026
Merged

alexey-milovidov merged 27 commits into
masterfrom
parquet-columns-cache

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Extends the columns cache (#96844) to Parquet files: local files (file, File), object storages (s3, azureBlobStorage and their engines) and data lake tables, i.e. every read that goes through the metadata-aware Parquet creator. Repeated queries over hot Parquet data no longer pay for reading, decompressing and decoding the column chunks.

How it works:

  • An entry holds a whole output column of one row group, in the same ColumnsCache as MergeTree (the row group index is the stripe). So it shares the size limit, admission control, system.columns_cache and SYSTEM DROP COLUMNS CACHE.
  • The key is: the path of the file among all storages (with the bucket or container, the connection and the read source index, from getUniqueStoragePathIdentifier; the absolute path of a local file), its version (ETag of an object, or the version token of a local file) and its size; the format settings that change decoded values; the file columns the output column is read from; and the decoded and output types. A local file is cached only once its version token has settled, the same rule the query condition cache uses (ObjectMetadata::etag_is_strong is set accordingly).
  • A cached column is neither prefetched nor decoded. Each row subgroup takes its rows from the cached column, filtered as the subgroup is. Bloom filters, the dictionary filter and the column index still prune as usual.
  • A column is written only when every row subgroup of the row group reads all its rows before any filter. So with PREWHERE, the filter columns are cached; columns read only for the rows that pass are not. A column that may be written is decoded without apply_string_filters_during_scan, so the cache gets its real values.
  • The per-query budgets columns_cache_max_estimated_bytes_to_write_to_cache and columns_cache_max_bytes_to_write_to_cache apply. The estimate is the uncompressed size of the column chunks to be written.
  • In system.columns_cache, an entry of a file is shown only to a user holding global SHOW COLUMNS and an unrestricted READ grant on the source of the file (FILE, S3, AZURE, HDFS, URL).
  • use_parquet_metadata_cache is now checked by the format creator itself, because StorageObjectStorageSource now passes the object metadata when either cache needs it.

Local check (1M rows, 4 columns, 8 row groups, max_threads = 1): CPU time per query went from about 60 ms to 6-7 ms once the columns were cached. All existing stateless Parquet tests were also run with use_columns_cache = 1 forced through the default profile. Results are unchanged; the only differences were counters in 05055_string_filters_during_scan_parquet, which now pins use_columns_cache = 0 for those checks.

Related: #96844

Changelog category (leave one):

  • Experimental Feature

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

The columns cache (use_columns_cache) now also applies to Parquet files read from the local filesystem, from object storages such as S3 and Azure, and by data lake tables. Repeated reads of the same row groups skip reading and decoding the column chunks.

🤖 Generated with Claude Code


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

Version info

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

alexey-milovidov and others added 2 commits October 8, 2026 00:53
Use the columns cache (`use_columns_cache`) for `Parquet` files read from
the local filesystem (`file`, `File`), from object storages (`s3`,
`azureBlobStorage` and their engines) and by data lake tables.

An entry holds a whole output column of one row group; the row group index
is its stripe. The key is made of the path of the file, its version (the
ETag of an object, or the version token of a local file once it has settled)
and size, the format settings that change the decoded values, the columns of
the file the column is read from and the types it is decoded into and
converted to. The entries share the cache with `MergeTree`, its size limit,
`system.columns_cache` and `SYSTEM DROP COLUMNS CACHE`.

A column found in the cache is neither prefetched nor decoded: every row
subgroup takes its rows from the cached column, filtered as the subgroup is.
A column is written only when every row subgroup of the row group reads all
its rows before any filter, so with `PREWHERE` the columns of the filter are
written. The per-query write budgets are respected.

`use_parquet_metadata_cache` is now honored by the format itself, as
`StorageObjectStorageSource` now passes the object metadata also when only
the columns cache needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dictionary filter prunes row groups for all columns, so a column found in
the cache still reads its dictionary page when the filter is used for it.
Pin `use_columns_cache = 0` where `05055_string_filters_during_scan_parquet`
checks that the string filters are applied: a column that can be written to
the columns cache is decoded without them.

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

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [08059a4]

Summary: ✅


AI Review

Summary

This PR extends use_columns_cache to decoded Parquet row-group columns from files, object storage, and data lakes. Review of head 08059a4a359cedc1897ae06f2018af059e27daba retains four findings: incorrect timestamps across time zones, unbounded cache-write staging, underestimated memory for cached strings, and a parser-depth limit bypass. The timestamp correctness issue blocks approval.

Missing context / blind spots
  • ⚠️ CI for the reviewed head remains running, with 105 jobs pending. Completed functional and sanitizer results are still needed. Focused memory and depth reproductions used CI binary 726f6f75887; the relevant source matches the current head except for an all-rows-pass shortcut that the half-selective memory reproduction does not take.
Findings

❌ Blockers

  • Cache identity omits the effective time zone. ParquetV3BlockInputFormat.cpp:134. String conversion to DateTime or DateTime64 without an explicit zone depends on session_timezone, which neither this hash nor the type-name identity captures. The existing reproduction warms 2020-01-01 00:00:00 in UTC, then reads in America/New_York: the cache returns 1577836800, while an uncached read returns 1577854800. Partition entries by the effective conversion time zone. [dismissed by author -- https://github.com/Columns cache for Parquet #124531#discussion_r4296855476] The wrong result remains possible across independently configured sessions; changing one session in place is unnecessary.

⚠️ Majors

  • Decoded cache-write staging has no effective memory bound. Reader.cpp:4316. Staging grows outside query accounting and reader watermarks, while canWriteToColumnsCache counts only entries already admitted. Encoded page size can grossly underestimate decoded strings. The existing reproduction stages a 256 MiB payload from a 33,250-byte file with a 32 MiB cache and 1 MiB write budgets, exceeding the server memory limit before an entry that cannot fit is rejected. Reserve and bound aggregate in-flight staging before growth, and abandon entries that cannot fit. [dismissed by author -- https://github.com/Columns cache for Parquet #124531#discussion_r4293387287] This exceeds the entire cache eightfold, rather than merely overshooting a soft threshold slightly.

  • Cached string copies still bypass effective reader backpressure when optional size statistics are absent. ReadManager.cpp:944. The reservation uses the metadata estimator, which assumes 20 bytes per dictionary string until its dictionary is decoded (Reader.cpp:2957–2970). Cache hits skip dictionary decoding, so this estimate stays wrong throughout the read. Reproduced with 131,072 alternating 1,024-byte strings in 63 cached row groups without optional size_statistics: SELECT sum(sipHash64(s)) … PREWHERE endsWith(s, '0'), with 1/2 MiB reader watermarks and a 32 MiB query limit, succeeds uncached but fails cached at 32.40 MiB. Block sizes 256 and 1,024 both diverge. Reserve from the available decoded cached column. Existing thread reopened with the reproduction because the claimed fix is incomplete.

  • Warm reads bypass max_parser_depth. ParquetV3BlockInputFormat.cpp:134. decodeVariantColumn enforces this limit, but the cache identity omits it and a hit skips decoding. Reproduced with a JSON value containing 100 nested objects: warming with max_parser_depth = 0, then reading with 20, succeeds from cache while the uncached query raises TOO_DEEP_RECURSION. Include the limit in the cache identity or enforce it on hits. Existing thread.

Tests
  • ⚠️ Add focused cache-on/cache-off regressions for time-zone-dependent DateTime and DateTime64 conversion and for a nested variant value read under different max_parser_depth limits.
  • ⚠️ Extend memory coverage with dictionary strings lacking optional size statistics, and a highly compressed row group whose decoded column exceeds the cache size. Existing memory tests do not cover these cases.
Final Verdict

Status: ❌ Block. Correct the time-zone identity, bound in-flight cache-write memory, size cached-copy reservations from decoded data, and preserve the parser-depth limit; cover these cases with focused regressions.

@clickhouse-gh clickhouse-gh Bot added the pr-experimental Experimental Feature label Oct 8, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-parquet-reader-v3 Issues related to the native Parquet reader. label Oct 8, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit 08059a4a359cedc1897ae06f2018af059e27daba 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 and others added 2 commits October 8, 2026 06:01
…che`

`DatabaseCatalog::tryGetByUUID` requires a non-nil UUID, and the entries of
`Parquet` files have the nil one, so reading `system.columns_cache` threw a
logical error exception in debug and sanitizer builds.

Also pin `use_columns_cache = 0` in tests that check the reads themselves:
`04342_reader_executor_s3_long_connections` writes the same object with the
same ETag in every run, so a rerun was served from the cache without opening
a connection, and `05321_parquet_bool_hint_no_minmax_pruning` checks
`ParquetReadPages`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=7b7a1351da28112ad0428c6f960ffddc75fedbc1&name_0=PR
PR: #124531

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts to the columns cache

The check consulted only `block_missing_values`, which is allocated only for
the columns of the sample block and only with
`input_format_defaults_for_omitted_fields`. Decide from the null map of the
column instead, so that a column whose nulls were replaced with defaults
(`input_format_null_as_default`) is never written, whether or not the query
reports them in the block missing values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits October 9, 2026 04:06
…ue path, check the source grant in `system.columns_cache`

The relative path of an object does not identify it: another bucket, container or endpoint can
have an object with the same key and version token. `StorageObjectStorageSource` now passes
`getUniqueStoragePathIdentifier` (with the namespace, the connection and `read_source_index`) as
`RelativePathWithMetadata::path_for_content_cache`, and `StorageFile` passes the absolute path.
The columns cache is not used for an object without it.

An entry of a file now records its source (`FILE`, `S3`, `AZURE`, `HDFS`, `URL`), and
`system.columns_cache` shows it only to a user holding an unrestricted `READ` grant on that source
besides `SHOW COLUMNS` globally, so the paths of the files do not leak across privilege boundaries.

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

The style check requires queries to `system.columns` (which also matches
`system.columns_cache`) to have a `database` condition. The entries of
`Parquet` files have an empty `database`, so filter by `database = ''`.

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

Copy link
Copy Markdown

Measurements of this PR (CI build of 74a3564) on ClickBench hits.parquet in S3. Reruns are 2-6x faster than with the page cache alone. Two costs: the run that fills the cache with URL is 24% slower and its query memory includes everything it writes; under memory pressure, a GROUP BY spills to disk because the cached columns count as used memory.

Setup. r7g.xlarge (4 vCPU, 30 GiB). hits.parquet (14.8 GB, 226 row groups) is one object behind ENGINE = S3, served from another host (versitygw, 20 ms to first byte). Both arms have 16 GiB of cache and use_page_cache_for_object_storage = 1:

  • cache on: use_columns_cache = 1, columns_cache_size 13 GiB, columns_cache_size_ratio = 0.2, columns_cache_max_estimated_bytes_to_write_to_cache and columns_cache_max_bytes_to_write_to_cache 12 GiB, page_cache_max_size 3 GiB;
  • cache off: use_columns_cache = 0, page_cache_max_size 16 GiB.

Each arm and repetition starts a fresh server; 4 paired repetitions in rotated order. Ratios are cache on / cache off, geometric mean with a 95% t-interval.

The write budgets are raised because with the defaults the 13 GiB cache stores nothing for the URL scan (0 bytes after two runs; the second run still takes 3.3 s). The estimate, about 7.6 GB of uncompressed URL chunks, is over half the cache, so all writes of the query are disabled. With the raised budgets, the 226 URL entries take 9.84 GB.

Query (ClickBench, 0-based) Cache off Cache on On / off
Q20 run 1, fills the cache 11.6 s 14.3 s 1.24 [1.18, 1.30]
Q20 runs 2-6 3.3 s 0.58-0.71 s 0.17-0.22
Q21 run 1 7.8 s 2.3 s 0.30 [0.26, 0.35]
Q21 runs 2-6 2.2-2.3 s 0.57-0.72 s 0.26-0.31
Q27 runs 2-6 2.9-3.2 s 0.77-0.88 s 0.24-0.29
Q2 run 1, fills the cache 1.45 s 1.42 s 0.99 [0.93, 1.05]
Q2 runs 2-12 0.20-0.22 s 0.10-0.12 s 0.50 [0.46, 0.54]
Q20, Q21, Q27 × 6, total 66.9 s 29.3 s 0.44 [0.42, 0.45]

The run that fills the cache. For Q20, query memory goes from 0.31 to 9.3 GiB, system time from 3.8 to 7.2 s and minor page faults from 1.0M to 3.6M. Disabling apply_string_filters_during_scan alone (cache off) does not slow the cold run (1.006, 3 pairs), so the extra time is the copy of the decoded columns into new cache entries (addToColumnsCacheWrite), in newly allocated memory. Because the entries are charged to the query, its memory limit has to cover every column it writes, here 30 times what Q20 needs otherwise. Charging them to the cache would avoid that.

Memory pressure. max_server_memory_usage is 20 GiB. Q20 × 6 fill the cache, then one client loops Q33 (GROUP BY URL) while another runs Q20 × 4, Q21 × 3, Q27 × 3.

  • The first Q33 takes twice as long, 2.00 [1.71, 2.35] (6.5 → 12.9 s): it spills 10-11 external aggregation parts, none without the cache. Its threshold is max_bytes_ratio_before_external_group_by (0.5) × (server limit − memory in use) when it starts (getMostStrictAvailableSystemMemory), and the 9.2 GiB of cached columns count as in use. The cache then shrinks to 0-1.8 GiB during the query, but the threshold is already set. With the cache, all 17 Q33 runs spilled; without it, the first never did and 12 of 28 did overall.
  • The first timed Q20 still hits the cache (1.2-1.6 s vs 5.3-6.2 s). The second is 1.56 [1.16, 2.09] times as slow as without the cache (71 S3 GETs, 4.7-7.4 GiB query memory), because the evicted entries are read and written again.
  • The timed sequence as a whole is still faster with the cache, 0.74 [0.59, 0.93], but Q33 completes 4-5 times during it instead of 7. No query failed.

Counting the evictable part of the cache as available in getMostStrictAvailableSystemMemory should avoid the extra spills; I have not tested that.

Queries and run order
-- Q2
SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits;
-- Q20
SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%';
-- Q21
SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10;
-- Q27
SELECT CounterID, AVG(length(URL)) AS l, COUNT(*) AS c FROM hits WHERE URL <> '' GROUP BY CounterID HAVING COUNT(*) > 100000 ORDER BY l DESC LIMIT 25;
-- Q33
SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10;

Rerun table: each repetition runs Q20 × 6, Q21 × 6, Q27 × 6, waits until 95 s after server start, then runs Q20 and Q2 × 12, with --format Null.

…ies read by tables

The entries of a `Parquet` file read by a table (`ENGINE = File`, `S3`, `AzureBlobStorage`,
`Iceberg`, ...) had the nil UUID, so `system.columns_cache` showed them to any user with global
`SHOW COLUMNS` and `READ` on the source, regardless of their access to the table. Now such entries
carry the UUID of the table and are shown under the same rules as the entries of `MergeTree`
tables; the nil-UUID, source-grant path is kept only for table functions. A table without a UUID
(e.g. in an `Ordinary` database) does not use the columns cache, since the provenance of its
entries cannot be kept.

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

Copy link
Copy Markdown
Member Author

🕵 Thanks for the measurements, @snelheidai. Pushed c489c79, which addresses the AI-review blocker: Parquet entries read by a table now carry the table's UUID, so system.columns_cache checks access to the table. Only table-function reads keep the source-READ check.

The three costs you found change how the cache is accounted and admitted, so they need a decision from the author. I have not changed them in this pass:

  • Write memory is charged to the query. The query that fills the cache is charged for the entries it writes (addToColumnsCacheWrite), so its memory limit has to cover all of them. Moving that charge to the cache is the obvious fix.
  • Extra spills under memory pressure. getMostStrictAvailableSystemMemory counts cached columns as used memory, which makes external GROUP BY spill more. Treating the evictable part of the cache as available should avoid that, but it affects every columns cache user, MergeTree included.
  • Large scans write nothing with the default budgets. For a scan as large as the URL column of hits.parquet, the estimated-bytes budget (half of the cache) blocks all writes of the query. A per-row-group admission would still cache a prefix of the scan.

All of the remaining CI failures are unrelated to this PR:

… cache key

The key of a `Parquet` columns cache entry was built with the nil UUID even for
reads by tables, so a read by a table function (`file`, `s3`) and a read by a
table (`ENGINE = File`, `S3`, data lakes) of the same file shared one entry.
Whichever path wrote it decided which access check `system.columns_cache`
applies. Now the identity includes the UUID of the owning table, so the entries
of the two paths are separate. The test `05355_parquet_columns_cache_table_access`
now warms the file through the table function first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits October 13, 2026 07:03
# Conflicts:
#	src/Processors/Formats/Impl/Parquet/Reader.cpp
The admission control of `ColumnsCache` lowers the probability of writes
(down to 1/64) when other tests load the cache with entries that are never
read, so `05340_parquet_columns_cache_access` and
`05355_parquet_columns_cache_table_access` could not populate the cache in
20 attempts in the targeted ASan runs. Mark them `no-parallel`, as the
other columns cache tests are, and drop the cache at the start, which
resets the admission probability.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=91b302b267c0d25015f3389a985ed8e451c88562&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29
PR: #124531

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

The columns cache entries of a file read by a table (`File`, `S3`,
`AzureBlobStorage`, data lakes) are not removed when the table is dropped,
so they fall into the branch of `system.columns_cache` for unresolvable
table UUIDs, which only required the global `SHOW COLUMNS`. Keep the source
of the file in every `Parquet` entry, and require the unrestricted `READ`
grant on it in that branch too, as for the entries of table functions.

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

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=91b302b267c0d25015f3389a985ed8e451c88562&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 (05210_lightweight_update_materialized_cte_in_ignore: Unknown table expression identifier '_materialized_cte_c_...', which also fails on master and in many other PRs) and provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

The fix is already in progress: #123121 (mine, open).

This is the race from #112642: query 26 of 05210 sends a subquery over a twice-referenced MATERIALIZED CTE to the replicas before the initiator has written _materialized_cte_c_*, so the replica cannot resolve it. On the head of #123121 (eb9385ea), 05210 passes in this job. Nothing in this PR needs to change.

alexey-milovidov and others added 3 commits October 13, 2026 23:09
The `DatabaseReplicated` test configuration sets `distributed_ddl_output_mode = none`,
so `DROP TABLE` returns before the table is dropped and its UUID still resolves.
Wait until the entries of the table no longer show its name.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=a5029b4afdb55339526ebaa8bd74b2e982d38a23&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20sequential%29
#124531

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

The copy of a column written to the columns cache goes to the shared cache,
so allocate and release it outside the memory tracker of the query, like the
marks in the mark cache. Otherwise warming the cache could exceed
`max_memory_usage` of a query that fits without it.

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

Entries of a file read by a table carry the table UUID and show its name;
only entries of table functions have the nil UUID, and the entries of a
dropped table also require the `READ` grant on the source.

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

Copy link
Copy Markdown
Member Author

🕵 Pushed three commits:

  • fdb18f6 fixes the only remaining CI failure, 05355_parquet_columns_cache_table_access in Stateless tests (arm_binary, s3 storage, DBReplicated, sequential). The DatabaseReplicated profile sets distributed_ddl_output_mode = none, so DROP TABLE returned before the table was gone and its entries were still attributed to it. The test now waits for the drop to finish.
  • a510a7f: the copies written to the Parquet columns cache are no longer charged to the query (MemoryTrackerBlockerInThread, as for the mark cache). This resolves the first of the three costs listed earlier. The other two are still open for the author: cached columns counting as used memory for external spills, and per-row-group admission for large scans.
  • 3007660 updates the system.columns_cache description to match the current access rules.

Thanks @groeneai. #123121 is merged now. This branch will pick it up with the next merge of master.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=726f6f75887f99e327e188e8dffd2fd2401cf985&name_0=PR&name_1=Build%20(arm_release) (build_profile_hook.py fails with AssertionError in insert_profile_data after LogCluster connection failed ... RemoteDisconnected; the build itself succeeded) and provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I am investigating the build_profile_hook.py failure (all 8 LogCluster readiness probes got RemoteDisconnected, then the bare assert in insert_profile_data failed Post Hooks on a green build). No fix for this shape is in progress yet; I will follow up here with a PR (or my findings) shortly.

@groeneai

Copy link
Copy Markdown
Collaborator

Fix: #126296 (when no readiness probe gets any HTTP answer, the hook reports a workflow warning and exits 0; any answer from the cluster still fails it). The cause itself is outside the repo: the CI logs cluster writer endpoint has not answered since this morning and is still down at 13:00 UTC, which is also why these runs carry Failed to start log export warnings.

…ters_during_scan_parquet_short_dictionary_values`

The test was added on `master` after this branch pinned the same setting in `05055_string_filters_during_scan_parquet`. A `Parquet` column that can be written to the columns cache is decoded without `apply_string_filters_during_scan`, so that the cache gets its values. With the randomized `use_columns_cache = 1`, `StringValueFilterValuesReplaced` is `0` and the check fails.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=1303eb3b1b6beafeb084da62ae0e5a576291bac3&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20distributed%20plan%2C%20targeted%29
PR: #124531

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master added reading of dictionary-encoded `PREWHERE` columns as `ColumnReplicated`
(`decode_dictionary_as_replicated`), materialized after the last step. Such a column can reach
`addToColumnsCacheWrite` before that, so it is converted with `convertToFullColumnIfReplicated`
before being copied into the columns cache write. In `ReadManager::read` keep both the new
`getOrFormOutputColumn` signature and master's `convertToFullColumnIfReplicated`. In
`05055_string_filters_during_scan_parquet.sh` take master's queries and keep `use_columns_cache = 0`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
@alexey-milovidov alexey-milovidov self-assigned this Oct 18, 2026

@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.

Very good implementation. Love all of it.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 18, 2026
Merged via the queue into master with commit f4c66ae Oct 18, 2026
178 checks passed
@alexey-milovidov
alexey-milovidov deleted the parquet-columns-cache branch October 18, 2026 01:23
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 18, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 18, 2026
…age-column-data-read-ahead

Resolves the conflict with ClickHouse#124531 (columns cache for Parquet) in
ReadCommon.h: ReadOptions keeps both is_remote_fs and columns_cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 18, 2026
The test runner randomizes use_columns_cache since ClickHouse#124531. A row group
column served from the columns cache has no column data to read, so with
the cache enabled for reads and writes the second read of the same file
(e_s3_limit_1gb, g_s3_16_decoders) reads nothing ahead and prints 0.
Measured: forcing use_columns_cache = 1 with reads and writes fails
exactly those two lines; with the pin the test passes, and 50/50
randomized runs pass (7 of them drew that combination).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 18, 2026
A column served from the columns cache (ClickHouse#124531) has no column data to
read, so a reader whose row groups are all served from it can start no
read-ahead, yet each ColumnData admission round still took the shared
lock and ran an exclusive pass over the schedulable row groups. The init
gate now also requires a row group with a column that is not served
from the cache.

Measured (debug build, 3963 row groups of one UInt32 column in MinIO,
every column served from the cache, 5 runs): max_download_threads 16
median 185 ms before vs 92 ms after (max_download_threads 1: 95 / 93 ms).
With one of two columns cached the reader still reads ahead (15 row
groups).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@novikd
novikd requested a review from alesapin October 19, 2026 14:51
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-experimental Experimental Feature 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.

4 participants