@Override public <U> TStream<U> aggregate(BiFunction<List<T>,K, U> processor) { processor = Functions.synchronizedBiFunction(processor); Window<T, K, LinkedList<T>> window = Windows.lastNProcessOnInsert(size, getKeyFunction()); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, processor); return feeder().pipe(op); }
@Override public <U> TStream<U> aggregate(BiFunction<List<T>,K, U> processor) { processor = Functions.synchronizedBiFunction(processor); Window<T, K, LinkedList<T>> window = Windows.lastNProcessOnInsert(size, getKeyFunction()); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, processor); return feeder().pipe(op); }
@Override public <J, U, K> TStream<J> joinLast(Function<T, K> keyer, TStream<U> lastStream, Function<U, K> lastStreamKeyer, BiFunction<T, U, J> joiner) { BiFunction<List<U>,K, Object> processor = Functions.synchronizedBiFunction((list, key) -> null); Window<U, K, LinkedList<U>> window = Windows.lastNProcessOnInsert(1, lastStreamKeyer); Aggregate<U,Object,K> op = new Aggregate<U,Object,K>(window, processor); lastStream.pipe(op); return this.map((tuple) -> { Partition<U, K, ? extends List<U>> part = window.getPartitions().get(keyer.apply(tuple)); if(part == null) return null; J ret; synchronized (part) { U last = part.getContents().get(0); ret = joiner.apply(tuple, last); } return ret; }); }
@Override public <J, U, K> TStream<J> joinLast(Function<T, K> keyer, TStream<U> lastStream, Function<U, K> lastStreamKeyer, BiFunction<T, U, J> joiner) { BiFunction<List<U>,K, Object> processor = Functions.synchronizedBiFunction((list, key) -> null); Window<U, K, LinkedList<U>> window = Windows.lastNProcessOnInsert(1, lastStreamKeyer); Aggregate<U,Object,K> op = new Aggregate<U,Object,K>(window, processor); lastStream.pipe(op); return this.map((tuple) -> { Partition<U, K, ? extends List<U>> part = window.getPartitions().get(keyer.apply(tuple)); if(part == null) return null; J ret; synchronized (part) { U last = part.getContents().get(0); ret = joiner.apply(tuple, last); } return ret; }); }
@Override public <U> TStream<U> batch(BiFunction<List<T>, K, U> batcher) { batcher = Functions.synchronizedBiFunction(batcher); Window<T, K, List<T>> window = Windows.window( alwaysInsert(), Policies.scheduleEvictOnFirstInsert(time, unit), Policies.evictAllAndScheduleEvictWithProcess(time, unit), (partition, tuple) -> {}, getKeyFunction(), () -> new ArrayList<T>()); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, batcher); return feeder().pipe(op); }
@Override public <U> TStream<U> batch(BiFunction<List<T>, K, U> batcher) { batcher = Functions.synchronizedBiFunction(batcher); Window<T, K, List<T>> window = Windows.window( alwaysInsert(), Policies.scheduleEvictOnFirstInsert(time, unit), Policies.evictAllAndScheduleEvictWithProcess(time, unit), (partition, tuple) -> {}, getKeyFunction(), () -> new ArrayList<T>()); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, batcher); return feeder().pipe(op); }
@Override public <U> TStream<U> batch(BiFunction<List<T>, K, U> batcher) { batcher = Functions.synchronizedBiFunction(batcher); Window<T, K, List<T>> window = Windows.window( alwaysInsert(), Policies.doNothing(), Policies.evictAll(), Policies.processWhenFullAndEvict(size), getKeyFunction(), () -> new ArrayList<T>(size)); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, batcher); return feeder().pipe(op); }
@Override public <U> TStream<U> batch(BiFunction<List<T>, K, U> batcher) { batcher = Functions.synchronizedBiFunction(batcher); Window<T, K, List<T>> window = Windows.window( alwaysInsert(), Policies.doNothing(), Policies.evictAll(), Policies.processWhenFullAndEvict(size), getKeyFunction(), () -> new ArrayList<T>(size)); Aggregate<T,U,K> op = new Aggregate<T,U,K>(window, batcher); return feeder().pipe(op); }
processor = Functions.synchronizedBiFunction(processor); Window<T, K, InsertionTimeList<T>> window = Windows.window(
processor = Functions.synchronizedBiFunction(processor); Window<T, K, InsertionTimeList<T>> window = Windows.window(
BiFunction<List<U>,K, Object> processor = Functions.synchronizedBiFunction((list, key) -> null); Window<U, K, ?> window; if(twindow instanceof TWindowImpl){
BiFunction<List<U>,K, Object> processor = Functions.synchronizedBiFunction((list, key) -> null); Window<U, K, ?> window; if(twindow instanceof TWindowImpl){