@@ -451,7 +451,10 @@ macro_rules! handle_transform_recursion_up {
451
451
impl LogicalPlan {
452
452
/// Calls `f` on all expressions in the current `LogicalPlan` node.
453
453
///
454
- /// Note this does not include expressions in child `LogicalPlan` nodes.
454
+ /// # Notes
455
+ /// * Similar to [`TreeNode::apply`] but for this node's expressions.
456
+ /// * Does not include expressions in input `LogicalPlan` nodes
457
+ /// * Visits only the top level expressions (Does not recurse into each expression)
455
458
pub fn apply_expressions < F : FnMut ( & Expr ) -> Result < TreeNodeRecursion > > (
456
459
& self ,
457
460
mut f : F ,
@@ -541,7 +544,9 @@ impl LogicalPlan {
541
544
///
542
545
/// Returns the current node.
543
546
///
544
- /// Note this does not include expressions in child `LogicalPlan` nodes.
547
+ /// # Notes
548
+ /// * Similar to [`TreeNode::map_children`] but for this node's expressions.
549
+ /// * Visits only the top level expressions (Does not recurse into each expression)
545
550
pub fn map_expressions < F : FnMut ( Expr ) -> Result < Transformed < Expr > > > (
546
551
self ,
547
552
mut f : F ,
@@ -757,7 +762,8 @@ impl LogicalPlan {
757
762
} )
758
763
}
759
764
760
- /// Visits a plan similarly to [`Self::visit`], but including embedded subqueries.
765
+ /// Visits a plan similarly to [`Self::visit`], including subqueries that
766
+ /// may appear in expressions such as `IN (SELECT ...)`.
761
767
pub fn visit_with_subqueries < V : TreeNodeVisitor < Node = Self > > (
762
768
& self ,
763
769
visitor : & mut V ,
@@ -771,7 +777,9 @@ impl LogicalPlan {
771
777
. visit_parent ( || visitor. f_up ( self ) )
772
778
}
773
779
774
- /// Rewrites a plan similarly t [`Self::visit`], but including embedded subqueries.
780
+ /// Similarly to [`Self::rewrite`], rewrites this node and its inputs using `f`,
781
+ /// including subqueries that may appear in expressions such as `IN (SELECT
782
+ /// ...)`.
775
783
pub fn rewrite_with_subqueries < R : TreeNodeRewriter < Node = Self > > (
776
784
self ,
777
785
rewriter : & mut R ,
@@ -783,10 +791,9 @@ impl LogicalPlan {
783
791
)
784
792
}
785
793
786
- /// Calls `f` recursively on all children of the `LogicalPlan` node.
787
- ///
788
- /// Unlike [`Self::apply`], this method *does* includes `LogicalPlan`s that
789
- /// are referenced in `Expr`s
794
+ /// Similarly to [`Self::apply`], calls `f` on this node and all its inputs,
795
+ /// including subqueries that may appear in expressions such as `IN (SELECT
796
+ /// ...)`.
790
797
pub fn apply_with_subqueries < F : FnMut ( & Self ) -> Result < TreeNodeRecursion > > (
791
798
& self ,
792
799
f : & mut F ,
@@ -796,20 +803,29 @@ impl LogicalPlan {
796
803
. visit_sibling ( || self . apply_children ( |c| c. apply_with_subqueries ( f) ) )
797
804
}
798
805
806
+ /// Similarly to [`Self::transform`], rewrites this node and its inputs using `f`,
807
+ /// including subqueries that may appear in expressions such as `IN (SELECT
808
+ /// ...)`.
799
809
pub fn transform_with_subqueries < F : Fn ( Self ) -> Result < Transformed < Self > > > (
800
810
self ,
801
811
f : & F ,
802
812
) -> Result < Transformed < Self > > {
803
813
self . transform_up_with_subqueries ( f)
804
814
}
805
815
816
+ /// Similarly to [`Self::transform_down`], rewrites this node and its inputs using `f`,
817
+ /// including subqueries that may appear in expressions such as `IN (SELECT
818
+ /// ...)`.
806
819
pub fn transform_down_with_subqueries < F : Fn ( Self ) -> Result < Transformed < Self > > > (
807
820
self ,
808
821
f : & F ,
809
822
) -> Result < Transformed < Self > > {
810
823
handle_transform_recursion_down ! ( f( self ) , |c| c. transform_down_with_subqueries( f) )
811
824
}
812
825
826
+ /// Similarly to [`Self::transform_down_mut`], rewrites this node and its inputs using `f`,
827
+ /// including subqueries that may appear in expressions such as `IN (SELECT
828
+ /// ...)`.
813
829
pub fn transform_down_mut_with_subqueries <
814
830
F : FnMut ( Self ) -> Result < Transformed < Self > > ,
815
831
> (
@@ -820,6 +836,9 @@ impl LogicalPlan {
820
836
. transform_down_mut_with_subqueries( f) )
821
837
}
822
838
839
+ /// Similarly to [`Self::transform_up`], rewrites this node and its inputs using `f`,
840
+ /// including subqueries that may appear in expressions such as `IN (SELECT
841
+ /// ...)`.
823
842
pub fn transform_up_with_subqueries < F : Fn ( Self ) -> Result < Transformed < Self > > > (
824
843
self ,
825
844
f : & F ,
@@ -836,6 +855,9 @@ impl LogicalPlan {
836
855
handle_transform_recursion_up ! ( self , |c| c. transform_up_mut_with_subqueries( f) , f)
837
856
}
838
857
858
+ /// Similarly to [`Self::transform_down`], rewrites this node and its inputs using `f`,
859
+ /// including subqueries that may appear in expressions such as `IN (SELECT
860
+ /// ...)`.
839
861
pub fn transform_down_up_with_subqueries <
840
862
FD : FnMut ( Self ) -> Result < Transformed < Self > > ,
841
863
FU : FnMut ( Self ) -> Result < Transformed < Self > > ,
@@ -851,8 +873,9 @@ impl LogicalPlan {
851
873
)
852
874
}
853
875
854
- /// Calls `f` on all subqueries referenced in expressions of the current
855
- /// `LogicalPlan` node.
876
+ /// Similarly to [`Self::apply`], calls `f` on this node and its inputs
877
+ /// including subqueries that may appear in expressions such as `IN (SELECT
878
+ /// ...)`.
856
879
pub fn apply_subqueries < F : FnMut ( & Self ) -> Result < TreeNodeRecursion > > (
857
880
& self ,
858
881
mut f : F ,
@@ -872,8 +895,8 @@ impl LogicalPlan {
872
895
} )
873
896
}
874
897
875
- /// Rewrites all subquery `LogicalPlan` in the current `LogicalPlan` node
876
- /// using `f`.
898
+ /// Similarly to [`Self::map_children`], rewrites all subqueries that may
899
+ /// appear in expressions such as `IN (SELECT ...)` using `f`.
877
900
///
878
901
/// Returns the current node.
879
902
pub fn map_subqueries < F : FnMut ( Self ) -> Result < Transformed < Self > > > (
0 commit comments