feat(time-series): add EXCLUDEEMPTY to TS.MRANGE and TS.MREVRANGE#3352
Open
nkaradzhov wants to merge 1 commit into
Open
feat(time-series): add EXCLUDEEMPTY to TS.MRANGE and TS.MREVRANGE#3352nkaradzhov wants to merge 1 commit into
nkaradzhov wants to merge 1 commit into
Conversation
Adds the Redis 8.10 EXCLUDEEMPTY flag to the non-GROUPBY TS.MRANGE and TS.MREVRANGE variants (base, WITHLABELS, SELECTED_LABELS, and their multi-aggregation counterparts), for both forward and reverse commands. When set, the server omits matching series with an empty samples array from the top-level reply. Default behavior is unchanged. The flag lives on new TsMRangeOptions / TsMRangeMultiAggrOptions types so single-key TS.RANGE/TS.REVRANGE never expose it. GROUPBY variants also do not expose it, making the illegal EXCLUDEEMPTY+GROUPBY combination unrepresentable in the typed API while raw commands still surface the server error. The response parser is unchanged. Behavior tests gated to server >= 8.10. 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 support for the
EXCLUDEEMPTYflag onTS.MRANGEandTS.MREVRANGE, introduced in Redis 8.10. When set, the server omits from the top-level reply any matching time series whose samples array is empty for the queried range and options. The default behavior (empty series included) is unchanged and fully backward compatible.The flag is exposed as an
EXCLUDEEMPTY?: booleanoption on the non-GROUPBYmulti-range helpers (base,WITHLABELS,SELECTED_LABELS, and their multi-aggregation counterparts), for both forward (mRange) and reverse (mRevRange) commands. It is emitted as a bare flag with no value, placed among the range options beforeFILTER.Key design points:
EXCLUDEEMPTYlives on newTsMRangeOptions/TsMRangeMultiAggrOptionstypes, so single-keyTS.RANGE/TS.REVRANGEnever offer an invalid option.EXCLUDEEMPTYis mutually exclusive withGROUPBY. BecauseGROUPBYis a separate set of command variants that do not expose the option, the illegal combination is unrepresentable in the typed API. RawsendCommandusers who combine them still receive the server error (TSDB: EXCLUDEEMPTY is not allowed with GROUPBY) unchanged.Behavior tests are gated to server
>= 8.10.🤖 Generated with Claude Code
Note
Low Risk
Read-only command argument and typing changes with default behavior unchanged; no reply parsing or security-sensitive logic.
Overview
Adds Redis 8.10
EXCLUDEEMPTYsupport on non-GROUPBYTS.MRANGE/TS.MREVRANGEclient helpers so callers can omit matching series with no samples in the queried range.The option is
EXCLUDEEMPTY?: booleanon newTsMRangeOptionsandTsMRangeMultiAggrOptions(extending the existing range option types so single-keyTS.RANGEdoes not expose it).parseExcludeEmptyArgumentemits the bareEXCLUDEEMPTYtoken after range options and beforeFILTER/ label modifiers across base,WITHLABELS,SELECTED_LABELS, and multi-aggregation parsers. Reply handling is unchanged; the server returns fewer keys.Tests cover argument serialization for several variants and integration checks on
mRange/mRevRange(gated to server ≥ 8.10).Reviewed by Cursor Bugbot for commit 06c1815. Bugbot is set up for automated code reviews on this repo. Configure here.