MCPcopy Create free account
hub / github.com/apache/datafusion / scatter_native

Function scatter_native

datafusion/physical-expr-common/src/utils.rs:149–172  ·  view source on GitHub ↗
(
    src: &[T],
    mask: &BooleanBuffer,
    output_len: usize,
    selectivity: f64,
)

Source from the content-addressed store, hash-verified

147
148#[inline(never)]
149fn scatter_native<T: ArrowNativeType>(
150 src: &[T],
151 mask: &BooleanBuffer,
152 output_len: usize,
153 selectivity: f64,
154) -> ScalarBuffer<T> {
155 let mut output = vec![T::default(); output_len];
156 let mut src_offset = 0;
157
158 if selectivity > SCATTER_SLICES_SELECTIVITY_THRESHOLD {
159 for (start, end) in mask.set_slices() {
160 let len = end - start;
161 output[start..end].copy_from_slice(&src[src_offset..src_offset + len]);
162 src_offset += len;
163 }
164 } else {
165 for dst_idx in mask.set_indices() {
166 output[dst_idx] = src[src_offset];
167 src_offset += 1;
168 }
169 }
170
171 ScalarBuffer::from(output)
172}
173
174fn scatter_bits(
175 src: &BooleanBuffer,

Callers 2

scatter_primitiveFunction · 0.85
scatter_byte_viewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…