youngoli commented on a change in pull request #12350:
URL: https://github.com/apache/beam/pull/12350#discussion_r459851264
##########
File path: sdks/go/pkg/beam/core/runtime/exec/sdf.go
##########
@@ -325,6 +337,63 @@ func (n *ProcessSizedElementsAndRestrictions) String()
string {
return fmt.Sprintf("SDF.ProcessSizedElementsAndRestrictions[%v] UID:%v
Out:%v", path.Base(n.PDo.Fn.Name()), n.PDo.ID(), IDs(n.PDo.Out...))
}
+type SplittableUnit interface {
+ Split(fraction float64) (primary, residual *FullValue, err error)
+ GetProgress() float64
+ GetTransformId() string
+ GetMainInputId() string
+}
+
+func (n *ProcessSizedElementsAndRestrictions) Split(f float64) (*FullValue,
*FullValue, error) {
+ if n.rt == nil {
+ err := errors.New("Restriction tracker missing.")
+ return nil, nil, errors.WithContext(err, "Attempting split in
ProcessSizedElementsAndRestrictions")
+ }
+ p, r, err := n.rt.TrySplit(f)
+ if err != nil {
+ return nil, nil, errors.WithContext(err, "Attempting split in
ProcessSizedElementsAndRestrictions")
+ }
+
+ var pfv, rfv *FullValue
+ if r != nil { // If r is nil then the split failed/returned an empty
residual.
Review comment:
Agreed, done.
----------------------------------------------------------------
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]