izzyacademy commented on a change in pull request #10926: URL: https://github.com/apache/kafka/pull/10926#discussion_r660953456
########## File path: streams/src/main/java/org/apache/kafka/streams/kstream/JoinWindows.java ########## @@ -92,32 +100,61 @@ private JoinWindows(final long beforeMs, if (beforeMs + afterMs < 0) { throw new IllegalArgumentException("Window interval (ie, beforeMs+afterMs) must not be negative."); } + + if (graceMs < 0) { + throw new IllegalArgumentException("Grace period must not be negative."); + } + this.afterMs = afterMs; this.beforeMs = beforeMs; this.graceMs = graceMs; this.enableSpuriousResultFix = enableSpuriousResultFix; } + /** + * Reject out-of-order events that are delayed more than {@code afterWindowEnd} + * after the end of its window. + * <p> + * Delay is defined as (stream_time - record_timestamp). + * + * @param timeDifference join window interval + * @param afterWindowEnd The grace period to admit out-of-order events to a window. + * @throws IllegalArgumentException if the {@code afterWindowEnd} is negative of can't be represented as {@code long milliseconds} + * @return A new JoinWindows object with the specified window definition and grace period + */ public static JoinWindows ofTimeDifferenceAndGrace(final Duration timeDifference, final Duration afterWindowEnd) { return new JoinWindows(timeDifference.toMillis(), timeDifference.toMillis(), afterWindowEnd.toMillis(), true); } + /** + * Specifies that records of the same key are joinable if their timestamps are within {@code timeDifference}, + * i.e., the timestamp of a record from the secondary stream is max {@code timeDifference} earlier or later than + * the timestamp of the record from the primary stream. Using the method implicitly sets the grace period to zero + * which means that out of order records arriving after the window end will be dropped. Review comment: Upon review, I have updated the javadocs but I dont think they can be identical in wording. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org