File tree Expand file tree Collapse file tree 1 file changed +11
-16
lines changed
datafusion/physical-optimizer/src/enforce_sorting Expand file tree Collapse file tree 1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -150,25 +150,20 @@ fn is_coalesce_to_remove(
150150 node : & Arc < dyn ExecutionPlan > ,
151151 parent : & Arc < dyn ExecutionPlan > ,
152152) -> bool {
153- node. as_any ( )
154- . downcast_ref :: < CoalescePartitionsExec > ( )
155- . map ( |_coalesce| {
156- // Note that the `Partitioning::satisfy()` (parent vs. coalesce.child) cannot be used for cases of:
157- // * Repartition -> Coalesce -> Repartition
158-
159- let parent_req_single_partition = matches ! (
160- parent. required_input_distribution( ) [ 0 ] ,
161- Distribution :: SinglePartition
162- ) ;
153+ let parent_req_single_partition = matches ! (
154+ parent. required_input_distribution( ) [ 0 ] ,
155+ Distribution :: SinglePartition
156+ ) ;
163157
158+ is_coalesce_partitions ( node)
159+ && (
164160 // node above does not require single distribution
165161 !parent_req_single_partition
166- // it doesn't immediately repartition
167- || is_repartition ( parent)
168- // any adjacent Coalesce->Sort can be replaced
169- || is_sort ( parent)
170- } )
171- . unwrap_or ( false )
162+ // it doesn't immediately repartition
163+ || is_repartition ( parent)
164+ // any adjacent Coalesce->Sort can be replaced
165+ || is_sort ( parent)
166+ )
172167}
173168
174169/// Discovers the linked Coalesce->Sort cascades.
You can’t perform that action at this time.
0 commit comments