rdtr commented on code in PR #13170:
URL: https://github.com/apache/gluten/pull/13170#discussion_r4212250035


##########
backends-velox/src/test/scala/org/apache/gluten/functions/ArithmeticAnsiValidateSuite.scala:
##########
@@ -93,4 +93,137 @@ class ArithmeticAnsiValidateSuite extends 
FunctionsValidateSuite {
     }
   }
 
+  test("decimal add overflow") {
+    // Normal decimal add should succeed and match Spark results
+    runQueryAndCompare(
+      "SELECT CAST(1.0 AS DECIMAL(10,2)) + CAST(2.0 AS DECIMAL(10,2))") {
+      checkGlutenPlan[ProjectExecTransformer]
+    }
+
+    // Overflow: max DECIMAL(38,0) + 1 should throw in ANSI mode
+    if (isSparkVersionGE("4.0")) {

Review Comment:
   Thanks for the review! Addressed now. All the `isSparkVersionGE("4.0")` 
checks in this suite are replaced by one helper, `checkOverflow`, which runs 
each overflow case with `withSQLConf`:
   
   - ANSI on: the query throws, and the message is Velox's error (for example 
"Decimal overflow in add"), so we know it ran in Velox.
   - ANSI off: the result matches Spark (NULL for decimals, a wrapped value for 
integers), and the plan has `ProjectExecTransformer`.
   
   I also fixed the existing `multiply` test, which checked `2147483647 + 1` 
instead of a multiplication. I ran the suite on Spark 3.5 and 4.1.
   



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