andygrove commented on code in PR #6824:
URL: https://github.com/apache/datafusion-comet/pull/6824#discussion_r4237581208
##########
native/core/benches/array_element_append.rs:
##########
@@ -137,6 +147,27 @@ fn create_spark_unsafe_array_f64(num_elements: usize,
with_nulls: bool) -> Vec<u
buffer
}
+/// Create a SparkUnsafeArray of `num_elements` elements of `width` bytes
whose element `null_idx`
+/// is null, on an 8-byte boundary as inside an UnsafeRow.
+fn create_spark_unsafe_array_with_one_null(
+ num_elements: usize,
+ width: usize,
+ null_idx: usize,
+) -> Vec<u64> {
+ let header_size = 8 + num_elements.div_ceil(64) * 8;
+ let mut buffer = vec![0u8; header_size + (num_elements *
width).div_ceil(8) * 8];
+ buffer[0..8].copy_from_slice(&(num_elements as i64).to_le_bytes());
+ buffer[8 + null_idx / 8] |= 1 << (null_idx % 8);
+ for i in 0..num_elements {
+ let offset = header_size + i * width;
+ buffer[offset..offset + width].copy_from_slice(&(i as
i64).to_le_bytes()[..width]);
+ }
+ buffer
+ .chunks_exact(8)
Review Comment:
Done in 81d74bc4f, with `as_chunks::<8>()` as clippy suggests, and
`rust-test` passes now. I've also updated the PR description: it covers the
`row.rs` test, the Scala case and `list_with_one_null`, and takes its numbers
from the in-tree bench.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]