Browse Source

HUE-8904 [oozie] Fix hive operations when using http thrift

Jean-Francois Desjeans Gauthier 6 năm trước cách đây
mục cha
commit
15397db37b
2 tập tin đã thay đổi với 10 bổ sung1 xóa
  1. 6 1
      apps/beeswax/src/beeswax/hive_site.py
  2. 4 0
      apps/beeswax/src/beeswax/tests.py

+ 6 - 1
apps/beeswax/src/beeswax/hive_site.py

@@ -139,7 +139,8 @@ def hiveserver2_impersonation_enabled():
   return get_conf().get(_CNF_HIVESERVER2_IMPERSONATION, 'TRUE').upper() == 'TRUE'
 
 def hiveserver2_jdbc_url():
-  urlbase = 'jdbc:hive2://%s:%s/default' % (beeswax.conf.HIVE_SERVER_HOST.get(), beeswax.conf.HIVE_SERVER_PORT.get())
+  is_transport_mode_http = hiveserver2_transport_mode() == 'HTTP'
+  urlbase = 'jdbc:hive2://%s:%s/default' % (beeswax.conf.HIVE_SERVER_HOST.get(), hiveserver2_thrift_http_port() if is_transport_mode_http else beeswax.conf.HIVE_SERVER_PORT.get())
 
   if get_conf().get(_CNF_HIVESERVER2_USE_SSL, 'FALSE').upper() == 'TRUE':
     urlbase += ';ssl=true'
@@ -152,6 +153,10 @@ def hiveserver2_jdbc_url():
     if get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PASSWORD):
       urlbase += ';trustStorePassword=%s' % get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PASSWORD)
 
+  if is_transport_mode_http:
+    urlbase += ';transportMode=http'
+    urlbase += ';httpPath=%s' % hiveserver2_thrift_http_path()
+
   return urlbase
 
 

+ 4 - 0
apps/beeswax/src/beeswax/tests.py

@@ -3456,6 +3456,10 @@ def test_hiveserver2_jdbc_url():
     beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_USE_SSL] = 'FALSE'
     url = hiveserver2_jdbc_url()
     assert_equal(url, 'jdbc:hive2://server-with-ssl-enabled.com:10000/default')
+
+    beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_TRANSPORT_MODE] = 'HTTP'
+    url = hiveserver2_jdbc_url()
+    assert_equal(url, 'jdbc:hive2://server-with-ssl-enabled.com:10001/default;transportMode=http;httpPath=cliservice')
   finally:
     beeswax.hive_site.reset()
     hadoop.ssl_client_site.reset()