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

Function test_like

src/expr/src/interpret.rs:1978–2003  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1976
1977 #[mz_ore::test]
1978 fn test_like() {
1979 let arena = RowArena::new();
1980
1981 let expr = MirScalarExpr::CallUnary {
1982 func: UnaryFunc::IsLikeMatch(IsLikeMatch(
1983 crate::like_pattern::compile("%whatever%", true).unwrap(),
1984 )),
1985 expr: Box::new(MirScalarExpr::column(0)),
1986 };
1987
1988 let relation = ReprRelationType::new(vec![ReprScalarType::String.nullable(true)]);
1989 let mut interpreter = ColumnSpecs::new(&relation, &arena);
1990 interpreter.push_column(
1991 0,
1992 ResultSpec::value_between(Datum::String("aardvark"), Datum::String("zebra")),
1993 );
1994
1995 let range_out = interpreter.expr(&expr).range;
1996 assert!(
1997 !range_out.fallible,
1998 "like function should not error on non-error input"
1999 );
2000 assert!(range_out.may_contain(Datum::True));
2001 assert!(range_out.may_contain(Datum::False));
2002 assert!(range_out.may_contain(Datum::Null));
2003 }
2004
2005 #[mz_ore::test]
2006 fn test_try_parse_monotonic_iso8601_timestamp() {

Callers

nothing calls this directly

Calls 6

IsLikeMatchClass · 0.85
compileFunction · 0.85
StringClass · 0.85
unwrapMethod · 0.80
push_columnMethod · 0.80
exprMethod · 0.45

Tested by

no test coverage detected