Repository: hive Updated Branches: refs/heads/master b62246540 -> 48596c33b
HIVE-16057: SchemaTool ignores --passWord argument if hadoop.security.credential.provider.path is configured (Peter Vary, reviewed by Aihua Xu and Vihang Karajgaonkar) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/48596c33 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/48596c33 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/48596c33 Branch: refs/heads/master Commit: 48596c33bb2c0563ce870a714140952ce0b1c5ef Parents: b622465 Author: Aihua Xu <[email protected]> Authored: Fri Mar 3 09:06:33 2017 -0500 Committer: Aihua Xu <[email protected]> Committed: Fri Mar 3 09:06:33 2017 -0500 ---------------------------------------------------------------------- .../org/apache/hive/beeline/HiveSchemaTool.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/48596c33/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 2c088c9..456b4ab 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, hiveConf, 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() { @@ -1102,9 +1095,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);
