Understanding default triggers, on time, and closing behavior
As we have seen, when specifying a PTransform
window, which is necessary for all grouping operations, we may optionally specify a triggering. We explored this concept in the theoretical part of Chapter 1, Introduction to Data Processing with Apache Beam. Here, we will focus specifically on understanding how Beam interprets triggers and when the output is triggered.
The simplest trigger we can specify is the AfterWatermark.pastEndOfWindow()
trigger, which simply means trigger the output once the window has completed. That is, once the watermark passes the end timestamp of each particular window. We have already seen that each window has such an end timestamp, including the global window, which has a timestamp set in the very distant future.
A question we might ask is, which trigger will be used if we create a PTransform window without specifying a trigger? The answer is DefaultTrigger
. How should this trigger be defined...