File tree Expand file tree Collapse file tree 2 files changed +26
-27
lines changed
Expand file tree Collapse file tree 2 files changed +26
-27
lines changed Original file line number Diff line number Diff line change @@ -36,29 +36,3 @@ pub fn display_plan_with_partition_in_out(plan: &dyn ExecutionPlan) -> Result<St
3636 visit ( plan, 0 , & mut f) ?;
3737 Ok ( f)
3838}
39-
40- /// Returns a boolean indicating if this stage can be divided into more than one task.
41- ///
42- /// Some Plan nodes need to materialize all partitions inorder to execute such as
43- /// NestedLoopJoinExec. Rewriting the plan to accommodate dividing it into tasks
44- /// would result in redundant work.
45- ///
46- /// The plans we cannot split are:
47- /// - NestedLoopJoinExec
48- pub fn can_be_divided ( plan : & Arc < dyn ExecutionPlan > ) -> Result < bool > {
49- // recursively check to see if this stages plan contains a NestedLoopJoinExec
50- let mut has_unsplittable_plan = false ;
51- let search = |f : & Arc < dyn ExecutionPlan > | {
52- if f. as_any ( )
53- . downcast_ref :: < datafusion:: physical_plan:: joins:: NestedLoopJoinExec > ( )
54- . is_some ( )
55- {
56- has_unsplittable_plan = true ;
57- return Ok ( TreeNodeRecursion :: Stop ) ;
58- }
59-
60- Ok ( TreeNodeRecursion :: Continue )
61- } ;
62- plan. apply ( search) ?;
63- Ok ( !has_unsplittable_plan)
64- }
Original file line number Diff line number Diff line change 11use std:: sync:: Arc ;
22
33use super :: stage:: ExecutionStage ;
4- use crate :: common:: util:: can_be_divided;
54use crate :: { plan:: PartitionIsolatorExec , ArrowFlightReadExec } ;
65use datafusion:: common:: tree_node:: TreeNodeRecursion ;
76use datafusion:: error:: DataFusionError ;
@@ -153,6 +152,32 @@ impl DistributedPhysicalOptimizerRule {
153152 }
154153}
155154
155+ /// Returns a boolean indicating if this stage can be divided into more than one task.
156+ ///
157+ /// Some Plan nodes need to materialize all partitions inorder to execute such as
158+ /// NestedLoopJoinExec. Rewriting the plan to accommodate dividing it into tasks
159+ /// would result in redundant work.
160+ ///
161+ /// The plans we cannot split are:
162+ /// - NestedLoopJoinExec
163+ pub fn can_be_divided ( plan : & Arc < dyn ExecutionPlan > ) -> Result < bool > {
164+ // recursively check to see if this stages plan contains a NestedLoopJoinExec
165+ let mut has_unsplittable_plan = false ;
166+ let search = |f : & Arc < dyn ExecutionPlan > | {
167+ if f. as_any ( )
168+ . downcast_ref :: < datafusion:: physical_plan:: joins:: NestedLoopJoinExec > ( )
169+ . is_some ( )
170+ {
171+ has_unsplittable_plan = true ;
172+ return Ok ( TreeNodeRecursion :: Stop ) ;
173+ }
174+
175+ Ok ( TreeNodeRecursion :: Continue )
176+ } ;
177+ plan. apply ( search) ?;
178+ Ok ( !has_unsplittable_plan)
179+ }
180+
156181#[ cfg( test) ]
157182mod tests {
158183 use crate :: assert_snapshot;
You can’t perform that action at this time.
0 commit comments