-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In IOx we have several extension nodes with Exprs which we want to compile to PhysicalExpr as part of a plan
This was previously annoying as the signature of the extension planner is:
fn plan_extension(
&self,
node: &dyn UserDefinedLogicalNode,
inputs: &[Arc<dyn ExecutionPlan>],
ctx_state: &ExecutionContextState,
) -> Result<Option<Arc<dyn ExecutionPlan>>> {Which offers no way to plan physical expressions, so I had to do something like the following workaround
// create physical expressions in extension planner)
let input_schema = inputs[0].schema();
let physical_planner = DefaultPhysicalPlanner::default();
let split_expr = physical_planner.create_physical_expr(
stream_split.split_expr(),
&input_schema,
ctx_state,
)?;However, with the introduction of qualified names, now I have to provide a DFSchema (which should have come from the input LogicalPlan which I do not have access to at this point).
// create physical expressions in extension planner)
let input_schema = inputs[0].schema();
let input_df_schema = DFSchema::try_from_qualified_schema("foo", &input_schema).unwrap();
let physical_planner = DefaultPhysicalPlanner::default();
let split_expr = physical_planner.create_physical_expr(
stream_split.split_expr(),
&input_df_schema,
&input_schema,
ctx_state,
)?;(note the "foo" needs to be the correct table name"
Describe the solution you'd like
- Add
create_physical_exprto thePhysicalPlannertrait - Pass an instance of the planner to the plan extension (rather than a
ctx_state) - Pass the input logical schema to each "plan extension" call as well
Basically as the internals of DataFusion evolve we also need to evolve the interfaces along with it.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.