MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / canCastStatically

Method canCastStatically

src/binder/expression/expression_util.cpp:417–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417bool ExpressionUtil::canCastStatically(const Expression& expr, const LogicalType& targetType) {
418 switch (expr.expressionType) {
419 case ExpressionType::LITERAL: {
420 auto value = expr.constPtrCast<LiteralExpression>()->getValue();
421 return compatible(value, targetType);
422 }
423 case ExpressionType::PARAMETER: {
424 auto value = expr.constPtrCast<ParameterExpression>()->getValue();
425 return compatible(value, targetType);
426 }
427 default:
428 return compatible(expr.getDataType(), targetType);
429 }
430}
431
432bool ExpressionUtil::canEvaluateAsLiteral(const Expression& expr) {
433 switch (expr.expressionType) {

Callers

nothing calls this directly

Calls 3

compatibleFunction · 0.85
getDataTypeMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected