This is an automated email from the ASF dual-hosted git repository.

comphead 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 1c4c00230a Minor: Improve documentation on `LogicalPlan::apply*` and 
`LogicalPlan::map*` (#9996)
1c4c00230a is described below

commit 1c4c00230afe3058b45ed2df812daa16f7276ce5
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon Apr 8 14:41:03 2024 -0400

    Minor: Improve documentation on `LogicalPlan::apply*` and 
`LogicalPlan::map*` (#9996)
---
 datafusion/expr/src/logical_plan/plan.rs | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/datafusion/expr/src/logical_plan/plan.rs 
b/datafusion/expr/src/logical_plan/plan.rs
index 860fd7daaf..ca8d718ec0 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -305,9 +305,9 @@ impl LogicalPlan {
         err
     }
 
-    /// Calls `f` on all expressions (non-recursively) in the current
-    /// logical plan node. This does not include expressions in any
-    /// children.
+    /// Calls `f` on all expressions in the current `LogicalPlan` node.
+    ///
+    /// Note this does not include expressions in child `LogicalPlan` nodes.
     pub fn apply_expressions<F: FnMut(&Expr) -> Result<TreeNodeRecursion>>(
         &self,
         mut f: F,
@@ -393,6 +393,11 @@ impl LogicalPlan {
         }
     }
 
+    /// Rewrites all expressions in the current `LogicalPlan` node using `f`.
+    ///
+    /// Returns the current node.
+    ///
+    /// Note this does not include expressions in child `LogicalPlan` nodes.
     pub fn map_expressions<F: FnMut(Expr) -> Result<Transformed<Expr>>>(
         self,
         mut f: F,
@@ -608,8 +613,9 @@ impl LogicalPlan {
         })
     }
 
-    /// returns all inputs of this `LogicalPlan` node. Does not
-    /// include inputs to inputs, or subqueries.
+    /// Returns all inputs / children of this `LogicalPlan` node.
+    ///
+    /// Note does not include inputs to inputs, or subqueries.
     pub fn inputs(&self) -> Vec<&LogicalPlan> {
         match self {
             LogicalPlan::Projection(Projection { input, .. }) => vec![input],
@@ -1370,6 +1376,10 @@ impl LogicalPlan {
         )
     }
 
+    /// Calls `f` recursively on all children of the  `LogicalPlan` node.
+    ///
+    /// Unlike [`Self::apply`], this method *does* includes `LogicalPlan`s that
+    /// are referenced in `Expr`s
     pub fn apply_with_subqueries<F: FnMut(&Self) -> Result<TreeNodeRecursion>>(
         &self,
         f: &mut F,
@@ -1434,6 +1444,8 @@ impl LogicalPlan {
         )
     }
 
+    /// Calls `f` on all subqueries referenced in expressions of the current
+    /// `LogicalPlan` node.
     fn apply_subqueries<F: FnMut(&Self) -> Result<TreeNodeRecursion>>(
         &self,
         mut f: F,
@@ -1453,6 +1465,10 @@ impl LogicalPlan {
         })
     }
 
+    /// Rewrites all subquery `LogicalPlan` in the current `LogicalPlan` node
+    /// using `f`.
+    ///
+    /// Returns the current node.
     fn map_subqueries<F: FnMut(Self) -> Result<Transformed<Self>>>(
         self,
         mut f: F,

Reply via email to