alamb commented on issue #10871:
URL: https://github.com/apache/datafusion/issues/10871#issuecomment-2170336713

   Thank you @LorrensP-2158466  -- sorry for the delay . I have been traveling
   
   > I do have a question.
   > How can we show these results? Because Analyzer rules only return 
transformed LogicalPlans, or do I understand something in a wrong way?
   
   I think in an example, we can use `println!` which is what we do in other 
examples: 
https://github.com/apache/datafusion/blob/3773fb7fb54419f889e7d18b73e9eb48069eb08e/datafusion-examples/examples/rewrite_expr.rs#L45-L48
   
   Normally the idea is to give a well documented example that shows the basic 
pattern that people can start with
   
   For this one, maybe you could show how to use `TreeNode::apply` to walk the 
tree. Something like (totally untested)
   
   ```rust
   let mut join_count = 0;
   plan.apply(|child| {
     if matches!(child, LogicalPlan::Join(_)) {
       join_count += 1;
     }
   });
   
   println!("Found {join_count} joins in the plan");
   ```
   
   


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

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