alamb commented on a change in pull request #643:
URL: https://github.com/apache/arrow-datafusion/pull/643#discussion_r660933366
##########
File path: datafusion/src/physical_plan/planner.rs
##########
@@ -172,16 +170,51 @@ fn physical_name(e: &Expr, input_schema: &DFSchema) ->
Result<String> {
}
}
+/// Physical query planner that converts a `LogicalPlan` to an
+/// `ExecutionPlan` suitable for execution.
+pub trait PhysicalPlanner {
+ /// Create a physical plan from a logical plan
+ fn create_physical_plan(
+ &self,
+ logical_plan: &LogicalPlan,
+ ctx_state: &ExecutionContextState,
+ ) -> Result<Arc<dyn ExecutionPlan>>;
+
+ /// Create a physical expression from a logical expression
+ /// suitable for evaluation
+ ///
+ /// `e`: the expression to convert
+ ///
+ /// `input_dfschema`: the logical plan schema for evaluating `e`
+ ///
+ /// `input_schema`: the physical schema for evaluating `e`
+ fn create_physical_expr(
+ &self,
+ e: &Expr,
+ input_dfschema: &DFSchema,
+ input_schema: &Schema,
+ ctx_state: &ExecutionContextState,
+ ) -> Result<Arc<dyn PhysicalExpr>>;
+}
+
/// This trait exposes the ability to plan an [`ExecutionPlan`] out of a
[`LogicalPlan`].
pub trait ExtensionPlanner {
/// Create a physical plan for a [`UserDefinedLogicalNode`].
- /// This errors when the planner knows how to plan the concrete
implementation of `node`
- /// but errors while doing so, and `None` when the planner does not know
how to plan the `node`
- /// and wants to delegate the planning to another [`ExtensionPlanner`].
+ ///
Review comment:
The challenge prior to this PR is if the extension node has any `Expr`s
to convert them into `PhysicalExprs` requires access to the `LogicalPlan`
Furthermore, there was no way to call back into `create_physical_expr` from
the `ExtensionPlanner` so I added that to the trait as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]