incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/5] git commit: Making schme command easier to use with large table schemas.
Date Wed, 11 Dec 2013 18:46:20 GMT
Making schme command easier to use with large table schemas.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/8c2110b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/8c2110b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/8c2110b4

Branch: refs/heads/apache-blur-0.2
Commit: 8c2110b465b3fe4b6acdcc7b06c14a6ee49c063a
Parents: 1db3d91
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Dec 10 21:20:53 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Dec 10 21:20:53 2013 -0500

----------------------------------------------------------------------
 .../apache/blur/shell/SchemaTableCommand.java   | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8c2110b4/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java b/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
index dad0ce4..fc878df 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
@@ -19,6 +19,8 @@
 package org.apache.blur.shell;
 
 import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -35,17 +37,23 @@ public class SchemaTableCommand extends Command implements TableFirstArgCommand
   @Override
   public void doit(PrintWriter out, Blur.Iface client, String[] args) throws CommandException,
TException,
       BlurException {
-    if (args.length != 2) {
+    if (args.length < 2) {
       throw new CommandException("Invalid args: " + help());
     }
     String tablename = args[1];
+    List<String> familiesToDisplay = new ArrayList<String>();
+    for (int i = 2; i < args.length; i++) {
+      familiesToDisplay.add(args[i]);
+    }
 
     Schema schema = client.schema(tablename);
-    out.println(schema);
-    out.println(schema.getTable());
+    out.println("table  : "+schema.getTable());
     Map<String, Map<String, ColumnDefinition>> families = schema.getFamilies();
     Set<String> familyNames = new TreeSet<String>(families.keySet());
     for (String cf : familyNames) {
+      if (!familiesToDisplay.isEmpty() && !familiesToDisplay.contains(cf)) {
+        continue;
+      }
       out.println("family : " + cf);
       Map<String, ColumnDefinition> columns = families.get(cf);
       Set<String> columnNames = new TreeSet<String>(columns.keySet());
@@ -75,6 +83,11 @@ public class SchemaTableCommand extends Command implements TableFirstArgCommand
         }
       }
     }
+    for (String f : familiesToDisplay) {
+      if (!familyNames.contains(f)) {
+        out.println("family : " + f + " NOT FOUND");
+      }
+    }
   }
 
   @Override
@@ -84,7 +97,7 @@ public class SchemaTableCommand extends Command implements TableFirstArgCommand
 
   @Override
   public String usage() {
-    return "<tablename>";
+    return "<tablename> [<family> ...]";
   }
 
   @Override


Mime
View raw message