From bb021697ee3e2db8bb9c20956f6ef13643b76043 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 20 Jul 2022 14:04:07 +0800 Subject: [PATCH] fix max_partion.py test case --- tests/system-test/2-query/max_partition.py | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/system-test/2-query/max_partition.py b/tests/system-test/2-query/max_partition.py index 0a7214ec75..a352865c45 100644 --- a/tests/system-test/2-query/max_partition.py +++ b/tests/system-test/2-query/max_partition.py @@ -11,13 +11,13 @@ class TDTestCase: self.row_nums = 10 self.tb_nums = 10 self.ts = 1537146000000 - + def prepare_datas(self, stb_name , tb_nums , row_nums ): tdSql.execute(" use db ") tdSql.execute(f" create stable {stb_name} (ts timestamp , c1 int , c2 bigint , c3 float , c4 double , c5 smallint , c6 tinyint , c7 bool , c8 binary(36) , c9 nchar(36) , uc1 int unsigned,\ uc2 bigint unsigned ,uc3 smallint unsigned , uc4 tinyint unsigned ) tags(t1 timestamp , t2 int , t3 bigint , t4 float , t5 double , t6 smallint , t7 tinyint , t8 bool , t9 binary(36)\ , t10 nchar(36) , t11 int unsigned , t12 bigint unsigned ,t13 smallint unsigned , t14 tinyint unsigned ) ") - + for i in range(tb_nums): tbname = f"sub_{stb_name}_{i}" ts = self.ts + i*10000 @@ -30,7 +30,7 @@ class TDTestCase: for null in range(5): ts = self.ts + row_nums*1000 + null*1000 tdSql.execute(f"insert into {tbname} values({ts} , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )") - + def basic_query(self): tdSql.query("select count(*) from stb") tdSql.checkData(0,0,(self.row_nums + 5 )*self.tb_nums) @@ -44,7 +44,7 @@ class TDTestCase: tdSql.query(" select max(t2) from stb group by c1 order by t1 ") tdSql.query(" select max(c1) from stb group by tbname order by tbname ") tdSql.checkRows(self.tb_nums) - # bug need fix + # bug need fix tdSql.query(" select max(t2) from stb group by t2 order by t2 ") tdSql.checkRows(self.tb_nums) tdSql.query(" select max(c1) from stb group by c1 order by c1 ") @@ -62,8 +62,8 @@ class TDTestCase: # bug need fix # tdSql.query(" select tbname , max(c1) from sub_stb_1 where c1 is null group by c1 order by c1 desc ") - # tdSql.checkRows(1) - # tdSql.checkData(0,0,"sub_stb_1") + # tdSql.checkRows(1) + # tdSql.checkData(0,0,"sub_stb_1") tdSql.query("select max(c1) ,c2 ,t2,tbname from stb group by abs(c1) order by abs(c1)") tdSql.checkRows(self.row_nums+1) @@ -80,7 +80,7 @@ class TDTestCase: tdSql.checkRows(2) tdSql.query(" select max(c1) from stb where abs(c1+t2)=1 partition by tbname ") tdSql.checkRows(2) - + tdSql.query(" select tbname , max(c1) from stb partition by tbname order by tbname ") tdSql.checkRows(self.tb_nums) tdSql.checkData(0,1,self.row_nums-1) @@ -89,7 +89,7 @@ class TDTestCase: tdSql.query("select tbname , max(t2) from stb partition by t1 order by t1") tdSql.query("select tbname , max(t2) from stb partition by t2 order by t2") - # # bug need fix + # # bug need fix tdSql.query("select t2 , max(t2) from stb partition by t2 order by t2") tdSql.checkRows(self.tb_nums) @@ -97,7 +97,7 @@ class TDTestCase: tdSql.checkRows(self.tb_nums) tdSql.checkData(0,1,self.row_nums-1) - + tdSql.query("select tbname , max(c1) from stb partition by t2 order by t2") tdSql.query("select c2, max(c1) from stb partition by c2 order by c2 desc") @@ -125,10 +125,10 @@ class TDTestCase: tdSql.checkRows(self.tb_nums) tdSql.checkData(0,0,self.row_nums) - # bug need fix + # bug need fix tdSql.query("select count(c1) , max(t2) ,abs(c1) from stb partition by abs(c1) order by abs(c1)") tdSql.checkRows(self.row_nums+1) - + tdSql.query("select max(ceil(c2)) , max(floor(t2)) ,max(floor(c2)) from stb partition by abs(c2) order by abs(c2)") tdSql.checkRows(self.row_nums+1) @@ -148,15 +148,15 @@ class TDTestCase: tdSql.query(" select c1 , sample(c1,2) from stb partition by tbname order by tbname ") tdSql.checkRows(self.tb_nums*2) - - # interval + + # interval tdSql.query("select max(c1) from stb interval(2s) sliding(1s)") # bug need fix tdSql.query('select max(c1) from stb where ts>="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s) fill(NULL)') - + tdSql.query(" select tbname , count(c1) from stb partition by tbname interval(10s) slimit 5 soffset 1 ") tdSql.query("select tbname , max(c1) from stb partition by tbname interval(10s)") @@ -179,12 +179,12 @@ class TDTestCase: tdSql.query("select c1 , sample(c1,2) from stb partition by c1 order by c1") tdSql.checkRows(21) - # bug need fix + # bug need fix # tdSql.checkData(0,1,None) tdSql.query("select c1 , twa(c1) from stb partition by c1 order by c1") tdSql.checkRows(11) - tdSql.checkData(0,1,0.000000000) + tdSql.checkData(0,1,None) tdSql.query("select c1 , irate(c1) from stb partition by c1 order by c1") tdSql.checkRows(11) @@ -192,7 +192,7 @@ class TDTestCase: tdSql.query("select c1 , DERIVATIVE(c1,2,1) from stb partition by c1 order by c1") tdSql.checkRows(72) - # bug need fix + # bug need fix # tdSql.checkData(0,1,None) @@ -201,15 +201,15 @@ class TDTestCase: - # bug need fix - # tdSql.query(" select tbname , max(c1) from stb partition by tbname order by tbname slimit 5 soffset 0 ") + # bug need fix + # tdSql.query(" select tbname , max(c1) from stb partition by tbname order by tbname slimit 5 soffset 0 ") # tdSql.checkRows(5) - + # tdSql.query(" select tbname , max(c1) from stb partition by tbname order by tbname slimit 5 soffset 1 ") - # tdSql.checkRows(5) - - tdSql.query(" select tbname , max(c1) from sub_stb_1 partition by tbname interval(10s) sliding(5s) ") - + # tdSql.checkRows(5) + + tdSql.query(" select tbname , max(c1) from sub_stb_1 partition by tbname interval(10s) sliding(5s) ") + tdSql.query(f'select max(c1) from stb where ts>={self.ts} and ts < {self.ts}+1000 interval(50s) sliding(30s)') tdSql.query(f'select tbname , max(c1) from stb where ts>={self.ts} and ts < {self.ts}+1000 interval(50s) sliding(30s)') @@ -219,18 +219,18 @@ class TDTestCase: self.prepare_datas("stb",self.tb_nums,self.row_nums) self.basic_query() - # # coverage case for taosd crash about bug fix + # # coverage case for taosd crash about bug fix tdSql.query(" select sum(c1) from stb where t2+10 >1 ") tdSql.query(" select count(c1),count(t1) from stb where -t2<1 ") tdSql.query(" select tbname ,max(ceil(c1)) from stb group by tbname ") tdSql.query(" select avg(abs(c1)) , tbname from stb group by tbname ") tdSql.query(" select t1,c1 from stb where abs(t2+c1)=1 ") - + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) -- GitLab