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

Function unary_typecheck

src/expr/src/interpret.rs:1296–1312  ·  view source on GitHub ↗
(func: &UnaryFunc, arg: &ReprColumnType)

Source from the content-addressed store, hash-verified

1294 };
1295
1296 fn unary_typecheck(func: &UnaryFunc, arg: &ReprColumnType) -> bool {
1297 use UnaryFunc::*;
1298 match func {
1299 CastNumericToMzTimestamp(_) | NegNumeric(_) => arg.scalar_type == NUM_TYPE,
1300 CastJsonbToNumeric(_) | CastJsonbToBool(_) | CastJsonbToString(_) => {
1301 arg.scalar_type == ReprScalarType::Jsonb
1302 }
1303 ExtractTimestamp(_) | DateTruncTimestamp(_) => {
1304 arg.scalar_type == ReprScalarType::Timestamp
1305 }
1306 ExtractDate(_) => arg.scalar_type == ReprScalarType::Date,
1307 Not(_) => arg.scalar_type == ReprScalarType::Bool,
1308 IsNull(_) => true,
1309 TryParseMonotonicIso8601Timestamp(_) => arg.scalar_type == ReprScalarType::String,
1310 _ => false,
1311 }
1312 }
1313
1314 fn interesting_binary_funcs() -> Vec<BinaryFunc> {
1315 vec![

Callers 1

gen_expr_for_relationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected