PHOENIX-2535 Create shaded clients (thin + thick)

Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3f7e1c46
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3f7e1c46
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3f7e1c46

Branch: refs/heads/4.x-HBase-1.1
Commit: 3f7e1c46fcfea5cf3a9ced58ebe3a70b6b481506
Parents: faeb8f7
Author: Sergey Soldatov <s...@apache.org>
Authored: Wed Jun 15 12:57:59 2016 -0700
Committer: Sergey Soldatov <s...@apache.org>
Committed: Wed Jun 15 14:08:35 2016 -0700

----------------------------------------------------------------------
 bin/log4j.properties                            |   2 +-
 bin/phoenix_utils.py                            |  12 +-
 bin/queryserver.py                              |   2 +-
 bin/tephra                                      |   4 +-
 phoenix-assembly/pom.xml                        |  89 +----
 phoenix-assembly/src/build/client-minimal.xml   |  38 --
 phoenix-assembly/src/build/client-spark.xml     |  74 ----
 .../src/build/client-without-hbase.xml          |  40 --
 phoenix-assembly/src/build/client.xml           |  98 -----
 .../src/build/components-major-client.xml       |  57 ---
 .../src/build/components-minimal.xml            |  77 ----
 .../src/build/components/all-common-jars.xml    |  42 +-
 phoenix-assembly/src/build/server.xml           |  53 ---
 phoenix-client/pom.xml                          | 381 +++++++++++++++++++
 .../phoenix/query/QueryServicesOptions.java     |   2 +-
 phoenix-hive/pom.xml                            |   4 +
 phoenix-queryserver-client/pom.xml              | 143 +++++++
 .../phoenix/queryserver/client/Driver.java      |  49 +++
 .../queryserver/client/ThinClientUtil.java      |  42 ++
 .../resources/META-INF/services/java.sql.Driver |   1 +
 .../org-apache-phoenix-remote-jdbc.properties   |  25 ++
 phoenix-queryserver/pom.xml                     | 149 ++++++++
 .../src/build/query-server-runnable.xml         |  52 +++
 .../phoenix/end2end/QueryServerBasicsIT.java    | 164 ++++++++
 .../phoenix/end2end/QueryServerThread.java      |  45 +++
 .../src/it/resources/log4j.properties           |  63 +++
 .../apache/phoenix/queryserver/server/Main.java | 236 ++++++++++++
 .../queryserver/server/PhoenixMetaFactory.java  |  28 ++
 .../server/PhoenixMetaFactoryImpl.java          |  76 ++++
 .../apache/phoenix/DriverCohabitationTest.java  |  65 ++++
 phoenix-server-client/pom.xml                   |  66 ----
 phoenix-server-client/src/build/thin-client.xml |  49 ---
 .../phoenix/queryserver/client/Driver.java      |  49 ---
 .../queryserver/client/ThinClientUtil.java      |  42 --
 .../resources/META-INF/services/java.sql.Driver |   1 -
 .../org-apache-phoenix-remote-jdbc.properties   |  25 --
 phoenix-server/pom.xml                          | 184 +++++----
 .../src/build/query-server-runnable.xml         |  52 ---
 .../phoenix/end2end/QueryServerBasicsIT.java    | 164 --------
 .../phoenix/end2end/QueryServerThread.java      |  45 ---
 .../src/it/resources/log4j.properties           |  63 ---
 .../apache/phoenix/queryserver/server/Main.java | 236 ------------
 .../queryserver/server/PhoenixMetaFactory.java  |  28 --
 .../server/PhoenixMetaFactoryImpl.java          |  76 ----
 .../apache/phoenix/DriverCohabitationTest.java  |  65 ----
 pom.xml                                         |  20 +-
 46 files changed, 1722 insertions(+), 1556 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/bin/log4j.properties
----------------------------------------------------------------------
diff --git a/bin/log4j.properties b/bin/log4j.properties
index 3f7760a..2d007e1 100644
--- a/bin/log4j.properties
+++ b/bin/log4j.properties
@@ -28,7 +28,7 @@ hadoop.log.dir=.
 # Define the root logger to the system property "plsql.root.logger".
 log4j.rootLogger=${psql.root.logger}
 
-# Logging Threshold to INFO for query-server. root logger still at WARN for 
sqlline clients.
+# Logging Threshold to INFO for queryserver. root logger still at WARN for 
sqlline clients.
 log4j.threshold=INFO
 
 #

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/bin/phoenix_utils.py
----------------------------------------------------------------------
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 6b00d5f..2da094f 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -70,7 +70,7 @@ def findClasspath(command_name):
 def setPath():
     PHOENIX_CLIENT_JAR_PATTERN = "phoenix-*-client.jar"
     PHOENIX_THIN_CLIENT_JAR_PATTERN = "phoenix-*-thin-client.jar"
-    PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-server-*-runnable.jar"
+    PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-*-queryserver.jar"
     PHOENIX_TRACESERVER_JAR_PATTERN = "phoenix-tracing-webapp-*-runnable.jar"
     PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-tests*.jar"
     PHOENIX_PHERF_JAR_PATTERN = "phoenix-pherf-*-minimal*.jar"
@@ -107,7 +107,7 @@ def setPath():
         pherf_conf_path = os.path.join(current_dir, "..", "phoenix-pherf", 
"config")
 
     global phoenix_jar_path
-    phoenix_jar_path = os.path.join(current_dir, "..", "phoenix-assembly", 
"target","*")
+    phoenix_jar_path = os.path.join(current_dir, "..", "phoenix-client", 
"target","*")
 
     global phoenix_client_jar
     phoenix_client_jar = find("phoenix-*-client.jar", phoenix_jar_path)
@@ -137,13 +137,13 @@ def setPath():
         hadoop_classpath = os.getenv('HADOOP_CLASSPATH', '')
 
     global hadoop_common_jar_path
-    hadoop_common_jar_path = os.path.join(current_dir, "..", 
"phoenix-assembly", "target","*")
+    hadoop_common_jar_path = os.path.join(current_dir, "..", "phoenix-client", 
"target","*")
 
     global hadoop_common_jar
     hadoop_common_jar = find("hadoop-common*.jar", hadoop_common_jar_path)
 
     global hadoop_hdfs_jar_path
-    hadoop_hdfs_jar_path = os.path.join(current_dir, "..", "phoenix-assembly", 
"target","*")
+    hadoop_hdfs_jar_path = os.path.join(current_dir, "..", "phoenix-client", 
"target","*")
 
     global hadoop_hdfs_jar
     hadoop_hdfs_jar = find("hadoop-hdfs*.jar", hadoop_hdfs_jar_path)
