(args: &[ArrayRef])
| 300 | } |
| 301 | |
| 302 | fn general_position_dispatch<O: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> { |
| 303 | let haystack = as_generic_list_array::<O>(&args[0])?; |
| 304 | let needle = &args[1]; |
| 305 | |
| 306 | crate::utils::check_datatypes("array_position", &[haystack.values(), needle])?; |
| 307 | |
| 308 | let arr_from = if args.len() == 3 { |
| 309 | as_int64_array(&args[2])? |
| 310 | .values() |
| 311 | .iter() |
| 312 | .map(|&x| x - 1) |
| 313 | .collect::<Vec<_>>() |
| 314 | } else { |
| 315 | vec![0; haystack.len()] |
| 316 | }; |
| 317 | |
| 318 | for (row, &from) in haystack.iter().zip(arr_from.iter()) { |
| 319 | if !row.is_none_or(|row| from >= 0 && (from as usize) <= row.len()) { |
| 320 | return exec_err!("start_from out of bounds: {}", from + 1); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | generic_position::<O>(haystack, needle, &arr_from) |
| 325 | } |
| 326 | |
| 327 | fn generic_position<O: OffsetSizeTrait>( |
| 328 | haystack: &GenericListArray<O>, |
nothing calls this directly
no test coverage detected
searching dependent graphs…