Enable metadata-only MIN/MAX from Iceberg manifest column bounds (e.g., MAX(updated_at))#1173
Open
The-Alchemist wants to merge 3 commits into
Open
Enable metadata-only MIN/MAX from Iceberg manifest column bounds (e.g., MAX(updated_at))#1173The-Alchemist wants to merge 3 commits into
MAX(updated_at))#1173The-Alchemist wants to merge 3 commits into
Conversation
MAX(last_updated))
Expose exact numeric/temporal lower/upper bounds via PartitionRowGroup so StatisticsPropagator can fold SELECT MIN/MAX without scanning data files.
The-Alchemist
force-pushed
the
feature/min-max-for-sorted-columns
branch
from
July 12, 2026 02:23
30e6cbe to
513a293
Compare
Tishj
reviewed
Jul 13, 2026
MAX(last_updated))MAX(updated_at))
The-Alchemist
marked this pull request as ready for review
July 13, 2026 17:08
Signed-off-by: Karl Pietrzak <karl@medplum.com>
The-Alchemist
force-pushed
the
feature/min-max-for-sorted-columns
branch
from
July 13, 2026 17:22
7c5b2f8 to
95cdac4
Compare
Open
2 tasks
Tishj
reviewed
Jul 15, 2026
| //! Materialize data-file entries so column bounds are available for MIN/MAX. | ||
| idx_t materialized = 0; | ||
| while (GetDataFile(materialized, guard)) { | ||
| materialized++; |
Member
There was a problem hiding this comment.
I'm worried this happens before filter pushdown, in which case we are now aggressively materializing all metadata, which is not ideal.
Contributor
Author
There was a problem hiding this comment.
good point. my latest commit delays materialization until necessary, although that increases the complexity
The-Alchemist
force-pushed
the
feature/min-max-for-sorted-columns
branch
from
July 15, 2026 18:28
95874aa to
bebfef4
Compare
…ted. GetStatistics still supplies manifest-level counts for COUNT(*), but only drains matching data files when GetColumnStatistics needs bounds.
The-Alchemist
force-pushed
the
feature/min-max-for-sorted-columns
branch
from
July 15, 2026 19:58
bebfef4 to
7b5c5ca
Compare
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.
Summary
get_partition_statsto expose per-column min/max from manifestdata_file.lower_bounds/upper_boundsvia a newIcebergPartitionRowGroup, so DuckDB'sStatisticsPropagator::TryExecuteAggregatescan foldSELECT MIN(col)/SELECT MAX(col)into constants without scanning Parquet.FLOAT/DOUBLE/VARCHAR); bail out when any file lacks usable bounds or matching delete manifests are present.IcebergPartitionRowGroupfocused on min/max; reconcile if both land).Test plan
test/sql/local/iceberg_scans/aggregate_min_max_metadata.test— correctness vs oracle,EXPLAINshowsCOLUMN_DATA_SCANfor bigint/timestamp folds, fallbacks for varchar/float/WHERE; verify nested type behaviortest/sql/local/iceberg_scans/scan_order_limit_pruning.teststill passes