shanielh opened a new pull request, #3762: URL: https://github.com/apache/iceberg-rust/pull/3762
## 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? `Manifest::parse_avro` needs the whole manifest file in memory, and it returns every entry decoded at once. A caller that reads a large manifest, for example one streamed from object storage, has to hold both. This adds `Manifest::read_entries(source: impl Read, f: impl FnMut(ManifestEntry) -> Result<()>) -> Result<ManifestMetadata>`. It decodes entries one at a time from any `Read`, passes each one to `f`, and returns the manifest metadata. `parse_avro` (through `try_from_avro_bytes`) now collects from the same decode, so there is still only one decoding path. To keep the existing fallback for manifests that define an Avro named type more than once, the decoder now first reads only the header's magic and metadata (the new `read_header_metadata`). If apache-avro rejects the schema, it is rewritten and read in front of the rest of the stream, so the source does not need to be seekable. ## Are these changes tested? Yes: - A new test writes a manifest that spans several Avro blocks. It checks that `read_entries` reading one byte at a time gives the same `Manifest` as `parse_avro`. - The existing repeated-`decimal` fallback test now also streams that manifest one byte at a time. `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` (`public-api.txt` updated) 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: - The fallback relies on how apache-avro's `Reader::new` reads: it parses the header schema, and fails on an ambiguous one, before it reads the 16-byte sync marker. So when the first attempt fails, it has consumed only the bytes `read_header_metadata` recorded. That holds for apache-avro 0.22, but it is an implementation detail rather than a documented contract. - The API shape is a callback, not an iterator. An iterator would need to own both the `Reader` and the partition type it borrows. I'm open to a different shape if you prefer one. - `read_entries` passes no manifest location, so its fallback warning says `<unknown location>`. 🤖 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]
