Class ExternalPythonKeyedProcessOperator<OUT>

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>, org.apache.flink.streaming.api.operators.BoundedOneInput, org.apache.flink.streaming.api.operators.Input<org.apache.flink.types.Row>, org.apache.flink.streaming.api.operators.KeyContext, org.apache.flink.streaming.api.operators.KeyContextHandler, org.apache.flink.streaming.api.operators.OneInputStreamOperator<org.apache.flink.types.Row,​OUT>, DataStreamPythonFunctionOperator<OUT>, org.apache.flink.streaming.api.operators.SetupableStreamOperator<OUT>, org.apache.flink.streaming.api.operators.StreamOperator<OUT>, org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator, org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​Object>

    @Internal
    public class ExternalPythonKeyedProcessOperator<OUT>
    extends AbstractExternalOneInputPythonFunctionOperator<org.apache.flink.types.Row,​OUT>
    implements org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​Object>
    ExternalPythonKeyedProcessOperator is responsible for launching beam runner which will start a python harness to execute user defined python function. It is also able to handle the timer and state request from the python stateful user defined function.
    See Also:
    Serialized Form
    • Constructor Detail

      • ExternalPythonKeyedProcessOperator

        public ExternalPythonKeyedProcessOperator​(org.apache.flink.configuration.Configuration config,
                                                  DataStreamPythonFunctionInfo pythonFunctionInfo,
                                                  org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
                                                  org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo)
      • ExternalPythonKeyedProcessOperator

        public ExternalPythonKeyedProcessOperator​(org.apache.flink.configuration.Configuration config,
                                                  DataStreamPythonFunctionInfo pythonFunctionInfo,
                                                  org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
                                                  org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo,
                                                  org.apache.flink.api.common.typeutils.TypeSerializer namespaceSerializer)
    • Method Detail

      • onEventTime

        public void onEventTime​(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,​Object> timer)
                         throws Exception
        Specified by:
        onEventTime in interface org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​Object>
        Throws:
        Exception
      • onProcessingTime

        public void onProcessingTime​(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,​Object> timer)
                              throws Exception
        Specified by:
        onProcessingTime in interface org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​Object>
        Throws:
        Exception
      • processElement

        public void processElement​(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.types.Row> element)
                            throws Exception
        Specified by:
        processElement in interface org.apache.flink.streaming.api.operators.Input<OUT>
        Throws:
        Exception
      • setCurrentKey

        public void setCurrentKey​(Object key)
        As the beam state gRPC service will access the KeyedStateBackend in parallel with this operator, we must override this method to prevent changing the current key of the KeyedStateBackend while the beam service is handling requests.
        Specified by:
        setCurrentKey in interface org.apache.flink.streaming.api.operators.KeyContext
        Overrides:
        setCurrentKey in class AbstractPythonFunctionOperator<OUT>
      • getCurrentKey

        public Object getCurrentKey()
        Specified by:
        getCurrentKey in interface org.apache.flink.streaming.api.operators.KeyContext
        Overrides:
        getCurrentKey in class org.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>