Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-07 Thread via GitHub


mjsax merged PR #14907:
URL: https://github.com/apache/kafka/pull/14907


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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-07 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1419763796


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##
@@ -254,12 +255,12 @@ private  QueryResult runRangeQuery(final Query 
query,
 final QueryResult result;
 final RangeQuery typedQuery = (RangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+final ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.getLowerBound().orElse(null)),
 keyBytes(typedQuery.getUpperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   This is covered with the previous PR, right?



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-07 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1419762701


##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -100,17 +99,25 @@ public boolean isKeyAscending() {
  * @return a new RangeQuery instance with descending flag set.
  */
 public TimestampedRangeQuery withDescendingKeys() {
-return new TimestampedRangeQuery<>(this.lower, this.upper, false);
+return new TimestampedRangeQuery<>(this.lower, this.upper, 
ResultOrder.DESCENDING);
 }
 
+/**
+ * Set the query to return the serialized byte[] of the keys in Ascending 
order.

Review Comment:
   ```suggestion
* Set the query to return the serialized byte[] of the keys in 
ascending order.
   ```



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).

Review Comment:
   But I didn't find where miss the space



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.
  */
 public RangeQuery withDescendingKeys() {

Review Comment:
   ok



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.

Review Comment:
   ok



##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).

Review Comment:
   ok



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -82,25 +81,25 @@ public static  TimestampedRangeQuery 
withUpperBound(final K upper) {
  * @param  The value type
  */
 public static  TimestampedRangeQuery withLowerBound(final K 
lower) {
-return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), true);
+return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), ResultOrder.ANY);
 }
 
 /**
  * Determines if the serialized byte[] of the keys in ascending order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of return records base on the serialized 
byte[] of the keys(can be unordered, or in ascending, or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.
  */
 public TimestampedRangeQuery withDescendingKeys() {

Review Comment:
   ok



##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -82,25 +81,25 @@ public static  TimestampedRangeQuery 
withUpperBound(final K upper) {
  * @param  The value type
  */
 public static  TimestampedRangeQuery withLowerBound(final K 
lower) {
-return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), true);
+return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), ResultOrder.ANY);
 }
 
 /**
  * Determines if the serialized byte[] of the keys in ascending order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of return records base on the serialized 
byte[] of the keys(can be unordered, or in ascending, or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.

Review Comment:
   ok



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredTimestampedKeyValueStore.java:
##
@@ -205,12 +206,12 @@ private  QueryResult runTimestampedRangeQuery(final 
Query query,
 final QueryResult result;
 final TimestampedRangeQuery typedQuery = 
(TimestampedRangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.lowerBound().orElse(null)),
 keyBytes(typedQuery.upperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   https://github.com/apache/kafka/pull/14907#discussion_r1416481443



##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredTimestampedKeyValueStore.java:
##
@@ -268,12 +269,12 @@ private   QueryResult runRangeQuery(final Query 
query,
 final QueryResult result;
 final RangeQuery typedQuery = (RangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.getLowerBound().orElse(null)),
 keyBytes(typedQuery.getUpperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   https://github.com/apache/kafka/pull/14907#discussion_r1416481443



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-05 Thread via GitHub


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


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##
@@ -254,12 +255,12 @@ private  QueryResult runRangeQuery(final Query 
query,
 final QueryResult result;
 final RangeQuery typedQuery = (RangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+final ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.getLowerBound().orElse(null)),
 keyBytes(typedQuery.getUpperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   Given that 'ANY' and 'ASCENDING' are treated the same, except for 
'ResultOrder.DESCENDING', should a separate statement be used to handle the 
'ASCENDING' case?



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414425643


##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -82,25 +81,25 @@ public static  TimestampedRangeQuery 
withUpperBound(final K upper) {
  * @param  The value type
  */
 public static  TimestampedRangeQuery withLowerBound(final K 
lower) {
-return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), true);
+return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), ResultOrder.ANY);
 }
 
 /**
  * Determines if the serialized byte[] of the keys in ascending order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of return records base on the serialized 
byte[] of the keys(can be unordered, or in ascending, or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.

Review Comment:
   original description is better



##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -82,25 +81,25 @@ public static  TimestampedRangeQuery 
withUpperBound(final K upper) {
  * @param  The value type
  */
 public static  TimestampedRangeQuery withLowerBound(final K 
lower) {
-return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), true);
+return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), ResultOrder.ANY);
 }
 
 /**
  * Determines if the serialized byte[] of the keys in ascending order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of return records base on the serialized 
byte[] of the keys(can be unordered, or in ascending, or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.
  */
 public TimestampedRangeQuery withDescendingKeys() {

Review Comment:
   we should add `withAscendingKeys()`



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414426924


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredTimestampedKeyValueStore.java:
##
@@ -268,12 +269,12 @@ private   QueryResult runRangeQuery(final Query 
query,
 final QueryResult result;
 final RangeQuery typedQuery = (RangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.getLowerBound().orElse(null)),
 keyBytes(typedQuery.getUpperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   Missing ascending case



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414425445


##
streams/src/main/java/org/apache/kafka/streams/query/TimestampedRangeQuery.java:
##
@@ -82,25 +81,25 @@ public static  TimestampedRangeQuery 
withUpperBound(final K upper) {
  * @param  The value type
  */
 public static  TimestampedRangeQuery withLowerBound(final K 
lower) {
-return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), true);
+return new TimestampedRangeQuery<>(Optional.of(lower), 
Optional.empty(), ResultOrder.ANY);
 }
 
 /**
  * Determines if the serialized byte[] of the keys in ascending order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of return records base on the serialized 
byte[] of the keys(can be unordered, or in ascending, or in descending order).

Review Comment:
   missing space



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414426563


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredTimestampedKeyValueStore.java:
##
@@ -205,12 +206,12 @@ private  QueryResult runTimestampedRangeQuery(final 
Query query,
 final QueryResult result;
 final TimestampedRangeQuery typedQuery = 
(TimestampedRangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.lowerBound().orElse(null)),
 keyBytes(typedQuery.upperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   We need to handle the ascending case, too



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414426281


##
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##
@@ -254,12 +255,12 @@ private  QueryResult runRangeQuery(final Query 
query,
 final QueryResult result;
 final RangeQuery typedQuery = (RangeQuery) query;
 RangeQuery rawRangeQuery;
-final boolean isKeyAscending = typedQuery.isKeyAscending();
+final ResultOrder order = typedQuery.resultOrder();
 rawRangeQuery = RangeQuery.withRange(
 keyBytes(typedQuery.getLowerBound().orElse(null)),
 keyBytes(typedQuery.getUpperBound().orElse(null))
 );
-if (!isKeyAscending) {
+if (order.equals(ResultOrder.DESCENDING)) {

Review Comment:
   We need to handle the ascending case, too.



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414424741


##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.
  */
 public RangeQuery withDescendingKeys() {

Review Comment:
   We should also add `withAscendingKeys()` method



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



Re: [PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-04 Thread via GitHub


mjsax commented on code in PR #14907:
URL: https://github.com/apache/kafka/pull/14907#discussion_r1414424355


##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).

Review Comment:
   missing space



##
streams/src/main/java/org/apache/kafka/streams/query/RangeQuery.java:
##
@@ -59,25 +58,25 @@ private RangeQuery(final Optional lower, final 
Optional upper, final boole
  * @param  The value type
  */
 public static  RangeQuery withRange(final K lower, final K 
upper) {
-return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), true);
+return new RangeQuery<>(Optional.ofNullable(lower), 
Optional.ofNullable(upper), ResultOrder.ANY);
 }
 
 /**
- * Determines if the serialized byte[] of the keys in ascending order.
+ * Determines if the serialized byte[] of the keys in ascending or any 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return true if ascending, false otherwise.
+ * @return return the order of returned records based on the serialized 
byte[] of the keys(can be unordered, or in ascending or in descending order).
  */
-public boolean isKeyAscending() {
-return isKeyAscending;
+public ResultOrder resultOrder() {
+return order;
 }
 
 /**
  * Set the query to return the serialized byte[] of the keys in descending 
order.
  * Order is based on the serialized byte[] of the keys, not the 'logical' 
key order.
- * @return a new RangeQuery instance with descending flag set.
+ * @return a new RangeQuery instance with DESCENDING set.

Review Comment:
   old description was better



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



[PR] KAFKA-15629: Support ResultOrder to TimestampedRangeQuery. [kafka]

2023-12-03 Thread via GitHub


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

   Support `ResultOrder` to `TimestampedRangeQuery`.
   ### 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: jira-unsubscr...@kafka.apache.org

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