Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anshuldata committed Aug 12, 2024
1 parent d6482f6 commit 048875e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 11 deletions.
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>
21 changes: 10 additions & 11 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 Expand Up @@ -183,17 +193,6 @@ scalar_functions:
values: [ NAN, ERROR ]
return: fp64

- 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 should be one more than input precision.
Result exceeding precision limit will raise an error.
impls:
- args:
- name: x
value: "DECIMAL<P,0>"
return: "DECIMAL<P+1,0>"
aggregate_functions:
- name: "sum"
description: Sum a set of values.
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>"

0 comments on commit 048875e

Please sign in to comment.