rtpsw commented on code in PR #13880:
URL: https://github.com/apache/arrow/pull/13880#discussion_r962014262


##########
cpp/src/arrow/compute/exec/asof_join_node.cc:
##########
@@ -714,20 +1089,26 @@ class AsofJoinNode : public ExecNode {
     DCHECK_EQ(output, outputs_[0]);
     StopProducing();
   }
-  void StopProducing() override { finished_.MarkFinished(); }
+  void StopProducing() override {
+    // avoid finishing twice, to prevent "Plan was destroyed before finishing" 
error
+    if (finished_.state() == FutureState::PENDING) {
+      finished_.MarkFinished();
+    }
+  }

Review Comment:
   The original code just called `finished_.MarkFinished()` and I observed a 
failure, with the documented message as well as the message `"Future already 
marked finished"` in a debugging session,, that I haven't figured out. I needed 
some way to get runs to complete and this led me to the code-change here to 
avoid finishing twice. I don't know enough about the stopping logic myself to 
say what is a clean solution here; probably both the original code and the 
code-change here are not as clean as we'd like.



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