riteshghorse commented on code in PR #23222:
URL: https://github.com/apache/beam/pull/23222#discussion_r970839705
##########
sdks/go/pkg/beam/core/runtime/exec/coder.go:
##########
@@ -1208,3 +1213,91 @@ func DecodeWindowedValueHeader(dec WindowDecoder, r
io.Reader) ([]typex.Window,
return ws, t, pn, nil
}
+
+// EncodeTimer encodes a typex.TimerMap into a byte stream.
+func EncodeTimer(elm ElementEncoder, tm typex.TimerMap, w io.Writer) error {
+ var b bytes.Buffer
+
+ elm.Encode(&FullValue{Elm: tm.Key}, &b)
+
+ if err := coder.EncodeStringUTF8(tm.Tag, &b); err != nil {
+ return errors.WithContext(err, "error encoding tag")
+ }
+
+ if _, err := ioutilx.WriteUnsafe(&b, tm.Windows); err != nil {
+ return err
+ }
+
+ if err := coder.EncodeBool(tm.Clear, &b); err != nil {
+ return errors.WithContext(err, "error encoding key")
+ }
+
+ if !tm.Clear {
+ if err := coder.EncodeVarInt(tm.FireTimestamp, &b); err != nil {
Review Comment:
Thanks for catching this. The big endian integer got me the other way.
--
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]