tomstepp commented on code in PR #36112:
URL: https://github.com/apache/beam/pull/36112#discussion_r2341667446
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Redistribute.java:
##########
@@ -190,21 +202,31 @@ public void processElement(
}
static class AssignShardFn<T> extends DoFn<T, KV<Integer, T>> {
- private int shard;
+ private int randomShard;
private @Nullable Integer numBuckets;
+ private boolean deterministicSharding;
- public AssignShardFn(@Nullable Integer numBuckets) {
+ public AssignShardFn(@Nullable Integer numBuckets, boolean
deterministicSharding) {
this.numBuckets = numBuckets;
+ this.deterministicSharding = deterministicSharding;
+ this.randomShard = 0;
}
@Setup
public void setup() {
- shard = ThreadLocalRandom.current().nextInt();
+ if (deterministicSharding) {
Review Comment:
Whoops, yes. Not that we put in separate DoFns, it is back to the original
now.
--
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]