datafusion_dist/physical_plan/
unresolved.rs

1use std::sync::Arc;
2
3use datafusion_common::DataFusionError;
4use datafusion_execution::{SendableRecordBatchStream, TaskContext};
5use datafusion_physical_plan::{DisplayAs, DisplayFormatType, ExecutionPlan, PlanProperties};
6
7use crate::planner::StageId;
8
9#[derive(Debug)]
10pub struct UnresolvedExec {
11    pub delegated_stage_id: StageId,
12    pub delegated_plan: Arc<dyn ExecutionPlan>,
13}
14
15impl UnresolvedExec {
16    pub fn new(delegated_stage_id: StageId, delegated_plan: Arc<dyn ExecutionPlan>) -> Self {
17        Self {
18            delegated_stage_id,
19            delegated_plan,
20        }
21    }
22}
23
24impl ExecutionPlan for UnresolvedExec {
25    fn name(&self) -> &str {
26        "UnresolvedExec"
27    }
28
29    fn as_any(&self) -> &dyn std::any::Any {
30        self
31    }
32
33    fn properties(&self) -> &PlanProperties {
34        self.delegated_plan.properties()
35    }
36
37    fn children(&self) -> Vec<&Arc<dyn ExecutionPlan>> {
38        vec![]
39    }
40
41    fn with_new_children(
42        self: Arc<Self>,
43        _children: Vec<Arc<dyn ExecutionPlan>>,
44    ) -> Result<Arc<dyn ExecutionPlan>, DataFusionError> {
45        Err(DataFusionError::Internal(
46            "UnresolvedExec with_new_children should not be called".to_string(),
47        ))
48    }
49
50    fn execute(
51        &self,
52        _partition: usize,
53        _context: Arc<TaskContext>,
54    ) -> Result<SendableRecordBatchStream, DataFusionError> {
55        Err(DataFusionError::Internal(
56            "UnresolvedExec execute should not be called".to_string(),
57        ))
58    }
59}
60
61impl DisplayAs for UnresolvedExec {
62    fn fmt_as(&self, _t: DisplayFormatType, f: &mut std::fmt::Formatter) -> std::fmt::Result {
63        write!(
64            f,
65            "UnresolvedExec: delegated_plan={}, delegated_stage={}",
66            self.delegated_plan.name(),
67            self.delegated_stage_id.stage
68        )
69    }
70}