Skip to content

no output when join tables with multiple columns  #20822

Open
@young-mu

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

Metadata

Assignees

No one assigned

    Labels

    area/2.xOSS 2.0 related issues and PRsarea/fluxIssues related to the Flux query enginearea/queries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions