You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ke...@apache.org on 2025/04/21 17:16:52 UTC
(iceberg-python) 01/01: fix hive client
This is an automated email from the ASF dual-hosted git repository.
kevinjqliu pushed a commit to branch hive-client-tests
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
commit 23fd19db24bebab7b97a48a8859ec656336b088a
Author: Kevin Liu <ke...@gmail.com>
AuthorDate: Mon Apr 21 10:16:33 2025 -0700
fix hive client
---
pyiceberg/catalog/hive.py | 6 ++----
tests/catalog/test_hive.py | 3 ++-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/pyiceberg/catalog/hive.py b/pyiceberg/catalog/hive.py
index 2d411cb4..75a63e0a 100644
--- a/pyiceberg/catalog/hive.py
+++ b/pyiceberg/catalog/hive.py
@@ -18,7 +18,6 @@ import getpass
import logging
import socket
import time
-from functools import cached_property
from types import TracebackType
from typing import (
TYPE_CHECKING,
@@ -160,7 +159,6 @@ class _HiveClient:
else:
return TTransport.TSaslClientTransport(socket, host=url_parts.hostname, service="hive")
- @cached_property
def _client(self) -> Client:
protocol = TBinaryProtocol.TBinaryProtocol(self._transport)
client = Client(protocol)
@@ -173,11 +171,11 @@ class _HiveClient:
if not self._transport.isOpen():
try:
self._transport.open()
- except TTransport.TTransportException:
+ except (TypeError, TTransport.TTransportException):
# reinitialize _transport
self._transport = self._init_thrift_transport()
self._transport.open()
- return self._client
+ return self._client() # recreate the client
def __exit__(
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
diff --git a/tests/catalog/test_hive.py b/tests/catalog/test_hive.py
index afb327f6..1ad2a473 100644
--- a/tests/catalog/test_hive.py
+++ b/tests/catalog/test_hive.py
@@ -45,6 +45,7 @@ from hive_metastore.ttypes import Table as HiveTable
from pyiceberg.catalog import PropertiesUpdateSummary
from pyiceberg.catalog.hive import (
+ HIVE_KERBEROS_AUTH,
LOCK_CHECK_MAX_WAIT_TIME,
LOCK_CHECK_MIN_WAIT_TIME,
LOCK_CHECK_RETRIES,
@@ -1310,7 +1311,7 @@ def test_create_hive_client_with_kerberos(
properties = {
"uri": kerberized_hive_metastore_fake_url,
"ugi": "user",
- "kerberos_auth": True,
+ HIVE_KERBEROS_AUTH: "true",
}
client = HiveCatalog._create_hive_client(properties)
assert client is not None