Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
arrays can be null and should be unboxed when deserializing items
Browse files Browse the repository at this point in the history
  • Loading branch information
Igosuki committed Jan 3, 2022
1 parent ef7937d commit 4d894d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/io/avro/read/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ fn deserialize_value<'a>(
let data_type = array.data_type();
match data_type {
DataType::List(inner) => {
let avro_inner = if let AvroSchema::Array(inner) = avro_field {
inner.as_ref()
} else {
unreachable!()
let avro_inner = match avro_field {
AvroSchema::Array(inner) => inner.as_ref(),
AvroSchema::Union(u) => match &u.as_slice() {
&[AvroSchema::Array(inner), _] | &[_, AvroSchema::Array(inner)] => inner.as_ref(),
_ => unreachable!()
}
_ => unreachable!()
};

let is_nullable = inner.is_nullable();
Expand Down

0 comments on commit 4d894d0

Please sign in to comment.