You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/11/08 19:45:37 UTC

[GitHub] [druid] gianm opened a new pull request #11890: HashJoinEngine: Fix extraneous advance of left cursor.

gianm opened a new pull request #11890:
URL: https://github.com/apache/druid/pull/11890


   This could happen for right or full outer joins in certain cases. Tests
   weren't catching this because existing Cursor implementations generally
   ignore extraneous calls to "advance". So, to help catch this in tests,
   extra state validations are also added to RowWalker, which is used by
   RowBasedSegment.


-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] gianm merged pull request #11890: HashJoinEngine: Fix extraneous advance of left cursor.

Posted by GitBox <gi...@apache.org>.
gianm merged pull request #11890:
URL: https://github.com/apache/druid/pull/11890


   


-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] gianm commented on a change in pull request #11890: HashJoinEngine: Fix extraneous advance of left cursor.

Posted by GitBox <gi...@apache.org>.
gianm commented on a change in pull request #11890:
URL: https://github.com/apache/druid/pull/11890#discussion_r745935843



##########
File path: processing/src/main/java/org/apache/druid/segment/RowWalker.java
##########
@@ -60,13 +61,16 @@ public T currentRow()
 
   public void advance()
   {
-    if (rowIterator.hasNext()) {
+    if (rowIterator == null) {
+      throw new IllegalStateException("cannot call advance when isDone == true");

Review comment:
       Note to reviewers: adding this check, without the patch to HashJoinEngine, causes a few of the tests to fail and illustrates the problem where `advance` is called on a cursor that has no more rows left.




-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] jihoonson commented on a change in pull request #11890: HashJoinEngine: Fix extraneous advance of left cursor.

Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #11890:
URL: https://github.com/apache/druid/pull/11890#discussion_r745947647



##########
File path: processing/src/main/java/org/apache/druid/segment/RowWalker.java
##########
@@ -60,13 +61,16 @@ public T currentRow()
 
   public void advance()
   {
-    if (rowIterator.hasNext()) {
+    if (rowIterator == null) {
+      throw new IllegalStateException("cannot call advance when isDone == true");
+    } else if (rowIterator.hasNext()) {
       current = rowIterator.next();
 
       if (current == null) {
         throw new NullPointerException("null row encountered in walker");
       }
     } else {
+      rowIterator = null;

Review comment:
       nit: perhaps better do `assert rowIterator == null` in `isDone()`.




-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] gianm commented on a change in pull request #11890: HashJoinEngine: Fix extraneous advance of left cursor.

Posted by GitBox <gi...@apache.org>.
gianm commented on a change in pull request #11890:
URL: https://github.com/apache/druid/pull/11890#discussion_r745950985



##########
File path: processing/src/main/java/org/apache/druid/segment/RowWalker.java
##########
@@ -60,13 +61,16 @@ public T currentRow()
 
   public void advance()
   {
-    if (rowIterator.hasNext()) {
+    if (rowIterator == null) {
+      throw new IllegalStateException("cannot call advance when isDone == true");
+    } else if (rowIterator.hasNext()) {
       current = rowIterator.next();
 
       if (current == null) {
         throw new NullPointerException("null row encountered in walker");
       }
     } else {
+      rowIterator = null;

Review comment:
       Makes sense to me, but that's gonna get changed in #11886 anyway.




-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org