Skip to content

TimeSeries: Support LATEST option in queries #3265

@yezhizi

Description

@yezhizi

Search before asking

  • I had searched in the issues and found no similar issues.

Motivation

When using TS.GET/TS.RANGE to query a compacted time series, the LATEST option can be specified. This causes TS.GET/TS.RANGE to return the compacted value of the latest bucket, which may be a partial bucket.

Redis reference:
https://redis.io/docs/latest/commands/ts.get/

Solution

Modify rangeCommon and getCommon to retrieve the latest bucket of source series when the latest sample is requested.

Note: Since partial aggregations are stored in DOWNSTREAM sub keys, we only need to fetch the last chunk of the source series to retrieve the latest bucket's aggregated value.

Refer to DOWNSTREAM sub keys
Refer to #3151

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions