Skip to content

Commit

Permalink
Add additional docstring comments to from_plan (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored Oct 23, 2021
1 parent 3c1b807 commit fe1a9e2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion datafusion/src/optimizer/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,25 @@ pub fn optimize_children(
from_plan(plan, &new_exprs, &new_inputs)
}

/// Returns a new logical plan based on the original one with inputs and expressions replaced
/// Returns a new logical plan based on the original one with inputs
/// and expressions replaced.
///
/// The exprs correspond to the same order of expressions returned by
/// `LogicalPlan::expressions`. This function is used in optimizers in
/// the following way:
///
/// ```text
/// let new_inputs = optimize_children(..., plan, props);
///
/// // get the plans expressions to optimize
/// let exprs = plan.expressions();
///
/// // potentially rewrite plan expressions
/// let rewritten_exprs = rewrite_exprs(exprs);
///
/// // create new plan using rewritten_exprs in same position
/// let new_plan = from_plan(&plan, rewritten_exprs, new_inputs);
/// ```
pub fn from_plan(
plan: &LogicalPlan,
expr: &[Expr],
Expand Down

0 comments on commit fe1a9e2

Please sign in to comment.