davidradl commented on code in PR #27188:
URL: https://github.com/apache/flink/pull/27188#discussion_r2490216630
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sort/SortLimitOperator.java:
##########
@@ -92,12 +92,11 @@ public void processElement(StreamRecord<RowData> element)
throws Exception {
@Override
public void endInput() throws Exception {
if (isGlobal) {
- // Global sort, we need sort the results and pick records in
limitStart to limitEnd.
- List<RowData> list = new ArrayList<>(heap);
- list.sort((o1, o2) -> comparator.compare(o1, o2));
-
- int maxIndex = (int) Math.min(limitEnd, list.size());
- for (int i = (int) limitStart; i < maxIndex; i++) {
+ List<RowData> list = new ArrayList<>((int) (heap.size() -
limitStart));
Review Comment:
a couple of thoughts:
-I see this is a new way of sorting using the heap. I wonder if it is now
sorted differently so there is a change in behaviour.
- I would like to see a unit test for this to ensure there is no regression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]