You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "sunchao (via GitHub)" <gi...@apache.org> on 2026/09/02 03:03:01 UTC
Re: [PR] feat: route `abs` on interval types through the codegen dispatcher [datafusion-comet]
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org