cloud-fan commented on a change in pull request #21599: [SPARK-26218][SQL] 
Overflow on arithmetic operations returns incorrect result
URL: https://github.com/apache/spark/pull/21599#discussion_r309247142
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/types/DecimalSuite.scala
 ##########
 @@ -94,8 +94,8 @@ class DecimalSuite extends SparkFunSuite with 
PrivateMethodTester {
     checkValues(Decimal(2e18.toLong), 2e18, 2e18.toLong)
     checkValues(Decimal(Long.MaxValue), Long.MaxValue.toDouble, Long.MaxValue)
     checkValues(Decimal(Long.MinValue), Long.MinValue.toDouble, Long.MinValue)
-    checkValues(Decimal(Double.MaxValue), Double.MaxValue, 0L)
-    checkValues(Decimal(Double.MinValue), Double.MinValue, 0L)
+    assert(Decimal(Double.MaxValue).toDouble == Double.MaxValue)
+    assert(Decimal(Double.MinValue).toDouble == Double.MinValue)
 
 Review comment:
   Yes we know `Decimal.toLong` can return wrong result, and we are going to 
fix it by making cast follow SQL standard. Let's revert it and fix it in the 
cast PR.

----------------------------------------------------------------
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]

Reply via email to