Skip to content

Mutable Join Unwind#16883

Merged
alamb merged 2 commits into
apache:mainfrom
synnada-ai:join_unwind_mut
Jul 25, 2025
Merged

Mutable Join Unwind#16883
alamb merged 2 commits into
apache:mainfrom
synnada-ai:join_unwind_mut

Conversation

@berkaysynnada

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

When implementing Streams with SpawnedTask objects, the poll_next requires &mut self , but the existing join_unwind method consumes the SpawnedTask. The new join_unwind_mut method allows polling task completion status while retaining the SpawnedTask for subsequent polls.

What changes are included in this PR?

Added join_unwind_mut(&mut self) method to SpawnedTask that mirrors the behavior of join_unwind(self)

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added the common Related to common crate label Jul 24, 2025

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good change to me

/// usable after the call, though once a task completes, subsequent calls will continue
/// to return the same `JoinError`.
pub async fn join_unwind_mut(&mut self) -> Result<R, JoinError> {
self.await.map_err(|e| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid code duplication, perhaps we could change join_unwind to call join_unwind_mut ?

})
}

/// Joins the task using a mutable reference and unwinds the panic if it happens.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also document what happens if join_unwind_mut is called twice on the same task?

@alamb
alamb merged commit 8b9204c into apache:main Jul 25, 2025
27 checks passed
adriangb pushed a commit to pydantic/datafusion that referenced this pull request Jul 28, 2025
* Update common.rs

* Update common.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate

2 participants