influxdata / influxdata/influxdb
join() not working on some datasets
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
1. insert a series with float values (0s and 1s)
2. insert a series with bool values with same _measurement and optional tags, plus additional tags to distinguish from the first one
3. query first dataset and save it into a stream variable (eventually dropping all extra tags)
4. query second data set and save it into a stream variable (converting bools to floats), dropping extra tags/columns
5. yielding each dataset separately reports expected values for both queries
6. joining two queries on common columns (even subsets of them) results in "no data"
A CSV dump of the two datasets is included: both datasets have values, but when queried via Data Explorer (or directly via command line or via Grafana Explorer, they all look the same) the join() returns an empty data set.
[query2.csv](https://github.com/influxdata/influxdb/files/8089291/query2.csv)
[query1.csv](https://github.com/influxdata/influxdb/files/8089292/query1.csv)
Flux query:
```
data1 = from(bucket: "log/autogen")
|> range(start: 2022-02-14T00:00:00Z, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "state" and r.device == "nest" and exists r.sid)
|> drop(columns: ["plant_key", "sid", "device", "group", "_field"])
|> toFloat()
data2 = from(bucket: "log/autogen")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "state" and r.device == "nest" and not exists r.sid)
|> drop(columns: ["device", "group", "_field"])
// These two lines returns real data and same columns (values and format)
// data1 |> yield()
// data2 |> yield()
// This line returns an empty data set with different combinations of "on" parameter (i.e. all time fields like in the docs, a subset of it etc.)
// join(tables: {d1: data1, d2: data2}, on: ["_start", "_stop", "_time", "_value"])
```
__Expected behavior:__
A join result with both datasets merged into one table
__Actual behavior:__
No data returned
__Environment info:__
* Linux 5.4.0-92-generic x86_64
* InfluxDB 2.1.1 (git: 657e1839de) build_date: 2021-11-09T03:03:48Z
* Running latest official docker container with default configuration
__Config:__
Default configuration
__Logs:__
No relevant logs
__Performance:__
Not relevant
Contributor guide
Research direction
Begin by reproducing the provided Flux query against the two attached CSV datasets and compare separate yields with the join result. Investigate the join behavior for the listed common-column combinations; done means the two non-empty datasets produce the expected merged table instead of no data.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100