Skip to content

Allow fine-tune planner steps #11715

@waynexia

Description

@waynexia

Is your feature request related to a problem or challenge?

The planning phase generates and optimizes both logical and physical plans. IIRC we only provide one method to "optimize and create" a physical plan:

pub async fn create_physical_plan(
&self,
logical_plan: &LogicalPlan,
) -> datafusion_common::Result<Arc<dyn ExecutionPlan>> {
let logical_plan = self.optimize(logical_plan)?;
self.query_planner
.create_physical_plan(&logical_plan, self)
.await
}

Describe the solution you'd like

There are two approaches to alleviate this:

  • Expose more methods that each one only does one step, like create_logical_plan, analyze_logical_plan, optimize_logical_plan, create_physical_plan and optimize_physical_plan etc.
  • Expose those components to users, like
    /// Returns the [`Analyzer`] for this session
    pub fn analyzer(&self) -> &Analyzer {
        &self.analyzer
    }

    /// Returns the [`Optimizer`] for this session
    pub fn optimizer(&self) -> &Optimizer {
        &self.optimizer
    }

    /// Returns the [`QueryPlanner`] for this session
    pub fn query_planner(&self) -> &Arc<dyn QueryPlanner + Send + Sync> {
        &self.query_planner
    }

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions