robertwb commented on code in PR #23739:
URL: https://github.com/apache/beam/pull/23739#discussion_r999964603
##########
sdks/python/apache_beam/typehints/schemas.py:
##########
@@ -463,19 +463,20 @@ def named_tuple_from_schema(self, schema:
schema_pb2.Schema) -> type:
# Define a reduce function, otherwise these types can't be pickled
# (See BEAM-9574)
- def __reduce__(self):
- return (
- _hydrate_namedtuple_instance,
- (schema.SerializeToString(), tuple(self)))
-
- setattr(user_type, '__reduce__', __reduce__)
+ setattr(user_type, '__reduce__', _named_tuple_reduce)
Review Comment:
It's a little deeper than that. Cloud Pickle was trying to pickle the
`__reduce__` method of this custom type itself. (Another way to put it,
instances of this class pickled fine, but if you ever had a reference to the
class itself that caused issues.)
--
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]