Skip to content

Commit

Permalink
[hive] Use the right port number for server config according to thrif…
Browse files Browse the repository at this point in the history
…t transport mode
  • Loading branch information
wing2fly committed Sep 4, 2024
1 parent 09d13d0 commit bc62813
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/beeswax/src/beeswax/server/dbms.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ def get_query_server_config(name='beeswax', connector=None):
})
)
else:
cache.set("hiveserver2", json.dumps({"host": HIVE_SERVER_HOST.get(), "port": HIVE_HTTP_THRIFT_PORT.get()}))
cache.set("hiveserver2", json.dumps({
"host": HIVE_SERVER_HOST.get(),
"port": HIVE_HTTP_THRIFT_PORT.get() if hiveserver2_transport_mode() == 'HTTP' else HIVE_SERVER_PORT.get()
}))
else:
if HIVE_DISCOVERY_HS2.get():
# Replace ActiveEndpoint if the current HS2 is down
Expand Down Expand Up @@ -268,7 +271,10 @@ def get_query_server_config(name='beeswax', connector=None):
raise PopupException(_('Currently there are no HiveServer2 running'))
else:
# Setting hs2 cache in-case there is no HS2 discovery
cache.set("hiveserver2", json.dumps({"host": HIVE_SERVER_HOST.get(), "port": HIVE_HTTP_THRIFT_PORT.get()}))
cache.set("hiveserver2", json.dumps({
"host": HIVE_SERVER_HOST.get(),
"port": HIVE_HTTP_THRIFT_PORT.get() if hiveserver2_transport_mode() == 'HTTP' else HIVE_SERVER_PORT.get()
}))

activeEndpoint = json.loads(cache.get("hiveserver2"))

Expand All @@ -292,7 +298,7 @@ def get_query_server_config(name='beeswax', connector=None):
query_server = {
'server_name': 'beeswax' if name != 'hplsql' else 'hplsql',
'server_host': activeEndpoint["host"],
'server_port': LLAP_SERVER_PORT.get() if name == 'llap' else activeEndpoint["port"],
'server_port': LLAP_SERVER_PORT.get() if name == 'llap' else int(activeEndpoint["port"]),
'principal': kerberos_principal,
'http_url': '%(protocol)s://%(host)s:%(port)s/%(end_point)s' % {
'protocol': 'https' if hiveserver2_use_ssl() else 'http',
Expand Down

0 comments on commit bc62813

Please sign in to comment.