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

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

                Author: ASF GitHub Bot
            Created on: 28/Oct/20 19:21
            Start Date: 28/Oct/20 19:21
    Worklog Time Spent: 10m 
      Work Description: youngoli commented on a change in pull request #13188:
URL: https://github.com/apache/beam/pull/13188#discussion_r513702465



##########
File path: sdks/go/pkg/beam/io/rtrackers/offsetrange/offsetrange_test.go
##########
@@ -63,10 +63,87 @@ func TestRestriction_EvenSplits(t *testing.T) {
                                        t.Errorf("split restriction [%v, %v] 
has unexpected size. got: %v, want: %v or %v",
                                                split.Start, split.End, size, 
min, min+1)
                                }
-                               // Check: All elements are still in a split 
restrictions. This
-                               // logic assumes that the splits are returned 
in order which
-                               // isn't guaranteed by EvenSplits, but this 
check is way easier
-                               // with the assumption.
+                               // Check: All elements are still in a split 
restriction and
+                               // the restrictions are in the appropriate 
ascending order.
+                               if split.Start != prevEnd {
+                                       t.Errorf("restriction range [%v, %v] 
missing after splits.",
+                                               prevEnd, split.Start)
+                               } else {
+                                       prevEnd = split.End
+                               }
+                       }
+                       if prevEnd != r.End {
+                               t.Errorf("restriction range [%v, %v] missing 
after splits.",
+                                       prevEnd, r.End)
+                       }
+               })
+       }
+}
+
+// TestRestriction_SizedSplits tests various splits and checks that they all
+// follow the contract for SizedSplits. This means that all restrictions match
+// the given size unless it is a remainder, and that each element is present
+// in the split restrictions.
+func TestRestriction_SizedSplits(t *testing.T) {
+       tests := []struct {
+               rest Restriction
+               size int64
+               want []Restriction
+       }{
+               {
+                       rest: Restriction{Start: 0, End: 11},
+                       size: 5,
+                       want: []Restriction{{0, 5}, {5, 10}, {10, 11}},
+               },
+               {

Review comment:
       Yeah, that seems like a good idea. I'll add one more case before merging.




----------------------------------------------------------------
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: 505880)
    Time Spent: 2h 10m  (was: 2h)

> Add an SDF version of TextIO in Go
> ----------------------------------
>
>                 Key: BEAM-11108
>                 URL: https://issues.apache.org/jira/browse/BEAM-11108
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-go
>            Reporter: Daniel Oliveira
>            Assignee: Daniel Oliveira
>            Priority: P2
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Pretty straightforward. Add an SDF equivalent to the TextIO.Read and 
> TextIO.ReadAll transforms.



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

Reply via email to