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

Function substr

datafusion/functions/src/unicode/substr.rs:133–152  ·  view source on GitHub ↗

Dispatches `substr` to the appropriate string array implementation.

(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

131
132/// Dispatches `substr` to the appropriate string array implementation.
133fn substr(args: &[ArrayRef]) -> Result<ArrayRef> {
134 match args[0].data_type() {
135 DataType::Utf8 => {
136 let string_array = args[0].as_string::<i32>();
137 generic_string_substr(string_array, &args[1..])
138 }
139 DataType::LargeUtf8 => {
140 let string_array = args[0].as_string::<i64>();
141 generic_string_substr(string_array, &args[1..])
142 }
143 DataType::Utf8View => {
144 let string_array = args[0].as_string_view();
145 string_view_substr(string_array, &args[1..])
146 }
147 other => exec_err!(
148 "Unsupported data type {other:?} for function substr,\
149 expected Utf8View, Utf8 or LargeUtf8."
150 ),
151 }
152}
153
154/// Convert the given `start` and `count` to valid byte indices within `input` string.
155///

Callers 7

test_fn_substrFunction · 0.85
invoke_substr_with_argsFunction · 0.85
plan_substringMethod · 0.85
plan_substringMethod · 0.85

Calls 3

generic_string_substrFunction · 0.85
string_view_substrFunction · 0.85
data_typeMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…