public class SortUtils extends Object
toPaimonDataStream add key column range shuffle by key local sort remove key
DataStream[RowData] --------------------> DataStream[PaimonRowData] -------------------> DataStream[PaimonRowData] -------------------------> DataStream[PaimonRowData] -----------------------> DataStream[PaimonRowData sorted] ---------------------> DataStream[RowData sorted]
back to flink RowData
| Constructor and Description |
|---|
SortUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <KEY> org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.table.data.RowData> |
sortStreamByKey(org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.table.data.RowData> inputStream,
FileStoreTable table,
RowType sortKeyType,
org.apache.flink.api.common.typeinfo.TypeInformation<KEY> keyTypeInformation,
SerializableSupplier<Comparator<KEY>> shuffleKeyComparator,
org.apache.paimon.flink.sorter.SortUtils.KeyAbstract<KEY> shuffleKeyAbstract,
org.apache.paimon.flink.sorter.SortUtils.ShuffleKeyConvertor<KEY> convertor,
TableSortInfo tableSortInfo)
Sort the input stream by the key specified.
|
public static <KEY> org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.table.data.RowData> sortStreamByKey(org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.table.data.RowData> inputStream,
FileStoreTable table,
RowType sortKeyType,
org.apache.flink.api.common.typeinfo.TypeInformation<KEY> keyTypeInformation,
SerializableSupplier<Comparator<KEY>> shuffleKeyComparator,
org.apache.paimon.flink.sorter.SortUtils.KeyAbstract<KEY> shuffleKeyAbstract,
org.apache.paimon.flink.sorter.SortUtils.ShuffleKeyConvertor<KEY> convertor,
TableSortInfo tableSortInfo)
KEY - the KEY type in range shuffleinputStream - the input data streamtable - the sorted file store tablesortKeyType - we will use paimon `BinaryExternalSortBuffer` to local sort, so we need to
specify the key type.keyTypeInformation - we will use range shuffle in global sort, so we need to range
shuffle by the key first.shuffleKeyComparator - comparator to compare the key when shuffleshuffleKeyAbstract - abstract the key from the input `RowData`convertor - convert the `KEY` to the sort key, then we can sort in
`BinaryExternalSortBuffer`.tableSortInfo - the necessary info of table sort.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.