From b4209603d0f999126e02b21f84dbb1425c8165c4 Mon Sep 17 00:00:00 2001 From: Sung Yun <107272191+syun64@users.noreply.github.com> Date: Sun, 9 Jun 2024 17:31:43 +0000 Subject: [PATCH] avoid upcasting to large_binary --- pyiceberg/io/pyarrow.py | 2 +- tests/conftest.py | 2 +- tests/io/test_pyarrow.py | 2 +- tests/io/test_pyarrow_visitor.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyiceberg/io/pyarrow.py b/pyiceberg/io/pyarrow.py index 71925c27cd..114d0aa6cd 100644 --- a/pyiceberg/io/pyarrow.py +++ b/pyiceberg/io/pyarrow.py @@ -554,7 +554,7 @@ def visit_uuid(self, _: UUIDType) -> pa.DataType: return pa.binary(16) def visit_binary(self, _: BinaryType) -> pa.DataType: - return pa.large_binary() + return pa.binary() def _convert_scalar(value: Any, iceberg_type: IcebergType) -> pa.scalar: diff --git a/tests/conftest.py b/tests/conftest.py index d3f23689a2..244b6f8883 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2131,7 +2131,7 @@ def pa_schema() -> "pa.Schema": # ("time", pa.time64("us")), # Not natively supported by Arrow # ("uuid", pa.fixed(16)), - ("binary", pa.large_binary()), + ("binary", pa.binary()), ("fixed", pa.binary(16)), ]) diff --git a/tests/io/test_pyarrow.py b/tests/io/test_pyarrow.py index baa9e30824..bda28f76e5 100644 --- a/tests/io/test_pyarrow.py +++ b/tests/io/test_pyarrow.py @@ -491,7 +491,7 @@ def test_string_type_to_pyarrow() -> None: def test_binary_type_to_pyarrow() -> None: iceberg_type = BinaryType() - assert visit(iceberg_type, _ConvertToArrowSchema()) == pa.large_binary() + assert visit(iceberg_type, _ConvertToArrowSchema()) == pa.binary() def test_struct_type_to_pyarrow(table_schema_simple: Schema) -> None: diff --git a/tests/io/test_pyarrow_visitor.py b/tests/io/test_pyarrow_visitor.py index c8571dacf1..719ebc4293 100644 --- a/tests/io/test_pyarrow_visitor.py +++ b/tests/io/test_pyarrow_visitor.py @@ -216,7 +216,7 @@ def test_pyarrow_string_to_iceberg() -> None: def test_pyarrow_variable_binary_to_iceberg() -> None: - pyarrow_type = pa.large_binary() + pyarrow_type = pa.binary() converted_iceberg_type = visit_pyarrow(pyarrow_type, _ConvertToIceberg()) assert converted_iceberg_type == BinaryType() assert visit(converted_iceberg_type, _ConvertToArrowSchema()) == pyarrow_type