berkaysynnada commented on code in PR #15030: URL: https://github.com/apache/datafusion/pull/15030#discussion_r1982854173
########## datafusion/physical-plan/src/execution_plan.rs: ########## @@ -260,13 +260,30 @@ pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync { /// used. /// Thus, [`spawn`] is disallowed, and instead use [`SpawnedTask`]. /// + /// To enable timely cancellation, the [`Stream`] that is returned must not + /// pin the CPU and must yield back to the tokio runtime regularly. This can + /// be achieved by manually returning [`Poll::Pending`] in regular intervals, + /// or the use of [`tokio::task::yield_now()`]. Cooperative scheduling may also + /// be a way to achieve this goal, as [tokio support for it improves][coop]. + /// Determination for "regularly" may be made using a timer (being careful with + /// the overhead-heavy syscall needed to take the time) or by counting rows or + /// batches. + /// + /// The goal is for `datafusion`-provided operator implementation to + /// strive for [the guideline of not spending a long time without reaching Review Comment: I don't know if there is any implementation such that it manually yields because of spending long time without a yield point (for CPU bound works), and I am also not very sure we could need that. -- 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