This basic example illustrates a simple sum
NodeJS powered Clickhouse UDF function
Clickhouse is super fast and already has all the functions one could dream. What is this for?
This example is designed to understand the underlying formats and unleash imagination for integrators.
Create an executable NodeJS script
- read input from stdin
- split row values by tabs
- return some output
In our example we'll just accept two integers and sum them
Configure a UDF Function to invoke your script
- use directory
/var/lib/clickhouse/user-scripts
to store user-scripts
SELECT node_sum(10, 20)
Query id: f98a5f83-4e94-41d0-9d9f-78b37d3af152
┌─node_sum(10, 20)-─┐
│ 30 │
└───────────────────┘
1 rows in set. Elapsed: 0.054 sec.