Class AbstractPythonStreamAggregateOperator
java.lang.Object
org.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>
org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator<OUT>
org.apache.flink.streaming.api.operators.python.process.AbstractExternalPythonFunctionOperator<OUT>
org.apache.flink.table.runtime.operators.python.AbstractOneInputPythonFunctionOperator<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
org.apache.flink.table.runtime.operators.python.aggregate.AbstractPythonStreamAggregateOperator
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.streaming.api.operators.BoundedOneInput,org.apache.flink.streaming.api.operators.Input<org.apache.flink.table.data.RowData>,org.apache.flink.streaming.api.operators.KeyContext,org.apache.flink.streaming.api.operators.KeyContextHandler,org.apache.flink.streaming.api.operators.OneInputStreamOperator<org.apache.flink.table.data.RowData,,org.apache.flink.table.data.RowData> org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.table.data.RowData>,org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator,org.apache.flink.streaming.api.operators.YieldingOperator<org.apache.flink.table.data.RowData>
- Direct Known Subclasses:
AbstractPythonStreamGroupAggregateOperator,PythonStreamGroupWindowAggregateOperator
@Internal
public abstract class AbstractPythonStreamAggregateOperator
extends AbstractOneInputPythonFunctionOperator<org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
Base class for
AbstractPythonStreamGroupAggregateOperator and PythonStreamGroupWindowAggregateOperator.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.flink.core.memory.ByteArrayInputStreamWithPosReusable InputStream used to holding the execution results to be deserialized.protected org.apache.flink.core.memory.DataInputViewStreamWrapperInputStream Wrapper.protected org.apache.flink.core.memory.ByteArrayOutputStreamWithPosReusable OutputStream used to holding the serialized input elements.protected org.apache.flink.core.memory.DataOutputViewStreamWrapperOutputStream Wrapper.protected final org.apache.flink.table.types.logical.RowTypeThe input logical type.protected final org.apache.flink.table.types.logical.RowTypeThe output logical type.protected StreamRecordRowDataWrappingCollectorThe collector used to collect records.protected org.apache.flink.table.types.logical.RowTypeThe user-defined function input logical type.protected org.apache.flink.table.types.logical.RowTypeThe user-defined function output logical type.Fields inherited from class org.apache.flink.streaming.api.operators.python.process.AbstractExternalPythonFunctionOperator
pythonFunctionRunnerFields inherited from class org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator
bundleFinishedCallback, config, elementCount, lastFinishBundleTime, maxBundleSize, systemEnvEnabledFields inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
combinedWatermark, lastRecordAttributes1, lastRecordAttributes2, latencyStats, LOG, metrics, output, processingTimeService, stateHandler, stateKeySelector1, stateKeySelector2, timeServiceManager -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPythonStreamAggregateOperator(org.apache.flink.configuration.Configuration config, org.apache.flink.table.types.logical.RowType inputType, org.apache.flink.table.types.logical.RowType outputType, org.apache.flink.table.functions.python.PythonAggregateFunctionInfo[] aggregateFunctions, org.apache.flink.table.runtime.dataview.DataViewSpec[][] dataViewSpecs, int[] grouping, int indexOfCountStar, boolean generateUpdateBefore) -
Method Summary
Modifier and TypeMethodDescriptioncreateInputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerInputType) createOutputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerOutType) Creates thePythonFunctionRunnerwhich is responsible for Python user-defined function execution.abstract org.apache.flink.table.types.logical.RowTypeabstract org.apache.flink.table.types.logical.RowTypeabstract Stringprotected org.apache.flink.table.types.logical.RowTypeorg.apache.flink.table.functions.python.PythonEnvReturns thePythonEnvused to create PythonEnvironmentManager..protected FlinkFnApi.UserDefinedAggregateFunctionsGets the proto representation of the Python user-defined aggregate functions to be executed.voidopen()voidprocessElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.table.data.RowData> element) abstract voidprocessElementInternal(org.apache.flink.table.data.RowData value) voidsetCurrentKey(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.Methods inherited from class org.apache.flink.table.runtime.operators.python.AbstractOneInputPythonFunctionOperator
endInputMethods inherited from class org.apache.flink.streaming.api.operators.python.process.AbstractExternalPythonFunctionOperator
close, createPythonEnvironmentManager, drainUnregisteredTimers, emitResult, emitResults, invokeFinishBundleMethods inherited from class org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator
checkInvokeFinishBundleByCount, finish, getConfiguration, getFlinkMetricContainer, isBundleFinished, prepareSnapshotPreBarrier, processWatermarkMethods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
beforeInitializeStateHandler, getContainingTask, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getStateKeySelector1, getStateKeySelector2, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, initializeState, isAsyncStateProcessingEnabled, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark, processWatermark1, processWatermark1, processWatermark2, processWatermark2, processWatermarkStatus, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setKeyContextElement1, setKeyContextElement2, setMailboxExecutor, setProcessingTimeService, setup, snapshotState, snapshotState, useSplittableTimersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointCompleteMethods inherited from interface org.apache.flink.streaming.api.operators.Input
processLatencyMarker, processRecordAttributes, processWatermark, processWatermark, processWatermarkStatusMethods inherited from interface org.apache.flink.streaming.api.operators.KeyContextHandler
hasKeyContextMethods inherited from interface org.apache.flink.streaming.api.operators.OneInputStreamOperator
setKeyContextElementMethods inherited from interface org.apache.flink.streaming.api.operators.StreamOperator
close, finish, getMetricGroup, getOperatorAttributes, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
-
Field Details
-
inputType
protected final org.apache.flink.table.types.logical.RowType inputTypeThe input logical type. -
outputType
protected final org.apache.flink.table.types.logical.RowType outputTypeThe output logical type. -
userDefinedFunctionInputType
protected transient org.apache.flink.table.types.logical.RowType userDefinedFunctionInputTypeThe user-defined function input logical type. -
userDefinedFunctionOutputType
protected transient org.apache.flink.table.types.logical.RowType userDefinedFunctionOutputTypeThe user-defined function output logical type. -
bais
protected transient org.apache.flink.core.memory.ByteArrayInputStreamWithPos baisReusable InputStream used to holding the execution results to be deserialized. -
baisWrapper
protected transient org.apache.flink.core.memory.DataInputViewStreamWrapper baisWrapperInputStream Wrapper. -
baos
protected transient org.apache.flink.core.memory.ByteArrayOutputStreamWithPos baosReusable OutputStream used to holding the serialized input elements. -
baosWrapper
protected transient org.apache.flink.core.memory.DataOutputViewStreamWrapper baosWrapperOutputStream Wrapper. -
rowDataWrapper
The collector used to collect records.
-
-
Constructor Details
-
AbstractPythonStreamAggregateOperator
public AbstractPythonStreamAggregateOperator(org.apache.flink.configuration.Configuration config, org.apache.flink.table.types.logical.RowType inputType, org.apache.flink.table.types.logical.RowType outputType, org.apache.flink.table.functions.python.PythonAggregateFunctionInfo[] aggregateFunctions, org.apache.flink.table.runtime.dataview.DataViewSpec[][] dataViewSpecs, int[] grouping, int indexOfCountStar, boolean generateUpdateBefore)
-
-
Method Details
-
open
- Specified by:
openin interfaceorg.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.table.data.RowData>- Overrides:
openin classAbstractExternalPythonFunctionOperator<org.apache.flink.table.data.RowData>- Throws:
Exception
-
processElement
public void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.table.data.RowData> element) throws Exception - Throws:
Exception
-
createPythonFunctionRunner
Description copied from class:AbstractExternalPythonFunctionOperatorCreates thePythonFunctionRunnerwhich is responsible for Python user-defined function execution.- Specified by:
createPythonFunctionRunnerin classAbstractExternalPythonFunctionOperator<org.apache.flink.table.data.RowData>- Throws:
Exception
-
setCurrentKey
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:
setCurrentKeyin interfaceorg.apache.flink.streaming.api.operators.KeyContext- Overrides:
setCurrentKeyin classAbstractPythonFunctionOperator<org.apache.flink.table.data.RowData>
-
getCurrentKey
- Specified by:
getCurrentKeyin interfaceorg.apache.flink.streaming.api.operators.KeyContext- Overrides:
getCurrentKeyin classorg.apache.flink.streaming.api.operators.AbstractStreamOperator<org.apache.flink.table.data.RowData>
-
getPythonEnv
public org.apache.flink.table.functions.python.PythonEnv getPythonEnv()Description copied from class:AbstractExternalPythonFunctionOperatorReturns thePythonEnvused to create PythonEnvironmentManager..- Specified by:
getPythonEnvin classAbstractExternalPythonFunctionOperator<org.apache.flink.table.data.RowData>
-
getKeyType
protected org.apache.flink.table.types.logical.RowType getKeyType() -
getUserDefinedFunctionsProto
Gets the proto representation of the Python user-defined aggregate functions to be executed. -
getFunctionUrn
-
processElementInternal
public abstract void processElementInternal(org.apache.flink.table.data.RowData value) throws Exception - Throws:
Exception
-
createUserDefinedFunctionInputType
public abstract org.apache.flink.table.types.logical.RowType createUserDefinedFunctionInputType() -
createUserDefinedFunctionOutputType
public abstract org.apache.flink.table.types.logical.RowType createUserDefinedFunctionOutputType() -
createInputCoderInfoDescriptor
public FlinkFnApi.CoderInfoDescriptor createInputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerInputType) -
createOutputCoderInfoDescriptor
public FlinkFnApi.CoderInfoDescriptor createOutputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerOutType)
-