Skip to content

Commit

Permalink
arrays can be null and should be unboxed when deserializing items (jo…
Browse files Browse the repository at this point in the history
  • Loading branch information
Igosuki committed Jan 26, 2022
1 parent ef7937d commit 1d6db32
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/io/avro/read/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ 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 1d6db32

Please sign in to comment.