hanyuzheng7 commented on code in PR #14477:
URL: https://github.com/apache/kafka/pull/14477#discussion_r1349442196
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##########
@@ -254,17 +254,37 @@ protected <R> QueryResult<R> runRangeQuery(final Query<R>
query,
final QueryResult<R> result;
final RangeQuery<K, V> typedQuery = (RangeQuery<K, V>) query;
final RangeQuery<Bytes, byte[]> rawRangeQuery;
+ final boolean isKeyAscending = typedQuery.isKeyAscending();
if (typedQuery.getLowerBound().isPresent() &&
typedQuery.getUpperBound().isPresent()) {
- rawRangeQuery = RangeQuery.withRange(
- keyBytes(typedQuery.getLowerBound().get()),
- keyBytes(typedQuery.getUpperBound().get())
- );
+ if (isKeyAscending) {
+ rawRangeQuery = RangeQuery.withRange(
+ keyBytes(typedQuery.getLowerBound().get()),
+ keyBytes(typedQuery.getUpperBound().get())
+ );
+ } else {
+ rawRangeQuery = (RangeQuery<Bytes, byte[]>) (RangeQuery<?, ?>)
RangeQuery.withRange(
+ keyBytes(typedQuery.getLowerBound().get()),
+ keyBytes(typedQuery.getUpperBound().get())
+ ).withDescendingKeys();
Review Comment:
Thank you, I choose lift the final for rawRangeQuery and have already
updated it.
--
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]