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-39915][SQL][3.3] Dataset.repartition(N) may not create N partitions Non-AQE part #37730

Closed
wants to merge 1 commit into from

Conversation

ulysses-you
Copy link
Contributor

@ulysses-you ulysses-you commented Aug 30, 2022

What changes were proposed in this pull request?

backport #37706 for branch-3.3

Skip optimize the root user-specified repartition in PropagateEmptyRelation.

Why are the changes needed?

Spark should preserve the final repatition which can affect the final output partition which is user-specified.

For example:

spark.sql("select * from values(1) where 1 < rand()").repartition(1)

// before:
== Optimized Logical Plan ==
LocalTableScan <empty>, [col1#0]

// after:
== Optimized Logical Plan ==
Repartition 1, true
+- LocalRelation <empty>, [col1#0]

Does this PR introduce any user-facing change?

yes, the empty plan may change

How was this patch tested?

add test

… Non-AQE part

Skip optimize the root user-specified repartition in `PropagateEmptyRelation`.

Spark should preserve the final repatition which can affect the final output partition which is user-specified.

For example:

```scala
spark.sql("select * from values(1) where 1 < rand()").repartition(1)

// before:
== Optimized Logical Plan ==
LocalTableScan <empty>, [col1#0]

// after:
== Optimized Logical Plan ==
Repartition 1, true
+- LocalRelation <empty>, [col1#0]
```

yes, the empty plan may change

add test

Closes apache#37706 from ulysses-you/empty.

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@ulysses-you
Copy link
Contributor Author

cc @cloud-fan

@github-actions github-actions bot added the SQL label Aug 30, 2022
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. Merged to branch-3.3.
Thank you, @ulysses-you and @cloud-fan .

dongjoon-hyun pushed a commit that referenced this pull request Sep 9, 2022
…tions Non-AQE part

### What changes were proposed in this pull request?

backport #37706 for branch-3.3

Skip optimize the root user-specified repartition in `PropagateEmptyRelation`.

### Why are the changes needed?

Spark should preserve the final repatition which can affect the final output partition which is user-specified.

For example:

```scala
spark.sql("select * from values(1) where 1 < rand()").repartition(1)

// before:
== Optimized Logical Plan ==
LocalTableScan <empty>, [col1#0]

// after:
== Optimized Logical Plan ==
Repartition 1, true
+- LocalRelation <empty>, [col1#0]
```

### Does this PR introduce _any_ user-facing change?

yes, the empty plan may change

### How was this patch tested?

add test

Closes #37730 from ulysses-you/empty-3.3.

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@ulysses-you
Copy link
Contributor Author

thank you @dongjoon-hyun

@ulysses-you ulysses-you deleted the empty-3.3 branch September 13, 2022 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants