westonpace commented on issue #16312:
URL: https://github.com/apache/datafusion/issues/16312#issuecomment-2951175493
One possibility is to wrap execute...
```
let plan = plan.clone(); // Should be cheap since users almost always start
with Arc<dyn ExecutionPlan>
let schema = plan.schema();
let data_stream = futures::stream::once(async move {
// attach runtime here
plan.execute(partition, context)
});
let data_stream = data_stream.try_flatten();
let data_stream = Box::pin(RecordBatchStreamAdapter::new(stream, schema));
```
This ensures that no tasks are spawned until the stream is polled regardless
of how the individual `ExecutionPlan` nodes are implemented. I'd rather put
the burden on the caller that has the need than put the burden on everyone
building specialized nodes.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]