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

Function apply_arithmetic

datafusion/physical-expr/src/expressions/binary.rs:2734–2750  ·  view source on GitHub ↗
(
        schema: SchemaRef,
        data: Vec<ArrayRef>,
        op: Operator,
        expected: PrimitiveArray<T>,
    )

Source from the content-addressed store, hash-verified

2732 }
2733
2734 fn apply_arithmetic<T: ArrowNumericType>(
2735 schema: SchemaRef,
2736 data: Vec<ArrayRef>,
2737 op: Operator,
2738 expected: PrimitiveArray<T>,
2739 ) -> Result<()> {
2740 let arithmetic_op =
2741 binary_op(col("a", &schema)?, op, col("b", &schema)?, &schema)?;
2742 let batch = RecordBatch::try_new(schema, data)?;
2743 let result = arithmetic_op
2744 .evaluate(&batch)?
2745 .into_array(batch.num_rows())
2746 .expect("Failed to convert to array");
2747
2748 assert_eq!(result.as_ref(), &expected);
2749 Ok(())
2750 }
2751
2752 fn apply_arithmetic_scalar(
2753 schema: SchemaRef,

Callers 5

plus_op_dict_decimalFunction · 0.85
minus_op_dict_decimalFunction · 0.85
multiply_op_dict_decimalFunction · 0.85
divide_op_dict_decimalFunction · 0.85
modulus_op_dict_decimalFunction · 0.85

Calls 4

binary_opFunction · 0.85
colFunction · 0.70
into_arrayMethod · 0.45
evaluateMethod · 0.45

Tested by 5

plus_op_dict_decimalFunction · 0.68
minus_op_dict_decimalFunction · 0.68
multiply_op_dict_decimalFunction · 0.68
divide_op_dict_decimalFunction · 0.68
modulus_op_dict_decimalFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…