@@ -1269,38 +1269,37 @@ impl PhysicalPlanBuilder {
12691269 . await ?;
12701270
12711271 // Step 12: Create and return the HashJoin
1272+ let build_side_data_distribution = s_expr. build_side_child ( ) . get_data_distribution ( ) ?;
1273+ let broadcast_id = if build_side_data_distribution
1274+ . as_ref ( )
1275+ . is_some_and ( |e| matches ! ( e, databend_common_sql:: plans:: Exchange :: NodeToNodeHash ( _) ) )
12721276 {
1273- let build_side_data_distribution = s_expr. build_side_child ( ) . get_data_distribution ( ) ?;
1274- let broadcast_id = if build_side_data_distribution. as_ref ( ) . is_some_and ( |e| {
1275- matches ! ( e, databend_common_sql:: plans:: Exchange :: NodeToNodeHash ( _) )
1276- } ) {
1277- Some ( self . ctx . get_next_broadcast_id ( ) )
1278- } else {
1279- None
1280- } ;
1281- Ok ( PhysicalPlan :: new ( HashJoin {
1282- projections : projections,
1283- build_projections : build_projections,
1284- probe_projections : probe_projections,
1285- build : build_side,
1286- probe : probe_side,
1287- join_type : join. join_type ,
1288- build_keys : right_join_conditions,
1289- probe_keys : left_join_conditions,
1290- is_null_equal : is_null_equal,
1291- non_equi_conditions : non_equi_conditions,
1292- marker_index : join. marker_index ,
1293- meta : PhysicalPlanMeta :: new ( "HashJoin" ) ,
1294- from_correlated_subquery : join. from_correlated_subquery ,
1295- probe_to_build : probe_to_build,
1296- output_schema : output_schema,
1297- need_hold_hash_table : join. need_hold_hash_table ,
1298- stat_info : Some ( stat_info) ,
1299- single_to_inner : join. single_to_inner ,
1300- build_side_cache_info : build_side_cache_info,
1301- runtime_filter : runtime_filter,
1302- broadcast_id,
1303- } ) )
1304- }
1277+ Some ( self . ctx . get_next_broadcast_id ( ) )
1278+ } else {
1279+ None
1280+ } ;
1281+ Ok ( PhysicalPlan :: new ( HashJoin {
1282+ projections : projections,
1283+ build_projections : build_projections,
1284+ probe_projections : probe_projections,
1285+ build : build_side,
1286+ probe : probe_side,
1287+ join_type : join. join_type ,
1288+ build_keys : right_join_conditions,
1289+ probe_keys : left_join_conditions,
1290+ is_null_equal : is_null_equal,
1291+ non_equi_conditions : non_equi_conditions,
1292+ marker_index : join. marker_index ,
1293+ meta : PhysicalPlanMeta :: new ( "HashJoin" ) ,
1294+ from_correlated_subquery : join. from_correlated_subquery ,
1295+ probe_to_build : probe_to_build,
1296+ output_schema : output_schema,
1297+ need_hold_hash_table : join. need_hold_hash_table ,
1298+ stat_info : Some ( stat_info) ,
1299+ single_to_inner : join. single_to_inner ,
1300+ build_side_cache_info : build_side_cache_info,
1301+ runtime_filter : runtime_filter,
1302+ broadcast_id,
1303+ } ) )
13051304 }
13061305}
0 commit comments