impala-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Armstrong <tarmstr...@cloudera.com>
Subject Re: how to pass constant parameter to Init() function of UDAF
Date Mon, 14 Aug 2017 20:49:06 GMT
Hi Santanu,
  Thanks for your interest. I can probably help you out given a bit more
info. Whether the arguments are constant or not is determined based on
analysis of the input expression to your function. In your case 1 and 100
are definitely constant.

What version of Impala are you running? Could you also show us the actual
code for your UDAF (or an simplified reproduction of the problem), the SQL
commands you ran and the output?

- Tim

On Mon, Aug 14, 2017 at 1:39 PM, Santanu Chatterjee <
santanu.chatter@gmail.com> wrote:

> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message