alex-plekhanov commented on code in PR #11977:
URL: https://github.com/apache/ignite/pull/11977#discussion_r2212859928


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java:
##########
@@ -772,14 +737,13 @@ else if (cmp > 0) {
                 inLoop = false;
             }
 
-            if (waitingRight == 0)
-                rightSource().request(waitingRight = IN_BUFFER_SIZE);
+            if (requested > 0 && rightFinished(true) && (!distributed || 
waitingRight == NOT_WAITING)) {

Review Comment:
   Not correct condition, for distributed join both hands should be drained



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java:
##########
@@ -523,17 +493,10 @@ public RightJoin(
                 }
             }
 
-            if (waitingRight == 0)
-                rightSource().request(waitingRight = IN_BUFFER_SIZE);
-
-            if (waitingLeft == 0 && leftInBuf.isEmpty())
-                leftSource().request(waitingLeft = IN_BUFFER_SIZE);
+            if ((rightNotMatchedIndexes == null || 
rightNotMatchedIndexes.isEmpty()) && checkJoinFinished())

Review Comment:
   F.isEmpty(rightNotMatchedIndexes)



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java:
##########
@@ -213,12 +242,33 @@ protected Node<Row> rightSource() {
     /** */
     protected abstract void join() throws Exception;
 
-    /** */
-    protected void checkJoinFinished() throws Exception {
-        if (!distributed || (waitingLeft == NOT_WAITING && waitingRight == 
NOT_WAITING)) {
+    /** Checks if finished considering strictly one shoulder. */
+    protected boolean checkFinished(boolean leftShoulder) throws Exception {
+        return checkFinished(leftShoulder ? -1 : 1, false);
+    }
+
+    /**
+     * Checks if finished. Can take in account one or both shoulders.
+     *
+     * @param shoulder If <0, checks the only left input. If is 0, checks both 
inputs. If >0, checks only right input.
+     * @param strict Works with only with {@code input} == 0. If {@code true}, 
checks both inputs. Otherwise, checks any input.
+     */
+    protected boolean checkFinished(int shoulder, boolean strict) throws 
Exception {

Review Comment:
   Last item still not fixed



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to