wangyum opened a new pull request #35220:
URL: https://github.com/apache/spark/pull/35220
### What changes were proposed in this pull request?
This pr improve `SimplifyCasts` to remove useless cast. For example:
```scala
spark.sql("CREATE TABLE t1 (id int) using parquet")
spark.sql("SELECT CAST(CAST(id AS DECIMAL(10, 0)) AS DECIMAL(12, 2)) FROM
t1").explain(true)
```
Before this pr:
```
== Optimized Logical Plan ==
Project [cast(cast(id#1 as decimal(10,0)) as decimal(12,2)) AS casted#0]
+- Relation default.t1[id#1] parquet
```
After this pr:
```
== Optimized Logical Plan ==
Project [cast(id#1 as decimal(12,2)) AS casted#0]
+- Relation default.t1[id#1] 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]