Skip to content

Comments

feat: two-stage builder API for async Avro reader#9462

Open
mzabaluev wants to merge 1 commit intoapache:mainfrom
mzabaluev:avro-async-reader-builder-with-writer-schema
Open

feat: two-stage builder API for async Avro reader#9462
mzabaluev wants to merge 1 commit intoapache:mainfrom
mzabaluev:avro-async-reader-builder-with-writer-schema

Conversation

@mzabaluev
Copy link
Contributor

Which issue does this PR close?

What changes are included in this PR?

Expose the read_header method in reader::async_reader::ReaderBuilder, returning another builder typestate that exposes the writer schema as it was read from the file header.

Are these changes tested?

Tests and doc tests to be added for the new API, showing possible use.

Are there any user-facing changes?

The new API augments the existing ReaderBuilder in a backward-compatible way.

Expose the read_header method in reader::async_reader::ReaderBuilder,
returning another builder typestate that exposes the writer schema
as it was read from the file header.
@github-actions github-actions bot added arrow Changes to the arrow crate arrow-avro arrow-avro crate labels Feb 22, 2026

impl<R: AsyncFileReader> ReaderBuilder<R> {
async fn read_header(&mut self) -> Result<(Header, u64), AvroError> {
impl<R> ReaderBuilder<R>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, do we want to allow maybe a with_header function as well? that will accept a user's header directly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the typical usecase, but makes it more flexible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the behavior with this method? Skip reading the header from the file, and start decoding from...?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumable the range?
The behaviour would be the exact same, since the header ends with the magic I believe? and we start the actual decoding from the first magic we encounter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-avro arrow-avro crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose Avro writer schema when building the reader

2 participants