(
&'a self,
datums: &[Datum<'a>],
temp_storage: &'a RowArena,
a: &'a impl Eval,
)
| 357 | |
| 358 | impl LazyUnaryFunc for CastStringToArray { |
| 359 | fn eval<'a>( |
| 360 | &'a self, |
| 361 | datums: &[Datum<'a>], |
| 362 | temp_storage: &'a RowArena, |
| 363 | a: &'a impl Eval, |
| 364 | ) -> Result<Datum<'a>, EvalError> { |
| 365 | let a = a.eval(datums, temp_storage)?; |
| 366 | if a.is_null() { |
| 367 | return Ok(Datum::Null); |
| 368 | } |
| 369 | let (datums, dims) = strconv::parse_array( |
| 370 | a.unwrap_str(), |
| 371 | || Datum::Null, |
| 372 | |elem_text| { |
| 373 | let elem_text = match elem_text { |
| 374 | Cow::Owned(s) => temp_storage.push_string(s), |
| 375 | Cow::Borrowed(s) => s, |
| 376 | }; |
| 377 | self.cast_expr |
| 378 | .eval(&[Datum::String(elem_text)], temp_storage) |
| 379 | }, |
| 380 | )?; |
| 381 | |
| 382 | Ok(temp_storage.try_make_datum(|packer| packer.try_push_array(&dims, datums))?) |
| 383 | } |
| 384 | |
| 385 | /// The output SqlColumnType of this function |
| 386 | fn output_sql_type(&self, input_type: SqlColumnType) -> SqlColumnType { |
nothing calls this directly
no test coverage detected