Skip to content

Commit

Permalink
feat: additional boolean comparison functions (#764)
Browse files Browse the repository at this point in the history
Added:
* is_true:bool
* is_not_true:bool
* is_false:bool
* is_not_false:bool
  • Loading branch information
vbarua authored Jan 8, 2025
1 parent 57770b6 commit 2d8b1b6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
32 changes: 32 additions & 0 deletions extensions/functions_comparison.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,38 @@ scalar_functions:
name: high
description: The value to check if less than or equal to.
return: boolean
- name: "is_true"
description: Whether a value is true.
impls:
- args:
- value: boolean?
name: x
return: BOOLEAN
nullability: DECLARED_OUTPUT
- name: "is_not_true"
description: Whether a value is not true.
impls:
- args:
- value: boolean?
name: x
return: BOOLEAN
nullability: DECLARED_OUTPUT
- name: "is_false"
description: Whether a value is false.
impls:
- args:
- value: boolean?
name: x
return: BOOLEAN
nullability: DECLARED_OUTPUT
- name: "is_not_false"
description: Whether a value is not false.
impls:
- args:
- value: boolean?
name: x
return: BOOLEAN
nullability: DECLARED_OUTPUT
-
name: "is_null"
description: Whether a value is null. NaN is not null.
Expand Down
6 changes: 6 additions & 0 deletions tests/cases/comparison/is_false.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### SUBSTRAIT_SCALAR_TEST: v1.0
### SUBSTRAIT_INCLUDE: '/extensions/functions_comparison.yaml'

is_false(true::bool) = false::bool
is_false(false::bool) = true::bool
is_false(null::bool) = false::bool
6 changes: 6 additions & 0 deletions tests/cases/comparison/is_not_false.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### SUBSTRAIT_SCALAR_TEST: v1.0
### SUBSTRAIT_INCLUDE: '/extensions/functions_comparison.yaml'

is_not_false(true::bool) = true::bool
is_not_false(false::bool) = false::bool
is_not_false(null::bool) = true::bool
6 changes: 6 additions & 0 deletions tests/cases/comparison/is_not_true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### SUBSTRAIT_SCALAR_TEST: v1.0
### SUBSTRAIT_INCLUDE: '/extensions/functions_comparison.yaml'

is_not_true(true::bool) = false::bool
is_not_true(false::bool) = true::bool
is_not_true(null::bool) = true::bool
6 changes: 6 additions & 0 deletions tests/cases/comparison/is_true.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### SUBSTRAIT_SCALAR_TEST: v1.0
### SUBSTRAIT_INCLUDE: '/extensions/functions_comparison.yaml'

is_true(true::bool) = true::bool
is_true(false::bool) = false::bool
is_true(null::bool) = false::bool

0 comments on commit 2d8b1b6

Please sign in to comment.