From 65097022b821dbfcb24e6ba3e0895f7d9731e766 Mon Sep 17 00:00:00 2001 From: Jakub Filipek Date: Sat, 6 Jan 2024 22:23:16 -0800 Subject: [PATCH] fix binary fixed type check and add test for decimal subclass --- python/deltalake/schema.py | 2 +- python/tests/test_schema.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/deltalake/schema.py b/python/deltalake/schema.py index 8b4ceb7651..2f89cfaa2d 100644 --- a/python/deltalake/schema.py +++ b/python/deltalake/schema.py @@ -54,7 +54,7 @@ def dtype_to_delta_dtype(dtype: pa.DataType) -> pa.DataType: return pa.timestamp( "us" ) # TODO(ion): propagate also timezone information during writeonce we can properly read TZ in delta schema - elif isinstance(dtype, pa.FixedSizeBinaryType): + elif type(dtype) is pa.FixedSizeBinaryType: return pa.binary() try: return dtype_map[dtype] diff --git a/python/tests/test_schema.py b/python/tests/test_schema.py index faaf8f5897..7721774d21 100644 --- a/python/tests/test_schema.py +++ b/python/tests/test_schema.py @@ -236,6 +236,7 @@ def test_delta_schema(): pa.field("some_int", pa.uint32(), nullable=True), pa.field("some_string", pa.string(), nullable=False), pa.field("some_fixed_binary", pa.binary(5), nullable=False), + pa.field("some_decimal", pa.decimal128(10, 2), nullable=False), ] ), pa.schema( @@ -243,6 +244,7 @@ def test_delta_schema(): pa.field("some_int", pa.int32(), nullable=True), pa.field("some_string", pa.string(), nullable=False), pa.field("some_fixed_binary", pa.binary(), nullable=False), + pa.field("some_decimal", pa.decimal128(10, 2), nullable=False), ] ), False,