public class TSNRangeParams extends java.lang.Object implements IParams
TS.NRANGE and
TS.NREVRANGE.
The command keys (numkeys key [key ...]) are supplied through the command method and are
not part of these params; this object carries only
fromTimestamp/toTimestamp and the optional range arguments, which are emitted on
the wire in the canonical order documented on addParams(CommandArguments).
| Constructor and Description |
|---|
TSNRangeParams() |
TSNRangeParams(long fromTimestamp,
long toTimestamp) |
| Modifier and Type | Method and Description |
|---|---|
void |
addParams(CommandArguments args)
Emits, in order:
fromTimestamp toTimestamp (defaulting to the -/+
sentinels), then the optional tokens LATEST, FILTER_BY_TS,
FILTER_BY_VALUE, COUNT, and the aggregation clause
({@code [ALIGN align] AGGREGATION agg [agg ...] |
TSNRangeParams |
aggregation(AggregationType[][] aggregators,
long bucketDuration)
Applies one or more aggregators per key, in key order.
|
TSNRangeParams |
aggregation(AggregationType[] aggregators,
long bucketDuration)
Applies exactly one aggregator per key, in key order.
|
TSNRangeParams |
align(long timestamp)
This requires AGGREGATION.
|
TSNRangeParams |
alignEnd()
This requires AGGREGATION.
|
TSNRangeParams |
alignStart()
This requires AGGREGATION.
|
TSNRangeParams |
bucketTimestamp(java.lang.String bucketTimestamp)
This requires AGGREGATION.
|
TSNRangeParams |
bucketTimestampHigh()
This requires AGGREGATION.
|
TSNRangeParams |
bucketTimestampLow()
This requires AGGREGATION.
|
TSNRangeParams |
bucketTimestampMid()
This requires AGGREGATION.
|
TSNRangeParams |
count(int count) |
TSNRangeParams |
empty()
This requires AGGREGATION.
|
boolean |
equals(java.lang.Object o) |
TSNRangeParams |
filterByTS(long... timestamps) |
TSNRangeParams |
filterByValues(double min,
double max) |
TSNRangeParams |
fromTimestamp(long fromTimestamp) |
int |
hashCode() |
TSNRangeParams |
latest() |
static TSNRangeParams |
nrangeParams() |
static TSNRangeParams |
nrangeParams(long fromTimestamp,
long toTimestamp) |
TSNRangeParams |
toTimestamp(long toTimestamp) |
void |
validateAggregationForKeys(int numKeys)
Validates this aggregation configuration against the actual number of command keys.
|
public TSNRangeParams(long fromTimestamp,
long toTimestamp)
public TSNRangeParams()
public static TSNRangeParams nrangeParams(long fromTimestamp, long toTimestamp)
public static TSNRangeParams nrangeParams()
public TSNRangeParams fromTimestamp(long fromTimestamp)
public TSNRangeParams toTimestamp(long toTimestamp)
public TSNRangeParams latest()
public TSNRangeParams filterByTS(long... timestamps)
public TSNRangeParams filterByValues(double min, double max)
public TSNRangeParams count(int count)
public TSNRangeParams align(long timestamp)
public TSNRangeParams alignStart()
public TSNRangeParams alignEnd()
public TSNRangeParams aggregation(AggregationType[] aggregators, long bucketDuration)
AGGREGATION token.aggregators - ordered, non-empty list holding one aggregator per keybucketDuration - aggregation bucket duration in millisecondsjava.lang.IllegalArgumentException - if aggregators is empty or contains a null elementpublic TSNRangeParams aggregation(AggregationType[][] aggregators, long bucketDuration)
AGGREGATION token
(e.g. AVG,MAX). The response returns one value column per aggregator, flattened in key
then aggregator order.aggregators - ordered, non-empty per-key lists of aggregatorsbucketDuration - aggregation bucket duration in millisecondsjava.lang.IllegalArgumentException - if aggregators (or any inner array) is empty or
contains a null elementpublic void validateAggregationForKeys(int numKeys)
TS.NRANGE/TS.NREVRANGE require exactly one aggregation spec per key, so when
aggregation is set the number of specs must equal numKeys. This mirrors the server rule
client-side so callers fail fast instead of relying on the the number of AGGREGATION
arguments must be equal to numkeys error. No-op when aggregation is not set.numKeys - number of keys passed to the commandjava.lang.IllegalArgumentException - if aggregation is set and the spec count differs from
numKeyspublic TSNRangeParams bucketTimestamp(java.lang.String bucketTimestamp)
public TSNRangeParams bucketTimestampLow()
public TSNRangeParams bucketTimestampHigh()
public TSNRangeParams bucketTimestampMid()
public TSNRangeParams empty()
public void addParams(CommandArguments args)
fromTimestamp toTimestamp (defaulting to the -/+
sentinels), then the optional tokens LATEST, FILTER_BY_TS,
FILTER_BY_VALUE, COUNT, and the aggregation clause
([ALIGN align] AGGREGATION agg [agg ...]
bucketDuration [BUCKETTIMESTAMP bt] [EMPTY]). One AGGREGATION token is emitted per
key.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2026. All rights reserved.