use of org.apache.apex.malhar.lib.window.accumulation.PojoInnerJoin in project apex-malhar by apache.
the class PojoInnerJoinTestApplication method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
POJOGenerator salesGenerator = dag.addOperator("Input1", new POJOGenerator(1, 1));
POJOGenerator productGenerator = dag.addOperator("Input2", new POJOGenerator(1, 1));
productGenerator.setSalesEvent(false);
WindowedMergeOperatorImpl<POJOGenerator.SalesEvent, POJOGenerator.ProductEvent, List<Set<Object>>, List<List<Object>>> op = dag.addOperator("Merge", new WindowedMergeOperatorImpl<POJOGenerator.SalesEvent, POJOGenerator.ProductEvent, List<Set<Object>>, List<List<Object>>>());
op.setAccumulation(new PojoInnerJoin(2, POJOGenerator.OutputEvent.class, "productId", "productId"));
op.setDataStorage(new InMemoryWindowedStorage<List<Set<Object>>>());
WindowedStorage.WindowedPlainStorage<WindowState> windowStateMap = new InMemoryWindowedStorage<>();
op.setWindowStateStorage(windowStateMap);
op.setWindowOption(new WindowOption.TimeWindows(Duration.millis(10)));
op.setTriggerOption(new TriggerOption().withEarlyFiringsAtEvery(1).accumulatingFiredPanes());
op.setAllowedLateness(Duration.millis(500));
ResultCollector results = dag.addOperator("results", new ResultCollector());
dag.addStream("SalesToJoin", salesGenerator.outputsales, op.input);
dag.addStream("ProductToJoin", productGenerator.outputproduct, op.input2);
dag.addStream("results", op.output, results.input);
dag.addStream("wm1", salesGenerator.watermarkDefaultOutputPort, op.controlInput);
dag.addStream("wm2", productGenerator.watermarkDefaultOutputPort, op.controlInput2);
}
Aggregations