hanyuzheng7 commented on code in PR #14523: URL: https://github.com/apache/kafka/pull/14523#discussion_r1356042346
########## streams/src/test/java/org/apache/kafka/streams/integration/IQv2StoreIntegrationTest.java: ########## @@ -880,25 +888,113 @@ private <T> void shouldHandleWindowKeyQueries(final Function<T, Integer> extract extractor, mkSet() ); + + shouldHandleWindowKeyQuery( + 0, + Instant.ofEpochMilli(WINDOW_START), + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(5).toMillis()), + extractor, + mkSet(0) + ); + + shouldHandleWindowKeyQuery( + 1, + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(4).toMillis()), + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(11).toMillis()), + extractor, + mkSet(1) + ); + + shouldHandleWindowKeyQuery( + 2, + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(5).toMillis()), + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(12).toMillis()), + extractor, + mkSet(2) + ); + + shouldHandleWindowKeyQuery( + 3, + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(13).toMillis()), + Instant.ofEpochMilli(WINDOW_START + Duration.ofMinutes(20).toMillis()), + extractor, + mkSet(3) + ); } private <T> void shouldHandleWindowRangeQueries(final Function<T, Integer> extractor) { final long windowSize = WINDOW_SIZE.toMillis(); final long windowStart = (RECORD_TIME / windowSize) * windowSize; + // miss the window start + shouldHandleWindowRangeQuery( + Instant.ofEpochMilli(windowStart - 1), + Instant.ofEpochMilli(windowStart - 1), + extractor, + mkSet() + ); + + shouldHandleWindowRangeQuery( + Instant.ofEpochMilli(windowStart), + Instant.ofEpochMilli(windowStart), + extractor, + mkSet(0) + ); + shouldHandleWindowRangeQuery( Instant.ofEpochMilli(windowStart), - Instant.ofEpochMilli(windowStart), + Instant.ofEpochMilli(windowStart + Duration.ofMinutes(5).toMillis()), extractor, - mkSet(0, 1, 2, 3) + mkSet(0, 1) ); - // miss the window start shouldHandleWindowRangeQuery( Review Comment: https://github.com/apache/kafka/pull/14523#discussion_r1356041608 I might consider choosing the query bounds more methodically. Additionally, I'll annotate my code with comments to clarify the rationale behind my boundary selections. -- 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