kosiew commented on code in PR #22582:
URL: https://github.com/apache/datafusion/pull/22582#discussion_r3330235535


##########
docs/source/library-user-guide/working-with-exprs.md:
##########
@@ -167,7 +167,7 @@ In DataFusion, an `OptimizerRule` is a trait that supports 
rewriting `Expr`s tha
 We'll call our rule `AddOneInliner` and implement the `OptimizerRule` trait. 
The `OptimizerRule` trait has two methods:
 
 - `name` - returns the name of the rule
-- `try_optimize` - takes a `LogicalPlan` and returns an `Option<LogicalPlan>`. 
If the rule is able to optimize the plan, it returns `Some(LogicalPlan)` with 
the optimized plan. If the rule is not able to optimize the plan, it returns 
`None`.
+- `rewrite` - takes a `LogicalPlan` and returns an `Transformed<LogicalPlan>`. 
If the rule is able to optimize the plan, it returns `Transformed::yes` with 
the optimized plan. If the rule is not able to optimize the plan, it returns 
`Transformed::no`.

Review Comment:
   Thanks for updating this section. I think the `rewrite` description still 
needs one more tweak to match the actual `OptimizerRule::rewrite` API.
   
   The method also receives `&dyn OptimizerConfig` and returns 
`Result<Transformed<LogicalPlan>>`, rather than just 
`Transformed<LogicalPlan>`. Since this PR is focused on fixing stale optimizer 
rule docs, it would be good to make the signature complete here so users 
implementing the trait have the right shape to follow.
   
   Suggested wording: `rewrite` takes a `LogicalPlan` and `&dyn 
OptimizerConfig`, and returns `Result<Transformed<LogicalPlan>>`.
   
   Small grammar note while you are here: this should be `a 
Transformed<LogicalPlan>` rather than `an Transformed<LogicalPlan>`.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to