johnyangk commented on a change in pull request #172: [NEMO-270] Test different triggers in GroupByKeyAndWindowDoFnTransformTest URL: https://github.com/apache/incubator-nemo/pull/172#discussion_r238532857
########## File path: compiler/test/src/test/java/org/apache/nemo/compiler/frontend/beam/transform/GroupByKeyAndWindowDoFnTransformTest.java ########## @@ -248,4 +252,120 @@ public void test() { doFnTransform.close(); } + + /** + * Test complex triggers that emit early and late firing. + */ + @Test + public void eventTimeTriggerTest() { + final Duration lateness = Duration.standardSeconds(1); + final AfterWatermark.AfterWatermarkEarlyAndLate trigger = AfterWatermark.pastEndOfWindow() + // early firing + .withEarlyFirings( + AfterProcessingTime + .pastFirstElementInPane() + // early firing 1 sec after receiving an element + .plusDelayOf(Duration.millis(1000))) + // late firing: Fire on any late data. + .withLateFirings(AfterPane.elementCountAtLeast(1)); + + final FixedWindows window = (FixedWindows) Window.into( + FixedWindows.of(Duration.standardSeconds(5))) + // lateness + .withAllowedLateness(lateness) + .triggering(trigger) + .accumulatingFiredPanes().getWindowFn(); + + final TupleTag<String> outputTag = new TupleTag<>("main-output"); + final GroupByKeyAndWindowDoFnTransform<String, String> doFnTransform = + new GroupByKeyAndWindowDoFnTransform( + NULL_OUTPUT_CODERS, + outputTag, + WindowingStrategy.of(window).withTrigger(trigger) + .withMode(ACCUMULATING_FIRED_PANES) Review comment: Can you also test DISCARDING_FIRED_PANES, or add a TODO? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services