From 2f1635a85d2c70aa63134066e1cd91e4ec520841 Mon Sep 17 00:00:00 2001 From: jlapacik <joshua.lapacik@pacbell.net> Date: Tue, 4 Sep 2018 10:02:52 -0700 Subject: [PATCH] csv test for join --- query/functions/testdata/join.flux | 17 +++++++++++++++++ query/functions/testdata/join.in.csv | 20 ++++++++++++++++++++ query/functions/testdata/join.out.csv | 11 +++++++++++ 3 files changed, 48 insertions(+) create mode 100644 query/functions/testdata/join.flux create mode 100644 query/functions/testdata/join.in.csv create mode 100644 query/functions/testdata/join.out.csv diff --git a/query/functions/testdata/join.flux b/query/functions/testdata/join.flux new file mode 100644 index 0000000000..37369f86c4 --- /dev/null +++ b/query/functions/testdata/join.flux @@ -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" + }) \ No newline at end of file diff --git a/query/functions/testdata/join.in.csv b/query/functions/testdata/join.in.csv new file mode 100644 index 0000000000..22a30c7a5f --- /dev/null +++ b/query/functions/testdata/join.in.csv @@ -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 \ No newline at end of file diff --git a/query/functions/testdata/join.out.csv b/query/functions/testdata/join.out.csv new file mode 100644 index 0000000000..248f9a44e0 --- /dev/null +++ b/query/functions/testdata/join.out.csv @@ -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 +