Skip to content

Commit

Permalink
fix binary fixed type check and add test for decimal subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
balbok0 committed Jan 7, 2024
1 parent 20d29d6 commit 6e36a67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/deltalake/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,15 @@ 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(
[
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,
Expand Down

0 comments on commit 6e36a67

Please sign in to comment.