diff --git a/extensions/functions_comparison.yaml b/extensions/functions_comparison.yaml index dffc5728d..517f8e38f 100644 --- a/extensions/functions_comparison.yaml +++ b/extensions/functions_comparison.yaml @@ -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. diff --git a/tests/cases/comparison/is_false.test b/tests/cases/comparison/is_false.test new file mode 100644 index 000000000..c11295ac3 --- /dev/null +++ b/tests/cases/comparison/is_false.test @@ -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 diff --git a/tests/cases/comparison/is_not_false.test b/tests/cases/comparison/is_not_false.test new file mode 100644 index 000000000..4301e041f --- /dev/null +++ b/tests/cases/comparison/is_not_false.test @@ -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 diff --git a/tests/cases/comparison/is_not_true b/tests/cases/comparison/is_not_true new file mode 100644 index 000000000..3dafdaee1 --- /dev/null +++ b/tests/cases/comparison/is_not_true @@ -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 diff --git a/tests/cases/comparison/is_true.test b/tests/cases/comparison/is_true.test new file mode 100644 index 000000000..f3bb7ff0e --- /dev/null +++ b/tests/cases/comparison/is_true.test @@ -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