0

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?

Mr.zs
  • 1
  • I get the answer! in add method, except the first parameter, all the leaving parameter represents the AGG functions parameter. so we can get it in add method, and do what I want – Mr.zs Oct 24 '22 at 03:12
  • If you have solved your problem, it would help if you post it as answer to your own question so that future readers can see it easily. – Michael Mior Oct 24 '22 at 11:12

0 Answers0