You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/03/09 16:25:52 UTC
[PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
alamb opened a new pull request, #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520
## Which issue does this PR close?
Related to https://github.com/apache/arrow-datafusion/issues/9519
## Rationale for this change
When filing https://github.com/apache/arrow-datafusion/issues/9519 I didn't think DataFusion allowed registering AnalyzerRules. However, in the middle of filing a ticket requesting we do so, I found [`SessionState::add_analyzer_rule`](https://docs.rs/datafusion/latest/datafusion/execution/context/struct.SessionState.html#method.add_analyzer_rule)
I would like to make this clearer to find in the future
## What changes are included in this PR?
1. Improve doc comments, add hints about how to reguster contexts
## Are these changes tested?
Doc tests
## Are there any user-facing changes?
Documentation only (no code changes)
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520#discussion_r1518815961
##########
datafusion/core/src/physical_optimizer/optimizer.rs:
##########
@@ -34,8 +34,12 @@ use crate::physical_optimizer::topk_aggregation::TopKAggregation;
use crate::{error::Result, physical_plan::ExecutionPlan};
/// `PhysicalOptimizerRule` transforms one ['ExecutionPlan'] into another which
-/// computes the same results, but in a potentially more efficient
-/// way.
+/// computes the same results, but in a potentially more efficient way.
+///
+/// Use [`SessionState::add_physical_optimizer_rule`] to register additional
+/// `PhysicalOptimizerRule`s..
Review Comment:
```suggestion
/// `PhysicalOptimizerRule`s.
```
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520#discussion_r1518651956
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1641,12 +1643,13 @@ impl SessionState {
self
}
- /// Adds a new [`PhysicalOptimizerRule`]
+ /// Add `physical_optimizer_rule` to the end of the list of
+ /// [`PhysicalOptimizerRule`]s used to rewrite queries.
pub fn add_physical_optimizer_rule(
mut self,
- optimizer_rule: Arc<dyn PhysicalOptimizerRule + Send + Sync>,
+ physical_optimizer_rule: Arc<dyn PhysicalOptimizerRule + Send + Sync>,
Review Comment:
👍
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520#discussion_r1518651905
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1596,7 +1596,7 @@ impl SessionState {
self
}
- /// Replace the analyzer rules
+ /// Replace the entire list of [`AnalyzerRule`]s used to optimize plans.
Review Comment:
```suggestion
/// Override the [`AnalyzerRule`]s optimizer plan rules.
```
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520#discussion_r1518651643
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1587,7 +1587,7 @@ impl SessionState {
self
}
- /// Replace the default query planner
+ /// use `query_planner` to plan queries, replacing the default
Review Comment:
```suggestion
/// override default query planner with `query_planner`
```
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve documentation for registering `AnalyzerRule` [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9520:
URL: https://github.com/apache/arrow-datafusion/pull/9520#discussion_r1518615152
##########
datafusion/core/src/lib.rs:
##########
@@ -145,7 +145,7 @@
//! * define your own catalogs, schemas, and table lists ([`CatalogProvider`])
//! * build your own query language or plans ([`LogicalPlanBuilder`])
//! * declare and use user-defined functions ([`ScalarUDF`], and [`AggregateUDF`], [`WindowUDF`])
-//! * add custom optimizer rewrite passes ([`OptimizerRule`] and [`PhysicalOptimizerRule`])
+//! * add custom plan rewrite passes ([`AnalyzerRule`], [`OptimizerRule`] and [`PhysicalOptimizerRule`])
Review Comment:
contribution 1: Mention `AnalyzerRule` in this list
##########
datafusion/core/src/physical_optimizer/optimizer.rs:
##########
@@ -34,8 +34,12 @@ use crate::physical_optimizer::topk_aggregation::TopKAggregation;
use crate::{error::Result, physical_plan::ExecutionPlan};
/// `PhysicalOptimizerRule` transforms one ['ExecutionPlan'] into another which
-/// computes the same results, but in a potentially more efficient
-/// way.
+/// computes the same results, but in a potentially more efficient way.
+///
+/// Use [`SessionState::add_physical_optimizer_rule`] to register additional
+/// `PhysicalOptimizerRule`s..
+///
+/// [`SessionState::add_physical_optimizer_rule`]: https://docs.rs/datafusion/latest/datafusion/execution/context/struct.SessionState.html#method.add_physical_optimizer_rule
Review Comment:
Contrbution 2: Add links to how to register these rules with SessionContext (which was the API I didn't find initially)
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org