zechenj18 commented on code in PR #29590:
URL: https://github.com/apache/beam/pull/29590#discussion_r1419764601


##########
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:
   For current implementation in pcollection.go, Pcollection.Up() will panic if 
WindowCoder is nil. Based on the code in makeCoderForPCollection, it only 
returns nil windowCoder with an error which should be caught before init 
pCollection node.



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

Reply via email to