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

fix: Comet should not translate try_sum to native sum expression #277

Merged
merged 4 commits into from
Apr 17, 2024

Conversation

viirya
Copy link
Member

@viirya viirya commented Apr 16, 2024

Which issue does this PR close?

Closes #276.

Rationale for this change

What changes are included in this PR?

How are these changes tested?

@viirya
Copy link
Member Author

viirya commented Apr 16, 2024

cc @huaxingao @sunchao @andygrove

case s @ Sum(child, _) if sumDataTypeSupported(s.dataType) =>
case s @ Sum(child, evalMode)
if sumDataTypeSupported(s.dataType) &&
evalMode == EvalMode.LEGACY =>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is introduced in Spark 3.4. So Spark 3.2/3.3 builds are failed due to this change. I need to add a shim layer...

Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except one minor comment.

@@ -202,7 +202,7 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde {
inputs: Seq[Attribute],
binding: Boolean): Option[AggExpr] = {
aggExpr.aggregateFunction match {
case s @ Sum(child, _) if sumDataTypeSupported(s.dataType) =>
case s @ Sum(child, _) if sumDataTypeSupported(s.dataType) && isLegacyMode(s) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR.
But maybe we should add try_sum and try_xxx aggregation function support in the native side too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we should do it. We probably need to implement native try_sum expression because DataFusion might not have it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, so I just went ahead and create an issue to track this one: #280.

….scala

Co-authored-by: advancedxy <xianjin@apache.org>
Copy link
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix!

@huaxingao
Copy link
Contributor

There are some format issues that need to be fixed.

@viirya
Copy link
Member Author

viirya commented Apr 17, 2024

I'd need one committer approval to merge this. 🙂

@viirya
Copy link
Member Author

viirya commented Apr 17, 2024

Thank you @sunchao 😄

@viirya viirya merged commit 9321be6 into apache:main Apr 17, 2024
28 checks passed
@viirya
Copy link
Member Author

viirya commented Apr 17, 2024

Merged. Thanks @huaxingao @sunchao @advancedxy

@viirya viirya deleted the fix_try_sum branch April 17, 2024 19:24
himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
…che#277)

* fix: Comet should not translate try_sum to native sum expression

* For Spark 3.2 and 3.3

* Update spark/src/main/scala/org/apache/comet/shims/ShimQueryPlanSerde.scala

Co-authored-by: advancedxy <xianjin@apache.org>

* Fix format

---------

Co-authored-by: advancedxy <xianjin@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comet should not translate try_sum to native sum expression
4 participants