incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/4] git commit: Read stack should now work with tables as args and shardids as args.
Date Thu, 11 Sep 2014 19:12:03 GMT
Read stack should now work with tables as args and shardids as args.


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

Branch: refs/heads/master
Commit: b55cf9e5c78adea6a9e65cf1ef1b8ea487266c91
Parents: 2c2e870
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Sep 11 15:10:43 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Sep 11 15:10:43 2014 -0400

----------------------------------------------------------------------
 .../command/TestBlurObjectCommandUsing.java     |   2 +-
 .../apache/blur/command/BaseCommandManager.java |  57 ++++++++++
 .../org/apache/blur/command/ClusterContext.java |   6 +-
 .../org/apache/blur/command/CommandUtil.java    |   6 +-
 .../blur/command/ControllerClusterContext.java  | 105 +++++++++++------
 .../blur/command/ControllerCommandManager.java  |  15 +--
 .../java/org/apache/blur/command/Shard.java     |  52 ++++++---
 .../blur/command/ShardCommandManager.java       | 101 ++++++----------
 .../org/apache/blur/server/LayoutFactory.java   |  35 ++++++
 .../blur/thrift/BlurControllerServer.java       |  99 +++++++++++++++-
 .../org/apache/blur/thrift/BlurShardServer.java |  15 ++-
 .../blur/command/ShardCommandManagerTest.java   |  22 ++--
 .../apache/blur/thrift/generated/Arguments.java |   4 +-
 .../org/apache/blur/thrift/generated/Blur.java  |  24 ++--
 .../blur/thrift/generated/BlurQueryStatus.java  |   4 +-
 .../blur/thrift/generated/BlurResults.java      |   4 +-
 .../blur/thrift/generated/ColumnDefinition.java |   4 +-
 .../apache/blur/thrift/generated/Metric.java    |  12 +-
 .../apache/blur/thrift/generated/Response.java  |   8 +-
 .../apache/blur/thrift/generated/Schema.java    |   8 +-
 .../apache/blur/thrift/generated/Selector.java  |   4 +-
 .../org/apache/blur/thrift/generated/Shard.java | 114 +++++++++++++++++--
 .../blur/thrift/generated/TableDescriptor.java  |   8 +-
 .../org/apache/blur/thrift/generated/User.java  |   8 +-
 .../apache/blur/thrift/util/CommandExample.java |  39 ++-----
 .../src/main/scripts/interface/Blur.thrift      |   3 +-
 .../main/scripts/interface/gen-html/Blur.html   |   3 +-
 .../apache/blur/thrift/generated/Arguments.java |   4 +-
 .../org/apache/blur/thrift/generated/Blur.java  |  24 ++--
 .../blur/thrift/generated/BlurQueryStatus.java  |   4 +-
 .../blur/thrift/generated/BlurResults.java      |   4 +-
 .../blur/thrift/generated/ColumnDefinition.java |   4 +-
 .../apache/blur/thrift/generated/Metric.java    |  12 +-
 .../apache/blur/thrift/generated/Response.java  |   8 +-
 .../apache/blur/thrift/generated/Schema.java    |   8 +-
 .../apache/blur/thrift/generated/Selector.java  |   4 +-
 .../org/apache/blur/thrift/generated/Shard.java | 114 +++++++++++++++++--
 .../blur/thrift/generated/TableDescriptor.java  |   8 +-
 .../org/apache/blur/thrift/generated/User.java  |   8 +-
 .../main/scripts/interface/gen-js/Blur_types.js |  21 +++-
 .../scripts/interface/gen-perl/Blur/Types.pm    |  19 +++-
 .../main/scripts/interface/gen-rb/blur_types.rb |   4 +-
 docs/Blur.html                                  |   3 +-
 43 files changed, 719 insertions(+), 292 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommandUsing.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommandUsing.java b/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommandUsing.java
