Skip to content

Commit 2c283ca

Browse files
committed
feat: Initial support for AnyExpression
1 parent 5ee9214 commit 2c283ca

File tree

19 files changed

+695
-7
lines changed

19 files changed

+695
-7
lines changed

ballista/rust/client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ datafusion = { path = "../../../datafusion/core", version = "7.0.0" }
3535
futures = "0.3"
3636
log = "0.4"
3737
parking_lot = "0.12"
38-
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
38+
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "804047c4f77c7973c87322dc3e0270c55a2a9b44" }
3939
tempfile = "3"
4040
tokio = "1.0"
4141

ballista/rust/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ parse_arg = "0.1.3"
4949
prost = "0.9"
5050
prost-types = "0.9"
5151
serde = { version = "1", features = ["derive"] }
52-
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
52+
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "804047c4f77c7973c87322dc3e0270c55a2a9b44" }
5353
tokio = "1.0"
5454
tonic = "0.6"
5555
uuid = { version = "0.8", features = ["v4"] }

datafusion/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ cranelift-module = { version = "0.82.0", optional = true }
4444
ordered-float = "2.10"
4545
parquet = { git = 'https://github.com/cube-js/arrow-rs.git', rev = "01aa59d11110fd33b389cab0bf679b99db9e10e2", features = ["arrow"], optional = true }
4646
pyo3 = { version = "0.16", optional = true }
47-
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
47+
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "804047c4f77c7973c87322dc3e0270c55a2a9b44" }

datafusion/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pin-project-lite= "^0.2.7"
7878
pyo3 = { version = "0.16", optional = true }
7979
rand = "0.8"
8080
smallvec = { version = "1.6", features = ["union"] }
81-
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "81217ce0dccc446d3d2f42582717b9e8fe960113" }
81+
sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "804047c4f77c7973c87322dc3e0270c55a2a9b44" }
8282
tempfile = "3"
8383
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }
8484
tokio-stream = "0.1"

datafusion/core/src/datasource/listing/helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ impl ExpressionVisitor for ApplicabilityVisitor<'_> {
9191
| Expr::Cast { .. }
9292
| Expr::TryCast { .. }
9393
| Expr::BinaryExpr { .. }
94+
| Expr::AnyExpr { .. }
9495
| Expr::Between { .. }
9596
| Expr::InList { .. }
9697
| Expr::GetIndexedField { .. }

datafusion/core/src/logical_plan/expr_rewriter.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ impl ExprRewritable for Expr {
119119
op,
120120
right: rewrite_boxed(right, rewriter)?,
121121
},
122+
Expr::AnyExpr { left, op, right } => Expr::AnyExpr {
123+
left: rewrite_boxed(left, rewriter)?,
124+
op,
125+
right: rewrite_boxed(right, rewriter)?,
126+
},
122127
Expr::Not(expr) => Expr::Not(rewrite_boxed(expr, rewriter)?),
123128
Expr::IsNotNull(expr) => Expr::IsNotNull(rewrite_boxed(expr, rewriter)?),
124129
Expr::IsNull(expr) => Expr::IsNull(rewrite_boxed(expr, rewriter)?),

datafusion/core/src/logical_plan/expr_schema.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ impl ExprSchemable for Expr {
111111
| Expr::IsNull(_)
112112
| Expr::Between { .. }
113113
| Expr::InList { .. }
114+
| Expr::AnyExpr { .. }
114115
| Expr::IsNotNull(_) => Ok(DataType::Boolean),
115116
Expr::BinaryExpr {
116117
ref left,
@@ -189,6 +190,11 @@ impl ExprSchemable for Expr {
189190
ref right,
190191
..
191192
} => Ok(left.nullable(input_schema)? || right.nullable(input_schema)?),
193+
Expr::AnyExpr {
194+
ref left,
195+
ref right,
196+
..
197+
} => Ok(left.nullable(input_schema)? || right.nullable(input_schema)?),
192198
Expr::Wildcard => Err(DataFusionError::Internal(
193199
"Wildcard expressions are not valid in a logical query plan".to_owned(),
194200
)),

datafusion/core/src/logical_plan/expr_visitor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ impl ExprVisitable for Expr {
116116
let visitor = left.accept(visitor)?;
117117
right.accept(visitor)
118118
}
119+
Expr::AnyExpr { left, right, .. } => {
120+
let visitor = left.accept(visitor)?;
121+
right.accept(visitor)
122+
}
119123
Expr::Between {
120124
expr, low, high, ..
121125
} => {

datafusion/core/src/optimizer/common_subexpr_eliminate.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ impl ExprIdentifierVisitor<'_> {
423423
desc.push_str("BinaryExpr-");
424424
desc.push_str(&op.to_string());
425425
}
426+
Expr::AnyExpr { op, .. } => {
427+
desc.push_str("AnyExpr-");
428+
desc.push_str(&op.to_string());
429+
}
426430
Expr::Not(_) => {
427431
desc.push_str("Not-");
428432
}

datafusion/core/src/optimizer/simplify_expressions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ impl<'a> ConstEvaluator<'a> {
385385
Expr::TableUDF { .. } => false,
386386
Expr::Literal(_)
387387
| Expr::BinaryExpr { .. }
388+
| Expr::AnyExpr { .. }
388389
| Expr::Not(_)
389390
| Expr::IsNotNull(_)
390391
| Expr::IsNull(_)

0 commit comments

Comments
 (0)