Resolves the optional `start_from` argument into a `Vec ` of 0-indexed starting positions.
(
third_arg: Option<&ColumnarValue>,
num_rows: usize,
)
| 201 | /// Resolves the optional `start_from` argument into a `Vec<i64>` of |
| 202 | /// 0-indexed starting positions. |
| 203 | fn resolve_start_from( |
| 204 | third_arg: Option<&ColumnarValue>, |
| 205 | num_rows: usize, |
| 206 | ) -> Result<Vec<i64>> { |
| 207 | match third_arg { |
| 208 | None => Ok(vec![0i64; num_rows]), |
| 209 | Some(ColumnarValue::Scalar(ScalarValue::Int64(Some(v)))) => { |
| 210 | Ok(vec![v - 1; num_rows]) |
| 211 | } |
| 212 | Some(ColumnarValue::Scalar(s)) => { |
| 213 | exec_err!("array_position expected Int64 for start_from, got {s}") |
| 214 | } |
| 215 | Some(ColumnarValue::Array(a)) => { |
| 216 | Ok(as_int64_array(a)?.values().iter().map(|&x| x - 1).collect()) |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | /// Fast path for `array_position` when the needle is scalar. |
| 222 | /// |
no test coverage detected
searching dependent graphs…