use of org.apache.drill.exec.physical.EndpointAffinity in project drill by apache.
the class AbstractMuxExchange method getReceiverParallelizationInfo.
@Override
public ParallelizationInfo getReceiverParallelizationInfo(List<DrillbitEndpoint> senderFragmentEndpoints) {
Preconditions.checkArgument(senderFragmentEndpoints != null && senderFragmentEndpoints.size() > 0, "Sender fragment endpoint list should not be empty");
// We want to run one mux receiver per Drillbit endpoint.
// Identify the number of unique Drillbit endpoints in sender fragment endpoints.
List<DrillbitEndpoint> drillbitEndpoints = ImmutableSet.copyOf(senderFragmentEndpoints).asList();
List<EndpointAffinity> affinities = Lists.newArrayList();
for (DrillbitEndpoint ep : drillbitEndpoints) {
affinities.add(new EndpointAffinity(ep, Double.POSITIVE_INFINITY));
}
return ParallelizationInfo.create(affinities.size(), affinities.size(), affinities);
}
use of org.apache.drill.exec.physical.EndpointAffinity in project drill by apache.
the class MapRDBGroupScan method getOperatorAffinity.
@Override
public List<EndpointAffinity> getOperatorAffinity() {
watch.reset();
watch.start();
Map<String, DrillbitEndpoint> endpointMap = new HashMap<>();
for (DrillbitEndpoint ep : formatPlugin.getContext().getBits()) {
endpointMap.put(ep.getAddress(), ep);
}
final Map<DrillbitEndpoint, EndpointAffinity> affinityMap = new HashMap<>();
for (String serverName : getRegionsToScan().values()) {
DrillbitEndpoint ep = endpointMap.get(serverName);
if (ep != null) {
EndpointAffinity affinity = affinityMap.get(ep);
if (affinity == null) {
affinityMap.put(ep, new EndpointAffinity(ep, 1));
} else {
affinity.addAffinity(1);
}
}
}
logger.debug("Took {} µs to get operator affinity", watch.elapsed(TimeUnit.NANOSECONDS) / 1000);
return Lists.newArrayList(affinityMap.values());
}
use of org.apache.drill.exec.physical.EndpointAffinity in project drill by apache.
the class HBaseGroupScan method getOperatorAffinity.
@Override
public List<EndpointAffinity> getOperatorAffinity() {
watch.reset();
watch.start();
Map<String, DrillbitEndpoint> endpointMap = new HashMap<>();
for (DrillbitEndpoint ep : storagePlugin.getContext().getBits()) {
endpointMap.put(ep.getAddress(), ep);
}
Map<DrillbitEndpoint, EndpointAffinity> affinityMap = new HashMap<>();
for (ServerName sn : regionsToScan.values()) {
DrillbitEndpoint ep = endpointMap.get(sn.getHostname());
if (ep != null) {
EndpointAffinity affinity = affinityMap.get(ep);
if (affinity == null) {
affinityMap.put(ep, new EndpointAffinity(ep, 1));
} else {
affinity.addAffinity(1);
}
}
}
logger.debug("Took {} µs to get operator affinity", watch.elapsed(TimeUnit.NANOSECONDS) / 1000);
return new ArrayList<>(affinityMap.values());
}
Aggregations