feat(common): inject _block_num statistics into physical plan#2031
Merged
feat(common): inject _block_num statistics into physical plan#2031
_block_num statistics into physical plan#2031Conversation
Override _block_num column min/max on the Statistics passed to FileScanConfig in scan(), using synced_range. This is where DataFusion's AggregateStatistics optimizer reads from, enabling it to resolve MIN/MAX(_block_num) as constants without scanning parquet files.
_block_num statistics into physical plan
fordN
approved these changes
Mar 26, 2026
leoyvens
reviewed
Mar 29, 2026
| .await?; | ||
|
|
||
| // Override _block_num column statistics with exact min/max from synced_range. | ||
| // This enables the AggregateStatistics optimizer to resolve MIN/MAX(_block_num) |
Collaborator
There was a problem hiding this comment.
This seems wrong, the start and end range of the synced segment are not necessarily represented as column values. E.g. the segment could have zero rows.
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.
Implement TableProvider::statistics() on QueryableSnapshot to report exact _block_num column min/max from synced range. DataFusion's AggregateStatistics optimizer replaces MIN/MAX aggregates with constants when exact statistics are available, avoiding full parquet scans.