[
https://issues.apache.org/jira/browse/BEAM-8871?focusedWorklogId=426736&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-426736
]
ASF GitHub Bot logged work on BEAM-8871:
----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Apr/20 20:53
Start Date: 23/Apr/20 20:53
Worklog Time Spent: 10m
Work Description: boyuanzz commented on a change in pull request #11454:
URL: https://github.com/apache/beam/pull/11454#discussion_r414116060
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/splittabledofn/ByteKeyRangeTrackerTest.java
##########
@@ -152,9 +158,35 @@ public void testCheckpointAfterLastUsingEmptyKey() throws
Exception {
assertTrue(tracker.tryClaim(ByteKey.of(0x90)));
assertTrue(tracker.tryClaim(ByteKey.of(0xa0)));
assertFalse(tracker.tryClaim(ByteKey.EMPTY));
- ByteKeyRange checkpoint = tracker.trySplit(0).getResidual();
+ assertNull(tracker.trySplit(0));
assertEquals(ByteKeyRange.of(ByteKey.of(0x10), ByteKey.of(0xc0)),
tracker.currentRestriction());
- assertEquals(ByteKeyRangeTracker.NO_KEYS, checkpoint);
+ tracker.checkDone();
+ }
+
+ @Test
+ public void testTrySplit() throws Exception {
+ ByteKeyRangeTracker tracker =
+ ByteKeyRangeTracker.of(ByteKeyRange.of(ByteKey.EMPTY,
ByteKey.of(0x80)));
+ SplitResult<ByteKeyRange> res = tracker.trySplit(0.5);
+ assertKeyRangeEqualExceptPadding(
+ ByteKeyRange.of(ByteKey.EMPTY, ByteKey.of(0x40)), res.getPrimary());
+ assertKeyRangeEqualExceptPadding(
+ ByteKeyRange.of(ByteKey.of(0x40), ByteKey.of(0x80)),
res.getResidual());
+ tracker.tryClaim(ByteKey.of(0x00));
+ res = tracker.trySplit(0.5);
+ assertKeyRangeEqualExceptPadding(
+ ByteKeyRange.of(ByteKey.of(0x00), ByteKey.of(0x20)), res.getPrimary());
Review comment:
It should be `EMPTY`. Thanks for catching 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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 426736)
Time Spent: 4h 10m (was: 4h)
> 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: 4h 10m
> Remaining Estimate: 0h
>
> org.apache.beam.sdk.transforms.splittabledofn.ByteKeyRangeTracker only
> supports checkpointing
--
This message was sent by Atlassian Jira
(v8.3.4#803005)