Repository navigation
Conversation
… guard Read coalescing bridges gaps shorter than the seek threshold to save requests, but many sub-threshold gaps can accumulate into a task that is almost entirely filler: reading a tiny, scattered column drags in its neighbouring columns and amplifies a few KB of wanted data into hundreds of MB read. Add `input_format_parquet_read_min_fill_ratio` (0 = off, range 0..1). During coalescing, `Prefetcher` stops extending a task once bridging the next gap would drop its wanted/span fraction below the ratio. Gaps below 64 KiB are always bridged, so dense reads are never split. New profile event `ParquetPrefetcherFillRatioLimitedTasks`. Ported from the fill-ratio part of #2181 Related: #2181 Co-authored-by: Cursor <cursoragent@cursor.com>
6 of 28 tasks
…ption The setting description claimed that a coalesced task is never allowed to be less than the ratio wanted. In fact `Prefetcher::fillRatioWouldBreak` evaluates the ratio only for gaps of at least 64 KiB; gaps below that are always bridged, so a task made of many such gaps can be arbitrarily sparse, and when the seek threshold is not above 64 KiB (the default `input_format_parquet_local_file_min_bytes_for_seek` is 8 KiB) the guard has no effect. Describe the actual behaviour and the precondition instead of an unconditional bound. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…eadManager` The range check lived in `Prefetcher::init`, which is also used by schema inference, the count-only path and `ParquetBucketSplitter::splitToBuckets`. An out-of-range value therefore made `DESCRIBE` and bucket splitting throw `BAD_ARGUMENTS`, although they never coalesce data reads, while the sibling settings `input_format_parquet_prefetch_memory_fraction` and `input_format_parquet_decode_thread_fraction` are validated only in `ReadManager::init`. Move the check next to those two, before any read is scheduled, so that equivalent invalid values behave the same. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
… test The "guard off" check was trivially true (the guard returns early when the ratio is 0), and nothing checked that a dense read is left alone or that the guard really changes the reads issued. Add a dense read (all columns, no gaps) that must neither be limited nor change the number of reads, and assert that the sparse read with the guard on issues more reads than with the guard off, in addition to the `ParquetPrefetcherFillRatioLimitedTasks` event. The invalid-ratio check now reads a column (`sum(length(b))`): a plain `count()` takes the count-only path that never reaches the `ReadManager`, where the range check now lives. Also check that an invalid ratio does not break schema inference. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
… filler instead of gap size `Prefetcher::fillRatioWouldBreak` computed the gap on each side of the task and evaluated the ratio only for gaps of at least 64 KiB, so a task made of many smaller gaps was never limited and the guard did nothing when the seek threshold was not above 64 KiB. Evaluate the ratio on every extension and exempt only tasks with less than 64 KiB of total filler (span minus wanted bytes). This drops the gap computation, makes the description of the setting accurate (a task is not extended once it is less than the ratio wanted, unless it has little filler), and makes the guard effective at the default `input_format_parquet_local_file_min_bytes_for_seek`. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…et_read_min_fill_ratio` The previous commit (ffcb741) said the guard is effective at the default `input_format_parquet_local_file_min_bytes_for_seek`. That is wrong. The scan conditions in `pickRangesAndCreateTaskIfNotExists` keep a task within the requested ranges plus `bytes_per_read_task` on each side, so its filler stays below 2 * `bytes_per_read_task` = 8 * `min_bytes_for_seek`. The 64 KiB filler floor can therefore be reached only when the seek threshold is above 8 KiB, and with the default 8 KiB the guard never refuses a task (a probe showed 0 limited tasks at 8 KiB and 51 at 8 MiB). This commit documents the precondition in the setting description and in the comment on `filler_floor_for_fill_ratio`. It does not change behaviour. The earlier commit cannot be amended, per repository rules. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…ad_min_fill_ratio` description The description said the guard needs a seek threshold above 8 KiB and named only `input_format_parquet_local_file_min_bytes_for_seek`. That setting is used for local files only. For object storage `ParquetV3BlockInputFormat` uses `read_settings.remote_fs_settings.min_bytes_for_seek`, which `StorageObjectStorageSource` sets to the remote read buffer size (`max_read_buffer_size_remote_fs`, 1 MiB by default, capped at the object size). Name both thresholds so that the precondition is correct for object storage too. No behaviour change. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…er floor with the read task size With a fixed 64 KiB filler floor, the guard could never refuse a task when `bytes_per_read_task` is at most 32 KiB. The scan conditions in `pickRangesAndCreateTaskIfNotExists` keep a task's filler below 2 * `bytes_per_read_task`, and `ParquetV3BlockInputFormat` sets `bytes_per_read_task` to 4 * the seek threshold, so at the default local `input_format_parquet_local_file_min_bytes_for_seek` of 8 KiB the guard did nothing. Every previous attempt to document this precondition got a detail wrong, because the description had to restate how other settings determine the threshold. Use min(64 KiB, `bytes_per_read_task` / 2) as the floor instead. Behaviour is unchanged when `bytes_per_read_task` is at least 128 KiB (seek threshold of 32 KiB or more). Below that, the guard now acts. The setting description no longer depends on other settings or their defaults. Add a test case with 600 small row groups at the 8 KiB seek threshold. It fails on the previous commit (0 limited tasks, no extra reads) and passes with this change. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…he `EXPERIMENTAL` tier The description starts with "Experimental.", but the setting was declared with flags 0, so `system.settings` reported `tier = 'Production'`, `allow_feature_tier` did not restrict it, and the docs generator (`experimental-settings.sql`) left it out of the experimental list. Declare it with `EXPERIMENTAL`, as `use_reader_executor` does for the same label. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…_fill_ratio` - `ParquetPrefetcherFillRatioLimitedTasks` said a refused task would be "mostly unwanted filler", which holds only for a ratio of at most 0.5. It now says the next range would leave the wanted fraction below the ratio. - The comment on `Prefetcher::fillRatioWouldBreak` had a garbled sentence about the filler floor. - The test comment called `big` incompressible; it compresses about 5.6 times. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…` in the settings history The entry said a tiny scattered column "no longer drags in its neighbours". The guard only limits that: a task may still be up to (1 - ratio) filler, and filler below the floor is always allowed. Reword it to "limits how much", using the same terms as the setting description. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
…istent - The description used "Range 0..1"; the sibling scheduler settings and the error message in `ReadManager::init` say "Must be in [0, 1]". It also said "Parquet v3" where the siblings say "the Parquet reader". - It quoted "a few KB ... into hundreds of MB", which was never measured. It now says only that far more bytes are read than the query needs. - The filler floor was described as "below 64 KiB, or less for small seek thresholds". It is exactly min(64 KiB, 2 * seek threshold), because `bytes_per_read_task` is 4 * `min_bytes_for_seek`. The description now says that, and names the local seek threshold, `input_format_parquet_local_file_min_bytes_for_seek`. - The inline comment in the left scan said the guard prevents "mostly filler" tasks, which holds only for a ratio of at most 0.5. Related: #2946 Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fill-ratio guard for read coalescing in the Parquet v3 reader. This is one independent feature split out of #2181, ported onto
antalya-26.8. Only the fill-ratio part of the original change is included.Prefetchercoalesces nearby column chunk ranges into one read when the gap is below the seek threshold. With a large threshold (remote storage) many such gaps add up: a tiny, scattered column (for example a constant column) drags in the wide columns between its chunks, so a few KB of wanted data turn into hundreds of MB read.New setting
input_format_parquet_read_min_fill_ratio(Double, range 0..1, 0 = off, the default): while extending a task in either direction,Prefetcherstops when including the next range would make the wanted bytes of the task less than this fraction of its span. Gaps below 64 KiB are always bridged, so dense reads are never split. A value outside 0..1 is rejected withBAD_ARGUMENTS. New profile eventParquetPrefetcherFillRatioLimitedTaskscounts how many times the guard stopped an extension.Tests: stateless test
05831_parquet_v3_read_min_fill_ratioreads one constant column from a file with wide neighbouring columns and a largeinput_format_parquet_local_file_min_bytes_for_seek; it checks that the result is the same and that the profile event is non-zero only with the guard on, and that an invalid ratio is rejected. It passed in the Praktika stateless job on a local aarch64 build.Related: #2181
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add the experimental setting
input_format_parquet_read_min_fill_ratio(off by default). The Parquet reader stops coalescing reads through gaps when the resulting read would be mostly unwanted data, which avoids reading neighbouring columns when only a small scattered column is requested.Documentation entry for user-facing changes
The setting is documented by its
DECLAREdescription inFormatFactorySettings.h.CI/CD Options
Exclude tests:
Regression jobs to run: