nevi-me commented on a change in pull request #7306:
URL: https://github.com/apache/arrow/pull/7306#discussion_r432919807
##########
File path: rust/arrow/src/array/builder.rs
##########
@@ -500,6 +500,49 @@ 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],
+ offset: usize,
+ ) -> Result<()> {
+ let ceil = bit_util::round_upto_power_of_2(values.len(), 8);
+ if offset == 0 {
+ // if there is no offset, the value slice should align with
validity
+ assert_eq!(
+ ceil / 8,
+ is_valid.len(),
+ "value slice not aligned with validity slice"
+ );
Review comment:
When I change the inputs to ArrayData, the asserts become redundant, so
I'll remove them. There are some cases where we use asserts to hint to the
compiler not to do bounds checks, so I think that's why we use them on some
functions.
----------------------------------------------------------------
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]