@@ -3209,29 +3209,19 @@ async fn apply_enforce_distribution_multiple_times() -> Result<()> {
32093209 |_, _| ( ) ,
32103210 ) ?;
32113211
3212- let optimizers: Vec < Arc < dyn PhysicalOptimizerRule + Send + Sync > > = vec ! [
3213- Arc :: new( OutputRequirements :: new_add_mode( ) ) ,
3214- Arc :: new( EnforceDistribution :: new( ) ) ,
3215- Arc :: new( EnforceSorting :: new( ) ) ,
3216- Arc :: new( ProjectionPushdown :: new( ) ) ,
3217- Arc :: new( CoalesceBatches :: new( ) ) ,
3218- Arc :: new( EnforceDistribution :: new( ) ) , // -- Add enforce distribution rule again
3219- // The second `EnforceDistribution` should be run before removing `OutputRequirements` to reproduce the bug.
3220- Arc :: new( OutputRequirements :: new_remove_mode( ) ) ,
3221- Arc :: new( ProjectionPushdown :: new( ) ) ,
3222- Arc :: new( LimitPushdown :: new( ) ) ,
3223- Arc :: new( SanityCheckPlan :: new( ) ) ,
3224- ] ;
3225-
32263212 let planner = DefaultPhysicalPlanner :: default ( ) ;
32273213 let session_state = SessionStateBuilder :: new ( )
32283214 . with_config ( ctx. copied_config ( ) )
32293215 . with_default_features ( )
3230- . with_physical_optimizer_rules ( optimizers)
3216+ // The second `EnforceDistribution` should be run with `OutputRequirements` to reproduce the bug.
3217+ . with_physical_optimizer_rule ( Arc :: new ( OutputRequirements :: new_add_mode ( ) ) )
3218+ . with_physical_optimizer_rule ( Arc :: new ( EnforceDistribution :: new ( ) ) ) // -- Add enforce distribution rule again
3219+ . with_physical_optimizer_rule ( Arc :: new ( OutputRequirements :: new_remove_mode ( ) ) )
32313220 . build ( ) ;
32323221 let optimized_physical_plan = planner
32333222 . create_physical_plan ( & optimized_logical_plan, & session_state)
32343223 . await ?;
3224+
32353225 let normalizer = ExplainNormalizer :: new ( ) ;
32363226 let actual = format ! (
32373227 "{}" ,
0 commit comments