lostluck commented on code in PR #29590:
URL: https://github.com/apache/beam/pull/29590#discussion_r1419777818
##########
sdks/go/pkg/beam/core/runtime/exec/pcollection.go:
##########
@@ -93,9 +99,19 @@ func (p *PCollection) ProcessElement(ctx context.Context,
elm *FullValue, values
} else {
p.nextSampleIdx = cur + p.r.Int63n(cur/10+2) + 1
}
- var w byteCounter
- p.elementCoder.Encode(elm, &w)
- p.addSize(int64(w.count))
+
+ if p.dataSampler == nil {
+ var w byteCounter
+ p.elementCoder.Encode(elm, &w)
+ p.addSize(int64(w.count))
+ } else {
+ var buf bytes.Buffer
+ EncodeWindowedValueHeader(p.windowCoder, elm.Windows,
elm.Timestamp, elm.Pane, &buf)
+ winSize := buf.Len()
+ p.elementCoder.Encode(elm, &buf)
Review Comment:
By definition, all PCollections in Beam are WindowValue encoded, so it's an
error for there not to be a windowed value coder. The panic exists for
debugging mistakes like that early, rather than later in processing.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]