Core: Add all puffin files metadata table#17282
Open
yangshangqing95 wants to merge 1 commit into
Open
Conversation
yangshangqing95
force-pushed
the
feat/all-puffins-metadata-table
branch
from
July 17, 2026 22:31
4d89232 to
1d950e8
Compare
yangshangqing95
force-pushed
the
feat/all-puffins-metadata-table
branch
from
July 17, 2026 23:03
1d950e8 to
ff55328
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
This PR adds a new
all_puffin_filesmetadata table that exposes Puffin files associated with all snapshots currently tracked in Iceberg table metadata.The metadata table reports Puffin files referenced through two metadata sources:
TableMetadata#statisticsFiles()The implementation does not open Puffin files, read Puffin footers, or parse blob payload bytes. All reported information is derived from Iceberg table metadata, snapshot manifest lists, and delete manifests.
Each row represents a Puffin file associated with one reference snapshot through one metadata source. A physical Puffin file may appear in multiple rows when it is referenced by multiple snapshots or through multiple sources.
The table contains the following columns:
reference_snapshot_idfile_pathsourcestatisticsordeletion_vectorfile_size_in_bytesreferenced_blob_countreferenced_blob_typesreferenced_fieldsfield_idandcurrent_field_namepairscurrent_field_nameis resolved against the current table schema and may be null when a referenced field has been dropped.Example
Example output:
.../1234567890-table.statsstatistics["apache-datasketches-theta-v1"][{"field_id":1,"current_field_name":"id"},{"field_id":2,"current_field_name":"data"}].../00000-4-deletes.puffindeletion_vector["deletion-vector-v1"][{"field_id":<ROW_POSITION_FIELD_ID>,"current_field_name":"_pos"}].../00000-4-deletes.puffindeletion_vector["deletion-vector-v1"][{"field_id":<ROW_POSITION_FIELD_ID>,"current_field_name":"_pos"}]The same deletion-vector Puffin file appears more than once in this example because it is referenced by multiple snapshots.
Snapshot history semantics
The
all_puffin_filesmetadata table scans all snapshots currently retained in table metadata.Deletion vector files are reconstructed independently for each snapshot from that snapshot's live delete-manifest entries. As a result, the same physical Puffin file may appear once for every retained snapshot that references one or more blobs from the file.
Statistics files are obtained from the statistics files currently registered in table metadata and associated with their registered snapshot IDs.
Statistics registration can be updated independently of data snapshots. Therefore, the table does not reconstruct historical statistics registration state. Replaced or removed statistics files are not reported merely because their associated snapshots are still retained.
The table reports rows by snapshot ID rather than by branch or tag name. If multiple references point to the same snapshot, the snapshot's Puffin files are reported once for that snapshot.
Filter planning
The implementation performs conservative task pruning for predicates over:
reference_snapshot_idsourceSource predicates can avoid preparing or scanning the unrelated metadata source entirely.
Snapshot predicates can prevent tasks from being created for snapshots that cannot match the filter.
A three-state evaluator is used during planning:
CANNOT_MATCHMIGHT_MATCHMUST_MATCHPredicates over unsupported fields or values that are not known during the current planning phase return
MIGHT_MATCH.This is especially important for negated predicates, because negating an unknown predicate must remain unknown and must not incorrectly prune a task.
Deletion-vector tasks are only planned for format version 3 or later. Snapshot summaries are used conservatively to skip snapshots that explicitly report zero delete files.
Motivation
Iceberg stores multiple types of metadata in Puffin files, including table statistics and deletion vectors.
Users currently need to query individual snapshots or inspect metadata JSON files, manifest lists, and delete manifests separately to understand how Puffin file references evolve over time.
Exposing this information through an all-snapshots metadata table makes it easier to:
Tests
The added tests cover: