HIVE-17983 Make the standalone metastore generate tarballs etc.

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

Branch: refs/heads/standalone-metastore
Commit: b9526a7ac987b8a07b41531ab14e381bbda7f8ab
Parents: 002233b
Author: Alan Gates <[email protected]>
Authored: Thu Oct 19 16:49:38 2017 -0700
Committer: Alan Gates <[email protected]>
Committed: Mon Dec 18 14:56:37 2017 -0800

----------------------------------------------------------------------
 .../org/apache/hive/beeline/HiveSchemaTool.java |    6 +-
 bin/ext/metastore.sh                            |   41 -
 binary-package-licenses/README                  |    1 +
 .../org/apache/hive/beeline/TestSchemaTool.java |   16 +-
 standalone-metastore/DEV-README                 |   40 +
 .../binary-package-licenses/NOTICE              |    4 +
 .../com.google.protobuf-LICENSE                 |   42 +
 .../javax.transaction.transaction-api-LICENSE   |  128 ++
 .../binary-package-licenses/javolution-LICENSE  |   25 +
 .../binary-package-licenses/jline-LICENSE       |   32 +
 .../binary-package-licenses/org.antlr-LICENSE   |   27 +
 .../binary-package-licenses/sqlline-LICENSE     |   33 +
 standalone-metastore/pom.xml                    |   97 +-
 standalone-metastore/src/assembly/bin.xml       |  126 ++
 standalone-metastore/src/assembly/src.xml       |   53 +
 .../hive/metastore/IMetaStoreSchemaInfo.java    |    7 +
 .../hive/metastore/MetaStoreSchemaInfo.java     |   16 +-
 .../hive/metastore/tools/HiveSchemaHelper.java  |   80 +-
 .../metastore/tools/MetastoreSchemaTool.java    | 1309 ++++++++++++++
 .../src/main/resources/metastore-log4j2.xml     |   30 +
 standalone-metastore/src/main/scripts/base      |  238 +++
 .../src/main/scripts/ext/metastore.sh           |   41 +
 .../src/main/scripts/ext/schemaTool.sh          |   33 +
 .../src/main/scripts/metastore-config.sh        |   70 +
 .../src/main/scripts/schematool                 |   21 +
 .../src/main/scripts/start-metastore            |   21 +
 .../main/sql/derby/hive-schema-2.3.0.derby.sql  |  456 +++++
 .../main/sql/derby/hive-schema-3.0.0.derby.sql  |  508 ++++++
 .../sql/derby/upgrade-2.3.0-to-3.0.0.derby.sql  |   46 +
 .../src/main/sql/derby/upgrade.order.derby      |    1 +
 .../src/main/sql/mssql/create-user.mssql.sql    |    5 +
 .../main/sql/mssql/hive-schema-2.3.0.mssql.sql  | 1023 +++++++++++
 .../main/sql/mssql/hive-schema-3.0.0.mssql.sql  | 1112 ++++++++++++
 .../sql/mssql/upgrade-2.3.0-to-3.0.0.mssql.sql  |  106 ++
 .../src/main/sql/mssql/upgrade.order.mssql      |    1 +
 .../src/main/sql/mysql/create-user.mysql.sql    |    8 +
 .../main/sql/mysql/hive-schema-2.3.0.mysql.sql  |  970 ++++++++++
 .../main/sql/mysql/hive-schema-3.0.0.mysql.sql  | 1045 +++++++++++
 .../sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql  |   90 +
 .../src/main/sql/mysql/upgrade.order.mysql      |    1 +
 .../src/main/sql/oracle/create-user.oracle.sql  |    3 +
 .../sql/oracle/hive-schema-2.3.0.oracle.sql     |  926 ++++++++++
 .../sql/oracle/hive-schema-3.0.0.oracle.sql     | 1014 +++++++++++
 .../oracle/upgrade-2.3.0-to-3.0.0.oracle.sql    |  107 ++
 .../src/main/sql/oracle/upgrade.order.oracle    |    1 +
 .../main/sql/postgres/create-user.postgres.sql  |    2 +
 .../sql/postgres/hive-schema-2.3.0.postgres.sql | 1593 ++++++++++++++++
 .../sql/postgres/hive-schema-3.0.0.postgres.sql | 1699 ++++++++++++++++++
 .../upgrade-2.3.0-to-3.0.0.postgres.sql         |  121 ++
 .../main/sql/postgres/upgrade.order.postgres    |    1 +
 .../hive/metastore/dbinstall/DbInstallBase.java |  280 +++
 .../hive/metastore/dbinstall/ITestMysql.java    |   82 +
 .../hive/metastore/dbinstall/ITestOracle.java   |   83 +
 .../hive/metastore/dbinstall/ITestPostgres.java |   82 +
 .../metastore/dbinstall/ITestSqlServer.java     |   84 +
 .../tools/TestMetastoreSchemaTool.java          |   67 +
 .../tools/TestSchemaToolForMetastore.java       |  467 +++++
 57 files changed, 14431 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java 
