/** * Configures a table's locality groups prior to initial table creation. * * Allows locality groups to be set prior to table creation. Additional calls to this method prior * to table creation will overwrite previous locality group mappings. * * @param groups * mapping of locality group names to column families in the locality group * * @since 2.0.0 * * @see TableOperations#setLocalityGroups */ public NewTableConfiguration setLocalityGroups(Map<String,Set<Text>> groups) { // ensure locality groups do not overlap LocalityGroupUtil.ensureNonOverlappingGroups(groups); Map<String,String> tmp = new HashMap<>(); for (Entry<String,Set<Text>> entry : groups.entrySet()) { Set<Text> colFams = entry.getValue(); String value = LocalityGroupUtil.encodeColumnFamilies(colFams); tmp.put(Property.TABLE_LOCALITY_GROUP_PREFIX + entry.getKey(), value); } tmp.put(Property.TABLE_LOCALITY_GROUPS.getKey(), String.join(",", groups.keySet())); checkDisjoint(properties, tmp, "locality groups"); localityProps = tmp; return this; }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String tableName = OptUtil.getTableOpt(cl, shellState); final Map<String,Set<Text>> groups = shellState.getAccumuloClient().tableOperations() .getLocalityGroups(tableName); for (Entry<String,Set<Text>> entry : groups.entrySet()) { shellState.getReader() .println(entry.getKey() + "=" + LocalityGroupUtil.encodeColumnFamilies(entry.getValue())); } return 0; }
String value = LocalityGroupUtil.encodeColumnFamilies(colFams); setPropertyNoChecks(tableName, Property.TABLE_LOCALITY_GROUP_PREFIX + entry.getKey(), value);
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String tableName = OptUtil.getTableOpt(cl, shellState); final Map<String,Set<Text>> groups = shellState.getConnector().tableOperations() .getLocalityGroups(tableName); for (Entry<String,Set<Text>> entry : groups.entrySet()) { shellState.getReader() .println(entry.getKey() + "=" + LocalityGroupUtil.encodeColumnFamilies(entry.getValue())); } return 0; }
String value = LocalityGroupUtil.encodeColumnFamilies(colFams); setProperty(tableName, Property.TABLE_LOCALITY_GROUP_PREFIX + entry.getKey(), value);