alamb opened a new issue, #10628:
URL: https://github.com/apache/datafusion/issues/10628

   ### Is your feature request related to a problem or challenge?
   
   The usecase of walking `LogicalPlan` to either analyze the plan or rewrite 
it has come up multiple times recently
   
   Specifically I think both @goldmedal  and @cisaacson  have asked about this 
recently and so I think the documentation is not clear enough
   
   
   
   
   
   ### Describe the solution you'd like
   
   In order to help people do this, I would like to add some examples of how to 
walk the tree
   
   I suggest first adding simple doc example in the [docs of `LogicalPlan` 
itself 
](https://github.com/apache/datafusion/blob/b14e92f30057868da8e7b428223e66c6300773a1/datafusion/expr/src/logical_plan/plan.rs#L68-L69)
   
   The example would do somethig like create a plan using `LogicalPlanBuilder` 
   ```
     Project
       Filter
        Scan
   ```
   
   And then show how to:
   1. Use `TreeNode::apply` to recursively find something about the scan (maybe 
the table name?)
   2. Use the `TreeNode::rewrite` to recursively rewrite and remove the Filter 
(or something)
   
   I think those would be relatively short examples to write and would 
illustrate the key apis
   
   
   
   
   
   
   
   ### Describe alternatives you've considered
   
   Bonus points for a more full featured example (perhaps linked from the 
`LogicalPlan` docs) of how use / walk / manipulate LogicalPlans
   
   Similarly to 
https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/expr_api.rs,
 perahaps `datafusion-examples/examples/plan_walk.rs` or something
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to