hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aihu...@apache.org
Subject [2/2] hive git commit: HIVE-16057: SchemaTool ignores --passWord argument if hadoop.security.credential.provider.path is configured (Peter Vary, reviewed by Aihua Xu)
Date Thu, 30 Mar 2017 18:16:38 GMT
HIVE-16057: SchemaTool ignores --passWord argument if hadoop.security.credential.provider.path
is configured (Peter Vary, reviewed by Aihua Xu)


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

Branch: refs/heads/master
Commit: e339d144425f01bad2aaab1367bded15f5dbaaba
Parents: 191302c
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Thu Mar 30 14:08:08 2017 -0400
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Thu Mar 30 14:08:08 2017 -0400

----------------------------------------------------------------------
 .../org/apache/hive/beeline/HiveSchemaTool.java    | 17 ++++++++++-------
 .../org/apache/hive/beeline/TestSchemaTool.java    |  5 +++++
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e339d144/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 4255ebd..7dd4d5f 100644
--- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
+++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
@@ -90,13 +90,6 @@ public class HiveSchemaTool {
     this.hiveConf = hiveConf;
     this.dbType = dbType;
     this.metaStoreSchemaInfo = new MetaStoreSchemaInfo(hiveHome, dbType);
-    userName = hiveConf.get(ConfVars.METASTORE_CONNECTION_USER_NAME.varname);
-    try {
-      passWord = ShimLoader.getHadoopShims().getPassword(hiveConf,
-          HiveConf.ConfVars.METASTOREPWD.varname);
-    } catch (IOException err) {
-      throw new HiveMetaException("Error getting metastore password", err);
-    }
   }
 
   public HiveConf getHiveConf() {
@@ -1118,9 +1111,19 @@ public class HiveSchemaTool {
 
       if (line.hasOption("userName")) {
         schemaTool.setUserName(line.getOptionValue("userName"));
+      } else {
+        schemaTool.setUserName(
+            schemaTool.getHiveConf().get(ConfVars.METASTORE_CONNECTION_USER_NAME.varname));
       }
       if (line.hasOption("passWord")) {
         schemaTool.setPassWord(line.getOptionValue("passWord"));
+      } else {
+        try {
+          schemaTool.setPassWord(ShimLoader.getHadoopShims().getPassword(schemaTool.getHiveConf(),
+              HiveConf.ConfVars.METASTOREPWD.varname));
+        } catch (IOException err) {
+          throw new HiveMetaException("Error getting metastore password", err);
+        }
       }
       if (line.hasOption("dryRun")) {
         schemaTool.setDryRun(true);

http://git-wip-us.apache.org/repos/asf/hive/blob/e339d144/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 22630b9..57bbe0e 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
@@ -36,6 +36,7 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.HiveMetaException;
 import org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo;
+import org.apache.hadoop.hive.shims.ShimLoader;
 import org.apache.hive.beeline.HiveSchemaHelper.NestedScriptParser;
 import org.apache.hive.beeline.HiveSchemaHelper.PostgresCommandParser;
 
@@ -57,6 +58,10 @@ public class TestSchemaTool extends TestCase {
     hiveConf = new HiveConf(this.getClass());
     schemaTool = new HiveSchemaTool(
         System.getProperty("test.tmp.dir", "target/tmp"), hiveConf, "derby");
+    schemaTool.setUserName(
+        schemaTool.getHiveConf().get(HiveConf.ConfVars.METASTORE_CONNECTION_USER_NAME.varname));
+    schemaTool.setPassWord(ShimLoader.getHadoopShims().getPassword(schemaTool.getHiveConf(),
+          HiveConf.ConfVars.METASTOREPWD.varname));
     System.setProperty("beeLine.system.exit", "true");
     errStream = System.err;
     outStream = System.out;


Mime
View raw message