@Internal public class PythonKeyedProcessOperator<OUT> extends AbstractOneInputPythonFunctionOperator<org.apache.flink.types.Row,OUT> implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>, org.apache.flink.streaming.api.operators.Triggerable<org.apache.flink.types.Row,Object>
PythonKeyedProcessOperator 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.elementCount, maxBundleSize, pythonFunctionRunner| Constructor and Description |
|---|
PythonKeyedProcessOperator(org.apache.flink.configuration.Configuration config,
org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo,
DataStreamPythonFunctionInfo pythonFunctionInfo) |
PythonKeyedProcessOperator(org.apache.flink.configuration.Configuration config,
org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo,
DataStreamPythonFunctionInfo pythonFunctionInfo,
org.apache.flink.api.common.typeutils.TypeSerializer namespaceSerializer) |
| Modifier and Type | Method and Description |
|---|---|
PythonFunctionRunner |
createPythonFunctionRunner()
Creates the
PythonFunctionRunner which is responsible for Python user-defined
function execution. |
void |
emitResult(org.apache.flink.api.java.tuple.Tuple2<byte[],Integer> resultTuple)
Sends the execution result to the downstream operator.
|
Object |
getCurrentKey() |
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> |
getProducedType() |
org.apache.flink.table.functions.python.PythonEnv |
getPythonEnv()
Returns the
PythonEnv used to create PythonEnvironmentManager.. |
void |
onEventTime(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,Object> timer) |
void |
onProcessingTime(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,Object> timer) |
void |
open() |
void |
processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.types.Row> element) |
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.
|
endInputcheckInvokeFinishBundleByCount, close, createPythonEnvironmentManager, dispose, emitResults, getConfig, getFlinkMetricContainer, getPythonConfig, invokeFinishBundle, isBundleFinished, prepareSnapshotPreBarrier, processWatermark, setPythonConfiggetChainingStrategy, getContainingTask, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark1, processWatermark2, reportOrForwardLatencyMarker, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, setup, snapshotState, snapshotStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetKeyContextElementclose, dispose, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotStatepublic PythonKeyedProcessOperator(org.apache.flink.configuration.Configuration config,
org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo,
DataStreamPythonFunctionInfo pythonFunctionInfo)
public PythonKeyedProcessOperator(org.apache.flink.configuration.Configuration config,
org.apache.flink.api.java.typeutils.RowTypeInfo inputTypeInfo,
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outputTypeInfo,
DataStreamPythonFunctionInfo pythonFunctionInfo,
org.apache.flink.api.common.typeutils.TypeSerializer namespaceSerializer)
public void open()
throws Exception
open in interface org.apache.flink.streaming.api.operators.StreamOperator<OUT>open in class AbstractPythonFunctionOperator<OUT>Exceptionpublic org.apache.flink.api.common.typeinfo.TypeInformation<OUT> getProducedType()
getProducedType in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<OUT>public void onEventTime(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,Object> timer) throws Exception
public void onProcessingTime(org.apache.flink.streaming.api.operators.InternalTimer<org.apache.flink.types.Row,Object> timer) throws Exception
public PythonFunctionRunner createPythonFunctionRunner() throws Exception
AbstractPythonFunctionOperatorPythonFunctionRunner which is responsible for Python user-defined
function execution.createPythonFunctionRunner in class AbstractPythonFunctionOperator<OUT>Exceptionpublic org.apache.flink.table.functions.python.PythonEnv getPythonEnv()
AbstractPythonFunctionOperatorPythonEnv used to create PythonEnvironmentManager..getPythonEnv in class AbstractPythonFunctionOperator<OUT>public void emitResult(org.apache.flink.api.java.tuple.Tuple2<byte[],Integer> resultTuple) throws Exception
AbstractPythonFunctionOperatoremitResult in class AbstractPythonFunctionOperator<OUT>Exceptionpublic void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.types.Row> element)
throws Exception
processElement in interface org.apache.flink.streaming.api.operators.Input<org.apache.flink.types.Row>Exceptionpublic void setCurrentKey(Object key)
setCurrentKey in interface org.apache.flink.streaming.api.operators.KeyContextsetCurrentKey in class AbstractPythonFunctionOperator<OUT>Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.