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

Function check_support

datafusion/physical-expr/src/intervals/utils.rs:38–62  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

36/// will relax as more types of `PhysicalExpr`s and `Operator`s are supported.
37/// Currently, [`CastExpr`], [`NegativeExpr`], [`BinaryExpr`], [`Column`] and [`Literal`] are supported.
38pub 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.
65pub fn get_inverse_op(op: Operator) -> Result<Operator> {

Callers 2

statistics_helperMethod · 0.85
is_prunableFunction · 0.85

Calls 10

is_operator_supportedFunction · 0.85
is_datatype_supportedFunction · 0.85
field_with_nameMethod · 0.80
opMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45
nameMethod · 0.45
data_typeMethod · 0.45
exprMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…