Re: [I] Add example for writing an SQL analysis pass [datafusion]

2024-06-21 Thread via GitHub


alamb closed issue #10871: Add example for writing an SQL analysis pass
URL: https://github.com/apache/datafusion/issues/10871


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



Re: [I] Add example for writing an SQL analysis pass [datafusion]

2024-06-15 Thread via GitHub


LorrensP-2158466 commented on issue #10871:
URL: https://github.com/apache/datafusion/issues/10871#issuecomment-2170427006

   Thanks for the reply!
   
   That's exactly what I have made, I'll open up a PR later today or tomorrow.


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



Re: [I] Add example for writing an SQL analysis pass [datafusion]

2024-06-15 Thread via GitHub


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



Re: [I] Add example for writing an SQL analysis pass [datafusion]

2024-06-11 Thread via GitHub


LorrensP-2158466 commented on issue #10871:
URL: https://github.com/apache/datafusion/issues/10871#issuecomment-2161172409

   I like the Join count analysis, I had to do this in my project (mentioned in 
#10808) in a really hacky way. We can have 2 sorts of counts:
   1. Count every individual join
   2. Count all groups of joins (subsequent joins that are related) with their 
respective count(this would have been useful for me)
   
   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?
   
   


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