pub fn df_physical_expr(
    input: &dyn ExecutionPlan,
    expr: Expr,
) -> std::result::Result<Arc<dyn PhysicalExpr>, DataFusionError> {
    // To create a physical expression for a logical expression we need appropriate
    // PhysicalPlanner and ExecutionContextState, however, our given logical expression is very basic
    // and any planner or context will work
    let physical_planner = DefaultPhysicalPlanner::default();
    let ctx_state = datafusion::execution::context::ExecutionContextState::new();

    let input_physical_schema = input.schema();
    let input_logical_schema: DFSchema = input_physical_schema.as_ref().clone().try_into()?;

    trace!(%expr, "logical expression");
    trace!(%input_logical_schema, "input logical schema");
    trace!(%input_physical_schema, "input physical schema");

    physical_planner.create_physical_expr(
        &expr,
        &input_logical_schema,
        &input_physical_schema,
        &ctx_state,
    )
}
// Build a datafusion physical expression from its logical one
Build a datafusion physical expression from its logical one
Build a datafusion physical expression from its logical one
pub fn df_physical_expr(
    input: &dyn ExecutionPlan,
    expr: Expr,
) -> std::result::Result<Arc<dyn PhysicalExpr>, DataFusionError> {
    // To create a physical expression for a logical expression we need appropriate
    // PhysicalPlanner and ExecutionContextState, however, our given logical expression is very basic
    // and any planner or context will work
    let physical_planner = DefaultPhysicalPlanner::default();
    let ctx_state = datafusion::execution::context::ExecutionContextState::new();
    let input_physical_schema = input.schema();
    let input_logical_schema: DFSchema = input_physical_schema.as_ref().clone().try_into()?;
    trace!(%expr, "logical expression");
    trace!(%input_logical_schema, "input logical schema");
    trace!(%input_physical_schema, "input physical schema");
    physical_planner.create_physical_expr(
        &expr,
        &input_logical_schema,
        &input_physical_schema,
        &ctx_state,
    )
}
pub fn df_physical_expr ( input : & dyn ExecutionPlan , expr : Expr , ) -> std :: result :: Result < Arc < dyn PhysicalExpr > , DataFusionError > { // To create a physical expression for a logical expression we need appropriate // PhysicalPlanner and ExecutionContextState, however, our given logical expression is very basic // and any planner or context will work let physical_planner = DefaultPhysicalPlanner :: default ( ) ; let ctx_state = datafusion :: execution :: context :: ExecutionContextState :: new ( ) ; let input_physical_schema = input . schema ( ) ; let input_logical_schema : DFSchema = input_physical_schema . as_ref ( ) . clone ( ) . try_into ( ) ? ; trace ! ( expr " " ) ; trace ! ( input_logical_schema " " ) ; trace ! ( input_physical_schema " " ) ; physical_planner . create_physical_expr ( & expr , & input_logical_schema , & input_physical_schema , & ctx_state , ) }
Build a datafusion physical expression from its logical one
Build a datafusion physical expression from its logical one
input
&dyn ExecutionPlan
expr
Expr
input
&dyn ExecutionPlan
expr
Expr