Rich-T-kid commented on code in PR #11174:
URL: https://github.com/apache/arrow-rs/pull/11174#discussion_r4321603142
##########
arrow-select/src/coalesce.rs:
##########
@@ -40,6 +41,45 @@ use fixed_size_binary::InProgressFixedSizeBinaryArray;
use generic::GenericInProgressArray;
use primitive::InProgressPrimitiveArray;
+// Caller must have bounds-checked `indices` against `source_nulls`.
+pub(crate) fn append_gathered_nulls(
+ nulls: &mut NullBufferBuilder,
+ source_nulls: &NullBuffer,
+ indices: &[u32],
+) {
+ if source_nulls.null_count() == 0 {
+ nulls.append_n_non_nulls(indices.len());
+ return;
+ }
+ let buf = Buffer::from_slice_ref(indices);
+ let scalar: ScalarBuffer<u32> = ScalarBuffer::new(buf, 0, indices.len());
+ let indices_arr = UInt32Array::new(scalar, None);
+ let gathered = take_bits::<UInt32Type, false>(source_nulls.inner(),
&indices_arr);
+ nulls.append_buffer(&NullBuffer::new(gathered));
+}
Review Comment:
yea this makes a lot of sense to me. changing the API to `[u32]` or
something of this nature allows for buffer re-use as well across calls which
should be nice savings for medium/large sized buffers.
--
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]