numaproj / numaflow-java

Numaflow Java SDK
Apache License 2.0
22 stars 10 forks source link

Fix: Need to investigate about Java Instant.now() time conversion to protobuf then to numaflow #75

Closed shashank10456 closed 10 months ago

shashank10456 commented 1 year ago

The new watermark value was set to 5336473980199843232 which is 120+ years ahead from now. Need to investigate how that value is being set.

jy4096 commented 1 year ago

Note: Findings...

1. When we construct a toDrop message, java SDK assigns Instant.MIN to event time, which translates to epoch is exactly “5336473980199843232”. While in Go SDK, we use time.Time{}, which translates to “-62135596800000"(0001-01-01 00:00:00 +0000 UTC) (by @KeranYang and @shashank10456 )

2. We drop messages in the whereTo func. In the source vertex with a transformer, we publish the source watermark before we call whereTo that’s why we are publishing dropped message’s watermark in source vertex

if the source vertex doesn’t have a transformer…. then there’s no toDrop tag in the original source message, so it’s not affected by "publish watermark before whereTo"

KeranYang commented 1 year ago

The issue we're encountering arises from how negative numbers are represented in computers (two's complement representation) and how we're interpreting the results.

However, when we use time.UnixMilli(), it returns the number of milliseconds since January 1, 1970 UTC. If we try to print the result directly, it's showing us a very large positive number because the two's complement representation of a large negative number looks like a large positive number if interpreted as an unsigned value.

KeranYang commented 10 months ago

The issue of dropping messages has been fixed by https://github.com/numaproj/numaflow/issues/1357 . I am closing this issue.