Repository navigation
feat(file-index): support V2 containers and streaming writes - #446
Merged
Merged
Conversation
lxy-9602
reviewed
Oct 21, 2026
lxy-9602
reviewed
Oct 21, 2026
Align the format version option with Java and simplify option parsing and metadata helpers. Clarify borrowed output stream ownership and update writer APIs and callers. Cover Java reads and C++ V1/V2 write-read paths across file formats, prefetch settings, and embedded or external indexes.
Move OffsetOutputStream into common IO and wrap V2 payload streams at the container layer. Keep LuminaFileWriter ownership and close behavior unchanged, adapt direct Lumina writes, and add focused OffsetOutputStream unit tests.
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
Closes #445.
Add Java-compatible V2 file index containers with 64-bit payload offsets and lengths and support for streaming payload writes. Keep V1 as the default write format and automatically select the reader from the stored version.
Split the format implementations into V1/V2 writers, add
FileIndexWriter::WriteTo()with aSerializedBytes()fallback, and implement direct streaming for Lumina. The data-file index writer spills to an external file when the container exceeds the inline threshold. Plugins need a streamingWriteTo()implementation to avoid buffering the complete payload.Tests
INT32_MAX, V1 payload buffering untilFinish(), and rejection of callbacks that write bytes but report an absent index. Retain V1 golden-byte compatibility coverage.FileIndexWritertests for the defaultSerializedBytes()fallback, short writes, and null or zero-length serialized payloads.OffsetOutputStreamtests for relative positions, writes, flush forwarding, and keeping the underlying stream open on close.WriteTo(), and empty output through both serialization interfaces.WriteAndReadInteWithIndexTestacross C++ V1, C++ V2, and Java fixtures, alongside ORC/Parquet and prefetch settings. C++ cases write the data and indexes before reading and randomly select embedded or external index storage.The V2 golden bytes were generated by running the unmodified Java Paimon format sources at commit
5a6739c6c10e96052bac678eb245742ad92bc556; the 86-byte fixture matches the C++ output.API and Format
file-index.format.version=1|2(default:1).FileIndexer::CreateReader()offsets and lengths to int64. Individual plugins retain their own payload limits; bitmap and range bitmap explicitly reject lengths aboveINT32_MAX.Result<bool> FileIndexWriter::WriteTo(OutputStream*) const. The stream is borrowed and reports positions relative to the payload start. False means no payload and must write no bytes; true means a non-empty payload was written. The default implementation treats null or zero-lengthSerializedBytes()results as no index.WriteColumnIndexes()withWriteIndex()andFinish().CreateWriter()takes an explicit version argument. Downstream API implementations and callers must adapt to these interface changes.Documentation
Describe version selection and streaming behavior in public API comments, and document each serialized layout in
file_index_format_v1.handfile_index_format_v2.h.Generative AI tooling
Generated-by: OpenAI Codex (GPT-6)