zml1206 opened a new pull request, #43144: URL: https://github.com/apache/spark/pull/43144
### What changes were proposed in this pull request? This PR add a new optimizer rule `OptimizeWindowPartitions`, it remove window partition if partition expressions are foldable. Sql1: `select row_number() over(oder by a) b from t ` Sql2: `select row_number() over(partition by 1 oder by a) b from t ` After this PR, the `optimizedPlan` for sql1 and sql2 is the same. ### Why are the changes needed? Foldable partition is redundant, remove it not only can simplify plan, but some rules can also take effect when the partitions are all foldable, such as `InferWindowGroupLimit`. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? UT ### Was this patch authored or co-authored using generative AI tooling? No -- 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]
