Skip to content

Commit c0d2de9

Browse files
committed
Address review comments
1 parent d6482f6 commit c0d2de9

File tree

3 files changed

+70
-11
lines changed

3 files changed

+70
-11
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
base_uri: >
2+
https://github.com/substrait-io/substrait/blob/main/extensions/substrait/extensions/functions_arithmetic_decimal.yaml
3+
function: bitwise_not
4+
cases:
5+
- group: basic
6+
description: Basic examples without any special cases
7+
tests:
8+
- (1|decimal<1, 0>): -2|decimal<1, 0>
9+
- (1|decimal<2, 0>): -2|decimal<2, 0>
10+
- (1|decimal<3, 0>): -2|decimal<3, 0>
11+
- (1|decimal<4, 0>): -2|decimal<4, 0>
12+
- (1|decimal<5, 0>): -2|decimal<5, 0>
13+
- (1|decimal<6, 0>): -2|decimal<6, 0>
14+
- (1|decimal<7, 0>): -2|decimal<7, 0>
15+
- (1|decimal<8, 0>): -2|decimal<8, 0>
16+
- (1|decimal<9, 0>): -2|decimal<9, 0>
17+
- (1|decimal<10, 0>): -2|decimal<10, 0>
18+
- (1|decimal<11, 0>): -2|decimal<11, 0>
19+
- (1|decimal<12, 0>): -2|decimal<12, 0>
20+
- (1|decimal<13, 0>): -2|decimal<13, 0>
21+
- (1|decimal<14, 0>): -2|decimal<14, 0>
22+
- (1|decimal<15, 0>): -2|decimal<15, 0>
23+
- (1|decimal<16, 0>): -2|decimal<16, 0>
24+
- (1|decimal<17, 0>): -2|decimal<17, 0>
25+
- (1|decimal<18, 0>): -2|decimal<18, 0>
26+
- (1|decimal<19, 0>): -2|decimal<19, 0>
27+
- (1|decimal<20, 0>): -2|decimal<20, 0>
28+
- (1|decimal<21, 0>): -2|decimal<21, 0>
29+
- (1|decimal<22, 0>): -2|decimal<22, 0>
30+
- (1|decimal<23, 0>): -2|decimal<23, 0>
31+
- (1|decimal<24, 0>): -2|decimal<24, 0>
32+
- (1|decimal<25, 0>): -2|decimal<25, 0>
33+
- (1|decimal<26, 0>): -2|decimal<26, 0>
34+
- (1|decimal<27, 0>): -2|decimal<27, 0>
35+
- (1|decimal<28, 0>): -2|decimal<28, 0>
36+
- (1|decimal<29, 0>): -2|decimal<29, 0>
37+
- (1|decimal<30, 0>): -2|decimal<30, 0>
38+
- (1|decimal<31, 0>): -2|decimal<31, 0>
39+
- (1|decimal<32, 0>): -2|decimal<32, 0>
40+
- (1|decimal<33, 0>): -2|decimal<33, 0>
41+
- (1|decimal<34, 0>): -2|decimal<34, 0>
42+
- (1|decimal<35, 0>): -2|decimal<35, 0>
43+
- (1|decimal<36, 0>): -2|decimal<36, 0>
44+
- (1|decimal<37, 0>): -2|decimal<37, 0>
45+
- (1|decimal<38, 0>): -2|decimal<38, 0>
46+
- (null|decimal<38, 0>): null|decimal<38, 0>

extensions/functions_arithmetic_decimal.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ scalar_functions:
149149
return: |-
150150
max_precision = max(P1, P2)
151151
DECIMAL<max_precision, 0>
152+
- name: "bitwise_not"
153+
description: >
154+
Return the bitwise NOT result for one decimal input.
155+
In inputs scale must be 0 (i.e. only integer types are allowed).
156+
Result precision will be equal to input precision.
157+
impls:
158+
- args:
159+
- name: x
160+
value: "DECIMAL<P,0>"
161+
return: "DECIMAL<P,0>"
152162
- name: "sqrt"
153163
description: Square root of the value. Sqrt of 0 is 0 and sqrt of negative values will raise an error.
154164
impls:
@@ -183,17 +193,6 @@ scalar_functions:
183193
values: [ NAN, ERROR ]
184194
return: fp64
185195

186-
- name: "bitwise_not"
187-
description: >
188-
Return the bitwise NOT result for one decimal input.
189-
In inputs scale must be 0 (i.e. only integer types are allowed).
190-
Result precision should be one more than input precision.
191-
Result exceeding precision limit will raise an error.
192-
impls:
193-
- args:
194-
- name: x
195-
value: "DECIMAL<P,0>"
196-
return: "DECIMAL<P+1,0>"
197196
aggregate_functions:
198197
- name: "sum"
199198
description: Sum a set of values.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%YAML 1.2
2+
---
3+
scalar_functions:
4+
- name: "bitwise_not"
5+
description: >
6+
Return the bitwise NOT result for one decimal input in which Precision is 1.
7+
Result precision will be equal to 2.
8+
impls:
9+
- args:
10+
- name: x
11+
value: "DECIMAL<1,0>"
12+
return: "DECIMAL<2,0>"
13+
14+

0 commit comments

Comments
 (0)