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

Function get_str_value

datafusion/functions-nested/src/string.rs:499–512  ·  view source on GitHub ↗

Returns the string value at index `i` from a string array of any type.

(array: &ArrayRef, i: usize)

Source from the content-addressed store, hash-verified

497
498/// Returns the string value at index `i` from a string array of any type.
499fn get_str_value(array: &ArrayRef, i: usize) -> Option<&str> {
500 if array.is_null(i) {
501 return None;
502 }
503 match array.data_type() {
504 Utf8 => Some(array.as_string::<i32>().value(i)),
505 LargeUtf8 => Some(array.as_string::<i64>().value(i)),
506 Utf8View => Some(array.as_string_view().value(i)),
507 other => {
508 debug_assert!(false, "unexpected type in get_str_value: {other:?}");
509 None
510 }
511 }
512}
513
514fn array_to_string_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
515 if args.len() < 2 || args.len() > 3 {

Callers 1

Calls 3

is_nullMethod · 0.45
data_typeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…