Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions arrow-row/src/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ pub fn encode<T: FixedLengthEncoding>(
nulls: &NullBuffer,
opts: SortOptions,
) {
let null_sentinel = null_sentinel(opts);
for (value_idx, is_valid) in nulls.iter().enumerate() {
let offset = &mut offsets[value_idx + 1];
let end_offset = *offset + T::ENCODED_LEN;
Expand All @@ -234,7 +235,7 @@ pub fn encode<T: FixedLengthEncoding>(
}
to_write[1..].copy_from_slice(encoded.as_ref())
} else {
data[*offset] = null_sentinel(opts);
data[*offset] = null_sentinel;
}
*offset = end_offset;
}
Expand Down Expand Up @@ -276,6 +277,7 @@ pub fn encode_boolean(
nulls: &NullBuffer,
opts: SortOptions,
) {
let null_sentinel = null_sentinel(opts);
for (idx, is_valid) in nulls.iter().enumerate() {
let offset = &mut offsets[idx + 1];
let end_offset = *offset + bool::ENCODED_LEN;
Expand All @@ -289,7 +291,7 @@ pub fn encode_boolean(
}
to_write[1..].copy_from_slice(encoded.as_ref())
} else {
data[*offset] = null_sentinel(opts);
data[*offset] = null_sentinel;
}
*offset = end_offset;
}
Expand Down Expand Up @@ -327,6 +329,7 @@ pub fn encode_fixed_size_binary(
opts: SortOptions,
) {
let len = array.value_length() as usize;
let null_sentinel = null_sentinel(opts);
for (offset, maybe_val) in offsets.iter_mut().skip(1).zip(array.iter()) {
let end_offset = *offset + len + 1;
if let Some(val) = maybe_val {
Expand All @@ -338,7 +341,7 @@ pub fn encode_fixed_size_binary(
to_write[1..1 + len].iter_mut().for_each(|v| *v = !*v)
}
} else {
data[*offset] = null_sentinel(opts);
data[*offset] = null_sentinel;
}
*offset = end_offset;
}
Expand Down
3 changes: 2 additions & 1 deletion arrow-row/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,10 @@ pub unsafe fn decode_list_view<O: OffsetSizeTrait>(
}
O::from_usize(child_count).expect("overflow");

let null_sentinel = null_sentinel(opts);
let mut null_count = 0;
let nulls = MutableBuffer::collect_bool(rows.len(), |x| {
let valid = rows[x][0] != null_sentinel(opts);
let valid = rows[x][0] != null_sentinel;
null_count += !valid as usize;
valid
});
Expand Down
3 changes: 2 additions & 1 deletion arrow-row/src/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ fn decode_binary_view_inner<const VALIDATE_UTF8: bool>(
Vec::new()
};

let null_sentinel = null_sentinel(options);
let mut views = vec![0_u128; len];
for (i, row) in rows.iter_mut().enumerate() {
let start_offset = values.len();
Expand All @@ -344,7 +345,7 @@ fn decode_binary_view_inner<const VALIDATE_UTF8: bool>(
// overwrite short strings in the values buffer as we inline those to
// views.
let decoded_len = values.len() - start_offset;
if row[0] == null_sentinel(options) {
if row[0] == null_sentinel {
debug_assert_eq!(offset, 1);
debug_assert_eq!(start_offset, values.len());
} else {
Expand Down
Loading