Class 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.SetupableStreamOperator<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>
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.flink.core.memory.ByteArrayInputStreamWithPos bais
      Reusable InputStream used to holding the execution results to be deserialized.
      protected org.apache.flink.core.memory.DataInputViewStreamWrapper baisWrapper
      InputStream Wrapper.
      protected org.apache.flink.core.memory.ByteArrayOutputStreamWithPos baos
      Reusable OutputStream used to holding the serialized input elements.
      protected org.apache.flink.core.memory.DataOutputViewStreamWrapper baosWrapper
      OutputStream Wrapper.
      protected org.apache.flink.table.types.logical.RowType inputType
      The input logical type.
      protected org.apache.flink.table.types.logical.RowType outputType
      The output logical type.
      protected StreamRecordRowDataWrappingCollector rowDataWrapper
      The collector used to collect records.
      protected org.apache.flink.table.types.logical.RowType userDefinedFunctionInputType
      The user-defined function input logical type.
      protected org.apache.flink.table.types.logical.RowType userDefinedFunctionOutputType
      The user-defined function output logical type.
      • Fields inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator

        chainingStrategy, lastRecordAttributes1, lastRecordAttributes2, latencyStats, LOG, metrics, output, processingTimeService, stateHandler, stateKeySelector1, stateKeySelector2, timeServiceManager
    • 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)  
    • 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.
    • 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

      • processElement

        public void processElement​(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.table.data.RowData> element)
                            throws Exception
        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<org.apache.flink.table.data.RowData>
      • 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<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)