Operators & functions

Most operations in FeatureQL can be written two ways: as an operator (+, ||, CASE WHEN) or as a function call (ADD(), CONCAT(), CASE_WHEN()). They produce identical results — pick whichever reads better in context.

Operator and function equivalence

Arithmetic, conditionals, and casting all have both forms:

FeatureQL
SELECT
    2 AS VALUE_TO_TEST,
    1 + VALUE_TO_TEST AS ADD_OPERATOR,
    ADD(1, VALUE_TO_TEST) AS ADD_FUNCTION,
    CASE
        WHEN VALUE_TO_TEST=1 THEN 'ONE'
        WHEN VALUE_TO_TEST=2 THEN 'TWO'
        WHEN VALUE_TO_TEST=3 THEN 'THREE'
        ELSE 'OTHER'
    END AS CASE_OPERATOR,
    CASE_WHEN(
        ARRAY[VALUE_TO_TEST=1, VALUE_TO_TEST=2, VALUE_TO_TEST=3],
        ARRAY['ONE', 'TWO', 'THREE'],
        'OTHER'
    ) AS CASE_FUNCTION,
    CAST('1' AS BIGINT) AS CAST_OPERATOR,
    CAST('1', TYPE 'BIGINT') AS CAST_FUNCTION
;
Result
VALUE_TO_TEST BIGINTADD_OPERATOR BIGINTADD_FUNCTION BIGINTCASE_OPERATOR VARCHARCASE_FUNCTION VARCHARCAST_OPERATOR BIGINTCAST_FUNCTION BIGINT
233TWOTWO11

The function forms are useful when you need to build logic dynamically. CASE_WHEN() takes arrays of conditions and values, which makes it easier to construct programmatically than the traditional CASE WHEN ... END syntax. Note that casting also has a function form: CAST('1', TYPE 'BIGINT') is equivalent to CAST('1' AS BIGINT).

For the full catalog, see Operators and Functions . For edge cases where operator and function forms behave differently, see Functions Advanced .

Constants

Mathematical constants and system values can be written with or without parentheses — PI and PI() are equivalent:

FeatureQL
SELECT
    E,
    E(),
    PI,
    PI(),
    INFINITY,
    INFINITY(),
    NAN,
    NAN(),
    VERSION,
    VERSION(),
    NULL,
    NULL(),
    EMPTY,
    EMPTY()
Result
?_0 VARCHAR?_1 VARCHAR?_2 VARCHAR?_3 VARCHAR?_4 VARCHAR?_5 VARCHAR?_6 VARCHAR?_7 VARCHAR?_8 VARCHAR?_9 VARCHAR?_10 VARCHAR?_11 VARCHAR?_12 VARCHAR?_13 VARCHAR
2.7182818284590452.7182818284590453.1415926535897933.141592653589793InfinityInfinityNaNNaN0.0.10.0.1NULLNULLEMPTY()EMPTY()

E, PI, INFINITY, and NAN are the mathematical constants. VERSION returns the FeatureQL version. NULL and EMPTY are the two special values (see Literals for how they differ).

Discovering functions

Browsing available functions

SHOW FUNCTIONS lists functions by name and category. Use LIKE patterns to narrow the results:

FeatureQL
SHOW FUNCTIONS (COLUMNS (NAME, CATEGORY)) LIKE 'ARR%' ORDER BY NAME LIMIT 10;
Result
NAME VARCHARCATEGORY ARRAY
ARRAYS_OVERLAP[Array, Set Operations]
ARRAY_AGG() GROUP BY ...[Group By, Collection]
ARRAY_AGG() OVER ...[Window Function, Collection]
ARRAY_AVG[Array, Aggregation And Statistics]
ARRAY_CONCAT[Array, Array Combination]
ARRAY_CONCAT_FN[Array, Array Combination]
ARRAY_DISTINCT[Array, Filtering And Transformation]
ARRAY_EXCEPT[Array, Set Operations]
ARRAY_HISTOGRAM[Array, Aggregation And Statistics]
ARRAY_INTERSECT[Array, Set Operations]

Results include CATEGORY (as an array like ['Math', 'Arithmetic']), DISPLAY_ORDER for sorting, and optional columns like ALIASES, OPERATOR, PARAMETERS, and NOTES available via INCLUDE.

Inspecting function signatures

SHOW FUNCTION SIGNATURES reveals the type overloads for a function — what input types it accepts and what it returns:

FeatureQL
SHOW FUNCTION SIGNATURES (COLUMNS (NAME, CATEGORY, PARAMETER_NAMES, PARAMETER_TYPES, RETURN_TYPE)) WHERE NAME='ADD';
Result
NAME VARCHARCATEGORY ARRAYPARAMETER_NAMES ARRAYPARAMETER_TYPES ARRAYRETURN_TYPE VARCHAR
ADD[Date And Time, Arithmetic Date][timestamp, interval][TIMESTAMP, INTERVAL]TIMESTAMP
ADD[Math, Arithmetic][number1, number2][T, T]T

ADD has two signatures: one for numeric types (using the generic T) and one for date/interval arithmetic. PARAMETER_NAMES and PARAMETER_TYPES are arrays, making them easy to process programmatically. Use INCLUDE (GENERICS) to see what concrete types a generic like T accepts.

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19