jecsand838 commented on code in PR #8006: URL: https://github.com/apache/arrow-rs/pull/8006#discussion_r2251790346
########## arrow-avro/src/reader/mod.rs: ########## @@ -216,34 +369,91 @@ impl ReaderBuilder { /// - `batch_size` = 1024 /// - `strict_mode` = false /// - `utf8_view` = false - /// - `schema` = None + /// - `reader_schema` = None + /// - `writer_schema_store` = None + /// - `active_fingerprint` = None pub fn new() -> Self { Self::default() } - fn make_record_decoder(&self, schema: &AvroSchema<'_>) -> Result<RecordDecoder, ArrowError> { - let root_field = AvroFieldBuilder::new(schema) - .with_utf8view(self.utf8_view) - .with_strict_mode(self.strict_mode) - .build()?; - RecordDecoder::try_new_with_options(root_field.data_type(), self.utf8_view) + fn make_record_decoder<'a>( + &self, + writer_schema: &AvroSchema<'a>, + reader_schema: Option<&AvroSchema<'a>>, + ) -> Result<RecordDecoder, ArrowError> { + let root = match reader_schema { + Some(reader_schema) if !compare_schemas(writer_schema, reader_schema)? => { + AvroFieldBuilder::new(writer_schema).with_reader_schema(reader_schema) + } + _ => AvroFieldBuilder::new(writer_schema), + } + .with_utf8view(self.utf8_view) + .with_strict_mode(self.strict_mode) + .build()?; + RecordDecoder::try_new_with_options(root.data_type(), self.utf8_view) + } + + fn make_decoder_with_parts( + &self, + active_decoder: RecordDecoder, + active_fingerprint: Option<Fingerprint>, + reader_schema: Option<AvroSchema<'static>>, + writer_schema_store: Option<SchemaStore<'static>>, + ) -> Decoder { + #[cfg(feature = "lru")] + let capacity = NonZeroUsize::new(self.decoder_cache_size).unwrap_or(NonZeroUsize::MIN); // NonZeroUsize::MIN is 1 Review Comment: The CI fmt job is aware of this crate and I always run fmt on the code before pushing up. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org