{{ message }}
Support zstd blob decompression in Puffin#3575
Draft
ebyhr wants to merge 1 commit into
Draft
Conversation
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.

Rationale for this change
Prepares PuffinFile for
apache-datasketches-theta-v1blob support by removing the hard constraint that all blobs aredeletion-vector-v1and by adding zstd blob decompression.Two fixes were required to make this work correctly:
Fix: blob offsets were off by 8
_payload stored puffin[8:], but blob offset values in the Puffin footer are measured from byte 0 of the file. For the existing deletion-vector-v1 case this was harmless — the 8-byte shift accidentally cancelled the 8-byte blob framing ([length:4][magic:4]) that was never stripped. With arbitrary blob types and real offsets the cancellation breaks, so _payload now holds the full file bytes.
Widen PuffinBlobMetadata.type from Literal["deletion-vector-v1"] to str
PuffinFile is a generic Puffin format parser, not a deletion-vector-specific reader. Locking type to a single literal means parsing any Puffin file that contains a non-DV blob (e.g., a theta sketch) raises a Pydantic validation error before we can even read the footer. Widening to str keeps the parser general; blob-type-specific logic belongs in callers (deletion_vectors_from_puffin_file, and the forthcoming theta sketch reader).
Are these changes tested?
Yes. Copied Puffin files from https://github.com/apache/iceberg/tree/main/core/src/test/resources/org/apache/iceberg/puffin/v1
Are there any user-facing changes?
No. PuffinFile is internal. The type: str widening is backwards-compatible.