sunchao commented on code in PR #5622:
URL: https://github.com/apache/datafusion-comet/pull/5622#discussion_r3910332373


##########
spark/src/test/resources/sql-tests/expressions/math/abs_ansi.sql:
##########
@@ -104,3 +104,8 @@ SELECT abs(v) FROM ansi_test_abs_byte
 -- literal
 query expect_error(overflow)
 SELECT abs(cast(-128 as tinyint))
+
+-- overflow: abs on Long.MinValue microseconds throws; the dispatched codegen 
path must
+-- propagate Spark's exception
+query expect_error(overflow)
+SELECT abs(make_dt_interval(-2147483648))

Review Comment:
   [P2] Reach abs with a representable minimum interval
   
   Could this construct `Long.MinValue` microseconds before calling `abs`? The 
first argument to `make_dt_interval` is days. `make_dt_interval(-2147483648)` 
overflows while multiplying days by microseconds per day, so evaluation never 
reaches `Abs`'s exact-negation check. This leaves the new path's minimum-value 
behavior untested. `make_dt_interval(-106751991, -4, 0, -54.775808)` constructs 
the actual minimum without overflowing its intermediate calculations. Please 
also cover `make_ym_interval(0, -2147483648)`, with ANSI both enabled and 
disabled, since interval `abs` checks overflow in both modes. Pair these error 
cases with a valid nearby interval query that requires Comet execution. The 
`expect_error` helper alone does not assert that the dispatcher ran.



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