Skip to content

Commit ef189fb

Browse files
committed
Update comment
1 parent 24abbd0 commit ef189fb

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

datafusion/optimizer/src/optimizer.rs

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -185,39 +185,11 @@ pub struct Optimizer {
185185
pub rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>,
186186
}
187187

188-
/// If a rule is with `ApplyOrder`, it means the optimizer will handle
189-
/// recursion. If it is `None` the rule must handle any required recursion
188+
/// Specifies how recursion for an `OptimizerRule` should be handled.
190189
///
191-
/// Notice: **sometime** result after optimize still can be optimized, we need
192-
/// apply again.
193-
///
194-
/// Usage Example: Merge Limit (subtree pattern is: Limit-Limit)
195-
/// ```rust
196-
/// use datafusion_expr::{Limit, LogicalPlan, LogicalPlanBuilder};
197-
/// use datafusion_common::Result;
198-
/// fn merge_limit(parent: &Limit, child: &Limit) -> LogicalPlan {
199-
/// // just for run
200-
/// return parent.input.as_ref().clone();
201-
/// }
202-
/// fn try_optimize(plan: &LogicalPlan) -> Result<Option<LogicalPlan>> {
203-
/// match plan {
204-
/// LogicalPlan::Limit(limit) => match limit.input.as_ref() {
205-
/// LogicalPlan::Limit(child_limit) => {
206-
/// // merge limit ...
207-
/// let optimized_plan = merge_limit(limit, child_limit);
208-
/// // due to optimized_plan may be optimized again,
209-
/// // for example: plan is Limit-Limit-Limit
210-
/// Ok(Some(
211-
/// try_optimize(&optimized_plan)?
212-
/// .unwrap_or_else(|| optimized_plan.clone()),
213-
/// ))
214-
/// }
215-
/// _ => Ok(None),
216-
/// },
217-
/// _ => Ok(None),
218-
/// }
219-
/// }
220-
/// ```
190+
/// If an `OptimizerRule` returns `Some` from `apply_order`, it means the
191+
/// optimizer will handle recursively applying the rule to the plan. If the
192+
/// apply order is `None`, the rule must handle any required recursion itself.
221193
#[derive(Debug, Clone, Copy, PartialEq)]
222194
pub enum ApplyOrder {
223195
TopDown,

0 commit comments

Comments
 (0)