Skip to content

Commit

Permalink
Support negate expression in substrait (apache#13112)
Browse files Browse the repository at this point in the history
  • Loading branch information
LatrecheYasser authored Oct 29, 2024
1 parent d62f262 commit c03e260
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions datafusion/substrait/src/logical_plan/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2613,7 +2613,7 @@ impl BuiltinExprBuilder {
match name {
"not" | "like" | "ilike" | "is_null" | "is_not_null" | "is_true"
| "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
| "is_not_unknown" | "negative" => Some(Self {
| "is_not_unknown" | "negative" | "negate" => Some(Self {
expr_name: name.to_string(),
}),
_ => None,
Expand All @@ -2634,8 +2634,9 @@ impl BuiltinExprBuilder {
"ilike" => {
Self::build_like_expr(ctx, true, f, input_schema, extensions).await
}
"not" | "negative" | "is_null" | "is_not_null" | "is_true" | "is_false"
| "is_not_true" | "is_not_false" | "is_unknown" | "is_not_unknown" => {
"not" | "negative" | "negate" | "is_null" | "is_not_null" | "is_true"
| "is_false" | "is_not_true" | "is_not_false" | "is_unknown"
| "is_not_unknown" => {
Self::build_unary_expr(ctx, &self.expr_name, f, input_schema, extensions)
.await
}
Expand Down Expand Up @@ -2664,7 +2665,7 @@ impl BuiltinExprBuilder {

let expr = match fn_name {
"not" => Expr::Not(arg),
"negative" => Expr::Negative(arg),
"negative" | "negate" => Expr::Negative(arg),
"is_null" => Expr::IsNull(arg),
"is_not_null" => Expr::IsNotNull(arg),
"is_true" => Expr::IsTrue(arg),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/substrait/src/logical_plan/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ pub fn to_substrait_rex(
),
Expr::Negative(arg) => to_substrait_unary_scalar_fn(
ctx,
"negative",
"negate",
arg,
schema,
col_ref_offset,
Expand Down

0 comments on commit c03e260

Please sign in to comment.