phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffr...@apache.org
Subject [10/36] PHOENIX-113 Enable usage of ClientKeyValue on for indexing on server (JamesTaylor)
Date Mon, 10 Mar 2014 04:21:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/KeyValueBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/KeyValueBuilder.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/KeyValueBuilder.java
new file mode 100644
index 0000000..0d27512
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/KeyValueBuilder.java
@@ -0,0 +1,130 @@
+/*
+ * 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.phoenix.hbase.index.util;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValue.KVComparator;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+
+/**
+ * Build {@link KeyValue} in an efficient way
+ */
+public abstract class KeyValueBuilder {
+
+    /**
+     * Helper method for a {@link KeyValueBuilder} that catches an IOException from a {@link
Put}
+     * when adding a {@link KeyValue} generated by the KeyValueBuilder.
+     * @throws RuntimeException if there is an IOException thrown from the underlying {@link
Put}
+     */
+    @SuppressWarnings("javadoc")
+    public static void addQuietly(Put put, KeyValueBuilder builder, KeyValue kv) {
+        try {
+            put.add(kv);
+        } catch (IOException e) {
+            throw new RuntimeException("KeyValue Builder " + builder + " created an invalid
kv: "
+                    + kv + "!");
+        }
+    }
+
+    /**
+     * Helper method for a {@link KeyValueBuilder} that catches an IOException from a {@link
Put}
+     * when adding a {@link KeyValue} generated by the KeyValueBuilder.
+     * @throws RuntimeException if there is an IOException thrown from the underlying {@link
Put}
+     */
+    @SuppressWarnings("javadoc")
+    public static void deleteQuietly(Delete delete, KeyValueBuilder builder, KeyValue kv)
{
+        try {
+            delete.addDeleteMarker(kv);
+        } catch (IOException e) {
+            throw new RuntimeException("KeyValue Builder " + builder + " created an invalid
kv: "
+                    + kv + "!");
+        }
+    }
+
+    private static final int CUSTOM_KEY_VALUE_MIN_VERSION = VersionUtil.encodeVersion("0.94.14");
+
+    public static KeyValueBuilder get(String hbaseVersion) {
+        int version = VersionUtil.encodeVersion(hbaseVersion);
+        if (version >= CUSTOM_KEY_VALUE_MIN_VERSION) {
+            return ClientKeyValueBuilder.INSTANCE;
+        }
+        return GenericKeyValueBuilder.INSTANCE;
+    }
+
+  public KeyValue buildPut(ImmutableBytesWritable row, ImmutableBytesWritable family,
+      ImmutableBytesWritable qualifier, ImmutableBytesWritable value) {
+    return buildPut(row, family, qualifier, HConstants.LATEST_TIMESTAMP, value);
+  }
+
+  public abstract KeyValue buildPut(ImmutableBytesWritable row, ImmutableBytesWritable family,
+      ImmutableBytesWritable qualifier, long ts, ImmutableBytesWritable value);
+
+  public KeyValue buildDeleteFamily(ImmutableBytesWritable row, ImmutableBytesWritable family,
+            ImmutableBytesWritable qualifier) {
+        return buildDeleteFamily(row, family, qualifier, HConstants.LATEST_TIMESTAMP);
+  }
+
+  public abstract KeyValue buildDeleteFamily(ImmutableBytesWritable row,
+            ImmutableBytesWritable family, ImmutableBytesWritable qualifier, long ts);
+
+  public KeyValue buildDeleteColumns(ImmutableBytesWritable row, ImmutableBytesWritable family,
+            ImmutableBytesWritable qualifier) {
+        return buildDeleteColumns(row, family, qualifier, HConstants.LATEST_TIMESTAMP);
+  }
+
+  public abstract KeyValue buildDeleteColumns(ImmutableBytesWritable row,
+            ImmutableBytesWritable family, ImmutableBytesWritable qualifier, long ts);
+
+  public KeyValue buildDeleteColumn(ImmutableBytesWritable row, ImmutableBytesWritable family,
+            ImmutableBytesWritable qualifier) {
+        return buildDeleteColumn(row, family, qualifier, HConstants.LATEST_TIMESTAMP);
+  }
+
+  public abstract KeyValue buildDeleteColumn(ImmutableBytesWritable row,
+            ImmutableBytesWritable family, ImmutableBytesWritable qualifier, long ts);
+
+  /**
+   * Compare the qualifier based on the type of keyvalue. Assumes that the {@link KeyValue}
passed
+   * in was generated by the {@link KeyValueBuilder}
+   * @param kv to compare against
+   * @param key to compare
+   * @param offset in the passed key
+   * @param length length of the key from the offset to check
+   * @return the byte difference between the passed keyvalue's qualifier and the passed key
+   */
+  public abstract int compareQualifier(KeyValue kv, byte[] key, int offset, int length);
+
+  public abstract int compareFamily(KeyValue kv, byte[] key, int offset, int length);
+  public abstract int compareRow(KeyValue kv, byte[] row, int offset, int length);
+  /**
+   * @param kv to read
+   * @param ptr set with the value from the {@link KeyValue}
+   */
+  public abstract void getValueAsPtr(KeyValue kv, ImmutableBytesWritable ptr);
+  
+  public abstract KVComparator getKeyValueComparator();
+  
+  public abstract List<Mutation> cloneIfNecessary(List<Mutation> mutations);
+}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/VersionUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/VersionUtil.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/VersionUtil.java
new file mode 100644
index 0000000..42d07f5
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/util/VersionUtil.java
@@ -0,0 +1,76 @@
+/*
+ * 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.phoenix.hbase.index.util;
+
+
+public class VersionUtil {
+    private VersionUtil() {
+    }
+
+    // Encode a version string in the format of "major.minor.patch" into an integer.
+    public static int encodeVersion(String version) {
+        String[] versionParts = VersionUtil.splitHBaseVersionString(version);
+        return VersionUtil.encodeVersion(versionParts[0], versionParts.length > 1 ? versionParts[1]
: null, versionParts.length > 2 ? versionParts[2] : null);
+    }
+
+    public static String[] splitHBaseVersionString(String version) {
+        return version.split("[-\\.]");
+    }
+
+    // Encode the major as 2nd byte in the int, minor as the first byte and patch as the
last byte.
+    public static int encodeVersion(String major, String minor, String patch) {
+        return encodeVersion(major == null ? 0 : Integer.parseInt(major), minor == null ?
0 : Integer.parseInt(minor), 
+                        patch == null ? 0 : Integer.parseInt(patch));
+    }
+
+    public static int encodeVersion(int major, int minor, int patch) {
+        int version = 0;
+        version |= (major << Byte.SIZE * 2);
+        version |= (minor << Byte.SIZE);
+        version |= patch;
+        return version;
+    }
+
+    public static int encodeMaxPatchVersion(int major, int minor) {
+        int version = 0;
+        version |= (major << Byte.SIZE * 2);
+        version |= (minor << Byte.SIZE);
+        version |= 0xFF;
+        return version;
+    }
+
+    public static int encodeMinPatchVersion(int major, int minor) {
+        int version = 0;
+        version |= (major << Byte.SIZE * 2);
+        version |= (minor << Byte.SIZE);
+        return version;
+    }
+
+    public static int encodeMaxMinorVersion(int major) {
+        int version = 0;
+        version |= (major << Byte.SIZE * 2);
+        version |= 0xFFFF;
+        return version;
+    }
+
+    public static int encodeMinMinorVersion(int major) {
+        int version = 0;
+        version |= (major << Byte.SIZE * 2);
+        return version;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
index 55695ff..d4a4d68 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
@@ -33,8 +33,6 @@ import org.apache.hadoop.hbase.Stoppable;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-
-import com.google.common.collect.Multimap;
 import org.apache.phoenix.hbase.index.exception.SingleIndexWriteFailureException;
 import org.apache.phoenix.hbase.index.parallel.EarlyExitFailure;
 import org.apache.phoenix.hbase.index.parallel.QuickFailingTaskRunner;
@@ -45,6 +43,9 @@ import org.apache.phoenix.hbase.index.parallel.ThreadPoolManager;
 import org.apache.phoenix.hbase.index.table.CachingHTableFactory;
 import org.apache.phoenix.hbase.index.table.HTableFactory;
 import org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
+
+import com.google.common.collect.Multimap;
 
 /**
  * Write index updates to the index tables in parallel. We attempt to early exit from the
writes if
@@ -67,6 +68,7 @@ public class ParallelWriterIndexCommitter implements IndexCommitter {
   private HTableFactory factory;
   private Stoppable stopped;
   private QuickFailingTaskRunner pool;
+  private KeyValueBuilder kvBuilder;
 
   @Override
   public void setup(IndexWriter parent, RegionCoprocessorEnvironment env, String name) {
@@ -78,6 +80,7 @@ public class ParallelWriterIndexCommitter implements IndexCommitter {
             DEFAULT_CONCURRENT_INDEX_WRITER_THREADS).
           setCoreTimeout(INDEX_WRITER_KEEP_ALIVE_TIME_CONF_KEY), env),
       env.getRegionServerServices(), parent, CachingHTableFactory.getCacheSize(conf));
+    this.kvBuilder = KeyValueBuilder.get(env.getHBaseVersion());
   }
 
   /**
@@ -111,7 +114,7 @@ public class ParallelWriterIndexCommitter implements IndexCommitter {
     for (Entry<HTableInterfaceReference, Collection<Mutation>> entry : entries)
{
       // get the mutations for each table. We leak the implementation here a little bit to
save
       // doing a complete copy over of all the index update for each table.
-      final List<Mutation> mutations = (List<Mutation>) entry.getValue();
+      final List<Mutation> mutations = kvBuilder.cloneIfNecessary((List<Mutation>)
entry.getValue());
       final HTableInterfaceReference tableReference = entry.getKey();
       /*
        * Write a batch of index updates to an index table. This operation stops (is cancelable)
via

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index e3d7588..ffda55d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -39,10 +39,10 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.hbase.index.ValueGetter;
 import org.apache.phoenix.hbase.index.covered.update.ColumnReference;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PColumnFamily;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMetaDataCacheFactory.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMetaDataCacheFactory.java
b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMetaDataCacheFactory.java
index b950704..488db44 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMetaDataCacheFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMetaDataCacheFactory.java
@@ -25,10 +25,9 @@ import java.sql.SQLException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-
 import org.apache.phoenix.cache.IndexMetaDataCache;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
 import org.apache.phoenix.coprocessor.ServerCachingProtocol.ServerCacheFactory;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.memory.MemoryManager.MemoryChunk;
 
 public class IndexMetaDataCacheFactory implements ServerCacheFactory {

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexCodec.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexCodec.java
index d184c46..7fb0add 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexCodec.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexCodec.java
@@ -34,8 +34,6 @@ import org.apache.phoenix.cache.GlobalCache;
 import org.apache.phoenix.cache.IndexMetaDataCache;
 import org.apache.phoenix.cache.ServerCacheClient;
 import org.apache.phoenix.cache.TenantCache;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.hbase.index.ValueGetter;
@@ -45,6 +43,7 @@ import org.apache.phoenix.hbase.index.covered.TableState;
 import org.apache.phoenix.hbase.index.scanner.Scanner;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.hbase.index.write.IndexWriter;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ServerUtil;
@@ -73,7 +72,7 @@ public class PhoenixIndexCodec extends BaseIndexCodec {
             PhoenixIndexFailurePolicy.class.getName());
         // We cannot use the ClientKeyValueBuilder because when these hit the memstore
         // the memstore assmes we have a backing buffer.
-        this.kvBuilder = GenericKeyValueBuilder.INSTANCE;
+        this.kvBuilder = KeyValueBuilder.get(env.getHBaseVersion());
     }
 
     List<IndexMaintainer> getIndexMaintainers(Map<String, byte[]> attributes)
throws IOException{

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 825a0bb..e9c6272 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -51,11 +51,11 @@ import java.util.concurrent.Executor;
 import javax.annotation.Nullable;
 
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.expression.function.FunctionArgumentType;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.jdbc.PhoenixStatement.PhoenixStatementParser;
 import org.apache.phoenix.query.ConnectionQueryServices;
 import org.apache.phoenix.query.DelegateConnectionQueryServices;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/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 95cd8ea..2bfd91f 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
@@ -40,6 +40,7 @@ import org.apache.phoenix.expression.function.IndexStateNameFunction;
 import org.apache.phoenix.expression.function.SQLTableTypeFunction;
 import org.apache.phoenix.expression.function.SQLViewTypeFunction;
 import org.apache.phoenix.expression.function.SqlTypeNameFunction;
+import org.apache.phoenix.hbase.index.util.VersionUtil;
 import org.apache.phoenix.iterate.MaterializedResultIterator;
 import org.apache.phoenix.iterate.ResultIterator;
 import org.apache.phoenix.parse.HintNode.Hint;
@@ -55,7 +56,6 @@ import org.apache.phoenix.schema.tuple.SingleKeyValueTuple;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.KeyValueUtil;
-import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.SchemaUtil;
 
 import com.google.common.collect.Lists;
@@ -208,11 +208,11 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho
     private final ResultSet emptyResultSet;
 
     // Version below which we should turn off essential column family.
-    public static final int ESSENTIAL_FAMILY_VERSION_THRESHOLD = MetaDataUtil.encodeVersion("0",
"94", "7");
+    public static final int ESSENTIAL_FAMILY_VERSION_THRESHOLD = VersionUtil.encodeVersion("0",
"94", "7");
     // Version below which we should disallow usage of mutable secondary indexing.
-    public static final int MUTABLE_SI_VERSION_THRESHOLD = MetaDataUtil.encodeVersion("0",
"94", "10");
+    public static final int MUTABLE_SI_VERSION_THRESHOLD = VersionUtil.encodeVersion("0",
"94", "10");
     /** Version below which we fall back on the generic KeyValueBuilder */
-    public static final int CLIENT_KEY_VALUE_BUILDER_THRESHOLD = MetaDataUtil.encodeVersion("0",
"94", "14");
+    public static final int CLIENT_KEY_VALUE_BUILDER_THRESHOLD = VersionUtil.encodeVersion("0",
"94", "14");
 
     PhoenixDatabaseMetaData(PhoenixConnection connection) throws SQLException {
         this.emptyResultSet = new PhoenixResultSet(ResultIterator.EMPTY_ITERATOR, RowProjector.EMPTY_PROJECTOR,
new PhoenixStatement(connection));

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServices.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServices.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServices.java
index 4d05008..e0ee7f2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServices.java
@@ -29,10 +29,10 @@ import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Pair;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
 import org.apache.phoenix.execute.MutationState;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PTable;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index a7e7eed..5dfb7c7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -90,7 +90,6 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -108,6 +107,7 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.hbase.index.Indexer;
 import org.apache.phoenix.hbase.index.covered.CoveredColumnsIndexBuilder;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.index.PhoenixIndexBuilder;
 import org.apache.phoenix.index.PhoenixIndexCodec;
 import org.apache.phoenix.jdbc.PhoenixConnection;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 4c2e382..f95bdc5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@ -35,8 +35,6 @@ import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.util.VersionInfo;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
@@ -44,6 +42,8 @@ import org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.execute.MutationState;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.schema.NewerTableAlreadyExistsException;
@@ -87,9 +87,8 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices
imple
     public ConnectionlessQueryServicesImpl(QueryServices queryServices) {
         super(queryServices);
         metaData = newEmptyMetaData();
-        // find the HBase version and use that to determine the KeyValueBuilder that should
be used
-        String hbaseVersion = VersionInfo.getVersion();
-        this.kvBuilder = KeyValueBuilder.get(hbaseVersion);
+        // Use KeyValueBuilder that builds real KeyValues, as our test utils require this
+        this.kvBuilder = GenericKeyValueBuilder.INSTANCE;
     }
 
     private PMetaData newEmptyMetaData() {

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/query/DelegateConnectionQueryServices.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/DelegateConnectionQueryServices.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/DelegateConnectionQueryServices.java
index 4a943c8..06b508d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/DelegateConnectionQueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/DelegateConnectionQueryServices.java
@@ -29,10 +29,10 @@ import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Pair;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
 import org.apache.phoenix.execute.MutationState;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PMetaData;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
index dae93a2..0af04da 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
@@ -22,7 +22,7 @@ import java.util.List;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.Writable;
-import org.apache.phoenix.client.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.schema.stat.PTableStats;
 

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index 37301ae..94fda52 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -17,8 +17,8 @@
  */
 package org.apache.phoenix.schema;
 
-import static org.apache.phoenix.client.KeyValueBuilder.addQuietly;
-import static org.apache.phoenix.client.KeyValueBuilder.deleteQuietly;
+import static org.apache.phoenix.hbase.index.util.KeyValueBuilder.addQuietly;
+import static org.apache.phoenix.hbase.index.util.KeyValueBuilder.deleteQuietly;
 import static org.apache.phoenix.query.QueryConstants.SEPARATOR_BYTE;
 import static org.apache.phoenix.schema.SaltingUtil.SALTING_COLUMN;
 
@@ -41,8 +41,8 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.RowKeySchema.RowKeySchemaBuilder;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
index bd2f390..7380d1d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/MultiKeyValueTuple.java
@@ -21,7 +21,7 @@ import java.util.List;
 
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.util.KeyValueUtil;
 
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/ResultTuple.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/ResultTuple.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/ResultTuple.java
index ec8d061..02aebf7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/ResultTuple.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/tuple/ResultTuple.java
@@ -21,7 +21,7 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.util.KeyValueUtil;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
index e2121b9..58b2465 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
@@ -27,12 +27,12 @@ import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.hbase.index.ValueGetter;
 import org.apache.phoenix.hbase.index.covered.update.ColumnReference;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.ColumnFamilyNotFoundException;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
index 51bd373..d54aaea 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/KeyValueUtil.java
@@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.KeyValue.KVComparator;
 import org.apache.hadoop.hbase.KeyValue.Type;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.client.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
index 47fc56b..438477b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
@@ -29,10 +29,11 @@ import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.client.ClientKeyValue;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.hbase.index.util.ClientKeyValue;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.VersionUtil;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryConstants;
@@ -65,7 +66,7 @@ public class MetaDataUtil {
         // A server and client with the same major and minor version number must be compatible.
         // So it's important that we roll the PHOENIX_MAJOR_VERSION or PHOENIX_MINOR_VERSION
         // when we make an incompatible change.
-        return MetaDataUtil.encodeMaxMinorVersion(pMajor) >= version && MetaDataUtil.encodeMinMinorVersion(pMajor)
<= version;
+        return VersionUtil.encodeMaxMinorVersion(pMajor) >= version && VersionUtil.encodeMinMinorVersion(pMajor)
<= version;
     }
 
     // Given the encoded integer representing the phoenix version in the encoded version
value.
@@ -102,63 +103,11 @@ public class MetaDataUtil {
     }
 
     public static long encodeHBaseAndPhoenixVersions(String hbaseVersion) {
-        return (((long) encodeVersion(hbaseVersion)) << (Byte.SIZE * 5)) |
-                (((long) encodeVersion(MetaDataProtocol.PHOENIX_MAJOR_VERSION, MetaDataProtocol.PHOENIX_MINOR_VERSION,
+        return (((long) VersionUtil.encodeVersion(hbaseVersion)) << (Byte.SIZE * 5))
|
+                (((long) VersionUtil.encodeVersion(MetaDataProtocol.PHOENIX_MAJOR_VERSION,
MetaDataProtocol.PHOENIX_MINOR_VERSION,
                         MetaDataProtocol.PHOENIX_PATCH_NUMBER)) << (Byte.SIZE * 1));
     }
 
-    // Encode a version string in the format of "major.minor.patch" into an integer.
-    public static int encodeVersion(String version) {
-        String[] versionParts = splitHBaseVersionString(version);
-        return encodeVersion(versionParts[0], versionParts.length > 1 ? versionParts[1]
: null, versionParts.length > 2 ? versionParts[2] : null);
-    }
-
-    public static String[] splitHBaseVersionString(String version) {
-        return version.split("[-\\.]");
-    }
-
-    // Encode the major as 2nd byte in the int, minor as the first byte and patch as the
last byte.
-    public static int encodeVersion(String major, String minor, String patch) {
-        return encodeVersion(major == null ? 0 : Integer.parseInt(major), minor == null ?
0 : Integer.parseInt(minor), 
-                        patch == null ? 0 : Integer.parseInt(patch));
-    }
-
-    public static int encodeVersion(int major, int minor, int patch) {
-        int version = 0;
-        version |= (major << Byte.SIZE * 2);
-        version |= (minor << Byte.SIZE);
-        version |= patch;
-        return version;
-    }
-
-    public static int encodeMaxPatchVersion(int major, int minor) {
-        int version = 0;
-        version |= (major << Byte.SIZE * 2);
-        version |= (minor << Byte.SIZE);
-        version |= 0xFF;
-        return version;
-    }
-
-    public static int encodeMinPatchVersion(int major, int minor) {
-        int version = 0;
-        version |= (major << Byte.SIZE * 2);
-        version |= (minor << Byte.SIZE);
-        return version;
-    }
-
-    public static int encodeMaxMinorVersion(int major) {
-        int version = 0;
-        version |= (major << Byte.SIZE * 2);
-        version |= 0xFFFF;
-        return version;
-    }
-
-    public static int encodeMinMinorVersion(int major) {
-        int version = 0;
-        version |= (major << Byte.SIZE * 2);
-        return version;
-    }
-
     public static void getTenantIdAndSchemaAndTableName(List<Mutation> tableMetadata,
byte[][] rowKeyMetaData) {
         Mutation m = getTableHeaderRow(tableMetadata);
         getVarChars(m.getRow(), 3, rowKeyMetaData);

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValue.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValue.java
b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValue.java
index ff4ecba..02e06c7 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValue.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValue.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.hbase.index.util.ClientKeyValue;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
index 5a4dfd4..b6e2853 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/client/TestClientKeyValueLocal.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.DataOutputBuffer;
+import org.apache.phoenix.hbase.index.util.ClientKeyValue;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
b/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
index df17cf3..42cfd12 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/end2end/index/IndexTestUtil.java
@@ -40,7 +40,8 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 
 import com.google.common.collect.Lists;
-import org.apache.phoenix.client.KeyValueBuilder;
+
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.ColumnNotFoundException;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/test/java/org/apache/phoenix/index/IndexMaintainerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/index/IndexMaintainerTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/index/IndexMaintainerTest.java
index aba2d76..8adf9fa 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/index/IndexMaintainerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/index/IndexMaintainerTest.java
@@ -38,13 +38,13 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
-import org.apache.phoenix.client.ClientKeyValueBuilder;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
-import org.apache.phoenix.client.KeyValueBuilder;
 import org.apache.phoenix.end2end.index.IndexTestUtil;
 import org.apache.phoenix.hbase.index.ValueGetter;
 import org.apache.phoenix.hbase.index.covered.update.ColumnReference;
+import org.apache.phoenix.hbase.index.util.ClientKeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.BaseConnectionlessQueryTest;
 import org.apache.phoenix.schema.PTable;

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/4ca3cae0/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java b/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java
index caacd57..2f7c6cd 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java
@@ -24,10 +24,11 @@ import static org.junit.Assert.assertTrue;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.client.ClientKeyValueBuilder;
-import org.apache.phoenix.client.GenericKeyValueBuilder;
-import org.apache.phoenix.client.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.ClientKeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
+import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.util.VersionUtil;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.junit.Test;
 
@@ -36,22 +37,22 @@ public class MetaDataUtilTest {
 
     @Test
     public void testEncode() {
-        assertEquals(MetaDataUtil.encodeVersion("0.94.5"),MetaDataUtil.encodeVersion("0.94.5-mapR"));
-        assertTrue(MetaDataUtil.encodeVersion("0.94.6")>MetaDataUtil.encodeVersion("0.94.5-mapR"));
-        assertTrue(MetaDataUtil.encodeVersion("0.94.6")>MetaDataUtil.encodeVersion("0.94.5"));
-        assertTrue(MetaDataUtil.encodeVersion("0.94.1-mapR")>MetaDataUtil.encodeVersion("0.94"));
+        assertEquals(VersionUtil.encodeVersion("0.94.5"),VersionUtil.encodeVersion("0.94.5-mapR"));
+        assertTrue(VersionUtil.encodeVersion("0.94.6")>VersionUtil.encodeVersion("0.94.5-mapR"));
+        assertTrue(VersionUtil.encodeVersion("0.94.6")>VersionUtil.encodeVersion("0.94.5"));
+        assertTrue(VersionUtil.encodeVersion("0.94.1-mapR")>VersionUtil.encodeVersion("0.94"));
     }
     
     @Test
     public void testCompatibility() {
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(1,2,1),
1));
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(1,2,10),
1));
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(1,2,0),
1));
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(1,2,255),
1));
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(2,2,0),
2));
-        assertTrue(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(2,10,36),
2));
-        assertFalse(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(3,1,10),
4));
-        assertFalse(MetaDataUtil.areClientAndServerCompatible(MetaDataUtil.encodeVersion(3,1,10),
2));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(1,2,1),
1));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(1,2,10),
1));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(1,2,0),
1));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(1,2,255),
1));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(2,2,0),
2));
+        assertTrue(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(2,10,36),
2));
+        assertFalse(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(3,1,10),
4));
+        assertFalse(MetaDataUtil.areClientAndServerCompatible(VersionUtil.encodeVersion(3,1,10),
2));
     }
 
   /**


Mime
View raw message