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

[SPARK-29343][SQL][FOLLOW-UP] Remove floating-point Sum/Average/CentralMomentAgg from order-insensitive aggregates #26534

Closed
wants to merge 4 commits into from

Conversation

maropu
Copy link
Member

@maropu maropu commented Nov 15, 2019

What changes were proposed in this pull request?

This pr is to remove floating-point Sum/Average/CentralMomentAgg from order-insensitive aggregates in EliminateSorts.

This pr comes from the @gatorsmile suggestion: #26011 (comment)

Why are the changes needed?

Bug fix.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added tests in SubquerySuite.

@maropu
Copy link
Member Author

maropu commented Nov 15, 2019

@cloud-fan @WangGuangxin

@SparkQA
Copy link

SparkQA commented Nov 15, 2019

Test build #113828 has finished for PR 26534 at commit 09406e2.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM (Pending Jenkins.)
The previous failure might occur again due to the recent Python change.

cc @HyukjinKwon

@SparkQA
Copy link

SparkQA commented Nov 15, 2019

Test build #113836 has finished for PR 26534 at commit a44f218.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Nov 15, 2019

Test build #113858 has finished for PR 26534 at commit a44f218.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Nov 15, 2019

Test build #113873 has finished for PR 26534 at commit a44f218.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29343][SQL][FOLLOW-UP] Remove AVG from order-insensitive aggregates in EliminateSorts [SPARK-29343][SQL][FOLLOW-UP] Remove floating-point Sum/Average/CentralMomentAgg from order-insensitive aggregates Nov 15, 2019
case _: Average => true
case _: CentralMomentAgg => true
// Arithmetic operations for floating-point values are order-sensitive
// (they are not associative).
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for adding more description.

Seq("float", "double").foreach { typeName =>
Seq("SUM", "AVG", "KURTOSIS", "SKEWNESS", "STDDEV_POP", "STDDEV_SAMP",
"VAR_POP", "VAR_SAMP").foreach { aggName =>
val query1 =
Copy link
Member

Choose a reason for hiding this comment

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

nit. query1 -> query since we remove the other test query.

Copy link
Member

Choose a reason for hiding this comment

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

@maropu , you can ignore this renaming comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, right.

@@ -1002,12 +1002,13 @@ object EliminateSorts extends Rule[LogicalPlan] {

private def isOrderIrrelevantAggs(aggs: Seq[NamedExpression]): Boolean = {
def isOrderIrrelevantAggFunction(func: AggregateFunction): Boolean = func match {
case _: Sum => true
case _: Min => true
case _: Max => true
case _: Count => true
Copy link
Member

Choose a reason for hiding this comment

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

You can collapse these cases too while you're here, but not necessary

@SparkQA
Copy link

SparkQA commented Nov 15, 2019

Test build #113882 has finished for PR 26534 at commit a1815ba.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 16, 2019

Test build #113897 has finished for PR 26534 at commit ebec317.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM, again. Thank you all!
Merged to master.

@maropu
Copy link
Member Author

maropu commented Nov 16, 2019

Thanks as always, @dongjoon-hyun !

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

LGTM too. Thanks for cc'ing me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants