scwhittle commented on code in PR #36112:
URL: https://github.com/apache/beam/pull/36112#discussion_r2352858377


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java:
##########
@@ -1845,18 +1846,21 @@ public PCollection<KafkaRecord<K, V>> expand(PBegin 
input) {
                 "Offsets committed due to usage of commitOffsetsInFinalize() 
and may not capture all work processed due to use of withRedistribute() with 
duplicates enabled");
           }
 
-          if (kafkaRead.getRedistributeNumKeys() == 0) {

Review Comment:
   I think the names maybe need to be the same for update compatability. Can we 
just leave them as they were?



##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Redistribute.java:
##########
@@ -157,8 +168,16 @@ public boolean getAllowDuplicates() {
 
     @Override
     public PCollection<T> expand(PCollection<T> input) {
-      return input
-          .apply("Pair with random key", ParDo.of(new 
AssignShardFn<>(numBuckets)))
+      PCollection<KV<Integer, T>> sharded;
+      if (deterministicSharding) {
+        sharded =
+            input.apply(
+                "Pair with deterministic key",
+                ParDo.of(new AssignDeterministicShardFn<T>(numBuckets)));

Review Comment:
   can you add a test to RedistributeTest for this?



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

Reply via email to