Skip to content

Commit c03e260

Browse files
Support negate expression in substrait (#13112)
1 parent d62f262 commit c03e260

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

datafusion/substrait/src/logical_plan/consumer.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,7 +2613,7 @@ impl BuiltinExprBuilder {
26132613
match name {
26142614
"not" | "like" | "ilike" | "is_null" | "is_not_null" | "is_true"
26152615
| "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
2616-
| "is_not_unknown" | "negative" => Some(Self {
2616+
| "is_not_unknown" | "negative" | "negate" => Some(Self {
26172617
expr_name: name.to_string(),
26182618
}),
26192619
_ => None,
@@ -2634,8 +2634,9 @@ impl BuiltinExprBuilder {
26342634
"ilike" => {
26352635
Self::build_like_expr(ctx, true, f, input_schema, extensions).await
26362636
}
2637-
"not" | "negative" | "is_null" | "is_not_null" | "is_true" | "is_false"
2638-
| "is_not_true" | "is_not_false" | "is_unknown" | "is_not_unknown" => {
2637+
"not" | "negative" | "negate" | "is_null" | "is_not_null" | "is_true"
2638+
| "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
2639+
| "is_not_unknown" => {
26392640
Self::build_unary_expr(ctx, &self.expr_name, f, input_schema, extensions)
26402641
.await
26412642
}
@@ -2664,7 +2665,7 @@ impl BuiltinExprBuilder {
26642665

26652666
let expr = match fn_name {
26662667
"not" => Expr::Not(arg),
2667-
"negative" => Expr::Negative(arg),
2668+
"negative" | "negate" => Expr::Negative(arg),
26682669
"is_null" => Expr::IsNull(arg),
26692670
"is_not_null" => Expr::IsNotNull(arg),
26702671
"is_true" => Expr::IsTrue(arg),

datafusion/substrait/src/logical_plan/producer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ pub fn to_substrait_rex(
13441344
),
13451345
Expr::Negative(arg) => to_substrait_unary_scalar_fn(
13461346
ctx,
1347-
"negative",
1347+
"negate",
13481348
arg,
13491349
schema,
13501350
col_ref_offset,

0 commit comments

Comments
 (0)