wangyum opened a new pull request #33946:
URL: https://github.com/apache/spark/pull/33946
### What changes were proposed in this pull request?
This pr removes the `Sort` if it is the child of `RepartitionByExpression`.
For example:
```sql
spark.range(10).selectExpr("cast(id AS
string)").sort("id").repartition($"id").explain()
```
Before this PR:
```
== Optimized Logical Plan ==
RepartitionByExpression [id#2]
+- Sort [id#2 ASC NULLS FIRST], true
+- Project [cast(id#0L as string) AS id#2]
+- Range (0, 10, step=1, splits=Some(2))
```
After this PR:
```
== Optimized Logical Plan ==
RepartitionByExpression [id#2]
+- Project [cast(id#0L as string) AS id#2]
+- Range (0, 10, step=1, splits=Some(2))
```
### Why are the changes needed?
Remove useless sort.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Unit 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]