:::info Spice is built on Apache DataFusion and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects. :::
+ {#op_plus}Addition
- {#op_minus}Subtraction
* {#op_multiply}Multiplication
/ {#op_divide}Division (integer division truncates toward zero)
% {#op_modulo}Modulo (remainder)
= {#op_eq}Equal
!= {#op_neq}Not Equal
< {#op_lt}Less Than
<= {#op_le}Less Than or Equal To
> {#op_gt}Greater Than
>= {#op_ge}Greater Than or Equal To
<=> {#op_spaceship}Three-way comparison operator. A NULL-safe operator that returns true if both operands are equal or both are NULL, false otherwise.
IS DISTINCT FROMGuarantees the result of a comparison is true or false and not an empty set
IS NOT DISTINCT FROMThe negation of IS DISTINCT FROM
~ {#op_re_match}Regex Match
~* {#op_re_match_i}Regex Case-Insensitive Match
!~ {#op_re_not_match}Not Regex Match
!~* {#op_re_not_match_i}Not Regex Case-Insensitive Match
~~Like Match
~~*Case-Insensitive Like Match
!~~Not Like Match
!~~*Not Case-Insensitive Like Match
ANDLogical And
ORLogical Or
& {#op_bit_and}Bitwise And
| {#op_bit_or}Bitwise Or
# {#op_bit_xor}Bitwise Xor (interchangeable with ^)
>> {#op_shift_r}Bitwise Shift Right
<< {#op_shift_l}Bitwise Shift Left
CAST(expr AS type) – Explicit type conversion:: (PostgreSQL-style cast) – Shorthand type conversionCAST(expr AS type) {#op_cast}Converts an expression to the specified data type.
:: (PostgreSQL-style cast) {#op_double_colon}Shorthand syntax for type conversion, equivalent to CAST.
Supported Types:
| Type | Description |
|---|---|
INT / INTEGER / INT4 | 32-bit signed integer |
BIGINT / INT8 | 64-bit signed integer |
SMALLINT / INT2 | 16-bit signed integer |
FLOAT / REAL / FLOAT4 | 32-bit floating point |
DOUBLE / FLOAT8 | 64-bit floating point |
TEXT / VARCHAR / STRING | Variable-length string |
BOOLEAN / BOOL |
|| {#op_str_cat}String Concatenation
@> {#op_arr_contains}Array Contains
<@ {#op_arr_contained_by}Array Is Contained By
Use single quotes for literal string values.
SQL literals do not support C-style escape sequences such as \n for newline by default. All characters in a ' string are treated literally.
To escape ' in SQL literals, use '':
Strings such as 'foo\nbar' contain a literal backslash followed by n, not a newline:
To include escaped characters such as newline or tab, use E-prefixed strings:
Supported escape sequences:
| Escape | Character |
|---|---|
\n | Newline |
\t | Tab |
\r | Carriage return |
\\ | Backslash |
\' | Single quote |
| True/false value |
DATE | Calendar date |
TIMESTAMP | Date and time |
INTERVAL | Time duration |