Skip to content

docs(avro): add OpenDAL read and write example - #11080

Merged
Jefffrey merged 3 commits into
apache:mainfrom
Xuanwo:xuanwo/avro-opendal-example
Sep 17, 2026
Merged

Jefffrey merged 3 commits into
apache:mainfrom
Xuanwo:xuanwo/avro-opendal-example

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Sep 14, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

No associated issue. Follows the Parquet example in #11014.

Rationale for this change

Demonstrate how to read Avro through OpenDAL using the generic async I/O interfaces, alongside the existing object_store example.

What changes are included in this PR?

Add an in-memory round-trip example with an AsyncFileReader adapter using OpenDAL range reads and a SpawnedReader demonstration. The synchronous Avro writer encodes a small OCF in memory before uploading it. OpenDAL uses the same development dependency version and memory service as the Parquet example.

Are these changes tested?

The example asserts that ordinary and dedicated-runtime reads reproduce the written RecordBatch, including nulls. It runs successfully with --features async and with --no-default-features --features async. Example Clippy with -D warnings, workspace formatting, and whitespace checks pass.

Are there any user-facing changes?

A new example, runnable with cargo run -p arrow-avro --example opendal --features async. No public API changes. OpenDAL 0.59 requires Rust 1.91, above the workspace's declared Rust 1.88 MSRV; this affects development targets that build the new dependency.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-avro arrow-avro crate labels Sep 14, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review September 14, 2026 08:18
@Xuanwo

Xuanwo commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

cc @alamb, following the same pattern as parquet.

@alamb alamb added the documentation Improvements or additions to documentation label Sep 15, 2026

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Xuanwo -- this looks good to me


let file_size = operator.stat(path).await?.content_length();
let reader = OpenDalReader(operator.reader(path).await?);
let stream = AsyncAvroFileReader::builder(reader.clone(), file_size, 1024)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍
looks good to me

Comment thread arrow-avro/Cargo.toml
async-stream = "0.3.6"
apache-avro = "0.22.0"
object_store = { workspace = true, features = ["fs"] }
opendal = { version = "0.59.1", default-features = false, features = ["services-memory"] }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dev dependency 👍

@Jefffrey
Jefffrey merged commit 6faa527 into apache:main Sep 17, 2026
35 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @Xuanwo & @alamb

Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 18, 2026
# Which issue does this PR close?

No associated issue. Follows the Parquet example in apache#11014.

# Rationale for this change

Demonstrate how to read Avro through OpenDAL using the generic async I/O
interfaces, alongside the existing object_store example.

# What changes are included in this PR?

Add an in-memory round-trip example with an `AsyncFileReader` adapter
using OpenDAL range reads and a `SpawnedReader` demonstration. The
synchronous Avro writer encodes a small OCF in memory before uploading
it. OpenDAL uses the same development dependency version and memory
service as the Parquet example.

# Are these changes tested?

The example asserts that ordinary and dedicated-runtime reads reproduce
the written `RecordBatch`, including nulls. It runs successfully with
`--features async` and with `--no-default-features --features async`.
Example Clippy with `-D warnings`, workspace formatting, and whitespace
checks pass.

# Are there any user-facing changes?

A new example, runnable with `cargo run -p arrow-avro --example opendal
--features async`. No public API changes. OpenDAL 0.59 requires Rust
1.91, above the workspace's declared Rust 1.88 MSRV; this affects
development targets that build the new dependency.

Co-authored-by: Andrew Lamb <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 21, 2026
# Which issue does this PR close?

No associated issue. Follows the Parquet example in apache#11014.

# Rationale for this change

Demonstrate how to read Avro through OpenDAL using the generic async I/O
interfaces, alongside the existing object_store example.

# What changes are included in this PR?

Add an in-memory round-trip example with an `AsyncFileReader` adapter
using OpenDAL range reads and a `SpawnedReader` demonstration. The
synchronous Avro writer encodes a small OCF in memory before uploading
it. OpenDAL uses the same development dependency version and memory
service as the Parquet example.

# Are these changes tested?

The example asserts that ordinary and dedicated-runtime reads reproduce
the written `RecordBatch`, including nulls. It runs successfully with
`--features async` and with `--no-default-features --features async`.
Example Clippy with `-D warnings`, workspace formatting, and whitespace
checks pass.

# Are there any user-facing changes?

A new example, runnable with `cargo run -p arrow-avro --example opendal
--features async`. No public API changes. OpenDAL 0.59 requires Rust
1.91, above the workspace's declared Rust 1.88 MSRV; this affects
development targets that build the new dependency.

Co-authored-by: Andrew Lamb <[email protected]>
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 documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants