You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by 张帅 <79...@gmail.com> on 2022/10/24 01:39:02 UTC
apache calcite UDAF implementation
hi,
I am implementing a user-defined aggregate function, it needs input two
parameters like "AGG(column, 5)", the first is the agg column, the second
is
a number literal.
I implement it like this:
public class CalciteUDAF {
public List init() {return new ArrayList()}
public List add(List accumulator, Object o) {*accumulator.add(o)*}
public Object result(List accumulator) {return xxxx}
}
I use schemaPlus.add("AGG",
AggregateFunctionImpl.create(CalciteUDAF.class)) to use it.
but how could I use the second parameter in this UDAF? could anyone give me
some advice?
Re: apache calcite UDAF implementation
Posted by 张帅 <79...@gmail.com>.
get it, in add
张帅 <79...@gmail.com> 于2022年10月24日周一 09:39写道:
> hi,
> I am implementing a user-defined aggregate function, it needs input two
> parameters like "AGG(column, 5)", the first is the agg column, the second
> is
> a number literal.
> I implement it like this:
> public class CalciteUDAF {
> public List init() {return new ArrayList()}
> public List add(List accumulator, Object o) {*accumulator.add(o)*
> }
> public Object result(List accumulator) {return xxxx}
> }
>
> I use schemaPlus.add("AGG",
> AggregateFunctionImpl.create(CalciteUDAF.class)) to use it.
>
> but how could I use the second parameter in this UDAF? could anyone give
> me some advice?
>