Skip to content

Commit

Permalink
Fix incorrect null_count
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 19, 2022
1 parent 20ffaf8 commit b453bbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arrow/src/ipc/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,13 @@ fn write_array_data(
null_count: usize,
) -> i64 {
let mut offset = offset;
nodes.push(ipc::FieldNode::new(num_rows as i64, null_count as i64));
if !matches!(array_data.data_type(), DataType::Null) {
nodes.push(ipc::FieldNode::new(num_rows as i64, null_count as i64));
} else {
// NullArray's null_count equals to len, but the `null_count` passed in is from ArrayData
// where null_count is always 0.
nodes.push(ipc::FieldNode::new(num_rows as i64, num_rows as i64));
}
// NullArray does not have any buffers, thus the null buffer is not generated
// UnionArray does not have a validity buffer
if !matches!(
Expand Down

0 comments on commit b453bbc

Please sign in to comment.