AMashenkov commented on code in PR #1629:
URL: https://github.com/apache/ignite-3/pull/1629#discussion_r1114990331


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/SortNode.java:
##########
@@ -38,16 +43,45 @@
     /** Rows buffer. */
     private final PriorityQueue<RowT> rows;
 
+    /** SQL select limit. Negative if disabled. */
+    private final int limit;
+
+    /** Reverse-ordered rows in case of limited sort. */
+    private List<RowT> reversed;

Review Comment:
   Also, I think we can reuse the same array for both structures: PriorityQueue 
and Stack.
   
   E.g. using ObjectHeapPriorityQueue and write trivial Stack implementation.
   Actually, PriorityQueue stores data in heap structure that is partially 
sorted.
   It looks easy to implement heap-sort algorithm to get the array sorted 
instantly.
   



-- 
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]

Reply via email to