@@ -156,7 +156,7 @@ def setPath():
         testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_class_path)
 
     global phoenix_queryserver_jar
-    phoenix_queryserver_jar = find(PHOENIX_QUERYSERVER_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-server", "target", "*"))
+    phoenix_queryserver_jar = find(PHOENIX_QUERYSERVER_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-queryserver", "target", "*"))
     if phoenix_queryserver_jar == "":
         phoenix_queryserver_jar = 
findFileInPathWithoutRecursion(PHOENIX_QUERYSERVER_JAR_PATTERN, 
os.path.join(current_dir, "..", "lib"))
     if phoenix_queryserver_jar == "":
@@ -177,7 +177,7 @@ def setPath():
         phoenix_pherf_jar = 
findFileInPathWithoutRecursion(PHOENIX_PHERF_JAR_PATTERN, 
os.path.join(current_dir, ".."))
 
     global phoenix_thin_client_jar
-    phoenix_thin_client_jar = find(PHOENIX_THIN_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-server-client", "target", "*"))
+    phoenix_thin_client_jar = find(PHOENIX_THIN_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-queryserver-client", "target", "*"))
     if phoenix_thin_client_jar == "":
         phoenix_thin_client_jar = 
findFileInPathWithoutRecursion(PHOENIX_THIN_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, ".."))
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/bin/queryserver.py
----------------------------------------------------------------------
diff --git a/bin/queryserver.py b/bin/queryserver.py
index 57ca371..1048adb 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -119,7 +119,7 @@ out_file_path = os.path.join(log_dir, phoenix_out_file)
 
 # The command is run through subprocess so environment variables are 
automatically inherited
 java_cmd = '%(java)s -cp ' + hbase_config_path + os.pathsep + 
hadoop_config_path + os.pathsep + \
-    phoenix_utils.phoenix_queryserver_jar + os.pathsep + 
phoenix_utils.phoenix_client_jar + \
+    phoenix_utils.phoenix_client_jar + os.pathsep + 
phoenix_utils.phoenix_queryserver_jar  + \
     " -Dproc_phoenixserver" + \
     " -Dlog4j.configuration=file:" + os.path.join(phoenix_utils.current_dir, 
"log4j.properties") + \
     " -Dpsql.root.logger=%(root_logger)s" + \

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/bin/tephra
----------------------------------------------------------------------
diff --git a/bin/tephra b/bin/tephra
index e71ffd7..d77d33f 100755
--- a/bin/tephra
+++ b/bin/tephra
@@ -91,11 +91,11 @@ set_classpath()
   export HBASE_CP
 
   if [ -n "$HBASE_CP" ]; then
-    CP=$COMP_HOME/phoenix-assembly/target/*:$HBASE_CP:$EXTRA_CLASSPATH
+    CP=$COMP_HOME/phoenix-client/target/*:$HBASE_CP:$EXTRA_CLASSPATH
   else
     # assume Hadoop/HBase libs are included via EXTRA_CLASSPATH
     echo "WARN: could not find Hadoop and HBase libraries"
-    CP=$COMP_HOME/phoenix-assembly/target/*:$EXTRA_CLASSPATH
+    CP=$COMP_HOME/phoenix-client/target/*:$EXTRA_CLASSPATH
   fi
 
   # Setup classpaths.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 3e3e097..8b152be 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -20,7 +20,8 @@
 
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <parent>
@@ -35,72 +36,27 @@
 
   <properties>
     <top.dir>${project.basedir}/..</top.dir>
+    <maven.test.skip>true</maven.test.skip>
+    <source.skip>true</source.skip>
   </properties>
 
   <build>
     <plugins>
+      <!-- No jars created for this module -->
       <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>
-            <id>client</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-            <configuration>
-              <attach>false</attach>
-              <finalName>phoenix-${project.version}</finalName>
-              <archive>
-                <index>true</index>
-                <manifest>
-                  <addClasspath>true</addClasspath>
-                  
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-                  
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
-                </manifest>
-              </archive>
-              <descriptors>
-                <descriptor>src/build/client.xml</descriptor>
-              </descriptors>
-            </configuration>
-          </execution>
-          <!-- Due to SPARK-8332 and Calcite's fasterxml dependency, we need a 
custom spark client -->
-          <execution>
-            <id>client-spark</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-            <configuration>
-              <finalName>phoenix-${project.version}</finalName>
-              <attach>false</attach>
-              <appendAssemblyId>true</appendAssemblyId>
-              <descriptors>
-                <!-- build the phoenix spark client jar -->
-                <descriptor>src/build/client-spark.xml</descriptor>
-              </descriptors>
-            </configuration>
-          </execution>
-          <execution>
-            <id>client-minimal</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-            <configuration>
-            <finalName>phoenix-${project.version}</finalName>
-              <attach>false</attach>
-              <appendAssemblyId>true</appendAssemblyId>
-              <descriptors>
-               <!--build the phoenix client jar, but without HBase code. -->
-                <descriptor>src/build/client-without-hbase.xml</descriptor>
-               <!-- build the phoenix client jar, but without HBase (or its 
depenencies). -->
-                <descriptor>src/build/client-minimal.xml</descriptor>
-               <!-- build the phoenix server side jar, that includes 
phoenix-hadoopX-compat, phoenix-hadoop-compat and antlr -->
-                <descriptor>src/build/server.xml</descriptor>
-              </descriptors>
-            </configuration>
+            <id>default-jar</id>
+            <phase>none</phase>
+            <goals/>
           </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
           <execution>
             <id>package-to-tar</id>
             <phase>package</phase>
@@ -137,17 +93,6 @@
           </execution>
         </executions>
       </plugin>
-      <!-- No jars created for this module -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>prepare-package</phase>
-            <goals />
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 
@@ -171,11 +116,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.phoenix</groupId>
-      <artifactId>phoenix-server</artifactId>
+      <artifactId>phoenix-queryserver</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.phoenix</groupId>
-      <artifactId>phoenix-server-client</artifactId>
+      <artifactId>phoenix-queryserver-client</artifactId>
     </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/client-minimal.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/client-minimal.xml 
b/phoenix-assembly/src/build/client-minimal.xml
deleted file mode 100644
index 1cda711..0000000
--- a/phoenix-assembly/src/build/client-minimal.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
-  <!-- Often clients want to use Phoenix in an existing HBase environment 
(they have 
-    their own HBase version already built), so the standard HBase jar 
shouldn't be included 
-    (as with the regular client jar) as it will conflict the installed 
version. This 
-    profile does the same thing as the client.xml build, but excludes the 
hbase stuff. -->
-  <id>client-minimal</id>
-  <formats>
-    <format>jar</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-  <componentDescriptors>
-    <componentDescriptor>src/build/components-minimal.xml</componentDescriptor>
-  </componentDescriptors>
-</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/client-spark.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/client-spark.xml 
b/phoenix-assembly/src/build/client-spark.xml
deleted file mode 100644
index 93d02ff..0000000
--- a/phoenix-assembly/src/build/client-spark.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<!-- Due to SPARK-8332 and Calcite's fasterxml dependency, we need a custom 
spark client -->
-<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
-  <id>client-spark</id>
-  <!-- All the dependencies (unpacked) necessary to run phoenix from a single, 
stand-alone jar -->
-  <formats>
-    <format>jar</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-
-  <componentDescriptors>
-    <componentDescriptor>src/build/components-minimal.xml</componentDescriptor>
-  </componentDescriptors>
-
-  <dependencySets>
-    <dependencySet>
-      <!-- Unpack all the dependencies to class files, since java doesn't 
support
-        jar of jars for running -->
-      <unpack>true</unpack>
-      <!-- save these dependencies to the top-level -->
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>org.apache.hbase:hbase*</include>
-        <include>org.apache.htrace:htrace-core</include>
-        <include>io.netty:netty-all</include>
-        <include>commons-codec:commons-codec</include>
-        <include>org.apache.tephra:tephra*</include>
-        <include>org.apache.twill:twill*</include>
-        <include>com.google.code.gson:gson*</include>
-        <!-- We use a newer version of guava than HBase - this might be an 
issue? -->
-        <include>com.google.guava:guava</include>
-        <!-- HBase also pulls in these dependencies on its own, should we 
include-them? -->
-        <include>com.google.protobuf:protobuf-java</include>
-        <include>org.slf4j:slf4j-api</include>
-        <include>org.apache.zookeeper:zookeeper</include>
-        <include>log4j:log4j</include>
-        <include>org.apache.hadoop:hadoop*</include>
-        <include>commons-configuration:commons-configuration</include>
-        <include>commons-io:commons-io</include>
-        <include>commons-logging:commons-logging</include>
-        <include>commons-lang:commons-lang</include>
-        <include>commons-cli:commons-cli</include>
-        <include>org.apache.commons:commons-csv</include>
-        <include>commons-collections:commons-collections</include>
-        <include>joda-time:joda-time</include>
-        <include>org.jruby.joni:joni</include>
-        <include>org.jruby.jcodings:jcodings</include>
-      </includes>
-    </dependencySet>
-  </dependencySets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/client-without-hbase.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/client-without-hbase.xml 
b/phoenix-assembly/src/build/client-without-hbase.xml
deleted file mode 100644
index ac84762..0000000
--- a/phoenix-assembly/src/build/client-without-hbase.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
-  <!-- Often clients want to use Phoenix in an existing HBase environment 
(they have 
-    their own HBase version already built), so the standard HBase jar 
shouldn't be included 
-    (as with the regular client jar) as it will conflict the installed 
version. This 
-    profile does the same thing as the client.xml build, but excludes the 
hbase stuff. -->
-  <id>client-without-hbase</id>
-  <formats>
-    <format>jar</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-
-  <componentDescriptors>
-    <componentDescriptor>src/build/components-minimal.xml</componentDescriptor>
-    
<componentDescriptor>src/build/components-major-client.xml</componentDescriptor>
-  </componentDescriptors>
-</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/client.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/client.xml 
b/phoenix-assembly/src/build/client.xml
deleted file mode 100644
index f9c2415..0000000
--- a/phoenix-assembly/src/build/client.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
-  <id>client</id>
-  <!-- All the dependencies (unpacked) necessary to run phoenix from a single, 
stand-alone jar -->
-  <formats>
-    <format>jar</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-
-  <containerDescriptorHandlers>
-    <containerDescriptorHandler>
-      <!--
-          aggregate SPI's so that things like HDFS FileSystem works in uberjar
-          http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html
-      -->
-      <handlerName>metaInf-services</handlerName>
-    </containerDescriptorHandler>
-  </containerDescriptorHandlers>
-  
-  <componentDescriptors>
-    <componentDescriptor>src/build/components-minimal.xml</componentDescriptor>
-    
<componentDescriptor>src/build/components-major-client.xml</componentDescriptor>
-  </componentDescriptors>
-
-  <dependencySets>
-    <dependencySet>
-      <!-- Unpack all the dependencies to class files, since java doesn't 
support 
-        jar of jars for running -->
-      <unpack>true</unpack>
-      <!-- save these dependencies to the top-level -->
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>jline:jline</include>
-        <include>sqlline:sqlline</include>
-        <include>org.apache.hbase:hbase*</include>
-        <include>org.apache.htrace:htrace-core</include>
-        <include>io.netty:netty-all</include>
-        <include>commons-codec:commons-codec</include>
-        <include>org.apache.tephra:tephra*</include>
-        <include>org.apache.twill:twill*</include>
-        <include>org.apache.thrift:*</include>
-        <include>com.google.code.gson:gson*</include>
-      </includes>
-    </dependencySet>
-
-    <!-- Make sure we get all the components, not just the minimal client ones 
(e.g.
-      phoenix-flume, phoenix-pig, etc). We should exclude phoenix-server and
-      phoenix-server-client in the future, see PHOENIX-2032, PHOENIX-2038 -->
-    <dependencySet>
-      <outputDirectory>/</outputDirectory>
-      <unpack>true</unpack>
-      <!-- multiple deps provide some variant of LICENSE files/directories. 
These
-           overwrite each other at best, at worst conflict on case-insensitive
-           filesystems like HDFS+ and FAT32. Just exclude them -->
-      <unpackOptions>
-        <excludes>
-          <exclude>*license*</exclude>
-          <exclude>*LICENSE*</exclude>
-          <exclude>**/license/**</exclude>
-          <exclude>**/LICENSE/**</exclude>
-        </excludes>
-      </unpackOptions>
-      <!-- this is default, but make intentions clear -->
-      <useTransitiveDependencies>true</useTransitiveDependencies>
-      <!-- "When <include> subelements are present, they define a set of
-           artifact coordinates to include. If none is present, then <includes>
-           represents all valid values"
-           
https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet
-           This means bring in all dependencies transitively of the
-           phoenix-assembly module.
-      -->
-      <includes />
-    </dependencySet>
-  </dependencySets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/components-major-client.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/components-major-client.xml 
b/phoenix-assembly/src/build/components-major-client.xml
deleted file mode 100644
index 7a2909b..0000000
--- a/phoenix-assembly/src/build/components-major-client.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<component>
-  <!-- Components that the client needs (except for HBase) -->
-  <dependencySets>
-    <dependencySet>
-      <!-- Unpack all the dependencies to class files, since java doesn't 
support 
-        jar of jars for running -->
-      <unpack>true</unpack>
-      <!-- save these dependencies to the top-level -->
-      <outputDirectory>/</outputDirectory>
-      <!-- Maybe a blacklist is easier? -->
-      <includes>
-        <!-- We use a newer version of guava than HBase - this might be an 
issue? -->
-        <include>com.google.guava:guava</include>
-        <!-- HBase also pulls in these dependencies on its own, should we 
include-them? -->
-        <include>com.google.protobuf:protobuf-java</include>
-        <include>org.slf4j:slf4j-api</include>
-        <include>org.apache.zookeeper:zookeeper</include>
-        <include>log4j:log4j</include>
-        <include>org.apache.hadoop:hadoop*</include>
-        <include>commons-configuration:commons-configuration</include>
-        <include>commons-io:commons-io</include>
-        <include>commons-logging:commons-logging</include>
-        <include>commons-lang:commons-lang</include>
-        <include>commons-cli:commons-cli</include>
-        <include>org.apache.commons:commons-csv</include>
-        <include>org.codehaus.jackson:jackson-mapper-asl</include>
-        <include>org.codehaus.jackson:jackson-core-asl</include>
-        <include>commons-collections:commons-collections</include>
-        <include>joda-time:joda-time</include>
-        <include>org.jruby.joni:joni</include>
-        <include>org.jruby.jcodings:jcodings</include>
-      </includes>
-    </dependencySet>
-  </dependencySets>
-</component>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/components-minimal.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/components-minimal.xml 
b/phoenix-assembly/src/build/components-minimal.xml
deleted file mode 100644
index a3d1304..0000000
--- a/phoenix-assembly/src/build/components-minimal.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<component>
-  <!-- Just the basic components that Phoenix pulls in, that is not a 
transitive dependency from Hadoop/HBase/Pig -->
-  <dependencySets>
-    <dependencySet>
-      <!-- Unpack all the dependencies to class files, since java doesn't 
support 
-        jar of jars for running -->
-      <unpack>true</unpack>
-      <!-- save these dependencies to the top-level -->
-      <outputDirectory>/</outputDirectory>
-      <!-- Just include the extra things that phoenix needs -->
-      <includes>
-        <include>org.antlr:antlr*</include>
-      </includes>
-    </dependencySet>
-
-    <dependencySet>
-      <outputDirectory>/</outputDirectory>
-      <unpack>true</unpack>
-      <includes>
-        <include>org.apache.phoenix:phoenix-*</include>
-        <include>org.iq80.snappy:snappy</include>
-      </includes>
-      <excludes>
-        <exclude>org.apache.phoenix:phoenix-flume</exclude>
-        <exclude>org.apache.phoenix:phoenix-pig</exclude>
-        <exclude>org.apache.phoenix:phoenix-server</exclude>
-        <exclude>org.apache.phoenix:phoenix-server-client</exclude>
-      </excludes>
-    </dependencySet>
-  </dependencySets>
-
-  <fileSets>
-    <fileSet>
-      <!--Get misc project files -->
-      <directory>${project.basedir}/..</directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>*.txt*</include>
-        <include>*.md</include>
-        <include>NOTICE*</include>
-      </includes>
-      <excludes>
-        <exclude>build.txt</exclude>
-      </excludes>
-    </fileSet>
-    <fileSet>
-      <!--Get map-red-config properties files -->
-      <directory>${project.basedir}/../config</directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>csv-bulk-load-config.properties</include>
-      </includes>
-    </fileSet>
-  </fileSets>
-</component>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/components/all-common-jars.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/components/all-common-jars.xml 
b/phoenix-assembly/src/build/components/all-common-jars.xml
index 960c3c9..3d334db 100644
--- a/phoenix-assembly/src/build/components/all-common-jars.xml
+++ b/phoenix-assembly/src/build/components/all-common-jars.xml
@@ -24,22 +24,44 @@
      <!-- Add the client & mapreduce jars. Expects the client jar packaging 
phase to already be run,
       which is determined by specification order in the pom. -->
     <fileSet>
-      <directory>target</directory>
+      <directory>${project.basedir}/../phoenix-client/target</directory>
       <outputDirectory>/</outputDirectory>
       <includes>
         <include>phoenix-*-client.jar</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>${project.basedir}/../phoenix-server/target</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
         <include>phoenix-*-server.jar</include>
-        <include>phoenix-*-mapreduce.jar</include>
       </includes>
     </fileSet>
     <fileSet>
-      
<directory>${project.basedir}/../phoenix-server-client/target/</directory>
+      <directory>${project.basedir}/../phoenix-queryserver/target/</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>phoenix-*-queryserver.jar</include>
+      </includes>
+      <fileMode>0644</fileMode>
+    </fileSet>
+    <fileSet>
+      
<directory>${project.basedir}/../phoenix-queryserver-client/target/</directory>
       <outputDirectory>/</outputDirectory>
       <includes>
         <include>phoenix-*-thin-client.jar</include>
       </includes>
       <fileMode>0644</fileMode>
     </fileSet>
+    <fileSet>
+      <directory>${project.basedir}/../phoenix-hive/target/</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>phoenix-*-hive.jar</include>
+      </includes>
+      <fileMode>0644</fileMode>
+    </fileSet>
+
     <!-- This is only necessary until maven fixes the intra-project dependency 
bug
       in maven 3.0. Until then, we have to include the jars for sub-projects 
explicitly.
       Otherwise, test jars are pulled in wrongly.
@@ -85,15 +107,23 @@
       <fileMode>0644</fileMode>
     </fileSet>
     <fileSet>
-      <directory>${project.basedir}/../phoenix-server/target/</directory>
+      <directory>${project.basedir}/../phoenix-queryserver/target/</directory>
       <outputDirectory>lib</outputDirectory>
       <includes>
-        <include>phoenix-*.jar</include>
+        <include>phoenix-queryserver-*.jar</include>
+      </includes>
+      <fileMode>0644</fileMode>
+    </fileSet>
+    <fileSet>
+      <directory>${project.basedir}/../phoenix-hive/target/</directory>
+      <outputDirectory>lib</outputDirectory>
+      <includes>
+        <include>phoenix-hive-*.jar</include>
       </includes>
       <fileMode>0644</fileMode>
     </fileSet>
     <fileSet>
-      
<directory>${project.basedir}/../phoenix-server-client/target/</directory>
+      
<directory>${project.basedir}/../phoenix-queryserver-client/target/</directory>
       <outputDirectory>lib</outputDirectory>
       <includes>
         <include>phoenix-*.jar</include>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-assembly/src/build/server.xml
----------------------------------------------------------------------
diff --git a/phoenix-assembly/src/build/server.xml 
b/phoenix-assembly/src/build/server.xml
deleted file mode 100644
index fe784e9..0000000
--- a/phoenix-assembly/src/build/server.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-
-<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
-  <!-- build the phoenix server side jar, that includes 
phoenix-hadoopX-compat, phoenix-hadoop-compat and antlr -->
-  <id>server</id>
-  <formats>
-    <format>jar</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-  <dependencySets>
-    <dependencySet>
-      <outputDirectory>/</outputDirectory>
-      <unpack>true</unpack>
-      <includes>
-        <include>org.apache.phoenix:phoenix-core</include>
-        <include>org.iq80.snappy:snappy</include>
-       <include>org.antlr:antlr*</include>
-        <include>org.apache.tephra:tephra*</include>
-        <include>com.google.code.gson:gson</include>
-        <include>org.jruby.joni:joni</include>
-        <include>org.jruby.jcodings:jcodings</include>
-       <include>joda-time:joda-time</include>
-       <include>org.apache.twill:twill*</include>
-       <include>com.google.inject.extensions:guice-assistedinject</include>
-       <include>it.unimi.dsi:fastutil</include>
-       <include>io.dropwizard.metrics:metrics-core</include>
-       <include>org.apache.thrift:libthrift</include>
-      </includes>
-    </dependencySet>
-  </dependencySets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-client/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml
new file mode 100644
index 0000000..593e505
--- /dev/null
+++ b/phoenix-client/pom.xml
@@ -0,0 +1,381 @@
+<?xml version='1.0'?>
+<!--
+
+ 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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.phoenix</groupId>
+    <artifactId>phoenix</artifactId>
+    <version>4.8.0-HBase-1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>phoenix-client</artifactId>
+  <name>Phoenix Client</name>
+  <description>Phoenix Client</description>
+  <packaging>jar</packaging>
+  <properties>
+    <!-- Don't make a test-jar -->
+    <maven.test.skip>true</maven.test.skip>
+    <!-- Don't make a source-jar -->
+    <source.skip>true</source.skip>
+    <license.bundles.dependencies>true</license.bundles.dependencies>
+    <top.dir>${project.basedir}/..</top.dir>
+    <shaded.package>org.apache.phoenix.shaded</shaded.package>
+
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-jar</id>
+            <phase>none</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <id>default-install</id>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+            <phase>install</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <file>${basedir}/target/phoenix-${project.version}-client.jar</file>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <finalName>phoenix-${project.version}-client</finalName>
+              <shadedArtifactAttached>false</shadedArtifactAttached>
+              
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+              <shadeTestJar>false</shadeTestJar>
+              <transformers>
+                <!--<transformer 
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer">-->
+                <!--</transformer>-->
+                <transformer 
implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+                  <resources>
+                    <resource>LICENSE.txt</resource>
+                    <resource>ASL2.0</resource>
+                  </resources>
+                </transformer>
+                <transformer
+                        
implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
+                  <addHeader>false</addHeader>
+                </transformer>
+                <transformer 
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+                <transformer
+                        
implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
+                  <resource>csv-bulk-load-config.properties</resource>
+                  <file>
+                    
${project.basedir}/../config/csv-bulk-load-config.properties
+                  </file>
+                </transformer>
+                <transformer
+                        
implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
+                  <resource>README.md</resource>
+                  <file>${project.basedir}/../README.md</file>
+                </transformer>
+                <transformer
+                        
implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
+                  <resource>LICENSE.txt</resource>
+                  <file>${project.basedir}/../LICENSE.txt</file>
+                </transformer>
+              </transformers>
+              <artifactSet>
+                <includes>
+                  <include>*:*</include>
+                </includes>
+                <excludes>
+                  <exclude>org.apache.phoenix:phoenix-client</exclude>
+                </excludes>
+              </artifactSet>
+
+              <relocations>
+
+                <!-- COM relocation -->
+                <relocation>
+                  <pattern>com.codahale</pattern>
+                  <shadedPattern>${shaded.package}.com.codahale</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.fasterxml</pattern>
+                  
<shadedPattern>${shaded.package}.com.fasterxml</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.google</pattern>
+                  <shadedPattern>${shaded.package}.com.google</shadedPattern>
+                  <excludes>
+                  </excludes>
+                </relocation>
+                <relocation>
+                  <pattern>com.jamesmurty</pattern>
+                  
<shadedPattern>${shaded.package}.com.jamesmurty</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.jcraft</pattern>
+                  <shadedPattern>${shaded.package}.com.jcraft</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.lmax</pattern>
+                  <shadedPattern>${shaded.package}.com.lmax</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.thoughtworks</pattern>
+                  
<shadedPattern>${shaded.package}.com.thoughtworks</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.sun.jersey</pattern>
+                  
<shadedPattern>${shaded.package}.com.sun.jersey</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>com.yammer</pattern>
+                  <shadedPattern>${shaded.package}.com.yammer</shadedPattern>
+                </relocation>
+
+                <!-- IO relocations -->
+                <relocation>
+                  <pattern>io.netty</pattern>
+                  <shadedPattern>${shaded.package}.io.netty</shadedPattern>
+                </relocation>
+
+                <!-- ORG relocations -->
+                <relocation>
+                  <pattern>org.antlr</pattern>
+                  <shadedPattern>${shaded.package}.org.antlr</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.aopalliance</pattern>
+                  
<shadedPattern>${shaded.package}.org.aopalliance</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.codehaus</pattern>
+                  <shadedPattern>${shaded.package}.org.codehaus</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.fusesource</pattern>
+                  
<shadedPattern>${shaded.package}.org.fusesource</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.hamcrest</pattern>
+                  <shadedPattern>${shaded.package}.org.hamcrest</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.hsqldb</pattern>
+                  <shadedPattern>${shaded.package}.org.hsqldb</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.iq80</pattern>
+                  <shadedPattern>${shaded.package}.org.iq80</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.jamon</pattern>
+                  <shadedPattern>${shaded.package}.org.jamon</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.jboss</pattern>
+                  <shadedPattern>${shaded.package}.org.jboss</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.jcodings</pattern>
+                  <shadedPattern>${shaded.package}.org.jcodings</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.jets3t</pattern>
+                  <shadedPattern>${shaded.package}.org.jets3t</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.joda</pattern>
+                  <shadedPattern>${shaded.package}.org.joda</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.joni</pattern>
+                  <shadedPattern>${shaded.package}.org.joni</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.junit</pattern>
+                  <shadedPattern>${shaded.package}.org.junit</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.kosmix</pattern>
+                  <shadedPattern>${shaded.package}.org.kosmix</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.mortbay</pattern>
+                  <shadedPattern>${shaded.package}.org.mortbay</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.objectweb</pattern>
+                  
<shadedPattern>${shaded.package}.org.objectweb</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.stringtemplate</pattern>
+                  
<shadedPattern>${shaded.package}.org.stringtemplate</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.tukaani</pattern>
+                  <shadedPattern>${shaded.package}.org.tukaani</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.znerd</pattern>
+                  <shadedPattern>${shaded.package}.org.znerd</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.avro</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.avro</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.commons</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.commons</shadedPattern>
+                  <excludes>
+                    <exclude>org.apache.commons.csv.**</exclude>
+                    <exclude>org.apache.commons.logging.**</exclude>
+                  </excludes>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.directory</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.directory</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.http</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.http</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.jasper</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.jasper</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.jute</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.jute</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.mina</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.mina</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.oro</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.oro</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.taglibs</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.taglibs</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.thrift</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.thrift</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.tools</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.tools</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.twill</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.twill</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.velocity</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.velocity</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.zookeeper</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.zookeeper</shadedPattern>
+                </relocation>
+
+                <!-- NET relocations -->
+                <relocation>
+                  <pattern>net</pattern>
+                  <shadedPattern>${shaded.package}.net</shadedPattern>
+                </relocation>
+
+                <!-- Misc relocations -->
+                <relocation>
+                  <pattern>antlr</pattern>
+                  <shadedPattern>${shaded.package}.antlr</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>it.unimi</pattern>
+                  <shadedPattern>${shaded.package}.it.unimi</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>jline</pattern>
+                  <shadedPattern>${shaded.package}.jline</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>junit</pattern>
+                  <shadedPattern>${shaded.package}.junit</shadedPattern>
+                </relocation>
+              </relocations>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- Depend on all other internal projects -->
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-flume</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-pig</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-spark</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/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 a7c91f6..c3cdbde 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
@@ -234,7 +234,7 @@ public class QueryServicesOptions {
     
     public static final long DEFAULT_INDEX_POPULATION_SLEEP_TIME = 5000;
 
-    // QueryServer defaults -- ensure ThinClientUtil is also updated since 
phoenix-server-client
+    // QueryServer defaults -- ensure ThinClientUtil is also updated since 
phoenix-queryserver-client
     // 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;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-hive/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-hive/pom.xml b/phoenix-hive/pom.xml
index e4b4a49..f41b935 100644
--- a/phoenix-hive/pom.xml
+++ b/phoenix-hive/pom.xml
@@ -150,6 +150,10 @@
             <goals>
               <goal>single</goal>
             </goals>
+            <configuration>
+              <appendAssemblyId>false</appendAssemblyId>
+              <finalName>phoenix-${project.version}-hive</finalName>
+            </configuration>
           </execution>
         </executions>
       </plugin>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver-client/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-queryserver-client/pom.xml 
b/phoenix-queryserver-client/pom.xml
new file mode 100644
index 0000000..54afadf
--- /dev/null
+++ b/phoenix-queryserver-client/pom.xml
@@ -0,0 +1,143 @@
+<?xml version='1.0'?>
+<!--
+
+ 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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.phoenix</groupId>
+    <artifactId>phoenix</artifactId>
+    <version>4.8.0-HBase-1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>phoenix-queryserver-client</artifactId>
+  <name>Phoenix Query Server Client</name>
+  <description>A thin JDBC client for interacting with the query 
server</description>
+
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+      <comments/>
+    </license>
+  </licenses>
+
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org</url>
+  </organization>
+
+  <properties>
+    <top.dir>${project.basedir}/..</top.dir>
+    <shaded.package>org.apache.phoenix.shaded</shaded.package>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <skipAssembly>true</skipAssembly>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>thin-client</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <finalName>phoenix-${project.version}-thin-client</finalName>
+              <relocations>
+
+                <!-- COM relocation -->
+
+                <relocation>
+                  <pattern>com.fasterxml</pattern>
+                  
<shadedPattern>${shaded.package}.com.fasterxml</shadedPattern>
+                </relocation>
+                <!-- ORG relocation -->
+                <relocation>
+                  <pattern>org.apache.calcite</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.calcite</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.commons</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.commons</shadedPattern>
+                  <excludes>
+                    <exclude>org.apache.commons.logging.**</exclude>
+                  </excludes>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.http</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.http</shadedPattern>
+                </relocation>
+
+                <relocation>
+                  <pattern>org.fusesource</pattern>
+                  
<shadedPattern>${shaded.package}.org.fusesource</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.hamcrest</pattern>
+                  <shadedPattern>${shaded.package}.org.hamcrest</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.junit</pattern>
+                  <shadedPattern>${shaded.package}.org.junit</shadedPattern>
+                </relocation>
+
+                <!-- MISC relocations -->
+
+                <relocation>
+                  <pattern>jline</pattern>
+                  <shadedPattern>${shaded.package}.jline</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>junit</pattern>
+                  <shadedPattern>${shaded.package}.junit</shadedPattern>
+                </relocation>
+
+              </relocations>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.calcite.avatica</groupId>
+      <artifactId>avatica</artifactId>
+    </dependency>
+    <dependency>
+      <!-- a dependency for the thin-client uberjar -->
+      <groupId>sqlline</groupId>
+      <artifactId>sqlline</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/Driver.java
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/Driver.java
 
b/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/Driver.java
new file mode 100644
index 0000000..5c8f119
--- /dev/null
+++ 
b/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/Driver.java
@@ -0,0 +1,49 @@
+/*
+ * 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.queryserver.client;
+
+import org.apache.calcite.avatica.DriverVersion;
+
+public class Driver extends org.apache.calcite.avatica.remote.Driver {
+
+  public static final String CONNECT_STRING_PREFIX = "jdbc:phoenix:thin:";
+
+  static {
+    new Driver().register();
+  }
+
+  public Driver() {
+    super();
+  }
+
+  @Override
+  protected DriverVersion createDriverVersion() {
+    return DriverVersion.load(
+        Driver.class,
+        "org-apache-phoenix-remote-jdbc.properties",
+        "Phoenix Remote JDBC Driver",
+        "unknown version",
+        "Apache Phoenix",
+        "unknown version");
+  }
+
+  @Override
+  protected String getConnectStringPrefix() {
+    return CONNECT_STRING_PREFIX;
+  }
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/ThinClientUtil.java
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/ThinClientUtil.java
 
b/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/ThinClientUtil.java
new file mode 100644
index 0000000..59fe093
--- /dev/null
+++ 
b/phoenix-queryserver-client/src/main/java/org/apache/phoenix/queryserver/client/ThinClientUtil.java
@@ -0,0 +1,42 @@
+/*
+ * 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.queryserver.client;
+
+/**
+ * Utilities for thin clients.
+ */
+public final class ThinClientUtil {
+  // The default serialization is also defined in QueryServicesOptions. 
phoenix-queryserver-client
+  // currently doesn't depend on phoenix-core so we have to deal with the 
duplication.
+  private static final String DEFAULT_SERIALIZATION = "PROTOBUF";
+
+  private ThinClientUtil() {}
+
+  public static String getConnectionUrl(String hostname, int port) {
+    return getConnectionUrl("http", hostname, port);
+  }
+
+  public static String getConnectionUrl(String protocol, String hostname, int 
port) {
+    return getConnectionUrl(protocol, hostname, port, DEFAULT_SERIALIZATION);
+  }
+
+  public static String getConnectionUrl(String protocol, String hostname, int 
port, String serialization) {
+    String urlFmt = Driver.CONNECT_STRING_PREFIX + 
"url=%s://%s:%s;serialization=%s";
+    return String.format(urlFmt, protocol, hostname, port, serialization);
+  }
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver-client/src/main/resources/META-INF/services/java.sql.Driver
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver-client/src/main/resources/META-INF/services/java.sql.Driver
 
b/phoenix-queryserver-client/src/main/resources/META-INF/services/java.sql.Driver
new file mode 100644
index 0000000..f94d657
--- /dev/null
+++ 
b/phoenix-queryserver-client/src/main/resources/META-INF/services/java.sql.Driver
@@ -0,0 +1 @@
+org.apache.phoenix.queryserver.client.Driver

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver-client/src/main/resources/version/org-apache-phoenix-remote-jdbc.properties
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver-client/src/main/resources/version/org-apache-phoenix-remote-jdbc.properties
 
b/phoenix-queryserver-client/src/main/resources/version/org-apache-phoenix-remote-jdbc.properties
new file mode 100644
index 0000000..7e8eb7e
--- /dev/null
+++ 
b/phoenix-queryserver-client/src/main/resources/version/org-apache-phoenix-remote-jdbc.properties
@@ -0,0 +1,25 @@
+# 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.
+#
+driver.name=Apache Phoenix Remote JDBC Driver
+driver.version=${pom.version}
+product.name=Apache Phoenix
+product.version=${pom.version}
+jdbc.compliant=true
+driver.version.major=${version.major}
+driver.version.minor=${version.minor}
+database.version.major=${version.major}
+database.version.minor=${version.minor}
+build.timestamp=${build.timestamp}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-queryserver/pom.xml b/phoenix-queryserver/pom.xml
new file mode 100644
index 0000000..56f1a8a
--- /dev/null
+++ b/phoenix-queryserver/pom.xml
@@ -0,0 +1,149 @@
+<?xml version='1.0'?>
+<!--
+
+ 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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.phoenix</groupId>
+    <artifactId>phoenix</artifactId>
+    <version>4.8.0-HBase-1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>phoenix-queryserver</artifactId>
+  <name>Phoenix Query Server</name>
+  <description>A query server for exposing Phoenix to thin 
clients</description>
+
+
+  <properties>
+    <top.dir>${project.basedir}/..</top.dir>
+    <shaded.package>org.apache.phoenix.shaded</shaded.package>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>query-server</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <finalName>phoenix-${project.version}-queryserver</finalName>
+              <shadedArtifactAttached>false</shadedArtifactAttached>
+              
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+              <shadeTestJar>false</shadeTestJar>
+              <artifactSet>
+                <includes>
+                  <include>org.apache.calcite.avatica:*</include>
+                  <include>org.eclipse.jetty:*</include>
+                  <include>javax.servlet:*</include>
+                </includes>
+              </artifactSet>
+              <relocations>
+                <relocation>
+                  <pattern>com.google</pattern>
+                  <shadedPattern>${shaded.package}.com.google</shadedPattern>
+                  <excludes>
+                  </excludes>
+                </relocation>
+                <relocation>
+                  <pattern>org.eclipse.jetty</pattern>
+                  
<shadedPattern>${shaded.package}.org.eclipse.jetty</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.calcite</pattern>
+                  
<shadedPattern>${shaded.package}.org.apache.calcite</shadedPattern>
+                </relocation>
+              </relocations>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-queryserver-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite.avatica</groupId>
+      <artifactId>avatica</artifactId>
+      <version>${avatica.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite.avatica</groupId>
+      <artifactId>avatica-server</artifactId>
+      <version>${avatica.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <!-- for tests -->
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-core</artifactId>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase-it</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hbase</groupId>
+      <artifactId>hbase-testing-util</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tephra</groupId>
+      <artifactId>tephra-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver/src/build/query-server-runnable.xml
----------------------------------------------------------------------
diff --git a/phoenix-queryserver/src/build/query-server-runnable.xml 
b/phoenix-queryserver/src/build/query-server-runnable.xml
new file mode 100644
index 0000000..d098b63
--- /dev/null
+++ b/phoenix-queryserver/src/build/query-server-runnable.xml
@@ -0,0 +1,52 @@
+<?xml version='1.0'?>
+<!--
+
+ 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.
+
+-->
+
+<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
+  <id>runnable</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <containerDescriptorHandlers>
+    <containerDescriptorHandler>
+      <!--
+          aggregate SPI's so that things like HDFS FileSystem works in uberjar
+          http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html
+      -->
+      <handlerName>metaInf-services</handlerName>
+    </containerDescriptorHandler>
+  </containerDescriptorHandlers>
+  <dependencySets>
+    <dependencySet>
+      <unpack>true</unpack>
+      <scope>runtime</scope>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>org.apache.phoenix:phoenix-queryserver</include>
+        <include>org.apache.phoenix:phoenix-queryserver-client</include>
+        <include>org.apache.calcite.avatica:*</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerBasicsIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerBasicsIT.java
 
b/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerBasicsIT.java
new file mode 100644
index 0000000..ba49bab
--- /dev/null
+++ 
b/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerBasicsIT.java
@@ -0,0 +1,164 @@
+/*
+ * 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.end2end;
+
+import static java.lang.String.format;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_CAT;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_CATALOG;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
+import static org.apache.phoenix.query.QueryConstants.SYSTEM_SCHEMA_NAME;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.Statement;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.queryserver.client.ThinClientUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Smoke test for query server.
+ */
+public class QueryServerBasicsIT extends BaseHBaseManagedTimeIT {
+
+  private static final Log LOG = LogFactory.getLog(QueryServerBasicsIT.class);
+
+  private static QueryServerThread AVATICA_SERVER;
+  private static Configuration CONF;
+  private static String CONN_STRING;
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    CONF = getTestClusterConfig();
+    CONF.setInt(QueryServices.QUERY_SERVER_HTTP_PORT_ATTRIB, 0);
+    String url = getUrl();
+    AVATICA_SERVER = new QueryServerThread(new String[] { url }, CONF,
+            QueryServerBasicsIT.class.getName());
+    AVATICA_SERVER.start();
+    AVATICA_SERVER.getMain().awaitRunning();
+    final int port = AVATICA_SERVER.getMain().getPort();
+    LOG.info("Avatica server started on port " + port);
+    CONN_STRING = ThinClientUtil.getConnectionUrl("localhost", port);
+    LOG.info("JDBC connection string is " + CONN_STRING);
+  }
+
+  @AfterClass
+  public static void afterClass() throws Exception {
+    if (AVATICA_SERVER != null) {
+      AVATICA_SERVER.join(TimeUnit.MINUTES.toMillis(1));
+      Throwable t = AVATICA_SERVER.getMain().getThrowable();
+      if (t != null) {
+        fail("query server threw. " + t.getMessage());
+      }
+      assertEquals("query server didn't exit cleanly", 0, 
AVATICA_SERVER.getMain().getRetCode());
+    }
+  }
+
+  @Test
+  public void testCatalogs() throws Exception {
+    try (final Connection connection = 
DriverManager.getConnection(CONN_STRING)) {
+      assertThat(connection.isClosed(), is(false));
+      try (final ResultSet resultSet = connection.getMetaData().getCatalogs()) 
{
+        final ResultSetMetaData metaData = resultSet.getMetaData();
+        assertFalse("unexpected populated resultSet", resultSet.next());
+        assertEquals(1, metaData.getColumnCount());
+        assertEquals(TABLE_CAT, metaData.getColumnName(1));
+      }
+    }
+  }
+
+  @Test
+  public void testSchemas() throws Exception {
+      Properties props=new Properties();
+      props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, 
Boolean.toString(true));
+      try (final Connection connection = 
DriverManager.getConnection(CONN_STRING, props)) {
+      connection.createStatement().executeUpdate("CREATE SCHEMA IF NOT EXISTS 
" + SYSTEM_SCHEMA_NAME);
+      assertThat(connection.isClosed(), is(false));
+      try (final ResultSet resultSet = connection.getMetaData().getSchemas()) {
+        final ResultSetMetaData metaData = resultSet.getMetaData();
+        assertTrue("unexpected empty resultset", resultSet.next());
+        assertEquals(2, metaData.getColumnCount());
+        assertEquals(TABLE_SCHEM, metaData.getColumnName(1));
+        assertEquals(TABLE_CATALOG, metaData.getColumnName(2));
+        boolean containsSystem = false;
+        do {
+          if (resultSet.getString(1).equalsIgnoreCase(SYSTEM_SCHEMA_NAME)) 
containsSystem = true;
+        } while (resultSet.next());
+        assertTrue(format("should contain at least %s schema.", 
SYSTEM_SCHEMA_NAME), containsSystem);
+      }
+    }
+  }
+
+  @Test
+  public void smokeTest() throws Exception {
+    final String tableName = getClass().getSimpleName().toUpperCase() + 
System.currentTimeMillis();
+    try (final Connection connection = 
DriverManager.getConnection(CONN_STRING)) {
+      assertThat(connection.isClosed(), is(false));
+      connection.setAutoCommit(true);
+      try (final Statement stmt = connection.createStatement()) {
+        assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
+        assertFalse(stmt.execute("CREATE TABLE " + tableName + "("
+            + "id INTEGER NOT NULL, "
+            + "pk varchar(3) NOT NULL "
+            + "CONSTRAINT PK_CONSTRAINT PRIMARY KEY (id, pk))"));
+        assertEquals(0, stmt.getUpdateCount());
+        assertEquals(1, stmt.executeUpdate("UPSERT INTO " + tableName + " 
VALUES(1, 'foo')"));
+        assertEquals(1, stmt.executeUpdate("UPSERT INTO " + tableName + " 
VALUES(2, 'bar')"));
+        assertTrue(stmt.execute("SELECT * FROM " + tableName));
+        try (final ResultSet resultSet = stmt.getResultSet()) {
+          assertTrue(resultSet.next());
+          assertEquals(1, resultSet.getInt(1));
+          assertEquals("foo", resultSet.getString(2));
+          assertTrue(resultSet.next());
+          assertEquals(2, resultSet.getInt(1));
+          assertEquals("bar", resultSet.getString(2));
+        }
+      }
+      final String sql = "SELECT * FROM " + tableName + " WHERE id = ?";
+      try (final PreparedStatement stmt = connection.prepareStatement(sql)) {
+        stmt.setInt(1, 1);
+        try (ResultSet resultSet = stmt.executeQuery()) {
+          assertTrue(resultSet.next());
+          assertEquals(1, resultSet.getInt(1));
+          assertEquals("foo", resultSet.getString(2));
+        }
+        stmt.clearParameters();
+        stmt.setInt(1, 5);
+        try (final ResultSet resultSet = stmt.executeQuery()) {
+          assertFalse(resultSet.next());
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f7e1c46/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerThread.java
----------------------------------------------------------------------
diff --git 
a/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerThread.java
 
b/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerThread.java
new file mode 100644
index 0000000..ef94bf7
--- /dev/null
+++ 
b/phoenix-queryserver/src/it/java/org/apache/phoenix/end2end/QueryServerThread.java
@@ -0,0 +1,45 @@
+/*
+ * 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.end2end;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.phoenix.queryserver.server.Main;
+
+/** Wraps up the query server for tests. */
+public class QueryServerThread extends Thread {
+
+  private final Main main;
+
+  public QueryServerThread(String[] argv, Configuration conf) {
+    this(argv, conf, null);
+  }
+
+  public QueryServerThread(String[] argv, Configuration conf, String name) {
+    this(new Main(argv, conf), name);
+  }
+
+  private QueryServerThread(Main m, String name) {
+    super(m, "query server" + (name == null ? "" : (" - " + name)));
+    this.main = m;
+    setDaemon(true);
+  }
+
+  public Main getMain() {
+    return main;
+  }
+}

Reply via email to