You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/12/14 09:45:36 UTC

[GitHub] [kafka] vpapavas commented on a change in pull request #11598: feat: Implement range and scan queries

vpapavas commented on a change in pull request #11598:
URL: https://github.com/apache/kafka/pull/11598#discussion_r768481150



##########
File path: streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryKeyValueStore.java
##########
@@ -92,11 +93,29 @@ Position getPosition() {
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public <R> QueryResult<R> query(
         final Query<R> query,
         final PositionBound positionBound,
         final boolean collectExecutionInfo) {
 
+        if (query instanceof RangeQuery) {
+            final RangeQuery<Bytes, byte[]> typedQuery = (RangeQuery<Bytes, byte[]>) query;
+            final KeyValueIterator<Bytes, byte[]> keyValueIterator;
+            if (typedQuery.getLowerBound().isPresent() && typedQuery.getUpperBound().isPresent()) {
+                keyValueIterator = this.range(typedQuery.getLowerBound().get(), typedQuery.getUpperBound().get());
+            } else if (typedQuery.getLowerBound().isPresent()) {
+                keyValueIterator = this.range(typedQuery.getLowerBound().get(), null);
+            } else if (typedQuery.getUpperBound().isPresent()) {
+                keyValueIterator = this.range(null, typedQuery.getUpperBound().get());
+            } else {
+                keyValueIterator = this.range(null, null);
+            }

Review comment:
       Oh jeez /facepalm. Yes!!!!




-- 
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-unsubscribe@kafka.apache.org

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