From 26a30432d21831d467d2c0067279fe849ad1f669 Mon Sep 17 00:00:00 2001 From: Jack McCluskey Date: Fri, 13 May 2022 15:04:19 -0400 Subject: [PATCH] [BEAM-14469] Allow nil primary returns from TrySplit in a single-window context --- sdks/go/pkg/beam/core/runtime/exec/sdf.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sdks/go/pkg/beam/core/runtime/exec/sdf.go b/sdks/go/pkg/beam/core/runtime/exec/sdf.go index f5dd6a7431bc..8ca57625573f 100644 --- a/sdks/go/pkg/beam/core/runtime/exec/sdf.go +++ b/sdks/go/pkg/beam/core/runtime/exec/sdf.go @@ -665,15 +665,20 @@ func (n *ProcessSizedElementsAndRestrictions) singleWindowSplit(f float64, pWeSt return []*FullValue{}, []*FullValue{}, nil } - pfv, err := n.newSplitResult(p, n.elm.Windows, pWeState) - if err != nil { - return nil, nil, err + var primaryResult []*FullValue + if p != nil { + pfv, err := n.newSplitResult(p, n.elm.Windows, pWeState) + if err != nil { + return nil, nil, err + } + primaryResult = append(primaryResult, pfv) } + rfv, err := n.newSplitResult(r, n.elm.Windows, rWeState) if err != nil { return nil, nil, err } - return []*FullValue{pfv}, []*FullValue{rfv}, nil + return primaryResult, []*FullValue{rfv}, nil } // multiWindowSplit is intended for splitting multi-window elements in