@@ -46,9 +46,10 @@ use ballista_core::event_loop::EventSender;
4646use ballista_core:: serde:: BallistaCodec ;
4747use ballista_core:: serde:: protobuf:: TaskStatus ;
4848use datafusion:: logical_expr:: LogicalPlan ;
49+ use datafusion:: physical_plan:: coalesce_partitions:: CoalescePartitionsExec ;
4950use datafusion:: physical_plan:: display:: DisplayableExecutionPlan ;
5051use datafusion:: physical_plan:: empty:: EmptyExec ;
51- use datafusion:: physical_plan:: joins:: HashJoinExec ;
52+ use datafusion:: physical_plan:: joins:: { HashJoinExec , PartitionMode } ;
5253use datafusion:: prelude:: SessionContext ;
5354use datafusion_proto:: logical_plan:: AsLogicalPlan ;
5455use datafusion_proto:: physical_plan:: AsExecutionPlan ;
@@ -639,9 +640,18 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> SchedulerState<T,
639640 info ! (
640641 "Job {job_id}: stripping dynamic-filter accumulator from {display}"
641642 ) ;
643+ let left = Arc :: clone ( hash_join. left ( ) ) ;
644+ let left: Arc < dyn ExecutionPlan > =
645+ if * hash_join. partition_mode ( ) == PartitionMode :: CollectLeft
646+ && left. properties ( ) . output_partitioning ( ) . partition_count ( ) > 1
647+ {
648+ Arc :: new ( CoalescePartitionsExec :: new ( left) )
649+ } else {
650+ left
651+ } ;
642652 let rebuilt: Arc < dyn ExecutionPlan > = Arc :: new (
643653 HashJoinExec :: try_new (
644- Arc :: clone ( hash_join . left ( ) ) ,
654+ left,
645655 Arc :: clone ( hash_join. right ( ) ) ,
646656 hash_join. on ( ) . to_vec ( ) ,
647657 hash_join. filter ( ) . cloned ( ) ,
0 commit comments