Indicates whether interval arithmetic is supported for the given expression. Currently, we do not support all [`PhysicalExpr`]s for interval calculations. We do not support every type of [`Operator`]s either. Over time, this check will relax as more types of `PhysicalExpr`s and `Operator`s are supported. Currently, [`CastExpr`], [`NegativeExpr`], [`BinaryExpr`], [`Column`] and [`Literal`] are supp
(expr: &Arc<dyn PhysicalExpr>, schema: &SchemaRef)
| 36 | /// will relax as more types of `PhysicalExpr`s and `Operator`s are supported. |
| 37 | /// Currently, [`CastExpr`], [`NegativeExpr`], [`BinaryExpr`], [`Column`] and [`Literal`] are supported. |
| 38 | pub fn check_support(expr: &Arc<dyn PhysicalExpr>, schema: &SchemaRef) -> bool { |
| 39 | if let Some(binary_expr) = expr.downcast_ref::<BinaryExpr>() { |
| 40 | is_operator_supported(binary_expr.op()) |
| 41 | && check_support(binary_expr.left(), schema) |
| 42 | && check_support(binary_expr.right(), schema) |
| 43 | } else if let Some(column) = expr.downcast_ref::<Column>() { |
| 44 | if let Ok(field) = schema.field_with_name(column.name()) { |
| 45 | is_datatype_supported(field.data_type()) |
| 46 | } else { |
| 47 | false |
| 48 | } |
| 49 | } else if let Some(literal) = expr.downcast_ref::<Literal>() { |
| 50 | if let Ok(dt) = literal.data_type(schema) { |
| 51 | is_datatype_supported(&dt) |
| 52 | } else { |
| 53 | false |
| 54 | } |
| 55 | } else if let Some(cast) = expr.downcast_ref::<CastExpr>() { |
| 56 | check_support(cast.expr(), schema) |
| 57 | } else if let Some(negative) = expr.downcast_ref::<NegativeExpr>() { |
| 58 | check_support(negative.arg(), schema) |
| 59 | } else { |
| 60 | false |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // This function returns the inverse operator of the given operator. |
| 65 | pub fn get_inverse_op(op: Operator) -> Result<Operator> { |
no test coverage detected
searching dependent graphs…