Skip to content

[Python] Schema not hashable when metadata is set #47602

@jonded94

Description

@jonded94

Describe the bug, including details regarding any error messages, version, and platform.

In Python, pyarrow.Schema before was not hashable when it has metadata set.

>>> import pyarrow
>>> schema = pyarrow.schema([], metadata={b"1": b"1"})
>>> hash(schema)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyarrow/types.pxi", line 2921, in pyarrow.lib.Schema.__hash__
TypeError: unhashable type: 'dict'

This is because the metadata (which is a dict) was tried to be hashed as-is, which doesn't work.

Corresponding fix is contianed in this PR:
#47601

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions