To maintain a state, Trigger uses TriggerContext
while the window functions uses Context
. Although logically similar, TriggerContext
and Context
do not seem to share the same code (neither through inheritance nor usage).
Why do TriggerContext
and Context
don't share the same code and have a different usage pattern?
These two classes are the just the tip of the iceberg; Flink's APIs make frequent use of this Context object pattern. The objective here is to provide user-defined functions with just the information they need, while avoiding any unnecessary coupling between components.