Status
Current state: Accepted
Discussion thread: https://lists.apache.org/thread/5lyjrrdtwkngkol2t541r4xwoh7133km
Vote thread: https://lists.apache.org/thread/owq9cwxooty237phbc55c3ko43rw9lww
JIRA:
Released: <Flink Version>
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
The open() method in RichFunction requires a Configuration instance as an argument, which is always passed as a new instance without any configuration parameters in AbstractUdfStreamOperator#open. Thus, it is unnecessary to include this parameter in the open() method. To keep the signature, we can replace the Configuration argument with an OpenContext. The OpenContext is able to add new parameters in the future.
Public Interfaces
Modify the RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext context).
Proposed Changes
There are two steps to modify the RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext context).
First step, add a new method open() to RichFunction interface. Implement the open(OpenContext context) and make open(Configuration parameters) invoke it in the implementations of RichFunction.
The configuration parameter is always empty so the implementations of RichFunction#open(Configuration parameters) should't get value from configuration and just use the default value. There are three classes that still get value from configuration: ContinuousFileMonitoringFunction#open, OutputFormatSinkFunction#open, InputFormatSourceFunction#open. The three methods should be modified to use the default value instead of getting value from configuration.
Second step, mark the open(Configuration parameters) as deprecated and remove open(Configuration parameters) in next major release.
Compatibility, Deprecation, and Migration Plan
- What impact (if any) will there be on existing users?
For the users that rely on the open() method, they will have to migrate to the no parameter variants. This migration shouldn't be difficult.
As the RichFunction abstract class is part of the public API we will deprecate the method 2 releases before removal.