Class ExternalPythonKeyedCoProcessOperator<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.BoundedMultiInput, org.apache.flink.streaming.api.operators.KeyContext, org.apache.flink.streaming.api.operators.KeyContextHandler, DataStreamPythonFunctionOperator<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,​org.apache.flink.runtime.state.VoidNamespace>, org.apache.flink.streaming.api.operators.TwoInputStreamOperator<org.apache.flink.types.Row,​org.apache.flink.types.Row,​OUT>, org.apache.flink.streaming.api.operators.YieldingOperator<OUT>
    Direct Known Subclasses:
    ExternalPythonBatchKeyedCoBroadcastProcessOperator

    @Internal
    public class ExternalPythonKeyedCoProcessOperator<OUT>
    extends AbstractExternalTwoInputPythonFunctionOperator<org.apache.flink.types.Row,​org.apache.flink.types.Row,​OUT>
    implements org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​org.apache.flink.runtime.state.VoidNamespace>
    ExternalPythonKeyedCoProcessOperator is responsible for launching beam runner which will start a python harness to execute user defined python CoProcess 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

      • ExternalPythonKeyedCoProcessOperator

        public ExternalPythonKeyedCoProcessOperator​(org.apache.flink.configuration.Configuration config,
                                                    DataStreamPythonFunctionInfo pythonFunctionInfo,
                                                    org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> inputTypeInfo1,
                                                    org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> inputTypeInfo2,
                                                    org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo)
    • Method Detail

      • processElement1

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

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

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

        public void onProcessingTime​(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,​org.apache.flink.runtime.state.VoidNamespace> timer)
                              throws Exception
        Specified by:
        onProcessingTime in interface org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,​org.apache.flink.runtime.state.VoidNamespace>
        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>