You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/11 04:02:10 UTC

[GitHub] [flink] zjuwangg commented on a change in pull request #18982: [FLINK-26334][datastream] Fix getWindowStartWithOffset in TimeWindow.java

zjuwangg commented on a change in pull request #18982:
URL: https://github.com/apache/flink/pull/18982#discussion_r824368943



##########
File path: flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/TimeWindow.java
##########
@@ -220,7 +220,9 @@ public TimeWindowSerializerSnapshot() {
      * @return window start
      */
     public static long getWindowStartWithOffset(long timestamp, long offset, long windowSize) {
-        return timestamp - (timestamp - offset + windowSize) % windowSize;
+        return timestamp
+                - (timestamp - offset) % windowSize
+                - (windowSize & (timestamp - offset) >> 63);

Review comment:
       `(windowSize & (timestamp - offset) >> 63` hard to understand, better to add more comments.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org