Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions db_dtypes/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def __arrow_ext_serialize__(self) -> bytes:
def __arrow_ext_deserialize__(cls, storage_type, serialized) -> JSONArrowType:
return JSONArrowType()

def __hash__(self) -> int:
return hash(str(self))

def to_pandas_dtype(self):
return JSONDtype()

Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ def test_json_arrow_storage_type():
assert pa.types.is_string(arrow_json_type.storage_type)


def test_json_arrow_hash():
arr = pa.array([], type=db_dtypes.JSONArrowType())
assert hash(arr.type) == hash(db_dtypes.JSONArrowType())


def test_json_arrow_constructors():
data = [
json.dumps(value, sort_keys=True, separators=(",", ":"))
Expand Down
Loading