Skip to content

Conversation

@AlenkaF
Copy link
Member

@AlenkaF AlenkaF commented Jun 20, 2023

Rationale for this change

ExtensionType subclasses can't be pickled if __reduce__ method isn't implemented separately.

What changes are included in this PR?

Add __reduce__ method to ExtensionType class.

Are these changes tested?

Yes, test is added to python/pyarrow/tests/test_extension_type.py.

Are there any user-facing changes?

No.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Do you know if we have test coverage for the array itself also being pickleable?

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Jun 20, 2023
@AlenkaF
Copy link
Member Author

AlenkaF commented Jun 20, 2023

Do you know if we have test coverage for the array itself also being pickleable?

I don't think so. Will check and add if necessary 👍

@AlenkaF
Copy link
Member Author

AlenkaF commented Jun 21, 2023

There is a test for ExtensionArray with PyExtensionType called test_ext_array_pickling, but no test for an ExtensionArray with ExtensionType. So I added test_generic_ext_array_pickling.

@AlenkaF
Copy link
Member Author

AlenkaF commented Jun 26, 2023

@jorisvandenbossche I plan to merge this unless there is some issue with changes from the last commit 7d72817.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jorisvandenbossche jorisvandenbossche merged commit f865fbd into apache:main Jun 27, 2023
@AlenkaF AlenkaF deleted the gh-36038-reduce-extensiontype branch June 29, 2023 09:29
@conbench-apache-arrow
Copy link

Conbench analyzed the 6 benchmark runs on commit f865fbd7.

There were 5 benchmark results indicating a performance regression:

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python] Implement __reduce__ on ExtensionType class

2 participants