Skip to content

[SPARK-20246][SQL] Don't pushdown non-deterministic expression through Aggregate#17559

Closed
viirya wants to merge 1 commit intoapache:masterfrom
viirya:dont-pushdown-nondeter-expr-through-agg
Closed

[SPARK-20246][SQL] Don't pushdown non-deterministic expression through Aggregate#17559
viirya wants to merge 1 commit intoapache:masterfrom
viirya:dont-pushdown-nondeter-expr-through-agg

Conversation

@viirya
Copy link
Copy Markdown
Member

@viirya viirya commented Apr 7, 2017

What changes were proposed in this pull request?

We inadvertently push down non-deterministic expression through Aggregate like this:

import org.apache.spark.sql.functions._
val df = spark.range(1,1000).distinct.withColumn("random", rand()).filter(col("random") > 0.3).orderBy("random")

The optimized plan before this:

Sort [random#4 ASC NULLS FIRST], true
+- Aggregate [id#0L], [id#0L, rand(-3812200341668550973) AS random#4]
   +- Filter (rand(-3812200341668550973) > 0.3)
      +- Range (1, 1000, step=1, splits=Some(2))

The optimized plan after this:

Sort [random#4 ASC NULLS FIRST], true
+- Filter (random#4 > 0.3)
   +- Aggregate [id#0L], [id#0L, rand(-6229677203478213930) AS random#4]
      +- Range (1, 1000, step=1, splits=Some(2))

How was this patch tested?

Will add test later.

Please review http://spark.apache.org/contributing.html before opening a pull request.

@SparkQA
Copy link
Copy Markdown

SparkQA commented Apr 7, 2017

Test build #75592 has started for PR 17559 at commit 77896e9.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 7, 2017

retest this please.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 7, 2017

close this as there is a duplicate pr #17562.

@viirya viirya closed this Apr 7, 2017
@SparkQA
Copy link
Copy Markdown

SparkQA commented Apr 7, 2017

Test build #75595 has finished for PR 17559 at commit 77896e9.

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

@viirya viirya deleted the dont-pushdown-nondeter-expr-through-agg branch December 27, 2023 18:34
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.

2 participants