You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/17 07:25:19 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #35220: [SPARK-37922][SQL] Improve `SimplifyCasts` to remove useless cast
cloud-fan commented on a change in pull request #35220:
URL: https://github.com/apache/spark/pull/35220#discussion_r785694477
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -1037,6 +1037,9 @@ object SimplifyCasts extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan.transformAllExpressionsWithPruning(
_.containsPattern(CAST), ruleId) {
case Cast(e, dataType, _, _) if e.dataType == dataType => e
+ case c1 @ Cast(Cast(e, d2: DecimalType, _, _), d1: DecimalType, _, _)
+ if d1.isWiderThan(d2) && d2.isWiderThan(e.dataType) =>
Review comment:
can we generalize it? I think the general idea is we can combine to "upcast" into one.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org