-
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
feat: Add method to add analyzer rules to SessionContext #10849
Changes from 1 commit
6b63dcc
9a1eae8
e134719
62c5ab3
925f2c6
c81b4cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,9 +387,9 @@ impl SessionState { | |
/// Add `analyzer_rule` to the end of the list of | ||
/// [`AnalyzerRule`]s used to rewrite queries. | ||
pub fn add_analyzer_rule( | ||
mut self, | ||
&mut self, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think technically this is an API change as now the api takes a However, I think the change is good as now What do you think about adding an api to make things consistent? (we could do this as a separate PR) pub fn with_analyzer_rule(
mut self,
analyzer_rule: Arc<dyn AnalyzerRule + Send + Sync>,
) -> Self {
..
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also update Also, do we need to add |
||
analyzer_rule: Arc<dyn AnalyzerRule + Send + Sync>, | ||
) -> Self { | ||
) -> &Self { | ||
self.analyzer.rules.push(analyzer_rule); | ||
self | ||
} | ||
|
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.
Would be nice to have an examples, or doc test for the this method
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 agree -- we are tracking adding an example for how to use custom analyzer rules in #10855, so perhaps we can add the example as part of that ticket (i think @goldmedal said he may have some time to work on that eventually)
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.
FWIW I have a WIP PR to improve these examples -- I hope to get it up for review sometime this weekend