diff --git a/tests/system-test/2-query/elapsed.py b/tests/system-test/2-query/elapsed.py index 1553e069149c0d95eb8a428c37e6de8a750daa87..da737f97bb47e7abc920fde7cc136eaa04c17c5c 100644 --- a/tests/system-test/2-query/elapsed.py +++ b/tests/system-test/2-query/elapsed.py @@ -40,30 +40,30 @@ class TDTestCase: =================================================================================================================================== elapsed function can acting on ordinary tables and super tables , notice that this function is related to the timeline. - If it acts on a super table , it must be group by tbname . by the way ,this function support nested query. + If it acts on a super table , it must be partition by tbname . by the way ,this function support nested query. The scenarios covered by the test cases are as follows: ==================================================================================================================================== - case: select * from table|stable[group by tbname]|regular_table + case: select * from table|stable[partition by tbname]|regular_table - case:select elapsed(ts) from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]; + case:select elapsed(ts) from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]; - case:select elapsed(ts) , elapsed(ts,unit_time1)*regular_num1 , elapsed(ts,unit_time1)+regular_num2 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]; + case:select elapsed(ts) , elapsed(ts,unit_time1)*regular_num1 , elapsed(ts,unit_time1)+regular_num2 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]; //mixup with all functions only once query (it's different with nest query) - case:select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]; + case:select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]; //mixup with ordinary col - case:select ts ,elapsed(ts)*10 ,col+5 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]; + case:select ts ,elapsed(ts)*10 ,col+5 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]; //nest query - case:select elapsed(ts) from (select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]) where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]; + case:select elapsed(ts) from (select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]) where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [partition by tbname] order [by ts desc asc|desc]; //clause about filter condition - case:select elapsed(ts) from table|stable[group by tbname] where [ts|col|tag >|<|=|>=|<=|=|<>|!= value] | [between ... and ...] |[in] |[is null|not null] interval (unit_time) ; - case:select elapsed(ts) from table|stable[group by tbname] where clause1 and clause 2 and clause3 interval (unit_time) ; + case:select elapsed(ts) from table|stable[partition by tbname] where [ts|col|tag >|<|=|>=|<=|=|<>|!= value] | [between ... and ...] |[in] |[is null|not null] interval (unit_time) ; + case:select elapsed(ts) from table|stable[partition by tbname] where clause1 and clause 2 and clause3 interval (unit_time) ; //JOIN query case:select elapsed(ts) from TABLE1 as tb1 , TABLE2 as tb2 where join_condition [TABLE1 and TABLE2 can be stable|table|sub_table|empty_table] @@ -77,7 +77,7 @@ class TDTestCase: case:select elapsed(ts) from t1 where clause state_window(regular_nums); // Continuous query - case:create table select elapsed(ts) ,avg(col) from (select elapsed(ts) ts_inter ,avg(col) col from stable|table interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL)][group by tbname]) interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL) sliding(unit_time_windows); + case:create table select elapsed(ts) ,avg(col) from (select elapsed(ts) ts_inter ,avg(col) col from stable|table interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL)][partition by tbname]) interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL) sliding(unit_time_windows); ======================================================================================================================================== @@ -149,7 +149,7 @@ class TDTestCase: for abnormal_param in abnormal_list: if tablename.startswith("stable"): - basic_sql= "select elapsed" + abnormal_param + " from " + tablename + " group by tbname ,ind order by tbname;" #stables + basic_sql= "select elapsed" + abnormal_param + " from " + tablename + " partition by tbname ,ind order by tbname;" #stables else: basic_sql= "select elapsed" + abnormal_param + " from " + tablename + ";" # regular table tdSql.error(basic_sql) @@ -158,20 +158,20 @@ class TDTestCase: tdLog.info (" ====================================== elapsed use abnormal ==================================================") - sqls_list = ["select elapsed(ts) from regular_empty group by tbname,ind order by desc; ", - "select elapsed(ts) from regular_empty group by tbname,ind order by desc; ", - "select elapsed(ts) from regular_table_1 group by tbname,ind order by desc; ", - "select elapsed(ts) from sub_table1_1 group by tbname,ind order by desc; ", - "select elapsed(ts) from sub_table1_1 group by tbname,ind order by desc; ", + sqls_list = ["select elapsed(ts) from regular_empty partition by tbname,ind order by desc; ", + "select elapsed(ts) from regular_empty partition by tbname,ind order by desc; ", + "select elapsed(ts) from regular_table_1 partition by tbname,ind order by desc; ", + "select elapsed(ts) from sub_table1_1 partition by tbname,ind order by desc; ", + "select elapsed(ts) from sub_table1_1 partition by tbname,ind order by desc; ", # "select elapsed(ts,10s) from stable_empty group by ts order by ts;", "select elapsed(ts,10s) from stable_1 group by ind order by ts;", "select elapsed(ts,10s) from stable_2 group by tstag order by ts;", - "select elapsed(ts,10s) from stable_1 group by tbname,tstag,tscol order by ts;", - "select elapsed(ts,10s),ts from stable_1 group by tbname ,ind order by ts;", - "select ts,elapsed(ts,10s),tscol*100 from stable_1 group by tbname ,ind order by ts;", + "select elapsed(ts,10s) from stable_1 partition by tbname,tstag,tscol order by ts;", + "select elapsed(ts,10s),ts from stable_1 partition by tbname ,ind order by ts;", + "select ts,elapsed(ts,10s),tscol*100 from stable_1 partition by tbname ,ind order by ts;", "select elapsed(ts) from stable_1 group by tstag order by ts;", - "select elapsed(ts) from sub_empty_1 group by tbname,ind ,tscol order by ts desc;", - "select tbname, tscol,elapsed(ts) from sub_table1_1 group by tbname ,ind order by ts desc;", + "select elapsed(ts) from sub_empty_1 partition by tbname,ind ,tscol order by ts desc;", + "select tbname, tscol,elapsed(ts) from sub_table1_1 partition by tbname ,ind order by ts desc;", "select elapsed(tscol) from sub_table1_1 order by ts desc;", "select elapsed(tstag) from sub_table1_1 order by ts desc;", "select elapsed(ind) from sub_table1_1 order by ts desc;", @@ -199,7 +199,7 @@ class TDTestCase: ts_end_time = self.ts + (self.num-1-i)*10000 ts_col_end_time = self.ts + (self.num-1-i)*10 - filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d group by tbname " %(ts_start_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d partition by tbname " %(ts_start_time) tdSql.query(filter_sql) tdSql.checkRows(3) tdSql.checkData(0,0,float(self.num -i-1)) @@ -212,7 +212,7 @@ class TDTestCase: tdSql.checkData(0,0,float(self.num -i-1)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol >= %d and tstag='2015-01-01 00:01:00'group by tbname " %(ts_start_time,ts_col_start_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol >= %d and tstag='2015-01-01 00:01:00'partition by tbname " %(ts_start_time,ts_col_start_time) tdSql.query(filter_sql) tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-1)) @@ -222,7 +222,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-1)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol > %d and tstag='2015-01-01 00:01:00' group by tbname" %(ts_start_time,ts_col_start_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol > %d and tstag='2015-01-01 00:01:00' partition by tbname" %(ts_start_time,ts_col_start_time) tdSql.query(filter_sql) if i == self.num-1: @@ -240,7 +240,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol > %d and tstag < '2015-01-01 00:01:00' group by tbname " %(ts_start_time,ts_col_start_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol > %d and tstag < '2015-01-01 00:01:00' partition by tbname " %(ts_start_time,ts_col_start_time) tdSql.query(filter_sql) if i == self.num-1: @@ -258,7 +258,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol <= %d and tstag < '2015-01-01 00:01:00' group by tbname" %(ts_start_time,ts_col_start_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol <= %d and tstag < '2015-01-01 00:01:00' partition by tbname" %(ts_start_time,ts_col_start_time) tdSql.query(filter_sql) tdSql.checkRows(0) @@ -266,7 +266,7 @@ class TDTestCase: tdSql.query(filter_sql) tdSql.checkRows(0) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d and tstag < '2015-01-01 00:01:00' group by tbname" %(ts_end_time,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d and tstag < '2015-01-01 00:01:00' partition by tbname" %(ts_end_time,ts_col_end_time) tdSql.query(filter_sql) if i == self.num-1: @@ -284,7 +284,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d group by tbname " %(ts_end_time,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d partition by tbname " %(ts_end_time,ts_col_end_time) tdSql.query(filter_sql) if i == self.num-1: @@ -304,7 +304,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num - i - 2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where ts = %d and tscol < %d group by tbname " %(ts_end_time,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where ts = %d and tscol < %d partition by tbname " %(ts_end_time,ts_col_end_time) tdSql.query(filter_sql) tdSql.checkRows(0) @@ -312,7 +312,7 @@ class TDTestCase: tdSql.query(filter_sql) tdSql.checkRows(0) - filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol < %d group by tbname " %(i,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol < %d partition by tbname " %(i,ts_col_end_time) tdSql.query(filter_sql) if i == self.num-1: @@ -332,7 +332,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol <= %d group by tbname " %(i,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol <= %d partition by tbname " %(i,ts_col_end_time) tdSql.query(filter_sql) if i == self.num: @@ -352,7 +352,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num - i - 1)) - filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol < %d group by tbname " %(i,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol < %d partition by tbname " %(i,ts_col_end_time) tdSql.query(filter_sql) if i == self.num-1: @@ -372,7 +372,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,float(self.num -i-2)) - filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol <= %d group by tbname " %(i,ts_col_end_time) + filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol <= %d partition by tbname " %(i,ts_col_end_time) tdSql.query(filter_sql) if i == self.num: @@ -396,7 +396,7 @@ class TDTestCase: tdSql.query("select elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' ") tdSql.checkData(0,0,2) tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and \ - q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,2) tdSql.checkData(1,0,2) tdSql.checkData(2,0,2) @@ -405,59 +405,59 @@ class TDTestCase: tdSql.query("select elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' ") tdSql.checkData(0,0,2) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,2) tdSql.checkData(1,0,2) tdSql.checkData(2,0,2) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint in (125,126,127) and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint in (125,126,127) and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,2) tdSql.checkData(1,0,2) tdSql.checkData(2,0,2) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,1) tdSql.checkData(1,0,1) tdSql.checkData(2,0,1) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,1) tdSql.checkData(1,0,1) tdSql.checkData(2,0,1) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,6) tdSql.checkData(1,0,6) tdSql.checkData(2,0,6) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' group by tbname ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' partition by tbname ") tdSql.checkData(0,0,6) tdSql.checkData(1,0,6) tdSql.checkData(2,0,6) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is not null and tscol <= '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is not null and tscol <= '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.checkData(0,0,6) tdSql.checkData(1,0,6) tdSql.checkData(2,0,6) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is null and tscol <= '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is null and tscol <= '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.checkRows(0) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars match '^b' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars match '^b' and tscol <= '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.checkRows(3) tdSql.checkData(0,0,6) tdSql.checkData(1,0,6) tdSql.checkData(2,0,6) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars nmatch '^a' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars nmatch '^a' and tscol <= '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.checkRows(3) tdSql.checkData(0,0,6) tdSql.checkData(1,0,6) tdSql.checkData(2,0,6) - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars ='bintest1' or bin_chars ='bintest2' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars ='bintest1' or bin_chars ='bintest2' and tscol <= '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.checkRows(3) - tdSql.query("select elapsed(ts,10s) from stable_1 where (ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000') or (ts between '2015-01-01 00:01:00.000' and '2015-01-01 00:02:00.000') group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where (ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000') or (ts between '2015-01-01 00:01:00.000' and '2015-01-01 00:02:00.000') partition by tbname; ") tdSql.checkRows(3) tdSql.checkData(0,0,9) tdSql.checkData(1,0,9) @@ -473,7 +473,7 @@ class TDTestCase: tdSql.query("select max(q_int)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);") tdSql.checkRows(0) - tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(prev) ;") tdSql.checkRows(0) tdSql.query("select elapsed(ts,10s)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);") tdSql.checkRows(0) @@ -487,7 +487,7 @@ class TDTestCase: # only interval - interval_sql = "select elapsed(ts,10s) from stable_1 where ts <=%d interval(10s) group by tbname " %(ts_start_time) + interval_sql = "select elapsed(ts,10s) from stable_1 where ts <=%d partition by tbname interval(10s) " %(ts_start_time) tdSql.query(interval_sql) tdSql.checkRows(3*(i+1)) @@ -504,20 +504,20 @@ class TDTestCase: # interval (10s) and time range is outer records - tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(prev) ;") tdSql.checkRows(0) tdSql.query("select elapsed(ts,10s)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);") tdSql.checkRows(0) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(prev) ;") tdSql.checkRows(180) tdSql.checkData(0,1,10) tdSql.checkData(9,1,0) tdSql.checkData(59,1,0) tdSql.checkData(60,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(next) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(next) ;") tdSql.checkRows(180) tdSql.checkData(0,1,10) tdSql.checkData(9,1,0) @@ -526,7 +526,7 @@ class TDTestCase: tdSql.checkData(60,1,10) tdSql.checkData(61,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(linear) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(linear) ;") tdSql.checkRows(180) tdSql.checkData(0,1,10) tdSql.checkData(9,1,0) @@ -535,7 +535,7 @@ class TDTestCase: tdSql.checkData(60,1,10) tdSql.checkData(61,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(NULL) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(NULL) ;") tdSql.checkRows(180) tdSql.checkData(0,1,10) tdSql.checkData(9,1,0) @@ -544,7 +544,7 @@ class TDTestCase: tdSql.checkData(60,1,10) tdSql.checkData(61,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(value ,2) group by tbname;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname interval(10s) fill(value ,2) ;") tdSql.checkRows(180) tdSql.checkData(0,1,10) tdSql.checkData(9,1,0) @@ -554,7 +554,7 @@ class TDTestCase: tdSql.checkData(61,1,10) # interval (20s) and time range is outer records - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(prev) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname,ind interval(20s) fill(prev) ;") tdSql.checkRows(90) tdSql.checkData(0,1,20) tdSql.checkData(4,1,10) @@ -563,7 +563,7 @@ class TDTestCase: tdSql.checkData(30,1,20) tdSql.checkData(31,1,20) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(next) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname,ind interval(20s) fill(next) ;") tdSql.checkRows(90) tdSql.checkData(0,1,20) tdSql.checkData(4,1,10) @@ -572,7 +572,7 @@ class TDTestCase: tdSql.checkData(30,1,20) tdSql.checkData(31,1,20) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(linear) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname,ind interval(20s) fill(linear) ;") tdSql.checkRows(90) tdSql.checkData(0,1,20) tdSql.checkData(4,1,10) @@ -581,7 +581,7 @@ class TDTestCase: tdSql.checkData(30,1,20) tdSql.checkData(31,1,20) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(NULL) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname,ind interval(20s) fill(NULL) ;") tdSql.checkRows(90) tdSql.checkData(0,1,20) tdSql.checkData(4,1,10) @@ -590,7 +590,7 @@ class TDTestCase: tdSql.checkData(30,1,20) tdSql.checkData(31,1,20) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(value ,2) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' partition by tbname,ind interval(20s) fill(value ,2) ;") tdSql.checkRows(90) tdSql.checkData(0,1,20) tdSql.checkData(4,1,10) @@ -601,7 +601,7 @@ class TDTestCase: # interval (20s) and time range is in records - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(prev) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(prev) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -610,7 +610,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(next) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(next) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -619,7 +619,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(linear) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(linear) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -628,7 +628,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(NULL) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(NULL) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -637,7 +637,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(value ,2 ) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(value ,2 ) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -646,7 +646,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) ;") tdSql.checkRows(9) tdSql.checkData(0,1,20) tdSql.checkData(2,1,10) @@ -655,7 +655,7 @@ class TDTestCase: tdSql.checkData(7,1,20) tdSql.checkData(8,1,10) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(NULL) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) fill(NULL) ;") tdSql.checkRows(18) tdSql.checkData(0,1,None) tdSql.checkData(2,1,None) @@ -667,7 +667,7 @@ class TDTestCase: # interval sliding - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) sliding(20s) fill(NULL) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) sliding(20s) fill(NULL) ;") tdSql.checkRows(18) tdSql.checkData(0,1,None) tdSql.checkData(2,1,None) @@ -677,7 +677,7 @@ class TDTestCase: tdSql.checkData(8,1,None) tdSql.checkData(9,1,20) - tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) sliding(10s) fill(NULL) group by tbname,ind ;") + tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' partition by tbname,ind interval(20s) sliding(10s) fill(NULL) ;") tdSql.checkRows(39) tdSql.checkData(0,1,None) tdSql.checkData(2,1,None) @@ -694,7 +694,7 @@ class TDTestCase: tdLog.info (" ======================================elapsed mixup with common col, it will not support =======================================") - tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and ind =1 group by tbname; ") + tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and ind =1 partition by tbname; ") tdSql.checkRows(1) tdSql.checkData(0,0,6) @@ -703,16 +703,16 @@ class TDTestCase: tdSql.checkData(0,0,6) tdSql.error("select ts,elapsed(ts,10s) from sub_empty_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ") - tdSql.error("select ts,elapsed(ts,10s) from stable_empty where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.error("select ts,elapsed(ts,10s) from stable_empty where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.error("select ts,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ") - tdSql.error("select ts,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.error("select ts,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.error("select q_int,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ") - tdSql.error("select q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.error("select q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' partition by tbname; ") tdSql.error("select ts,q_int,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ") - tdSql.error("select ts,q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ") + tdSql.error("select ts,q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' partition by tbname; ") def query_mix_Aggregate(self): @@ -729,7 +729,7 @@ class TDTestCase: tdSql.query(sql) tdSql.checkData(0,0,data[0][index]) - tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from stable_1 group by tbname; ") + tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from stable_1 partition by tbname; ") # Arithmetic with elapsed for common table @@ -795,11 +795,11 @@ class TDTestCase: for index , query in enumerate(querys_oper): - query_data = tdSql.getResult("select %s from stable_1 group by tbname;"%query) + query_data = tdSql.getResult("select %s from stable_1 partition by tbname;"%query) query_datas.append(query_data[0][0]) sql_common += " %s %s " %(query,operator) - sql_common=sql_common[:-2] + " from stable_1 group by tbname;" + sql_common=sql_common[:-2] + " from stable_1 partition by tbname;" tdSql.query(sql_common) results= query_datas[0] @@ -861,14 +861,14 @@ class TDTestCase: tdSql.query(sql) tdSql.checkData(0,0,data[0][index]) - tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 group by tbname ; ") + tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 partition by tbname ; ") - data = tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 group by tbname ; ") + data = tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 partition by tbname ; ") querys_mix = ["max(q_int)","min(q_int)" , "first(q_tinyint)", "first(q_int)","last(q_int)","APERCENTILE(q_int,10)","elapsed(ts,10s)"] for index , query in enumerate(querys_mix): - sql = "select %s from stable_1 group by tbname " %(query) + sql = "select %s from stable_1 partition by tbname " %(query) tdSql.query(sql) tdSql.checkData(0,0,data[0][index]) tdSql.checkData(1,0,data[0][index]) @@ -936,11 +936,11 @@ class TDTestCase: for index , query in enumerate(querys_oper): - query_data = tdSql.getResult("select %s from stable_1 group by tbname;"%query) + query_data = tdSql.getResult("select %s from stable_1 partition by tbname;"%query) query_datas.append(query_data[0][0]) sql_common += " %s %s " %(query,operator) - sql_common=sql_common[:-2] + " from stable_1 group by tbname;" + sql_common=sql_common[:-2] + " from stable_1 partition by tbname;" tdSql.query(sql_common) results= query_datas[0] @@ -993,7 +993,7 @@ class TDTestCase: for index , query in enumerate(querys): sql1 = "select elapsed(ts,10s),%s from sub_table1_1 " %(query) - sql2 = "select elapsed(ts,10s),%s from stable_1 group by tbname" %(query) + sql2 = "select elapsed(ts,10s),%s from stable_1 partition by tbname" %(query) if query in ["diff(q_int)","DERIVATIVE(q_int,1s,1)","ceil(q_float)","floor(q_float)","round(q_float)"]: tdSql.error(sql1) tdSql.error(sql2) @@ -1069,11 +1069,11 @@ class TDTestCase: tdLog.info (" ====================================== elapsed mixup with join =================================================") tdSql.error("select elapsed(ts,10s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts; ") - tdSql.error("select elapsed(ts,10s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts group by tbname; ") + tdSql.error("select elapsed(ts,10s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts partition by tbname; ") tdSql.execute("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts; ") tdSql.error("select elapsed(ts,10s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind; ") - tdSql.error("select elapsed(ts,10s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind group by tbname,ind; ") # join not support group by + tdSql.error("select elapsed(ts,10s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind partition by tbname,ind; ") # join not support group by tdSql.error("select elapsed(ts,10s) from sub_empty_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind ; ") tdSql.execute("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ") @@ -1141,56 +1141,56 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0,0,9) - tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;') + tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_sub_empty partition by tbname;') - tdSql.error('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;') + tdSql.error('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from stable_sub_empty partition by tbname;') tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from sub_empty_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev);') tdSql.checkRows(0) - tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_empty group by tbname;') + tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_empty partition by tbname;') - tdSql.error('select elapsed(ts,10s) from sub_empty_1 interval(1s) union all select elapsed(ts,10s) from stable_empty interval(1s) group by tbname;') + tdSql.error('select elapsed(ts,10s) from sub_empty_1 interval(1s) union all select elapsed(ts,10s) from stable_empty interval(1s) partition by tbname;') - # tdSql.error('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) group by tbname;') + # tdSql.error('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) partition by tbname;') - tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;") + tdSql.query("select elapsed(ts,10s) from stable_empty partition by tbname union all select elapsed(ts,10s) from stable_empty partition by tbname ;") tdSql.checkRows(0) # case : TD-12229 - tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;") + tdSql.query("select elapsed(ts,10s) from stable_empty partition by tbname union all select elapsed(ts,10s) from stable_1 partition by tbname ;") tdSql.checkRows(3) - tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;") + tdSql.query("select elapsed(ts,10s) from stable_1 partition by tbname union all select elapsed(ts,10s) from stable_1 partition by tbname ;") tdSql.checkRows(6) tdSql.checkData(0,0,9) tdSql.checkData(5,0,9) - tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;") + tdSql.query("select elapsed(ts,10s) from stable_1 partition by tbname union all select elapsed(ts,10s) from stable_2 partition by tbname ;") tdSql.checkRows(6) tdSql.checkData(0,0,9) tdSql.checkData(5,0,9) - tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\ - select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;') + tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) union all\ + select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) ;') tdSql.checkRows(360) tdSql.checkData(0,1,1) tdSql.checkData(50,1,0) #case : TD-12229 - tdSql.query('select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;') + tdSql.query('select elapsed(ts,10s) from stable_empty partition by tbname union all select elapsed(ts,10s) from stable_2 partition by tbname ;') tdSql.checkRows(3) - tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;') + tdSql.query('select elapsed(ts,10s) from stable_1 partition by tbname union all select elapsed(ts,10s) from stable_empty partition by tbname ;') tdSql.checkRows(3) - tdSql.query('select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\ - select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;') + tdSql.query('select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) union all\ + select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) ;') tdSql.checkRows(180) - tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\ - select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;') + tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) union all\ + select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname interval(10s) fill(prev) ;') tdSql.checkRows(180) # union all with sub table and regular table @@ -1247,8 +1247,8 @@ class TDTestCase: # stable with stable - tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\ - select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname;') + tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) partition by tbname union all\ + select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) partition by tbname;') tdSql.checkRows(360) tdSql.checkData(0,1,1) tdSql.checkData(12,1,0) @@ -1269,27 +1269,27 @@ class TDTestCase: tdSql.checkData(1,1,1) tdSql.checkData(9,1,1) - tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_2 group by tbname, ind order by ts asc ;') + tdSql.query('select elapsed(ts,10s) from stable_1 partition by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_2 partition by tbname, ind order by ts asc ;') tdSql.checkRows(6) tdSql.checkData(0,0,9) - tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts asc ;') + tdSql.query('select elapsed(ts,10s) from stable_1 partition by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_1 partition by tbname, ind order by ts asc ;') tdSql.checkRows(6) tdSql.checkData(0,0,9) - tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;') + tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) partition by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname,ind interval(10s) fill(prev) order by ts asc ;') tdSql.checkRows(210) tdSql.checkData(0,1,0) tdSql.checkData(1,1,1) tdSql.checkData(9,1,1) - tdSql.query('select elapsed(ts,10s) from stable_2 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;') + tdSql.query('select elapsed(ts,10s) from stable_2 interval(10s) partition by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname,ind interval(10s) fill(prev) order by ts asc ;') tdSql.checkRows(210) tdSql.checkData(0,1,0) tdSql.checkData(1,1,1) tdSql.checkData(9,1,1) - tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;') + tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) partition by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" partition by tbname,ind interval(10s) fill(prev) order by ts asc ;') tdSql.checkRows(210) tdSql.checkData(0,1,0) tdSql.checkData(1,1,1) @@ -1349,7 +1349,7 @@ class TDTestCase: for query in querys: sql1 = "select elapsed(ts,10s) from (select %s from regular_table_1 order by ts ) interval(1s); " % query sql2 = "select elapsed(ts,10s) from (select ts , tbname ,%s from regular_table_1 order by ts ) interval(1s); " % query - sql3 = "select elapsed(ts,10s) from (select ts , tbname ,%s from stable_1 group by tbname, ind order by ts ) interval(1s); " % query + sql3 = "select elapsed(ts,10s) from (select ts , tbname ,%s from stable_1 partition by tbname, ind order by ts ) interval(1s); " % query sql4 = "select elapsed(ts,10s) from (select %s from sub_table2_1 order by ts ) interval(1s); " % query sql5 = "select elapsed(ts,10s) from (select ts , tbname ,%s from sub_table2_1 order by ts ) interval(1s); " % query @@ -1364,17 +1364,17 @@ class TDTestCase: tdSql.error( "select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from regular_table_1) ; " ) tdSql.error( "select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from regular_table_1) ; " ) - tdSql.error( "select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from stable_1 group by tbname ) ; " ) - tdSql.error( "select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from stable_1 group by tbname) ; " ) + tdSql.error( "select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from stable_1 partition by tbname ) ; " ) + tdSql.error( "select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from stable_1 partition by tbname) ; " ) # stable - tdSql.error("select elapsed(ts,10s) from (select ts from stable_1 ) group by tbname ;") + tdSql.error("select elapsed(ts,10s) from (select ts from stable_1 ) partition by tbname ;") - tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from stable_1 group by tbname order by ts ) interval(1s) group by tbname;") + tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from stable_1 partition by tbname order by ts ) partition by tbname interval(1s) ;") - tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from stable_1 order by ts ) interval(1s) group by tbname;") + tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from stable_1 order by ts ) partition by tbname interval(1s);") # mixup with aggregate @@ -1384,8 +1384,8 @@ class TDTestCase: for index , query in enumerate(querys): sql1 = "select elapsed(ts,10s) from (select %s from sub_table1_1) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) ; " %(query) - sql2 = "select elapsed(ts,10s) from (select %s from stable_1 ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) group by tbname; " %(query) - sql3 = "select elapsed(ts,10s) from (select %s from stable_1 group by tbname) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) group by tbname; " %(query) + sql2 = "select elapsed(ts,10s) from (select %s from stable_1 ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" partition by tbname interval(10s) fill(prev) ; " %(query) + sql3 = "select elapsed(ts,10s) from (select %s from stable_1 partition by tbname) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" partition by tbname interval(10s) fill(prev) ; " %(query) if query in ["interp(q_int)" ]: # print(sql1 ) @@ -1477,7 +1477,7 @@ class TDTestCase: # case TD-12344 # session not support stable - tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,10s) group by tbname,ind order by ts asc ') + tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,10s) partition by tbname,ind order by ts asc ') tdSql.query('select elapsed(ts,10s) from sub_table1_1 session(ts,1w) ; ') tdSql.checkRows(1) @@ -1498,7 +1498,7 @@ class TDTestCase: # windows state # not support stable - tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) group by tbname,ind order by ts asc ') + tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) partition by tbname,ind order by ts asc ') tdSql.query('select elapsed(ts,10s) from sub_table1_1 state_window(q_int) ; ') tdSql.checkRows(10) @@ -1519,8 +1519,8 @@ class TDTestCase: def continuous_query(self): tdSql.error('create table elapsed_t as select elapsed(ts) from sub_table1_1 interval(1m) sliding(30s);') - tdSql.error('create table elapsed_tb as select elapsed(ts) from stable_1 interval(1m) sliding(30s) group by tbname;') - tdSql.error('create table elapsed_tc as select elapsed(ts) from stable_1 interval(10s) sliding(5s) interval(1m) sliding(30s) group by tbname;') + tdSql.error('create table elapsed_tb as select elapsed(ts) from stable_1 interval(1m) sliding(30s) partition by tbname;') + tdSql.error('create table elapsed_tc as select elapsed(ts) from stable_1 interval(10s) sliding(5s) interval(1m) sliding(30s) partition by tbname;') def query_precision(self): def generate_data(precision="ms"): @@ -1560,19 +1560,19 @@ class TDTestCase: if pres == "ms": if unit in ["10u","10b"]: - tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres)) + tdSql.error("select elapsed(ts,%s) from db_%s.st partition by tbname "%(unit,pres)) pass else: - tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres)) + tdSql.query("select elapsed(ts,%s) from db_%s.st partition by tbname "%(unit,pres)) elif pres == "us" and unit in ["10b"]: if unit in ["10b"]: - tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres)) + tdSql.error("select elapsed(ts,%s) from db_%s.st partition by tbname "%(unit,pres)) pass else: - tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres)) + tdSql.query("select elapsed(ts,%s) from db_%s.st partition by tbname "%(unit,pres)) else: - tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres)) + tdSql.query("select elapsed(ts,%s) from db_%s.st partition by tbname "%(unit,pres)) basic_result = 9 tdSql.checkData(0,0,basic_result*pow(1000,index))