You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "jayzhan211 (via GitHub)" <gi...@apache.org> on 2024/06/08 01:13:04 UTC
[PR] Remove builtin Sum [datafusion]
jayzhan211 opened a new pull request, #10831:
URL: https://github.com/apache/datafusion/pull/10831
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Part of #10731 .
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Since we need stub fo test in datafusion::expr, so I move it to `expr` crate
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#discussion_r1632033601
##########
datafusion/sql/Cargo.toml:
##########
@@ -54,6 +54,7 @@ strum = { version = "0.26.1", features = ["derive"] }
[dev-dependencies]
ctor = { workspace = true }
datafusion-functions = { workspace = true, default-features = true }
+datafusion-functions-aggregate = { workspace = true }
Review Comment:
I think this is ok.
We have had bad experiences in the past with making semi-circular dependencies for tests (as I recall it messes up the release process to crates.io. THough maybe this one is ok, because datafusion-functions-aggregate doesn't depend on datafusion-sql either directly or transitively
If we are going to go with this approach, perhaps we could remove the stubs added in https://github.com/apache/datafusion/pull/10816 🤔
##########
datafusion/sql/src/unparser/expr.rs:
##########
@@ -1124,19 +1125,7 @@ mod tests {
Expr::Literal(ScalarValue::Date32(Some(-1))),
r#"CAST('1969-12-31' AS DATE)"#,
),
- (
- Expr::AggregateFunction(AggregateFunction {
- func_def: AggregateFunctionDefinition::BuiltIn(
- datafusion_expr::AggregateFunction::Sum,
- ),
- args: vec![col("a")],
- distinct: false,
- filter: None,
- order_by: None,
- null_treatment: None,
- }),
- r#"SUM(a)"#,
- ),
+ (sum(col("a")), r#"sum(a)"#),
Review Comment:
😍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove builtin Sum [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#discussion_r1631922668
##########
datafusion/expr/src/type_coercion/aggregates.rs:
##########
@@ -621,17 +592,6 @@ mod tests {
assert_eq!(*input_type, result.unwrap());
}
}
- // test sum
Review Comment:
I think we don't need coercion test, because they are handled in slt query already.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove builtin Sum [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#discussion_r1631923230
##########
datafusion/substrait/Cargo.toml:
##########
@@ -43,6 +43,7 @@ prost = "0.12"
substrait = { version = "0.34.0", features = ["serde"] }
[dev-dependencies]
+datafusion-functions-aggregate = { workspace = true }
Review Comment:
imported for test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove builtin Sum [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#discussion_r1631923006
##########
datafusion/sql/Cargo.toml:
##########
@@ -54,6 +54,7 @@ strum = { version = "0.26.1", features = ["derive"] }
[dev-dependencies]
ctor = { workspace = true }
datafusion-functions = { workspace = true, default-features = true }
+datafusion-functions-aggregate = { workspace = true }
Review Comment:
imported for test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#issuecomment-2156032850
> If we are going to go with this approach, perhaps we could remove the stubs added in https://github.com/apache/datafusion/pull/10816 🤔
It is nice if we don't need stubs 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#issuecomment-2156053741
It seems I cant remove stub for test in `datafusion/expr/src/utils.rs` because we can't import datafusion-aggregate in dev-dependency. We should move the test to other crate before removing stub.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#issuecomment-2156043495
I found it is not too trivial and need review, so I will merge this one first and file another PR for removing stubs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #10831:
URL: https://github.com/apache/datafusion/pull/10831#issuecomment-2156043600
Thanks @alamb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Remove Built-in sum and Rename to lowercase `sum` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 merged PR #10831:
URL: https://github.com/apache/datafusion/pull/10831
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org