-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(expr): support pow function (#7789)
As per the title. Right now, both x and y are casted into Float64 when pow(x, y). By PG's standard, we also need to support Decimal but Decimal has no built-in pow and we may also change the underlying crate for Decimal. So we leave it aside for now. Urgently requested by user. #7725 Approved-By: st1page Approved-By: TennyZhuang
- Loading branch information
Showing
10 changed files
with
147 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
query R | ||
select pow(2.0, 3.0) | ||
---- | ||
8 | ||
|
||
query R | ||
select pow(2.0::decimal, 3.0::decimal) | ||
---- | ||
8 | ||
|
||
query R | ||
select pow(2.0::double, 3.0::double) | ||
---- | ||
8 | ||
|
||
query R | ||
select pow(2.0::smallint, 3.0::smallint) | ||
---- | ||
8 | ||
|
||
query R | ||
select pow(2.0::bigint, 3.0::bigint) | ||
---- | ||
8 | ||
|
||
query R | ||
select pow(2.0, -2); | ||
---- | ||
0.25 | ||
|
||
query R | ||
select pow(2.23, -2.33); | ||
---- | ||
0.15432975583772085 | ||
|
||
query R | ||
select pow(100000, 0); | ||
---- | ||
1 | ||
|
||
query R | ||
select pow(100000, -200000000000000); | ||
---- | ||
0 | ||
|
||
statement error QueryError: Expr error: Numeric out of range | ||
select pow(100000, 200000000000000); | ||
|
||
|
||
statement error QueryError: Expr error: Numeric out of range | ||
select pow(-100000, 200000000000001); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters