I am trying to develop a UDAF which takes three parameters. SQL syntax
would look like this :

select myudaf(col1, 1, 100) from mytab;

Here col1 is from table mytab and of type numeric (double/int etc.). The
other two parameters are constants. The third parameter determines memory
allocation for intermediate results. Therefore, I need to access it from
Init() function. Here is how I developed my update and init functions :

void myUDAFInit(FunctionContext *ctx, StringVal *dst);
void myUDAFUpdate(FunctionContext *ctx, const DoubleVal& d, const IntVal&,
const IntVal&, StringVal* result);

Also, I am defining my UDAF like this :

create aggregate function myUDAF(double, int, int) returns... ;

However, when I try to access function arguments in my Init() function, it
says the arguments are non-constant. Is there a different way to define
constant arguments?

Thanks in Advance.

Reply via email to