csv test for join

pull/10616/head
jlapacik 2018-09-04 10:02:52 -07:00
parent 5be44d7fac
commit 2f1635a85d
3 changed files with 48 additions and 0 deletions

17
query/functions/testdata/join.flux vendored Normal file
View File

@ -0,0 +1,17 @@
left = from(bucket: "test")
|> range(start:2018-05-22T19:53:00Z, stop:2018-05-22T19:55:00Z)
|> drop(columns: ["_start", "_stop"])
|> filter(fn: (r) => r.user == "user1")
|> group(by: ["user"])
right = from(bucket: "test")
|> range(start:2018-05-22T19:53:00Z, stop:2018-05-22T19:55:00Z)
|> drop(columns: ["_start", "_stop"])
|> filter(fn: (r) => r.user == "user2")
|> group(by: ["_measurement"])
join(tables: {left:left, right:right}, on: ["_time", "_measurement"])
|> rename(columns: {
left__value: "left_value",
right__value: "right_value"
})

20
query/functions/testdata/join.in.csv vendored Normal file
View File

@ -0,0 +1,20 @@
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string
#group,false,false,false,false,false,false,true,true
#default,_result,,,,,,,
,result,table,_start,_stop,_time,_value,_measurement,user
,,0,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:26Z,1,RAM,user1
,,0,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,2,RAM,user1
,,0,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,3,RAM,user1
,,0,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,5,RAM,user1
,,1,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:26Z,0,CPU,user1
,,1,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,1,CPU,user1
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:26Z,2,RAM,user2
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,4,RAM,user2
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,4,RAM,user2
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,0,RAM,user2
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,2,RAM,user2
,,2,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,10,RAM,user2
,,3,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:26Z,4,CPU,user2
,,3,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,20,CPU,user2
,,3,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,7,CPU,user2
,,3,2018-05-22T19:53:00Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,10,CPU,user2
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string
2 #group false false false false false false true true
3 #default _result
4 result table _start _stop _time _value _measurement user
5 0 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:26Z 1 RAM user1
6 0 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 2 RAM user1
7 0 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 3 RAM user1
8 0 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 5 RAM user1
9 1 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:26Z 0 CPU user1
10 1 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 1 CPU user1
11 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:26Z 2 RAM user2
12 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 4 RAM user2
13 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 4 RAM user2
14 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 0 RAM user2
15 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:54:06Z 2 RAM user2
16 2 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:54:16Z 10 RAM user2
17 3 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:26Z 4 CPU user2
18 3 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 20 CPU user2
19 3 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 7 CPU user2
20 3 2018-05-22T19:53:00Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 10 CPU user2

11
query/functions/testdata/join.out.csv vendored Normal file
View File

@ -0,0 +1,11 @@
#datatype,string,long,string,dateTime:RFC3339,double,string,double,string
#group,false,false,true,false,false,true,false,false
#default,_result,,,,,,,
,result,table,_measurement,_time,left_value,left_user,right_value,right_user
,,0,CPU,2018-05-22T19:53:26Z,0,user1,4,user2
,,0,CPU,2018-05-22T19:53:36Z,1,user1,20,user2
,,1,RAM,2018-05-22T19:53:26Z,1,user1,2,user2
,,1,RAM,2018-05-22T19:53:36Z,2,user1,4,user2
,,1,RAM,2018-05-22T19:53:46Z,3,user1,4,user2
,,1,RAM,2018-05-22T19:53:56Z,5,user1,0,user2
1 #datatype string long string dateTime:RFC3339 double string double string
2 #group false false true false false true false false
3 #default _result
4 result table _measurement _time left_value left_user right_value right_user
5 0 CPU 2018-05-22T19:53:26Z 0 user1 4 user2
6 0 CPU 2018-05-22T19:53:36Z 1 user1 20 user2
7 1 RAM 2018-05-22T19:53:26Z 1 user1 2 user2
8 1 RAM 2018-05-22T19:53:36Z 2 user1 4 user2
9 1 RAM 2018-05-22T19:53:46Z 3 user1 4 user2
10 1 RAM 2018-05-22T19:53:56Z 5 user1 0 user2