@@ -77,19 +77,19 @@ impl QueryPlanner {
7777 customizer
7878 . clone ( )
7979 . map ( |c| c as Arc < dyn PhysicalExtensionCodec > )
80- . or ( Some ( Arc :: new ( DefaultPhysicalExtensionCodec { } ) ) )
81- . unwrap ( ) ,
80+ . unwrap_or ( Arc :: new ( DefaultPhysicalExtensionCodec { } ) ) ,
8281 ) ) ;
8382
8483 Self { customizer, codec }
8584 }
8685
87- /// Common planning steps shared by both query and its EXPLAIN
86+ /// Prepare a Distributed DataFusion plan from a sql query.
8887 ///
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().
88+ /// This function parses the SQL, produces a logical plan, then derives the
89+ /// physical plan and its distributed counterpart.
90+ /// The resulting `QueryPlan` includes the logical plan, physical plan,
91+ /// distributed plan, and distributed stages, but it does not yet contain
92+ /// worker addresses or tasks, as they are filled in later by `distribute_plan()`.
9393 pub async fn prepare ( & self , sql : & str ) -> Result < QueryPlan > {
9494 let mut ctx = get_ctx ( ) . map_err ( |e| anyhow ! ( "Could not create context: {e}" ) ) ?;
9595 if let Some ( customizer) = & self . customizer {
@@ -109,6 +109,15 @@ impl QueryPlanner {
109109 }
110110 }
111111
112+ /// Prepare a Distributed DataFusion plan from a Substrait plan.
113+ ///
114+ /// 1. Convert the incoming Substrait plan into a `LogicalPlan` with DataFusion’s
115+ /// default Substrait consumer.
116+ /// 2. Derive the corresponding physical plan and distributed variant.
117+ ///
118+ /// The resulting `QueryPlan` contains the logical plan, physical plan,
119+ /// distributed plan, and distributed stages, but it does not yet contain
120+ /// worker addresses or tasks, as they are filled in later by `distribute_plan()`.
112121 pub async fn prepare_substrait ( & self , substrait_plan : Plan ) -> Result < QueryPlan > {
113122 let ctx = get_ctx ( ) . map_err ( |e| anyhow ! ( "Could not create context: {e}" ) ) ?;
114123
@@ -122,7 +131,7 @@ impl QueryPlanner {
122131 }
123132 }
124133
125- /// Prepare the query plan for distributed execution
134+ /// Prepare a `QueryPlan` for a regular SELECT query
126135 async fn prepare_query (
127136 & self ,
128137 logical_plan : LogicalPlan ,
@@ -147,6 +156,8 @@ impl QueryPlanner {
147156 . await ;
148157 }
149158
159+ /// Prepare a `QueryPlan` for statements that should run locally on the proxy
160+ /// node (e.g. `DESCRIBE TABLE`).
150161 async fn prepare_local (
151162 & self ,
152163 logical_plan : LogicalPlan ,
@@ -186,6 +197,7 @@ impl QueryPlanner {
186197 . await ;
187198 }
188199
200+ /// Prepare a `QueryPlan` for an EXPLAIN statement.
189201 async fn prepare_explain (
190202 & self ,
191203 explain_plan : LogicalPlan ,
0 commit comments