yikf opened a new pull request #34916: URL: https://github.com/apache/spark/pull/34916
### What changes were proposed in this pull request? Currently, Some scenes retain the combination of GlobalLimitExec - LocalLimitExec, which can actually be optimized to CollectLimitExec, like: `INSERT INTO t2 SELECT c1 FROM t1 LIMIT 1` The PR aims to 2 points: - Improve `INSERT INTO t2 SELECT c1 FROM t1 LIMIT 1` to `CollectLimitExec` - Add a flag that identifies `CollectLimitExec` without shuffle and scan all data. Example: > CREATE TABLE t1(id STRING) USING parquet CREATE TABLE t2(id STRING) USING parquet INSERT INTO t1 SELECT * FROM t2 LIMIT 5 Before:  After: <img width="669" alt="After PR" src="https://user-images.githubusercontent.com/51110188/146298706-78ef867d-8342-4340-8ad5-7a648c597e50.png"> ### Why are the changes needed? Optimize logic ### Does this PR introduce _any_ user-facing change? No, optimize only ### How was this patch tested? Unit Test and manually 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]
