Aljoscha Krettek created FLINK-18011:
----------------------------------------
Summary: Make WatermarkStrategy/WatermarkStrategies more ergonomic
Key: FLINK-18011
URL: https://issues.apache.org/jira/browse/FLINK-18011
Project: Flink
Issue Type: Sub-task
Components: API / Core, API / DataStream
Reporter: Aljoscha Krettek
Assignee: Aljoscha Krettek
Fix For: 1.11.0
Currently, we have an interface {{WatermarkStrategy}}, which is a
{{TimestampAssignerSupplier}} and {{WatermarkGeneratorSupplier}}. The very
first design (which is also currently implemented) also added
{{WatermarkStrategies}} as a convenience builder for a {{WatermarkStrategy}}.
However, I don't think users will ever implement a {{WatermarkStrategy}} but
always wrap it in a builder. I also think that {{WatermarkStrategy}} itself is
already that builder and we currently have two levels of builders, which also
makes them harder to use in the {{DataStream API}} because of type checking
issues.
I'm proposing to remove {{WatermarkStrategies}} and to instead put the static
methods directly into {{WatermarkStrategy}} and also to remove the {{build()}}
method. Instead of a {{build()}} method, API methods on {{WatermarkStrategy}}
just keep "piling" features on top of a base {{WatermarkStrategy}} via wrapping.
Example to show what I mean for the API (current):
{code}
DataStream<MyType> input = ...;
input.assignTimestampsAndWatermarks(
WatermarkStrategies.<MyType>.forMonotonousTimestamps().build());
{code}
with the proposed change:
{code}
DataStream<MyType> input = ...;
input.assignTimestampsAndWatermarks(
WatermarkStrategy.forMonotonousTimestamps());
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)