wangyum opened a new pull request #35287:
URL: https://github.com/apache/spark/pull/35287
### What changes were proposed in this pull request?
This pr add a new logical plan(`PartialDistinct`) to support partially
deduplicate input rows and use it push down limit through Aggregate if it is
group only.
For example:
```scala
spark.range(10000L).write.saveAsTable("t1")
spark.sql("SELECT DISTINCT * FROM t1 LIMIT 5").explain(true)
```
Before this pr:
```
== Optimized Logical Plan ==
GlobalLimit 5
+- LocalLimit 5
+- Aggregate [id#3L], [id#3L]
+- Relation default.t1[id#3L] parquet
```
After this pr:
```
== Optimized Logical Plan ==
GlobalLimit 5
+- LocalLimit 5
+- PartialDistinct
+- Relation default.t1[id#3L] parquet
```
### Why are the changes needed?
Improve query performance.
### 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]