"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; ",
# "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,1s) from stable_empty group by ts order by ts;",
"select elapsed(ts,1s) from stable_1 group by ind order by ts;",
"select elapsed(ts,1s) from stable_2 group by tstag order by ts;",
"select elapsed(ts,1s) from stable_1 group by tbname,tstag,tscol order by ts;",
"select elapsed(ts,1s),ts from stable_1 group by tbname ,ind order by ts;",
"select ts,elapsed(ts,1s),tscol*100 from stable_1 group 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;",
...
...
@@ -178,13 +178,13 @@ class TDTestCase:
"select elapsed(tscol) from sub_empty_1 order by ts desc;",
"select elapsed(tstag) from sub_empty_1 order by ts desc;",
"select elapsed(ind) from sub_table1_1 order by ts desc;",
"select elapsed(ind,10s) from sub_table1_1 order by ts desc;",
"select elapsed(tscol,10s) from sub_table1_1 order by ts desc;",
"select elapsed(tstag,10s) from sub_table1_1 order by ts desc;",
"select elapsed(q_int,10s) from sub_table1_1 order by ts desc;",
"select elapsed(loc,10s) from sub_table1_1 order by ts desc;",
"select elapsed(q_bigint,10s) from sub_table1_1 order by ts desc;",
"select elapsed(bin_chars,10s) from sub_table1_1 order by ts desc;"]
"select elapsed(ind,1s) from sub_table1_1 order by ts desc;",
"select elapsed(tscol,1s) from sub_table1_1 order by ts desc;",
"select elapsed(tstag,1s) from sub_table1_1 order by ts desc;",
"select elapsed(q_int,1s) from sub_table1_1 order by ts desc;",
"select elapsed(loc,1s) from sub_table1_1 order by ts desc;",
"select elapsed(q_bigint,1s) from sub_table1_1 order by ts desc;",
"select elapsed(bin_chars,1s) from sub_table1_1 order by ts desc;"]
forsqlinsqls_list:
tdSql.error(sql)
...
...
@@ -199,269 +199,269 @@ 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,1s) from stable_1 where ts >= %d group by tbname "%(ts_start_time)
tdSql.query(filter_sql)
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(1,0,float(self.num-i-1))
tdSql.checkData(2,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
tdSql.checkData(1,0,float((self.num-i-1)*10))
tdSql.checkData(2,0,float((self.num-i-1)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts >= %d "%(ts_start_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts >= %d "%(ts_start_time)
tdSql.query(filter_sql)
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
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,1s) 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)
tdSql.query(filter_sql)
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts >= %d and tscol >= %d "%(ts_start_time,ts_col_start_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts >= %d and tscol >= %d "%(ts_start_time,ts_col_start_time)
tdSql.query(filter_sql)
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
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,1s) 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)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts >= %d and tscol > %d "%(ts_start_time,ts_col_start_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts >= %d and tscol > %d "%(ts_start_time,ts_col_start_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) 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)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts > %d and tscol > %d "%(ts_start_time,ts_col_start_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts > %d and tscol > %d "%(ts_start_time,ts_col_start_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) 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)
tdSql.query(filter_sql)
tdSql.checkRows(0)
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts > %d and tscol <= %d "%(ts_start_time,ts_col_start_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts > %d and tscol <= %d "%(ts_start_time,ts_col_start_time)
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,1s) 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)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts < %d and tscol <= %d "%(ts_end_time,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts < %d and tscol <= %d "%(ts_end_time,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) from stable_1 where ts < %d and tscol <= %d group by tbname "%(ts_end_time,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(1,0,float(self.num-i-2))
tdSql.checkData(2,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
tdSql.checkData(1,0,float((self.num-i-2)*10))
tdSql.checkData(2,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts < %d and tscol <= %d "%(ts_end_time,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts < %d and tscol <= %d "%(ts_end_time,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) from stable_1 where ts = %d and tscol < %d group by tbname "%(ts_end_time,ts_col_end_time)
tdSql.query(filter_sql)
tdSql.checkRows(0)
filter_sql="select elapsed(ts,10s) from sub_table1_1 where ts = %d and tscol < %d "%(ts_end_time,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where ts = %d and tscol < %d "%(ts_end_time,ts_col_end_time)
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,1s) from stable_1 where q_tinyint != %d and tscol < %d group by tbname "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(1,0,float(self.num-i-2))
tdSql.checkData(2,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
tdSql.checkData(1,0,float((self.num-i-2)*10))
tdSql.checkData(2,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where q_tinyint != %d and tscol < %d "%(i,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where q_tinyint != %d and tscol < %d "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) from stable_1 where q_tinyint != %d and tscol <= %d group by tbname "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num:
tdSql.checkRows(0)
else:
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(1,0,float(self.num-i-1))
tdSql.checkData(2,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
tdSql.checkData(1,0,float((self.num-i-1)*10))
tdSql.checkData(2,0,float((self.num-i-1)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where q_tinyint != %d and tscol <= %d "%(i,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where q_tinyint != %d and tscol <= %d "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
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,1s) from stable_1 where q_tinyint <> %d and tscol < %d group by tbname "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(1,0,float(self.num-i-2))
tdSql.checkData(2,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
tdSql.checkData(1,0,float((self.num-i-2)*10))
tdSql.checkData(2,0,float((self.num-i-2)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where q_tinyint <> %d and tscol < %d "%(i,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where q_tinyint <> %d and tscol < %d "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num-1:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-2))
tdSql.checkData(0,0,float((self.num-i-2)*10))
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,1s) from stable_1 where q_tinyint <> %d and tscol <= %d group by tbname "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num:
tdSql.checkRows(0)
else:
tdSql.checkRows(3)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(1,0,float(self.num-i-1))
tdSql.checkData(2,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
tdSql.checkData(1,0,float((self.num-i-1)*10))
tdSql.checkData(2,0,float((self.num-i-1)*10))
filter_sql="select elapsed(ts,10s) from sub_table1_1 where q_tinyint <> %d and tscol <= %d "%(i,ts_col_end_time)
filter_sql="select elapsed(ts,1s) from sub_table1_1 where q_tinyint <> %d and tscol <= %d "%(i,ts_col_end_time)
tdSql.query(filter_sql)
ifi==self.num:
tdSql.checkRows(0)
else:
tdSql.checkRows(1)
tdSql.checkData(0,0,float(self.num-i-1))
tdSql.checkData(0,0,float((self.num-i-1)*10))
# filter between and
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 \
tdSql.query("select elapsed(ts,1s) 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,20)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,2)
tdSql.checkData(1,0,2)
tdSql.checkData(2,0,2)
tdSql.checkData(0,0,20)
tdSql.checkData(1,0,20)
tdSql.checkData(2,0,20)
# filter in and or
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.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.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.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.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.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.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.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,1s) 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,20)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,20)
tdSql.checkData(1,0,20)
tdSql.checkData(2,0,20)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,20)
tdSql.checkData(1,0,20)
tdSql.checkData(2,0,20)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,10)
tdSql.checkData(1,0,10)
tdSql.checkData(2,0,10)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,10)
tdSql.checkData(1,0,10)
tdSql.checkData(2,0,10)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,60)
tdSql.checkData(1,0,60)
tdSql.checkData(2,0,60)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,60)
tdSql.checkData(1,0,60)
tdSql.checkData(2,0,60)
tdSql.query("select elapsed(ts,1s) 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.checkData(0,0,60)
tdSql.checkData(1,0,60)
tdSql.checkData(2,0,60)
tdSql.query("select elapsed(ts,1s) 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.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,1s) 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.checkRows(3)
tdSql.checkData(0,0,6)
tdSql.checkData(1,0,6)
tdSql.checkData(2,0,6)
tdSql.checkData(0,0,60)
tdSql.checkData(1,0,60)
tdSql.checkData(2,0,60)
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,1s) 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.checkRows(3)
tdSql.checkData(0,0,6)
tdSql.checkData(1,0,6)
tdSql.checkData(2,0,6)
tdSql.checkData(0,0,60)
tdSql.checkData(1,0,60)
tdSql.checkData(2,0,60)
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,1s) 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.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,1s) 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.checkRows(3)
tdSql.checkData(0,0,9)
tdSql.checkData(1,0,9)
tdSql.checkData(2,0,9)
tdSql.checkData(0,0,90)
tdSql.checkData(1,0,90)
tdSql.checkData(2,0,90)
defquery_interval(self):
...
...
@@ -473,9 +473,9 @@ 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,1s)*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.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.query("select elapsed(ts,1s)*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)
foriinrange(self.num):
...
...
@@ -487,254 +487,254 @@ 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,1s) from stable_1 where ts <=%d interval(10s) group by tbname "%(ts_start_time)
tdSql.query(interval_sql)
tdSql.checkRows(3*(i+1))
interval_sql="select elapsed(ts,10s) from sub_table1_1 where ts <=%d interval(10s) "%(ts_start_time)
interval_sql="select elapsed(ts,1s) from sub_table1_1 where ts <=%d interval(10s) "%(ts_start_time)
tdSql.query(interval_sql)
tdSql.checkRows(i+1)
forxinrange(i+1):
ifx==i:
tdSql.checkData(x,1,0)
else:
tdSql.checkData(x,1,1)
tdSql.checkData(x,1,10)
# interval and fill , fill_type = ["NULL","value,100","prev","next","linear"]
# interval (10s) and time range is outer records
# interval (1s) 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,1s)*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.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.query("select elapsed(ts,1s)*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,1s)*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.checkRows(180)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,100)
tdSql.checkData(9,1,0)
tdSql.checkData(59,1,0)
tdSql.checkData(60,1,10)
tdSql.checkData(60,1,100)
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,1s)*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.checkRows(180)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,100)
tdSql.checkData(9,1,0)
tdSql.checkData(10,1,None)
tdSql.checkData(59,1,None)
tdSql.checkData(60,1,10)
tdSql.checkData(61,1,10)
tdSql.checkData(60,1,100)
tdSql.checkData(61,1,100)
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,1s)*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.checkRows(180)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,100)
tdSql.checkData(9,1,0)
tdSql.checkData(10,1,None)
tdSql.checkData(59,1,None)
tdSql.checkData(60,1,10)
tdSql.checkData(61,1,10)
tdSql.checkData(60,1,100)
tdSql.checkData(61,1,100)
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,1s)*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.checkRows(180)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,100)
tdSql.checkData(9,1,0)
tdSql.checkData(10,1,None)
tdSql.checkData(59,1,None)
tdSql.checkData(60,1,10)
tdSql.checkData(61,1,10)
tdSql.checkData(60,1,100)
tdSql.checkData(61,1,100)
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,1s)*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.checkRows(180)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,100)
tdSql.checkData(9,1,0)
tdSql.checkData(10,1,2)
tdSql.checkData(59,1,2)
tdSql.checkData(10,1,20)
tdSql.checkData(59,1,20)
tdSql.checkData(60,1,10)
tdSql.checkData(61,1,10)
tdSql.checkData(61,1,100)
# 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,1s)*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.checkRows(90)
tdSql.checkData(0,1,20)
tdSql.checkData(4,1,10)
tdSql.checkData(5,1,10)
tdSql.checkData(29,1,10)
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.checkData(0,1,200)
tdSql.checkData(4,1,100)
tdSql.checkData(5,1,100)
tdSql.checkData(29,1,100)
tdSql.checkData(30,1,200)
tdSql.checkData(31,1,200)
tdSql.query("select elapsed(ts,1s)*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.checkRows(90)
tdSql.checkData(0,1,20)
tdSql.checkData(4,1,10)
tdSql.checkData(0,1,200)
tdSql.checkData(4,1,100)
tdSql.checkData(5,1,None)
tdSql.checkData(29,1,None)
tdSql.checkData(30,1,20)
tdSql.checkData(31,1,20)
tdSql.checkData(30,1,200)
tdSql.checkData(31,1,200)
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,1s)*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.checkRows(90)
tdSql.checkData(0,1,20)
tdSql.checkData(4,1,10)
tdSql.checkData(0,1,200)
tdSql.checkData(4,1,100)
tdSql.checkData(5,1,None)
tdSql.checkData(29,1,None)
tdSql.checkData(30,1,20)
tdSql.checkData(31,1,20)
tdSql.checkData(30,1,200)
tdSql.checkData(31,1,200)
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,1s)*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.checkRows(90)
tdSql.checkData(0,1,20)
tdSql.checkData(4,1,10)
tdSql.checkData(0,1,200)
tdSql.checkData(4,1,100)
tdSql.checkData(5,1,None)
tdSql.checkData(29,1,None)
tdSql.checkData(30,1,20)
tdSql.checkData(31,1,20)
tdSql.checkData(30,1,200)
tdSql.checkData(31,1,200)
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,1s)*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.checkRows(90)
tdSql.checkData(0,1,20)
tdSql.checkData(4,1,10)
tdSql.checkData(5,1,2)
tdSql.checkData(29,1,2)
tdSql.checkData(30,1,20)
tdSql.checkData(31,1,20)
tdSql.checkData(0,1,200)
tdSql.checkData(4,1,100)
tdSql.checkData(5,1,20)
tdSql.checkData(29,1,20)
tdSql.checkData(30,1,200)
tdSql.checkData(31,1,200)
# 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,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(9)
tdSql.checkData(0,1,20)
tdSql.checkData(2,1,10)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
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.checkData(0,1,200)
tdSql.checkData(2,1,100)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(8,1,100)
tdSql.query("select elapsed(ts,1s)*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.checkRows(18)
tdSql.checkData(0,1,None)
tdSql.checkData(2,1,None)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,None)
tdSql.checkData(8,1,None)
tdSql.checkData(9,1,20)
tdSql.checkData(9,1,200)
# 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,1s)*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.checkRows(18)
tdSql.checkData(0,1,None)
tdSql.checkData(2,1,None)
tdSql.checkData(3,1,20)
tdSql.checkData(5,1,10)
tdSql.checkData(3,1,200)
tdSql.checkData(5,1,100)
tdSql.checkData(7,1,None)
tdSql.checkData(8,1,None)
tdSql.checkData(9,1,20)
tdSql.checkData(9,1,200)
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,1s)*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.checkRows(39)
tdSql.checkData(0,1,None)
tdSql.checkData(2,1,None)
tdSql.checkData(6,1,10)
tdSql.checkData(7,1,20)
tdSql.checkData(6,1,100)
tdSql.checkData(7,1,200)
tdSql.checkData(12,1,0)
tdSql.checkData(13,1,None)
tdSql.checkData(15,1,None)
tdSql.checkData(19,1,10)
tdSql.checkData(20,1,20)
tdSql.checkData(19,1,100)
tdSql.checkData(20,1,200)
tdSql.checkData(25,1,0)
defquery_mix_common(self):
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,1s) 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.checkRows(1)
tdSql.checkData(0,0,6)
tdSql.checkData(0,0,60)
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' ; ")
tdSql.query("select elapsed(ts,1s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
tdSql.checkRows(1)
tdSql.checkData(0,0,6)
tdSql.checkData(0,0,60)
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,1s) 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,1s) 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 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,1s) 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,1s) 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 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,1s) 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,1s) 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 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,1s) 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,1s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ")
defquery_mix_Aggregate(self):
tdLog.info(" ====================================== elapsed mixup with aggregate ==================================================")
tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from sub_table1_1 ; ")
tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) from sub_table1_1 ; ")
data=tdSql.getResult("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from sub_table1_1 ; ")
data=tdSql.getResult("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) from sub_table1_1 ; ")
tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,10s) from sub_table1_1 ; ")
tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,1s) from sub_table1_1 ; ")
data=tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,10s) from sub_table1_1 ; ")
data=tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,1s) from sub_table1_1 ; ")
forindex,queryinenumerate(querys_mix):
sql="select %s from sub_table1_1 "%(query)
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,1s) 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 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,1s) from stable_1 group by tbname ; ")
sql="select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,10s) from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
sql="select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,1s) from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
tdSql.execute(sql)
data=tdSql.getResult(sql)
sql="select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,10s) from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
sql="select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,1s) from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
sql="select %s from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; "%(query)
...
...
@@ -1053,50 +1053,50 @@ class TDTestCase:
tdLog.info(" ====================================== elapsed mixup with arithmetic =================================================")
tdSql.execute("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
tdSql.execute("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
tdSql.execute("select elapsed(ts,1s)+1 ,elapsed(ts,1s)-2,elapsed(ts,1s)*3,elapsed(ts,1s)/4,elapsed(ts,1s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
tdSql.execute("select elapsed(ts,1s)+1 ,elapsed(ts,1s)-2,elapsed(ts,1s)*3,elapsed(ts,1s)/4,elapsed(ts,1s)%5 from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
# sql = "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(1s) fill(prev) ;" % (query)
# data = tdSql.getResult(sql)
# tdSql.query("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) ; ")
# tdSql.query("select elapsed(ts,1s)+1 ,elapsed(ts,1s)-2,elapsed(ts,1s)*3,elapsed(ts,1s)/4,elapsed(ts,1s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) ; ")
# tdSql.checkData(0,index+1,data[0][1])
defquery_with_join(self):
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,1s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts; ")
tdSql.error("select elapsed(ts,1s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts group 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.execute("select elapsed(ts,1s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts; ")
tdSql.error("select elapsed(ts,1s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind; ")
tdSql.error("select elapsed(ts,1s) 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 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 ; ")
tdSql.error("select elapsed(ts,1s) from sub_empty_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind ; ")
tdSql.execute("select elapsed(ts,1s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.query("select elapsed(ts,10s) from sub_table1_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkData(0,0,9)
tdSql.query("select elapsed(ts,1s) from sub_table1_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkData(0,0,90)
tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.query("select elapsed(ts,1s) from sub_empty_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkRows(0)
tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , regular_empty TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.query("select elapsed(ts,1s) from sub_empty_1 TABLE1 , regular_empty TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkRows(0)
tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.query("select elapsed(ts,1s) from sub_empty_1 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkRows(0)
tdSql.query("select elapsed(ts,10s) from sub_table1_3 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.query("select elapsed(ts,1s) from sub_table1_3 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query("select elapsed(ts,10s) from regular_table_1 ; ")
tdSql.query("select elapsed(ts,1s) from regular_table_1 ; ")
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
defquery_with_union(self):
...
...
@@ -1104,196 +1104,196 @@ class TDTestCase:
# union all with empty
tdSql.query("select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from regular_table_2;")
tdSql.query("select elapsed(ts,1s) from regular_table_1 union all select elapsed(ts,1s) from regular_table_2;")
tdSql.query("select elapsed(ts,10s) from regular_table_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 regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select elapsed(ts,1s) from regular_table_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,1s) from regular_table_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(1200)
tdSql.checkData(0,1,0.1)
tdSql.checkData(0,1,1)
tdSql.checkData(500,1,0)
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 regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select elapsed(ts,1s) 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,1s) from regular_table_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(600)
tdSql.checkData(0,1,0.1)
tdSql.checkData(0,1,1)
tdSql.checkData(500,0,0)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_empty_2;')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 union all select elapsed(ts,1s) from sub_empty_2;')
tdSql.checkRows(0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from sub_empty_1;')
tdSql.query('select elapsed(ts,1s) from regular_table_1 union all select elapsed(ts,1s) from sub_empty_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 union all select elapsed(ts,1s) from regular_table_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_table1_1;')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 union all select elapsed(ts,1s) from sub_table1_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 union all select elapsed(ts,10s) from sub_empty_1;')
tdSql.query('select elapsed(ts,1s) from sub_table1_1 union all select elapsed(ts,1s) from sub_empty_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 union all select elapsed(ts,1s) from regular_table_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
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,1s) from sub_empty_1 union all select elapsed(ts,1s) 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 group by tbname;')
tdSql.error('select elapsed(ts,1s) from regular_table_1 union all select elapsed(ts,1s) from stable_sub_empty group 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.query('select elapsed(ts,1s) 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,1s) 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,1s) from sub_empty_1 union all select elapsed(ts,1s) from stable_empty 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) group by tbname;')
tdSql.error('select elapsed(ts,1s) from sub_empty_1 interval(1s) union all select elapsed(ts,1s) from stable_empty interval(1s) 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) group by tbname;')
# tdSql.error('select elapsed(ts,1s) 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,1s) 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.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,1s) from stable_empty group by tbname union all select elapsed(ts,1s) from stable_empty group 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,1s) from stable_empty group by tbname union all select elapsed(ts,1s) from stable_1 group 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,1s) from stable_1 group by tbname union all select elapsed(ts,1s) from stable_1 group by tbname ;")
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(5,0,9)
tdSql.checkData(0,0,90)
tdSql.checkData(5,0,90)
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,1s) from stable_1 group by tbname union all select elapsed(ts,1s) from stable_2 group by tbname ;")
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(5,0,9)
tdSql.checkData(0,0,90)
tdSql.checkData(5,0,90)
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,1s) 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,1s) 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.checkRows(360)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
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,1s) from stable_empty group by tbname union all select elapsed(ts,1s) from stable_2 group 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,1s) from stable_1 group by tbname union all select elapsed(ts,1s) from stable_empty group 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,1s) 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,1s) 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.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,1s) 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,1s) 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.checkRows(180)
# union all with sub table and regular table
# sub_table with sub_table
tdSql.query('select elapsed(ts,10s) 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) union all\
select elapsed(ts,10s) from sub_table2_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) 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) union all\
select elapsed(ts,1s) from sub_table2_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(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) 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) union all\
select elapsed(ts,10s) 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) ;')
tdSql.query('select elapsed(ts,1s) 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) union all\
select elapsed(ts,1s) 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) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) 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) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) 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) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) from regular_table_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(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) from regular_table_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(120)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
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(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) from regular_table_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(60)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
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(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,1s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(60)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
# 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,1s) 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,1s) 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.checkRows(360)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all 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(10s) fill(prev);')
tdSql.query('select elapsed(ts,1s) from regular_table_2 interval(10s) union all select elapsed(ts,1s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev);')
tdSql.checkRows(10)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(9,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.query('select elapsed(ts,1s) from regular_table_2 interval(10s) union all select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(70)
tdSql.checkData(0,1,1)
tdSql.checkData(0,1,10)
tdSql.checkData(9,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) order by ts desc union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) order by ts asc;')
tdSql.query('select elapsed(ts,1s) from regular_table_2 interval(10s) order by ts desc union all select elapsed(ts,1s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) order by ts asc;')
tdSql.checkRows(70)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.checkData(1,1,10)
tdSql.checkData(9,1,10)
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,1s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,1s) from stable_2 group by tbname, ind order by ts asc ;')
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
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,1s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,1s) from stable_1 group by tbname, ind order by ts asc ;')
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
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,1s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,1s) 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.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(1,1,10)
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,1s) from stable_2 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,1s) 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.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.checkData(1,1,10)
tdSql.checkData(9,1,10)
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,1s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,1s) 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.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.checkData(1,1,10)
tdSql.checkData(9,1,10)
defquery_nest(self):
...
...
@@ -1305,12 +1305,12 @@ class TDTestCase:
# ts can't be used at outer query
tdSql.query("select elapsed(ts,10s) from (select ts from regular_table_1 );")
tdSql.query("select elapsed(ts,1s) from (select ts from regular_table_1 );")
# case : TD-12164
tdSql.error("select elapsed(ts,10s) from (select qint ts from regular_table_1 );")
tdSql.error("select elapsed(tbname ,10s) from (select qint tbname from regular_table_1 );")
tdSql.error("select elapsed(ts,1s) from (select qint ts from regular_table_1 );")
tdSql.error("select elapsed(tbname ,1s) from (select qint tbname from regular_table_1 );")
tdSql.error("select elapsed(tsc ,1s) from (select q_int tsc from regular_table_1) ;")
tdSql.error("select elapsed(tsv ,1s) from (select elapsed(ts,1s) tsv from regular_table_1);")
tdSql.error("select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from regular_table_1);")
...
...
@@ -1318,40 +1318,40 @@ class TDTestCase:
# tdSql.error("select elapsed(tsc ,1s) from (select tscol tsc from regular_table_1) ;")
# case TD-12276
# tdSql.error("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts asc );")
# tdSql.error("select elapsed(ts,1s) from (select ts,tbname from regular_table_1 order by ts asc );")
# tdSql.error("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts desc );")
# tdSql.error("select elapsed(ts,1s) from (select ts,tbname from regular_table_1 order by ts desc );")
# tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,1s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from regular_table_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,1s) from (select ts ,q_int,tbname from regular_table_1 order by ts ) interval(1s);")
# sub table
tdSql.query("select elapsed(ts,10s) from (select ts from sub_table1_1 );")
tdSql.query("select elapsed(ts,1s) from (select ts from sub_table1_1 );")
# tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from sub_table1_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,1s) from (select ts ,max(q_int),tbname from sub_table1_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from sub_table1_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,1s) from (select ts ,q_int,tbname from sub_table1_1 order by ts ) interval(1s);")
tdSql.query("select elapsed(ts,10s) from (select ts ,tbname,top(q_int,3) from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,1s) from (select ts ,tbname,top(q_int,3) from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,10s) from (select ts ,tbname,bottom(q_int,3) from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,1s) from (select ts ,tbname,bottom(q_int,3) from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,10s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,1s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,10s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
tdSql.query("select elapsed(ts,1s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
# tdSql.error("select elapsed(ts,10s) from (select ts ,count(*),tbname from sub_table1_1 order by ts ) interval(1s);")
# tdSql.error("select elapsed(ts,1s) from (select ts ,count(*),tbname from sub_table1_1 order by ts ) interval(1s);")
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)
sql1="select elapsed(ts,1s) 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,1s) 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,1s) 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)
ifqueryin["interp(q_int)"]:
# print(sql1 )
...
...
@@ -1397,55 +1397,55 @@ class TDTestCase:
tdSql.error(sql2)
tdSql.error(sql3)
tdSql.query("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select elapsed(ts,1s) from (select ts,tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select elapsed(ts,1s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_table1_1 ); ")
tdSql.checkData(0,0,9)
tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from sub_table1_1 ); ")
tdSql.checkData(0,0,90)
# tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_table1_1 \
# tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from sub_table1_1 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.checkData(0,0,0.1)
# tdSql.checkData(0,0,1)
tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 ); ")
tdSql.checkData(0,5,9)
tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 ); ")
tdSql.checkData(0,5,90)
# tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.checkData(0,0,0.1)
# tdSql.checkData(0,0,1)
tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 ); ")
tdSql.checkData(0,0,9)
tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 ); ")
tdSql.checkData(0,0,90)
# tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(1)
# tdSql.checkData(0,0,0.1)
# tdSql.checkData(0,0,1)
# tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_empty_2 \
# tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data 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.query("select max(data),min(data),avg(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select max(data),min(data),avg(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(1)
# tdSql.query("select ceil(data),floor(data),round(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select ceil(data),floor(data),round(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.query("select spread(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select spread(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(1)
# tdSql.query("select diff(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select diff(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(599)
...
...
@@ -1453,23 +1453,23 @@ class TDTestCase:
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(598)
# tdSql.query("select ceil(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select ceil(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.query("select floor(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select floor(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.query("select round(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select round(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
# tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
# tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,1s) data from regular_table_3 \
# where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
# tdSql.checkRows(600)
...
...
@@ -1477,49 +1477,49 @@ 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,1s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,1s) group by tbname,ind order by ts asc ')
tdSql.query('select elapsed(ts,10s) from sub_table1_1 session(ts,1w) ; ')
tdSql.query('select elapsed(ts,1s) from sub_table1_1 session(ts,1w) ; ')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1w) ; ')
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,1s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1w) ; ')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.checkData(0,0,90)
tdSql.query('select elapsed(ts,10s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
tdSql.query('select elapsed(ts,1s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
tdSql.error('select elapsed(ts,10s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
tdSql.error('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) session(ts,1w) ; ')
# tdSql.error('select elapsed(ts,1s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
# tdSql.error('select elapsed(ts,1s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) session(ts,1w) ; ')
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" session(ts,1w) ; ')
tdSql.query('select elapsed(ts,1s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1w) ; ')
tdSql.checkRows(0)
# 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,1s) 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.query('select elapsed(ts,10s) from sub_table1_1 state_window(q_int) ; ')
tdSql.query('select elapsed(ts,1s) from sub_table1_1 state_window(q_int) ; ')
tdSql.checkRows(10)
tdSql.checkData(0,0,0)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) ; ')
tdSql.query('select elapsed(ts,1s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) ; ')
tdSql.checkRows(10)
tdSql.checkData(0,0,0)
# tdSql.error('select elapsed(ts,10s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
# tdSql.error('select elapsed(ts,1s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
# tdSql.error('select elapsed(ts,10s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
# tdSql.error('select elapsed(ts,1s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
# tdSql.error('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) state_window(q_int) ; ')
# tdSql.error('select elapsed(ts,1s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) state_window(q_int) ; ')
# 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" state_window(q_int); ')
# tdSql.query('select elapsed(ts,1s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int); ')
# tdSql.checkRows(0)
defcontinuous_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_tc as select elapsed(ts) from stable_1 interval(1s) sliding(5s) interval(1m) sliding(30s) group by tbname;')
defquery_precision(self):
defgenerate_data(precision="ms"):
...
...
@@ -1549,7 +1549,7 @@ class TDTestCase:
tdSql.execute(sql1)
tdSql.execute(sql2)
time_units=["10s","10a","10u","10b"]
time_units=["1s","1a","1u","1b"]
precision_list=["ms","us","ns"]
forpresinprecision_list:
...
...
@@ -1558,13 +1558,13 @@ class TDTestCase:
forindex,unitinenumerate(time_units):
ifpres=="ms":
ifunitin["10u","10b"]:
ifunitin["1u","1b"]:
tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
pass
else:
tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
elifpres=="us"andunitin["10b"]:
ifunitin["10b"]:
elifpres=="us"andunitin["1b"]:
ifunitin["1b"]:
tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
pass
else:
...
...
@@ -1572,7 +1572,7 @@ class TDTestCase:
else:
tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))