...
We introduce the sortPartition
API in the PartitionWindowedStream, including three methods to sort records by different key extraction logics API in the PartitionWindowedStream, including four methods to sort records by different key extraction logics.
Code Block | ||
---|---|---|
| ||
public class PartitionWindowedStream<T> { /** * Sorts the records of the window on the specified field in the specified order. The type of * records must be atomic. An atomic type is a type that is treated as one indivisible unit and * can act as a key. Example atomic types are the basic types (int, long, String, ...) and * comparable custom classes. * * @param order The order in which records is sorted. * @return The resulting data stream with sorted records in each subtask. */ DataStream<T> sortPartition(Order order); /** * Sorts the records of the window on the specified field in the * specified order. The type of records must be {@link Tuple}. * * @param field The field index on which records is sorted. * @param order The order in which records is sorted. * @return The resulting data stream with sorted records in each subtask. */ public DataStream<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 be {@link Tuple} or POJO * class. The POJO class must be public and have getter and setter methods * for each field. It mustn't implement any interfaces or extend any * classes. * * @param field The field expression referring to the field on which * records is sorted. * @param order The order in which records is sorted. * @return The resulting data stream with sorted records in each subtask. */ public DataStream<T> sortPartition(String field, Order order) { ... } /** * Sorts the records of the window on the extracted key in the specified order. * * @param keySelector The KeySelector function which extracts the key * from records. * @param order The order in which records is sorted. * @return The resulting data stream with sorted records in each subtask. */ public <K> DataStream<T> sortPartition(KeySelector<T, K> keySelector, Order order) { ... } } |
...