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 forAbstractPythonStreamGroupAggregateOperatorandPythonStreamGroupWindowAggregateOperator.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.flink.core.memory.ByteArrayInputStreamWithPosbaisReusable InputStream used to holding the execution results to be deserialized.protected org.apache.flink.core.memory.DataInputViewStreamWrapperbaisWrapperInputStream Wrapper.protected org.apache.flink.core.memory.ByteArrayOutputStreamWithPosbaosReusable OutputStream used to holding the serialized input elements.protected org.apache.flink.core.memory.DataOutputViewStreamWrapperbaosWrapperOutputStream Wrapper.protected org.apache.flink.table.types.logical.RowTypeinputTypeThe input logical type.protected org.apache.flink.table.types.logical.RowTypeoutputTypeThe output logical type.protected StreamRecordRowDataWrappingCollectorrowDataWrapperThe collector used to collect records.protected org.apache.flink.table.types.logical.RowTypeuserDefinedFunctionInputTypeThe user-defined function input logical type.protected org.apache.flink.table.types.logical.RowTypeuserDefinedFunctionOutputTypeThe user-defined function output logical type.-
Fields inherited from class org.apache.flink.streaming.api.operators.python.process.AbstractExternalPythonFunctionOperator
pythonFunctionRunner
-
Fields inherited from class org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator
bundleFinishedCallback, config, elementCount, lastFinishBundleTime, maxBundleSize, systemEnvEnabled
-
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FlinkFnApi.CoderInfoDescriptorcreateInputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerInputType)FlinkFnApi.CoderInfoDescriptorcreateOutputCoderInfoDescriptor(org.apache.flink.table.types.logical.RowType runnerOutType)PythonFunctionRunnercreatePythonFunctionRunner()Creates thePythonFunctionRunnerwhich is responsible for Python user-defined function execution.abstract org.apache.flink.table.types.logical.RowTypecreateUserDefinedFunctionInputType()abstract org.apache.flink.table.types.logical.RowTypecreateUserDefinedFunctionOutputType()ObjectgetCurrentKey()abstract StringgetFunctionUrn()protected org.apache.flink.table.types.logical.RowTypegetKeyType()org.apache.flink.table.functions.python.PythonEnvgetPythonEnv()Returns thePythonEnvused to create PythonEnvironmentManager..protected FlinkFnApi.UserDefinedAggregateFunctionsgetUserDefinedFunctionsProto()Gets 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
endInput
-
Methods inherited from class org.apache.flink.streaming.api.operators.python.process.AbstractExternalPythonFunctionOperator
close, createPythonEnvironmentManager, drainUnregisteredTimers, emitResult, emitResults, invokeFinishBundle
-
Methods inherited from class org.apache.flink.streaming.api.operators.python.AbstractPythonFunctionOperator
checkInvokeFinishBundleByCount, finish, getConfiguration, getFlinkMetricContainer, isBundleFinished, prepareSnapshotPreBarrier, processWatermark
-
Methods 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, isAsyncKeyOrderedProcessingEnabled, 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, useSplittableTimers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointComplete
-
Methods inherited from interface org.apache.flink.streaming.api.operators.Input
processLatencyMarker, processRecordAttributes, processWatermark, processWatermark, processWatermarkStatus
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContextHandler
hasKeyContext
-
-
-
-
Field Detail
-
inputType
protected final org.apache.flink.table.types.logical.RowType inputType
The input logical type.
-
outputType
protected final org.apache.flink.table.types.logical.RowType outputType
The output logical type.
-
userDefinedFunctionInputType
protected transient org.apache.flink.table.types.logical.RowType userDefinedFunctionInputType
The user-defined function input logical type.
-
userDefinedFunctionOutputType
protected transient org.apache.flink.table.types.logical.RowType userDefinedFunctionOutputType
The user-defined function output logical type.
-
bais
protected transient org.apache.flink.core.memory.ByteArrayInputStreamWithPos bais
Reusable InputStream used to holding the execution results to be deserialized.
-
baisWrapper
protected transient org.apache.flink.core.memory.DataInputViewStreamWrapper baisWrapper
InputStream Wrapper.
-
baos
protected transient org.apache.flink.core.memory.ByteArrayOutputStreamWithPos baos
Reusable OutputStream used to holding the serialized input elements.
-
baosWrapper
protected transient org.apache.flink.core.memory.DataOutputViewStreamWrapper baosWrapper
OutputStream Wrapper.
-
rowDataWrapper
protected transient StreamRecordRowDataWrappingCollector rowDataWrapper
The collector used to collect records.
-
-
Constructor Detail
-
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 Detail
-
open
public void open() throws Exception- 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
public PythonFunctionRunner createPythonFunctionRunner() throws Exception
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
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:
setCurrentKeyin interfaceorg.apache.flink.streaming.api.operators.KeyContext- Overrides:
setCurrentKeyin classAbstractPythonFunctionOperator<org.apache.flink.table.data.RowData>
-
getCurrentKey
public Object 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
protected FlinkFnApi.UserDefinedAggregateFunctions getUserDefinedFunctionsProto()
Gets the proto representation of the Python user-defined aggregate functions to be executed.
-
getFunctionUrn
public abstract String 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)
-
-