How can I get a parameterized bulk version of a scalar C UDF to work in SQL?
Hi,
Say that I have a family of simple scalar transforming function f(x ,p) => y parameterized by p which are implemented as C UDF's and exposed as SQL UDF's. Is it possible to create a bulk version of this?
So the scalar C signature is simplified to something like
char* f(int* output, int* input, const char** func_parameter);
the mal stuff
module m;
command f(input:int, func_parameter:str):int address f;
and in sql we have
CREATE FUNCTION f(input INT, func_param STRING) RETURNS INT EXTERNAL NAME m.f;
Now for the bulk version I would like to use
in C:
char* f(bat* output, bat* input, const char** func_parameter);
in MAL:
module batm;
command f(input:bat[:int], func_parameter:str):bat[:int]
address f;
in SQL: reuse the scalar SQL signature.
But that doesn't seem to work. When I compile this and call the udf in a sql query on an actual column, the plan applies the scalar version on each tuple instead of calling the bulk version once. However if I remove the parametrization, i.e. removing the func_parameter from the signature, the bulk version is correctly called.
Aris
participants (1)
-
aris