(
plan: Arc<dyn ExecutionPlan>,
context: Arc<TaskContext>,
)
| 1275 | reason = "Public API that historically takes owned Arcs" |
| 1276 | )] |
| 1277 | pub fn execute_stream( |
| 1278 | plan: Arc<dyn ExecutionPlan>, |
| 1279 | context: Arc<TaskContext>, |
| 1280 | ) -> Result<SendableRecordBatchStream> { |
| 1281 | match plan.output_partitioning().partition_count() { |
| 1282 | 0 => Ok(Box::pin(EmptyRecordBatchStream::new(plan.schema()))), |
| 1283 | 1 => plan.execute(0, context), |
| 1284 | 2.. => { |
| 1285 | // merge into a single partition |
| 1286 | let plan = CoalescePartitionsExec::new(Arc::clone(&plan)); |
| 1287 | // CoalescePartitionsExec must produce a single partition |
| 1288 | assert_eq!(1, plan.properties().output_partitioning().partition_count()); |
| 1289 | plan.execute(0, context) |
| 1290 | } |
| 1291 | } |
| 1292 | } |
| 1293 | |
| 1294 | /// Execute the [ExecutionPlan] and collect the results in memory |
| 1295 | pub async fn collect_partitioned( |
searching dependent graphs…