I've created UDF in Clickhouse, for example:
create function test_function AS (in_param) -> (select col1 from table1 t1 join table2 t2 on t1.key=t2.key where t1.key = in_param);
It works fine when I try the following example, just passing the string value excplicitly:
select test_function('10000');
But the following example fails:
select test_function(x_id) from tablex where colx='somevalue';
Fails with error:
Code: 47. DB::Exception: Missing columns: 'x_id' while processing query: 'select col1 from table1 t1 join table2 t2 on t1.key=t2.key where t1.key = x_id'
As if the value of x_id is not passed to the function, looks like the function is working with string 'x_id' and not the value of field x_id. Any suggestions ?