Interface PartitionWindowedStream<T>

  • Type Parameters:
    T - The type of the elements in this stream.
    All Known Implementing Classes:
    KeyedPartitionWindowedStream, NonKeyedPartitionWindowedStream

    @PublicEvolving
    public interface PartitionWindowedStream<T>
    PartitionWindowedStream represents a data stream that collects all records of each partition separately into a full window. Window emission will be triggered at the end of inputs. For non-keyed DataStream, a partition contains all records of a subtask. For KeyedStream, a partition contains all records of a key.
    • Method Detail

      • mapPartition

        <R> SingleOutputStreamOperator<R> mapPartition​(org.apache.flink.api.common.functions.MapPartitionFunction<T,​R> mapPartitionFunction)
        Process the records of the window by MapPartitionFunction.
        Type Parameters:
        R - The type of map partition result.
        Parameters:
        mapPartitionFunction - The map partition function.
        Returns:
        The data stream with map partition result.
      • reduce

        SingleOutputStreamOperator<T> reduce​(org.apache.flink.api.common.functions.ReduceFunction<T> reduceFunction)
        Applies a reduce transformation on the records of the window.
        Parameters:
        reduceFunction - The reduce function.
        Returns:
        The data stream with final reduced result.
      • aggregate

        <ACC,​R> SingleOutputStreamOperator<R> aggregate​(org.apache.flink.api.common.functions.AggregateFunction<T,​ACC,​R> aggregateFunction)
        Applies an aggregate transformation on the records of the window.
        Type Parameters:
        ACC - The type of accumulator in aggregate function.
        R - The type of aggregate function result.
        Parameters:
        aggregateFunction - The aggregate function.
        Returns:
        The data stream with final aggregated result.
      • sortPartition

        SingleOutputStreamOperator<T> sortPartition​(int field,
                                                    org.apache.flink.api.common.operators.Order order)
        Sorts the records of the window on the specified field in the specified order. The type of records must be Tuple.

        This operator will use managed memory for the sort.For NonKeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_PARTITION_MEMORY. For KeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_KEYED_PARTITION_MEMORY.

        Parameters:
        field - The field 1-based index on which records is sorted.
        order - The order in which records is sorted.
        Returns:
        The data stream with sorted records.
      • sortPartition

        SingleOutputStreamOperator<T> sortPartition​(String field,
                                                    org.apache.flink.api.common.operators.Order order)
        Sorts the records of the window on the specified field in the specified order. The type of records must be Flink POJO PojoTypeInfo. A type is considered a Flink POJO type, if it fulfills the conditions below.
        • It is a public class, and standalone (not a non-static inner class).
        • It has a public no-argument constructor.
        • All non-static, non-transient fields in the class (and all superclasses) are either public (and non-final) or have a public getter and a setter method that follows the Java beans naming conventions for getters and setters.
        • It is a fixed-length, null-aware composite type with non-deterministic field order. Every field can be null independent of the field's type.

        This operator will use managed memory for the sort.For NonKeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_PARTITION_MEMORY. For KeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_KEYED_PARTITION_MEMORY.

        Parameters:
        field - The field expression referring to the field on which records is sorted.
        order - The order in which records is sorted.
        Returns:
        The data stream with sorted records.
      • sortPartition

        <K> SingleOutputStreamOperator<T> sortPartition​(org.apache.flink.api.java.functions.KeySelector<T,​K> keySelector,
                                                        org.apache.flink.api.common.operators.Order order)
        Sorts the records according to a KeySelector in the specified order.

        This operator will use managed memory for the sort.For NonKeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_PARTITION_MEMORY. For KeyedPartitionWindowedStream, the managed memory size can be set by ExecutionOptions.SORT_KEYED_PARTITION_MEMORY.

        Parameters:
        keySelector - The key selector to extract key from the records for sorting.
        order - The order in which records is sorted.
        Returns:
        The data stream with sorted records.