Repository navigation
feat(arrow): read manifest lists into Arrow with arrow-avro - #3631
Conversation
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM
most of the changes are isolated to crates/iceberg/src/arrow/. the crates/iceberg/src/spec/ changes are all just refactor
| /// Field ID of `manifest_entry.data_file`. | ||
| pub(crate) const DATA_FILE_FIELD_ID: i32 = 2; | ||
| /// Field ID of `manifest_entry.sequence_number`. | ||
| pub(crate) const SEQUENCE_NUMBER_FIELD_ID: i32 = 3; | ||
| /// Field ID of `manifest_entry.file_sequence_number`. | ||
| pub(crate) const FILE_SEQUENCE_NUMBER_FIELD_ID: i32 = 4; | ||
| /// Field ID of `data_file.partition`. | ||
| pub(crate) const DATA_FILE_PARTITION_FIELD_ID: i32 = 102; | ||
| /// Field ID of `data_file.content`. | ||
| pub(crate) const DATA_FILE_CONTENT_FIELD_ID: i32 = 134; |
There was a problem hiding this comment.
nice, ty for the refactor
There was a problem hiding this comment.
i see manifest_list has a _const_schema.rs file, maybe we should do the same. thats a bigger refactor, lets not do it here
| "arrow-avro split the manifest into more than one batch" | ||
| )); | ||
| } | ||
| // v1 manifests have no content or sequence number columns, which v2+ |
There was a problem hiding this comment.
meta question. what do you think is the best way to deal with different manifest versions in terms of arrow schema?
for example, say we have a table that is upgraded from v1 all the way to v4. how should we represent all the fields? should the arrow schema be a superset of all the versions combined?
and then how do we validate the integrity of the data? for example, "field x should not exist in v1 schema"?
just curious, i feel like we have to answer this eventually 😄
| } | ||
|
|
||
| let Some(batch) = reader.next() else { | ||
| let Some(batch) = only_batch(reader, invalid_manifest)? else { |
There was a problem hiding this comment.
we might want to revisit this once the data reach a certain size
Which issue does this PR close?
What changes are included in this PR?
Adds
iceberg::arrow::read_manifest_list, which decodes a manifest list into aRecordBatchwitharrow-avro, followingread_manifest_entriesfrom #3388. The binding follows in a separate PR.manifest_filewith its field IDs. The file and row counts are nullable, because v1 lists may write them as null, which the spec reads as non-zero.format-versionkey for manifest lists, but Java, PyIceberg, and iceberg-rust all write one. The reader parses it the wayread_manifest_entriesdoes, so an unknown version such as a v4 list is an error. A list without the key reads as v1. A v1 list reads the missingcontent,sequence_number, andmin_sequence_numberas 0, as the spec requires.spec/manifest/entry.rsandspec/manifest_list/_const_schema.rs, which addresses feat(arrow): read manifest entries into Arrow with arrow-avro #3388 (comment).Are these changes tested?
Yes, with unit tests in
arrow/manifest.rsand a doctest.test_manifest_lists_written_by_javacompares the result withManifestList::parse_with_versionon the two Java-written fixtures intestdata/manifests_lists.AI Disclosure
I wrote this PR with help from Claude but understand and support the core approach, implementation, and test coverage.