showuon commented on a change in pull request #11227:
URL: https://github.com/apache/kafka/pull/11227#discussion_r691052026



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/AbstractRocksDBSegmentedBytesStore.java
##########
@@ -124,8 +124,8 @@
 
         final List<S> searchSpace = keySchema.segmentsToSearch(segments, from, 
to, forward);
 
-        final Bytes binaryFrom = keySchema.lowerRange(keyFrom, from);
-        final Bytes binaryTo = keySchema.upperRange(keyTo, to);
+        final Bytes binaryFrom = keyFrom == null ? null : 
keySchema.lowerRange(keyFrom, from);
+        final Bytes binaryTo = keyTo == null ? null : 
keySchema.upperRange(keyTo, to);

Review comment:
       We already support `null` `binaryFrom` and `binaryTo` already.

##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
##########
@@ -573,12 +573,14 @@ private void setCacheKeyRange(final long 
lowerRangeEndTime, final long upperRang
                 throw new IllegalStateException("Error iterating over 
segments: segment interval has changed");
             }
 
-            if (keyFrom.equals(keyTo)) {
+            if (keyFrom != null && keyTo != null && keyFrom.equals(keyTo)) {
                 cacheKeyFrom = 
cacheFunction.cacheKey(segmentLowerRangeFixedSize(keyFrom, lowerRangeEndTime));
                 cacheKeyTo = 
cacheFunction.cacheKey(segmentUpperRangeFixedSize(keyTo, upperRangeEndTime));
             } else {
-                cacheKeyFrom = 
cacheFunction.cacheKey(keySchema.lowerRange(keyFrom, lowerRangeEndTime), 
currentSegmentId);
-                cacheKeyTo = 
cacheFunction.cacheKey(keySchema.upperRange(keyTo, timeTo), currentSegmentId);
+                cacheKeyFrom = keyFrom == null ? null :
+                    cacheFunction.cacheKey(keySchema.lowerRange(keyFrom, 
lowerRangeEndTime), currentSegmentId);
+                cacheKeyTo = keyTo == null ? null :
+                    cacheFunction.cacheKey(keySchema.upperRange(keyTo, 
timeTo), currentSegmentId);

Review comment:
       The `null` `cacheKeyFrom` and `cacheKeyTo` will use `range` query, which 
is already supported in KIP-763.

##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/SegmentIterator.java
##########
@@ -74,7 +74,7 @@ public boolean hasNext() {
             close();
             currentSegment = segments.next();
             try {
-                if (from == null || to == null) {
+                if (from == null && to == null) {
                     if (forward) {
                         currentIterator = currentSegment.all();

Review comment:
       side fix: the `all` case should be  `from == null && to == null`. 
Otherwise, call `range` method, which is already supported null range query in 
KIP-763




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