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-keyedDataStream
, a partition contains all records of a subtask. ForKeyedStream
, a partition contains all records of a key.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <ACC,R>
SingleOutputStreamOperator<R>aggregate(AggregateFunction<T,ACC,R> aggregateFunction)
Applies an aggregate transformation on the records of the window.<R> SingleOutputStreamOperator<R>
mapPartition(MapPartitionFunction<T,R> mapPartitionFunction)
Process the records of the window byMapPartitionFunction
.SingleOutputStreamOperator<T>
reduce(ReduceFunction<T> reduceFunction)
Applies a reduce transformation on the records of the window.SingleOutputStreamOperator<T>
sortPartition(int field, Order order)
Sorts the records of the window on the specified field in the specified order.SingleOutputStreamOperator<T>
sortPartition(String field, Order order)
Sorts the records of the window on the specified field in the specified order.<K> SingleOutputStreamOperator<T>
sortPartition(KeySelector<T,K> keySelector, Order order)
Sorts the records according to aKeySelector
in the specified order.
-
-
-
Method Detail
-
mapPartition
<R> SingleOutputStreamOperator<R> mapPartition(MapPartitionFunction<T,R> mapPartitionFunction)
Process the records of the window byMapPartitionFunction
.- 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(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(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, Order order)
Sorts the records of the window on the specified field in the specified order. The type of records must beTuple
.This operator will use managed memory for the sort.For
NonKeyedPartitionWindowedStream
, the managed memory size can be set byExecutionOptions.SORT_PARTITION_MEMORY
. ForKeyedPartitionWindowedStream
, the managed memory size can be set byExecutionOptions.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, Order order)
Sorts the records of the window on the specified field in the specified order. The type of records must be Flink POJOPojoTypeInfo
. 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 byExecutionOptions.SORT_PARTITION_MEMORY
. ForKeyedPartitionWindowedStream
, the managed memory size can be set byExecutionOptions.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(KeySelector<T,K> keySelector, Order order)
Sorts the records according to aKeySelector
in the specified order.This operator will use managed memory for the sort.For
NonKeyedPartitionWindowedStream
, the managed memory size can be set byExecutionOptions.SORT_PARTITION_MEMORY
. ForKeyedPartitionWindowedStream
, the managed memory size can be set byExecutionOptions.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.
-
-