Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion python_legacy/iceberg/hive/hive_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def delete_file(self, path: str) -> None:
class HiveTables(BaseMetastoreTables):
_DOT = "."
THRIFT_URIS = "hive.metastore.uris"
IPROT = "iprot"
OPROT = "oprot"

def __init__(self, conf):
super(HiveTables, self).__init__(conf)
Expand All @@ -67,9 +69,11 @@ def new_table_ops(self, conf, database, table):

def get_client(self) -> HMSClient:
from urllib.parse import urlparse
iprot = self.conf.get(HiveTables.IPROT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to put a default value? Will it still work if iprot and oprot are None value?

Copy link
Contributor Author

@puchengy puchengy Feb 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jun-he I don't think we need a default value. As when iprot is None, it will just use host and port value. https://github.com/gglanzani/hmsclient/blob/master/hmsclient/hmsclient.py#L42

oprot = self.conf.get(HiveTables.OPROT)
metastore_uri = urlparse(self.conf[HiveTables.THRIFT_URIS])

client = hmsclient.HMSClient(host=metastore_uri.hostname, port=metastore_uri.port)
client = hmsclient.HMSClient(iprot=iprot, oprot=oprot, host=metastore_uri.hostname, port=metastore_uri.port)
return client

def drop(self, database: str, table: str, purge: bool = False) -> None:
Expand Down