self.check_result_auto("select c1, t2, t3 , t4, t5 from ct4 ",
self.check_result_auto(f"select c1, t2, t3 , t4, t5 from {dbname}.ct4 ",
"select (c1), abs(t2) ,abs(t3), abs(t4), abs(t5) from ct4")
f"select (c1), abs(t2) ,abs(t3), abs(t4), abs(t5) from {dbname}.ct4")
self.check_result_auto("select c1+2, t2+2, t3 , t4, t5 from ct4 ",
self.check_result_auto(f"select c1+2, t2+2, t3 , t4, t5 from {dbname}.ct4 ",
"select (c1)+2, abs(t2)+2 ,abs(t3), abs(t4), abs(t5) from ct4")
f"select (c1)+2, abs(t2)+2 ,abs(t3), abs(t4), abs(t5) from {dbname}.ct4")
self.check_result_auto("select c1+2, t2+2, t3 , t4, t5 from stb1 order by t1 ",
self.check_result_auto(f"select c1+2, t2+2, t3 , t4, t5 from {dbname}.stb1 order by t1 ",
"select (c1)+2, abs(t2)+2 ,abs(t3), abs(t4), abs(t5) from stb1 order by t1")
f"select (c1)+2, abs(t2)+2 ,abs(t3), abs(t4), abs(t5) from {dbname}.stb1 order by t1")
# bug need fix
# bug need fix
# tdSql.query(" select sum(c1) from stb1 where t1+10 >1; ") # taosd crash
# tdSql.query(" select sum(c1) from stb1 where t1+10 >1; ") # taosd crash
tdSql.query("select c1 ,t1 from stb1 where t1 =0 ")
tdSql.query(f"select c1 ,t1 from {dbname}.stb1 where t1 =0 ")
tdSql.checkRows(13)
tdSql.checkRows(13)
tdSql.query("select t1 from stb1 where t1 >0 ")
tdSql.query(f"select t1 from {dbname}.stb1 where t1 >0 ")
tdSql.checkRows(12)
tdSql.checkRows(12)
tdSql.query("select t1 from stb1 where t1 =3 ")
tdSql.query(f"select t1 from {dbname}.stb1 where t1 =3 ")
tdSql.checkRows(12)
tdSql.checkRows(12)
# tdSql.query("select sum(t1) from (select c1 ,t1 from stb1)")
# tdSql.query(f"select sum(t1) from (select c1 ,t1 from {dbname}.stb1)")
# tdSql.checkData(0,0,61)
# tdSql.checkData(0,0,61)
# tdSql.query("select distinct(c1) ,t1 from stb1")
# tdSql.query(f"select distinct(c1) ,t1 from {dbname}.stb1")
# tdSql.checkRows(20)
# tdSql.checkRows(20)
tdSql.query("select max(t2) , t1 ,c1, t2 from stb1")
tdSql.query(f"select max(t2) , t1 ,c1, t2 from {dbname}.stb1")
tdSql.checkData(0,3,33333)
tdSql.checkData(0,3,33333)
# tag filter with abs function
# tag filter with abs function
tdSql.query("select t1 from stb1 where abs(t1)=1")
tdSql.query(f"select t1 from {dbname}.stb1 where abs(t1)=1")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select t1 from stb1 where abs(c1+t1)=1")
tdSql.query(f"select t1 from {dbname}.stb1 where abs(c1+t1)=1")
tdSql.checkRows(1)
tdSql.checkRows(1)
tdSql.checkData(0,0,0)
tdSql.checkData(0,0,0)
tdSql.query(
tdSql.query(
"select abs(c1+t1)*t1 from stb1 where abs(c1)/floor(abs(ceil(t1))) ==1")
f"select abs(c1+t1)*t1 from {dbname}.stb1 where abs(c1)/floor(abs(ceil(t1))) ==1")
defsupport_super_table_test(self):
defsupport_super_table_test(self):
tdSql.execute(" use testdb ")
dbname="testdb"
self.check_result_auto(" select c1 from stb1 order by ts ","select abs(c1) from stb1 order by ts")
tdSql.execute(f" use {dbname} ")
self.check_result_auto(" select c1 from stb1 order by tbname ","select abs(c1) from stb1 order by tbname")
self.check_result_auto(f" select c1 from {dbname}.stb1 order by ts ",f"select abs(c1) from {dbname}.stb1 order by ts")
self.check_result_auto(" select c1 from stb1 where c1 > 0 order by tbname ","select abs(c1) from stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select c1 from {dbname}.stb1 order by tbname ",f"select abs(c1) from {dbname}.stb1 order by tbname")
self.check_result_auto(" select c1 from stb1 where c1 > 0 order by tbname ","select abs(c1) from stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select c1 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select abs(c1) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select c1 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select abs(c1) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto(" select t1,c1 from stb1 order by ts ","select t1, abs(c1) from stb1 order by ts")
self.check_result_auto(" select t2,c1 from stb1 order by tbname ","select t2 ,abs(c1) from stb1 order by tbname")
self.check_result_auto(f" select t1,c1 from {dbname}.stb1 order by ts ",f"select t1, abs(c1) from {dbname}.stb1 order by ts")
self.check_result_auto(" select t3,c1 from stb1 where c1 > 0 order by tbname ","select t3 ,abs(c1) from stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select t2,c1 from {dbname}.stb1 order by tbname ",f"select t2 ,abs(c1) from {dbname}.stb1 order by tbname")
self.check_result_auto(" select t4,c1 from stb1 where c1 > 0 order by tbname ","select t4 , abs(c1) from stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select t3,c1 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select t3 ,abs(c1) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto(f" select t4,c1 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select t4 , abs(c1) from {dbname}.stb1 where c1 > 0 order by tbname")
tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query)
tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query)
deftest_errors(self):
deftest_errors(self,dbname="db"):
error_sql_lists=[
error_sql_lists=[
"select acos from t1",
f"select acos from {dbname}.t1",
# "select acos(-+--+c1 ) from t1",
# f"select acos(-+--+c1 ) from {dbname}.t1",
# "select +-acos(c1) from t1",
# f"select +-acos(c1) from {dbname}.t1",
# "select ++-acos(c1) from t1",
# f"select ++-acos(c1) from {dbname}.t1",
# "select ++--acos(c1) from t1",
# f"select ++--acos(c1) from {dbname}.t1",
# "select - -acos(c1)*0 from t1",
# f"select - -acos(c1)*0 from {dbname}.t1",
# "select acos(tbname+1) from t1 ",
# f"select acos(tbname+1) from {dbname}.t1 ",
"select acos(123--123)==1 from t1",
f"select acos(123--123)==1 from {dbname}.t1",
"select acos(c1) as 'd1' from t1",
f"select acos(c1) as 'd1' from {dbname}.t1",
"select acos(c1 ,c2) from t1",
f"select acos(c1 ,c2) from {dbname}.t1",
"select acos(c1 ,NULL ) from t1",
f"select acos(c1 ,NULL ) from {dbname}.t1",
"select acos(,) from t1;",
f"select acos(,) from {dbname}.t1;",
"select acos(acos(c1) ab from t1)",
f"select acos(acos(c1) ab from {dbname}.t1)",
"select acos(c1 ) as int from t1",
f"select acos(c1 ) as int from {dbname}.t1",
"select acos from stb1",
f"select acos from {dbname}.stb1",
# "select acos(-+--+c1) from stb1",
# f"select acos(-+--+c1) from {dbname}.stb1",
# "select +-acos(c1) from stb1",
# f"select +-acos(c1) from {dbname}.stb1",
# "select ++-acos(c1) from stb1",
# f"select ++-acos(c1) from {dbname}.stb1",
# "select ++--acos(c1) from stb1",
# f"select ++--acos(c1) from {dbname}.stb1",
# "select - -acos(c1)*0 from stb1",
# f"select - -acos(c1)*0 from {dbname}.stb1",
# "select acos(tbname+1) from stb1 ",
# f"select acos(tbname+1) from {dbname}.stb1 ",
"select acos(123--123)==1 from stb1",
f"select acos(123--123)==1 from {dbname}.stb1",
"select acos(c1) as 'd1' from stb1",
f"select acos(c1) as 'd1' from {dbname}.stb1",
"select acos(c1 ,c2 ) from stb1",
f"select acos(c1 ,c2 ) from {dbname}.stb1",
"select acos(c1 ,NULL) from stb1",
f"select acos(c1 ,NULL) from {dbname}.stb1",
"select acos(,) from stb1;",
f"select acos(,) from {dbname}.stb1;",
"select acos(acos(c1) ab from stb1)",
f"select acos(acos(c1) ab from {dbname}.stb1)",
"select acos(c1) as int from stb1"
f"select acos(c1) as int from {dbname}.stb1"
]
]
forerror_sqlinerror_sql_lists:
forerror_sqlinerror_sql_lists:
tdSql.error(error_sql)
tdSql.error(error_sql)
defsupport_types(self):
defsupport_types(self,dbname="db"):
type_error_sql_lists=[
type_error_sql_lists=[
"select acos(ts) from t1",
f"select acos(ts) from {dbname}.t1",
"select acos(c7) from t1",
f"select acos(c7) from {dbname}.t1",
"select acos(c8) from t1",
f"select acos(c8) from {dbname}.t1",
"select acos(c9) from t1",
f"select acos(c9) from {dbname}.t1",
"select acos(ts) from ct1",
f"select acos(ts) from {dbname}.ct1",
"select acos(c7) from ct1",
f"select acos(c7) from {dbname}.ct1",
"select acos(c8) from ct1",
f"select acos(c8) from {dbname}.ct1",
"select acos(c9) from ct1",
f"select acos(c9) from {dbname}.ct1",
"select acos(ts) from ct3",
f"select acos(ts) from {dbname}.ct3",
"select acos(c7) from ct3",
f"select acos(c7) from {dbname}.ct3",
"select acos(c8) from ct3",
f"select acos(c8) from {dbname}.ct3",
"select acos(c9) from ct3",
f"select acos(c9) from {dbname}.ct3",
"select acos(ts) from ct4",
f"select acos(ts) from {dbname}.ct4",
"select acos(c7) from ct4",
f"select acos(c7) from {dbname}.ct4",
"select acos(c8) from ct4",
f"select acos(c8) from {dbname}.ct4",
"select acos(c9) from ct4",
f"select acos(c9) from {dbname}.ct4",
"select acos(ts) from stb1",
f"select acos(ts) from {dbname}.stb1",
"select acos(c7) from stb1",
f"select acos(c7) from {dbname}.stb1",
"select acos(c8) from stb1",
f"select acos(c8) from {dbname}.stb1",
"select acos(c9) from stb1",
f"select acos(c9) from {dbname}.stb1",
"select acos(ts) from stbbb1",
f"select acos(ts) from {dbname}.stbbb1",
"select acos(c7) from stbbb1",
f"select acos(c7) from {dbname}.stbbb1",
"select acos(ts) from tbname",
f"select acos(ts) from {dbname}.tbname",
"select acos(c9) from tbname"
f"select acos(c9) from {dbname}.tbname"
]
]
...
@@ -172,103 +172,103 @@ class TDTestCase:
...
@@ -172,103 +172,103 @@ class TDTestCase:
type_sql_lists=[
type_sql_lists=[
"select acos(c1) from t1",
f"select acos(c1) from {dbname}.t1",
"select acos(c2) from t1",
f"select acos(c2) from {dbname}.t1",
"select acos(c3) from t1",
f"select acos(c3) from {dbname}.t1",
"select acos(c4) from t1",
f"select acos(c4) from {dbname}.t1",
"select acos(c5) from t1",
f"select acos(c5) from {dbname}.t1",
"select acos(c6) from t1",
f"select acos(c6) from {dbname}.t1",
"select acos(c1) from ct1",
f"select acos(c1) from {dbname}.ct1",
"select acos(c2) from ct1",
f"select acos(c2) from {dbname}.ct1",
"select acos(c3) from ct1",
f"select acos(c3) from {dbname}.ct1",
"select acos(c4) from ct1",
f"select acos(c4) from {dbname}.ct1",
"select acos(c5) from ct1",
f"select acos(c5) from {dbname}.ct1",
"select acos(c6) from ct1",
f"select acos(c6) from {dbname}.ct1",
"select acos(c1) from ct3",
f"select acos(c1) from {dbname}.ct3",
"select acos(c2) from ct3",
f"select acos(c2) from {dbname}.ct3",
"select acos(c3) from ct3",
f"select acos(c3) from {dbname}.ct3",
"select acos(c4) from ct3",
f"select acos(c4) from {dbname}.ct3",
"select acos(c5) from ct3",
f"select acos(c5) from {dbname}.ct3",
"select acos(c6) from ct3",
f"select acos(c6) from {dbname}.ct3",
"select acos(c1) from stb1",
f"select acos(c1) from {dbname}.stb1",
"select acos(c2) from stb1",
f"select acos(c2) from {dbname}.stb1",
"select acos(c3) from stb1",
f"select acos(c3) from {dbname}.stb1",
"select acos(c4) from stb1",
f"select acos(c4) from {dbname}.stb1",
"select acos(c5) from stb1",
f"select acos(c5) from {dbname}.stb1",
"select acos(c6) from stb1",
f"select acos(c6) from {dbname}.stb1",
"select acos(c6) as alisb from stb1",
f"select acos(c6) as alisb from {dbname}.stb1",
"select acos(c6) alisb from stb1",
f"select acos(c6) alisb from {dbname}.stb1",
]
]
fortype_sqlintype_sql_lists:
fortype_sqlintype_sql_lists:
tdSql.query(type_sql)
tdSql.query(type_sql)
defbasic_acos_function(self):
defbasic_acos_function(self,dbname="db"):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.query(f"select c1 from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
tdSql.query(f"select c1 from {dbname}.t1")
tdSql.checkRows(12)
tdSql.checkRows(12)
tdSql.query("select c1 from stb1")
tdSql.query(f"select c1 from {dbname}.stb1")
tdSql.checkRows(25)
tdSql.checkRows(25)
# used for empty table , ct3 is empty
# used for empty table , ct3 is empty
tdSql.query("select acos(c1) from ct3")
tdSql.query(f"select acos(c1) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select acos(c2) from ct3")
tdSql.query(f"select acos(c2) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select acos(c3) from ct3")
tdSql.query(f"select acos(c3) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select acos(c4) from ct3")
tdSql.query(f"select acos(c4) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select acos(c5) from ct3")
tdSql.query(f"select acos(c5) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
tdSql.query("select acos(c6) from ct3")
tdSql.query(f"select acos(c6) from {dbname}.ct3")
tdSql.checkRows(0)
tdSql.checkRows(0)
# # used for regular table
# # used for regular table
tdSql.query("select acos(c1) from t1")
tdSql.query(f"select acos(c1) from {dbname}.t1")
tdSql.checkData(0,0,None)
tdSql.checkData(0,0,None)
tdSql.checkData(1,0,0.000000000)
tdSql.checkData(1,0,0.000000000)
tdSql.checkData(3,0,None)
tdSql.checkData(3,0,None)
tdSql.checkData(5,0,None)
tdSql.checkData(5,0,None)
tdSql.query("select c1, c2, c3 , c4, c5 from t1")
tdSql.query(f"select c1, c2, c3 , c4, c5 from {dbname}.t1")
tdSql.checkData(1,4,1.11000)
tdSql.checkData(1,4,1.11000)
tdSql.checkData(3,3,33)
tdSql.checkData(3,3,33)
tdSql.checkData(5,4,None)
tdSql.checkData(5,4,None)
tdSql.query("select ts,c1, c2, c3 , c4, c5 from t1")
tdSql.query(f"select ts,c1, c2, c3 , c4, c5 from {dbname}.t1")
tdSql.checkData(1,5,1.11000)
tdSql.checkData(1,5,1.11000)
tdSql.checkData(3,4,33)
tdSql.checkData(3,4,33)
tdSql.checkData(5,5,None)
tdSql.checkData(5,5,None)
self.check_result_auto_acos("select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1","select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from t1")
self.check_result_auto_acos(f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.t1",f"select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from {dbname}.t1")
# used for sub table
# used for sub table
tdSql.query("select c2 ,acos(c2) from ct1")
tdSql.query(f"select c2 ,acos(c2) from {dbname}.ct1")
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(3,1,None)
tdSql.checkData(3,1,None)
tdSql.checkData(4,1,1.570796327)
tdSql.checkData(4,1,1.570796327)
tdSql.query("select c1, c5 ,acos(c5) from ct4")
tdSql.query(f"select c1, c5 ,acos(c5) from {dbname}.ct4")
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
tdSql.checkData(1,2,None)
tdSql.checkData(1,2,None)
tdSql.checkData(2,2,None)
tdSql.checkData(2,2,None)
tdSql.checkData(3,2,None)
tdSql.checkData(3,2,None)
tdSql.checkData(5,2,None)
tdSql.checkData(5,2,None)
self.check_result_auto_acos("select c1, c2, c3 , c4, c5 from ct1","select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from ct1")
self.check_result_auto_acos(f"select c1, c2, c3 , c4, c5 from {dbname}.ct1",f"select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from {dbname}.ct1")
# nest query for acos functions
# nest query for acos functions
tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;")
tdSql.query(f"select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from {dbname}.ct1;")
tdSql.checkData(0,0,88)
tdSql.checkData(0,0,88)
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
...
@@ -286,22 +286,22 @@ class TDTestCase:
...
@@ -286,22 +286,22 @@ class TDTestCase:
# used for stable table
# used for stable table
tdSql.query("select acos(c1) from stb1")
tdSql.query(f"select acos(c1) from {dbname}.stb1")
tdSql.checkRows(25)
tdSql.checkRows(25)
# used for not exists table
# used for not exists table
tdSql.error("select acos(c1) from stbbb1")
tdSql.error(f"select acos(c1) from {dbname}.stbbb1")
tdSql.error("select acos(c1) from tbname")
tdSql.error(f"select acos(c1) from {dbname}.tbname")
tdSql.error("select acos(c1) from ct5")
tdSql.error(f"select acos(c1) from {dbname}.ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, acos(c1) from ct1")
tdSql.query(f"select c1, acos(c1) from {dbname}.ct1")
tdSql.query("select c2, acos(c2) from ct4")
tdSql.query(f"select c2, acos(c2) from {dbname}.ct4")
# mix with common functions
# mix with common functions
tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ")
tdSql.query(f"select c1, acos(c1),acos(c1), acos(acos(c1)) from {dbname}.ct4 ")
tdSql.checkData(0,0,None)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
...
@@ -312,24 +312,24 @@ class TDTestCase:
...
@@ -312,24 +312,24 @@ class TDTestCase:
tdSql.checkData(3,2,None)
tdSql.checkData(3,2,None)
tdSql.checkData(3,3,None)
tdSql.checkData(3,3,None)
tdSql.query("select c1, acos(c1),c5, floor(c5) from stb1 ")
tdSql.query(f"select c1, acos(c1),c5, floor(c5) from {dbname}.stb1 ")
# # mix with agg functions , not support
# # mix with agg functions , not support
tdSql.error("select c1, acos(c1),c5, count(c5) from stb1 ")
tdSql.error(f"select c1, acos(c1),c5, count(c5) from {dbname}.stb1 ")
tdSql.error("select c1, acos(c1),c5, count(c5) from ct1 ")
tdSql.error(f"select c1, acos(c1),c5, count(c5) from {dbname}.ct1 ")
tdSql.error("select acos(c1), count(c5) from stb1 ")
tdSql.error(f"select acos(c1), count(c5) from {dbname}.stb1 ")
tdSql.error("select acos(c1), count(c5) from ct1 ")
tdSql.error(f"select acos(c1), count(c5) from {dbname}.ct1 ")
tdSql.error("select c1, count(c5) from ct1 ")
tdSql.error(f"select c1, count(c5) from {dbname}.ct1 ")
tdSql.error("select c1, count(c5) from stb1 ")
tdSql.error(f"select c1, count(c5) from {dbname}.stb1 ")
# agg functions mix with agg functions
# agg functions mix with agg functions
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query(f"select max(c5), count(c5) from {dbname}.stb1")
tdSql.query("select max(c5), count(c5) from ct1")
tdSql.query(f"select max(c5), count(c5) from {dbname}.ct1")
# # bug fix for compute
# # bug fix for compute
tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ")
tdSql.query(f"select c1, acos(c1) -0 ,acos(c1-4)-0 from {dbname}.ct4 ")
tdSql.checkData(0,0,None)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
...
@@ -337,7 +337,7 @@ class TDTestCase:
...
@@ -337,7 +337,7 @@ class TDTestCase:
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,2,None)
tdSql.checkData(1,2,None)
tdSql.query(" select c1, acos(c1) -0 ,acos(c1-0.1)-0.1 from ct4")
tdSql.query(f" select c1, acos(c1) -0 ,acos(c1-0.1)-0.1 from {dbname}.ct4")
tdSql.checkData(0,0,None)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
...
@@ -345,35 +345,35 @@ class TDTestCase:
...
@@ -345,35 +345,35 @@ class TDTestCase:
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,2,None)
tdSql.checkData(1,2,None)
tdSql.query("select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1")
tdSql.query(f"select c1, acos(c1), c2, acos(c2), c3, acos(c3) from {dbname}.ct1")
deftest_big_number(self):
deftest_big_number(self,dbname="db"):
tdSql.query("select c1, acos(100000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(100000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.checkData(4,1,None)
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(10000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.checkData(4,1,None)
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(10000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, acos(10000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(10000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, acos(10000000000000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(4,1,None)
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(10000000000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, acos(10000000000000000000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(4,1,None)
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, acos(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
defabs_func_filter(self):
defabs_func_filter(self,dbname="db"):
tdSql.execute("use db")
tdSql.execute(f"use {dbname}")
tdSql.query("select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from ct4 where c1>5 ")
tdSql.query(f"select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from {dbname}.ct4 where c1>5 ")
tdSql.checkRows(3)
tdSql.checkRows(3)
tdSql.checkData(0,0,8)
tdSql.checkData(0,0,8)
tdSql.checkData(0,1,8.000000000)
tdSql.checkData(0,1,8.000000000)
...
@@ -381,7 +381,7 @@ class TDTestCase:
...
@@ -381,7 +381,7 @@ class TDTestCase:
tdSql.checkData(0,3,7.900000000)
tdSql.checkData(0,3,7.900000000)
tdSql.checkData(0,4,None)
tdSql.checkData(0,4,None)
tdSql.query("select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from ct4 where c1=5 ")
tdSql.query(f"select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from {dbname}.ct4 where c1=5 ")
tdSql.checkRows(1)
tdSql.checkRows(1)
tdSql.checkData(0,0,5)
tdSql.checkData(0,0,5)
tdSql.checkData(0,1,5.000000000)
tdSql.checkData(0,1,5.000000000)
...
@@ -389,7 +389,7 @@ class TDTestCase:
...
@@ -389,7 +389,7 @@ class TDTestCase:
tdSql.checkData(0,3,4.900000000)
tdSql.checkData(0,3,4.900000000)
tdSql.checkData(0,4,None)
tdSql.checkData(0,4,None)
tdSql.query("select c1,c2 , abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from ct4 where c1<acos(c1) limit 1 ")
tdSql.query(f"select c1,c2 , abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(acos(c1)-0.5) from {dbname}.ct4 where c1<acos(c1) limit 1 ")
self.check_result_auto_acos("select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ","select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from sub1_bound")
self.check_result_auto_acos(f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ",f"select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from {dbname}.sub1_bound")
self.check_result_auto_acos("select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ","select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from sub1_bound")
self.check_result_auto_acos(f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from {dbname}.sub1_bound")
self.check_result_auto_acos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound","select acos(abs(c1)) from sub1_bound")
self.check_result_auto_acos(f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound",f"select acos(abs(c1)) from {dbname}.sub1_bound")
tdSql.execute(f'create table tb1 using st tags (1)')
tdSql.execute(f'create table {dbname}.tb1 using {dbname}.st tags (1)')
tdSql.execute(f'create table tb2 using st tags (2)')
tdSql.execute(f'create table {dbname}.tb2 using {dbname}.st tags (2)')
tdSql.execute(f'create table tb3 using st tags (3)')
tdSql.execute(f'create table {dbname}.tb3 using {dbname}.st tags (3)')
tdSql.execute('insert into tb1 values (now()-40s, {}, {})'.format(PI/2,PI/2))
tdSql.execute(f'insert into {dbname}.tb1 values (now()-40s, {PI/2}, {PI/2})')
tdSql.execute('insert into tb1 values (now()-30s, {}, {})'.format(PI,PI))
tdSql.execute(f'insert into {dbname}.tb1 values (now()-30s, {PI}, {PI})')
tdSql.execute('insert into tb1 values (now()-20s, {}, {})'.format(PI*1.5,PI*1.5))
tdSql.execute(f'insert into {dbname}.tb1 values (now()-20s, {PI*1.5}, {PI*1.5})')
tdSql.execute('insert into tb1 values (now()-10s, {}, {})'.format(PI*2,PI*2))
tdSql.execute(f'insert into {dbname}.tb1 values (now()-10s, {PI*2}, {PI*2})')
tdSql.execute('insert into tb1 values (now(), {}, {})'.format(PI*2.5,PI*2.5))
tdSql.execute(f'insert into {dbname}.tb1 values (now(), {PI*2.5}, {PI*2.5})')
tdSql.execute('insert into tb2 values (now()-40s, {}, {})'.format(PI/2,PI/2))
tdSql.execute(f'insert into {dbname}.tb2 values (now()-40s, {PI/2}, {PI/2})')
tdSql.execute('insert into tb2 values (now()-30s, {}, {})'.format(PI,PI))
tdSql.execute(f'insert into {dbname}.tb2 values (now()-30s, {PI}, {PI})')
tdSql.execute('insert into tb2 values (now()-20s, {}, {})'.format(PI*1.5,PI*1.5))
tdSql.execute(f'insert into {dbname}.tb2 values (now()-20s, {PI*1.5}, {PI*1.5})')
tdSql.execute('insert into tb2 values (now()-10s, {}, {})'.format(PI*2,PI*2))
tdSql.execute(f'insert into {dbname}.tb2 values (now()-10s, {PI*2}, {PI*2})')
tdSql.execute('insert into tb2 values (now(), {}, {})'.format(PI*2.5,PI*2.5))
tdSql.execute(f'insert into {dbname}.tb2 values (now(), {PI*2.5}, {PI*2.5})')
foriinrange(100):
foriinrange(100):
tdSql.execute('insert into tb3 values (now()+{}s, {}, {})'.format(i,PI*(5+i)/2,PI*(5+i)/2))
tdSql.execute(f'insert into {dbname}.tb3 values (now()+{i}s, {PI*(5+i)/2}, {PI*(5+i)/2})')
self.check_result_auto_acos("select num1,num2 from tb3;","select acos(num1),acos(num2) from tb3")
self.check_result_auto_acos(f"select num1,num2 from {dbname}.tb3;",f"select acos(num1),acos(num2) from {dbname}.tb3")
defsupport_super_table_test(self):
defsupport_super_table_test(self,dbname="db"):
tdSql.execute(" use db ")
tdSql.execute(f" use {dbname} ")
self.check_result_auto_acos(" select c5 from stb1 order by ts ","select acos(c5) from stb1 order by ts")
self.check_result_auto_acos(f" select c5 from {dbname}.stb1 order by ts ",f"select acos(c5) from {dbname}.stb1 order by ts")
self.check_result_auto_acos(" select c5 from stb1 order by tbname ","select acos(c5) from stb1 order by tbname")
self.check_result_auto_acos(f" select c5 from {dbname}.stb1 order by tbname ",f"select acos(c5) from {dbname}.stb1 order by tbname")
self.check_result_auto_acos(" select c5 from stb1 where c1 > 0 order by tbname ","select acos(c5) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(f" select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select acos(c5) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(" select c5 from stb1 where c1 > 0 order by tbname ","select acos(c5) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(f" select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select acos(c5) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(" select t1,c5 from stb1 order by ts ","select acos(t1), acos(c5) from stb1 order by ts")
self.check_result_auto_acos(f" select t1,c5 from {dbname}.stb1 order by ts ",f"select acos(t1), acos(c5) from {dbname}.stb1 order by ts")
self.check_result_auto_acos(" select t1,c5 from stb1 order by tbname ","select acos(t1) ,acos(c5) from stb1 order by tbname")
self.check_result_auto_acos(f" select t1,c5 from {dbname}.stb1 order by tbname ",f"select acos(t1) ,acos(c5) from {dbname}.stb1 order by tbname")
self.check_result_auto_acos(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select acos(t1) ,acos(c5) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(f" select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select acos(t1) ,acos(c5) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select acos(t1) , acos(c5) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_acos(f" select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select acos(t1) , acos(c5) from {dbname}.stb1 where c1 > 0 order by tbname")