This is an automated email from the ASF dual-hosted git repository.
jakevin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 26b8377b06 minor: Add doc comments to clarify what Analyzer is for
(#5705)
26b8377b06 is described below
commit 26b8377b0690916deacf401097d688699026b8fb
Author: Andrew Lamb <[email protected]>
AuthorDate: Fri Mar 24 03:51:52 2023 +0100
minor: Add doc comments to clarify what Analyzer is for (#5705)
---
datafusion/optimizer/src/analyzer/mod.rs | 12 ++++++++++--
datafusion/optimizer/src/optimizer.rs | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/datafusion/optimizer/src/analyzer/mod.rs
b/datafusion/optimizer/src/analyzer/mod.rs
index e4b3d22cde..37b4af34af 100644
--- a/datafusion/optimizer/src/analyzer/mod.rs
+++ b/datafusion/optimizer/src/analyzer/mod.rs
@@ -29,8 +29,16 @@ use log::{debug, trace};
use std::sync::Arc;
use std::time::Instant;
-/// `AnalyzerRule` transforms the unresolved ['LogicalPlan']s and unresolved
['Expr']s into
-/// the resolved form.
+/// [`AnalyzerRule`]s transform [`LogicalPlan`]s in some way to make
+/// the plan valid prior to the rest of the DataFusion optimization process.
+///
+/// For example, it may resolve [`Expr]s into more specific forms such
+/// as a subquery reference, to do type coercion to ensure the types
+/// of operands are correct.
+///
+/// This is different than an [`OptimizerRule`](crate::OptimizerRule)
+/// which should preserve the semantics of the LogicalPlan but compute
+/// it the same result in some more optimal way.
pub trait AnalyzerRule {
/// Rewrite `plan`
fn analyze(&self, plan: &LogicalPlan, config: &ConfigOptions) ->
Result<LogicalPlan>;
diff --git a/datafusion/optimizer/src/optimizer.rs
b/datafusion/optimizer/src/optimizer.rs
index bda4c47d11..e4880cb124 100644
--- a/datafusion/optimizer/src/optimizer.rs
+++ b/datafusion/optimizer/src/optimizer.rs
@@ -51,7 +51,7 @@ use std::collections::HashSet;
use std::sync::Arc;
use std::time::Instant;
-/// `OptimizerRule` transforms one ['LogicalPlan'] into another which
+/// `OptimizerRule` transforms one [`LogicalPlan`] into another which
/// computes the same results, but in a potentially more efficient
/// way. If there are no suitable transformations for the input plan,
/// the optimizer can simply return it as is.