Repository navigation
Conversation
Splitting Parquet files into row group buckets (`cluster_table_function_split_granularity = 'bucket'`) rarely paid off and silently lost Iceberg deletes: - The initiator read the footer of every file synchronously, under the mutex of the task distributor, with a HEAD request per file. Files whose size is known from the table metadata (Iceberg) are now cut into byte ranges without reading them, using the `split_offsets` of the manifest when present; the worker selects the row groups whose midpoint falls into its range. Files that still need a footer read are processed ahead of time in a thread pool. - The copies of an `IcebergDataObjectInfo` made for the buckets were sliced to `ObjectInfo`, so the workers did not receive the position and equality delete files. `ObjectInfo::clone` keeps the type. - The default `cluster_table_function_buckets_batch_size` of 0 made a task per row group; it is now 128 MiB, and files smaller than that are not split. - `cluster_table_function_split_granularity = 'auto'` splits only when there are fewer files than reading threads in the cluster. `IcebergIterator::estimatedKeysCount` uses the live file counts of the manifest list for that. - Position delete transforms open the delete files lazily, when the reader knows which rows of the data file it outputs, and read only the positions of that range. - Workers keep a request for the next task in flight while processing the current one. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…f buckets The requests for tasks that a worker keeps in flight are not answered in the order they were scheduled, so an empty answer to one of them did not mean that the others were empty too: a later request could have received the last task, which was then dropped. Collect the answers of all requests in flight before declaring the task stream exhausted. `SELECT count()` over Parquet files split into buckets returned the row count of the whole file for every bucket; count the rows of the selected row groups instead. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…split_offsets` The number of pieces of a file is now the larger of `size / cluster_table_function_buckets_batch_size` and `8 * reading threads of the cluster / number of files`, capped by the number of row groups. Row groups are assigned to pieces by their midpoint, the same rule the reader uses for byte ranges, so pieces are even and never empty. With few large files, six pieces for three reading threads left most of the cluster idle at the tail; now there are about eight tasks per thread. `auto` splits when there are fewer files than that target. Fixed byte ranges guessed from the file size are gone: without `split_offsets` the initiator reads the footer (in the thread pool) instead of producing tasks that select no row group. The Iceberg writer now records the row group offsets of every data file in `split_offsets`, so tables written by ClickHouse are cut without reading their footers, like those written by Spark. Also remove the explanatory comments added to the code in the previous commits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
scanhex12
marked this pull request as draft
October 9, 2026 12:01
Removes `RowRangeToReadGetter.h`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…condition cache A reader of a bucket reported the row groups of the other buckets of the file as not matching the condition, and the cache key covers the whole file. Every bucket overwrote the others, so a later read of the whole file with the same condition skipped almost all row groups and returned wrong results (`file` granularity after `bucket` on Iceberg TPC-H: 985857 rows instead of 29577564). Row groups the reader did not process are now reported as possibly matching. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A task for a whole file already keeps all threads of a node busy, because the Parquet reader reads row groups in parallel, so files only need to be split to balance the work between nodes. Counting reading threads made the target 864 tasks on a 3-node cluster with 36 threads per node, and every file was cut down to single row groups, the most expensive way to split it. `auto` now splits when there are fewer files than four times the number of nodes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
TPC-H on Iceberg: ClickHouse cluster without splitting, with splitting from this branch, and TrinoSetup
Scans of one large file
TPC-H, few large files
TPC-H, Trino default layout
Notes
|
Member
Author
Member
Author
…replica The initiator's own replica asks for `max_threads` tasks at once, before the other replicas have received the query. When the iterator was exhausted, the distributor gave it the files queued for the other replicas as well, so a table of three files on three nodes was read by one node (3/0/0 tasks; with `max_threads = 4` it was 1/1/1). The distributor now waits up to one second for the owner of a file to connect before giving the file to someone else, and among replicas that are already working it takes the file from the one with the most remaining files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
In a query with several tables, every replica received `SELECT columns FROM table` without the filter on that table: `ReadFromCluster::applyFilters` used the pushed-down filter only to prune files on the initiator, so the replicas read and shipped every row and the initiator filtered them (TPC-H Q12 on Iceberg: 575 MiB over the network). The conjuncts of the pushed-down filter that are made of the read columns, constants, constant `IN` lists and registered deterministic functions are now added to the `WHERE` of the query sent to the replicas (Q12: 77 MiB, 1195 ms -> 367 ms). The filter above the read stays, so the replicas only drop rows that it would drop anyway. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a replica takes a task of another one, it takes it from the replica with the most remaining bytes, counting the byte range of a bucket or the file size, instead of the most remaining tasks: a few large files and many small ones are no longer balanced by count. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
This was referenced Oct 13, 2026
…tting-improvements Most of this branch landed through separate PRs: #125611 #125615 #125636 Their versions are kept. Bucket splitting by `min_buckets` is applied on top of the greedy splitter of master, the weight of a byte range bucket is capped by the file size, byte ranges are gated by `cluster_table_function_split_by_split_offsets`, and the duplicate test of the filter pushdown is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Workflow [PR], commit [a46cef6] Summary: ❌
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.










Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
split_offsetsstats to skip parquet file reading stepWorkflow [PR]
Sync PR [sync-upstream/pr/124890]