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


##########
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:
   I've updated added a comment to the code to describe the behavior.
   
   But in general as @devinjdangelo mentioned, we could improve error handling 
in the future. At least, this logic isn't spread across the repo anymore.



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