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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/CorrelatedNestedLoopJoinNode.java:
##########
@@ -406,20 +406,26 @@ private void join() throws Exception {
             }
 
             if (joinType == JoinRelType.LEFT && !nullOrEmpty(leftInBuf)) {
-                int notMatchedIdx = leftMatched.nextClearBit(0);
+                state = State.IN_LOOP;
 
-                while (requested > 0 && notMatchedIdx < leftInBuf.size()) {
-                    
downstream().push(handler.concat(leftInBuf.get(notMatchedIdx), rightEmptyRow));
+                try {
+                    int notMatchedIdx = leftMatched.nextClearBit(0);
 
-                    requested--;
+                    while (requested > 0 && notMatchedIdx < leftInBuf.size()) {
+                        requested--;
 
-                    leftMatched.set(notMatchedIdx);
+                        
downstream().push(handler.concat(leftInBuf.get(notMatchedIdx), rightEmptyRow));
 
-                    notMatchedIdx = leftMatched.nextClearBit(notMatchedIdx + 
1);
-                }
+                        leftMatched.set(notMatchedIdx);
 
-                if (requested == 0 && notMatchedIdx < leftInBuf.size()) {
-                    return; // Some rows required to be pushed, wait for 
request.
+                        notMatchedIdx = leftMatched.nextClearBit(notMatchedIdx 
+ 1);
+                    }
+
+                    if (requested == 0 && notMatchedIdx < leftInBuf.size()) {
+                        return; // Some rows required to be pushed, wait for 
request.
+                    }
+                } finally {
+                    state = State.IDLE;
                 }

Review Comment:
   Can you wrap only a `while` loop into try-finally ?



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