influxdata / influxdata/influxdb

Using findColumn results in contains - only matches last value

Open
#23,215 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__

In a bucket with 2 series, I want to get a list of tag values from 1 series and based on that get metrics in another series:
```
// this returns 12 entries
myList = from(bucket: "myBucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "mySeries1")
|> group(columns: ["id"])
|> last()
|> group(columns: ["_measurement"])
|> findColumn(fn: (key) => true, column: "id")

// here I only get rows with the last id in the list above
from(bucket: "myBucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "mySeries2")
|> filter(fn: (r) => contains(value: r.id, set: myList ))
```
__Expected behavior:__

Get all data points for metric mySeries2 which have a tag value in the list returned by the first query

__Actual behavior:__

I only get mySeries2 data points for what seems the last value in the returned list

__Environment info:__

* System info: Linux 3.10.0-1160.53.1.el7.x86_64 x86_64
* InfluxDB version: InfluxDB 2.1.1 (git: 657e1839de) build_date: 2021-11-09T03:03:48Z
* Other relevant environment details:

__Config:__

http-bind-address: 127.0.0.1:8086
bolt-path: /prod/influxdb/data/influxd.bolt
engine-path: /prod/influxdb/data/engine
tls-cert: /prod/certs/myhost.example.com.cert.pem
tls-key: /prod/certs/myhost.example.com.key.pem

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two queries shown against InfluxDB 2.1.1, using the sample bucket, series, and tag values described in the report. Trace how the list returned by findColumn is consumed by contains; done means the second query returns every data point whose id appears in the list, not only those matching the last value.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.