@@ -3596,6 +3596,7 @@ Map<TNetworkAddress, TPipelineFragmentParams> toTPipelineParams(int backendNum)
3596
3596
}
3597
3597
3598
3598
Map <TNetworkAddress , TPipelineFragmentParams > res = new HashMap ();
3599
+ Map <TNetworkAddress , Integer > instanceIdx = new HashMap ();
3599
3600
for (int i = 0 ; i < instanceExecParams .size (); ++i ) {
3600
3601
final FInstanceExecParam instanceExecParam = instanceExecParams .get (i );
3601
3602
if (!res .containsKey (instanceExecParam .host )) {
@@ -3625,10 +3626,16 @@ Map<TNetworkAddress, TPipelineFragmentParams> toTPipelineParams(int backendNum)
3625
3626
params .setNumBuckets (fragment .getBucketNum ());
3626
3627
res .put (instanceExecParam .host , params );
3627
3628
res .get (instanceExecParam .host ).setBucketSeqToInstanceIdx (new HashMap <Integer , Integer >());
3629
+ instanceIdx .put (instanceExecParam .host , 0 );
3628
3630
}
3631
+ // Set each bucket belongs to which instance on this BE.
3632
+ // This is used for LocalExchange(BUCKET_HASH_SHUFFLE).
3633
+ int instanceId = instanceIdx .get (instanceExecParam .host );
3629
3634
for (int bucket : instanceExecParam .bucketSeqSet ) {
3630
- res .get (instanceExecParam .host ).getBucketSeqToInstanceIdx ().put (bucket , i );
3635
+ res .get (instanceExecParam .host ).getBucketSeqToInstanceIdx ().put (bucket , instanceId );
3636
+
3631
3637
}
3638
+ instanceIdx .replace (instanceExecParam .host , ++instanceId );
3632
3639
TPipelineFragmentParams params = res .get (instanceExecParam .host );
3633
3640
TPipelineInstanceParams localParams = new TPipelineInstanceParams ();
3634
3641
0 commit comments