From 3aece8bc97152c53c5796bfe26c7523a2b014eac Mon Sep 17 00:00:00 2001 From: Pucheng Yang Date: Fri, 4 Feb 2022 15:01:57 -0800 Subject: [PATCH] [python legacy] Support passing customized protocol for hms client --- python_legacy/iceberg/hive/hive_tables.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python_legacy/iceberg/hive/hive_tables.py b/python_legacy/iceberg/hive/hive_tables.py index 9260a91ea644..f5360dfda2c5 100644 --- a/python_legacy/iceberg/hive/hive_tables.py +++ b/python_legacy/iceberg/hive/hive_tables.py @@ -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) @@ -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) + 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: