derrickaw commented on code in PR #38046:
URL: https://github.com/apache/beam/pull/38046#discussion_r3086207757
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -1207,6 +1207,22 @@ def log_and_return(x):
return pcoll | "LogForTesting" >> beam.Map(log_and_return)
+ class Reshuffle(beam.PTransform):
+ """Reshuffles the elements of a PCollection.
+
+ Redistributes the elements of a PCollection to prevent fusion or balance
+ load.
+
+ Args:
+ num_buckets: (optional) Specifies the maximum random keys that would be
+ generated. If not set, a default value is used.
+ """
+ def __init__(self, num_buckets: Optional[int] = None):
+ self.num_buckets = num_buckets
+
+ def expand(self, pcoll):
+ return pcoll | beam.Reshuffle(num_buckets=self.num_buckets)
Review Comment:
num_buckets is supported -
https://github.com/apache/beam/blob/0471bb5e935905aa70c6b4ee05604318836be0c9/sdks/python/apache_beam/transforms/util.py#L1561
--
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]