[
https://issues.apache.org/jira/browse/CALCITE-1783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde reassigned CALCITE-1783:
------------------------------------
Assignee: James Xu (was: Julian Hyde)
> Support merge method in AggregateFunction
> -----------------------------------------
>
> Key: CALCITE-1783
> URL: https://issues.apache.org/jira/browse/CALCITE-1783
> Project: Calcite
> Issue Type: New Feature
> Reporter: James Xu
> Assignee: James Xu
>
> I was implementing the UDAF for BEAM SQL using Calcite, Since BEAM is used in
> big data processing where aggregate functions will be implemented using
> distributed algorithms. Then the `merge` method is a must to support UDAF in
> BEAM, the corresponding aggregator interface in BEAM is `CombineFn`:
> {code:java}
> public abstract static class CombineFn<InputT, AccumT, OutputT>
> extends AbstractGlobalCombineFn<InputT, AccumT, OutputT> {
> /**
> * Returns a new, mutable accumulator value, representing the
> accumulation of zero input values.
> */
> public abstract AccumT createAccumulator();
> /**
> * Adds the given input value to the given accumulator, returning the
> * new accumulator value.
> *
> * <p>For efficiency, the input accumulator may be modified and returned.
> */
> public abstract AccumT addInput(AccumT accumulator, InputT input);
> /**
> * Returns an accumulator representing the accumulation of all the
> * input values accumulated in the merging accumulators.
> *
> * <p>May modify any of the argument accumulators. May return a
> * fresh accumulator, or may return one of the (modified) argument
> * accumulators.
> */
> public abstract AccumT mergeAccumulators(Iterable<AccumT> accumulators);
> /**
> * Returns the output value that is the result of combining all
> * the input values represented by the given accumulator.
> */
> public abstract OutputT extractOutput(AccumT accumulator);
> }
> {code}
> mergeAccumulators is the analogue in BEAM for `merge`.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)