laraschmidt commented on a change in pull request #15540:
URL: https://github.com/apache/beam/pull/15540#discussion_r719810671



##########
File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/SimpleDoFnRunner.java
##########
@@ -1190,13 +1190,20 @@ public Timer withOutputTimestamp(Instant 
outputTimestamp) {
      * </ul>
      */
     private void setAndVerifyOutputTimestamp() {
-
       if (outputTimestamp != null) {
-        checkArgument(
-            !outputTimestamp.isBefore(elementInputTimestamp),
-            "output timestamp %s should be after input message timestamp or 
output timestamp of firing timers %s",
-            outputTimestamp,
-            elementInputTimestamp);
+        // The documentation of getAllowedTimestampSkew explicitly permits 
Long.MAX_VALUE to be used
+        // for infinite skew. Defend against underflow in that case for 
timestamps before the epoch.
+        if (fn.getAllowedTimestampSkew().getMillis() != Long.MAX_VALUE

Review comment:
       Sounds good.

##########
File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/SimpleDoFnRunner.java
##########
@@ -1190,13 +1190,20 @@ public Timer withOutputTimestamp(Instant 
outputTimestamp) {
      * </ul>
      */
     private void setAndVerifyOutputTimestamp() {
-
       if (outputTimestamp != null) {
-        checkArgument(
-            !outputTimestamp.isBefore(elementInputTimestamp),
-            "output timestamp %s should be after input message timestamp or 
output timestamp of firing timers %s",
-            outputTimestamp,
-            elementInputTimestamp);
+        // The documentation of getAllowedTimestampSkew explicitly permits 
Long.MAX_VALUE to be used
+        // for infinite skew. Defend against underflow in that case for 
timestamps before the epoch.
+        if (fn.getAllowedTimestampSkew().getMillis() != Long.MAX_VALUE

Review comment:
       Sounds good. Done.




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