nehsyc commented on a change in pull request #13405:
URL: https://github.com/apache/beam/pull/13405#discussion_r538925045
##########
File path: sdks/python/apache_beam/transforms/util.py
##########
@@ -825,7 +827,60 @@ def expand(self, pcoll):
key_value[1]))
return (
sharded_pcoll
- | GroupIntoBatches(self.batch_size,
self.max_buffering_duration_secs))
+ | GroupIntoBatches(
+ self.params.batch_size, self.params.max_buffering_duration_secs))
+
+ def to_runner_api_parameter(
+ self,
+ unused_context # type: PipelineContext
+ ): # type: (...) -> Tuple[str,
beam_runner_api_pb2.GroupIntoBatchesPayload]
+ return (
+ common_urns.composites.GROUP_INTO_BATCHES_WITH_SHARDED_KEY.urn,
+ self.params.get_payload())
+
+ @staticmethod
+ @PTransform.register_urn(
+ common_urns.composites.GROUP_INTO_BATCHES_WITH_SHARDED_KEY.urn,
+ beam_runner_api_pb2.GroupIntoBatchesPayload)
+ def from_runner_api_parameter(unused_ptransform, proto, unused_context):
+ return GroupIntoBatches.WithShardedKey(
+ *GroupIntoBatchesParams.parse_payload(proto))
+
+
+class GroupIntoBatchesParams:
Review comment:
Done. I also changed the class name to `_GroupIntoBatchesParams`; it's
not intended to be "public" and referenced outside of this file.
----------------------------------------------------------------
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]