MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / eval

Method eval

src/expr/src/scalar/func/impls/string.rs:359–383  ·  view source on GitHub ↗
(
        &'a self,
        datums: &[Datum<'a>],
        temp_storage: &'a RowArena,
        a: &'a impl Eval,
    )

Source from the content-addressed store, hash-verified

357
358impl 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 {

Callers

nothing calls this directly

Calls 15

StringClass · 0.85
parse_rangeFunction · 0.85
parse_legacy_vectorFunction · 0.85
array_create_scalarFunction · 0.85
regexp_match_staticFunction · 0.85
regexp_split_to_array_reFunction · 0.85
unwrap_strMethod · 0.80
push_stringMethod · 0.80
try_make_datumMethod · 0.80
try_push_arrayMethod · 0.80
make_datumMethod · 0.80
push_listMethod · 0.80

Tested by

no test coverage detected