lukecwik commented on a change in pull request #13069:
URL: https://github.com/apache/beam/pull/13069#discussion_r504841758



##########
File path: sdks/python/apache_beam/coders/coder_impl.py
##########
@@ -1365,3 +1366,38 @@ def estimate_size(self, value, nested=False):
     # type: (Any, bool) -> int
     value_size = self._value_coder.estimate_size(value)
     return get_varint_size(value_size) + value_size
+
+
+class ShardedKeyCoderImpl(StreamCoderImpl):
+  """For internal use only; no backwards-compatibility guarantees.
+
+  A coder for sharded user keys.
+
+  The encoding and decoding should follow the order:
+      length of shard id byte string
+      shard id byte string
+      encoded user key
+  """
+  def __init__(self, key_coder_impl):
+    self._shard_id_coder_impl = LengthPrefixCoderImpl(BytesCoderImpl())

Review comment:
       I was under the impression that nested=True would have the 
BytesCoderImpl have the length written by the OutputStream:
   
https://github.com/apache/beam/blob/c921b0c8384809dbcab3edcd5007e92da25067c6/sdks/python/apache_beam/coders/slow_stream.py#L45




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to