use of org.apache.flink.table.runtime.operators.sort.RowTimeSortOperator in project flink by apache.
the class StreamExecTemporalSort method createSortRowTime.
/**
* Create Sort logic based on row time.
*/
private Transformation<RowData> createSortRowTime(RowType inputType, Transformation<RowData> inputTransform, ExecNodeConfig config) {
GeneratedRecordComparator rowComparator = null;
if (sortSpec.getFieldSize() > 1) {
// skip the first field which is the rowtime field and would be ordered by timer.
SortSpec specExcludeTime = sortSpec.createSubSortSpec(1);
rowComparator = ComparatorCodeGenerator.gen(config.getTableConfig(), "RowTimeSortComparator", inputType, specExcludeTime);
}
RowTimeSortOperator sortOperator = new RowTimeSortOperator(InternalTypeInfo.of(inputType), sortSpec.getFieldSpec(0).getFieldIndex(), rowComparator);
OneInputTransformation<RowData, RowData> transform = ExecNodeUtil.createOneInputTransformation(inputTransform, createTransformationMeta(TEMPORAL_SORT_TRANSFORMATION, config), sortOperator, InternalTypeInfo.of(inputType), inputTransform.getParallelism());
if (inputsContainSingleton()) {
transform.setParallelism(1);
transform.setMaxParallelism(1);
}
EmptyRowDataKeySelector selector = EmptyRowDataKeySelector.INSTANCE;
transform.setStateKeySelector(selector);
transform.setStateKeyType(selector.getProducedType());
return transform;
}
Aggregations