Custom Functions
Hydrolix provides the ability to create user-defined functions.
Custom Functions⚓︎
Hydrolix custom functions are created using the Create function endpoint and are scoped to specific projects to avoid namespace collision.
Custom function configuration follows a similar method as can be found here - https://clickhouse.com/docs/sql-reference/statements/create/function.
Define Functions⚓︎
To specify your function with the API you should define it as follows:
Alternatively, you can define multiple functions with one API call:
The SQL is just the function definition
The sql section of the function config corresponds to the expression which immediately follows:
CREATE FUNCTION <function name> AS ...
| Name | Definition |
|---|---|
| sql | The function's specification |
| name | The name of the function |
Validation of function SQL⚓︎
When you save this resource, Hydrolix validates the SQL you provide by passing it through hdx_verify_sql, a ClickHouse table function that parses and analyzes the semantics of the query without executing it.
hdx_verify_sql checks for:
- Syntax errors such as unclosed strings, unbalanced parentheses, missing keywords, or malformed statements
- References to non-existent tables or databases
- Type errors, for example arithmetic on incompatible types
Validation doesn't catch:
- References to non-existent functions
- Undefined variables
- Whether referenced tables contain data
- Query performance or cost
- Access control or row/column-level permissions
- Runtime errors
If the query service is temporarily unavailable, validation is skipped and the save is allowed to proceed.