Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support negate arithmetic expression in substrait #13112

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2159,7 +2159,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 @@ -2180,8 +2180,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 @@ -2210,7 +2211,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 @@ -1285,7 +1285,7 @@ pub fn to_substrait_rex(
),
Expr::Negative(arg) => to_substrait_unary_scalar_fn(
ctx,
"negative",
"negate",
arg,
schema,
col_ref_offset,
Expand Down