What works
- Query syntax:
SELECT,FROM, joins includingLEFT SEMIandLEFT ANTI, set operations includingMINUSandBY NAME,QUALIFY,GROUP BY ALL,GROUPING SETS,ROLLUP,CUBE, CTEs,SELECT * EXCEPT,SORT BY,TABLE,VALUES, and the|>pipe operator. - Table-valued functions:
RANGE,EXPLODE,POSEXPLODE,STACK, andIDENTIFIERin aFROMclause. - Data types:
BOOLEAN, the integer types,FLOAT,DOUBLE,DECIMAL,STRING,BINARY,DATE,TIMESTAMP,TIMESTAMP_NTZ,ARRAY, andSTRUCT. - Operators: arithmetic, bitwise, comparison including
<=>, and logical operators, the::cast,LIKE ANYandLIKE ALL,RLIKE, and zero-based[]subscripts. - Functions:
- Aggregate:
AVG,COLLECT_LIST,COUNT_IF,MAX_BY,MIN_BY, theREGR_family, and more. - Array, collection, and struct:
ARRAY,ARRAY_CONTAINS,ARRAY_DISTINCT,ARRAY_MAX,ARRAYS_OVERLAP,GET, and more. - Bitwise:
SHIFTLEFT,SHIFTRIGHT, and more. - Conditional and predicate:
COALESCE,IF,NULLIF,NVL,NVL2,EQUAL_NULL,RLIKE, and more. - Conversion:
CASTand more. - Date and timestamp:
ADD_MONTHS,DATE_ADD,MAKE_DATE,FROM_UTC_TIMESTAMP,TO_DATE,TO_TIMESTAMP, and more. - Hash:
MD5and more. - JSON and semi-structured:
JSON_OBJECT_KEYS,TO_JSON, and more. - Math:
EXP,GREATEST,LEAST,LOG2,PMOD,POWER, and more. - Miscellaneous:
CURRENT_USER,UUID, and more. - String:
ELT,INSTR,REGEXP_COUNT,REPEAT,SPLIT_PART,URL_ENCODE, and more. - Window:
RANK,LAG,LEAD,NTH_VALUE,NTILE, and more.
- Aggregate:
- Statements:
CREATE TABLE,CREATE VIEW,CREATE SCHEMA,DROP,ALTER TABLE,INSERT,UPDATE,DELETE,MERGE,TRUNCATE TABLE,SHOW,DESCRIBE, and transactions. - Information schema: the Databricks-shaped
information_schemaviews. - Firebolt’s own functions: call them with the
firebolt.qualifier when Spark has no equivalent.
ai_ and h3_ families and read_files, are not available in either mode.
Enable a mode
Set thedialect session setting to spark for SparkSQL mode or to databricks for Databricks mode:
?dialect=spark) or in a WITH (dialect='spark') clause. Return to native Firebolt SQL with:
firebolt.
Choosing a mode
Both modes translate the same way: the functions, data types, operators, and results described in this reference are identical. They differ only in grammar, where each follows its own system, so pick the mode that matches the SQL you run.
Backslash handling also changes regular expressions written as string literals. In Databricks mode
'\\d+' reaches the regular expression engine as \d+, as it does in Spark, and '\d+' reaches it as d+. In SparkSQL mode each string arrives as written: '\d+' matches digits, and '\\d+' matches a literal backslash followed by d.
Calling Firebolt functions
In either mode you get Spark’s functions, not Firebolt’s. A name Spark does not define is rejected, even if Firebolt has a function by that name:firebolt:
firebolt is a namespace, not a schema: it qualifies function calls only, not tables or views.