VictoriaMetrics/app/vmselect/promql
Roman Khavronenko 38568254c5
app/vmselect: ignore empty series for limit_offset (#3178)
* app/vmselect: ignore empty series for `limit_offset`

VictoriaMetrics doesn't return empty series (with all NaN values) to
the user. But such series are filtered after transform functions.
It means `limit_offset` will account for empty series as well.

For example, let's consider following data set:
```
time series:
foo{label="1"} NaN, NaN, NaN, NaN // empty series
foo{label="2"} 1, 2, 3, 4
foo{label="3"} 4, 3, 2, 1
```

When user requests all series for metric `foo` the empty series
will be filtered out:
```
/query=foo:
foo{label="v2"} 1, 2, 3, 4
foo{label="v3"} 4, 3, 2, 1
```

But `limit_offset(1, 1, foo)` is applied to original series, not filtered yet.
So it will return `foo{label="v2"}` (skips the first in list)
```
/query=limit_offset(1, 1, foo):
foo{label="v2"} 1, 2, 3, 4
```

Expected result would be to apply `limit_offset` to already filtered list,
so in result we receive `foo{label="v3"}`:
```
/query=limit_offset(1, 1, foo):
foo{label="v3"} 4, 3, 2, 1
```

The change does exactly that - filters empty series before applying `limit_offset`.

Signed-off-by: hagen1778 <roman@victoriametrics.com>

* app/vmselect: ignore empty series for `limit_offset`

Signed-off-by: hagen1778 <roman@victoriametrics.com>

Signed-off-by: hagen1778 <roman@victoriametrics.com>
2022-10-06 15:49:56 +03:00
..
active_queries.go app/vmselect: show X-Forwarded-For contents on /api/v1/status/active_queries page 2020-07-31 20:01:09 +03:00
aggr.go app/vmselect/promql: remove empty series before applying aggregate function 2022-10-06 15:49:55 +03:00
aggr_incremental.go app/vmselect/promql: return empty values from group() if all the time series have no values at the given timestamp 2020-07-28 13:41:04 +03:00
aggr_incremental_test.go all: use %w instead of %s for wrapping errors in fmt.Errorf 2020-06-30 23:33:46 +03:00
aggr_test.go app/vmselect/promql: add mode() aggregate function 2020-07-20 15:30:11 +03:00
binary_op.go app/vmselect/promql: properly return q1 series from q1 ifnot q2 when q2 returns nothing 2022-08-08 15:44:51 +03:00
eval.go app/vmselect/promql: typo fix after 992f36702f 2022-08-30 12:04:51 +03:00
eval_test.go app/vmselect/promql: optimize queries, which join on _info metrics. 2022-01-31 20:25:15 +02:00
exec.go all: add initial support for query tracing 2022-06-01 02:31:44 +03:00
exec_test.go app/vmselect: ignore empty series for limit_offset (#3178) 2022-10-06 15:49:56 +03:00
memory_limiter.go app/vmselect/promql: use dynamic limit on memory for concurrent queries 2019-06-12 23:18:23 +03:00
memory_limiter_test.go app/vmselect/promql: use dynamic limit on memory for concurrent queries 2019-06-12 23:18:23 +03:00
parser.go app/vmselect: accept optional extra_filters[] query args for all the supported Prometheus querying APIs 2021-12-06 17:33:49 +02:00
rollup.go vmselect/rollup: rm workaround for slow-changing counters (#3163) 2022-10-06 15:46:29 +03:00
rollup_result_cache.go all: readability improvements for query traces 2022-06-30 18:19:43 +03:00
rollup_result_cache_test.go all: add initial support for query tracing 2022-06-01 02:31:44 +03:00
rollup_test.go vmselect/rollup: rm workaround for slow-changing counters (#3163) 2022-10-06 15:46:29 +03:00
rollup_timing_test.go all: open-sourcing single-node version 2019-05-23 00:18:06 +03:00
timeseries.go lib/bytesutil: split Resize* funcs to MayOverallocate and NoOverallocate for more fine-grained control over memory allocations 2022-02-01 11:20:20 +02:00
timeseries_test.go app/vmselect/promql: store compressed results in the cache 2019-08-14 02:32:16 +03:00
transform.go app/vmselect: ignore empty series for limit_offset (#3178) 2022-10-06 15:49:56 +03:00
transform_test.go app/vmselect: make fmt after f3ece83e67 2022-07-05 14:56:53 +03:00
tzdata.go all: add go:build lines for Go1.17 2021-07-26 15:50:46 +03:00