dpcollins-google commented on a change in pull request #15817:
URL: https://github.com/apache/beam/pull/15817#discussion_r740494147
##########
File path: sdks/python/apache_beam/coders/coder_impl.py
##########
@@ -310,6 +311,19 @@ def encode(self, value):
return value.SerializePartialToString(deterministic=True)
+class ProtoPlusCoderImpl(SimpleCoderImpl):
+ """For internal use only; no backwards-compatibility guarantees."""
+ def __init__(self, proto_plus_type):
+ # type: (Type[proto.Message]) -> None
+ self.proto_plus_type = proto_plus_type
+
+ def encode(self, value):
+ return value._pb.SerializePartialToString(deterministic=True)
+
+ def decode(self, value):
+ return self.proto_plus_type.deserialize(value)
Review comment:
This is the preferred way to deserialize proto plus types. I can't use
the serialize method on line 321 because it is not deterministic, so must drop
down to the protobuf interface to do so.
--
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]