udim commented on a change in pull request #14916:
URL: https://github.com/apache/beam/pull/14916#discussion_r644141497
##########
File path: sdks/python/apache_beam/io/iobase.py
##########
@@ -1226,17 +1226,13 @@ def _finalize_write(
class _RoundRobinKeyFn(core.DoFn):
- def __init__(self, count):
- # type: (int) -> None
- self.count = count
-
def start_bundle(self):
- self.counter = random.randint(0, self.count - 1)
+ self.counter = None
- def process(self, element):
- self.counter += 1
- if self.counter >= self.count:
- self.counter -= self.count
+ def process(self, element, count):
+ if self.counter is None:
+ self.counter = int(random.random() * count)
Review comment:
```suggestion
self.counter = random.randrange(0, count)
```
--
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]