}
public Schema schema(String table) throws IOException {
TableContext tableContext = getTableContext(table);
FieldManager fieldManager = tableContext.getFieldManager();
Schema schema = new Schema().setTable(table);
schema.setFamilies(new HashMap<String, Map<String, ColumnDefinition>>());
Set<String> fieldNames = fieldManager.getFieldNames();
INNER: for (String fieldName : fieldNames) {
FieldTypeDefinition fieldTypeDefinition = fieldManager.getFieldTypeDefinition(fieldName);
if (fieldTypeDefinition == null) {
continue INNER;
}
String columnName = fieldTypeDefinition.getColumnName();
String columnFamily = fieldTypeDefinition.getFamily();
String subColumnName = fieldTypeDefinition.getSubColumnName();
Map<String, ColumnDefinition> map = schema.getFamilies().get(columnFamily);
if (map == null) {
map = new HashMap<String, ColumnDefinition>();
schema.putToFamilies(columnFamily, map);
}
if (subColumnName == null) {
map.put(columnName, getColumnDefinition(fieldTypeDefinition));
} else {
map.put(columnName + "." + subColumnName, getColumnDefinition(fieldTypeDefinition));