(
schema: SchemaRef,
data: Vec<ArrayRef>,
op: Operator,
expected: PrimitiveArray<T>,
)
| 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, |
searching dependent graphs…