hanyuzheng7 commented on code in PR #14570:
URL: https://github.com/apache/kafka/pull/14570#discussion_r1379080018


##########
streams/src/test/java/org/apache/kafka/streams/integration/IQv2StoreIntegrationTest.java:
##########
@@ -1632,10 +1721,65 @@ public <V> void shouldHandleRangeQuery(
                     IllegalArgumentException.class,
                     queryResult.get(partition)::getFailureMessage
                 );
-
                 try (final KeyValueIterator<Integer, V> iterator = 
queryResult.get(partition).getResult()) {
                     while (iterator.hasNext()) {
-                        
actualValues.add(valueExtactor.apply(iterator.next().value));
+                        actualValues.add((Integer) iterator.next().value);
+                    }
+                }
+                assertThat(queryResult.get(partition).getExecutionInfo(), 
is(empty()));
+            }
+            assertThat("Result:" + result, actualValues, is(expectedValues));
+            assertThat("Result:" + result, result.getPosition(), 
is(INPUT_POSITION));
+        }
+    }
+
+    public <V> void shouldHandleTimestampedRangeQuery(
+        final Optional<Integer> lower,
+        final Optional<Integer> upper,
+        final boolean isKeyAscending,
+        final List<Integer> expectedValues) {
+
+        TimestampedRangeQuery<Integer, V> query;
+
+        query = TimestampedRangeQuery.withRange(lower.orElse(null), 
upper.orElse(null));
+
+        if (!isKeyAscending) {
+            query = query.withDescendingKeys();
+        }
+
+        final StateQueryRequest<KeyValueIterator<Integer, 
ValueAndTimestamp<V>>> request =
+            inStore(STORE_NAME)
+                .withQuery(query)
+                .withPartitions(mkSet(0, 1))
+                .withPositionBound(PositionBound.at(INPUT_POSITION));
+        final StateQueryResult<KeyValueIterator<Integer, 
ValueAndTimestamp<V>>> result =
+            IntegrationTestUtils.iqv2WaitForResult(kafkaStreams, request);
+
+        if (result.getGlobalResult() != null) {
+            fail("global tables aren't implemented");
+        } else {
+            final List<Integer> actualValues = new ArrayList<>();
+            final Map<Integer, QueryResult<KeyValueIterator<Integer, 
ValueAndTimestamp<V>>>> queryResult = result.getPartitionResults();
+            final TreeSet<Integer> partitions = new 
TreeSet<>(queryResult.keySet());
+            for (final int partition : partitions) {
+                final boolean failure = queryResult.get(partition).isFailure();
+                if (failure) {
+                    throw new AssertionError(queryResult.toString());
+                }

Review Comment:
   If we use `TimestampedRangeQuery `query KV-store, here will throw an 
exception.



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

Reply via email to