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 (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
Igosuki committed Jan 5, 2022
1 parent c28d69e commit 9ed6aba
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 9ed6aba

Please sign in to comment.