http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
index 8d6c575..97d3d58 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java
@@ -3449,30 +3449,15 @@ public final class PTableProtos {
      */
     com.google.protobuf.ByteString getStorageScheme();
 
-    // repeated .EncodedColumnQualifierCounter encodedColumnQualifierCounters 
= 32;
+    // optional int32 encodedColumnQualifierCounter = 32;
     /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+     * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
      */
-    
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 
-        getEncodedColumnQualifierCountersList();
+    boolean hasEncodedColumnQualifierCounter();
     /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+     * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
      */
-    
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 getEncodedColumnQualifierCounters(int index);
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    int getEncodedColumnQualifierCountersCount();
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    java.util.List<? extends 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>
 
-        getEncodedColumnQualifierCountersOrBuilderList();
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder
 getEncodedColumnQualifierCountersOrBuilder(
-        int index);
+    int getEncodedColumnQualifierCounter();
   }
   /**
    * Protobuf type {@code PTable}
@@ -3698,12 +3683,9 @@ public final class PTableProtos {
               storageScheme_ = input.readBytes();
               break;
             }
-            case 258: {
-              if (!((mutable_bitField0_ & 0x80000000) == 0x80000000)) {
-                encodedColumnQualifierCounters_ = new 
java.util.ArrayList<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>();
-                mutable_bitField0_ |= 0x80000000;
-              }
-              
encodedColumnQualifierCounters_.add(input.readMessage(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.PARSER,
 extensionRegistry));
+            case 256: {
+              bitField0_ |= 0x08000000;
+              encodedColumnQualifierCounter_ = input.readInt32();
               break;
             }
           }
@@ -3726,9 +3708,6 @@ public final class PTableProtos {
         if (((mutable_bitField0_ & 0x00040000) == 0x00040000)) {
           physicalNames_ = 
java.util.Collections.unmodifiableList(physicalNames_);
         }
-        if (((mutable_bitField0_ & 0x80000000) == 0x80000000)) {
-          encodedColumnQualifierCounters_ = 
java.util.Collections.unmodifiableList(encodedColumnQualifierCounters_);
-        }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
       }
@@ -4351,40 +4330,20 @@ public final class PTableProtos {
       return storageScheme_;
     }
 
-    // repeated .EncodedColumnQualifierCounter encodedColumnQualifierCounters 
= 32;
-    public static final int ENCODEDCOLUMNQUALIFIERCOUNTERS_FIELD_NUMBER = 32;
-    private 
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 encodedColumnQualifierCounters_;
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    public 
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 getEncodedColumnQualifierCountersList() {
-      return encodedColumnQualifierCounters_;
-    }
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    public java.util.List<? extends 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>
 
-        getEncodedColumnQualifierCountersOrBuilderList() {
-      return encodedColumnQualifierCounters_;
-    }
-    /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-     */
-    public int getEncodedColumnQualifierCountersCount() {
-      return encodedColumnQualifierCounters_.size();
-    }
+    // optional int32 encodedColumnQualifierCounter = 32;
+    public static final int ENCODEDCOLUMNQUALIFIERCOUNTER_FIELD_NUMBER = 32;
+    private int encodedColumnQualifierCounter_;
     /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+     * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
      */
