nevi-me commented on a change in pull request #7306:
URL: https://github.com/apache/arrow/pull/7306#discussion_r432869911
##########
File path: rust/arrow/src/array/builder.rs
##########
@@ -500,6 +500,26 @@ impl<T: ArrowPrimitiveType> PrimitiveBuilder<T> {
Ok(())
}
+ /// Appends values from a slice of type `T` and a validity byte slice
+ pub fn append_values(&mut self, values: &[T::Native], is_valid: &[u8]) ->
Result<()> {
+ let ceil = bit_util::round_upto_power_of_2(values.len(), 8);
+ assert_eq!(
+ ceil / 8,
+ is_valid.len(),
+ "value slice not aligned with validity slice"
+ );
+ let mut bools = Vec::with_capacity(values.len() / 8 + 1);
+ is_valid.iter().for_each(|v| {
+ let bin = format!("{:b}", v);
+ // TODO: reversing to correct the endianness, find a better
solution
Review comment:
I need help here. I'm ultimately trying to convert `&[u8; x]` to
`&[bool; 8x]` while also handling the correct endianness.
The only way I could find to check endianness is by introducing the
`byteorder` crate, so I'm unsure if the `rev()` is currently always valid. I'll
add more tests to check this.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]