jorisvandenbossche commented on code in PR #14238:
URL: https://github.com/apache/arrow/pull/14238#discussion_r992253095
##########
python/pyarrow/tests/test_extension_type.py:
##########
@@ -60,6 +60,22 @@ def __reduce__(self):
return UuidType, ()
+class LabelType(pa.ExtensionType):
+
+ def __init__(self):
+ super(LabelType, self).__init__(pa.string(), "label")
+
+ def __reduce__(self):
+ return LabelType, ()
+
+ def __arrow_ext_serialize__(self):
+ return b""
+
+ @classmethod
+ def __arrow_ext_deserialize__(cls, storage_type, serialized):
+ return LabelType()
Review Comment:
Either you specify the `__reduce__` subclassing PyExtensionType, or either
`_arrow_ext_serialize__`/`__arrow_ext_deserialize__` subclass ExtensionType
(see https://arrow.apache.org/docs/dev/python/extending_types.html). Since the
surrounding types are using PyExtensionType, maybe can use it for this one as
well.
(now, also when subclassing ExtensionType, it can be useful to support
pickling, but that's not needed here for the tests)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]