[core] Expose Avro header and physical block locations - #9835
Merged
Merged
Conversation
leaves12138
marked this pull request as draft
September 15, 2026 07:07
leaves12138
marked this pull request as ready for review
September 15, 2026 07:48
leaves12138
marked this pull request as draft
September 15, 2026 07:54
leaves12138
marked this pull request as ready for review
September 15, 2026 07:56
Contributor
|
+1 |
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.
Purpose
Expose the original Avro object-container header and physical block offsets/lengths through
RawBlockReader,AvroBlockReader, andManifestAvroReader. These locations allow callers to index existing manifest blocks and reconstruct valid Avro streams from selected blocks. Encoded lengths include the block header and sync marker.The reader chain accepts
SeekableInputStreamand computes positions fromgetPos()with Avro decoder read-ahead deducted. Reading starts at the stream's current position. The original header bytes are captured during construction and stored in a final byte array; the underlying stream position is restored before block reading continues. Header getters return defensive copies without I/O.ByteArraySeekableStreampermits seeking to EOF so position restoration also works for small in-memory Avro files after read-ahead reaches their end.This is the first standalone prerequisite extracted from the manifest sidecar work in #9743. Sidecar generation, scan pruning, and sidecar/block caching will follow separately.
Tests
DataFileWriter.sync()for null, deflate, Snappy, and Zstandard codecs, including large headers, one-byte/short reads, repeated look-ahead, borrowed-block reuse, and empty files.mvn -B -ntp -nsu -pl paimon-core -am \ -DwildcardSuites=none -DfailIfNoTests=false \ -Dtest=ByteArraySeekableStreamTest,OffsetSeekableInputStreamTest,AvroBlockReaderTest,AvroFileFormatTest,ManifestFileTest clean test