influxdata / influxdata/influxdb

Join creating empty rows

Open
#20,478 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Maybe im _holding it wrong_ but I can't figure out why this should be expected behavior?
I know that I don't have to use a join in this specific case, it's only for demonstration.

__Config:__
Version 2.0.0 (37cc047)

__Steps to reproduce:__
When querying as seen below the results will contain a row for EVERY time increment (10s in this case) have a look:

```go
container1 = from(bucket: "temptest")
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "GrafanatestData")
|> filter(fn: (r) => r["_field"] == "A")
|> aggregateWindow(every: 10s, fn: mean)
|> drop(columns: ["_stop", "_start", "_measurement", "_field"])

container2 = from(bucket: "temptest")
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "GrafanatestData")
|> filter(fn: (r) => r["_field"] == "B")
|> aggregateWindow(every: 10s, fn: mean)
|> drop(columns: ["_stop", "_start", "_measurement", "_field"])

join(tables: {t1: container1, t2: container2}, on: ["_time"])
```

![image](https://user-images.githubusercontent.com/53257619/104027162-4a310380-51c7-11eb-9841-9364262c75cd.png)
[2021-01-08-15-37_chronograf_data.csv.txt](https://github.com/influxdata/influxdb/files/5787739/2021-01-08-15-37_chronograf_data.csv.txt)

A side problem of this behavior are enormous query executing times or even timeouts...

__Expected behavior:__
Resulting only in rows where data is present?
![image](https://user-images.githubusercontent.com/53257619/104026989-0b9b4900-51c7-11eb-8481-215fbe39a564.png)
[2021-01-08-15-38_chronograf_data.csv.txt](https://github.com/influxdata/influxdb/files/5787742/2021-01-08-15-38_chronograf_data.csv.txt)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied query with the two containers, aggregateWindow calls, and join on _time. Compare the generated rows with the expected result and investigate why empty time increments are included, including the reported query timeouts; done means the join returns only rows where data is present.

Written by the indexing model from the issue text.

Assessment

Domain
database
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.