Skip to content

Commit 508f77a

Browse files
committed
More doc
1 parent 5c12df4 commit 508f77a

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/query_planner.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ impl QueryPlanner {
8484
Self { customizer, codec }
8585
}
8686

87-
/// Common planning steps shared by both query and its EXPLAIN
87+
/// Prepare a Distributed DataFusion plan from a sql query.
8888
///
89-
/// Prepare a query by parsing the SQL, performing logical planning,
90-
/// and then physical planning to create a distributed plan.
91-
/// Builds an initial `QueryPlan` with the logical and physical plans,
92-
/// but without worker addresses and tasks, which will be set later in distribute_plan().
89+
/// This function parses the SQL, produces a logical plan, then derives the
90+
/// physical plan and its distributed counterpart.
91+
/// The resulting `QueryPlan` includes the logical plan, physical plan,
92+
/// distributed plan, and distributed stages, but it does not yet contain
93+
/// worker addresses or tasks, as they are filled in later by `distribute_plan()`.
9394
pub async fn prepare(&self, sql: &str) -> Result<QueryPlan> {
9495
let mut ctx = get_ctx().map_err(|e| anyhow!("Could not create context: {e}"))?;
9596
if let Some(customizer) = &self.customizer {
@@ -109,6 +110,15 @@ impl QueryPlanner {
109110
}
110111
}
111112

113+
/// Prepare a Distributed DataFusion plan from a Substrait plan.
114+
///
115+
/// 1. Convert the incoming Substrait plan into a `LogicalPlan` with DataFusion’s
116+
/// default Substrait consumer.
117+
/// 2. Derive the corresponding physical plan and distributed variant.
118+
///
119+
/// The resulting `QueryPlan` contains the logical plan, physical plan,
120+
/// distributed plan, and distributed stages, but it does not yet contain
121+
/// worker addresses or tasks, as they are filled in later by `distribute_plan()`.
112122
pub async fn prepare_substrait(&self, substrait_plan: Plan) -> Result<QueryPlan> {
113123
let ctx = get_ctx().map_err(|e| anyhow!("Could not create context: {e}"))?;
114124

@@ -122,7 +132,7 @@ impl QueryPlanner {
122132
}
123133
}
124134

125-
/// Prepare the query plan for distributed execution
135+
/// Prepare a `QueryPlan` for a regular SELECT query
126136
async fn prepare_query(
127137
&self,
128138
logical_plan: LogicalPlan,
@@ -147,6 +157,8 @@ impl QueryPlanner {
147157
.await;
148158
}
149159

160+
/// Prepare a `QueryPlan` for statements that should run locally on the proxy
161+
/// node (e.g. `DESCRIBE TABLE`).
150162
async fn prepare_local(
151163
&self,
152164
logical_plan: LogicalPlan,
@@ -186,6 +198,7 @@ impl QueryPlanner {
186198
.await;
187199
}
188200

201+
/// Prepare a `QueryPlan` for an EXPLAIN statement.
189202
async fn prepare_explain(
190203
&self,
191204
explain_plan: LogicalPlan,

0 commit comments

Comments
 (0)