You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/04/22 23:59:50 UTC

[GitHub] [beam] robertwb commented on a change in pull request #11454: [BEAM-8871] Support trySplit for ByteKeyRangeTracker

robertwb commented on a change in pull request #11454:
URL: https://github.com/apache/beam/pull/11454#discussion_r413412898



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/splittabledofn/ByteKeyRangeTracker.java
##########
@@ -64,31 +64,38 @@ public ByteKeyRange currentRestriction() {
 
   @Override
   public SplitResult<ByteKeyRange> trySplit(double fractionOfRemainder) {
-    // TODO(BEAM-8871): Add support for splitting off a fixed amount of work for this restriction
-    // instead of only supporting checkpointing.
-
-    // If we haven't done any work, we should return the original range we were processing
-    // as the checkpoint.
-    if (lastAttemptedKey == null) {
-      ByteKeyRange rval = range;
-      // We update our current range to an interval that contains no elements.
-      range = NO_KEYS;
-      return SplitResult.of(range, rval);
+    // No split on an empty range.
+    if (NO_KEYS.equals(range)) {
+      return null;

Review comment:
       Semantically, what we want to return here is the empty split. It is important that the infrastructure be able to recognize and empty split (of type RestrictionT) so that it won't try to further split/reschedule it. One could create a new SplitResult type for Java, but I'm unconvinced it's worth its weight. (Certainly None/nil feel more appropriate for Python and Go respectively.)




----------------------------------------------------------------
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:
users@infra.apache.org