Skip to content

Commit

Permalink
Add check at reader too
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 19, 2022
1 parent b453bbc commit 1c206f8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions arrow/src/ipc/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,18 @@ fn create_array(
Arc::new(array)
}
Null => {
let length = nodes[node_index].length() as usize;
let length = nodes[node_index].length();
let null_count = nodes[node_index].null_count();

if length != null_count {
return Err(ArrowError::IoError(format!(
"Field {} of NullArray has unequal null_count {} and len {}",
field, null_count, length
)));
}

let data = ArrayData::builder(data_type.clone())
.len(length)
.len(length as usize)
.offset(0)
.build()
.unwrap();
Expand Down

0 comments on commit 1c206f8

Please sign in to comment.