Skip to content

Commit

Permalink
[beeswax][compute] set username for computes/hive connection
Browse files Browse the repository at this point in the history
The regular beeswax/hive connections set `hive.server2.proxy.user` to
the current username but it was missing for the compute based
connections. This commit adds a flag `is_compute` to query_server_config
for compute/connector based configs.

Impala based connections were already setting the correct usernames on
the connection.

Change-Id: I23521a5c1cf3d650da551b343d18820862feb7c5
  • Loading branch information
amitsrivastava committed Oct 11, 2023
1 parent 3ce4adb commit 2ab1de1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/beeswax/src/beeswax/server/dbms.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def get_query_server_config_via_connector(connector):
impersonation_enabled = hiveserver2_impersonation_enabled()

return {
'is_compute': True,
'dialect': compute['dialect'],
'server_name': compute_name,
'server_host': server_host,
Expand Down
3 changes: 2 additions & 1 deletion apps/beeswax/src/beeswax/server/hive_server2_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ def open_session(self, user):
if self.query_server.get('dialect') == 'impala': # Only when Impala accepts it
kwargs['configuration'].update({'impala.doas.user': user.username})

if self.query_server['server_name'] == 'beeswax': # All the time
if self.query_server['server_name'] == 'beeswax' or \
(self.query_server.get('is_compute') and self.query_server.get('dialect') == 'hive'):
kwargs['configuration'].update({'hive.server2.proxy.user': user.username})
xff_header = json.loads(user.userprofile.json_data).get('X-Forwarded-For', None)
if xff_header and ENABLE_XFF_FOR_HIVE_IMPALA.get():
Expand Down

0 comments on commit 2ab1de1

Please sign in to comment.