Dispatches `substr` to the appropriate string array implementation.
(args: &[ArrayRef])
| 131 | |
| 132 | /// Dispatches `substr` to the appropriate string array implementation. |
| 133 | fn 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 | /// |
searching dependent graphs…