Operators & functions

FeatureQL provides both operators and equivalent functions for common operations, giving you flexibility in how you express your feature logic. Understanding both approaches helps you write more readable and maintainable code.

Operator and function equivalence

Many operations can be written in two ways:

  • Using traditional SQL operators (+, ||, CASE, CAST)
  • Using equivalent function calls (ADD(), CONCAT(), CASE_WHEN(), CAST())

Key insights from this example:

  • Arithmetic: 1 + VALUE_TO_TEST equals ADD(1, VALUE_TO_TEST)
  • Conditional logic: Traditional CASE WHEN ... END can be replaced with CASE_WHEN() using arrays
  • Type casting: Both CAST('1' AS BIGINT) and CAST('1', TYPE 'BIGINT') are valid
  • Array-based functions: CASE_WHEN() uses arrays for conditions and values, enabling more dynamic logic
  • Disambiguating Operator and Function Forms: See Functions and Operators Advanced

You can see the full list of:

Constants and mathematical functions

Some functions that return constants can be written with or without parentheses, providing flexibility in your coding style.

Notable constant functions:

  • Mathematical constants: E, PI, INFINITY, NAN
  • System information: VERSION returns the FeatureQL version
  • Special values: NULL, EMPTY for missing data handling
  • Flexible syntax: Both PI and PI() are valid and equivalent

Function discovery

Browsing available functions

You can view available functions using the SHOW FUNCTIONS command:

This example shows functions starting with "ARR" in the ARRAY category. Use LIKE patterns to filter functions by name or explore specific categories.

Understanding function signatures

For detailed information about function parameters and return types, use SHOW FUNCTION SIGNATURES:

This shows all overloads of the ADD function, demonstrating:

  • Type polymorphism: ADD works with different numeric types
  • Date arithmetic: Adding intervals to dates/timestamps
  • Return type rules: Output type depends on input types
Last update at: 2025/10/13 10:23:46