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 not with decimal arguments #676

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
46 changes: 46 additions & 0 deletions cases_new/arithmetic_decimal/bitwise_not.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
base_uri: >
https://github.com/substrait-io/substrait/blob/main/extensions/substrait/extensions/functions_arithmetic_decimal.yaml
function: bitwise_not
cases:
- group: basic
description: Basic examples without any special cases
tests:
- (1|decimal<1, 0>): -2|decimal<1, 0>
- (1|decimal<2, 0>): -2|decimal<2, 0>
- (1|decimal<3, 0>): -2|decimal<3, 0>
- (1|decimal<4, 0>): -2|decimal<4, 0>
- (1|decimal<5, 0>): -2|decimal<5, 0>
- (1|decimal<6, 0>): -2|decimal<6, 0>
- (1|decimal<7, 0>): -2|decimal<7, 0>
- (1|decimal<8, 0>): -2|decimal<8, 0>
- (1|decimal<9, 0>): -2|decimal<9, 0>
- (1|decimal<10, 0>): -2|decimal<10, 0>
- (1|decimal<11, 0>): -2|decimal<11, 0>
- (1|decimal<12, 0>): -2|decimal<12, 0>
- (1|decimal<13, 0>): -2|decimal<13, 0>
- (1|decimal<14, 0>): -2|decimal<14, 0>
- (1|decimal<15, 0>): -2|decimal<15, 0>
- (1|decimal<16, 0>): -2|decimal<16, 0>
- (1|decimal<17, 0>): -2|decimal<17, 0>
- (1|decimal<18, 0>): -2|decimal<18, 0>
- (1|decimal<19, 0>): -2|decimal<19, 0>
- (1|decimal<20, 0>): -2|decimal<20, 0>
- (1|decimal<21, 0>): -2|decimal<21, 0>
- (1|decimal<22, 0>): -2|decimal<22, 0>
- (1|decimal<23, 0>): -2|decimal<23, 0>
- (1|decimal<24, 0>): -2|decimal<24, 0>
- (1|decimal<25, 0>): -2|decimal<25, 0>
- (1|decimal<26, 0>): -2|decimal<26, 0>
- (1|decimal<27, 0>): -2|decimal<27, 0>
- (1|decimal<28, 0>): -2|decimal<28, 0>
- (1|decimal<29, 0>): -2|decimal<29, 0>
- (1|decimal<30, 0>): -2|decimal<30, 0>
- (1|decimal<31, 0>): -2|decimal<31, 0>
- (1|decimal<32, 0>): -2|decimal<32, 0>
- (1|decimal<33, 0>): -2|decimal<33, 0>
- (1|decimal<34, 0>): -2|decimal<34, 0>
- (1|decimal<35, 0>): -2|decimal<35, 0>
- (1|decimal<36, 0>): -2|decimal<36, 0>
- (1|decimal<37, 0>): -2|decimal<37, 0>
- (1|decimal<38, 0>): -2|decimal<38, 0>
- (null|decimal<38, 0>): null|decimal<38, 0>
10 changes: 10 additions & 0 deletions extensions/functions_arithmetic_decimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ scalar_functions:
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
- name: "bitwise_not"
description: >
Return the bitwise NOT result for one decimal input.
In inputs scale must be 0 (i.e. only integer types are allowed).
Result precision will be equal to input precision.
impls:
- args:
- name: x
value: "DECIMAL<P,0>"
return: "DECIMAL<P,0>"
- name: "sqrt"
description: Square root of the value. Sqrt of 0 is 0 and sqrt of negative values will raise an error.
impls:
Expand Down
12 changes: 12 additions & 0 deletions extensions/functions_snowflake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
%YAML 1.2
---
scalar_functions:
- name: "bitwise_not"
description: >
Return the bitwise NOT result for one decimal input in which Precision is 1.
Result precision will be equal to 2.
impls:
- args:
- name: x
value: "DECIMAL<1,0>"
return: "DECIMAL<2,0>"
Loading