mgaido91 commented on a change in pull request #25137: [SPARK-28348][SQL] Decimal precision promotion for binary arithmetic with casted decimal type URL: https://github.com/apache/spark/pull/25137#discussion_r303196449
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala ########## @@ -1051,6 +1052,17 @@ object TypeCoercion { } } } + + /** + * Replace CheckOverflow's dataType with Cast's dataType. + */ + object CastAfterCheckOverflow extends TypeCoercionRule { + override protected def coerceTypes( + plan: LogicalPlan): LogicalPlan = plan resolveExpressions { + case c @ Cast(m @ CheckOverflow(_, _: DecimalType, _), resultDecimalType: DecimalType, _) => + c.copy(child = m.copy(dataType = resultDecimalType)) Review comment: shouldn't this be `m.copy(dataType = resultDecimalType)`? why are you keeping the `Cast`? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org