Expand description
Scalar SQL-expression user functions, expanded (inlined) into native SQL before planning.
A scalar SQL function such as CREATE FUNCTION tax(x DOUBLE) RETURNS DOUBLE RETURN x * 1.1 is stored as a parsed body expression plus its parameter
names. When a query references it (SELECT tax(amount) FROM sales), every
call is replaced with the body — arguments substituted for parameters — so
the query becomes pure native SQL (SELECT (amount * 1.1) FROM sales).
Because the result is ordinary SQL with no UDF reference, it plans and runs anywhere the engine runs, INCLUDING distributed execution on the Rust executors — no Python interpreter and no per-executor function registration required. This is the portable, distributable counterpart to Python-callable UDFs, which can only run in the embedded (in-process) engine.
Structs§
- Scalar
SqlFunction - A scalar SQL function definition: its (lower-cased) name, ordered parameter names, and the parsed body expression.
Functions§
- expand_
scalar_ sql_ functions - Inline every call to a registered scalar SQL function in
sql, returning pure native SQL. No-op (returnssqlunchanged) whenfuncsis empty or the query references none of them. Errors only if the query cannot be parsed.