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 just kept the logic as it used to be.
   
   But in fact `JoinError` might be caused either by panic or cancellation of 
task.
   
   And I think it's reachable in general, but if it was cancelled - likely it's 
expected or was due to another propagated error. 
   
   For now I can suggest to remove `else { unreachable!() }`, but in long term 
we can think about smarter error handling for such cases



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