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

Function map_strings

datafusion/functions/src/unicode/substrindex.rs:477–499  ·  view source on GitHub ↗
(
    string_array: S,
    mut builder: GenericStringArrayBuilder<O>,
    f: F,
)

Source from the content-addressed store, hash-verified

475}
476
477fn map_strings<'a, S, O, F>(
478 string_array: S,
479 mut builder: GenericStringArrayBuilder<O>,
480 f: F,
481) -> Result<ArrayRef>
482where
483 S: StringArrayType<'a> + Copy,
484 O: OffsetSizeTrait,
485 F: Fn(&'a str) -> &'a str,
486{
487 let nulls = string_array.nulls().cloned();
488 for i in 0..string_array.len() {
489 if nulls.as_ref().is_some_and(|n| n.is_null(i)) {
490 builder.append_placeholder();
491 continue;
492 }
493 // SAFETY: `i < string_array.len()` and `nulls` is valid at i, so the
494 // input is also valid at i.
495 let s = unsafe { string_array.value_unchecked(i) };
496 builder.append_value(f(s));
497 }
498 Ok(Arc::new(builder.finish(nulls)?) as ArrayRef)
499}
500
501#[inline]
502fn substr_index_slice<'a>(string: &'a str, delimiter: &str, count: i64) -> &'a str {

Callers 1

substr_index_scalar_implFunction · 0.70

Calls 9

newFunction · 0.85
append_placeholderMethod · 0.80
clonedMethod · 0.45
nullsMethod · 0.45
lenMethod · 0.45
as_refMethod · 0.45
is_nullMethod · 0.45
append_valueMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…