-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add standalone example for OptimizerRule
#11087
Conversation
@@ -402,6 +402,16 @@ impl SessionState { | |||
self | |||
} | |||
|
|||
// the add_optimizer_rule takes an owned reference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the naming in SessionState is pretty inconsistent
/// Adds an analyzer rule to the end of the existing rules. | ||
/// | ||
/// See [`SessionState`] for more control of when the rule is applied. | ||
pub fn add_analyzer_rule(&self, analyzer_rule: Arc<dyn AnalyzerRule + Send + Sync>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +--------+-----+ | ||
// | Andy | 11 | | ||
// | Andrew | 22 | | ||
// | Oleks | 33 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks @alamb this is very clear example on plan rewrite
Co-authored-by: Oleks V <[email protected]>
🚀 |
/// [`OptimizerRule`]s transform [`LogicalPlan`]s into an equivalent (but | ||
/// hopefully faster) form. | ||
/// | ||
/// See [analyzer_rule.rs] for an example of AnalyzerRules, which are for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is analyzer_rule.rs
a file in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be once I can get someone to approve #11089
* Add standalone example for `OptimizerRule` * Fix typo * Update datafusion-examples/examples/optimizer_rule.rs Co-authored-by: Oleks V <[email protected]> * fmt --------- Co-authored-by: Oleks V <[email protected]>
Which issue does this PR close?
Part of #10855
Rationale for this change
The current
rewrite_expr.rs
example has three distinct examples:AnalyzerRule
OptimizerRule
Each I think should be its own example to make them easier to find and more full featured
What changes are included in this PR?
optimizer_rule.rs
SessionContext::add_optimizer_rule
as a convenience&mut self
to be consistentAre these changes tested?
Yes, by CI test on examples