You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jecsand838 (via GitHub)" <gi...@apache.org> on 2025/10/06 07:38:38 UTC
[PR] Add arrow-avro README.md file [arrow-rs]
jecsand838 opened a new pull request, #8556:
URL: https://github.com/apache/arrow-rs/pull/8556
# Which issue does this PR close?
- Closes #8504
- Part of #4886
# Rationale for this change
Due to the number of features `arrow-avro` has, a README.md file clearly explaining these features and when to use them would be useful for our users.
# What changes are included in this PR?
* New README.md file for arrow-avro
* Minor change in `schema.rs` (made `Array` `pub(crate)`). This is a one liner that was missed in #8492
# Are these changes tested?
These changes involve adding a README.md and tightening the public API in a missed spot. Nothing should break and all existing tests should pass.
# Are there any user-facing changes?
N/A since `arrow-avro` isn't public yet.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add arrow-avro README.md file [arrow-rs]
Posted by "jecsand838 (via GitHub)" <gi...@apache.org>.
jecsand838 commented on code in PR #8556:
URL: https://github.com/apache/arrow-rs/pull/8556#discussion_r2405220630
##########
arrow-avro/README.md:
##########
@@ -0,0 +1,182 @@
+<!---
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+# `arrow-avro`
+
+[](https://crates.io/crates/arrow-avro)
+[](https://docs.rs/arrow-avro/latest/arrow_avro/)
+
+Transfer data between the [Apache Arrow] memory format and [Apache Avro].
+
+This crate provides:
+
+- a **reader** that decodes Avro
+ - **Object Container Files (OCF)**,
+ - **Avro Single‑Object Encoding (SOE)**, and
+ - **Confluent Schema Registry wire format**
+ into Arrow `RecordBatch`es; and
+- a **writer** that encodes Arrow `RecordBatch`es into Avro (**OCF** or **SOE**).
+
+> The latest API docs for `main` (unreleased) are published on the Arrow website: **arrow_avro**.
+
+[Apache Arrow]: https://arrow.apache.org/
+[Apache Avro]: https://avro.apache.org/
+
+---
+
+## Install
+
+```toml
+[dependencies]
+arrow-avro = "56"
+````
+
+Disable defaults and pick only what you need (see **Feature Flags**):
+
+```toml
+[dependencies]
+arrow-avro = { version = "56", default-features = false, features = ["deflate", "snappy"] }
+```
+
+---
+
+## Quick start
+
+### Read an Avro OCF file into Arrow
+
+```rust
+use std::fs::File;
+use std::io::BufReader;
+
+use arrow_avro::reader::ReaderBuilder;
+use arrow_array::RecordBatch;
+
+fn main() -> anyhow::Result<()> {
+ let file = BufReader::new(File::open("data/example.avro")?);
+ let mut reader = ReaderBuilder::new().build(file)?;
+ while let Some(batch) = reader.next() {
+ let batch: RecordBatch = batch?;
+ println!("rows: {}", batch.num_rows());
+ }
+ Ok(())
+}
+```
+
+### Write Arrow to Avro OCF (in‑memory)
+
+```rust
+use std::sync::Arc;
+
+use arrow_avro::writer::AvroWriter;
+use arrow_array::{ArrayRef, Int32Array, RecordBatch};
+use arrow_schema::{DataType, Field, Schema};
+
+fn main() -> anyhow::Result<()> {
+ let schema = Schema::new(vec![Field::new("id", DataType::Int32, false)]);
+ let batch = RecordBatch::try_new(
+ Arc::new(schema.clone()),
+ vec![Arc::new(Int32Array::from(vec![1, 2, 3])) as ArrayRef],
+ )?;
+
+ let sink: Vec<u8> = Vec::new();
+ let mut w = AvroWriter::new(sink, schema)?;
+ w.write(&batch)?;
+ w.finish()?;
+ assert!(!w.into_inner().is_empty());
+ Ok(())
+}
+```
+
+See the crate docs for runnable SOE and Confluent round‑trip examples.
+
+---
+
+## Feature Flags (what they do and when to use them)
+
+### Compression codecs (OCF block compression)
+
+`arrow-avro` supports the Avro‑standard OCF codecs. The **defaults** include all five: `deflate`, `snappy`, `zstd`, `bzip2`, and `xz`.
Review Comment:
Ah thank you for that, I'll add those details in real fast.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add arrow-avro README.md file [arrow-rs]
Posted by "mbrobbel (via GitHub)" <gi...@apache.org>.
mbrobbel commented on code in PR #8556:
URL: https://github.com/apache/arrow-rs/pull/8556#discussion_r2405213234
##########
arrow-avro/README.md:
##########
@@ -0,0 +1,182 @@
+<!---
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+# `arrow-avro`
+
+[](https://crates.io/crates/arrow-avro)
+[](https://docs.rs/arrow-avro/latest/arrow_avro/)
+
+Transfer data between the [Apache Arrow] memory format and [Apache Avro].
+
+This crate provides:
+
+- a **reader** that decodes Avro
+ - **Object Container Files (OCF)**,
+ - **Avro Single‑Object Encoding (SOE)**, and
+ - **Confluent Schema Registry wire format**
+ into Arrow `RecordBatch`es; and
+- a **writer** that encodes Arrow `RecordBatch`es into Avro (**OCF** or **SOE**).
+
+> The latest API docs for `main` (unreleased) are published on the Arrow website: **arrow_avro**.
+
+[Apache Arrow]: https://arrow.apache.org/
+[Apache Avro]: https://avro.apache.org/
+
+---
+
+## Install
+
+```toml
+[dependencies]
+arrow-avro = "56"
+````
+
+Disable defaults and pick only what you need (see **Feature Flags**):
+
+```toml
+[dependencies]
+arrow-avro = { version = "56", default-features = false, features = ["deflate", "snappy"] }
+```
+
+---
+
+## Quick start
+
+### Read an Avro OCF file into Arrow
+
+```rust
+use std::fs::File;
+use std::io::BufReader;
+
+use arrow_avro::reader::ReaderBuilder;
+use arrow_array::RecordBatch;
+
+fn main() -> anyhow::Result<()> {
+ let file = BufReader::new(File::open("data/example.avro")?);
+ let mut reader = ReaderBuilder::new().build(file)?;
+ while let Some(batch) = reader.next() {
+ let batch: RecordBatch = batch?;
+ println!("rows: {}", batch.num_rows());
+ }
+ Ok(())
+}
+```
+
+### Write Arrow to Avro OCF (in‑memory)
+
+```rust
+use std::sync::Arc;
+
+use arrow_avro::writer::AvroWriter;
+use arrow_array::{ArrayRef, Int32Array, RecordBatch};
+use arrow_schema::{DataType, Field, Schema};
+
+fn main() -> anyhow::Result<()> {
+ let schema = Schema::new(vec![Field::new("id", DataType::Int32, false)]);
+ let batch = RecordBatch::try_new(
+ Arc::new(schema.clone()),
+ vec![Arc::new(Int32Array::from(vec![1, 2, 3])) as ArrayRef],
+ )?;
+
+ let sink: Vec<u8> = Vec::new();
+ let mut w = AvroWriter::new(sink, schema)?;
+ w.write(&batch)?;
+ w.finish()?;
+ assert!(!w.into_inner().is_empty());
+ Ok(())
+}
+```
+
+See the crate docs for runnable SOE and Confluent round‑trip examples.
+
+---
+
+## Feature Flags (what they do and when to use them)
+
+### Compression codecs (OCF block compression)
+
+`arrow-avro` supports the Avro‑standard OCF codecs. The **defaults** include all five: `deflate`, `snappy`, `zstd`, `bzip2`, and `xz`.
Review Comment:
I noticed some of these features are missing from the docs in `lib.rs`.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add arrow-avro README.md file [arrow-rs]
Posted by "mbrobbel (via GitHub)" <gi...@apache.org>.
mbrobbel merged PR #8556:
URL: https://github.com/apache/arrow-rs/pull/8556
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org