keith-turner commented on a change in pull request #370: ACCUMULO-4772 Update 
shell to use NewTableConfiguration methods
URL: https://github.com/apache/accumulo/pull/370#discussion_r164863285
 
 

 ##########
 File path: 
shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java
 ##########
 @@ -150,9 +168,67 @@ public int execute(final String fullCommand, final 
CommandLine cl, final Shell s
     return 0;
   }
 
+  /**
+   * Add supplied locality groups information to a NewTableConfiguration 
object.
+   *
+   * Used in conjunction with createtable shell command to allow locality 
groups to be configured upon table creation.
+   */
+  private NewTableConfiguration setLocalityForNewTable(CommandLine cl, 
NewTableConfiguration ntc) {
+    HashMap<String,Set<Text>> localityGroupMap = new HashMap<>();
+    String[] options = 
cl.getOptionValues(createTableOptLocalityProps.getOpt());
+    for (String localityInfo : options) {
+      final String parts[] = localityInfo.split("=", 2);
+      if (parts.length < 2)
+        throw new IllegalArgumentException("Missing '=' or there are spaces 
between entries");
+      final String groupName = parts[0];
+      final HashSet<Text> colFams = new HashSet<>();
+      for (String family : parts[1].split(","))
+        colFams.add(new Text(family.getBytes(Shell.CHARSET)));
+      localityGroupMap.put(groupName, colFams);
 
 Review comment:
   A sanity check to see if the if the group name already exist in the map 
would be nice.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to