pepijnve commented on PR #16196:
URL: https://github.com/apache/datafusion/pull/16196#issuecomment-2935084653

   In the meantime, I've been experimenting with factoring out the poll/yield 
budget part inspired a bit by `tokio::task::coop`. The `maybe_poll` macro is 
not as elegant as `consume_budget().await`, but that's the best I know how to 
do as a Rust novice. `YieldStream` becomes as simple as 
https://github.com/pepijnve/datafusion_cancel_test/blob/main/src/yield_stream.rs.
   
   The idea here is that you can either use the `YieldStream` decorator as 
convenience, or add a `PollBudget` and `maybe_poll!` to your stream 
implementation. I think this would require only very minimal changes to 
existing stream implementations since those all need to handle the case where 
`poll_next` returns `Pending` today anyway.


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to