17
17
*/
18
18
package org .apache .drill .exec .planner .fragment ;
19
19
20
+ import org .apache .drill .common .DrillNode ;
20
21
import org .apache .drill .common .util .function .CheckedConsumer ;
21
22
import org .apache .drill .exec .ops .QueryContext ;
22
23
import org .apache .drill .exec .physical .PhysicalOperatorSetupException ;
26
27
import org .apache .drill .exec .proto .CoordinationProtos .DrillbitEndpoint ;
27
28
import org .apache .drill .exec .util .memory .ZKQueueMemoryAllocationUtilities ;
28
29
import org .apache .drill .exec .work .foreman .rm .QueryResourceManager ;
29
- import org . apache . drill . shaded . guava . com . google . common . collect . ArrayListMultimap ;
30
- import org . apache . drill . shaded . guava . com . google . common . collect . Multimap ;
30
+
31
+ import java . util . ArrayList ;
31
32
import java .util .Collection ;
33
+ import java .util .List ;
32
34
import java .util .Map ;
33
35
import java .util .HashMap ;
34
36
import java .util .Set ;
@@ -69,15 +71,17 @@ public void adjustMemory(PlanningSet planningSet, Set<Wrapper> roots,
69
71
70
72
71
73
public class Collector extends AbstractOpWrapperVisitor <Void , RuntimeException > {
72
- private final Multimap < DrillbitEndpoint , PhysicalOperator > bufferedOperators ;
74
+ private final Map < DrillNode , List < PhysicalOperator > > bufferedOperators ;
73
75
74
76
public Collector () {
75
- this .bufferedOperators = ArrayListMultimap . create ();
77
+ this .bufferedOperators = new HashMap <> ();
76
78
}
77
79
78
80
private void getMinorFragCountPerDrillbit (Wrapper currFragment , PhysicalOperator operator ) {
79
81
for (DrillbitEndpoint endpoint : currFragment .getAssignedEndpoints ()) {
80
- bufferedOperators .put (endpoint , operator );
82
+ DrillNode node = new DrillNode (endpoint );
83
+ bufferedOperators .putIfAbsent (node , new ArrayList <>());
84
+ bufferedOperators .get (node ).add (operator );
81
85
}
82
86
}
83
87
@@ -103,10 +107,10 @@ public Void visitOp(PhysicalOperator op, Wrapper fragment) {
103
107
}
104
108
105
109
public Map <String , Collection <PhysicalOperator >> getNodeMap () {
106
- Map <DrillbitEndpoint , Collection <PhysicalOperator >> endpointCollectionMap = bufferedOperators . asMap () ;
110
+ Map <DrillNode , List <PhysicalOperator >> endpointCollectionMap = bufferedOperators ;
107
111
Map <String , Collection <PhysicalOperator >> nodeMap = new HashMap <>();
108
- for (Map .Entry <DrillbitEndpoint , Collection <PhysicalOperator >> entry : endpointCollectionMap .entrySet ()) {
109
- nodeMap .put (entry .getKey ().getAddress (), entry .getValue ());
112
+ for (Map .Entry <DrillNode , List <PhysicalOperator >> entry : endpointCollectionMap .entrySet ()) {
113
+ nodeMap .put (entry .getKey ().toString (), entry .getValue ());
110
114
}
111
115
112
116
return nodeMap ;
0 commit comments