Table of Contents

Boolean Functions

Or

Substrait definition

Or implements the boolean logic Or operator. Its return value will always be a boolean. An argument into the Or function that is not a boolean will be the same as the boolean value false.

Implements Kleene logic with the following truth table:

+------+-------+-----+-----+-----+
|              |     **B**       |
+  **A OR B**  +-----+-----+-----+
|              |**F**|**N**|**T**|
+------+-------+-----+-----+-----+
|      | **F** |  F  |  N  |  T  |
+      +-------+-----+-----+-----+
|**A** | **N** |  N  |  N  |  T  |
+      +-------+-----+-----+-----+
|      | **T** |  T  |  T  |  T  |
+------+-------+-----+-----+-----+

F = False, T = True, N = Null

SQL Usage

... WHERE c1 = 'hello' OR c2 = 'world'

And

Substrait definition

And implements the boolean logic And operator. Its return value will always be a boolean. An argument into the And function that is not a boolean will be the same as the boolean value false.

Implements Kleene logic with the following truth table:

+------+-------+-----+-----+-----+
|              |     **B**       |
+  **A AND B** +-----+-----+-----+
|              |**F**|**N**|**T**|
+------+-------+-----+-----+-----+
|      | **F** |  F  |  F  |  F  |
+      +-------+-----+-----+-----+
|**A** | **N** |  F  |  N  |  N  |
+      +-------+-----+-----+-----+
|      | **T** |  F  |  N  |  T  |
+------+-------+-----+-----+-----+

F = False, T = True, N = Null

SQL Usage

... WHERE c1 = 'hello' AND c2 = 'world'

Not

Substrait definition

The not of a boolean value. When a null is input, a null is output.

SQL Usage

... WHERE NOT c1 = 'hello'

Xor

Substrait definition

Xor implements the boolean logic Xor operator using kleene logic.

SQL Usage

... WHERE (c1 = 'hello') XOR (c2 = 'world')