未验证 提交 9530fd01 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #17687 from taosdata/test/fix_converage_enh

fix(coverage): enh function test case about cast , log , pow
......@@ -653,6 +653,58 @@ class TDTestCase:
tdSql.query(f"select cast(c9 as timestamp ) as b from {self.dbname}.ct4")
tdSql.query(f"select cast(c9 as binary(64) ) as b from {self.dbname}.ct4")
# enh of cast function about coverage
tdSql.query(f"select cast(c1 as int) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as bool) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as tinyint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as smallint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as float) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as double) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as tinyint unsigned) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as smallint unsigned) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c1 as int unsigned) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c2 as int) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c3 as bool) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c4 as tinyint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c5 as smallint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c6 as float) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c7 as double) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c8 as tinyint unsigned) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c8 as timestamp ) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c9 as timestamp ) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c9 as binary(64) ) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(abs(c2) as int) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c3 as bool) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(floor(c4) as tinyint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c5+2 as smallint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(2 as float) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c7 as double) as b from {self.dbname}.stb1")
tdSql.query(f"select cast('123' as tinyint unsigned) as b from {self.dbname}.stb1")
tdSql.query(f"select max(cast(abs(c2) as int)) as b from {self.dbname}.stb1")
tdSql.query(f"select log(cast(c3 as int),2) as b from {self.dbname}.stb1")
tdSql.query(f"select abs(cast(floor(c4) as tinyint)) as b from {self.dbname}.stb1")
tdSql.query(f"select last(cast(c5+2 as smallint)) as b from {self.dbname}.stb1")
tdSql.query(f"select mavg(cast(2 as float),3) as b from {self.dbname}.stb1 partition by tbname")
tdSql.query(f"select cast(c7 as double) as b from {self.dbname}.stb1 partition by tbname order by tbname")
tdSql.query(f"select cast('123' as tinyint unsigned) as b from {self.dbname}.stb1 partition by tbname")
# uion with cast and common cols
tdSql.query(f"select cast(c2 as int) as b from {self.dbname}.stb1 union all select c1 from {self.dbname}.stb1 ")
tdSql.query(f"select cast(c3 as bool) as b from {self.dbname}.stb1 union all select c7 from {self.dbname}.ct1 ")
tdSql.query(f"select cast(c4 as tinyint) as b from {self.dbname}.stb1 union all select c4 from {self.dbname}.stb1")
tdSql.query(f"select cast(c5 as smallint) as b from {self.dbname}.stb1 union all select cast(c5 as smallint) as b from {self.dbname}.stb1")
tdSql.query(f"select cast(c6 as float) as b from {self.dbname}.stb1 union all select c5 from {self.dbname}.stb1")
tdSql.query(f"select cast(c7 as double) as b from {self.dbname}.stb1 union all select 123 from {self.dbname}.stb1 ")
tdSql.query(f"select cast(c8 as tinyint unsigned) as b from {self.dbname}.stb1 union all select last(cast(c8 as tinyint unsigned)) from {self.dbname}.stb1")
def run(self):
tdSql.prepare()
......
......@@ -229,6 +229,36 @@ class TDTestCase:
tdSql.query(f"select log(c6 ,2) from {dbname}.ct3")
tdSql.checkRows(0)
# log used for different param types
tdSql.query(f"select log(c1,c2) from {dbname}.ct1;")
tdSql.query(f"select log(c1,c2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(c1,2) from {dbname}.ct1;")
tdSql.query(f"select log(c1,2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(2,c2) from {dbname}.ct1;")
tdSql.query(f"select log(2,c2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(2,1) from {dbname}.ct1;")
tdSql.query(f"select log(2,2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(2,floor(1)) from {dbname}.ct1;")
tdSql.query(f"select log(2,floor(2)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(abs(2),floor(1)) from {dbname}.ct1;")
tdSql.query(f"select log(abs(2),floor(2)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(abs(c2),c1) from {dbname}.ct1;")
tdSql.query(f"select log(abs(c2),c1) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(c2,abs(c1)) from {dbname}.ct1;")
tdSql.query(f"select log(c2,abs(c1)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select log(abs(c2),2) from {dbname}.ct1;")
tdSql.query(f"select log(abs(c2),2) from {dbname}.stb1 partition by tbname order by tbname;")
# # used for regular table
tdSql.query(f"select log(c1 ,2) from {dbname}.t1")
......@@ -292,6 +322,7 @@ class TDTestCase:
tdSql.checkRows(25)
# used for not exists table
tdSql.error(f"select log(c1, 2) from {dbname}.stbbb1")
tdSql.error(f"select log(c1, 2) from {dbname}tbname")
......
......@@ -216,6 +216,36 @@ class TDTestCase:
tdSql.checkRows(0)
# pow used for different param types
tdSql.query(f"select pow(c1,c2) from {dbname}.ct1;")
tdSql.query(f"select pow(c1,c2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(c1,2) from {dbname}.ct1;")
tdSql.query(f"select pow(c1,2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(2,c2) from {dbname}.ct1;")
tdSql.query(f"select pow(2,c2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(2,1) from {dbname}.ct1;")
tdSql.query(f"select pow(2,2) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(2,floor(1)) from {dbname}.ct1;")
tdSql.query(f"select pow(2,floor(2)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(abs(2),floor(1)) from {dbname}.ct1;")
tdSql.query(f"select pow(abs(2),floor(2)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(abs(c2),c1) from {dbname}.ct1;")
tdSql.query(f"select pow(abs(c2),c1) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(c2,abs(c1)) from {dbname}.ct1;")
tdSql.query(f"select pow(c2,abs(c1)) from {dbname}.stb1 partition by tbname order by tbname;")
tdSql.query(f"select pow(abs(c2),2) from {dbname}.ct1;")
tdSql.query(f"select pow(abs(c2),2) from {dbname}.stb1 partition by tbname order by tbname;")
# # used for regular table
tdSql.query(f"select pow(c1 ,2) from {dbname}.t1")
tdSql.checkData(0, 0, None)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册