You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2018/06/14 22:57:32 UTC
hive git commit: HIVE-19734 : Beeline: When beeline-site.xml is
present,
beeline does not honor -n (username) and -p (password) arguments (Vaibhav
Gumashta via Thejas Nair)
Repository: hive
Updated Branches:
refs/heads/master 529bffca1 -> a06721e8e
HIVE-19734 : Beeline: When beeline-site.xml is present, beeline does not honor -n (username) and -p (password) arguments (Vaibhav Gumashta via Thejas Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a06721e8
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a06721e8
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a06721e8
Branch: refs/heads/master
Commit: a06721e8e8b246aa42f6a4d1201a9eb1c45de3e0
Parents: 529bffc
Author: Thejas M Nair <th...@hortonworks.com>
Authored: Thu Jun 14 15:57:03 2018 -0700
Committer: Thejas M Nair <th...@hortonworks.com>
Committed: Thu Jun 14 15:57:24 2018 -0700
----------------------------------------------------------------------
beeline/src/java/org/apache/hive/beeline/BeeLine.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/a06721e8/beeline/src/java/org/apache/hive/beeline/BeeLine.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/BeeLine.java b/beeline/src/java/org/apache/hive/beeline/BeeLine.java
index 860d36e..ddb774e 100644
--- a/beeline/src/java/org/apache/hive/beeline/BeeLine.java
+++ b/beeline/src/java/org/apache/hive/beeline/BeeLine.java
@@ -1104,6 +1104,11 @@ public class BeeLine implements Closeable {
}
if (beelineSiteParser.configExists()) {
+ String urlFromCommandLineOption = cl.getOptionValue("u");
+ if (urlFromCommandLineOption != null) {
+ throw new BeelineSiteParseException(
+ "Not using beeline-site.xml since the user provided the url: " + urlFromCommandLineOption);
+ }
// Get the named url from user specific config file if present
Properties userNamedConnectionURLs = beelineSiteParser.getConnectionProperties();
if (!userNamedConnectionURLs.isEmpty()) {
@@ -1126,6 +1131,14 @@ public class BeeLine implements Closeable {
}
if (jdbcConnectionParams != null) {
+ String userName = cl.getOptionValue("n");
+ if (userName != null) {
+ jdbcConnectionParams.getSessionVars().put(JdbcConnectionParams.AUTH_USER, userName);
+ }
+ String password = cl.getOptionValue("p");
+ if (password != null) {
+ jdbcConnectionParams.getSessionVars().put(JdbcConnectionParams.AUTH_PASSWD, password);
+ }
mergedConnectionProperties =
HS2ConnectionFileUtils.mergeUserConnectionPropertiesAndBeelineSite(
userConnectionProperties, jdbcConnectionParams);