feat: expose arrow schema on async avro reader - #9534
Merged
alamb merged 4 commits intoMar 11, 2026
Merged
Conversation
Add a schema method to obtain the Arrow schema from the async Avro reader.
Tests on alltypes_plain.avro
Add metadata on fields of nested records and the list type, so that the expected schema matches the one produced by the reader. Add a test reading nested_records.avro to verify the schema exposed by the reader.
alamb
reviewed
Mar 11, 2026
alamb
left a comment
Contributor
There was a problem hiding this comment.
Thanks @mzabaluev -- the code looks good I just had some test comments
cc @jecsand838
| let location = Path::from_filesystem_path(&file).unwrap(); | ||
| let file_size = store.head(&location).await.unwrap().size; | ||
|
|
||
| let file_reader = AvroObjectReader::new(store, location); |
Contributor
There was a problem hiding this comment.
Could you also reduce some of the duplication in this test so that it is easier to understand what is actually being tested and what is different between the tests?
Contributor
Author
There was a problem hiding this comment.
I have added clarifying comments explaining the purpose and differences of code in each of the added cases. Hope this helps.
Remove copy-pasted comments that don't apply to the new tests. In the test with the reader schema, update the test to use a projected schema and verify that the reader schema is applied correctly. Add comments explaining the expectations for each test case.
mzabaluev-flarion
force-pushed
the
expose-arrow-schema-on-async-avro-reader
branch
from
March 11, 2026 12:26
017c28a to
4b39bef
Compare
alamb
approved these changes
Mar 11, 2026
alamb
left a comment
Contributor
There was a problem hiding this comment.
Thanks -- looks good to me
Contributor
|
🚢 🇮🇹 |
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.
Rationale for this change
Exposes the Arrow schema produced by the async Avro file reader, similarly to the
schemamethod on the synchronous reader.This allows an application to prepare casting or other schema transformations with no need to fetch the first record batch to learn the produced Arrow schema. Since the async reader only parses OCF content for the moment, the schema does not change from batch to batch.
What changes are included in this PR?
The
schemamethod forAsyncAvroFileReaderexposes the Arrow schema of record batches that are produced by the reader.Are these changes tested?
Added tests verifying that the returned schema matches the expected.
Are there any user-facing changes?
Added a
schemamethod toAsyncAvroFileReader.