Skip to content

MOD-16172 - support exclude empty in mrange commands (#2072) - #2091

Merged
TalBarYakar merged 1 commit into
8.10from
exclude_empty_to_8_10
Jul 8, 2026
Merged

TalBarYakar merged 1 commit into
8.10from
exclude_empty_to_8_10

Conversation

@TalBarYakar

@TalBarYakar TalBarYakar commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor
  • add EXCLUDEEMPTY flag to TS.MRANGE / TS.MREVRANGE

Filtering is applied per inner shard (not the coordinator), consistent with how aggregation and FILTERBY are handled. The standalone path filters in replyUngroupedMultiRange. EXCLUDEEMPTY and GROUPBY are mutually exclusive.

  • fix remarks

  • aplly changes to make the check fo empty series more effiecient

  • dix code remarks

  • add to command info


Note

Medium Risk
Changes multi-key query reply shape and cluster predicate serialization; behavior differs across LibMR coordinator paths (Gears vs internal), so cluster regressions are the main review focus.

Overview
Adds optional EXCLUDEEMPTY (since 8.10.0) to TS.MRANGE and TS.MREVRANGE, so series with no samples in the requested range (after range, filters, and aggregation) are omitted from the multi-series reply instead of returned with empty sample arrays.

Parsing stores an excludeEmpty flag on MRangeArgs, rejects EXCLUDEEMPTY with GROUPBY, and avoids treating a GROUPBY label literally named EXCLUDEEMPTY as the flag. Command metadata is updated in commands.json and ts_info.c.

Reply paths use SeriesQueryIfNonEmpty plus ReplySeriesRangeFromIter to skip empty series without double-scanning, and use postponed top-level array length when the final series count is unknown until emission. The flag is propagated through LibMR (**QueryPredicates_Arg** serialize/deserialize and shard mrangeArgs) and applied on the standalone ungrouped path and the Gears coordinator mrange_done_gears path.

Flow tests cover combinations with WITHLABELS, COUNT, aggregation, FILTER_BY_*, MREVRANGE, AGGREGATION … EMPTY, and RESP3.

Reviewed by Cursor Bugbot for commit 841dcd9. Bugbot is set up for automated code reviews on this repo. Configure here.

* add EXCLUDEEMPTY flag to TS.MRANGE / TS.MREVRANGE

Filtering is applied per inner shard (not the coordinator), consistent
with how aggregation and FILTERBY are handled. The standalone path
filters in replyUngroupedMultiRange. EXCLUDEEMPTY and GROUPBY are
mutually exclusive.

* fix remarks

* aplly changes to make the check fo empty series more effiecient

* dix code remarks

* add to command info
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@TalBarYakar
TalBarYakar merged commit f688452 into 8.10 Jul 8, 2026
39 checks passed
@TalBarYakar
TalBarYakar deleted the exclude_empty_to_8_10 branch July 8, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants