VictoriaMetrics/app
Zhu Jiekun f16a58f14c
vmctl: fixed import duplicate data when query result contains multiple series (#7330)
### Describe Your Changes

Fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7301

When querying with condition like `WHERE a=1` (looking for series A),
InfluxDB can return data with the tag `a=1` (series A) and data with the
tag `a=1,b=1` (series B).

However, series B is will be queried later and it's data should not be
combined into series A's data.

This PR filter those series that are not identical to the original query
condition.

For table `example`:
```
// time                           host    region  value
// ----                           ----    ------  -----
// 2024-10-25T02:12:13.469720983Z serverA us_west 0.64
// 2024-10-25T02:12:21.832755213Z serverA us_west 0.75
// 2024-10-25T02:12:32.351876479Z serverA         0.88
// 2024-10-25T02:12:37.766320484Z serverA         0.95
```

The query for series A (`example_value{host="serverA"}`) and result will
be:
```SQL
SELECT * FROM example WHERE host = "serverA"
```
```json
{
	"results": [{
		"statement_id": 0,
		"series": [{
			"name": "cpu",
			"columns": ["time", "host", "region", "value"],
			"values": [
				["2024-10-25T02:12:13.469720983Z", "serverA", "us_west", 0.64],
				["2024-10-25T02:12:21.832755213Z", "serverA", "us_west", 0.75],
				["2024-10-25T02:12:32.351876479Z", "serverA", null, 0.88],
				["2024-10-25T02:12:37.766320484Z", "serverA", null, 0.95]
			]
		}]
	}]
}
```

We need to abandon `values[0]` and `values[1]` because the value of
**unwanted** column `region` is not null.

As for series B (`example_value{host="serverA", region="us_west"}`), no
change needed since the query filter out unwanted rows already.

### Note
This is a draft PR for verifying the fix.

### Checklist

The following checks are **mandatory**:

- [x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).

---------

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>
2024-11-06 13:53:49 +01:00
..
victoria-logs app/vlstorage: add support for forced merge via /internal/force_merge HTTP endpoint 2024-10-13 22:20:31 +02:00
victoria-metrics app/victoria-metrics: fixes flaky e2e graphite test 2024-10-31 19:53:40 +01:00
vlinsert vlinsert: support datadog logs 2024-11-05 16:52:35 +01:00
vlogscli app/vlogscli: print hint on how to see available commands when starting vlogscli 2024-10-29 16:44:46 +01:00
vlogsgenerator all: consistently use stringsutil.JSONString() for formatting JSON strings with fmt.* functions instead of using "%q" formatter 2024-07-17 13:52:13 +02:00
vlselect app/{vmselect,vlselect}: run make vmui-update vmui-logs-update 2024-11-04 10:59:42 -03:00
vlstorage lib/flagutil: rename Duration to RetentionDuration (#7284) 2024-10-17 13:47:48 +02:00
vmagent vmagent: fix type of command-line flag -streamAggr.dedupInterval (#7081) 2024-10-17 13:27:59 +02:00
vmalert vmalert: integrate with victorialogs (#7255) 2024-10-29 16:30:39 +01:00
vmalert-tool vmalert-tool: set default interval for unittest input_series (#7392) 2024-10-31 14:04:50 +01:00
vmauth app/*/multiarch: return back empty value for TARGETARCH 2024-09-06 18:12:17 +02:00
vmbackup app/*/multiarch: return back empty value for TARGETARCH 2024-09-06 18:12:17 +02:00
vmbackupmanager all: replace old https://docs.victoriametrics.com/vmbackupmanager.html url with the new one - https://docs.victoriametrics.com/vmbackupmanager/ 2024-04-18 02:03:58 +02:00
vmctl vmctl: fixed import duplicate data when query result contains multiple series (#7330) 2024-11-06 13:53:49 +01:00
vmgateway all: replace old https://docs.victoriametrics.com/vmgateway.html url with the new one - https://docs.victoriametrics.com/vmgateway/ 2024-04-18 02:08:18 +02:00
vminsert lib/protoparser/influx: enable batch processing by default (#7165) 2024-10-15 11:48:40 +02:00
vmrestore app/*/multiarch: return back empty value for TARGETARCH 2024-09-06 18:12:17 +02:00
vmselect app/{vmselect,vlselect}: run make vmui-update vmui-logs-update 2024-11-04 10:59:42 -03:00
vmstorage Revert "lib/mergeset: add sparse indexdb cache (#7269)" 2024-11-04 10:29:14 -03:00
vmui vmui: fix the display of the link to vmalert (#7380) 2024-10-31 13:43:58 +01:00