Cerchie opened a new pull request, #13987:
URL: https://github.com/apache/kafka/pull/13987

   Change in response to 
[KIP-941](https://cwiki.apache.org/confluence/display/KAFKA/KIP-941%3A+Range+queries+to+accept+null+lower+and+upper+bounds).
 
   
   Changes line 57 in the RangeQuery class file from:
   
   ```
   public static <K, V> RangeQuery<K, V> withRange(final K lower, final K 
upper) {
       return new RangeQuery<>(Optional.of(lower), Optional.of(upper));
   }
   ```
   to
   ```
   public static <K, V> RangeQuery<K, V> withRange(final K lower, final K 
upper) {
        return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper));
    }
   ```
   
   Testing strategy: 
   
   Since null values can now be entered in `RangeQuery`s in order to receive 
full scans, I changed the logic defining `query` starting at [line 
1085](https://github.com/apache/kafka/blob/trunk/streams/src/test/java/org/apache/kafka/streams/integration/IQv2StoreIntegrationTest.java#L1085)
 in `IQv2StoreIntegrationTest.java` from:
   
   ```
           final RangeQuery<Integer, V> query;
           if (lower.isPresent() && upper.isPresent()) {
               query = RangeQuery.withRange(lower.get(), upper.get());
           } else if (lower.isPresent()) {
               query = RangeQuery.withLowerBound(lower.get());
           } else if (upper.isPresent()) {
               query = RangeQuery.withUpperBound(upper.get());
           } else {
               query = RangeQuery.withNoBounds();
           }
   ```
   to
   ```
   query = RangeQuery.withRange(lower.orElse(null), upper.orElse(null));
   ```
   because different combinations of `isPresent()` in the bounds is no longer 
necessary.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to