public class TableUtil {
@SuppressWarnings("rawtypes")
public static Map<String, List> getTableSummaries() throws IOException, TException {
Iface client = BlurClient.getClient(Config.getConnectionString());
List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>();
List<String> clusters = client.shardClusterList();
for (String cluster : clusters) {
List<String> tables = client.tableListByCluster(cluster);
for (String table : tables) {
Map<String, Object> tableInfo = new HashMap<String, Object>();
TableDescriptor descriptor = client.describe(table);
tableInfo.put("cluster", cluster);
tableInfo.put("name", table);
tableInfo.put("enabled", descriptor.isEnabled());
if (descriptor.isEnabled()) {
TableStats stats = client.tableStats(table);
tableInfo.put("rows", stats.getRowCount());
tableInfo.put("records", stats.getRecordCount());
Schema schema = client.schema(table);
tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet()));
} else {
tableInfo.put("rows", "?");
tableInfo.put("records", "?");
tableInfo.put("families", new ArrayList<String>());