influxdata / influxdata/influxdb
no output when join tables with multiple columns
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
I found when join tables with multiple columns, **if the sequence of columns in the two tables are different**, there will be no output.
---
You can reproduce this bug by the example below. I join two tables using two columns `_measurement` and `_time`.
In table1, the sequence of these two columns is **_time, _measurement**,
In table2, the sequence is **_time, _measurement**,
In table3, the sequence is **_measurement, _time**,
There is no output when joining table2 and table3.
```
import "csv"
csvData1 = "
#group,false,false,false,false
#datatype,string,long,dateTime:RFC3339,string
#default,,,,
,result,table,_time,_measurement
,,0,2021-02-22T16:00:00Z,0
,,0,2021-02-23T16:00:00Z,0
"
csvData2 = "
#group,false,false,false,false,false
#datatype,string,long,dateTime:RFC3339,string,string
#default,,,,,
,result,table,_time,_measurement,sn
,,0,2021-02-22T16:00:00Z,0,GLD18-0
,,0,2021-02-24T16:00:00Z,0,GLD18-0
"
csvData3 = "
#group,false,false,false,false
#datatype,string,long,string,dateTime:RFC3339
#default,,,,
,result,table,_measurement,_time
,,0,0,2021-02-22T16:00:00Z
,,0,0,2021-02-24T16:00:00Z
"
table1 = csv.from(csv: csvData1)
table2 = csv.from(csv: csvData2)
table3 = csv.from(csv: csvData3)
table12= join(tables: { table1: table1, table2: table2 }, on: ["_measurement", "_time"], method: "inner")
|> yield(name: "table12")
table13= join(tables: { table1: table1, table3: table3 }, on: ["_measurement", "_time"], method: "inner")
|> yield(name: "table13") // no output
```
Contributor guide
Research direction
Run the supplied table1/table3 reproduction and compare it with table1/table2, focusing on the join path that handles multiple columns in different orders. Done means the inner join emits the matching February 22 row when _measurement and _time appear in different column positions.
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
- Clearly specified
- Newbie friendliness
- 35/100