-    public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 getEncodedColumnQualifierCounters(int index) {
-      return encodedColumnQualifierCounters_.get(index);
+    public boolean hasEncodedColumnQualifierCounter() {
+      return ((bitField0_ & 0x08000000) == 0x08000000);
     }
     /**
-     * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+     * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
      */
-    public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder
 getEncodedColumnQualifierCountersOrBuilder(
-        int index) {
-      return encodedColumnQualifierCounters_.get(index);
+    public int getEncodedColumnQualifierCounter() {
+      return encodedColumnQualifierCounter_;
     }
 
     private void initFields() {
@@ -4419,7 +4378,7 @@ public final class PTableProtos {
       indexDisableTimestamp_ = 0L;
       isNamespaceMapped_ = false;
       storageScheme_ = com.google.protobuf.ByteString.EMPTY;
-      encodedColumnQualifierCounters_ = java.util.Collections.emptyList();
+      encodedColumnQualifierCounter_ = 0;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
@@ -4480,12 +4439,6 @@ public final class PTableProtos {
           return false;
         }
       }
-      for (int i = 0; i < getEncodedColumnQualifierCountersCount(); i++) {
-        if (!getEncodedColumnQualifierCounters(i).isInitialized()) {
-          memoizedIsInitialized = 0;
-          return false;
-        }
-      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -4586,8 +4539,8 @@ public final class PTableProtos {
       if (((bitField0_ & 0x04000000) == 0x04000000)) {
         output.writeBytes(31, storageScheme_);
       }
-      for (int i = 0; i < encodedColumnQualifierCounters_.size(); i++) {
-        output.writeMessage(32, encodedColumnQualifierCounters_.get(i));
+      if (((bitField0_ & 0x08000000) == 0x08000000)) {
+        output.writeInt32(32, encodedColumnQualifierCounter_);
       }
       getUnknownFields().writeTo(output);
     }
@@ -4727,9 +4680,9 @@ public final class PTableProtos {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(31, storageScheme_);
       }
-      for (int i = 0; i < encodedColumnQualifierCounters_.size(); i++) {
+      if (((bitField0_ & 0x08000000) == 0x08000000)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(32, encodedColumnQualifierCounters_.get(i));
+          .computeInt32Size(32, encodedColumnQualifierCounter_);
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -4897,8 +4850,11 @@ public final class PTableProtos {
         result = result && getStorageScheme()
             .equals(other.getStorageScheme());
       }
-      result = result && getEncodedColumnQualifierCountersList()
-          .equals(other.getEncodedColumnQualifierCountersList());
+      result = result && (hasEncodedColumnQualifierCounter() == 
other.hasEncodedColumnQualifierCounter());
+      if (hasEncodedColumnQualifierCounter()) {
+        result = result && (getEncodedColumnQualifierCounter()
+            == other.getEncodedColumnQualifierCounter());
+      }
       result = result &&
           getUnknownFields().equals(other.getUnknownFields());
       return result;
@@ -5036,9 +4992,9 @@ public final class PTableProtos {
         hash = (37 * hash) + STORAGESCHEME_FIELD_NUMBER;
         hash = (53 * hash) + getStorageScheme().hashCode();
       }
-      if (getEncodedColumnQualifierCountersCount() > 0) {
-        hash = (37 * hash) + ENCODEDCOLUMNQUALIFIERCOUNTERS_FIELD_NUMBER;
-        hash = (53 * hash) + 
getEncodedColumnQualifierCountersList().hashCode();
+      if (hasEncodedColumnQualifierCounter()) {
+        hash = (37 * hash) + ENCODEDCOLUMNQUALIFIERCOUNTER_FIELD_NUMBER;
+        hash = (53 * hash) + getEncodedColumnQualifierCounter();
       }
       hash = (29 * hash) + getUnknownFields().hashCode();
       memoizedHashCode = hash;
@@ -5144,7 +5100,6 @@ public final class PTableProtos {
           getColumnsFieldBuilder();
           getIndexesFieldBuilder();
           getGuidePostsFieldBuilder();
-          getEncodedColumnQualifierCountersFieldBuilder();
         }
       }
       private static Builder create() {
@@ -5227,12 +5182,8 @@ public final class PTableProtos {
         bitField0_ = (bitField0_ & ~0x20000000);
         storageScheme_ = com.google.protobuf.ByteString.EMPTY;
         bitField0_ = (bitField0_ & ~0x40000000);
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          encodedColumnQualifierCounters_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x80000000);
-        } else {
-          encodedColumnQualifierCountersBuilder_.clear();
-        }
+        encodedColumnQualifierCounter_ = 0;
+        bitField0_ = (bitField0_ & ~0x80000000);
         return this;
       }
 
@@ -5401,15 +5352,10 @@ public final class PTableProtos {
           to_bitField0_ |= 0x04000000;
         }
         result.storageScheme_ = storageScheme_;
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          if (((bitField0_ & 0x80000000) == 0x80000000)) {
-            encodedColumnQualifierCounters_ = 
java.util.Collections.unmodifiableList(encodedColumnQualifierCounters_);
-            bitField0_ = (bitField0_ & ~0x80000000);
-          }
-          result.encodedColumnQualifierCounters_ = 
encodedColumnQualifierCounters_;
-        } else {
-          result.encodedColumnQualifierCounters_ = 
encodedColumnQualifierCountersBuilder_.build();
+        if (((from_bitField0_ & 0x80000000) == 0x80000000)) {
+          to_bitField0_ |= 0x08000000;
         }
+        result.encodedColumnQualifierCounter_ = encodedColumnQualifierCounter_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -5597,31 +5543,8 @@ public final class PTableProtos {
         if (other.hasStorageScheme()) {
           setStorageScheme(other.getStorageScheme());
         }
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          if (!other.encodedColumnQualifierCounters_.isEmpty()) {
-            if (encodedColumnQualifierCounters_.isEmpty()) {
-              encodedColumnQualifierCounters_ = 
other.encodedColumnQualifierCounters_;
-              bitField0_ = (bitField0_ & ~0x80000000);
-            } else {
-              ensureEncodedColumnQualifierCountersIsMutable();
-              
encodedColumnQualifierCounters_.addAll(other.encodedColumnQualifierCounters_);
-            }
-            onChanged();
-          }
-        } else {
-          if (!other.encodedColumnQualifierCounters_.isEmpty()) {
-            if (encodedColumnQualifierCountersBuilder_.isEmpty()) {
-              encodedColumnQualifierCountersBuilder_.dispose();
-              encodedColumnQualifierCountersBuilder_ = null;
-              encodedColumnQualifierCounters_ = 
other.encodedColumnQualifierCounters_;
-              bitField0_ = (bitField0_ & ~0x80000000);
-              encodedColumnQualifierCountersBuilder_ = 
-                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
-                   getEncodedColumnQualifierCountersFieldBuilder() : null;
-            } else {
-              
encodedColumnQualifierCountersBuilder_.addAllMessages(other.encodedColumnQualifierCounters_);
-            }
-          }
+        if (other.hasEncodedColumnQualifierCounter()) {
+          
setEncodedColumnQualifierCounter(other.getEncodedColumnQualifierCounter());
         }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
@@ -5682,12 +5605,6 @@ public final class PTableProtos {
             return false;
           }
         }
-        for (int i = 0; i < getEncodedColumnQualifierCountersCount(); i++) {
-          if (!getEncodedColumnQualifierCounters(i).isInitialized()) {
-            
-            return false;
-          }
-        }
         return true;
       }
 
@@ -7467,245 +7384,38 @@ public final class PTableProtos {
         return this;
       }
 
-      // repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;
-      private 
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 encodedColumnQualifierCounters_ =
-        java.util.Collections.emptyList();
-      private void ensureEncodedColumnQualifierCountersIsMutable() {
-        if (!((bitField0_ & 0x80000000) == 0x80000000)) {
-          encodedColumnQualifierCounters_ = new 
java.util.ArrayList<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>(encodedColumnQualifierCounters_);
-          bitField0_ |= 0x80000000;
-         }
-      }
-
-      private com.google.protobuf.RepeatedFieldBuilder<
-          
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>
 encodedColumnQualifierCountersBuilder_;
-
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 getEncodedColumnQualifierCountersList() {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          return 
java.util.Collections.unmodifiableList(encodedColumnQualifierCounters_);
-        } else {
-          return encodedColumnQualifierCountersBuilder_.getMessageList();
-        }
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public int getEncodedColumnQualifierCountersCount() {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          return encodedColumnQualifierCounters_.size();
-        } else {
-          return encodedColumnQualifierCountersBuilder_.getCount();
-        }
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 getEncodedColumnQualifierCounters(int index) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          return encodedColumnQualifierCounters_.get(index);
-        } else {
-          return encodedColumnQualifierCountersBuilder_.getMessage(index);
-        }
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public Builder setEncodedColumnQualifierCounters(
-          int index, 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 value) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.set(index, value);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.setMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public Builder setEncodedColumnQualifierCounters(
-          int index, 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 builderForValue) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.set(index, builderForValue.build());
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.setMessage(index, 
builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public Builder 
addEncodedColumnQualifierCounters(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 value) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.add(value);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.addMessage(value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public Builder addEncodedColumnQualifierCounters(
-          int index, 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 value) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.add(index, value);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.addMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public Builder addEncodedColumnQualifierCounters(
-          
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 builderForValue) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.add(builderForValue.build());
-          onChanged();
-        } else {
-          
encodedColumnQualifierCountersBuilder_.addMessage(builderForValue.build());
-        }
-        return this;
-      }
+      // optional int32 encodedColumnQualifierCounter = 32;
+      private int encodedColumnQualifierCounter_ ;
       /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+       * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
        */
-      public Builder addEncodedColumnQualifierCounters(
-          int index, 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 builderForValue) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.add(index, builderForValue.build());
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.addMessage(index, 
builderForValue.build());
-        }
-        return this;
+      public boolean hasEncodedColumnQualifierCounter() {
+        return ((bitField0_ & 0x80000000) == 0x80000000);
       }
       /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+       * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
        */
-      public Builder addAllEncodedColumnQualifierCounters(
-          java.lang.Iterable<? extends 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter>
 values) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          ensureEncodedColumnQualifierCountersIsMutable();
-          super.addAll(values, encodedColumnQualifierCounters_);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.addAllMessages(values);
-        }
-        return this;
+      public int getEncodedColumnQualifierCounter() {
+        return encodedColumnQualifierCounter_;
       }
       /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+       * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
        */
-      public Builder clearEncodedColumnQualifierCounters() {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          encodedColumnQualifierCounters_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x80000000);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.clear();
-        }
+      public Builder setEncodedColumnQualifierCounter(int value) {
+        bitField0_ |= 0x80000000;
+        encodedColumnQualifierCounter_ = value;
+        onChanged();
         return this;
       }
       /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
+       * <code>optional int32 encodedColumnQualifierCounter = 32;</code>
        */
-      public Builder removeEncodedColumnQualifierCounters(int index) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          ensureEncodedColumnQualifierCountersIsMutable();
-          encodedColumnQualifierCounters_.remove(index);
-          onChanged();
-        } else {
-          encodedColumnQualifierCountersBuilder_.remove(index);
-        }
+      public Builder clearEncodedColumnQualifierCounter() {
+        bitField0_ = (bitField0_ & ~0x80000000);
+        encodedColumnQualifierCounter_ = 0;
+        onChanged();
         return this;
       }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 getEncodedColumnQualifierCountersBuilder(
-          int index) {
-        return 
getEncodedColumnQualifierCountersFieldBuilder().getBuilder(index);
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder
 getEncodedColumnQualifierCountersOrBuilder(
-          int index) {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          return encodedColumnQualifierCounters_.get(index);  } else {
-          return 
encodedColumnQualifierCountersBuilder_.getMessageOrBuilder(index);
-        }
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public java.util.List<? extends 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>
 
-           getEncodedColumnQualifierCountersOrBuilderList() {
-        if (encodedColumnQualifierCountersBuilder_ != null) {
-          return 
encodedColumnQualifierCountersBuilder_.getMessageOrBuilderList();
-        } else {
-          return 
java.util.Collections.unmodifiableList(encodedColumnQualifierCounters_);
-        }
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 addEncodedColumnQualifierCountersBuilder() {
-        return getEncodedColumnQualifierCountersFieldBuilder().addBuilder(
-            
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder
 addEncodedColumnQualifierCountersBuilder(
-          int index) {
-        return getEncodedColumnQualifierCountersFieldBuilder().addBuilder(
-            index, 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .EncodedColumnQualifierCounter 
encodedColumnQualifierCounters = 32;</code>
-       */
-      public 
java.util.List<org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder>
 
-           getEncodedColumnQualifierCountersBuilderList() {
-        return 
getEncodedColumnQualifierCountersFieldBuilder().getBuilderList();
-      }
-      private com.google.protobuf.RepeatedFieldBuilder<
-          
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>
 
-          getEncodedColumnQualifierCountersFieldBuilder() {
-        if (encodedColumnQualifierCountersBuilder_ == null) {
-          encodedColumnQualifierCountersBuilder_ = new 
com.google.protobuf.RepeatedFieldBuilder<
-              
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder>(
-                  encodedColumnQualifierCounters_,
-                  ((bitField0_ & 0x80000000) == 0x80000000),
-                  getParentForChildren(),
-                  isClean());
-          encodedColumnQualifierCounters_ = null;
-        }
-        return encodedColumnQualifierCountersBuilder_;
-      }
 
       // @@protoc_insertion_point(builder_scope:PTable)
     }
@@ -7718,645 +7428,25 @@ public final class PTableProtos {
     // @@protoc_insertion_point(class_scope:PTable)
   }
 
-  public interface EncodedColumnQualifierCounterOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string familyName = 1;
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    boolean hasFamilyName();
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    java.lang.String getFamilyName();
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getFamilyNameBytes();
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_PColumn_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_PColumn_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_PTableStats_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_PTableStats_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_PTable_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_PTable_fieldAccessorTable;
 
-    // required int32 counter = 2;
-    /**
-     * <code>required int32 counter = 2;</code>
-     */
-    boolean hasCounter();
-    /**
-     * <code>required int32 counter = 2;</code>
-     */
-    int getCounter();
-  }
-  /**
-   * Protobuf type {@code EncodedColumnQualifierCounter}
-   */
-  public static final class EncodedColumnQualifierCounter extends
-      com.google.protobuf.GeneratedMessage
-      implements EncodedColumnQualifierCounterOrBuilder {
-    // Use EncodedColumnQualifierCounter.newBuilder() to construct.
-    private 
EncodedColumnQualifierCounter(com.google.protobuf.GeneratedMessage.Builder<?> 
builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private EncodedColumnQualifierCounter(boolean noInit) { this.unknownFields 
= com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final EncodedColumnQualifierCounter defaultInstance;
-    public static EncodedColumnQualifierCounter getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public EncodedColumnQualifierCounter getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private EncodedColumnQualifierCounter(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              bitField0_ |= 0x00000001;
-              familyName_ = input.readBytes();
-              break;
-            }
-            case 16: {
-              bitField0_ |= 0x00000002;
-              counter_ = input.readInt32();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return 
org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_EncodedColumnQualifierCounter_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return 
org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_EncodedColumnQualifierCounter_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.class,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<EncodedColumnQualifierCounter> 
PARSER =
-        new 
com.google.protobuf.AbstractParser<EncodedColumnQualifierCounter>() {
-      public EncodedColumnQualifierCounter parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new EncodedColumnQualifierCounter(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<EncodedColumnQualifierCounter> 
getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string familyName = 1;
-    public static final int FAMILYNAME_FIELD_NUMBER = 1;
-    private java.lang.Object familyName_;
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    public boolean hasFamilyName() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    public java.lang.String getFamilyName() {
-      java.lang.Object ref = familyName_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          familyName_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string familyName = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getFamilyNameBytes() {
-      java.lang.Object ref = familyName_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        familyName_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // required int32 counter = 2;
-    public static final int COUNTER_FIELD_NUMBER = 2;
-    private int counter_;
-    /**
-     * <code>required int32 counter = 2;</code>
-     */
-    public boolean hasCounter() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>required int32 counter = 2;</code>
-     */
-    public int getCounter() {
-      return counter_;
-    }
-
-    private void initFields() {
-      familyName_ = "";
-      counter_ = 0;
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasFamilyName()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasCounter()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getFamilyNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(2, counter_);
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getFamilyNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(2, counter_);
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter))
 {
-        return super.equals(obj);
-      }
-      
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 other = 
(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter)
 obj;
-
-      boolean result = true;
-      result = result && (hasFamilyName() == other.hasFamilyName());
-      if (hasFamilyName()) {
-        result = result && getFamilyName()
-            .equals(other.getFamilyName());
-      }
-      result = result && (hasCounter() == other.hasCounter());
-      if (hasCounter()) {
-        result = result && (getCounter()
-            == other.getCounter());
-      }
-      result = result &&
-          getUnknownFields().equals(other.getUnknownFields());
-      return result;
-    }
-
-    private int memoizedHashCode = 0;
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      if (hasFamilyName()) {
-        hash = (37 * hash) + FAMILYNAME_FIELD_NUMBER;
-        hash = (53 * hash) + getFamilyName().hashCode();
-      }
-      if (hasCounter()) {
-        hash = (37 * hash) + COUNTER_FIELD_NUMBER;
-        hash = (53 * hash) + getCounter();
-      }
-      hash = (29 * hash) + getUnknownFields().hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder 
newBuilder(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code EncodedColumnQualifierCounter}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounterOrBuilder
 {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return 
org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_EncodedColumnQualifierCounter_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return 
org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_EncodedColumnQualifierCounter_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.class,
 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.Builder.class);
-      }
-
-      // Construct using 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        familyName_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        counter_ = 0;
-        bitField0_ = (bitField0_ & ~0x00000002);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return 
org.apache.phoenix.coprocessor.generated.PTableProtos.internal_static_EncodedColumnQualifierCounter_descriptor;
-      }
-
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 getDefaultInstanceForType() {
-        return 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.getDefaultInstance();
-      }
-
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 build() {
-        
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 buildPartial() {
-        
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 result = new 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.familyName_ = familyName_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.counter_ = counter_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter)
 {
-          return 
mergeFrom((org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder 
mergeFrom(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 other) {
-        if (other == 
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter.getDefaultInstance())
 return this;
-        if (other.hasFamilyName()) {
-          bitField0_ |= 0x00000001;
-          familyName_ = other.familyName_;
-          onChanged();
-        }
-        if (other.hasCounter()) {
-          setCounter(other.getCounter());
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasFamilyName()) {
-          
-          return false;
-        }
-        if (!hasCounter()) {
-          
-          return false;
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        
org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter
 parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = 
(org.apache.phoenix.coprocessor.generated.PTableProtos.EncodedColumnQualifierCounter)
 e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string familyName = 1;
-      private java.lang.Object familyName_ = "";
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public boolean hasFamilyName() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public java.lang.String getFamilyName() {
-        java.lang.Object ref = familyName_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          familyName_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getFamilyNameBytes() {
-        java.lang.Object ref = familyName_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          familyName_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public Builder setFamilyName(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        familyName_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public Builder clearFamilyName() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        familyName_ = getDefaultInstance().getFamilyName();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string familyName = 1;</code>
-       */
-      public Builder setFamilyNameBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        familyName_ = value;
-        onChanged();
-        return this;
-      }
-
-      // required int32 counter = 2;
-      private int counter_ ;
-      /**
-       * <code>required int32 counter = 2;</code>
-       */
-      public boolean hasCounter() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>required int32 counter = 2;</code>
-       */
-      public int getCounter() {
-        return counter_;
-      }
-      /**
-       * <code>required int32 counter = 2;</code>
-       */
-      public Builder setCounter(int value) {
-        bitField0_ |= 0x00000002;
-        counter_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required int32 counter = 2;</code>
-       */
-      public Builder clearCounter() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        counter_ = 0;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:EncodedColumnQualifierCounter)
-    }
-
-    static {
-      defaultInstance = new EncodedColumnQualifierCounter(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:EncodedColumnQualifierCounter)
-  }
-
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_PColumn_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_PColumn_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_PTableStats_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_PTableStats_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_PTable_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_PTable_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_EncodedColumnQualifierCounter_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_EncodedColumnQualifierCounter_fieldAccessorTable;
-
-  public static com.google.protobuf.Descriptors.FileDescriptor
-      getDescriptor() {
-    return descriptor;
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
   }
   private static com.google.protobuf.Descriptors.FileDescriptor
       descriptor;
@@ -8374,7 +7464,7 @@ public final class PTableProtos {
       "PTableStats\022\013\n\003key\030\001 
\002(\014\022\016\n\006values\030\002 \003(\014",
       "\022\033\n\023guidePostsByteCount\030\003 \001(\003\022\025\n\rkeyByte" 
+
       "sCount\030\004 \001(\003\022\027\n\017guidePostsCount\030\005 
\001(\005\022!\n" +
-      "\013pGuidePosts\030\006 \001(\0132\014.PGuidePosts\"\275\006\n\006PTa" +
+      "\013pGuidePosts\030\006 \001(\0132\014.PGuidePosts\"\234\006\n\006PTa" +
       "ble\022\027\n\017schemaNameBytes\030\001 
\002(\014\022\026\n\016tableNam" +
       "eBytes\030\002 \002(\014\022\036\n\ttableType\030\003 
\002(\0162\013.PTable" +
       "Type\022\022\n\nindexState\030\004 \001(\t\022\026\n\016sequenceNumb" +
@@ -8393,14 +7483,12 @@ public final class PTableProtos {
       "rOptimizable\030\032 \001(\010\022\025\n\rtransactional\030\033 \001(" +
       "\010\022\034\n\024updateCacheFrequency\030\034 
\001(\003\022\035\n\025index",
       "DisableTimestamp\030\035 \001(\003\022\031\n\021isNamespaceMap" +
-      "ped\030\036 \001(\010\022\025\n\rstorageScheme\030\037 
\001(\014\022F\n\036enco" +
-      "dedColumnQualifierCounters\030  \003(\0132\036.Encod" +
-      "edColumnQualifierCounter\"D\n\035EncodedColum" +
-      "nQualifierCounter\022\022\n\nfamilyName\030\001 \002(\t\022\017\n" +
-      "\007counter\030\002 
\002(\005*A\n\nPTableType\022\n\n\006SYSTEM\020\000" +
-      
"\022\010\n\004USER\020\001\022\010\n\004VIEW\020\002\022\t\n\005INDEX\020\003\022\010\n\004JOIN\020"
 +
-      "\004B@\n(org.apache.phoenix.coprocessor.gene" +
-      "ratedB\014PTableProtosH\001\210\001\001\240\001\001"
+      "ped\030\036 \001(\010\022\025\n\rstorageScheme\030\037 
\001(\014\022%\n\035enco" +
+      "dedColumnQualifierCounter\030  \001(\005*A\n\nPTabl" +
+      
"eType\022\n\n\006SYSTEM\020\000\022\010\n\004USER\020\001\022\010\n\004VIEW\020\002\022\t\n"
 +
+      "\005INDEX\020\003\022\010\n\004JOIN\020\004B@\n(org.apache.phoenix" +
+      ".coprocessor.generatedB\014PTableProtosH\001\210\001" +
+      "\001\240\001\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner 
assigner =
       new 
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -8424,13 +7512,7 @@ public final class PTableProtos {
           internal_static_PTable_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_PTable_descriptor,
-              new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", 
"TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", 
"BucketNum", "Columns", "Indexes", "IsImmutableRows", "GuidePosts", 
"DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", 
"ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", 
"IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", 
"RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", 
"IndexDisableTimestamp", "IsNamespaceMapped", "StorageScheme", 
"EncodedColumnQualifierCounters", });
-          internal_static_EncodedColumnQualifierCounter_descriptor =
-            getDescriptor().getMessageTypes().get(3);
-          internal_static_EncodedColumnQualifierCounter_fieldAccessorTable = 
new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_EncodedColumnQualifierCounter_descriptor,
-              new java.lang.String[] { "FamilyName", "Counter", });
+              new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", 
"TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", 
"BucketNum", "Columns", "Indexes", "IsImmutableRows", "GuidePosts", 
"DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", 
"ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", 
"IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", 
"RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", 
"IndexDisableTimestamp", "IsNamespaceMapped", "StorageScheme", 
"EncodedColumnQualifierCounter", });
           return null;
         }
       };

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
index e181e80..dd68944 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
@@ -651,6 +651,7 @@ public class SortMergeJoinPlan implements QueryPlan {
                 byte[] b = new byte[length];
                 buffer.get(b);
                 Result result = ResultUtil.toResult(new 
ImmutableBytesWritable(b));
+                //TODO: samarth make joins work with position based look up.
                 return new ResultTuple(result);
             }
             

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/execute/TupleProjector.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/TupleProjector.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/TupleProjector.java
index a884949..b6e1de2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/TupleProjector.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/TupleProjector.java
@@ -17,6 +17,9 @@
  */
 package org.apache.phoenix.execute;
 
+import static org.apache.phoenix.query.QueryConstants.VALUE_COLUMN_FAMILY;
+import static org.apache.phoenix.query.QueryConstants.VALUE_COLUMN_QUALIFIER;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
@@ -50,9 +53,6 @@ import org.apache.phoenix.util.SchemaUtil;
 import com.google.common.base.Preconditions;
 
 public class TupleProjector {    
-    public static final byte[] VALUE_COLUMN_FAMILY = Bytes.toBytes("_v");
-    public static final byte[] VALUE_COLUMN_QUALIFIER = new byte[0];
-    
     private static final String SCAN_PROJECTOR = "scanProjector";
     
     private final KeyValueSchema schema;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixTransactionalIndexer.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixTransactionalIndexer.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixTransactionalIndexer.java
index 13b95b5..b7e1975 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixTransactionalIndexer.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixTransactionalIndexer.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -222,8 +223,12 @@ public class PhoenixTransactionalIndexer extends 
BaseRegionObserver {
                 for (ColumnReference ref : mutableColumns) {
                     scan.addColumn(ref.getFamily(), ref.getQualifier());
                 }
-                // Indexes inherit the storage scheme of the data table which 
means all the indexes have the same
-                // storage scheme and empty key value qualifier.
+                /*
+                 * Indexes inherit the storage scheme of the data table which 
means all the indexes have the same
+                 * storage scheme and empty key value qualifier. Note that 
this assumption would be broken if we start
+                 * supporting new indexes over existing data tables to have a 
different storage scheme than the data
+                 * table.
+                 */
                 byte[] emptyKeyValueQualifier = 
indexMaintainers.get(0).getEmptyKeyValueQualifier();
                 
                 // Project empty key value column
@@ -322,17 +327,20 @@ public class PhoenixTransactionalIndexer extends 
BaseRegionObserver {
                     boolean hasPuts = false;
                     LinkedList<Cell> singleTimeCells = Lists.newLinkedList();
                     long writePtr;
+                    Cell cell = cells.get(i);
                     do {
-                        Cell cell = cells.get(i);
                         hasPuts |= cell.getTypeByte() == 
KeyValue.Type.Put.getCode();
                         writePtr = cell.getTimestamp();
+                        ListIterator<Cell> it = singleTimeCells.listIterator();
                         do {
                             // Add at the beginning of the list to match the 
expected HBase
                             // newest to oldest sort order (which TxTableState 
relies on
-                            // with the Result.getLatestColumnValue() calls).
-                            singleTimeCells.addFirst(cell);
-                        } while (++i < nCells && cells.get(i).getTimestamp() 
== writePtr);
-                    } while (i < nCells && cells.get(i).getTimestamp() <= 
readPtr);
+                            // with the Result.getLatestColumnValue() calls). 
However, we
+                            // still want to add Cells in the expected order 
for each time
+                            // bound as otherwise we won't find it in our old 
state.
+                            it.add(cell);
+                        } while (++i < nCells && 
(cell=cells.get(i)).getTimestamp() == writePtr);
+                    } while (i < nCells && cell.getTimestamp() <= readPtr);
                     
                     // Generate point delete markers for the prior row 
deletion of the old index value.
                     // The write timestamp is the next timestamp, not the 
current timestamp,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 0dca8ba..5a923eb 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -22,7 +22,9 @@ import static 
org.apache.phoenix.coprocessor.BaseScannerRegionObserver.EXPECTED_
 import static 
org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW;
 import static 
org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_FAILED_QUERY_COUNTER;
 import static 
org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_QUERY_TIMEOUT_COUNTER;
+import static 
org.apache.phoenix.query.QueryConstants.ENCODED_EMPTY_COLUMN_NAME;
 import static org.apache.phoenix.util.ByteUtil.EMPTY_BYTE_ARRAY;
+import static org.apache.phoenix.util.ScanUtil.setMinMaxQualifiersOnScan;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
@@ -46,6 +48,8 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+import javax.management.Query;
+
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.client.Scan;
@@ -71,6 +75,7 @@ import org.apache.phoenix.parse.FilterableStatement;
 import org.apache.phoenix.parse.HintNode.Hint;
 import org.apache.phoenix.query.ConnectionQueryServices;
 import org.apache.phoenix.query.KeyRange;
+import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.MetaDataClient;
@@ -225,7 +230,8 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
             if(offset!=null){
                 ScanUtil.addOffsetAttribute(scan, offset);
             }
-            if (EncodedColumnsUtil.usesEncodedColumnNames(table)) {
+            //TODO: samarth add condition to not do position based look ups in 
case of joins so that we won't need to do the hacky check inside co-processors.
+            if (setMinMaxQualifiersOnScan(table)) {
                 Pair<Integer, Integer> minMaxQualifiers = 
getMinMaxQualifiers(scan, context);
                 if (minMaxQualifiers != null) {
                     scan.setAttribute(BaseScannerRegionObserver.MIN_QUALIFIER, 
PInteger.INSTANCE.toBytes(minMaxQualifiers.getFirst()));
@@ -243,10 +249,15 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
         checkArgument(EncodedColumnsUtil.usesEncodedColumnNames(table), 
"Method should only be used for tables using encoded column names");
         Integer minQualifier = null;
         Integer maxQualifier = null;
+        boolean emptyKVProjected = false;
         for (Pair<byte[], byte[]> whereCol : 
context.getWhereConditionColumns()) {
             byte[] cq = whereCol.getSecond();
             if (cq != null) {
                 int qualifier = (Integer)PInteger.INSTANCE.toObject(cq);
+                if (qualifier == ENCODED_EMPTY_COLUMN_NAME) {
+                    emptyKVProjected = true;
+                    continue;
+                }
                 if (minQualifier == null && maxQualifier == null) {
                     minQualifier = maxQualifier = qualifier;
                 } else {
@@ -264,6 +275,10 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
                 for (byte[] cq : entry.getValue()) {
                     if (cq != null) {
                         int qualifier = 
(Integer)PInteger.INSTANCE.toObject(cq);
+                        if (qualifier == ENCODED_EMPTY_COLUMN_NAME) {
+                            emptyKVProjected = true;
+                            continue;
+                        }
                         if (minQualifier == null && maxQualifier == null) {
                             minQualifier = maxQualifier = qualifier;
                         } else {
@@ -277,7 +292,9 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
                 }
             }
         }
-        if (minQualifier == null) {
+        if (minQualifier == null && emptyKVProjected) {
+            return new Pair<>(ENCODED_EMPTY_COLUMN_NAME, 
ENCODED_EMPTY_COLUMN_NAME);
+        } else if (minQualifier == null) {
             return null;
         }
         return new Pair<>(minQualifier, maxQualifier);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
index 3293f65..1e5f09e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/LookAheadResultIterator.java
@@ -49,7 +49,7 @@ abstract public class LookAheadResultIterator implements 
PeekingResultIterator {
         };
     }
     
-    private final static Tuple UNINITIALIZED = new ResultTuple();
+    private final static Tuple UNINITIALIZED = ResultTuple.EMPTY_TUPLE;
     private Tuple next = UNINITIALIZED;
     
     abstract protected Tuple advance() throws SQLException;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
index 8ada952..135ab26 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MappedByteBufferQueue.java
@@ -180,6 +180,7 @@ public abstract class MappedByteBufferQueue<T> extends 
AbstractQueue<T> {
             return this.index;
         }
         
+        @Override
         public int size() {
             if (flushBuffer)
                 return flushedCount;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
index 8dcb2e8..e4c52c0 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
@@ -32,6 +32,7 @@ import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.expression.OrderByExpression;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.util.ServerUtil;
 import org.apache.phoenix.util.SizedUtil;
 
 import com.google.common.base.Function;
@@ -264,7 +265,7 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
             }
             this.byteSize = queueEntries.getByteSize();
         } catch (IOException e) {
-            throw new SQLException("", e);
+            ServerUtil.createIOException(e.getMessage(), e);
         } finally {
             delegate.close();
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
index 88e141a..d287749 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerResultIterator.java
@@ -24,16 +24,24 @@ import java.util.List;
 
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.schema.tuple.BoundedSkipNullCellsList;
 import org.apache.phoenix.schema.tuple.MultiKeyValueTuple;
+import org.apache.phoenix.schema.tuple.PositionBasedMultiKeyValueTuple;
 import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.ServerUtil;
 
 
 public class RegionScannerResultIterator extends BaseResultIterator {
     private final RegionScanner scanner;
+    private final Pair<Integer, Integer> minMaxQualifiers;
+    private final boolean useQualifierAsIndex;
     
-    public RegionScannerResultIterator(RegionScanner scanner) {
+    public RegionScannerResultIterator(RegionScanner scanner, Pair<Integer, 
Integer> minMaxQualifiers, boolean isJoin) {
         this.scanner = scanner;
+        this.useQualifierAsIndex = 
ScanUtil.useQualifierAsIndex(minMaxQualifiers, isJoin);
+        this.minMaxQualifiers = minMaxQualifiers;
     }
     
     @Override
@@ -43,7 +51,7 @@ public class RegionScannerResultIterator extends 
BaseResultIterator {
         synchronized (scanner) {
             try {
                 // TODO: size
-                List<Cell> results = new ArrayList<Cell>();
+                List<Cell> results = useQualifierAsIndex ? new 
BoundedSkipNullCellsList(minMaxQualifiers.getFirst(), 
minMaxQualifiers.getSecond()) :  new ArrayList<Cell>();
                 // Results are potentially returned even when the return value 
of s.next is false
                 // since this is an indication of whether or not there are 
more values after the
                 // ones returned
@@ -53,7 +61,7 @@ public class RegionScannerResultIterator extends 
BaseResultIterator {
                 }
                 // We instantiate a new tuple because in all cases currently 
we hang on to it
                 // (i.e. to compute and hold onto the TopN).
-                MultiKeyValueTuple tuple = new MultiKeyValueTuple();
+                Tuple tuple = useQualifierAsIndex ? new 
PositionBasedMultiKeyValueTuple() : new MultiKeyValueTuple();
                 tuple.setKeyValues(results);
                 return tuple;
             } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 1c9bc51..d02c29d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -586,9 +586,8 @@ public class PhoenixDatabaseMetaData implements 
DatabaseMetaData {
                 newCells.addAll(cells);
                 newCells.add(kv);
                 Collections.sort(newCells, KeyValue.COMPARATOR);
-                resultTuple.setResult(Result.create(newCells));
+                tuple = new ResultTuple(Result.create(newCells));
             }
-
             return tuple;
         }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
index 47c17ae..3ca48a1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
@@ -107,7 +107,7 @@ public class PhoenixResultSet implements ResultSet, 
SQLCloseable {
     private final static String STRING_FALSE = "0";
     private final static BigDecimal BIG_DECIMAL_FALSE = BigDecimal.valueOf(0);
     private final static Integer INTEGER_FALSE = Integer.valueOf(0);
-    private final static Tuple BEFORE_FIRST = new ResultTuple();
+    private final static Tuple BEFORE_FIRST = ResultTuple.EMPTY_TUPLE;
 
     private final ResultIterator scanner;
     private final RowProjector rowProjector;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java 
b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
index 908a117..2d7550a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java
@@ -122,6 +122,7 @@ public class HashCacheFactory implements ServerCacheFactory 
{
                     int resultSize = (int)Bytes.readVLong(hashCacheByteArray, 
offset);
                     offset += 
WritableUtils.decodeVIntSize(hashCacheByteArray[offset]);
                     ImmutableBytesWritable value = new 
ImmutableBytesWritable(hashCacheByteArray,offset,resultSize);
+                    //TODO: samarth make joins work with position look up.
                     Tuple result = new ResultTuple(ResultUtil.toResult(value));
                     ImmutableBytesPtr key = 
TupleUtil.getConcatenatedValue(result, onExpressions);
                     List<Tuple> tuples = hashCacheMap.get(key);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index f57043b..4984321 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -29,7 +29,7 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_COUNT;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_DEF;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_SIZE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CURRENT_VALUE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CYCLE_FLAG;
@@ -39,7 +39,7 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
-import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
+import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH;
@@ -120,7 +120,6 @@ import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PNameFactory;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.types.PInteger;
-import org.apache.phoenix.util.ByteUtil;
 
 
 /**
@@ -150,23 +149,30 @@ public interface QueryConstants {
     public final static byte[] OFFSET_ROW_KEY_BYTES = 
Bytes.toBytes(OFFSET_ROW_KEY);
     public final static ImmutableBytesPtr OFFSET_ROW_KEY_PTR = new 
ImmutableBytesPtr(OFFSET_ROW_KEY_BYTES);
 
-    public final static PName SINGLE_COLUMN_NAME = 
PNameFactory.newNormalizedName("s");
-    public final static PName SINGLE_COLUMN_FAMILY_NAME = 
PNameFactory.newNormalizedName("s");
-    public final static byte[] SINGLE_COLUMN = SINGLE_COLUMN_NAME.getBytes();
-    public final static byte[] SINGLE_COLUMN_FAMILY = 
SINGLE_COLUMN_FAMILY_NAME.getBytes();
-
     public static final long AGG_TIMESTAMP = HConstants.LATEST_TIMESTAMP;
     /**
      * Key used for a single row aggregation where there is no group by
      */
     public final static byte[] UNGROUPED_AGG_ROW_KEY = Bytes.toBytes("a");
-    public final static PName AGG_COLUMN_NAME = SINGLE_COLUMN_NAME;
-    public final static PName AGG_COLUMN_FAMILY_NAME = 
SINGLE_COLUMN_FAMILY_NAME;
-
-    public static final byte[] ARRAY_VALUE_COLUMN_FAMILY = Bytes.toBytes("a");
-    // Use empty byte array for column qualifier so as not to accidentally 
conflict with any other columns
-    public static final byte[] ARRAY_VALUE_COLUMN_QUALIFIER = 
ByteUtil.EMPTY_BYTE_ARRAY;
+    
+    /** BEGIN Set of reserved column qualifiers **/
+    
+    public static final String RESERVED_COLUMN_FAMILY = "_r";
+    public static final byte[] RESERVED_COLUMN_FAMILY_BYTES = 
Bytes.toBytes(RESERVED_COLUMN_FAMILY);
+    
+    public static final byte[] VALUE_COLUMN_FAMILY = 
RESERVED_COLUMN_FAMILY_BYTES;
+    public static final byte[] VALUE_COLUMN_QUALIFIER = 
PInteger.INSTANCE.toBytes(1);
+    
+    public static final byte[] ARRAY_VALUE_COLUMN_FAMILY = 
RESERVED_COLUMN_FAMILY_BYTES;
+    public static final byte[] ARRAY_VALUE_COLUMN_QUALIFIER = 
PInteger.INSTANCE.toBytes(2);
+    
+    public final static PName SINGLE_COLUMN_NAME = 
PNameFactory.newNormalizedName("s");
+    public final static PName SINGLE_COLUMN_FAMILY_NAME = 
PNameFactory.newNormalizedName("s");
+    public final static byte[] SINGLE_COLUMN = PInteger.INSTANCE.toBytes(3);
+    public final static byte[] SINGLE_COLUMN_FAMILY = 
RESERVED_COLUMN_FAMILY_BYTES;
 
+    /** END Set of reserved column qualifiers **/
+    
     public static final byte[] TRUE = new byte[] {1};
 
     /**
@@ -214,6 +220,13 @@ public interface QueryConstants {
     public static final int NANOS_IN_SECOND = BigDecimal.valueOf(Math.pow(10, 
9)).intValue();
     public static final int DIVERGED_VIEW_BASE_COLUMN_COUNT = -100;
     public static final int BASE_TABLE_BASE_COLUMN_COUNT = -1;
+    
+    //TODO: samarth think about this more.
+    /**
+     * We mark counter values 0 to 10 as reserved. Value 0 is used by {@link 
#ENCODED_EMPTY_COLUMN_NAME}. Values 1-10
+     * are reserved for special column qualifiers returned by Phoenix 
co-processors.
+     */
+    public static final int ENCODED_CQ_COUNTER_INITIAL_VALUE = 11;
     public static final String CREATE_TABLE_METADATA =
             // Do not use IF NOT EXISTS as we sometimes catch the 
TableAlreadyExists
             // exception and add columns to the SYSTEM.TABLE dynamically.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index c49ad1d..8c7c882 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -235,7 +235,7 @@ public class QueryServicesOptions {
     // doesn't depend on phoenix-core.
     public static final String DEFAULT_QUERY_SERVER_SERIALIZATION = "PROTOBUF";
     public static final int DEFAULT_QUERY_SERVER_HTTP_PORT = 8765;
-    public static final boolean DEFAULT_RENEW_LEASE_ENABLED = true;
+    public static final boolean DEFAULT_RENEW_LEASE_ENABLED = false;
     public static final int 
DEFAULT_RUN_RENEW_LEASE_FREQUENCY_INTERVAL_MILLISECONDS =
             DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD / 2;
     public static final int DEFAULT_RENEW_LEASE_THRESHOLD_MILLISECONDS =

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java
index 1690bd3..e7672f2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java
@@ -18,7 +18,6 @@
 package org.apache.phoenix.schema;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
@@ -289,7 +288,7 @@ public class DelegateTable implements PTable {
     }
 
     @Override
-    public Map<String, Integer> getEncodedCQCounters() {
-        return delegate.getEncodedCQCounters();
+    public EncodedCQCounter getEncodedCQCounter() {
+        return delegate.getEncodedCQCounter();
     }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9525c72f/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
index 1ab8c86..1bcf808 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/KeyValueSchema.java
@@ -109,6 +109,8 @@ public class KeyValueSchema extends ValueSchema {
             Field field = fields.get(i);
             PDataType type = field.getDataType();
             for (int j = 0; j < field.getCount(); j++) {
+                //TODO: samarth it is at this point that we are looking up 
stuff in the result tuple to figure out
+                // where exactly the value is here.
                 if (expressions[index].evaluate(tuple, ptr) && ptr.getLength() 
> 0) { // Skip null values
                     if (index >= minNullableIndex) {
                         valueSet.set(index - minNullableIndex);

Reply via email to