MCPcopy Create free account
hub / github.com/apache/datafusion / binary_op

Function binary_op

datafusion/physical-expr/src/expressions/binary.rs:1011–1025  ·  view source on GitHub ↗

Performs a binary operation, applying any type coercion necessary

(
        left: Arc<dyn PhysicalExpr>,
        op: Operator,
        right: Arc<dyn PhysicalExpr>,
        schema: &Schema,
    )

Source from the content-addressed store, hash-verified

1009 use datafusion_expr::col as logical_col;
1010 /// Performs a binary operation, applying any type coercion necessary
1011 fn binary_op(
1012 left: Arc<dyn PhysicalExpr>,
1013 op: Operator,
1014 right: Arc<dyn PhysicalExpr>,
1015 schema: &Schema,
1016 ) -> Result<Arc<dyn PhysicalExpr>> {
1017 let left_type = left.data_type(schema)?;
1018 let right_type = right.data_type(schema)?;
1019 let (lhs, rhs) =
1020 BinaryTypeCoercer::new(&left_type, &op, &right_type).get_input_types()?;
1021
1022 let left_expr = try_cast(left, schema, lhs)?;
1023 let right_expr = try_cast(right, schema, rhs)?;
1024 binary(left_expr, op, right_expr, schema)
1025 }
1026
1027 #[test]
1028 fn binary_comparison() -> Result<()> {

Callers 7

apply_arithmeticFunction · 0.85
apply_arithmetic_scalarFunction · 0.85
apply_logic_opFunction · 0.85
binary_exprFunction · 0.85

Calls 5

newFunction · 0.85
binaryFunction · 0.85
get_input_typesMethod · 0.80
try_castFunction · 0.70
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…