Skip to content

Commit ef9051e

Browse files
jecsand838scovich
andcommitted
Update arrow-avro/src/reader/mod.rs
Co-authored-by: Ryan Johnson <[email protected]>
1 parent eca7ca3 commit ef9051e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

arrow-avro/src/reader/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,14 @@ impl ReaderBuilder {
326326
writer_schema: &Schema,
327327
reader_schema: Option<&AvroSchema>,
328328
) -> Result<RecordDecoder, ArrowError> {
329-
let root = match reader_schema {
330-
Some(reader_schema) => {
331-
AvroFieldBuilder::new(writer_schema).with_reader_schema(reader_schema.clone())
332-
}
333-
_ => AvroFieldBuilder::new(writer_schema),
329+
let mut builder = AvroFieldBuilder::new(writer_schema);
330+
if let Some(reader_schema) = reader_schema {
331+
builder = builder.with_reader_schema(reader_schema.clone());
334332
}
335-
.with_utf8view(self.utf8_view)
336-
.with_strict_mode(self.strict_mode)
337-
.build()?;
333+
let root = builder
334+
.with_utf8view(self.utf8_view)
335+
.with_strict_mode(self.strict_mode)
336+
.build()?;
338337
RecordDecoder::try_new_with_options(root.data_type(), self.utf8_view)
339338
}
340339

0 commit comments

Comments
 (0)