alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r773663551



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java
##########
@@ -203,30 +203,38 @@ private void push() throws Exception {
             pushUnordered();
     }
 
-    /** */
-    private void pushOrdered() throws Exception {
-         PriorityQueue<Pair<Row, Buffer>> heap =
-            new PriorityQueue<>(Math.max(buffers.size(), 1), 
Map.Entry.comparingByKey(comp));
-
-        Iterator<Buffer> it = buffers.iterator();
-
+    /** Checks that all corresponding buffers are in ready state. */
+    private boolean checkAllBuffsReady(Iterator<Buffer> it) {
         while (it.hasNext()) {
             Buffer buf = it.next();
 
             switch (buf.check()) {
+                case READY:
+                    break;
                 case END:
                     it.remove();
-
-                    break;
-                case READY:
-                    heap.offer(Pair.of(buf.peek(), buf));
-
                     break;
                 case WAITING:
-
-                    return;
+                    return false;
             }
         }
+        return true;
+    }
+
+    /** */
+    private void pushOrdered() throws Exception {
+        if (!checkAllBuffsReady(buffers.iterator()))
+            return;
+
+        PriorityQueue<Pair<Row, Buffer>> heap =
+            new PriorityQueue<>(Math.max(buffers.size(), 1), 
Map.Entry.comparingByKey(comp));
+
+        for (Buffer buf : buffers) {
+            if (buf.check() == State.READY)

Review comment:
       Maybe just `assert buf.check() == State.READY : "Unexpected buffer 
state: " + buf.check();`?
   `buf.check()` - is not a simple getter, with current syntax it will be 
executed even if assertions are disabled.

##########
File path: modules/calcite/src/test/sql/sqlite/orderby/orderby1_10_2.test_ignore
##########
@@ -2070,10 +2069,6 @@ SELECT pk, col0 FROM tab4 WHERE col3 > 808 OR col0 IS 
NULL ORDER BY 1,2
 725
 8
 
-query I valuesort label-1200
-SELECT pk FROM tab0 WHERE (col3 < 204) AND col3 IN (SELECT col0 FROM tab0 
WHERE col3 >= 218) AND col4 IN (SELECT col1 FROM tab0 WHERE (((((col3 IN (427) 
OR col3 <= 404)))) OR ((col0 IS NULL AND (col4 > 802.10 AND col0 = 651))) OR 
col3 BETWEEN 851 AND 573)) ORDER BY 1 DESC
-----
-

Review comment:
       Why this query was deleted?




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