shanielh opened a new pull request, #3763: URL: https://github.com/apache/iceberg-rust/pull/3763
## Which issue does this PR close? No tracking issue. Happy to file one if you'd like it for the changelog. ## What changes are included in this PR? `ManifestWriter` keeps every added entry as a full `ManifestEntry`, including the column-stat maps, until `write_manifest_file` serializes them all. So while a manifest is being built, the writer's memory grows with the full parsed entries, not with the much smaller encoded file. With this change, the writer starts the Avro file at the first entry and encodes entries as they are added, in blocks of 64. It uses apache-avro's own block framing with the file's sync marker and codec (still deflate), and it updates the partition summaries as it goes. While a manifest is being built, the writer holds the encoded bytes plus at most one block of entries. The public API does not change. The output is the same manifest, split into more, smaller blocks. I also added `avro::codec()`, so `new_writer` and the manifest writer cannot drift apart on the codec they write. ## Are these changes tested? The existing manifest writer tests pass unchanged, including the codec assertions. A new test writes a manifest that spans several blocks and ends partway through one, in V1, V2 and V3. It reads the data files back and checks the partition summary (bounds and a null) against expected values. `cargo test -p iceberg --lib`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo fmt --check`, `cargo doc` with `-D warnings`, and `cargo public-api` (no change) all pass. ## AI Disclosure I wrote this with Claude Code (Claude Opus 5.5) and reviewed and tested the change myself. Places worth a close look: - Block size: 64 entries per block is a judgment call. Smaller blocks are each deflated on their own, so the file may compress slightly worse than one large block. If you'd rather cut blocks by encoded size, apache-avro's block-size threshold could do that instead. - The encoded file is still held in memory and written with one `write` at the end, because `write_manifest_file` is the only async step. Streaming it to the output as blocks fill would need `add_entry` to become async, which I left out of scope. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
