Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4890faa
Added arrow-avro `SchemaStore` and fingerprint support to `schema.rs`…
jecsand838 Jul 25, 2025
f8040c6
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 27, 2025
f2f34d0
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 27, 2025
3db9aed
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 28, 2025
da7b1b9
Address PR Comments
jecsand838 Jul 28, 2025
ed7fb49
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 28, 2025
8e6face
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 28, 2025
25c3899
Address Remaining PR Comments
jecsand838 Jul 28, 2025
bf55dba
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 31, 2025
a113399
Update arrow-avro/src/reader/mod.rs
jecsand838 Jul 31, 2025
5c8e045
Address Follow-up PR Comments
jecsand838 Jul 31, 2025
c8fce60
Update arrow-avro/src/codec.rs
jecsand838 Aug 1, 2025
c631218
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 1, 2025
d014bfb
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 1, 2025
7bffdb6
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 1, 2025
72afc79
Update arrow-avro/src/schema.rs
jecsand838 Aug 1, 2025
6aac06c
Address Follow-up PR Comments
jecsand838 Aug 2, 2025
81fae32
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
6fd3234
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
6a84a05
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
24cb8a2
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
07b55c4
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
4f734e2
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
9c828c6
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 4, 2025
dc56c70
Remove LRU cache feature and refactor StoreStore + AvroSchema handlin…
jecsand838 Aug 5, 2025
5a1b7e4
Merge branch 'main' into avro-reader-schema-store
jecsand838 Aug 5, 2025
fc6a5cb
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 5, 2025
eca7ca3
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 5, 2025
ef9051e
Update arrow-avro/src/reader/mod.rs
jecsand838 Aug 5, 2025
da0cfc2
Merge branch 'apache:main' into avro-reader-schema-store
jecsand838 Aug 7, 2025
c450401
Updated decoder benchmarks to include Avro single-object prefix gener…
jecsand838 Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions arrow-avro/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ impl AvroField {
pub fn name(&self) -> &str {
&self.name
}

/// Performs schema resolution between a writer and reader schema.
///
/// This is the primary entry point for handling schema evolution. It produces an
/// `AvroField` that contains all the necessary information to read data written
/// with the `writer` schema as if it were written with the `reader` schema.
pub fn resolve_from_writer_and_reader<'a>(
writer: &'a Schema<'a>,
reader: &'a Schema<'a>,

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.

aside: I guess this is a low-level avro schema instance, not the arrow schema Schema?
At least, I don't remember arrow Schema objects having a lifetime parameter?

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.

Ah -- SchemaRef is from arrow-schema, but Schema is crate-local.

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.

Perhaps we could rename to disambiguate? ArrowSchemaRef vs. [Avro]Schema?

use_utf8view: bool,
strict_mode: bool,
) -> Result<Self, ArrowError> {
Err(ArrowError::NotYetImplemented(
"Resolving schema from a writer and reader schema is not yet implemented".to_string(),
))
}
}

impl<'a> TryFrom<&Schema<'a>> for AvroField {
Expand All @@ -164,21 +180,33 @@ impl<'a> TryFrom<&Schema<'a>> for AvroField {
/// Builder for an [`AvroField`]
#[derive(Debug)]
pub struct AvroFieldBuilder<'a> {
schema: &'a Schema<'a>,
writer_schema: &'a Schema<'a>,
reader_schema: Option<&'a Schema<'a>>,
use_utf8view: bool,
strict_mode: bool,
}

impl<'a> AvroFieldBuilder<'a> {
/// Creates a new [`AvroFieldBuilder`]
pub fn new(schema: &'a Schema<'a>) -> Self {
/// Creates a new [`AvroFieldBuilder`] for a given writer schema.
pub fn new(writer_schema: &'a Schema<'a>) -> Self {
Self {
schema,
writer_schema,
reader_schema: None,
use_utf8view: false,
strict_mode: false,
}
}

/// Sets the reader schema for schema resolution.
///
/// If a reader schema is provided, the builder will produce a resolved `AvroField`
/// that can handle differences between the writer's and reader's schemas.
#[inline]
pub fn with_reader_schema(mut self, reader_schema: &'a Schema<'a>) -> Self {
self.reader_schema = Some(reader_schema);
self
}

/// Enable or disable Utf8View support
pub fn with_utf8view(mut self, use_utf8view: bool) -> Self {
self.use_utf8view = use_utf8view;
Expand All @@ -193,11 +221,11 @@ impl<'a> AvroFieldBuilder<'a> {

/// Build an [`AvroField`] from the builder
pub fn build(self) -> Result<AvroField, ArrowError> {
match self.schema {
match self.writer_schema {
Schema::Complex(ComplexType::Record(r)) => {
let mut resolver = Resolver::default();
let data_type = make_data_type(
self.schema,
self.writer_schema,
None,
&mut resolver,
self.use_utf8view,
Expand All @@ -210,7 +238,7 @@ impl<'a> AvroFieldBuilder<'a> {
}
_ => Err(ArrowError::ParseError(format!(
"Expected a Record schema to build an AvroField, but got {:?}",
self.schema
self.writer_schema
))),
}
}
Expand Down
8 changes: 4 additions & 4 deletions arrow-avro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
/// Implements the primary reader interface and record decoding logic.
pub mod reader;

// Avro schema parsing and representation
//
// Provides types for parsing and representing Avro schema definitions.
mod schema;
/// Avro schema parsing and representation
///
/// Provides types for parsing and representing Avro schema definitions.
pub mod schema;

/// Compression codec implementations for Avro
///
Expand Down
Loading
Loading