@Override public void process(Byte key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessAllWindowFunction<V, R, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void process(K key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessWindowFunction<V, R, K, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(key, ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void apply(K key, W window, Iterable<T> values, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : values) { acc = aggFunction.add(val, acc); } wrappedFunction.apply(key, window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void apply(W window, Iterable<T> values, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T value : values) { acc = aggFunction.add(value, acc); } wrappedFunction.apply(window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void add(T value) { byte[] key = getKeyBytes(); ACC accumulator = getInternal(key); accumulator = accumulator == null ? aggFunction.createAccumulator() : accumulator; updateInternal(key, aggFunction.add(value, accumulator)); }
@Override String expected(@Nonnull List<ValueWithTs<Integer>> updates, long currentTimestamp) { if (updates.isEmpty()) { return null; } long acc = AGG_FUNC.createAccumulator(); long lastTs = updates.get(0).getTimestamp(); for (ValueWithTs<Integer> update : updates) { if (expired(lastTs, update.getTimestamp())) { acc = AGG_FUNC.createAccumulator(); } acc = AGG_FUNC.add(update.getValue(), acc); lastTs = update.getTimestamp(); } return expired(lastTs, currentTimestamp) ? null : AGG_FUNC.getResult(acc); }
@Override public ACC apply(ACC accumulator, IN value) { if (accumulator == null) { accumulator = aggFunction.createAccumulator(); } return aggFunction.add(value, accumulator); } }
@Override public ACC apply(ACC accumulator, IN value) throws Exception { if (accumulator == null) { accumulator = aggFunction.createAccumulator(); } aggFunction.add(value, accumulator); return accumulator; } }
@Override public ACC apply(ACC accumulator, IN value) throws Exception { if (accumulator == null) { accumulator = aggFunction.createAccumulator(); } return aggFunction.add(value, accumulator); } }
@Override public ACC apply(ACC accumulator, IN value) { if (accumulator == null) { accumulator = aggFunction.createAccumulator(); } return aggFunction.add(value, accumulator); } }
@Override public void process(K key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessWindowFunction<V, R, K, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(key, ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void process(K key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessWindowFunction<V, R, K, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(key, ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void apply(W window, Iterable<T> values, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T value : values) { acc = aggFunction.add(value, acc); } wrappedFunction.apply(window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void process(Byte key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessAllWindowFunction<V, R, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void apply(W window, Iterable<T> values, Collector<R> out) throws Exception { final ACC acc = aggFunction.createAccumulator(); for (T value : values) { aggFunction.add(value, acc); } wrappedFunction.apply(window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void apply(K key, W window, Iterable<T> values, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : values) { acc = aggFunction.add(val, acc); } wrappedFunction.apply(key, window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void process(K key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { final ACC acc = aggFunction.createAccumulator(); for (T val : input) { aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessWindowFunction<V, R, K, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(key, ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public void apply(W window, Iterable<T> values, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T value : values) { acc = aggFunction.add(value, acc); } wrappedFunction.apply(window, Collections.singletonList(aggFunction.getResult(acc)), out); } }
@Override public void process(Byte key, final W window, final InternalWindowContext context, Iterable<T> input, Collector<R> out) throws Exception { ACC acc = aggFunction.createAccumulator(); for (T val : input) { acc = aggFunction.add(val, acc); } this.ctx.window = window; this.ctx.internalContext = context; ProcessAllWindowFunction<V, R, W> wrappedFunction = this.wrappedFunction; wrappedFunction.process(ctx, Collections.singletonList(aggFunction.getResult(acc)), out); }
@Override public TtlValue<ACC> add(IN value, TtlValue<ACC> accumulator) { ACC userAcc = getUnexpired(accumulator); userAcc = userAcc == null ? original.createAccumulator() : userAcc; return wrapWithTs(original.add(value, userAcc)); }