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 for bitwise(AND/OR/XOR) operation with decimal arguments #675

Merged
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
42 changes: 40 additions & 2 deletions extensions/functions_arithmetic_decimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,53 @@ scalar_functions:
scale_after_borrow = max(init_scale - delta, min_scale)
scale = init_prec > 38 ? scale_after_borrow : init_scale
DECIMAL<prec, scale>
-
-
name: "abs"
description: Calculate the absolute value of the argument.
impls:
- args:
- name: x
value: decimal<P,S>
return: decimal<P,S>

- name: "bitwise_and"
description: >
Return the bitwise AND result for two decimal inputs.
In inputs scale must be 0 (i.e. only integer types are allowed)
impls:
- args:
- name: x
value: "DECIMAL<P1,0>"
- name: y
value: "DECIMAL<P2,0>"
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
- name: "bitwise_or"
description: >
Return the bitwise OR result for two given decimal inputs.
In inputs scale must be 0 (i.e. only integer types are allowed)
impls:
- args:
- name: x
value: "DECIMAL<P1,0>"
- name: y
value: "DECIMAL<P2,0>"
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
- name: "bitwise_xor"
description: >
Return the bitwise XOR result for two given decimal inputs.
In inputs scale must be 0 (i.e. only integer types are allowed)
impls:
- args:
- name: x
value: "DECIMAL<P1,0>"
- name: y
value: "DECIMAL<P2,0>"
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
aggregate_functions:
- name: "sum"
description: Sum a set of values.
Expand Down
Loading