Skip to content

Commit 45a9322

Browse files
committed
fix(io): use PyArrow version alias
Signed-off-by: 1fanwang <1fannnw@gmail.com>
1 parent 545cb66 commit 45a9322

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎pyiceberg/io/pyarrow.py‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,11 @@ def _initialize_fs(self, scheme: str, netloc: str | None = None) -> FileSystem:
456456

457457
def _set_tls_ca_file_path(self, client_kwargs: dict[str, Any]) -> None:
458458
if tls_ca_file_path := self.properties.get(S3_SSL_CA_CERT):
459-
from packaging import version
460-
461-
min_pyarrow_version_supporting_tls_ca_file_path = "21.0.0"
462-
if version.parse(pyarrow.__version__) < version.parse(min_pyarrow_version_supporting_tls_ca_file_path):
459+
min_pyarrow_version_supporting_tls_ca_file_path = (21, 0)
460+
if tuple(map(int, pa.__version__.split(".")[:2])) < min_pyarrow_version_supporting_tls_ca_file_path:
463461
raise ImportError(
464-
f"pyarrow version >= {min_pyarrow_version_supporting_tls_ca_file_path} required for "
465-
f"S3FileSystem tls_ca_file_path support, but found version {pyarrow.__version__}."
462+
"pyarrow version >= 21.0.0 required for S3FileSystem tls_ca_file_path support, "
463+
f"but found version {pa.__version__}."
466464
)
467465
client_kwargs["tls_ca_file_path"] = tls_ca_file_path
468466

‎tests/io/test_pyarrow.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def test_pyarrow_s3_ssl_ca_cert_requires_supported_pyarrow_version() -> None:
410410
}
411411

412412
with (
413-
patch("pyiceberg.io.pyarrow.pyarrow.__version__", "20.0.0"),
413+
patch("pyiceberg.io.pyarrow.pa.__version__", "20.0.0"),
414414
patch("pyarrow.fs.S3FileSystem"),
415415
patch("pyarrow.fs.resolve_s3_region") as mock_s3_region_resolver,
416416
):

0 commit comments

Comments
 (0)