cloud-fan 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_r364818872
##########
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
+ private val intLowerBound = Int.MinValue
private val longUpperBound = Long.MaxValue.toFloat
private val longLowerBound = Long.MinValue.toFloat
Review comment:
seems we can remove `toFloat` here too? also the `toDouble` in
`DoubleExactNumeric`. They will be promoted anyway.
----------------------------------------------------------------
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]