byte[][] parsedSplitKeys = TableConfig.parseSplitKeys(null, splitKeys, splitKeyPrefix); createDescriptor = new TableCreateDescriptor(tableName, parsedSplitKeys); } else if (regionCount != -1) { byte[][] parsedSplitKeys = TableConfig.parseSplitKeys(regionCount, null, splitKeyPrefix); createDescriptor = new TableCreateDescriptor(tableName, parsedSplitKeys); } else {
public static List<TableConfigEntry> buildTableConfigs(Conf conf) { List<TableConfigEntry> result = new ArrayList<TableConfigEntry>(); for (Conf table : conf.getChildren("table")) { String tableName = table.getAttribute("name"); Pattern tableNamePattern; try { tableNamePattern = Pattern.compile(tableName); } catch (PatternSyntaxException e) { throw new RuntimeException("The table name should be a valid regular expression, " + "which the following is not: " + tableName + " at " + conf.getLocation()); } Integer regionCount = table.getChild("splits").getChild("regionCount").getValueAsInteger(-1); String splitKeysAsString = table.getChild("splits").getChild("splitKeys").getValue(null); String splitKeyPrefix = table.getChild("splits").getChild("splitKeyPrefix").getValue(null); byte[][] splitKeys = TableConfig.parseSplitKeys(regionCount, splitKeysAsString, splitKeyPrefix); Long maxFileSize = table.getChild("maxFileSize").getValueAsLong(null); Long memStoreFlushSize = table.getChild("memStoreFlushSize").getValueAsLong(null); TableConfig config = new TableConfig(splitKeys); config.setMaxFileSize(maxFileSize); config.setMemStoreFlushSize(memStoreFlushSize); for (Conf familyConf : table.getChild("families").getChildren("family")) { ColumnFamilyConfig family = buildCfConfig(familyConf); String familyName = familyConf.getAttribute("name"); config.getColumnFamilies().put(familyName, family); } result.add(new TableConfigEntry(tableNamePattern, config)); } return result; }