Skip to content
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

feat: add arithmetic function "sqrt" and "factorial" with decimal type #674

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions extensions/functions_arithmetic_decimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ scalar_functions:
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
- name: "sqrt"
description: Square root of the value. Sqrt of 0 is 0 and sqrt of negative values will raise an error.
impls:
- args:
- name: x
value: "DECIMAL<P,S>"
return: fp64
- name: "factorial"
description: >
Return the factorial of a given decimal input. Scale should be 0 for factorial decimal input.
The factorial of 0! is 1 by convention. Negative inputs will raise an error.
Input which cause overflow of result will raise an error.
impls:
- args:
- name: "n"
value: "DECIMAL<P,0>"
return: "DECIMAL<38,0>"
aggregate_functions:
- name: "sum"
description: Sum a set of values.
Expand Down
Loading