-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: pow() with integer base and negative float exponent returns error #19303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3987db6
6c13d5d
e737952
b0ee753
55c643f
74d1275
f63d153
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -696,8 +696,49 @@ query error DataFusion error: Arrow error: Compute error: Signed integer overflo | |
| select lcm(2, 9223372036854775803); | ||
|
|
||
|
|
||
| query error DataFusion error: Arrow error: Arithmetic overflow: Overflow happened on: 2107754225 \^ 1221660777 | ||
| ## pow/power | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've placed a TODO Tests in If you've covered this case, let's remove that TODO. |
||
|
|
||
| # pow() with integer base and negative float exponent (verifies type coercion) | ||
| query R | ||
| SELECT pow(2, -0.5) | ||
| ---- | ||
| 0.707106781187 | ||
|
|
||
| # pow() with negative integer base and negative float exponent (returns NaN) | ||
| query R | ||
| SELECT pow(-2, -0.5) | ||
| ---- | ||
| NaN | ||
|
|
||
| # pow() with zero base and negative exponent (returns Infinity) | ||
| query R | ||
| SELECT pow(0, -0.5) | ||
| ---- | ||
| Infinity | ||
|
|
||
| # pow() with integer base of 1 and negative exponent | ||
| query R | ||
| SELECT pow(1, -0.5) | ||
| ---- | ||
| 1 | ||
|
|
||
| # pow() with large integer base and small negative exponent | ||
| query R | ||
| SELECT pow(1000, -0.1) | ||
| ---- | ||
| 0.501187233627 | ||
|
|
||
| # pow() with integer base and negative integer exponent returns float (like PostgreSQL) | ||
| query R | ||
| SELECT pow(2, -2) | ||
| ---- | ||
| 0.25 | ||
|
|
||
| # power() with very large exponent returns infinity (Float64 behavior) | ||
| query R | ||
| select power(2107754225, 1221660777); | ||
| ---- | ||
| Infinity | ||
|
|
||
| # factorial overflow | ||
| query error DataFusion error: Arrow error: Compute error: Overflow happened on FACTORIAL\(350943270\) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, very useful unit test