Package org.apache.kafka.streams.query
Class TimestampedRangeQuery<K,V>
java.lang.Object
org.apache.kafka.streams.query.TimestampedRangeQuery<K,V>
- Type Parameters:
K
- Type of keysV
- Type of values
- All Implemented Interfaces:
Query<KeyValueIterator<K,
ValueAndTimestamp<V>>>
@Evolving
public final class TimestampedRangeQuery<K,V>
extends Object
implements Query<KeyValueIterator<K,ValueAndTimestamp<V>>>
Interactive query for issuing range queries and scans over
TimestampedKeyValueStore
A range query retrieves a set of records, specified using an upper and/or lower bound on the keys.
A scan query retrieves all records contained in the store.
Keys' order is based on the serialized byte[] of the keys, not the 'logical' key order.
-
Method Summary
Modifier and TypeMethodDescriptionThe lower bound of the query, if specified.Determines if the serialized byte[] of the keys in ascending or descending or unordered order.The upper bound of the query, if specifiedSet the query to return the serialized byte[] of the keys in ascending order.Set the query to return the serialized byte[] of the keys in descending order.static <K,
V> TimestampedRangeQuery<K, V> withLowerBound
(K lower) Interactive range query using a lower bound to filter the keys returned.static <K,
V> TimestampedRangeQuery<K, V> Interactive scan query that returns all records in the store.static <K,
V> TimestampedRangeQuery<K, V> withRange
(K lower, K upper) Interactive range query using a lower and upper bound to filter the keys returned.static <K,
V> TimestampedRangeQuery<K, V> withUpperBound
(K upper) Interactive range query using an upper bound to filter the keys returned.
-
Method Details
-
withRange
Interactive range query using a lower and upper bound to filter the keys returned.- Type Parameters:
K
- The key typeV
- The value type- Parameters:
lower
- The key that specifies the lower bound of the rangeupper
- The key that specifies the upper bound of the range
-
withUpperBound
Interactive range query using an upper bound to filter the keys returned. If both<K,V>
are null, RangQuery returns a full range scan.- Type Parameters:
K
- The key typeV
- The value type- Parameters:
upper
- The key that specifies the upper bound of the range
-
withLowerBound
Interactive range query using a lower bound to filter the keys returned.- Type Parameters:
K
- The key typeV
- The value type- Parameters:
lower
- The key that specifies the lower bound of the range
-
resultOrder
Determines if the serialized byte[] of the keys in ascending or descending or unordered order. Order is based on the serialized byte[] of the keys, not the 'logical' key order.- Returns:
- return the order of return records base on the serialized byte[] of the keys (can be unordered, or in ascending, or in descending order).
-
withDescendingKeys
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.- Returns:
- a new RangeQuery instance with descending flag set.
-
withAscendingKeys
Set the query to return the serialized byte[] of the keys in ascending order. Order is based on the serialized byte[] of the keys, not the 'logical' key order.- Returns:
- a new RangeQuery instance with ascending flag set.
-
withNoBounds
Interactive scan query that returns all records in the store.- Type Parameters:
K
- The key typeV
- The value type
-
lowerBound
The lower bound of the query, if specified. -
upperBound
The upper bound of the query, if specified
-