scovich commented on code in PR #9141:
URL: https://github.com/apache/arrow-rs/pull/9141#discussion_r2683107912
##########
arrow-array/src/array/byte_array.rs:
##########
@@ -154,6 +154,30 @@ impl<T: ByteArrayType> GenericByteArray<T> {
})
}
+ /// It returns a new array with the same data and a new null buffer.
+ ///
+ /// The resulting null buffer is the union of the existing nulls and the
provided nulls.
+ /// In other words, a slot is valid in the result only if it is valid in
BOTH
+ /// the existing array AND the provided `nulls`.
+ ///
+ /// # Panics
+ ///
+ /// Panics if `nulls` has a different length than the array.
+ pub fn with_nulls(self, nulls: Option<NullBuffer>) -> Self {
+ if let Some(n) = &nulls {
+ assert_eq!(n.len(), self.len(), "Null buffer length mismatch");
+ }
+
+ let new_nulls = NullBuffer::union(self.nulls.as_ref(), nulls.as_ref());
+
+ Self {
+ data_type: T::DATA_TYPE,
Review Comment:
@alamb Is this is a valid observation/suggestion? What do you think?
--
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]