[ 
https://issues.apache.org/jira/browse/BEAM-8871?focusedWorklogId=426724&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-426724
 ]

ASF GitHub Bot logged work on BEAM-8871:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Apr/20 20:23
            Start Date: 23/Apr/20 20:23
    Worklog Time Spent: 10m 
      Work Description: boyuanzz commented on a change in pull request #11454:
URL: https://github.com/apache/beam/pull/11454#discussion_r414098489



##########
File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/splittabledofn/ByteKeyRangeTracker.java
##########
@@ -64,31 +64,56 @@ 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.
+    // No split on an empty range.
+    if (NO_KEYS.equals(range)) {
+      return null;
+    }
+    // There is no more remaining work after the entire range has been claimed.
+    if (lastAttemptedKey != null && lastAttemptedKey.isEmpty()) {
+      return null;
+    }
 
-    // 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);
+    ByteKey startKey = (lastAttemptedKey == null) ? range.getStartKey() : 
next(lastAttemptedKey);
+    ByteKey endKey = range.getEndKey();

Review comment:
       When there is a split, the `range` is updated first before constructing 
residual. Thus stashing `endKey` is needed unless we create another local var 
to stash residual.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 426724)
    Time Spent: 3.5h  (was: 3h 20m)

> Add support for splitting at fractions > 0 to 
> org.apache.beam.sdk.transforms.splittabledofn.ByteKeyRangeTracker
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-8871
>                 URL: https://issues.apache.org/jira/browse/BEAM-8871
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Luke Cwik
>            Assignee: Boyuan Zhang
>            Priority: Major
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> org.apache.beam.sdk.transforms.splittabledofn.ByteKeyRangeTracker only 
> supports checkpointing



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to