use of org.apache.kudu.client.LocatedTablet.Replica in project drill by apache.
the class KuduGroupScan method init.
private void init() {
String tableName = kuduScanSpec.getTableName();
Collection<DrillbitEndpoint> endpoints = storagePlugin.getContext().getBits();
Map<String, DrillbitEndpoint> endpointMap = Maps.newHashMap();
for (DrillbitEndpoint endpoint : endpoints) {
endpointMap.put(endpoint.getAddress(), endpoint);
}
try {
List<LocatedTablet> locations = storagePlugin.getClient().openTable(tableName).getTabletsLocations(10000);
for (LocatedTablet tablet : locations) {
KuduWork work = new KuduWork(tablet.getPartition().getPartitionKeyStart(), tablet.getPartition().getPartitionKeyEnd());
for (Replica replica : tablet.getReplicas()) {
String host = replica.getRpcHost();
DrillbitEndpoint ep = endpointMap.get(host);
if (ep != null) {
work.getByteMap().add(ep, DEFAULT_TABLET_SIZE);
}
}
kuduWorkList.add(work);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations