Github user ddebrunner commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/60#discussion_r58105482
--- Diff:
spi/topology/src/main/java/quarks/topology/spi/graph/ConnectorStream.java ---
@@ -163,6 +175,100 @@ protected Graph graph() {
}
@Override
+ public <J, U, K> TStream<J> join(Function<T, K> keyer,
+ TWindow<U, K> twindow, BiFunction<T, List<U>, J> joiner) {
+
+ if(twindow instanceof TWindowImpl){
+ TStream<U> lastStream = twindow.feeder();
+ BiFunction<List<U>,K, Object> processor =
Functions.synchronizedBiFunction((list, key) -> null);
+ Window<U, K, LinkedList<U>> window =
Windows.lastNProcessOnInsert(((TWindowImpl<U, K>)twindow).getSize(),
twindow.getKeyFunction());
+ 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) {
+ List<U> last = part.getContents();
+ ret = joiner.apply(tuple, last);
+ }
+ return ret;
+ });
+ }
+
+ else if (twindow instanceof TWindowTimeImpl){
+ TStream<U> lastStream = twindow.feeder();
+ BiFunction<List<U>,K, Object> processor =
Functions.synchronizedBiFunction((list, key) -> null);
+ long time = ((TWindowTimeImpl<U, K>)(twindow)).getTime();
+ TimeUnit unit = ((TWindowTimeImpl<U, K>)(twindow)).getUnit();
+ Window<U, K, InsertionTimeList<U>> window =
+ Windows.window(
+ alwaysInsert(),
+ scheduleEvictIfEmpty(time, unit),
+ evictOlderWithProcess(time, unit),
+ processOnInsert(),
+ twindow.getKeyFunction(),
+ insertionTimeList());
+ Aggregate<U,Object,K> op = new Aggregate<U,Object,K>(window,
processor);
--- End diff --
Can some explanation be added, it's unclear why an Aggregate is used that
is unconnected.
I guess i was expecting a new Join oplet to be created & used.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---