lostluck commented on a change in pull request #13070:
URL: https://github.com/apache/beam/pull/13070#discussion_r503569540
##########
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:
Idiomatically, if there's no intended semantic real difference between
nil and empty, then checking the length is the correct way to handle that. nil
slices are also 0 length.
This catches the error case that empty slices are generated, and hints to
the compiler that there's at least 1 entry in the slices after this if block.
----------------------------------------------------------------
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]