Skip to content

Commit

Permalink
Add test cases for bitwise and/or/xor for decimal type (#94)
Browse files Browse the repository at this point in the history
* Add test cases for bitwise and/or/xor for decimal type

* Address review comments
  • Loading branch information
anshuldata authored Aug 23, 2024
1 parent 90241dc commit 136a324
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 0 deletions.
121 changes: 121 additions & 0 deletions cases/arithmetic_decimal/bitwise_and.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
base_uri: https://github.com/substrait-io/substrait/blob/main/extensions/substrait/extensions/functions_arithmetic_decimal.yaml
function: bitwise_and
cases:
- group:
id: basic
description: Basic examples without any special cases
args:
- value: 0
type: decimal<1, 0>
- value: 1
type: decimal<1, 0>
result:
value: 0
type: decimal<1, 0>
- group: basic
args:
- value: 127
type: decimal<3, 0>
- value: 127
type: decimal<3, 0>
result:
value: 127
type: decimal<3, 0>
- group: basic
args:
- value: -127
type: decimal<3, 0>
- value: -10
type: decimal<2, 0>
result:
value: -128
type: decimal<3, 0>
- group: basic
args:
- value: 31766
type: decimal<5, 0>
- value: 900
type: decimal<3, 0>
result:
value: 4
type: decimal<5, 0>
- group: basic
args:
- value: -31766
type: decimal<5, 0>
- value: 900
type: decimal<3, 0>
result:
value: 896
type: decimal<5, 0>
- group: basic
args:
- value: 2147483647
type: decimal<10, 0>
- value: 1234567
type: decimal<7, 0>
result:
value: 1234567
type: decimal<10, 0>
- group: basic
args:
- value: -2147483647
type: decimal<10, 0>
- value: 1234567
type: decimal<7, 0>
result:
value: 1
type: decimal<10, 0>
- group: basic
args:
- value: 9223372036854775807
type: decimal<19, 0>
- value: 127
type: decimal<3, 0>
result:
value: 127
type: decimal<19, 0>
- group: basic
args:
- value: -9223372036854775807
type: decimal<19, 0>
- value: 127
type: decimal<3, 0>
result:
value: 1
type: decimal<19, 0>
- group:
id: max_values
description: test with max values
args:
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
result:
value: 99999999999999999999999999999999999999
type: decimal<38, 0>
- group: max_values
args:
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
# 38 0s
- value: 00000000000000000000000000000000000000
type: decimal<38, 0>
result:
value: 0
type: decimal<38, 0>
- group: max_values
args:
# negative 38 9s
- value: -99999999999999999999999999999999999999
type: decimal<38, 0>
# negative 38 9s
- value: -99999999999999999999999999999999999999
type: decimal<38, 0>
result:
value: -99999999999999999999999999999999999999
type: decimal<38, 0>
143 changes: 143 additions & 0 deletions cases/arithmetic_decimal/bitwise_or.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
base_uri: https://github.com/substrait-io/substrait/blob/main/extensions/substrait/extensions/functions_arithmetic_decimal.yaml
function: bitwise_or
cases:
- group:
id: basic
description: Basic examples without any special cases
args:
- value: 0
type: decimal<1, 0>
- value: 1
type: decimal<1, 0>
result:
value: 1
type: decimal<1, 0>
- group: basic
args:
- value: 127
type: decimal<3, 0>
- value: 127
type: decimal<3, 0>
result:
value: 127
type: decimal<3, 0>
- group: basic
args:
- value: -127
type: decimal<3, 0>
- value: -10
type: decimal<2, 0>
result:
value: -9
type: decimal<3, 0>
- group: basic
args:
- value: 31766
type: decimal<5, 0>
- value: 900
type: decimal<3, 0>
result:
value: 32662
type: decimal<5, 0>
- group: basic
args:
- value: -31766
type: decimal<5, 0>
- value: 900
type: decimal<3, 0>
result:
value: -31762
type: decimal<5, 0>
- group: basic
args:
- value: 2147483647
type: decimal<10, 0>
- value: 123456789
type: decimal<9, 0>
result:
value: 2147483647
type: decimal<10, 0>
- group: basic
args:
- value: -2147483647
type: decimal<10, 0>
- value: 123456789
type: decimal<9, 0>
result:
value: -2024026859
type: decimal<10, 0>
- group: basic
args:
- value: 9223372036854775807
type: decimal<19, 0>
- value: 127
type: decimal<3, 0>
result:
value: 9223372036854775807
type: decimal<10, 0>
- group: basic
args:
- value: -9223372036854775807
type: decimal<19, 0>
- value: 127
type: decimal<3, 0>
result:
value: -9223372036854775681
type: decimal<19, 0>
- group:
id: max_values
description: test with max values
args:
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
result:
value: 99999999999999999999999999999999999999
type: decimal<38, 0>
- group: max_values
args:
# 38 9s
- value: 99999999999999999999999999999999999999
type: decimal<38, 0>
# 38 0s
- value: 00000000000000000000000000000000000000
type: decimal<38, 0>
result:
# 38 9s
value: 99999999999999999999999999999999999999
type: decimal<38, 0>
- group: max_values
args:
# negative 38 9s
- value: -99999999999999999999999999999999999999
type: decimal<38, 0>
# negative 38 9s
- value: -99999999999999999999999999999999999999
type: decimal<38, 0>
result:
# negative 38 9s
value: -99999999999999999999999999999999999999
type: decimal<38, 0>
- group:
id: null_values
description: test with null values
args:
- value: null
type: decimal<1, 0>
- value: 127
type: decimal<3, 0>
result:
value: null
type: decimal<3, 0>
- group: null_values
args:
- value: null
type: decimal<1, 0>
- value: null
type: decimal<1, 0>
result:
value: null
type: decimal<1, 0>
Loading

0 comments on commit 136a324

Please sign in to comment.