Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor StreamOperator Hierachy to make Keys Explicit #2573

Closed
wants to merge 6 commits into from

Conversation

aljoscha
Copy link
Contributor

This is more of a preview PR, I'm not yet completely done with testing and making sure that everything works.

R: @StephanEwen

The name is clashing with the soon-to-be-added
TimerService/InternalTimerService which is meant as an interface for
dealing with both processing time and event time.

TimeServiceProvided is renamed to ProcessingTimeService to reflect the
fact that it is a low-level utility that only deals with "physical"
processing-time trigger tasks.
Before, this would allow handing in a custom ProcessingTimeService but
this was in reality always TestProcessingTimeService.
This also introduces KeyedTwoInputStreamOperatorTestHarness which
is similar to KeyedOneInputStreamOperatorTestHarness
This moves the event-time/processing-time trigger code from
WindowOperator behind a well defined interface that can be used by
operators (and user functions).

InternalTimerService is the new interface that has the same
functionality that WindowOperator used to have. TimerService is the user
facing interface that does not allow dealing with namespaces/payloads
and also does not allow deleting timers. There is a default
implementation in HeapInternalTimerService that can checkpoint timers to
a stream and also restore from a stream. Right now, this is managed in
AbstractStreamOperator and operators can ask for an
InternalTimerService.

This also adds tests for HeapInternalTimerService.

This adds two new user functions:
 - TimelyFlatMapFunction: an extension of FlatMapFunction that also
   allows querying time and setting timers
 - TimelyCoFlatMapFunction: the same, but for CoFlatMapFunction

There are two new StreamOperator implementations for these that use the
InternalTimerService interface.

This also adds tests for the two new operators.

This also adds the new interface KeyContext that is used for
setting/querying the current key context for state and timers. Timers
are always scoped to a key, for now.

Also, this moves the handling of watermarks for both one-input and
two-input operators to AbstractStreamOperators so that we have a central
ground-truth.
@aljoscha aljoscha closed this Mar 8, 2018
@aljoscha aljoscha deleted the refactor-stream-operators branch March 8, 2018 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant