andygrove commented on code in PR #2472:
URL: https://github.com/apache/datafusion-comet/pull/2472#discussion_r2404681581


##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -322,11 +322,16 @@ class CometCastSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
     castTest(generateInts(), DataTypes.DoubleType)
   }
 
-  ignore("cast IntegerType to DecimalType(10,2)") {
-    // Comet should have failed with [NUMERIC_VALUE_OUT_OF_RANGE] -1117686336 
cannot be represented as Decimal(10, 2)
+  test("cast IntegerType to DecimalType(10,2)") {
     castTest(generateInts(), DataTypes.createDecimalType(10, 2))
   }
 
+  test("cast IntegerType to DecimalType(10,2) overflow check") {
+    val intToDecimal10OverflowValues =
+      Seq(Int.MinValue, -100000000, -100000001, 100000000, 100000001, 
Int.MaxValue).toDF("a")
+    castTest(intToDecimal10OverflowValues, DataTypes.createDecimalType(10, 2))
+  }

Review Comment:
   This test does not test all of the native implementation code. For example, 
it did not test the case where the `checked_mul` returned `None`. I suggest 
testing with other precisions and scales, including `DecimalType.MAX_PRECISION` 
and `DecimalType.MAX_SCALE`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to