My greetings.
I try to create User Defined Function(UDF) but passing string parameter fails.
Log prints empty string on the server side.
Client code(MySQL):
CREATE FUNCTION foo RETURNS BIGINT SONAME ‘foo.so’;
SELECT foo(‘abcd’) FROM …;
Server code:
int64_t foo(SPH_UDF_INIT* init, SPH_UDF_ARGS* args, char* error_flag) {
int arg_len = args->str_lengths[0];
const char* guid = args->arg_values[0];
DeamonLog(guid);
return 0;
}
Log prints garbage or empty string for guid,
but correct arg_len - 4 and correct arg type - SPH_UDF_TYPE_STRING - 5
Passing integers as parameters is ok.
I don’t use xxx_init and xxx_deinit procedures in the example.
UDF returns zero correctly.
Could anybody faced the problem?
Thanks.