b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
index 74591ac..ca05b2a 100644
--- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
+++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
@@ -159,12 +159,12 @@ public class HiveSchemaTool {
 
   private NestedScriptParser getDbCommandParser(String dbType, String 
metaDbType) {
     return HiveSchemaHelper.getDbCommandParser(dbType, dbOpts, userName,
-       passWord, hiveConf, metaDbType);
+       passWord, hiveConf, metaDbType, false);
   }
 
   private NestedScriptParser getDbCommandParser(String dbType) {
     return HiveSchemaHelper.getDbCommandParser(dbType, dbOpts, userName,
-       passWord, hiveConf, null);
+       passWord, hiveConf, null, false);
   }
 
   /***
@@ -804,7 +804,7 @@ public class HiveSchemaTool {
 
   private List<String> findCreateTable(String path, List<String> tableList)
       throws Exception {
-    NestedScriptParser sp           = 
HiveSchemaHelper.getDbCommandParser(dbType);
+    NestedScriptParser sp           = 
HiveSchemaHelper.getDbCommandParser(dbType, false);
     Matcher matcher                 = null;
     Pattern regexp                  = null;
     List<String> subs               = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/bin/ext/metastore.sh
----------------------------------------------------------------------
diff --git a/bin/ext/metastore.sh b/bin/ext/metastore.sh
deleted file mode 100644
index cc08c95..0000000
--- a/bin/ext/metastore.sh
+++ /dev/null
@@ -1,41 +0,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.
-
-THISSERVICE=metastore
-export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
-
-metastore() {
-  echo "$(timestamp): Starting Hive Metastore Server"
-  CLASS=org.apache.hadoop.hive.metastore.HiveMetaStore
-  if $cygwin; then
-    HIVE_LIB=`cygpath -w "$HIVE_LIB"`
-  fi
-  JAR=${HIVE_LIB}/hive-metastore-*.jar
-
-  # hadoop 20 or newer - skip the aux_jars option and hiveconf
-
-  export HADOOP_CLIENT_OPTS=" -Dproc_metastore $HADOOP_CLIENT_OPTS "
-  export HADOOP_OPTS="$HIVE_METASTORE_HADOOP_OPTS $HADOOP_OPTS"
-  exec $HADOOP jar $JAR $CLASS "$@"
-}
-
-metastore_help() {
-  metastore -h
-}
-
-timestamp()
-{
- date +"%Y-%m-%d %T"
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/binary-package-licenses/README
----------------------------------------------------------------------
diff --git a/binary-package-licenses/README b/binary-package-licenses/README
index ef127e3..c801896 100644
--- a/binary-package-licenses/README
+++ b/binary-package-licenses/README
@@ -42,6 +42,7 @@ guava
 guice*
 hbase*
 hibernate-validator
+Hikaricp
 htrace-core
 http-client
 httpclient

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
----------------------------------------------------------------------
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java 
b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
index 9f08693..0c34a1e 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java
@@ -338,7 +338,7 @@ public class TestSchemaTool extends TestCase {
     String expectedSQL = StringUtils.join(resultScript, 
System.getProperty("line.separator")) +
         System.getProperty("line.separator");
     File testScriptFile = generateTestScript(testScript);
-    String flattenedSql = HiveSchemaHelper.getDbCommandParser("derby")
+    String flattenedSql = HiveSchemaHelper.getDbCommandParser("derby", false)
         .buildCommand(testScriptFile.getParentFile().getPath(),
             testScriptFile.getName());
 
@@ -380,7 +380,7 @@ public class TestSchemaTool extends TestCase {
       };
 
     File testScriptFile = generateTestScript(parentTestScript);
-    String flattenedSql = HiveSchemaHelper.getDbCommandParser("derby")
+    String flattenedSql = HiveSchemaHelper.getDbCommandParser("derby", false)
         .buildCommand(testScriptFile.getParentFile().getPath(),
             testScriptFile.getName());
     assertFalse(flattenedSql.contains("RUN"));
@@ -425,7 +425,7 @@ public class TestSchemaTool extends TestCase {
       };
 
     File testScriptFile = generateTestScript(parentTestScript);
-    String flattenedSql = HiveSchemaHelper.getDbCommandParser("mysql")
+    String flattenedSql = HiveSchemaHelper.getDbCommandParser("mysql", false)
         .buildCommand(testScriptFile.getParentFile().getPath(),
             testScriptFile.getName());
     assertFalse(flattenedSql.contains("RUN"));
@@ -467,7 +467,7 @@ public class TestSchemaTool extends TestCase {
     String expectedSQL = StringUtils.join(resultScript, 
System.getProperty("line.separator")) +
         System.getProperty("line.separator");
     File testScriptFile = generateTestScript(testScript);
-    NestedScriptParser testDbParser = 
HiveSchemaHelper.getDbCommandParser("mysql");
+    NestedScriptParser testDbParser = 
HiveSchemaHelper.getDbCommandParser("mysql", false);
     String flattenedSql = 
testDbParser.buildCommand(testScriptFile.getParentFile().getPath(),
         testScriptFile.getName());
 
@@ -502,7 +502,7 @@ public class TestSchemaTool extends TestCase {
     String expectedSQL = StringUtils.join(parsedScript, 
System.getProperty("line.separator")) +
         System.getProperty("line.separator");
     File testScriptFile = generateTestScript(testScript);
-    NestedScriptParser testDbParser = 
HiveSchemaHelper.getDbCommandParser("mysql");
+    NestedScriptParser testDbParser = 
HiveSchemaHelper.getDbCommandParser("mysql", false);
     String flattenedSql = 
testDbParser.buildCommand(testScriptFile.getParentFile().getPath(),
         testScriptFile.getName());
 
@@ -544,7 +544,7 @@ public class TestSchemaTool extends TestCase {
       };
 
     File testScriptFile = generateTestScript(parentTestScript);
-    String flattenedSql = HiveSchemaHelper.getDbCommandParser("oracle")
+    String flattenedSql = HiveSchemaHelper.getDbCommandParser("oracle", false)
         .buildCommand(testScriptFile.getParentFile().getPath(),
             testScriptFile.getName());
     assertFalse(flattenedSql.contains("@"));
@@ -576,7 +576,7 @@ public class TestSchemaTool extends TestCase {
     };
 
     NestedScriptParser noDbOptParser = HiveSchemaHelper
-        .getDbCommandParser("postgres");
+        .getDbCommandParser("postgres", false);
     String expectedSQL = StringUtils.join(
         expectedScriptWithOptionPresent, System.getProperty("line.separator")) 
+
             System.getProperty("line.separator");
@@ -594,7 +594,7 @@ public class TestSchemaTool extends TestCase {
     NestedScriptParser dbOptParser = HiveSchemaHelper.getDbCommandParser(
         "postgres",
         PostgresCommandParser.POSTGRES_SKIP_STANDARD_STRINGS_DBOPT,
-        null, null, null, null);
+        null, null, null, null, false);
     expectedSQL = StringUtils.join(
         expectedScriptWithOptionAbsent, System.getProperty("line.separator")) +
             System.getProperty("line.separator");

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/DEV-README
----------------------------------------------------------------------
diff --git a/standalone-metastore/DEV-README b/standalone-metastore/DEV-README
new file mode 100644
index 0000000..446f580
--- /dev/null
+++ b/standalone-metastore/DEV-README
@@ -0,0 +1,40 @@
+This file contains information for developers and testers.
+
+Testing metastore installation and upgrade against databases beyond Derby:
+There are integration tests for testing installation and upgrade of the
+metastore on MySQL (actually MariaDB is used), Oracle, Postgres, and SQLServer.
+These tests are not run by default because they take several minutes each and
+they require the developer to download the JDBC driver for Oracle.
+They are run in the integration-test phase.
+
+Each ITest runs two tests, one that installs the latest version of the
+database and one that installs the latest version minus one and then upgrades
+the database.
+
+To run one of the tests you will need to explicitly turn on integration 
testing,
+in the Oracle case specify the location of the JDBC driver, and optionally
+specify which test you want to run.  To run all of the tests do:
+
+mvn verify -Ditest.jdbc.jars=_oracle_jar_path -DskipITests=false -Dtest=nosuch
+
+To run just one test, do
+
+mvn verify -DskipITests=false -Dit.test=ITestMysql -Dtest=nosuch
+
+You can download the Oracle driver at 
+http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
+
+If you wish to use one of these containers to run your own tests against a
+non-Derby version of the metastore, you can do that as well.  You must specify
+that only the install test be run (change -Dit.test=ITestMysql in the example
+above to -Dit.test=ITestMysql#install) and tell it to leave the docker 
container
+running by adding -Dmetastore.itest.no.stop.container=true.  You will then need
+to stop and remove the container yourself once you have finished.  The 
container
+is recreated for each run of the test, so you cannot rerun the test until you
+have stopped and removed it.  You can construct the connection values to put in
+metastore-site.xml from the information in the appropriate ITest file (e.g.,
+from ITestMysql you can find that the JDBC URL is
+"jdbc:mysql://localhost:3306/hivedb", the JDBC driver is
+"org.mariadb.jdbc.Driver", and the password is "hivepassword".  The user is
+always "hiveuser".
+

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/NOTICE
----------------------------------------------------------------------
diff --git a/standalone-metastore/binary-package-licenses/NOTICE 
b/standalone-metastore/binary-package-licenses/NOTICE
new file mode 100644
index 0000000..76cce78
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/NOTICE
@@ -0,0 +1,4 @@
+Binary distributions of this software contain jars that are not licensed under 
the
+Apache License 2.0.  Additional licenses attached to these jars are contained 
in the
+same directory as this NOTICE file.  
+

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/com.google.protobuf-LICENSE
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/binary-package-licenses/com.google.protobuf-LICENSE 
b/standalone-metastore/binary-package-licenses/com.google.protobuf-LICENSE
new file mode 100644
index 0000000..f028c82
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/com.google.protobuf-LICENSE
@@ -0,0 +1,42 @@
+This license applies to all parts of Protocol Buffers except the following:
+
+  - Atomicops support for generic gcc, located in
+    src/google/protobuf/stubs/atomicops_internals_generic_gcc.h.
+    This file is copyrighted by Red Hat Inc.
+
+  - Atomicops support for AIX/POWER, located in
+    src/google/protobuf/stubs/atomicops_internals_power.h.
+    This file is copyrighted by Bloomberg Finance LP.
+
+Copyright 2014, Google Inc.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it.  This code is not
+standalone and requires a support library to be linked with it.  This
+support library is itself covered by the above license.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/javax.transaction.transaction-api-LICENSE
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/binary-package-licenses/javax.transaction.transaction-api-LICENSE
 
b/standalone-metastore/binary-package-licenses/javax.transaction.transaction-api-LICENSE
new file mode 100644
index 0000000..d7b7cfe
--- /dev/null
+++ 
b/standalone-metastore/binary-package-licenses/javax.transaction.transaction-api-LICENSE
@@ -0,0 +1,128 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0 (CDDL-1.0)
+1. Definitions.
+
+1.1. Contributor means each individual or entity that creates or contributes 
to the creation of Modifications.
+
+1.2. Contributor Version means the combination of the Original Software, prior 
Modifications used by a Contributor (if any), and the Modifications made by 
that particular Contributor.
+
+1.3. Covered Software means (a) the Original Software, or (b) Modifications, 
or (c) the combination of files containing Original Software with files 
containing Modifications, in each case including portions thereof.
+
+1.4. Executable means the Covered Software in any form other than Source Code.
+
+1.5. Initial Developer means the individual or entity that first makes 
Original Software available under this License.
+
+1.6. Larger Work means a work which combines Covered Software or portions 
thereof with code not governed by the terms of this License.
+
+1.7. License means this document.
+
+1.8. Licensable means having the right to grant, to the maximum extent 
possible, whether at the time of the initial grant or subsequently acquired, 
any and all of the rights conveyed herein.
+
+1.9. Modifications means the Source Code and Executable form of any of the 
following:
+
+A. Any file that results from an addition to, deletion from or modification of 
the contents of a file containing Original Software or previous Modifications;
+
+B. Any new file that contains any part of the Original Software or previous 
Modification; or
+
+C. Any new file that is contributed or otherwise made available under the 
terms of this License.
+
+1.10. Original Software means the Source Code and Executable form of computer 
software code that is originally released under this License.
+
+1.11. Patent Claims means any patent claim(s), now owned or hereafter 
acquired, including without limitation, method, process, and apparatus claims, 
in any patent Licensable by grantor.
+
+1.12. Source Code means (a) the common form of computer software code in which 
modifications are made and (b) associated documentation included in or with 
such code.
+
+1.13. You (or Your) means an individual or a legal entity exercising rights 
under, and complying with all of the terms of, this License. For legal 
entities, You includes any entity which controls, is controlled by, or is under 
common control with You. For purposes of this definition, control means (a) the 
power, direct or indirect, to cause the direction or management of such entity, 
whether by contract or otherwise, or (b) ownership of more than fifty percent 
(50%) of the outstanding shares or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and subject to third 
party intellectual property claims, the Initial Developer hereby grants You a 
world-wide, royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark) 
Licensable by Initial Developer, to use, reproduce, modify, display, perform, 
sublicense and distribute the Original Software (or portions thereof), with or 
without Modifications, and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making, using or selling of Original 
Software, to make, have made, use, practice, sell, and offer for sale, and/or 
otherwise dispose of the Original Software (or portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date 
Initial Developer first distributes or otherwise makes the Original Software 
available to a third party under the terms of this License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) 
for code that You delete from the Original Software, or (2) for infringements 
caused by: (i) the modification of the Original Software, or (ii) the 
combination of the Original Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and subject to third 
party intellectual property claims, each Contributor hereby grants You a 
world-wide, royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark) 
Licensable by Contributor to use, reproduce, modify, display, perform, 
sublicense and distribute the Modifications created by such Contributor (or 
portions thereof), either on an unmodified basis, with other Modifications, as 
Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making, using, or selling of 
Modifications made by that Contributor either alone and/or in combination with 
its Contributor Version (or portions of such combination), to make, use, sell, 
offer for sale, have made, and/or otherwise dispose of: (1) Modifications made 
by that Contributor (or portions thereof); and (2) the combination of 
Modifications made by that Contributor with its Contributor Version (or 
portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the 
date Contributor first distributes or otherwise makes the Modifications 
available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) 
for any code that Contributor has deleted from the Contributor Version; (2) for 
infringements caused by: (i) third party modifications of Contributor Version, 
or (ii) the combination of Modifications made by that Contributor with other 
software (except as part of the Contributor Version) or other devices; or (3) 
under Patent Claims infringed by Covered Software in the absence of 
Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make available in 
Executable form must also be made available in Source Code form and that Source 
Code form must be distributed only under the terms of this License. You must 
include a copy of this License with every copy of the Source Code form of the 
Covered Software You distribute or otherwise make available. You must inform 
recipients of any such Covered Software in Executable form as to how they can 
obtain such Covered Software in Source Code form in a reasonable manner on or 
through a medium customarily used for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You contribute are governed by 
the terms of this License. You represent that You believe Your Modifications 
are Your original creation(s) and/or You have sufficient rights to grant the 
rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications that identifies You as 
the Contributor of the Modification. You may not remove or alter any copyright, 
patent or trademark notices contained within the Covered Software, or any 
notices of licensing or any descriptive text giving attribution to any 
Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered Software in Source Code 
form that alters or restricts the applicable version of this License or the 
recipients rights hereunder. You may choose to offer, and to charge a fee for, 
warranty, support, indemnity or liability obligations to one or more recipients 
of Covered Software. However, you may do so only on Your own behalf, and not on 
behalf of the Initial Developer or any Contributor. You must make it absolutely 
clear that any such warranty, support, indemnity or liability obligation is 
offered by You alone, and You hereby agree to indemnify the Initial Developer 
and every Contributor for any liability incurred by the Initial Developer or 
such Contributor as a result of warranty, support, indemnity or liability terms 
You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered Software under the terms 
of this License or under the terms of a license of Your choice, which may 
contain terms different from this License, provided that You are in compliance 
with the terms of this License and that the license for the Executable form 
does not attempt to limit or alter the recipients rights in the Source Code 
form from the rights set forth in this License. If You distribute the Covered 
Software in Executable form under a different license, You must make it 
absolutely clear that any terms which differ from this License are offered by 
You alone, not by the Initial Developer or Contributor. You hereby agree to 
indemnify the Initial Developer and every Contributor for any liability 
incurred by the Initial Developer or such Contributor as a result of any such 
terms You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software with other code not 
governed by the terms of this License and distribute the Larger Work as a 
single product. In such a case, You must make sure the requirements of this 
License are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Sun Microsystems, Inc. is the initial license steward and may publish revised 
and/or new versions of this License from time to time. Each version will be 
given a distinguishing version number. Except as provided in Section 4.3, no 
one other than the license steward has the right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise make the Covered 
Software available under the terms of the version of the License under which 
You originally received the Covered Software. If the Initial Developer includes 
a notice in the Original Software prohibiting it from being distributed or 
otherwise made available under any subsequent version of the License, You must 
distribute and make the Covered Software available under the terms of the 
version of the License under which You originally received the Covered 
Software. Otherwise, You may also choose to use, distribute or otherwise make 
the Covered Software available under the terms of any subsequent version of the 
License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a new license for 
Your Original Software, You may create and use a modified version of this 
License if You: (a) rename the license and remove any references to the name of 
the license steward (except to note that the license differs from this 
License); and (b) otherwise make it clear that the license contains terms which 
differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT 
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT 
LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, 
MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK 
AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD 
ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL 
DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, 
REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART 
OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT 
UNDER THIS DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will terminate 
automatically if You fail to comply with terms herein and fail to cure such 
breach within 30 days of becoming aware of the breach. Provisions which, by 
their nature, must remain in effect beyond the termination of this License 
shall survive.
+
+6.2. If You assert a patent infringement claim (excluding declaratory judgment 
actions) against Initial Developer or a Contributor (the Initial Developer or 
Contributor against whom You assert such claim is referred to as Participant) 
alleging that the Participant Software (meaning the Contributor Version where 
the Participant is a Contributor or the Original Software where the Participant 
is the Initial Developer) directly or indirectly infringes any patent, then any 
and all rights granted directly or indirectly to You by such Participant, the 
Initial Developer (if the Initial Developer is not the Participant) and all 
Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days 
notice from Participant terminate prospectively and automatically at the 
expiration of such 60 day notice period, unless if within such 60 day period 
You withdraw Your claim with respect to the Participant Software against such 
Participant either unilaterally or pursuant to a written agreem
 ent with Participant.
+
+6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user 
licenses that have been validly granted by You or any distributor hereunder 
prior to termination (excluding licenses granted to You by any distributor) 
shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING 
NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY 
OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF 
ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, 
INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT 
LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER 
FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN 
IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS 
LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL 
INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW 
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR 
LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND 
LIMITATION MAY NOT APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a commercial item, as that term is defined in 48 
C.F.R. 2.101 (Oct. 1995), consisting of commercial computer software (as that 
term is defined at 48 C.F.R.  252.227-7014(a)(1)) and commercial computer 
software documentation as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). 
Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 
(June 1995), all U.S. Government End Users acquire Covered Software with only 
those rights set forth herein. This U.S. Government Rights clause is in lieu 
of, and supersedes, any other FAR, DFAR, or other clause or provision that 
addresses Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject matter 
hereof. If any provision of this License is held to be unenforceable, such 
provision shall be reformed only to the extent necessary to make it 
enforceable. This License shall be governed by the law of the jurisdiction 
specified in a notice contained within the Original Software (except to the 
extent applicable law, if any, provides otherwise), excluding such 
jurisdictions conflict-of-law provisions. Any litigation relating to this 
License shall be subject to the jurisdiction of the courts located in the 
jurisdiction and venue specified in a notice contained within the Original 
Software, with the losing party responsible for costs, including, without 
limitation, court costs and reasonable attorneys fees and expenses. The 
application of the United Nations Convention on Contracts for the International 
Sale of Goods is expressly excluded. Any law or regulation which provides that 
the language of a contract shall be
  construed against the drafter shall not apply to this License. You agree that 
You alone are responsible for compliance with the United States export 
administration regulations (and the export control laws and regulation of any 
other countries) when You use, distribute or otherwise make available any 
Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is responsible 
for claims and damages arising, directly or indirectly, out of its utilization 
of rights under this License and You agree to work with Initial Developer and 
Contributors to distribute such responsibility on an equitable basis. Nothing 
herein is intended or shall be deemed to constitute any admission of liability.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/javolution-LICENSE
----------------------------------------------------------------------
diff --git a/standalone-metastore/binary-package-licenses/javolution-LICENSE 
b/standalone-metastore/binary-package-licenses/javolution-LICENSE
new file mode 100644
index 0000000..bd6788d
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/javolution-LICENSE
@@ -0,0 +1,25 @@
+Javolution - Java(tm) Solution for Real-Time and Embedded Systems
+Copyright (c) 2012, Javolution (http://javolution.org/)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/jline-LICENSE
----------------------------------------------------------------------
diff --git a/standalone-metastore/binary-package-licenses/jline-LICENSE 
b/standalone-metastore/binary-package-licenses/jline-LICENSE
new file mode 100644
index 0000000..246f54f
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/jline-LICENSE
@@ -0,0 +1,32 @@
+Copyright (c) 2002-2006, Marc Prud'hommeaux <[email protected]>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with
+the distribution.
+
+Neither the name of JLine nor the names of its contributors
+may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/org.antlr-LICENSE
----------------------------------------------------------------------
diff --git a/standalone-metastore/binary-package-licenses/org.antlr-LICENSE 
b/standalone-metastore/binary-package-licenses/org.antlr-LICENSE
new file mode 100644
index 0000000..f6d28b7
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/org.antlr-LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2003-2008, Terence Parr
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.  Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.  Neither the name of
+the author nor the names of its contributors may be used to endorse or
+promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/binary-package-licenses/sqlline-LICENSE
----------------------------------------------------------------------
diff --git a/standalone-metastore/binary-package-licenses/sqlline-LICENSE 
b/standalone-metastore/binary-package-licenses/sqlline-LICENSE
new file mode 100644
index 0000000..47e0391
--- /dev/null
+++ b/standalone-metastore/binary-package-licenses/sqlline-LICENSE
@@ -0,0 +1,33 @@
+Copyright (c) 2002,2003,2004,2005,2006 Marc Prud'hommeaux
+All rights reserved.
+
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+       
+Redistributions of source code must retain the above
+copyright notice, this list of conditions and the following
+disclaimer.
+Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials
+provided with the distribution.
+Neither the name of the <ORGANIZATION> nor the names
+of its contributors may be used to endorse or promote
+products derived from this software without specific
+prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/pom.xml
----------------------------------------------------------------------
diff --git a/standalone-metastore/pom.xml b/standalone-metastore/pom.xml
index d87863e..87efece 100644
--- a/standalone-metastore/pom.xml
+++ b/standalone-metastore/pom.xml
@@ -38,6 +38,7 @@
     <maven.compiler.target>1.8</maven.compiler.target>
     
<maven.compiler.useIncrementalCompilation>false</maven.compiler.useIncrementalCompilation>
     <maven.repo.local>${settings.localRepository}</maven.repo.local>
+    <maven.assembly.plugin.version>2.3</maven.assembly.plugin.version>
 
     <!-- Test Properties -->
     <log4j.conf.dir>${project.basedir}/src/test/resources</log4j.conf.dir>
@@ -45,6 +46,8 @@
     
<test.warehouse.dir>${project.build.directory}/warehouse</test.warehouse.dir>
     <test.warehouse.scheme>file://</test.warehouse.scheme>
     <test.forkcount>1</test.forkcount>
+    <skipITests>true</skipITests>
+    
<itest.jdbc.jars>set-this-to-colon-separated-full-path-list-of-jars-to-run-integration-tests</itest.jdbc.jars>
 
     <!-- Plugin versions -->
     <ant.contrib.version>1.0b3</ant.contrib.version>
@@ -75,6 +78,7 @@
     <log4j2.version>2.8.2</log4j2.version>
     <mockito-all.version>1.10.19</mockito-all.version>
     <protobuf.version>2.5.0</protobuf.version>
+    <sqlline.version>1.3.0</sqlline.version>
     <storage-api.version>3.0.0-SNAPSHOT</storage-api.version>
 
     <!-- Thrift properties -->
@@ -277,10 +281,21 @@
       <version>1.4.0</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>sqlline</groupId>
+      <artifactId>sqlline</artifactId>
+      <version>${sqlline.version}</version>
+    </dependency>
 
     <!-- test scope dependencies -->
 
     <dependency>
+      <groupId>com.microsoft.sqlserver</groupId>
+      <artifactId>mssql-jdbc</artifactId>
+      <version>6.2.1.jre8</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>${junit.version}</version>
@@ -292,6 +307,20 @@
       <version>${mockito-all.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+        <!-- Note, this is LGPL.  But we're only using it in a test and not 
changing it, so I
+        believe we are fine. -->
+      <groupId>org.mariadb.jdbc</groupId>
+      <artifactId>mariadb-java-client</artifactId>
+      <version>2.2.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <version>9.3-1102-jdbc41</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <profiles>
@@ -467,6 +496,21 @@
               <goal>run</goal>
             </goals>
           </execution>
+          <execution>
+            <id>setup-metastore-scripts</id>
+            <phase>process-test-resources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <mkdir dir="${test.tmp.dir}/scripts/metastore/upgrade" />
+                <copy todir="${test.tmp.dir}/scripts/metastore/upgrade">
+                  <fileset dir="${basedir}/src/main/sql/"/>
+                </copy>
+              </target>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
       <plugin>
@@ -497,11 +541,62 @@
           </execution>
         </executions>
       </plugin>
-      <!-- TODO MS-SPLIT assembly plugin -->
       <!-- TODO MS-SPLIT findbugs plugin -->
       <!-- TODO MS-SPLIT javadoc plugin -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>${maven.assembly.plugin.version}</version>
+        <executions>
+          <execution>
+            <id>assemble</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <finalName>apache-hive-metastore-${project.version}</finalName>
+              <descriptors>
+                <descriptor>src/assembly/bin.xml</descriptor>
+                <descriptor>src/assembly/src.xml</descriptor>
+              </descriptors>
+              <tarLongFileMode>gnu</tarLongFileMode>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>2.20.1</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+          <reuseForks>false</reuseForks>
+          <argLine>-Xmx2048m</argLine>
+          <failIfNoTests>false</failIfNoTests>
+          <systemPropertyVariables>
+            <log4j.debug>true</log4j.debug>
+            <java.io.tmpdir>${test.tmp.dir}</java.io.tmpdir>
+            <test.tmp.dir>${test.tmp.dir}</test.tmp.dir>
+            <hive.in.test>true</hive.in.test>
+          </systemPropertyVariables>
+          <additionalClasspathElements>
+            
<additionalClasspathElement>${log4j.conf.dir}</additionalClasspathElement>
+            
<additionalClasspathElement>${itest.jdbc.jars}</additionalClasspathElement>
+          </additionalClasspathElements>
+          <skipITs>${skipITests}</skipITs> <!-- set this to false to run these 
tests -->
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.16</version>
         <configuration>

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/assembly/bin.xml 
b/standalone-metastore/src/assembly/bin.xml
new file mode 100644
index 0000000..15b6213
--- /dev/null
+++ b/standalone-metastore/src/assembly/bin.xml
@@ -0,0 +1,126 @@
+<!--
+ 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.2";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
+
+  <id>bin</id>
+
+  <formats>
+    <format>dir</format>
+    <format>tar.gz</format>
+  </formats>
+
+  <baseDirectory>apache-hive-metastore-${project.version}-bin</baseDirectory>
+
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>lib</outputDirectory>
+      <unpack>false</unpack>
+      <useProjectArtifact>true</useProjectArtifact>
+      <useStrictFiltering>true</useStrictFiltering>
+      <useTransitiveFiltering>true</useTransitiveFiltering>
+      <excludes>
+        <exclude>org.apache.hadoop:*</exclude>
+        <exclude>org.slf4j:*</exclude>
+        <exclude>log4j:*</exclude>
+      </excludes>
+    </dependencySet>
+  </dependencySets>
+
+  <fileSets>
+    <fileSet>
+      <directory>${project.basedir}</directory>
+      <excludes>
+        <exclude>target/**</exclude>
+        <exclude>.classpath</exclude>
+        <exclude>.project</exclude>
+        <exclude>.settings/**</exclude>
+        <exclude>lib/**</exclude>
+      </excludes>
+
+      <includes>
+        <include>README.txt</include>
+        <include>LICENSE</include>
+        <include>NOTICE</include>
+      </includes>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+
+    <fileSet>
+      <directory>${project.basedir}/binary-package-licenses</directory>
+      <includes>
+        <include>/*</include>
+      </includes>
+      <excludes>
+        <exclude>/README</exclude>
+      </excludes>
+      <outputDirectory>binary-package-licenses</outputDirectory>
+    </fileSet>
+
+    <fileSet>
+      <fileMode>755</fileMode>
+      <directory>${project.basedir}/src/main/scripts</directory>
+      <includes>
+        <include>base</include>
+        <include>schematool</include>
+        <include>start-metastore</include>
+        <include>metastore-config.sh</include>
+        <include>ext/**/*</include>
+      </includes>
+      <outputDirectory>bin</outputDirectory>
+    </fileSet>
+
+    <fileSet>
+      <directory>${project.basedir}/src/main/sql</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+      <outputDirectory>scripts/metastore/upgrade</outputDirectory>
+    </fileSet>
+
+    <fileSet>
+      <directory>${project.basedir}/src/gen/thrift/gen-php</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+      <outputDirectory>lib/php/packages/hive_metastore</outputDirectory>
+    </fileSet>
+
+    <fileSet>
+      
<directory>${project.basedir}/src/gen/thrift/gen-py/hive_metastore</directory>
+      <fileMode>755</fileMode>
+       <includes>
+        <include>**/*</include>
+      </includes>
+      <outputDirectory>lib/py/hive_metastore</outputDirectory>
+    </fileSet>
+  </fileSets>
+
+  <files>
+    <file>
+      
<source>${project.basedir}/src/main/resources/metastore-log4j2.xml</source>
+      <outputDirectory>conf</outputDirectory>
+    </file>
+  </files>
+
+</assembly>
+

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/src/assembly/src.xml
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/assembly/src.xml 
b/standalone-metastore/src/assembly/src.xml
new file mode 100644
index 0000000..a240544
--- /dev/null
+++ b/standalone-metastore/src/assembly/src.xml
@@ -0,0 +1,53 @@
+<!--
+ 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.2";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
+
+  <id>src</id>
+
+  <formats>
+    <format>tar.gz</format>
+  </formats>
+
+  <baseDirectory>apache-hive-metastore-${project.version}-src</baseDirectory>
+
+  <fileSets>
+    <fileSet>
+      <directory>${project.basedir}</directory>
+
+      <excludes>
+        <exclude>target/**</exclude>
+      </excludes>
+
+      <includes>
+        <include>.checkstyle</include>
+        <include>.gitattributes</include>
+        <include>.gitignore</include>
+        <include>LICENSE</include>
+        <include>NOTICE</include>
+        <include>pom.xml</include>
+        <include>src/**/*</include>
+      </includes>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreSchemaInfo.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreSchemaInfo.java
 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreSchemaInfo.java
index be89f9b..ed4a2ef 100644
--- 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreSchemaInfo.java
+++ 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreSchemaInfo.java
@@ -55,6 +55,13 @@ public interface IMetaStoreSchemaInfo {
   String generateInitFileName(String toVersion) throws HiveMetaException;
 
   /**
+   * Get SQL script that will create the user and database for Metastore to 
use.
+   * @return filename
+   * @throws HiveMetaException if something goes wrong.
+   */
+  String getCreateUserScript() throws HiveMetaException;
+
+  /**
    * Find the directory of metastore scripts
    *
    * @return the path of directory where the sql scripts are

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
index 0c36855..3bb3643 100644
--- 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
+++ 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
@@ -38,10 +38,11 @@ import 
org.apache.hadoop.hive.metastore.utils.MetastoreVersionInfo;
 
 
 public class MetaStoreSchemaInfo implements IMetaStoreSchemaInfo {
-  protected static final String UPGRADE_FILE_PREFIX = "upgrade-";
+  private static final String UPGRADE_FILE_PREFIX = "upgrade-";
   private static final String INIT_FILE_PREFIX = "hive-schema-";
   private static final String VERSION_UPGRADE_LIST = "upgrade.order";
   private static final String PRE_UPGRADE_PREFIX = "pre-";
+  private static final String CREATE_USER_PREFIX = "create-user";
   protected final String dbType;
   private String[] hiveSchemaVersions;
   private final String hiveHome;
@@ -137,6 +138,17 @@ public class MetaStoreSchemaInfo implements 
IMetaStoreSchemaInfo {
     return initScriptName;
   }
 
+  @Override
+  public String getCreateUserScript() throws HiveMetaException {
+    String createScript = CREATE_USER_PREFIX + "." + dbType + 
SQL_FILE_EXTENSION;
+    // check if the file exists
+    if (!(new File(getMetaStoreScriptDir() + File.separatorChar +
+        createScript).exists())) {
+      throw new HiveMetaException("Unable to find create user file, expected: 
" + createScript);
+    }
+    return createScript;
+  }
+
   /**
    * Find the directory of metastore scripts
    * @return
@@ -209,7 +221,7 @@ public class MetaStoreSchemaInfo implements 
IMetaStoreSchemaInfo {
       throws HiveMetaException {
     String versionQuery;
     boolean needsQuotedIdentifier =
-        
HiveSchemaHelper.getDbCommandParser(connectionInfo.getDbType()).needsQuotedIdentifier();
+        HiveSchemaHelper.getDbCommandParser(connectionInfo.getDbType(), 
false).needsQuotedIdentifier();
     if (needsQuotedIdentifier) {
       versionQuery = "select t.\"SCHEMA_VERSION\" from \"VERSION\" t";
     } else {

http://git-wip-us.apache.org/repos/asf/hive/blob/b9526a7a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
index 08a3af5..23c5df3 100644
--- 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
+++ 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java
@@ -22,6 +22,8 @@ import com.google.common.collect.Lists;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.metastore.HiveMetaException;
 import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -34,6 +36,8 @@ import java.util.IllegalFormatException;
 import java.util.List;
 
 public class HiveSchemaHelper {
+  private static final Logger LOG = 
LoggerFactory.getLogger(HiveSchemaHelper.class);
+
   public static final String DB_DERBY = "derby";
   public static final String DB_HIVE = "hive";
   public static final String DB_MSSQL = "mssql";
@@ -56,14 +60,15 @@ public class HiveSchemaHelper {
       Configuration conf)
       throws HiveMetaException {
     try {
-      url = url == null ? getValidConfVar(
-        MetastoreConf.ConfVars.CONNECTURLKEY, conf) : url;
-      driver = driver == null ? getValidConfVar(
-        MetastoreConf.ConfVars.CONNECTION_DRIVER, conf) : driver;
+      url = url == null ? MetastoreConf.getVar(conf, 
MetastoreConf.ConfVars.CONNECTURLKEY) : url;
+      driver = driver == null ? MetastoreConf.getVar(conf, 
MetastoreConf.ConfVars.CONNECTION_DRIVER) : driver;
       if (printInfo) {
-        System.out.println("Metastore connection URL:\t " + url);
-        System.out.println("Metastore Connection Driver :\t " + driver);
-        System.out.println("Metastore connection User:\t " + userName);
+        MetastoreSchemaTool.logAndPrintToError("Metastore connection URL:\t " 
+ url);
+        MetastoreSchemaTool.logAndPrintToError("Metastore Connection Driver 
:\t " + driver);
+        MetastoreSchemaTool.logAndPrintToError("Metastore connection User:\t " 
+ userName);
+        if (MetastoreConf.getBoolVar(conf, 
MetastoreConf.ConfVars.HIVE_IN_TEST)) {
+          MetastoreSchemaTool.logAndPrintToError("Metastore connection 
Password:\t " + password);
+        }
       }
       if ((userName == null) || userName.isEmpty()) {
         throw new HiveMetaException("UserName empty ");
@@ -74,11 +79,11 @@ public class HiveSchemaHelper {
 
       // Connect using the JDBC URL and user/pass from conf
       return DriverManager.getConnection(url, userName, password);
-    } catch (IOException e) {
-      throw new HiveMetaException("Failed to get schema version.", e);
     } catch (SQLException e) {
-      throw new HiveMetaException("Failed to get schema version.", e);
+      LOG.error("Failed to connect", e);
+      throw new HiveMetaException("Failed to connect.", e);
     } catch (ClassNotFoundException e) {
+      LOG.error("Unable to find driver class", e);
       throw new HiveMetaException("Failed to load driver", e);
     }
   }
@@ -201,13 +206,17 @@ public class HiveSchemaHelper {
     private String msUsername;
     private String msPassword;
     private Configuration conf;
+    // Depending on whether we are using beeline or sqlline the line endings 
have to be handled
+    // differently.
+    private final boolean usingSqlLine;
 
     public AbstractCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
+        Configuration conf, boolean usingSqlLine) {
       setDbOpts(dbOpts);
       this.msUsername = msUsername;
       this.msPassword = msPassword;
       this.conf = conf;
+      this.usingSqlLine = usingSqlLine;
     }
 
     @Override
@@ -300,6 +309,7 @@ public class HiveSchemaHelper {
             // Now we have a complete statement, process it
             // write the line to buffer
             sb.append(currentCommand);
+            if (usingSqlLine) sb.append(";");
             sb.append(System.getProperty("line.separator"));
           }
         }
@@ -339,8 +349,8 @@ public class HiveSchemaHelper {
     private static final String DERBY_NESTING_TOKEN = "RUN";
 
     public DerbyCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
-      super(dbOpts, msUsername, msPassword, conf);
+        Configuration conf, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
     }
 
     @Override
@@ -369,9 +379,9 @@ public class HiveSchemaHelper {
     private final NestedScriptParser nestedDbCommandParser;
 
     public HiveCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf, String metaDbType) {
-      super(dbOpts, msUsername, msPassword, conf);
-      nestedDbCommandParser = getDbCommandParser(metaDbType);
+        Configuration conf, String metaDbType, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
+      nestedDbCommandParser = getDbCommandParser(metaDbType, usingSqlLine);
     }
 
     @Override
@@ -405,8 +415,8 @@ public class HiveSchemaHelper {
     private String delimiter = DEFAULT_DELIMITER;
 
     public MySqlCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
-      super(dbOpts, msUsername, msPassword, conf);
+        Configuration conf, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
     }
 
     @Override
@@ -471,8 +481,8 @@ public class HiveSchemaHelper {
     public static final String POSTGRES_SKIP_STANDARD_STRINGS_DBOPT = 
"postgres.filter.81";
 
     public PostgresCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
-      super(dbOpts, msUsername, msPassword, conf);
+        Configuration conf, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
     }
 
     @Override
@@ -514,8 +524,8 @@ public class HiveSchemaHelper {
     private static final String ORACLE_NESTING_TOKEN = "@";
 
     public OracleCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
-      super(dbOpts, msUsername, msPassword, conf);
+        Configuration conf, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
     }
 
     @Override
@@ -538,8 +548,8 @@ public class HiveSchemaHelper {
     private static final String MSSQL_NESTING_TOKEN = ":r";
 
     public MSSQLCommandParser(String dbOpts, String msUsername, String 
msPassword,
-        Configuration conf) {
-      super(dbOpts, msUsername, msPassword, conf);
+        Configuration conf, boolean usingSqlLine) {
+      super(dbOpts, msUsername, msPassword, conf, usingSqlLine);
     }
 
     @Override
@@ -557,29 +567,29 @@ public class HiveSchemaHelper {
     }
   }
 
-  public static NestedScriptParser getDbCommandParser(String dbName) {
-    return getDbCommandParser(dbName, null);
+  public static NestedScriptParser getDbCommandParser(String dbName, boolean 
usingSqlLine) {
+    return getDbCommandParser(dbName, null, usingSqlLine);
   }
 
-  public static NestedScriptParser getDbCommandParser(String dbName, String 
metaDbName) {
-    return getDbCommandParser(dbName, null, null, null, null, metaDbName);
+  public static NestedScriptParser getDbCommandParser(String dbName, String 
metaDbName, boolean usingSqlLine) {
+    return getDbCommandParser(dbName, null, null, null, null, metaDbName, 
usingSqlLine);
   }
 
   public static NestedScriptParser getDbCommandParser(String dbName,
       String dbOpts, String msUsername, String msPassword,
-      Configuration conf, String metaDbType) {
+      Configuration conf, String metaDbType, boolean usingSqlLine) {
     if (dbName.equalsIgnoreCase(DB_DERBY)) {
-      return new DerbyCommandParser(dbOpts, msUsername, msPassword, conf);
+      return new DerbyCommandParser(dbOpts, msUsername, msPassword, conf, 
usingSqlLine);
     } else if (dbName.equalsIgnoreCase(DB_HIVE)) {
-      return new HiveCommandParser(dbOpts, msUsername, msPassword, conf, 
metaDbType);
+      return new HiveCommandParser(dbOpts, msUsername, msPassword, conf, 
metaDbType, usingSqlLine);
     } else if (dbName.equalsIgnoreCase(DB_MSSQL)) {
-      return new MSSQLCommandParser(dbOpts, msUsername, msPassword, conf);
+      return new MSSQLCommandParser(dbOpts, msUsername, msPassword, conf, 
usingSqlLine);
     } else if (dbName.equalsIgnoreCase(DB_MYSQL)) {
-      return new MySqlCommandParser(dbOpts, msUsername, msPassword, conf);
+      return new MySqlCommandParser(dbOpts, msUsername, msPassword, conf, 
usingSqlLine);
     } else if (dbName.equalsIgnoreCase(DB_POSTGRACE)) {
-      return new PostgresCommandParser(dbOpts, msUsername, msPassword, conf);
+      return new PostgresCommandParser(dbOpts, msUsername, msPassword, conf, 
usingSqlLine);
     } else if (dbName.equalsIgnoreCase(DB_ORACLE)) {
-      return new OracleCommandParser(dbOpts, msUsername, msPassword, conf);
+      return new OracleCommandParser(dbOpts, msUsername, msPassword, conf, 
usingSqlLine);
     } else {
       throw new IllegalArgumentException("Unknown dbType " + dbName);
     }

Reply via email to