Performs a binary operation, applying any type coercion necessary
(
left: Arc<dyn PhysicalExpr>,
op: Operator,
right: Arc<dyn PhysicalExpr>,
schema: &Schema,
)
| 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<()> { |
no test coverage detected
searching dependent graphs…