[ 
https://issues.apache.org/jira/browse/BEAM-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122614#comment-16122614
 ] 

ASF GitHub Bot commented on BEAM-2711:
--------------------------------------

GitHub user chamikaramj opened a pull request:

    https://github.com/apache/beam/pull/3715

    [BEAM-2711] Updates ByteKeyRangeTracker so that getFractionConsumed() does 
not fail for completed trackers

    After this update:
    * getFractionConsumed() returns 1.0 after markDone() is set.
    * getFractionConsumed() returns 1.0 after tryReturnRecordAt() is invoked 
for a position that is larger than or equal to the end key.
    
    This is similar to how getFractionConsumed() method of OffsetRangeTracker 
is implemented.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/chamikaramj/beam key_range_progress

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/beam/pull/3715.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3715
    
----
commit ba08ec3bfb1eead06772945ab888d910ffe7d436
Author: chamik...@google.com <chamik...@google.com>
Date:   2017-08-11T00:35:37Z

    Updates ByteKeyRangeTracker so that getFractionConsumed() does not fail for 
completed trackers.
    
    After this update:
    * getFractionConsumed() returns 1.0 after markDone() is set.
    * getFractionConsumed() returns 1.0 after tryReturnRecordAt() is invoked 
for a position that is larger than or equal to the end key.
    
    This is similar to how getFractionConsumed() method of OffsetRangeTracker 
is implemented.

----


> ByteKeyRangeTracker.getFractionConsumed() fails when out of range positions 
> are claimed
> ---------------------------------------------------------------------------------------
>
>                 Key: BEAM-2711
>                 URL: https://issues.apache.org/jira/browse/BEAM-2711
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Chamikara Jayalath
>            Assignee: Chamikara Jayalath
>
> ByteKeyRangeTracker.getFractionConsumed() invokes 
> range.estimateFractionForKey(position) at following location.
> https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/io/range/ByteKeyRangeTracker.java#L127
> This invocation fails for out of range positions.
> https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/io/range/ByteKeyRange.java#L170
> But ByteKeyRangeTracker may accept out of range positions at following 
> location.
> https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/io/range/ByteKeyRangeTracker.java#L80
> We can fix this by updating ByteKeyRangeTracker.getFractionConsumed() to 
> return 1.0 for positions that are larger than the stop position, similar to 
> OffsetRangeTracker.
> https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/io/range/OffsetRangeTracker.java#L176



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to