ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-17271. Hive Jdbc View: Add code to include 'hive.server2.proxy.user' to connection param by default. (dipayanb)
Date Fri, 17 Jun 2016 02:29:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 92efc25eb -> f0fd29c0b


AMBARI-17271. Hive Jdbc View: Add code to include 'hive.server2.proxy.user' to connection
param by default. (dipayanb)


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

Branch: refs/heads/branch-2.4
Commit: f0fd29c0b993eb5b3c5c5ef1505773fa98dd26d8
Parents: 92efc25
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Thu Jun 16 16:07:29 2016 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Fri Jun 17 07:59:01 2016 +0530

----------------------------------------------------------------------
 .../org/apache/ambari/view/hive2/ConnectionFactory.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f0fd29c0/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionFactory.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionFactory.java
b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionFactory.java
index 2f7ffe0..7295f3a 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionFactory.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionFactory.java
@@ -46,6 +46,7 @@ public class ConnectionFactory {
   private static final String HTTP_PORT_KEY = "hive.server2.thrift.http.port";
   private static final String HIVE_TRANSPORT_MODE_KEY = "hive.server2.transport.mode";
   private static final String HTTP_PATH_KEY = "hive.server2.thrift.http.path";
+  private static final String HS2_PROXY_USER = "hive.server2.proxy.user";
 
 
   public static ConnectionConfig create(ViewContext context) {
@@ -111,10 +112,15 @@ public class ConnectionFactory {
     String sessionParams = context.getProperties().get(HIVE_SESSION_PARAMS);
 
     String formatted = String.format("jdbc:hive2://%s/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=%s",
quorum, namespace);
-    if(!Strings.isNullOrEmpty(sessionParams)){
-      return formatted + ";" + sessionParams;
+    if(Strings.isNullOrEmpty(sessionParams)){
+      sessionParams = "";
     }
-    return formatted;
+
+    if(!sessionParams.contains(HS2_PROXY_USER)) {
+      sessionParams = sessionParams + ";" + HS2_PROXY_USER + "=" + context.getUsername();
+    }
+    
+    return formatted + ";" + sessionParams;
   }
 
   private static boolean zookeeperConfigured(ViewContext context) {


Mime
View raw message