Core: Implement LZ4 frame compression for Puffin format#16054
Draft
laserninja wants to merge 1 commit intoapache:mainfrom
Draft
Core: Implement LZ4 frame compression for Puffin format#16054laserninja wants to merge 1 commit intoapache:mainfrom
laserninja wants to merge 1 commit intoapache:mainfrom
Conversation
Implement LZ4 frame compression and decompression in PuffinFormat using lz4-java (net.jpountz.lz4), which was already defined in the version catalog but not wired as a dependency of iceberg-core. The Puffin spec requires LZ4 single compression frame with content size present. The existing aircompressor library only provides block-level LZ4, not frame-level, so lz4-java's LZ4FrameOutputStream and LZ4FrameInputStream are used instead. Previously, compress() and decompress() had TODO stubs for LZ4 that threw UnsupportedOperationException at runtime, making footer compression (which defaults to LZ4) unusable. Fixes apache#16033
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.
What
Implements LZ4 frame compression and decompression in
PuffinFormat, fixing theUnsupportedOperationExceptionthrown when attempting to use LZ4 compression (which is the default for Puffin footer compression).Why
The
compress()anddecompress()methods inPuffinFormathad TODO stubs for the LZ4 case that fell through tothrow new UnsupportedOperationException("Unsupported codec: lz4"). This made footer compression — which defaults to LZ4 per the Puffin spec — unusable at runtime.How
lz4-java(net.jpountz.lz4) as a dependency toiceberg-core. The library was already defined in the version catalog (gradle/libs.versions.toml) but was not wired as a dependency.compressLz4()usingLZ4FrameOutputStreamwithCONTENT_SIZEandBLOCK_INDEPENDENCEflags, conforming to the Puffin spec requirement of "LZ4 single compression frame with content size present".decompressLz4()usingLZ4FrameInputStream.aircompressorlibrary only provides block-level LZ4, not the frame-level compression required by the Puffin spec.lz4-javaprovides the necessary frame format support.Testing
TestPuffinFormatfor both non-empty and empty data.testEmptyFooterCompressedinTestPuffinWriter— previously assertedUnsupportedOperationException, now verifies successful LZ4 footer compression and read-back.testWriteAndReadMetricDataCompressedLz4inTestPuffinWriterfor full write + read verification with LZ4-compressed blobs.All existing Puffin tests continue to pass.
Fixes #16033