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

Function scatter_fixed_size_binary

datafusion/physical-expr-common/src/utils.rs:314–344  ·  view source on GitHub ↗
(
    truthy: &FixedSizeBinaryArray,
    mask: &BooleanBuffer,
    output_len: usize,
    selectivity: f64,
)

Source from the content-addressed store, hash-verified

312}
313
314fn scatter_fixed_size_binary(
315 truthy: &FixedSizeBinaryArray,
316 mask: &BooleanBuffer,
317 output_len: usize,
318 selectivity: f64,
319) -> FixedSizeBinaryArray {
320 let value_length = truthy.value_length() as usize;
321 let mut output = vec![0u8; output_len * value_length];
322 let mut src_idx = 0;
323
324 if selectivity > SCATTER_SLICES_SELECTIVITY_THRESHOLD {
325 for (start, end) in mask.set_slices() {
326 for dst_idx in start..end {
327 let src_bytes = truthy.value(src_idx);
328 let dst_start = dst_idx * value_length;
329 output[dst_start..dst_start + value_length].copy_from_slice(src_bytes);
330 src_idx += 1;
331 }
332 }
333 } else {
334 for dst_idx in mask.set_indices() {
335 let src_bytes = truthy.value(src_idx);
336 let dst_start = dst_idx * value_length;
337 output[dst_start..dst_start + value_length].copy_from_slice(src_bytes);
338 src_idx += 1;
339 }
340 }
341 let nulls = scatter_null_mask(truthy.nulls(), mask, output_len, selectivity);
342
343 FixedSizeBinaryArray::new(truthy.value_length(), Buffer::from(output), nulls)
344}
345
346fn scatter_dict<K: ArrowDictionaryKeyType>(
347 truthy: &DictionaryArray<K>,

Callers

nothing calls this directly

Calls 4

scatter_null_maskFunction · 0.85
newFunction · 0.85
valueMethod · 0.45
nullsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…