zhuqi-lucas commented on code in PR #16196: URL: https://github.com/apache/datafusion/pull/16196#discussion_r2128014148
########## datafusion/physical-plan/src/memory.rs: ########## @@ -139,13 +140,18 @@ pub trait LazyBatchGenerator: Send + Sync + fmt::Debug + fmt::Display { /// /// This plan generates output batches lazily, it doesn't have to buffer all batches /// in memory up front (compared to `MemorySourceConfig`), thus consuming constant memory. +/// We now add a `cooperative` flag to +/// let it optionally yield back to the runtime periodically. +/// Default is `true`, meaning it will yield back to the runtime for cooperative scheduling. pub struct LazyMemoryExec { /// Schema representing the data schema: SchemaRef, /// Functions to generate batches for each partition batch_generators: Vec<Arc<RwLock<dyn LazyBatchGenerator>>>, /// Plan properties cache storing equivalence properties, partitioning, and execution mode cache: PlanProperties, + /// Indicates whether to enable cooperative yielding mode. + cooperative: bool, Review Comment: Also enable LazyMemoryExec as a built-in, because it's a normal case, for example, the following cases will hit this: ```rust SET datafusion.execution.target_partitions = 1; SELECT SUM(value) FROM range(1, 50000000000); ``` -- 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