feat(time-series): add TS.NRANGE and TS.NREVRANGE multi-key pivot commands - #3337
Merged
Merged
Conversation
…mands
Add the TS.NRANGE and TS.NREVRANGE RedisTimeSeries commands (Redis 8.10).
Both query an explicit list of keys over a timestamp range and return
timestamp-major pivot rows { timestamp, values } where values preserve the
input key order and missing cells surface as NaN. NRANGE returns rows in
increasing-timestamp order, NREVRANGE in decreasing order, reusing the same
argument builder and reply parser without re-sorting server rows.
- numkeys derived from the key list; duplicate keys preserved
- full TS.RANGE option set (LATEST, FILTER_BY_TS, FILTER_BY_VALUE, COUNT,
ALIGN, AGGREGATION, BUCKETTIMESTAMP, EMPTY)
- one aggregator per key emitted as separate tokens, never comma-joined
- single-shard, key-routed; same-slot key requirement documented
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…y NRANGE reply Apply code-review fixes to the TS.NRANGE/TS.NREVRANGE feature with no change to serialized wire arguments or reply shape: - Extract shared parseRangeCommonArguments + TsRangeCommonOptions into helpers.ts; RANGE, RANGE_MULTIAGGR, and NRANGE now emit the common option prefix from one place instead of three copies. - Reference transformPivotSamplesReply directly in NRANGE.transformReply, dropping redundant wrapper closures and unused imports. - Fold single-row transformPivotSampleReply into transformPivotSamplesReply. - Trim verbose registry JSDoc to match sibling range commands. - Add RESP2 test asserting a missing pivot cell surfaces as NaN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ale TODO Add "Added since Redis 8.10." to the NRANGE/NREVRANGE registry JSDoc, matching the version-annotation style used in the client command index, and remove the copied "use double type mapping instead" TODO from the pivot RESP2 transform. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nkaradzhov
marked this pull request as ready for review
July 14, 2026 10:45
PavelPashov
approved these changes
Jul 15, 2026
nkaradzhov
added a commit
that referenced
this pull request
Jul 28, 2026
…TS.NREVRANGE (#3360) RedisTimeSeries#2079 finalized the semantics: one AGGREGATION token per key, each holding one or more comma-separated aggregators (e.g. `avg,max sum`). The merged implementation (#3337) only exposed a single aggregator per key. Change `AGGREGATION.types` from a flat `TimeSeriesAggregationTypeList` to `TimeSeriesAggregationTypeGroups` (one group per key); emit each group as a single comma-joined token. The shared `TimeSeriesAggregationTypeList` used by single-key TS.RANGE is left untouched. BREAKING (vs unreleased #3337): flat `types: [MAX, MIN]` becomes grouped `types: [[MAX], [MIN]]`. Wire output for single-aggregator usage is unchanged. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the
TS.NRANGEandTS.NREVRANGERedisTimeSeries commands (Redis 8.10). Both query an explicit list of time series keys over a timestamp range and return timestamp-major pivot rows{ timestamp, values }, wherevaluespreserves the input key order and missing cells surface asNaN(indistinguishable from a stored/aggregatedNaN, matching the server contract).TS.NRANGEreturns rows in increasing-timestamp order;TS.NREVRANGEin decreasing order, reusing the same argument builder and reply parser without re-sorting server rows.Key behaviors:
numkeysis derived from the key list and duplicate keys are preserved (duplicates map to repeated value columns).TS.RANGE-style option set:LATEST,FILTER_BY_TS,FILTER_BY_VALUE,COUNT,ALIGN,AGGREGATION,BUCKETTIMESTAMP,EMPTY.AGGREGATION first max min ...), never the comma-joined form.multi_shardpolicy); same-slot key requirement documented in JSDoc.Exposed as
NRANGE/nRangeandNREVRANGE/nRevRange. A shared pivot-row reply transform lives inhelpers.ts. Behavior verified against a live Redis 8.10 instance.🤖 Generated with Claude Code
Note
Low Risk
Additive read-only commands plus a small dedupe refactor of range argument parsing; behavior covered by unit and integration tests against Redis 8.10.
Overview
Adds Redis 8.10 client support for
TS.NRANGEandTS.NREVRANGE, exposed asnRange/nRevRange. Both take an explicit key list (withnumkeysfrom length, duplicates preserved), a time range, and optionalTS.RANGE-style filters; replies are timestamp-major pivot rows{ timestamp, values[] }aligned to key order, with missing cells asNaNviatransformPivotSamplesReply.TS.NRANGEbuilds wire args including one aggregator token per key underAGGREGATION(not the comma-joined form used by single-key multi-agg).TS.NREVRANGEreuses the same argument builder and reply parser, only changing the command name.Refactor: shared range preamble (
LATEST,FILTER_BY_TS,FILTER_BY_VALUE,COUNT) moves intoparseRangeCommonArguments/TsRangeCommonOptionsinhelpers.ts, used by existingRANGEandRANGE_MULTIAGGRparsers without changing their aggregation wire format.Reviewed by Cursor Bugbot for commit 02a9e8c. Bugbot is set up for automated code reviews on this repo. Configure here.