srowen commented on a change in pull request #27151: [SPARK-26218][Follow up]
Fix the corner case when casting float to Integer.
URL: https://github.com/apache/spark/pull/27151#discussion_r364802553
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/numerics.scala
##########
@@ -121,8 +121,8 @@ object FloatExactNumeric extends FloatIsFractional {
private def overflowException(x: Float, dataType: String) =
throw new ArithmeticException(s"Casting $x to $dataType causes overflow")
- private val intUpperBound = Int.MaxValue.toFloat
- private val intLowerBound = Int.MinValue.toFloat
+ private val intUpperBound = Int.MaxValue
Review comment:
Hm, I'm also not clear how this helps - won't it just promote to a float in
the comparison below anyway?
Do we want floorDiv, etc, instead?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]