DDtKey commented on code in PR #9422:
URL: https://github.com/apache/arrow-datafusion/pull/9422#discussion_r1510009377


##########
datafusion/common_runtime/src/common.rs:
##########
@@ -51,10 +51,22 @@ impl<R: 'static> SpawnedTask<R> {
         Self { inner }
     }
 
+    /// Joins the task, returning the result of join (`Result<R, JoinError>`).
     pub async fn join(mut self) -> Result<R, JoinError> {
         self.inner
             .join_next()
             .await
             .expect("`SpawnedTask` instance always contains exactly 1 task")
     }
+
+    /// Joins the task and unwinds the panic if it happens.
+    pub async fn join_unwind(self) -> R {
+        self.join().await.unwrap_or_else(|e| {
+            if e.is_panic() {
+                std::panic::resume_unwind(e.into_panic());
+            } else {
+                unreachable!();

Review Comment:
   Hm, that's the good question. I preserved logic which used to be here.
   In fact `JoinError` might be caused either by panic or cancellation of task.
   
   But doing this inside our wrapper provides some guarantees:
   `join` consumes `self` there is no way to cancel the task outside. It can be 
cancelled(aborted) only on drop or on shutdown of runtime. 
   
   So cancellation reason can be considered unreachable here
   I'll add comments



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