Skip to content

Commit

Permalink
fix(pyarrow): map date type to arrow date32 not date64
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Feb 13, 2024
1 parent c68549a commit 2da6794
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ibis/formats/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def from_ibis(cls, dtype: dt.DataType) -> pa.DataType:
elif dtype.is_time():
return pa.time64("ns")
elif dtype.is_date():
return pa.date64()
return pa.date32()
elif dtype.is_array():
value_field = pa.field(
"item",
Expand Down
6 changes: 3 additions & 3 deletions ibis/formats/tests/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test_roundtripable_types(arrow_type):
(pa.decimal256(38, 5), dt.Decimal(38, 5, nullable=False), pa.decimal128(38, 5)),
(pa.decimal256(39, 6), dt.Decimal(39, 6, nullable=False), pa.decimal256(39, 6)),
(pa.decimal256(76, 6), dt.Decimal(76, 6, nullable=False), pa.decimal256(76, 6)),
(pa.date32(), dt.Date(nullable=False), pa.date64()),
(pa.date64(), dt.Date(nullable=False), pa.date64()),
(pa.date32(), dt.Date(nullable=False), pa.date32()),
(pa.date64(), dt.Date(nullable=False), pa.date32()),
(pa.time32("s"), dt.Time(nullable=False), pa.time64("ns")),
(pa.time32("ms"), dt.Time(nullable=False), pa.time64("ns")),
(pa.time64("us"), dt.Time(nullable=False), pa.time64("ns")),
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_dtype_from_nullable_list_type(value_nullable, list_nullable):
assert restored_type.value_field.nullable is value_nullable


@pytest.mark.parametrize("value_type", [pa.string(), pa.date64()])
@pytest.mark.parametrize("value_type", [pa.string(), pa.date32()])
def test_dtype_from_dictionary_type(value_type):
dict_type = pa.dictionary(pa.int32(), value_type)
ibis_type = PyArrowType.to_ibis(dict_type)
Expand Down

0 comments on commit 2da6794

Please sign in to comment.