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/10/12 19:42:28 UTC

[GitHub] [beam] robertwb commented on a change in pull request #13070: [BEAM-11020] Adding multi-window splitting to Go SDF.

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



##########
File path: sdks/go/pkg/beam/core/runtime/exec/datasource.go
##########
@@ -354,12 +354,12 @@ func (n *DataSource) Split(splits []int64, frac float64, bufSize int64) (SplitRe
 		return SplitResult{PI: s - 1, RI: s}, nil
 	}
 	// Otherwise, perform a sub-element split.
-	p, r, err := su.Split(fr)
+	ps, rs, err := su.Split(fr)
 	if err != nil {
 		return SplitResult{}, err
 	}
 
-	if p == nil || r == nil { // Unsuccessful split.
+	if len(ps) == 0 || len(rs) == 0 { // Unsuccessful split.

Review comment:
       Nit: nil seemed more explicit, why was this changed? (On that note, if one is empty must the other be empty as well, or is it OK to have one non-empty and treat that as an unsuccessful split?)

##########
File path: sdks/go/pkg/beam/io/rtrackers/offsetrange/offsetrange.go
##########
@@ -180,8 +180,8 @@ func (tracker *Tracker) TrySplit(fraction float64) (primary, residual interface{
 
 // GetProgress reports progress based on the claimed size and unclaimed sizes of the restriction.
 func (tracker *Tracker) GetProgress() (done, remaining float64) {
-	done = float64(tracker.claimed - tracker.rest.Start)
-	remaining = float64(tracker.rest.End - tracker.claimed)
+	done = float64((tracker.claimed + 1) - tracker.rest.Start)

Review comment:
       Ws his an existing bug? 

##########
File path: sdks/go/pkg/beam/core/runtime/exec/dynsplit_test.go
##########
@@ -103,11 +103,11 @@ func TestDynamicSplit(t *testing.T) {
 			// with the input coder to the path.
 			// TODO(BEAM-10579) Switch to using splittable unit's input coder
 			// once that is implemented.
-			p, err := decodeDynSplitElm(splitRes.split.PS, cdr)
+			p, err := decodeDynSplitElm(splitRes.split.PS[0], cdr)

Review comment:
       Is there a convention here you could use to assert that there's only one element while getting it, rather than let any (unexpected?) other elements in the list be dropped? 




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