Custom Functions

Hydrolix provides the ability to create user defined functions

Custom Functions

Hydrolix custom functions are created using the API 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/en/sql-reference/statements/create/function/.

To specify your function with the API you should define it as follows:

📘

The sql section of the function config corresponds to the expression which immediately follows:
CREATE FUNCTION <function name> AS ...

POST https://{hostname}.hydrolix.live/config/v1/orgs/{org_id}/projects/{project_id}/functions/
Authorization: Bearer {{access_token}}
Content-Type: application/json

{
     "sql": "(x, k, b) -> k*x + b;",
     "name": "linear_equation"
}
NameDefinition
sqlThe functions specification.
nameThe name of the function

Example Custom Function usage

SELECT
    number,
    {{projectname}}_linear_equation(number, 2, 1)
FROM numbers(3)

┌─number─┬─plus(multiply(2, number), 1)─┐
│      0 │                            1 │
│      1 │                            3 │
│      2 │                            5 │
└────────┴──────────────────────────────┘