index c2a7a80..2e99d10 100644
--- a/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommandUsing.java
+++ b/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommandUsing.java
@@ -31,7 +31,7 @@ public class TestBlurObjectCommandUsing {
 
   public static void main(String[] args) throws BlurException, TException, IOException {
     Client client = BlurClientManager.getClientPool().getClient(new Connection("localhost:40010"));
-    Response response = client.execute("test", "testBlurObject", null);
+    Response response = client.execute("testBlurObject", null);
     BlurObject object = (BlurObject) ObjectArrayPacking.unpack(response.getValue().getBlurObject());
     System.out.println(object);
     // prints => {"docCount":10005}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index de37d65..5e40f9a 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -8,6 +8,8 @@ import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.ConcurrentHashMap;
@@ -155,4 +157,59 @@ public class BaseCommandManager implements Closeable {
   protected String getCommandName(Class<? extends Command> clazz) {
     return _commandNameLookup.get(clazz);
   }
+
+  protected Map<String, Set<Shard>> getShards(Command command, final Args args, Set<String> tables) throws IOException {
+    Map<String, Set<Shard>> shardMap = new TreeMap<String, Set<Shard>>();
+    if (command instanceof ShardRoute) {
+      ShardRoute shardRoute = (ShardRoute) command;
+      for (String table : tables) {
+        shardMap.put(table, shardRoute.resolveShards(table, args));
+      }
+    } else {
+      if (tables.size() > 1) {
+        throw new IOException(
+            "Cannot route to single shard when multiple tables are specified.  Implement ShardRoute on your command.");
+      }
+      String singleTable = tables.iterator().next();
+      Set<Shard> shardSet = new TreeSet<Shard>();
+      String shard = args.get("shard");
+      if (shard == null) {
+        BlurArray shardArray = args.get("shards");
+        if (shardArray != null) {
+          for (int i = 0; i < shardArray.length(); i++) {
+            shardSet.add(new Shard(singleTable, shardArray.getString(i)));
+          }
+        }
+      } else {
+        shardSet.add(new Shard(singleTable, shard));
+      }
+      shardMap.put(singleTable, shardSet);
+    }
+    return shardMap;
+  }
+
+  protected Set<String> getTables(Command command, final Args args) throws IOException {
+    Set<String> tables = new TreeSet<String>();
+    if (command instanceof TableRoute) {
+      TableRoute tableRoute = (TableRoute) command;
+      tables.addAll(tableRoute.resolveTables(args));
+    } else {
+      if (args == null) {
+        return tables;
+      }
+      String table = args.get("table");
+      if (table == null) {
+        BlurArray tableArray = args.get("tables");
+        if (tableArray == null) {
+          return tables;
+        }
+        for (int i = 0; i < tableArray.length(); i++) {
+          tables.add(tableArray.getString(i));
+        }
+      } else {
+        tables.add(table);
+      }
+    }
+    return tables;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java b/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
index 10d0126..b199cb5 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
@@ -29,11 +29,11 @@ public abstract class ClusterContext {
 
   public abstract Args getArgs();
 
-  public abstract TableContext getTableContext();
+  public abstract TableContext getTableContext(String table) throws IOException;
 
-  public abstract BlurConfiguration getBlurConfiguration();
+  public abstract BlurConfiguration getBlurConfiguration(String table) throws IOException;
 
-  public abstract Configuration getConfiguration();
+  public abstract Configuration getConfiguration(String table) throws IOException;
 
   public abstract <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexReadCommand<T>> clazz)
       throws IOException;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/CommandUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/CommandUtil.java b/blur-core/src/main/java/org/apache/blur/command/CommandUtil.java
index 1dd6a91..5e61661 100644
--- a/blur-core/src/main/java/org/apache/blur/command/CommandUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/command/CommandUtil.java
@@ -56,7 +56,8 @@ public class CommandUtil {
       T key = e.getKey();
       if (key instanceof Shard) {
         Shard shard = (Shard) key;
-        result.put((R) new org.apache.blur.thrift.generated.Shard(shard.getShard()), toValueObject(e.getValue()));
+        result.put((R) new org.apache.blur.thrift.generated.Shard(shard.getTable(), shard.getShard()),
+            toValueObject(e.getValue()));
       } else if (key instanceof Server) {
         Server server = (Server) key;
         result.put((R) new org.apache.blur.thrift.generated.Server(server.getServer()), toValueObject(e.getValue()));
@@ -148,7 +149,8 @@ public class CommandUtil {
       Map<org.apache.blur.thrift.generated.Shard, ValueObject> shardToValue) {
     Map<Shard, T> result = new HashMap<Shard, T>();
     for (Entry<org.apache.blur.thrift.generated.Shard, ValueObject> e : shardToValue.entrySet()) {
-      result.put(new Shard(e.getKey().getShard()), (T) CommandUtil.toObject(e.getValue()));
+      org.apache.blur.thrift.generated.Shard shard = e.getKey();
+      result.put(new Shard(shard.getTable(), shard.getShard()), (T) CommandUtil.toObject(e.getValue()));
     }
     return result;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
index 7a20f17..dfb030b 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
@@ -14,7 +14,9 @@ import java.util.concurrent.Future;
 import org.apache.blur.BlurConfiguration;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
+import org.apache.blur.server.LayoutFactory;
 import org.apache.blur.server.TableContext;
+import org.apache.blur.server.TableContextFactory;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thrift.BlurClientManager;
 import org.apache.blur.thrift.ClientPool;
@@ -49,27 +51,27 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   private final static Log LOG = LogFactory.getLog(ControllerClusterContext.class);
 
   private final Args _args;
-  private final TableContext _tableContext;
+  private final TableContextFactory _tableContextFactory;
   private final Map<Server, Client> _clientMap;
   private final ControllerCommandManager _manager;
-  private final Map<String, String> _tableLayout;
+  private final LayoutFactory _layoutFactory;
 
-  public ControllerClusterContext(TableContext tableContext, Args args, Map<String, String> tableLayout,
+  public ControllerClusterContext(TableContextFactory tableContextFactory, LayoutFactory layoutFactory, Args args,
       ControllerCommandManager manager) throws IOException {
-    _tableContext = tableContext;
+    _tableContextFactory = tableContextFactory;
     _args = args;
-    _clientMap = getBlurClientsForTable(_tableContext.getTable(), tableLayout);
+    _clientMap = getBlurClientsForCluster(layoutFactory.getServerConnections());
     _manager = manager;
-    _tableLayout = tableLayout;
+    _layoutFactory = layoutFactory;
   }
 
-  public Map<Server, Client> getBlurClientsForTable(String table, Map<String, String> tableLayout) throws IOException {
+  public Map<Server, Client> getBlurClientsForCluster(Set<Connection> serverConnections) throws IOException {
     Map<Server, Client> clients = new HashMap<Server, Client>();
-    for (String serverStr : tableLayout.values()) {
+    for (Connection serverConnection : serverConnections) {
       try {
-        Client client = BlurClientManager.getClientPool().getClient(new Connection(serverStr));
+        Client client = BlurClientManager.getClientPool().getClient(serverConnection);
         client.refresh();
-        clients.put(new Server(serverStr), client);
+        clients.put(new Server(serverConnection.getHost() + ":" + serverConnection.getPort()), client);
       } catch (TException e) {
         throw new IOException(e);
       }
@@ -83,8 +85,8 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   }
 
   @Override
-  public TableContext getTableContext() {
-    return _tableContext;
+  public TableContext getTableContext(String table) throws IOException {
+    return _tableContextFactory.getTableContext(table);
   }
 
   @Override
@@ -112,38 +114,55 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
 
   @SuppressWarnings("unchecked")
   @Override
-  public <T> Map<Shard, Future<T>> readIndexesAsync(final Args args, Class<? extends IndexReadCommand<T>> clazz) {
+  public <T> Map<Shard, Future<T>> readIndexesAsync(final Args args, Class<? extends IndexReadCommand<T>> clazz)
+      throws IOException {
     final String commandName = _manager.getCommandName((Class<? extends Command>) clazz);
+    Command command = _manager.getCommandObject(commandName);
     Map<Shard, Future<T>> futureMap = new HashMap<Shard, Future<T>>();
-    for (Entry<Server, Client> e : _clientMap.entrySet()) {
+    Set<String> tables = _manager.getTables(command, args);
+    Map<String, Set<Shard>> shards = _manager.getShards(command, args, tables);
+    Map<Server, Client> clientMap = getClientMap(command, args, tables, shards);
+
+    for (Entry<Server, Client> e : clientMap.entrySet()) {
       Server server = e.getKey();
       final Client client = e.getValue();
       Future<Map<Shard, T>> future = _manager.submitToExecutorService(new Callable<Map<Shard, T>>() {
         @Override
         public Map<Shard, T> call() throws Exception {
           Arguments arguments = CommandUtil.toArguments(args);
-          Response response = waitForResponse(client, getTable(), commandName, arguments);
+          Response response = waitForResponse(client, commandName, arguments);
           Map<Shard, Object> shardToValue = CommandUtil.fromThriftToObject(response.getShardToValue());
           return (Map<Shard, T>) shardToValue;
         }
       });
-      Set<Shard> shards = getShardsOnServer(server);
-      for (Shard shard : shards) {
+      for (Shard shard : getShardsOnServer(server, tables, shards)) {
         futureMap.put(shard, new ShardResultFuture<T>(shard, future));
       }
     }
     return futureMap;
   }
 
-  protected static Response waitForResponse(Client client, String table, String commandName, Arguments arguments)
-      throws TException {
+  private Map<Server, Client> getClientMap(Command command, Args args, Set<String> tables,
+      Map<String, Set<Shard>> shards) throws IOException {
+    Map<Server, Client> result = new HashMap<Server, Client>();
+
+    for (Entry<Server, Client> e : _clientMap.entrySet()) {
+      Server server = e.getKey();
+      if (_layoutFactory.isValidServer(server, tables, shards)) {
+        result.put(server, e.getValue());
+      }
+    }
+    return result;
+  }
+
+  protected static Response waitForResponse(Client client, String commandName, Arguments arguments) throws TException {
     // TODO This should likely be changed to run of a AtomicBoolean used for
     // the status of commands.
     String executionId = null;
     while (true) {
       try {
         if (executionId == null) {
-          return client.execute(table, commandName, arguments);
+          return client.execute(commandName, arguments);
         } else {
           return client.reconnect(executionId);
         }
@@ -158,35 +177,49 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
     }
   }
 
-  private Set<Shard> getShardsOnServer(Server server) {
-    Set<Shard> shards = new HashSet<Shard>();
-    for (Entry<String, String> e : _tableLayout.entrySet()) {
-      String value = e.getValue();
-      if (value.equals(server.getServer())) {
-        shards.add(new Shard(e.getKey()));
+  private Set<Shard> getShardsOnServer(Server server, Set<String> tables, Map<String, Set<Shard>> shards)
+      throws IOException {
+    Set<Shard> serverLayout = _layoutFactory.getServerLayout(server);
+    Set<Shard> result = new HashSet<Shard>();
+    for (Shard shard : serverLayout) {
+      if (isValid(shard, tables, shards)) {
+        result.add(shard);
       }
     }
-    return shards;
+    return result;
   }
 
-  private String getTable() {
-    return getTableContext().getTable();
+  private boolean isValid(Shard shard, Set<String> tables, Map<String, Set<Shard>> shards) {
+    String table = shard.getTable();
+    if (!tables.contains(table)) {
+      return false;
+    }
+    Set<Shard> shardSet = shards.get(table);
+    if (shardSet.isEmpty()) {
+      return true;
+    } else {
+      return shardSet.contains(shard);
+    }
   }
 
   @SuppressWarnings("unchecked")
   @Override
   public <T> Map<Server, Future<T>> readServersAsync(final Args args,
-      Class<? extends IndexReadCombiningCommand<?, T>> clazz) {
+      Class<? extends IndexReadCombiningCommand<?, T>> clazz) throws IOException {
     final String commandName = _manager.getCommandName((Class<? extends Command>) clazz);
+    Command command = _manager.getCommandObject(commandName);
     Map<Server, Future<T>> futureMap = new HashMap<Server, Future<T>>();
-    for (Entry<Server, Client> e : _clientMap.entrySet()) {
+    Set<String> tables = _manager.getTables(command, args);
+    Map<String, Set<Shard>> shards = _manager.getShards(command, args, tables);
+    Map<Server, Client> clientMap = getClientMap(command, args, tables, shards);
+    for (Entry<Server, Client> e : clientMap.entrySet()) {
       Server server = e.getKey();
       final Client client = e.getValue();
       Future<T> future = _manager.submitToExecutorService(new Callable<T>() {
         @Override
         public T call() throws Exception {
           Arguments arguments = CommandUtil.toArguments(args);
-          Response response = waitForResponse(client, getTable(), commandName, arguments);
+          Response response = waitForResponse(client, commandName, arguments);
           ValueObject valueObject = response.getValue();
           return (T) CommandUtil.toObject(valueObject);
         }
@@ -223,13 +256,13 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   }
 
   @Override
-  public BlurConfiguration getBlurConfiguration() {
-    return _tableContext.getBlurConfiguration();
+  public BlurConfiguration getBlurConfiguration(String table) throws IOException {
+    return _tableContextFactory.getTableContext(table).getBlurConfiguration();
   }
 
   @Override
-  public Configuration getConfiguration() {
-    return _tableContext.getConfiguration();
+  public Configuration getConfiguration(String table) throws IOException {
+    return _tableContextFactory.getTableContext(table).getConfiguration();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
index 18e33af..4b13e51 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
@@ -4,7 +4,8 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.Callable;
 
-import org.apache.blur.server.TableContext;
+import org.apache.blur.server.LayoutFactory;
+import org.apache.blur.server.TableContextFactory;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,9 +30,9 @@ public class ControllerCommandManager extends BaseCommandManager {
     super(threadCount, connectionTimeout);
   }
 
-  public Response execute(TableContext tableContext, String commandName, final Args args,
-      Map<String, String> tableLayout) throws IOException, TimeoutException {
-    final ClusterContext context = createCommandContext(tableContext, args, tableLayout);
+  public Response execute(TableContextFactory tableContextFactory, LayoutFactory layoutFactory, String commandName,
+      final Args args) throws IOException, TimeoutException {
+    final ClusterContext context = createCommandContext(tableContextFactory, layoutFactory, args);
     final Command command = getCommandObject(commandName);
     if (command == null) {
       throw new IOException("Command with name [" + commandName + "] not found.");
@@ -75,9 +76,9 @@ public class ControllerCommandManager extends BaseCommandManager {
     return Response.createNewServerResponse(result);
   }
 
-  private ClusterContext createCommandContext(TableContext tableContext, Args args, Map<String, String> tableLayout)
-      throws IOException {
-    return new ControllerClusterContext(tableContext, args, tableLayout, this);
+  private ClusterContext createCommandContext(TableContextFactory tableContextFactory, LayoutFactory layoutFactory,
+      Args args) throws IOException {
+    return new ControllerClusterContext(tableContextFactory, layoutFactory, args, this);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/Shard.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/Shard.java b/blur-core/src/main/java/org/apache/blur/command/Shard.java
index 421fde4..a431d92 100644
--- a/blur-core/src/main/java/org/apache/blur/command/Shard.java
+++ b/blur-core/src/main/java/org/apache/blur/command/Shard.java
@@ -20,16 +20,44 @@ package org.apache.blur.command;
 public class Shard implements Comparable<Shard> {
 
   private final String _shard;
+  private final String _table;
 
-  public Shard(String shard) {
+  public Shard(String table, String shard) {
+    _table = table;
     _shard = shard;
   }
 
   @Override
+  public int compareTo(Shard o) {
+    if (o == null) {
+      return -1;
+    }
+    int compareTo = _table.compareTo(o._table);
+    if (compareTo == 0) {
+      return _shard.compareTo(o._shard);
+    }
+    return compareTo;
+  }
+
+  @Override
+  public String toString() {
+    return "Shard [_table=" + _table + ", _shard=" + _shard + "]";
+  }
+
+  public String getShard() {
+    return _shard;
+  }
+
+  public String getTable() {
+    return _table;
+  }
+
+  @Override
   public int hashCode() {
     final int prime = 31;
     int result = 1;
     result = prime * result + ((_shard == null) ? 0 : _shard.hashCode());
+    result = prime * result + ((_table == null) ? 0 : _table.hashCode());
     return result;
   }
 
@@ -47,24 +75,12 @@ public class Shard implements Comparable<Shard> {
         return false;
     } else if (!_shard.equals(other._shard))
       return false;
+    if (_table == null) {
+      if (other._table != null)
+        return false;
+    } else if (!_table.equals(other._table))
+      return false;
     return true;
   }
 
-  public String getShard() {
-    return _shard;
-  }
-
-  @Override
-  public int compareTo(Shard o) {
-    if (o == null) {
-      return -1;
-    }
-    return _shard.compareTo(o._shard);
-  }
-
-  @Override
-  public String toString() {
-    return "Shard [shard=" + _shard + "]";
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
index 40d00a1..25a4f10 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
@@ -17,13 +17,10 @@
 package org.apache.blur.command;
 
 import java.io.IOException;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -92,28 +89,41 @@ public class ShardCommandManager extends BaseCommandManager {
       throw new IOException("At least one table needs to specified.");
     }
     Map<String, Set<Shard>> shardMap = getShards(command, args, tables);
-    
-    Map<String, BlurIndex> indexes = _indexServer.getIndexes(tableContext.getTable());
-    Map<String, Future<?>> futureMap = new HashMap<String, Future<?>>();
-    for (Entry<String, BlurIndex> e : indexes.entrySet()) {
-      String shardId = e.getKey();
-      final Shard shard = new Shard(shardId);
-      final BlurIndex blurIndex = e.getValue();
-      Callable<Object> callable;
-      if (command instanceof IndexReadCommand) {
-        final IndexReadCommand<?> readCommand = (IndexReadCommand<?>) command.clone();
-        callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCommand);
-      } else if (command instanceof IndexReadCombiningCommand) {
-        final IndexReadCombiningCommand<?, ?> readCombiningCommand = (IndexReadCombiningCommand<?, ?>) command.clone();
-        callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCombiningCommand);
-      } else {
-        throw new IOException("Command type of [" + command.getClass() + "] not supported.");
+
+    Map<Shard, Future<?>> futureMap = new HashMap<Shard, Future<?>>();
+    for (String table : tables) {
+      Set<Shard> shardSet = shardMap.get(table);
+      boolean checkShards = !shardSet.isEmpty();
+      
+      TableContext tableContext = tableContextFactory.getTableContext(table);
+      Map<String, BlurIndex> indexes = _indexServer.getIndexes(table);
+      for (Entry<String, BlurIndex> e : indexes.entrySet()) {
+        String shardId = e.getKey();
+        final Shard shard = new Shard(table, shardId);
+        if (checkShards) {
+          if (!shardSet.contains(shard)) {
+            continue;
+          }
+        }
+        final BlurIndex blurIndex = e.getValue();
+        Callable<Object> callable;
+        if (command instanceof IndexReadCommand) {
+          final IndexReadCommand<?> readCommand = (IndexReadCommand<?>) command.clone();
+          callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCommand);
+        } else if (command instanceof IndexReadCombiningCommand) {
+          final IndexReadCombiningCommand<?, ?> readCombiningCommand = (IndexReadCombiningCommand<?, ?>) command
+              .clone();
+          callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCombiningCommand);
+        } else {
+          throw new IOException("Command type of [" + command.getClass() + "] not supported.");
+        }
+        Future<Object> future = submitToExecutorService(callable);
+        futureMap.put(shard, future);
       }
-      Future<Object> future = submitToExecutorService(callable);
-      futureMap.put(shardId, future);
     }
     Map<Shard, Object> resultMap = new HashMap<Shard, Object>();
-    for (Entry<String, Future<?>> e : futureMap.entrySet()) {
+    for (Entry<Shard, Future<?>> e : futureMap.entrySet()) {
+      Shard shard = e.getKey();
       Future<?> future = e.getValue();
       Object object;
       try {
@@ -123,57 +133,12 @@ public class ShardCommandManager extends BaseCommandManager {
       } catch (ExecutionException ex) {
         throw new IOException(ex.getCause());
       }
-      resultMap.put(new Shard(e.getKey()), object);
+      resultMap.put(shard, object);
     }
     return resultMap;
   }
 
-  private Map<String, Set<Shard>> getShards(Command command, final Args args, Set<String> tables) throws IOException {
-    Map<String, Set<Shard>> shardMap = new TreeMap<String, Set<Shard>>();
-    if (command instanceof ShardRoute) {
-      ShardRoute shardRoute = (ShardRoute) command;
-      for (String table : tables) {
-        shardMap.put(table, shardRoute.resolveShards(table, args));
-      }
-    } else {
-      if (tables.size() > 1) {
-        throw new IOException(
-            "Cannot route to single shard when multiple tables are specified.  Implement ShardRoute on your command.");
-      }
-      Set<Shard> shardSet = new TreeSet<Shard>();
-      String shard = args.get("shard");
-      if (shard == null) {
-        BlurArray shardArray = args.get("shards");
-        for (int i = 0; i < shardArray.length(); i++) {
-          shardSet.add(new Shard(shardArray.getString(i)));
-        }
-      } else {
-        shardSet.add(new Shard(shard));
-      }
-      String singleTable = tables.iterator().next();
-      shardMap.put(singleTable, shardSet);
-    }
-    return shardMap;
-  }
 
-  private Set<String> getTables(Command command, final Args args) {
-    Set<String> tables = new TreeSet<String>();
-    if (command instanceof TableRoute) {
-      TableRoute tableRoute = (TableRoute) command;
-      tables.addAll(tableRoute.resolveTables(args));
-    } else {
-      String table = args.get("table");
-      if (table == null) {
-        BlurArray tableArray = args.get("tables");
-        for (int i = 0; i < tableArray.length(); i++) {
-          tables.add(tableArray.getString(i));
-        }
-      } else {
-        tables.add(table);
-      }
-    }
-    return tables;
-  }
 
   private Callable<Object> getCallable(final ShardServerContext shardServerContext, final TableContext tableContext,
       final Args args, final Shard shard, final BlurIndex blurIndex,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/server/LayoutFactory.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/LayoutFactory.java b/blur-core/src/main/java/org/apache/blur/server/LayoutFactory.java
new file mode 100644
index 0000000..6202811
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/server/LayoutFactory.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.server;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.blur.command.Server;
+import org.apache.blur.command.Shard;
+import org.apache.blur.thrift.Connection;
+
+public interface LayoutFactory {
+
+  Set<Shard> getServerLayout(Server server) throws IOException;
+
+  Set<Connection> getServerConnections() throws IOException;
+
+  boolean isValidServer(Server server, Set<String> tables, Map<String, Set<Shard>> shards);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
index 4328b2c..c3434994 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
@@ -51,6 +51,8 @@ import org.apache.blur.command.CommandUtil;
 import org.apache.blur.command.ControllerCommandManager;
 import org.apache.blur.command.ExecutionId;
 import org.apache.blur.command.Response;
+import org.apache.blur.command.Server;
+import org.apache.blur.command.Shard;
 import org.apache.blur.concurrent.Executors;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
@@ -67,7 +69,9 @@ import org.apache.blur.manager.results.MergerBlurResultIterable;
 import org.apache.blur.manager.stats.MergerTableStats;
 import org.apache.blur.manager.status.MergerQueryStatusSingle;
 import org.apache.blur.server.ControllerServerContext;
+import org.apache.blur.server.LayoutFactory;
 import org.apache.blur.server.TableContext;
+import org.apache.blur.server.TableContextFactory;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol;
 import org.apache.blur.thirdparty.thrift_0_9_0.transport.TFramedTransport;
@@ -1509,10 +1513,13 @@ public class BlurControllerServer extends TableAdmin implements Iface {
   public org.apache.blur.thrift.generated.Response execute(String commandName, Arguments arguments)
       throws BlurException, TException {
     try {
-      TableContext tableContext = getTableContext(table);
-      Map<String, String> tableLayout = getTableLayout(table);
-      Response response = _commandManager
-          .execute(tableContext, commandName, CommandUtil.toArgs(arguments), tableLayout);
+      // TableContext tableContext = getTableContext(table);
+      // Map<String, String> tableLayout = getTableLayout(table);
+      Response response = _commandManager.execute(getTableContextFactory(), getLayoutFactory(), commandName,
+          CommandUtil.toArgs(arguments));
+      // Response response = _commandManager
+      // .execute(tableContext, commandName, CommandUtil.toArgs(arguments),
+      // tableLayout);
       return CommandUtil.fromObjectToThrift(response);
     } catch (Exception e) {
       if (e instanceof org.apache.blur.command.TimeoutException) {
@@ -1526,6 +1533,90 @@ public class BlurControllerServer extends TableAdmin implements Iface {
     }
   }
 
+  private TableContextFactory getTableContextFactory() {
+    return new TableContextFactory() {
+      @Override
+      public TableContext getTableContext(String table) throws IOException {
+        return TableContext.create(_clusterStatus.getTableDescriptor(true, _clusterStatus.getCluster(true, table),
+            table));
+      }
+    };
+  }
+
+  private LayoutFactory getLayoutFactory() {
+    return new LayoutFactory() {
+
+      @Override
+      public Set<Shard> getServerLayout(Server server) throws IOException {
+        makeSureLayoutIsUpToDate();
+        Set<Shard> shardSet = new TreeSet<Shard>();
+        Map<String, Map<String, String>> map = _shardServerLayout.get();
+        for (Entry<String, Map<String, String>> e1 : map.entrySet()) {
+          String table = e1.getKey();
+          Map<String, String> layout = e1.getValue();
+          for (Entry<String, String> e2 : layout.entrySet()) {
+            String shardId = e2.getKey();
+            String serverId = e2.getValue();
+            if (serverId.equals(server.getServer())) {
+              shardSet.add(new Shard(table, shardId));
+            }
+          }
+        }
+        return shardSet;
+      }
+
+      private void makeSureLayoutIsUpToDate() throws IOException {
+        List<String> tableList = _clusterStatus.getTableList(true);
+        for (String table : tableList) {
+          try {
+            getTableLayout(table);
+          } catch (BlurException e) {
+            throw new IOException(e);
+          } catch (TException e) {
+            throw new IOException(e);
+          }
+        }
+      }
+
+      @Override
+      public Set<Connection> getServerConnections() {
+        List<String> clusterList = _clusterStatus.getClusterList(true);
+        Set<Connection> connections = new HashSet<Connection>();
+        for (String cluster : clusterList) {
+          List<String> onlineShardServers = _clusterStatus.getOnlineShardServers(true, cluster);
+          for (String server : onlineShardServers) {
+            connections.add(new Connection(server));
+          }
+        }
+        return connections;
+      }
+
+      @Override
+      public boolean isValidServer(Server server, Set<String> tables, Map<String, Set<Shard>> shards) {
+        for (String table : tables) {
+          String cluster = _clusterStatus.getCluster(true, table);
+          List<String> onlineShardServers = _clusterStatus.getOnlineShardServers(true, cluster);
+          if (!onlineShardServers.contains(server.getServer())) {
+            return false;
+          }
+          Set<Shard> shardSet = shards.get(table);
+          if (shardSet.isEmpty()) {
+            return true;
+          }
+          Map<String, Map<String, String>> layout = _shardServerLayout.get();
+          Map<String, String> shardIdToServerMap = layout.get(table);
+          for (Shard shard : shardSet) {
+            String serverId = shardIdToServerMap.get(shard.getShard());
+            if (serverId.equals(server.getServer())) {
+              return true;
+            }
+          }
+        }
+        return false;
+      }
+    };
+  }
+
   public void setCommandManager(ControllerCommandManager commandManager) {
     _commandManager = commandManager;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index 8cfc96f..00c7509 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -20,6 +20,7 @@ import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_CACHE_MAX_QUERYCACH
 import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_CACHE_MAX_TIMETOLIVE;
 import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_DATA_FETCH_THREAD_COUNT;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -44,6 +45,7 @@ import org.apache.blur.manager.results.BlurResultIterable;
 import org.apache.blur.manager.writer.BlurIndex;
 import org.apache.blur.server.ShardServerContext;
 import org.apache.blur.server.TableContext;
+import org.apache.blur.server.TableContextFactory;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thrift.generated.Arguments;
 import org.apache.blur.thrift.generated.Blur.Iface;
@@ -597,7 +599,14 @@ public class BlurShardServer extends TableAdmin implements Iface {
   public org.apache.blur.thrift.generated.Response execute(String commandName, Arguments arguments)
       throws BlurException, TException {
     try {
-      Response response = _commandManager.execute(getTableContext(table), commandName, CommandUtil.toArgs(arguments));
+      TableContextFactory tableContextFactory = new TableContextFactory() {
+        @Override
+        public TableContext getTableContext(String table) throws IOException {
+          return TableContext.create(_clusterStatus.getTableDescriptor(true, _clusterStatus.getCluster(true, table),
+              table));
+        }
+      };
+      Response response = _commandManager.execute(tableContextFactory, commandName, CommandUtil.toArgs(arguments));
       return CommandUtil.fromObjectToThrift(response);
     } catch (Exception e) {
       if (e instanceof org.apache.blur.command.TimeoutException) {
@@ -611,10 +620,6 @@ public class BlurShardServer extends TableAdmin implements Iface {
     }
   }
 
-  private TableContext getTableContext(final String table) {
-    return TableContext.create(_clusterStatus.getTableDescriptor(true, _clusterStatus.getCluster(true, table), table));
-  }
-
   public void setCommandManager(ShardCommandManager commandManager) {
     _commandManager = commandManager;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java b/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
index 72570aa..943b994 100644
--- a/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/command/ShardCommandManagerTest.java
@@ -29,6 +29,7 @@ import org.apache.blur.manager.writer.IndexAction;
 import org.apache.blur.server.IndexSearcherClosable;
 import org.apache.blur.server.ShardContext;
 import org.apache.blur.server.TableContext;
+import org.apache.blur.server.TableContextFactory;
 import org.apache.blur.thrift.generated.RowMutation;
 import org.apache.blur.thrift.generated.ShardState;
 import org.apache.blur.thrift.generated.TableDescriptor;
@@ -73,17 +74,18 @@ public class ShardCommandManagerTest {
 
   @Test
   public void testShardCommandManagerNormalWait() throws IOException, TimeoutException {
-    TableContext tableContext = getTableContext();
     Response response;
     ExecutionId executionId = null;
 
     Args args = new Args();
     args.set("seconds", 5);
+    args.set("table", "test");
 
     while (true) {
       try {
         if (executionId == null) {
-          response = _manager.execute(tableContext, "wait", args);
+          TableContextFactory tableContextFactory = getTableContextFactory();
+          response = _manager.execute(tableContextFactory, "wait", args);
         } else {
           response = _manager.reconnect(executionId);
         }
@@ -97,15 +99,16 @@ public class ShardCommandManagerTest {
 
   @Test
   public void testShardCommandManagerNormalWithCancel() throws IOException, TimeoutException {
-    TableContext tableContext = getTableContext();
     Response response;
     ExecutionId executionId = null;
 
     Args args = new Args();
     args.set("seconds", 5);
+    args.set("table", "test");
 
     try {
-      response = _manager.execute(tableContext, "wait", args);
+      TableContextFactory tableContextFactory = getTableContextFactory();
+      response = _manager.execute(tableContextFactory, "wait", args);
     } catch (TimeoutException te) {
       _manager.cancel(te.getExecutionId());
       // some how validate the threads have cancelled.
@@ -113,8 +116,13 @@ public class ShardCommandManagerTest {
 
   }
 
-  private TableContext getTableContext() {
-    return TableContext.create(getTableDescriptor());
+  private TableContextFactory getTableContextFactory() {
+    return new TableContextFactory() {
+      @Override
+      public TableContext getTableContext(String table) throws IOException {
+        return TableContext.create(getTableDescriptor());
+      }
+    };
   }
 
   private TableDescriptor getTableDescriptor() {
@@ -180,7 +188,7 @@ public class ShardCommandManagerTest {
   }
 
   protected BlurIndex getNullBlurIndex(String shard) throws IOException {
-    ShardContext shardContext = ShardContext.create(getTableContext(), shard);
+    ShardContext shardContext = ShardContext.create(getTableContextFactory().getTableContext("test"), shard);
     return new BlurIndex(shardContext, null, null, null, null, null) {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Arguments.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Arguments.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Arguments.java
index 3d58218..53a01a0 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Arguments.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Arguments.java
@@ -367,7 +367,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<
                 struct.values = new HashMap<String,ValueObject>(2*_map260.size);
                 for (int _i261 = 0; _i261 < _map260.size; ++_i261)
                 {
-                  String _key262; // required
+                  String _key262; // optional
                   ValueObject _val263; // required
                   _key262 = iprot.readString();
                   _val263 = new ValueObject();
@@ -453,7 +453,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<
           struct.values = new HashMap<String,ValueObject>(2*_map266.size);
           for (int _i267 = 0; _i267 < _map266.size; ++_i267)
           {
-            String _key268; // required
+            String _key268; // optional
             ValueObject _val269; // required
             _key268 = iprot.readString();
             _val269 = new ValueObject();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
index d0dd35d..7005321 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
@@ -21725,7 +21725,7 @@ public class Blur {
                   struct.success = new HashMap<String,List<String>>(2*_map294.size);
                   for (int _i295 = 0; _i295 < _map294.size; ++_i295)
                   {
-                    String _key296; // required
+                    String _key296; // optional
                     List<String> _val297; // required
                     _key296 = iprot.readString();
                     {
@@ -21853,7 +21853,7 @@ public class Blur {
             struct.success = new HashMap<String,List<String>>(2*_map305.size);
             for (int _i306 = 0; _i306 < _map305.size; ++_i306)
             {
-              String _key307; // required
+              String _key307; // optional
               List<String> _val308; // required
               _key307 = iprot.readString();
               {
@@ -36456,7 +36456,7 @@ public class Blur {
                   struct.success = new HashMap<String,String>(2*_map384.size);
                   for (int _i385 = 0; _i385 < _map384.size; ++_i385)
                   {
-                    String _key386; // required
+                    String _key386; // optional
                     String _val387; // required
                     _key386 = iprot.readString();
                     _val387 = iprot.readString();
@@ -36561,7 +36561,7 @@ public class Blur {
             struct.success = new HashMap<String,String>(2*_map390.size);
             for (int _i391 = 0; _i391 < _map390.size; ++_i391)
             {
-              String _key392; // required
+              String _key392; // optional
               String _val393; // required
               _key392 = iprot.readString();
               _val393 = iprot.readString();
@@ -37354,7 +37354,7 @@ public class Blur {
                   struct.success = new HashMap<String,Map<String,ShardState>>(2*_map394.size);
                   for (int _i395 = 0; _i395 < _map394.size; ++_i395)
                   {
-                    String _key396; // required
+                    String _key396; // optional
                     Map<String,ShardState> _val397; // required
                     _key396 = iprot.readString();
                     {
@@ -37362,7 +37362,7 @@ public class Blur {
                       _val397 = new HashMap<String,ShardState>(2*_map398.size);
                       for (int _i399 = 0; _i399 < _map398.size; ++_i399)
                       {
-                        String _key400; // required
+                        String _key400; // optional
                         ShardState _val401; // required
                         _key400 = iprot.readString();
                         _val401 = ShardState.findByValue(iprot.readI32());
@@ -37486,7 +37486,7 @@ public class Blur {
             struct.success = new HashMap<String,Map<String,ShardState>>(2*_map406.size);
             for (int _i407 = 0; _i407 < _map406.size; ++_i407)
             {
-              String _key408; // required
+              String _key408; // optional
               Map<String,ShardState> _val409; // required
               _key408 = iprot.readString();
               {
@@ -37494,7 +37494,7 @@ public class Blur {
                 _val409 = new HashMap<String,ShardState>(2*_map410.size);
                 for (int _i411 = 0; _i411 < _map410.size; ++_i411)
                 {
-                  String _key412; // required
+                  String _key412; // optional
                   ShardState _val413; // required
                   _key412 = iprot.readString();
                   _val413 = ShardState.findByValue(iprot.readI32());
@@ -38979,7 +38979,7 @@ public class Blur {
                   struct.success = new HashMap<String,String>(2*_map414.size);
                   for (int _i415 = 0; _i415 < _map414.size; ++_i415)
                   {
-                    String _key416; // required
+                    String _key416; // optional
                     String _val417; // required
                     _key416 = iprot.readString();
                     _val417 = iprot.readString();
@@ -39084,7 +39084,7 @@ public class Blur {
             struct.success = new HashMap<String,String>(2*_map420.size);
             for (int _i421 = 0; _i421 < _map420.size; ++_i421)
             {
-              String _key422; // required
+              String _key422; // optional
               String _val423; // required
               _key422 = iprot.readString();
               _val423 = iprot.readString();
@@ -39916,7 +39916,7 @@ public class Blur {
                   struct.success = new HashMap<String,Metric>(2*_map432.size);
                   for (int _i433 = 0; _i433 < _map432.size; ++_i433)
                   {
-                    String _key434; // required
+                    String _key434; // optional
                     Metric _val435; // required
                     _key434 = iprot.readString();
                     _val435 = new Metric();
@@ -40022,7 +40022,7 @@ public class Blur {
             struct.success = new HashMap<String,Metric>(2*_map438.size);
             for (int _i439 = 0; _i439 < _map438.size; ++_i439)
             {
-              String _key440; // required
+              String _key440; // optional
               Metric _val441; // required
               _key440 = iprot.readString();
               _val441 = new Metric();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQueryStatus.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQueryStatus.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQueryStatus.java
index a9caf29..6cac5a1 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQueryStatus.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurQueryStatus.java
@@ -1050,7 +1050,7 @@ public class BlurQueryStatus implements org.apache.blur.thirdparty.thrift_0_9_0.
                 struct.cpuTimes = new HashMap<String,CpuTime>(2*_map126.size);
                 for (int _i127 = 0; _i127 < _map126.size; ++_i127)
                 {
-                  String _key128; // required
+                  String _key128; // optional
                   CpuTime _val129; // required
                   _key128 = iprot.readString();
                   _val129 = new CpuTime();
@@ -1263,7 +1263,7 @@ public class BlurQueryStatus implements org.apache.blur.thirdparty.thrift_0_9_0.
           struct.cpuTimes = new HashMap<String,CpuTime>(2*_map132.size);
           for (int _i133 = 0; _i133 < _map132.size; ++_i133)
           {
-            String _key134; // required
+            String _key134; // optional
             CpuTime _val135; // required
             _key134 = iprot.readString();
             _val135 = new CpuTime();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurResults.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurResults.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurResults.java
index a7fc566..aa923cc 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurResults.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurResults.java
@@ -900,7 +900,7 @@ public class BlurResults implements org.apache.blur.thirdparty.thrift_0_9_0.TBas
                 struct.shardInfo = new HashMap<String,Long>(2*_map84.size);
                 for (int _i85 = 0; _i85 < _map84.size; ++_i85)
                 {
-                  String _key86; // required
+                  String _key86; // optional
                   long _val87; // required
                   _key86 = iprot.readString();
                   _val87 = iprot.readI64();
@@ -1146,7 +1146,7 @@ public class BlurResults implements org.apache.blur.thirdparty.thrift_0_9_0.TBas
           struct.shardInfo = new HashMap<String,Long>(2*_map105.size);
           for (int _i106 = 0; _i106 < _map105.size; ++_i106)
           {
-            String _key107; // required
+            String _key107; // optional
             long _val108; // required
             _key107 = iprot.readString();
             _val108 = iprot.readI64();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ColumnDefinition.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ColumnDefinition.java
index 0ebf5a7..55d1744 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ColumnDefinition.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ColumnDefinition.java
@@ -992,7 +992,7 @@ public class ColumnDefinition implements org.apache.blur.thirdparty.thrift_0_9_0
                 struct.properties = new HashMap<String,String>(2*_map136.size);
                 for (int _i137 = 0; _i137 < _map136.size; ++_i137)
                 {
-                  String _key138; // required
+                  String _key138; // optional
                   String _val139; // required
                   _key138 = iprot.readString();
                   _val139 = iprot.readString();
@@ -1167,7 +1167,7 @@ public class ColumnDefinition implements org.apache.blur.thirdparty.thrift_0_9_0
           struct.properties = new HashMap<String,String>(2*_map142.size);
           for (int _i143 = 0; _i143 < _map142.size; ++_i143)
           {
-            String _key144; // required
+            String _key144; // optional
             String _val145; // required
             _key144 = iprot.readString();
             _val145 = iprot.readString();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Metric.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Metric.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Metric.java
index ccb417c..8e2be42 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Metric.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Metric.java
@@ -707,7 +707,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
                 struct.strMap = new HashMap<String,String>(2*_map202.size);
                 for (int _i203 = 0; _i203 < _map202.size; ++_i203)
                 {
-                  String _key204; // required
+                  String _key204; // optional
                   String _val205; // required
                   _key204 = iprot.readString();
                   _val205 = iprot.readString();
@@ -727,7 +727,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
                 struct.longMap = new HashMap<String,Long>(2*_map206.size);
                 for (int _i207 = 0; _i207 < _map206.size; ++_i207)
                 {
-                  String _key208; // required
+                  String _key208; // optional
                   long _val209; // required
                   _key208 = iprot.readString();
                   _val209 = iprot.readI64();
@@ -747,7 +747,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
                 struct.doubleMap = new HashMap<String,Double>(2*_map210.size);
                 for (int _i211 = 0; _i211 < _map210.size; ++_i211)
                 {
-                  String _key212; // required
+                  String _key212; // optional
                   double _val213; // required
                   _key212 = iprot.readString();
                   _val213 = iprot.readDouble();
@@ -899,7 +899,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
           struct.strMap = new HashMap<String,String>(2*_map220.size);
           for (int _i221 = 0; _i221 < _map220.size; ++_i221)
           {
-            String _key222; // required
+            String _key222; // optional
             String _val223; // required
             _key222 = iprot.readString();
             _val223 = iprot.readString();
@@ -914,7 +914,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
           struct.longMap = new HashMap<String,Long>(2*_map224.size);
           for (int _i225 = 0; _i225 < _map224.size; ++_i225)
           {
-            String _key226; // required
+            String _key226; // optional
             long _val227; // required
             _key226 = iprot.readString();
             _val227 = iprot.readI64();
@@ -929,7 +929,7 @@ public class Metric implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Met
           struct.doubleMap = new HashMap<String,Double>(2*_map228.size);
           for (int _i229 = 0; _i229 < _map228.size; ++_i229)
           {
-            String _key230; // required
+            String _key230; // optional
             double _val231; // required
             _key230 = iprot.readString();
             _val231 = iprot.readDouble();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java
index 6354606..1e36a12 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java
@@ -206,7 +206,7 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res
               shardToValue = new HashMap<Shard,ValueObject>(2*_map240.size);
               for (int _i241 = 0; _i241 < _map240.size; ++_i241)
               {
-                Shard _key242; // required
+                Shard _key242; // optional
                 ValueObject _val243; // required
                 _key242 = new Shard();
                 _key242.read(iprot);
@@ -229,7 +229,7 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res
               serverToValue = new HashMap<Server,ValueObject>(2*_map244.size);
               for (int _i245 = 0; _i245 < _map244.size; ++_i245)
               {
-                Server _key246; // required
+                Server _key246; // optional
                 ValueObject _val247; // required
                 _key246 = new Server();
                 _key246.read(iprot);
@@ -310,7 +310,7 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res
             shardToValue = new HashMap<Shard,ValueObject>(2*_map250.size);
             for (int _i251 = 0; _i251 < _map250.size; ++_i251)
             {
-              Shard _key252; // required
+              Shard _key252; // optional
               ValueObject _val253; // required
               _key252 = new Shard();
               _key252.read(iprot);
@@ -328,7 +328,7 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res
             serverToValue = new HashMap<Server,ValueObject>(2*_map254.size);
             for (int _i255 = 0; _i255 < _map254.size; ++_i255)
             {
-              Server _key256; // required
+              Server _key256; // optional
               ValueObject _val257; // required
               _key256 = new Server();
               _key256.read(iprot);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Schema.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Schema.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Schema.java
index ef3191c..39e1dbb 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Schema.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Schema.java
@@ -492,7 +492,7 @@ public class Schema implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Sch
                 struct.families = new HashMap<String,Map<String,ColumnDefinition>>(2*_map146.size);
                 for (int _i147 = 0; _i147 < _map146.size; ++_i147)
                 {
-                  String _key148; // required
+                  String _key148; // optional
                   Map<String,ColumnDefinition> _val149; // required
                   _key148 = iprot.readString();
                   {
@@ -500,7 +500,7 @@ public class Schema implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Sch
                     _val149 = new HashMap<String,ColumnDefinition>(2*_map150.size);
                     for (int _i151 = 0; _i151 < _map150.size; ++_i151)
                     {
-                      String _key152; // required
+                      String _key152; // optional
                       ColumnDefinition _val153; // required
                       _key152 = iprot.readString();
                       _val153 = new ColumnDefinition();
@@ -620,7 +620,7 @@ public class Schema implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Sch
           struct.families = new HashMap<String,Map<String,ColumnDefinition>>(2*_map158.size);
           for (int _i159 = 0; _i159 < _map158.size; ++_i159)
           {
-            String _key160; // required
+            String _key160; // optional
             Map<String,ColumnDefinition> _val161; // required
             _key160 = iprot.readString();
             {
@@ -628,7 +628,7 @@ public class Schema implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Sch
               _val161 = new HashMap<String,ColumnDefinition>(2*_map162.size);
               for (int _i163 = 0; _i163 < _map162.size; ++_i163)
               {
-                String _key164; // required
+                String _key164; // optional
                 ColumnDefinition _val165; // required
                 _key164 = iprot.readString();
                 _val165 = new ColumnDefinition();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Selector.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Selector.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Selector.java
index 37385d7..af622c5 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Selector.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Selector.java
@@ -1304,7 +1304,7 @@ public class Selector implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<S
                 struct.columnsToFetch = new HashMap<String,Set<String>>(2*_map29.size);
                 for (int _i30 = 0; _i30 < _map29.size; ++_i30)
                 {
-                  String _key31; // required
+                  String _key31; // optional
                   Set<String> _val32; // required
                   _key31 = iprot.readString();
                   {
@@ -1603,7 +1603,7 @@ public class Selector implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<S
           struct.columnsToFetch = new HashMap<String,Set<String>>(2*_map50.size);
           for (int _i51 = 0; _i51 < _map50.size; ++_i51)
           {
-            String _key52; // required
+            String _key52; // optional
             Set<String> _val53; // required
             _key52 = iprot.readString();
             {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Shard.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Shard.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Shard.java
index 751be40..6945aac 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Shard.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Shard.java
@@ -52,7 +52,8 @@ import java.util.Arrays;
 public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shard, Shard._Fields>, java.io.Serializable, Cloneable {
   private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("Shard");
 
-  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SHARD_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("shard", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)1);
+  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField TABLE_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("table", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)1);
+  private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField SHARD_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("shard", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)2);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -60,11 +61,13 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     schemes.put(TupleScheme.class, new ShardTupleSchemeFactory());
   }
 
+  public String table; // required
   public String shard; // required
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum {
-    SHARD((short)1, "shard");
+    TABLE((short)1, "table"),
+    SHARD((short)2, "shard");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -79,7 +82,9 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
      */
     public static _Fields findByThriftId(int fieldId) {
       switch(fieldId) {
-        case 1: // SHARD
+        case 1: // TABLE
+          return TABLE;
+        case 2: // SHARD
           return SHARD;
         default:
           return null;
@@ -124,6 +129,8 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
   public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.TABLE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("table", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, 
+        new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
     tmpMap.put(_Fields.SHARD, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("shard", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, 
         new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
@@ -134,9 +141,11 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
   }
 
   public Shard(
+    String table,
     String shard)
   {
     this();
+    this.table = table;
     this.shard = shard;
   }
 
@@ -144,6 +153,9 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
    * Performs a deep copy on <i>other</i>.
    */
   public Shard(Shard other) {
+    if (other.isSetTable()) {
+      this.table = other.table;
+    }
     if (other.isSetShard()) {
       this.shard = other.shard;
     }
@@ -155,9 +167,34 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
 
   @Override
   public void clear() {
+    this.table = null;
     this.shard = null;
   }
 
+  public String getTable() {
+    return this.table;
+  }
+
+  public Shard setTable(String table) {
+    this.table = table;
+    return this;
+  }
+
+  public void unsetTable() {
+    this.table = null;
+  }
+
+  /** Returns true if field table is set (has been assigned a value) and false otherwise */
+  public boolean isSetTable() {
+    return this.table != null;
+  }
+
+  public void setTableIsSet(boolean value) {
+    if (!value) {
+      this.table = null;
+    }
+  }
+
   public String getShard() {
     return this.shard;
   }
@@ -184,6 +221,14 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
 
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
+    case TABLE:
+      if (value == null) {
+        unsetTable();
+      } else {
+        setTable((String)value);
+      }
+      break;
+
     case SHARD:
       if (value == null) {
         unsetShard();
@@ -197,6 +242,9 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
 
   public Object getFieldValue(_Fields field) {
     switch (field) {
+    case TABLE:
+      return getTable();
+
     case SHARD:
       return getShard();
 
@@ -211,6 +259,8 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     }
 
     switch (field) {
+    case TABLE:
+      return isSetTable();
     case SHARD:
       return isSetShard();
     }
@@ -230,6 +280,15 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     if (that == null)
       return false;
 
+    boolean this_present_table = true && this.isSetTable();
+    boolean that_present_table = true && that.isSetTable();
+    if (this_present_table || that_present_table) {
+      if (!(this_present_table && that_present_table))
+        return false;
+      if (!this.table.equals(that.table))
+        return false;
+    }
+
     boolean this_present_shard = true && this.isSetShard();
     boolean that_present_shard = true && that.isSetShard();
     if (this_present_shard || that_present_shard) {
@@ -255,6 +314,16 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     int lastComparison = 0;
     Shard typedOther = (Shard)other;
 
+    lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTable()) {
+      lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.table, typedOther.table);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     lastComparison = Boolean.valueOf(isSetShard()).compareTo(typedOther.isSetShard());
     if (lastComparison != 0) {
       return lastComparison;
@@ -285,6 +354,14 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     StringBuilder sb = new StringBuilder("Shard(");
     boolean first = true;
 
+    sb.append("table:");
+    if (this.table == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.table);
+    }
+    first = false;
+    if (!first) sb.append(", ");
     sb.append("shard:");
     if (this.shard == null) {
       sb.append("null");
@@ -335,7 +412,15 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
           break;
         }
         switch (schemeField.id) {
-          case 1: // SHARD
+          case 1: // TABLE
+            if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
+              struct.table = iprot.readString();
+              struct.setTableIsSet(true);
+            } else { 
+              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // SHARD
             if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
               struct.shard = iprot.readString();
               struct.setShardIsSet(true);
@@ -358,6 +443,11 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
       struct.validate();
 
       oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.table != null) {
+        oprot.writeFieldBegin(TABLE_FIELD_DESC);
+        oprot.writeString(struct.table);
+        oprot.writeFieldEnd();
+      }
       if (struct.shard != null) {
         oprot.writeFieldBegin(SHARD_FIELD_DESC);
         oprot.writeString(struct.shard);
@@ -381,10 +471,16 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, Shard struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
       TTupleProtocol oprot = (TTupleProtocol) prot;
       BitSet optionals = new BitSet();
-      if (struct.isSetShard()) {
+      if (struct.isSetTable()) {
         optionals.set(0);
       }
-      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetShard()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetTable()) {
+        oprot.writeString(struct.table);
+      }
       if (struct.isSetShard()) {
         oprot.writeString(struct.shard);
       }
@@ -393,8 +489,12 @@ public class Shard implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<Shar
     @Override
     public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, Shard struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(1);
+      BitSet incoming = iprot.readBitSet(2);
       if (incoming.get(0)) {
+        struct.table = iprot.readString();
+        struct.setTableIsSet(true);
+      }
+      if (incoming.get(1)) {
         struct.shard = iprot.readString();
         struct.setShardIsSet(true);
       }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/TableDescriptor.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/TableDescriptor.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/TableDescriptor.java
index 3793c00..1a08bc0 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/TableDescriptor.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/TableDescriptor.java
@@ -1799,7 +1799,7 @@ public class TableDescriptor implements org.apache.blur.thirdparty.thrift_0_9_0.
                 struct.tableProperties = new HashMap<String,String>(2*_map172.size);
                 for (int _i173 = 0; _i173 < _map172.size; ++_i173)
                 {
-                  String _key174; // required
+                  String _key174; // optional
                   String _val175; // required
                   _key174 = iprot.readString();
                   _val175 = iprot.readString();
@@ -1843,7 +1843,7 @@ public class TableDescriptor implements org.apache.blur.thirdparty.thrift_0_9_0.
                 struct.defaultMissingFieldProps = new HashMap<String,String>(2*_map176.size);
                 for (int _i177 = 0; _i177 < _map176.size; ++_i177)
                 {
-                  String _key178; // required
+                  String _key178; // optional
                   String _val179; // required
                   _key178 = iprot.readString();
                   _val179 = iprot.readString();
@@ -2169,7 +2169,7 @@ public class TableDescriptor implements org.apache.blur.thirdparty.thrift_0_9_0.
           struct.tableProperties = new HashMap<String,String>(2*_map194.size);
           for (int _i195 = 0; _i195 < _map194.size; ++_i195)
           {
-            String _key196; // required
+            String _key196; // optional
             String _val197; // required
             _key196 = iprot.readString();
             _val197 = iprot.readString();
@@ -2196,7 +2196,7 @@ public class TableDescriptor implements org.apache.blur.thirdparty.thrift_0_9_0.
           struct.defaultMissingFieldProps = new HashMap<String,String>(2*_map198.size);
           for (int _i199 = 0; _i199 < _map198.size; ++_i199)
           {
-            String _key200; // required
+            String _key200; // optional
             String _val201; // required
             _key200 = iprot.readString();
             _val201 = iprot.readString();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/generated/User.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/User.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/User.java
index 8f152a6..33b0f91 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/User.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/User.java
@@ -480,8 +480,8 @@ public class User implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<User,
                 struct.attributes = new HashMap<String,String>(2*_map0.size);
                 for (int _i1 = 0; _i1 < _map0.size; ++_i1)
                 {
-                  String _key2; // required
-                  String _val3; // optional
+                  String _key2; // optional
+                  String _val3; // required
                   _key2 = iprot.readString();
                   _val3 = iprot.readString();
                   struct.attributes.put(_key2, _val3);
@@ -580,8 +580,8 @@ public class User implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<User,
           struct.attributes = new HashMap<String,String>(2*_map6.size);
           for (int _i7 = 0; _i7 < _map6.size; ++_i7)
           {
-            String _key8; // required
-            String _val9; // optional
+            String _key8; // optional
+            String _val9; // required
             _key8 = iprot.readString();
             _val9 = iprot.readString();
             struct.attributes.put(_key8, _val9);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java
index 6668766..b6ce76d 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java
@@ -21,42 +21,23 @@ import java.io.IOException;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thrift.BlurClientManager;
 import org.apache.blur.thrift.Connection;
+import org.apache.blur.thrift.generated.Arguments;
 import org.apache.blur.thrift.generated.Blur.Client;
 import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.Response;
-import org.apache.blur.thrift.generated.TimeoutException;
+import org.apache.blur.thrift.generated.Value;
+import org.apache.blur.thrift.generated.ValueObject;
 
 public class CommandExample {
 
   public static void main(String[] args) throws BlurException, TException, IOException {
     Client client = BlurClientManager.getClientPool().getClient(new Connection("localhost:40010"));
-    // String executionId = null;
-    // while (true) {
-    // try {
-    // Response response;
-    // if (executionId == null) {
-    // response = client.execute("test", "wait", null);
-    // } else {
-    // System.out.println("Reconecting...");
-    // response = client.reconnect(executionId);
-    // }
-    // System.out.println(response);
-    // break;
-    // } catch (TimeoutException ex) {
-    // executionId = ex.getExecutionId();
-    // }
-    // }
 
-    System.out.println(client.execute("docCount", null));
-    // System.out.println(client.execute("test", "docCountNoCombine", null));
-    // {
-    // Response response = client.execute("test", "docCountAggregate", null);
-    // long count = response.getValue().getValue().getLongValue();
-    // System.out.println(count);
-    // }
-    // {
-    // Response response = client.execute("test", "testBlurObject", null);
-    // System.out.println(response);
-    // }
+    Arguments arguments = new Arguments();
+    arguments.putToValues("table", new ValueObject(ValueObject._Fields.VALUE, new Value(Value._Fields.STRING_VALUE,
+        "test2")));
+    arguments.putToValues("shard", new ValueObject(ValueObject._Fields.VALUE, new Value(Value._Fields.STRING_VALUE,
+        "shard-00000000")));
+
+    System.out.println(client.execute("docCount", arguments));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/distribution/src/main/scripts/interface/Blur.thrift
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift
index 99ed2de..d500865 100644
--- a/distribution/src/main/scripts/interface/Blur.thrift
+++ b/distribution/src/main/scripts/interface/Blur.thrift
@@ -851,7 +851,8 @@ union Value {
 }
 
 struct Shard {
-  1:string shard
+  1:string table,
+  2:string shard
 }
 
 struct Server {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/distribution/src/main/scripts/interface/gen-html/Blur.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-html/Blur.html b/distribution/src/main/scripts/interface/gen-html/Blur.html
index 01e5913..7868344 100644
--- a/distribution/src/main/scripts/interface/gen-html/Blur.html
+++ b/distribution/src/main/scripts/interface/gen-html/Blur.html
@@ -623,7 +623,8 @@ be family dot column, "family.column".
 <tr><td>9</td><td>nullValue</td><td><code>bool</code></td><td></td><td>default</td><td></td></tr>
 </table><br/></div><div class="definition"><h3 id="Struct_Shard">Struct: Shard</h3>
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead>
-<tr><td>1</td><td>shard</td><td><code>string</code></td><td></td><td>default</td><td></td></tr>
+<tr><td>1</td><td>table</td><td><code>string</code></td><td></td><td>default</td><td></td></tr>
+<tr><td>2</td><td>shard</td><td><code>string</code></td><td></td><td>default</td><td></td></tr>
 </table><br/></div><div class="definition"><h3 id="Struct_Server">Struct: Server</h3>
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead>
 <tr><td>1</td><td>server</td><td><code>string</code></td><td></td><td>default</td><td></td></tr>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b55cf9e5/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java
index 3d58218..53a01a0 100644
--- a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java
+++ b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java
@@ -367,7 +367,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<
                 struct.values = new HashMap<String,ValueObject>(2*_map260.size);
                 for (int _i261 = 0; _i261 < _map260.size; ++_i261)
                 {
-                  String _key262; // required
+                  String _key262; // optional
                   ValueObject _val263; // required
                   _key262 = iprot.readString();
                   _val263 = new ValueObject();
@@ -453,7 +453,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<
           struct.values = new HashMap<String,ValueObject>(2*_map266.size);
           for (int _i267 = 0; _i267 < _map266.size; ++_i267)
           {
-            String _key268; // required
+            String _key268; // optional
             ValueObject _val269; // required
             _key268 = iprot.readString();
             _val269 = new ValueObject();


Mime
View raw message