kumarUjjawal commented on code in PR #22277:
URL: https://github.com/apache/datafusion/pull/22277#discussion_r3256507947
##########
datafusion/sqllogictest/test_files/math.slt:
##########
Review Comment:
We should also add tests for decimal like:
```
# integer base path (Decimal+Int64 → pow_decimal_int → pow_decimal_float
fallback)
query error DataFusion error: Arrow error: Compute error: zero raised to a
negative power is undefined
SELECT pow(0::bigint, -2::bigint)
# decimal base path (compute_pow_f64_result)
query error DataFusion error: Arrow error: Compute error: zero raised to a
negative power is undefined
SELECT pow(0.0::decimal(10,2), -1.0)
# array-exponent decimal path (pow_decimal_with_float_fallback)
query error DataFusion error: Arrow error: Compute error: zero raised to a
negative power is undefined
SELECT power(base, exp) FROM (VALUES (0.0::decimal(10,2), -1.0::float8))
t(base, exp)
```
##########
datafusion/functions/src/math/power.rs:
##########
@@ -657,5 +668,18 @@ mod tests {
// Test non-finite exponent returns error
assert!(pow_decimal_float(100i128, 2, f64::NAN).is_err());
assert!(pow_decimal_float(100i128, 2, f64::INFINITY).is_err());
+
+ // PostgreSQL: zero to a negative power is undefined
+ assert!(pow_decimal_float(0i128, 2, -1.0).is_err());
+ }
+
+ #[test]
Review Comment:
I think we should also cover the i256 specialization
--
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]