aljoscha opened a new pull request #12412:
URL: https://github.com/apache/flink/pull/12412


   ## What is the purpose of the change
   
   From the Jira issue:
   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):
   ```
   DataStream<MyType> input = ...;
   input.assignTimestampsAndWatermarks(
       WatermarkStrategies.<MyType>.forMonotonousTimestamps().build());
   ```
   
   with this change:
   ```
   DataStream<MyType> input = ...;
   input.assignTimestampsAndWatermarks(
       WatermarkStrategy.forMonotonousTimestamps());
   ```
   
   ## Brief change log
   
   - remove `WatermarkStrategies` and instead move all code to 
`WatermarkStrategy`
   
   
   ## Verifying this change
   
   - covered by existing tests
   - new tests are added to verify how `WatermarkStrategy` can be used on 
`DataStream.assignTimestampsAndWatermarks()`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: *yes*
   
   ## Documentation
   
   I didn't yet change the documentation. I would update that once we agree on 
the change.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Reply via email to