tdLog.notice("acos function value has not as expected , sql is \"%s\" "%pow_query)
sys.exit(1)
else:
tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query)
deftest_errors(self):
error_sql_lists=[
"select acos from t1",
# "select acos(-+--+c1 ) from t1",
# "select +-acos(c1) from t1",
# "select ++-acos(c1) from t1",
# "select ++--acos(c1) from t1",
# "select - -acos(c1)*0 from t1",
# "select acos(tbname+1) from t1 ",
"select acos(123--123)==1 from t1",
"select acos(c1) as 'd1' from t1",
"select acos(c1 ,c2) from t1",
"select acos(c1 ,NULL ) from t1",
"select acos(,) from t1;",
"select acos(acos(c1) ab from t1)",
"select acos(c1 ) as int from t1",
"select acos from stb1",
# "select acos(-+--+c1) from stb1",
# "select +-acos(c1) from stb1",
# "select ++-acos(c1) from stb1",
# "select ++--acos(c1) from stb1",
# "select - -acos(c1)*0 from stb1",
# "select acos(tbname+1) from stb1 ",
"select acos(123--123)==1 from stb1",
"select acos(c1) as 'd1' from stb1",
"select acos(c1 ,c2 ) from stb1",
"select acos(c1 ,NULL) from stb1",
"select acos(,) from stb1;",
"select acos(acos(c1) ab from stb1)",
"select acos(c1) as int from stb1"
]
forerror_sqlinerror_sql_lists:
tdSql.error(error_sql)
defsupport_types(self):
type_error_sql_lists=[
"select acos(ts) from t1",
"select acos(c7) from t1",
"select acos(c8) from t1",
"select acos(c9) from t1",
"select acos(ts) from ct1",
"select acos(c7) from ct1",
"select acos(c8) from ct1",
"select acos(c9) from ct1",
"select acos(ts) from ct3",
"select acos(c7) from ct3",
"select acos(c8) from ct3",
"select acos(c9) from ct3",
"select acos(ts) from ct4",
"select acos(c7) from ct4",
"select acos(c8) from ct4",
"select acos(c9) from ct4",
"select acos(ts) from stb1",
"select acos(c7) from stb1",
"select acos(c8) from stb1",
"select acos(c9) from stb1",
"select acos(ts) from stbbb1",
"select acos(c7) from stbbb1",
"select acos(ts) from tbname",
"select acos(c9) from tbname"
]
fortype_sqlintype_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists=[
"select acos(c1) from t1",
"select acos(c2) from t1",
"select acos(c3) from t1",
"select acos(c4) from t1",
"select acos(c5) from t1",
"select acos(c6) from t1",
"select acos(c1) from ct1",
"select acos(c2) from ct1",
"select acos(c3) from ct1",
"select acos(c4) from ct1",
"select acos(c5) from ct1",
"select acos(c6) from ct1",
"select acos(c1) from ct3",
"select acos(c2) from ct3",
"select acos(c3) from ct3",
"select acos(c4) from ct3",
"select acos(c5) from ct3",
"select acos(c6) from ct3",
"select acos(c1) from stb1",
"select acos(c2) from stb1",
"select acos(c3) from stb1",
"select acos(c4) from stb1",
"select acos(c5) from stb1",
"select acos(c6) from stb1",
"select acos(c6) as alisb from stb1",
"select acos(c6) alisb from stb1",
]
fortype_sqlintype_sql_lists:
tdSql.query(type_sql)
defbasic_acos_function(self):
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
tdSql.checkRows(12)
tdSql.query("select c1 from stb1")
tdSql.checkRows(25)
# used for empty table , ct3 is empty
tdSql.query("select acos(c1) from ct3")
tdSql.checkRows(0)
tdSql.query("select acos(c2) from ct3")
tdSql.checkRows(0)
tdSql.query("select acos(c3) from ct3")
tdSql.checkRows(0)
tdSql.query("select acos(c4) from ct3")
tdSql.checkRows(0)
tdSql.query("select acos(c5) from ct3")
tdSql.checkRows(0)
tdSql.query("select acos(c6) from ct3")
tdSql.checkRows(0)
# # used for regular table
tdSql.query("select acos(c1) from t1")
tdSql.checkData(0,0,None)
tdSql.checkData(1,0,0.000000000)
tdSql.checkData(3,0,None)
tdSql.checkData(5,0,None)
tdSql.query("select c1, c2, c3 , c4, c5 from t1")
tdSql.checkData(1,4,1.11000)
tdSql.checkData(3,3,33)
tdSql.checkData(5,4,None)
tdSql.query("select ts,c1, c2, c3 , c4, c5 from t1")
tdSql.checkData(1,5,1.11000)
tdSql.checkData(3,4,33)
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")
# used for sub table
tdSql.query("select c2 ,acos(c2) from ct1")
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(3,1,None)
tdSql.checkData(4,1,1.570796327)
tdSql.query("select c1, c5 ,acos(c5) from ct4")
tdSql.checkData(0,2,None)
tdSql.checkData(1,2,None)
tdSql.checkData(2,2,None)
tdSql.checkData(3,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")
# nest query for acos functions
tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;")
tdSql.checkData(0,0,88)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,3,None)
tdSql.checkData(1,0,77)
tdSql.checkData(1,1,None)
tdSql.checkData(1,2,None)
tdSql.checkData(1,3,None)
tdSql.checkData(11,0,-99)
tdSql.checkData(11,1,None)
tdSql.checkData(11,2,None)
tdSql.checkData(11,3,None)
# used for stable table
tdSql.query("select acos(c1) from stb1")
tdSql.checkRows(25)
# used for not exists table
tdSql.error("select acos(c1) from stbbb1")
tdSql.error("select acos(c1) from tbname")
tdSql.error("select acos(c1) from ct5")
# mix with common col
tdSql.query("select c1, acos(c1) from ct1")
tdSql.query("select c2, acos(c2) from ct4")
# mix with common functions
tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ")
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(0,3,None)
tdSql.checkData(3,0,6)
tdSql.checkData(3,1,None)
tdSql.checkData(3,2,None)
tdSql.checkData(3,3,None)
tdSql.query("select c1, acos(c1),c5, floor(c5) from stb1 ")
# # mix with agg functions , not support
tdSql.error("select c1, acos(c1),c5, count(c5) from stb1 ")
tdSql.error("select c1, acos(c1),c5, count(c5) from ct1 ")
tdSql.error("select acos(c1), count(c5) from stb1 ")
tdSql.error("select acos(c1), count(c5) from ct1 ")
tdSql.error("select c1, count(c5) from ct1 ")
tdSql.error("select c1, count(c5) from stb1 ")
# agg functions mix with agg functions
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute
tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ")
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(1,0,8)
tdSql.checkData(1,1,None)
tdSql.checkData(1,2,None)
tdSql.query(" select c1, acos(c1) -0 ,acos(c1-0.1)-0.1 from ct4")
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,None)
tdSql.checkData(1,0,8)
tdSql.checkData(1,1,None)
tdSql.checkData(1,2,None)
tdSql.query("select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1")
deftest_big_number(self):
tdSql.query("select c1, acos(100000000) from ct1")# bigint to double data overflow
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000) from ct1")# bigint to double data overflow
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(1,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query("select c1, acos(10000000000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(4,1,None)
tdSql.query("select c1, acos(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
defabs_func_filter(self):
tdSql.execute("use db")
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.checkRows(3)
tdSql.checkData(0,0,8)
tdSql.checkData(0,1,8.000000000)
tdSql.checkData(0,2,8.000000000)
tdSql.checkData(0,3,7.900000000)
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.checkRows(1)
tdSql.checkData(0,0,5)
tdSql.checkData(0,1,5.000000000)
tdSql.checkData(0,2,5.000000000)
tdSql.checkData(0,3,4.900000000)
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.checkRows(1)
tdSql.checkData(0,0,0)
tdSql.checkData(0,1,0)
tdSql.checkData(0,2,0.000000000)
tdSql.checkData(0,3,0.000000000)
tdSql.checkData(0,4,-0.100000000)
tdSql.checkData(0,5,2)
defpow_Arithmetic(self):
pass
defcheck_boundary_values(self):
PI=3.1415926
tdSql.execute("drop database if exists bound_test")
tdSql.execute("create database if not exists bound_test")
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("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("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound","select acos(abs(c1)) from sub1_bound")