tdSql.query("select c1, pow(c1, 100000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 100000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(4,1,0.000000000)
tdSql.checkData(4,1,0.000000000)
tdSql.query("select c1, pow(c1, 10000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 10000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(4,1,0.000000000)
tdSql.checkData(4,1,0.000000000)
tdSql.query("select c1, pow(c1, 10000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, pow(c1, 10000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(4,1,0.000000000)
tdSql.checkData(4,1,0.000000000)
tdSql.query("select c1, pow(c1, 10000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, pow(c1, 10000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(4,1,0.000000000)
tdSql.checkData(4,1,0.000000000)
tdSql.query("select c1, pow(c1, 10000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
tdSql.query("select c1, pow(c1, 10000000000000000000000000000000000000000.0) from ct1")# 10000000000000000000000000.0 is a double value
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000000000000000000.0) from {dbname}.ct1")# 10000000000000000000000000.0 is a double value
tdSql.checkData(0,1,None)
tdSql.checkData(0,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(1,1,None)
tdSql.checkData(4,1,0.000000000)
tdSql.checkData(4,1,0.000000000)
tdSql.query("select c1, pow(c1, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from ct1")# bigint to double data overflow
tdSql.query(f"select c1, pow(c1, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from {dbname}.ct1")# bigint to double data overflow
defpow_base_test(self):
defpow_base_test(self,dbname="db"):
# base is an regular number ,int or double
# base is an regular number ,int or double
tdSql.query("select c1, pow(c1, 2) from ct1")
tdSql.query(f"select c1, pow(c1, 2) from {dbname}.ct1")
tdSql.checkData(0,1,64.000000000)
tdSql.checkData(0,1,64.000000000)
tdSql.query("select c1, pow(c1, 2.0) from ct1")
tdSql.query(f"select c1, pow(c1, 2.0) from {dbname}.ct1")
tdSql.checkData(0,1,64.000000000)
tdSql.checkData(0,1,64.000000000)
tdSql.query("select c1, pow(1, 2.0) from ct1")
tdSql.query(f"select c1, pow(1, 2.0) from {dbname}.ct1")
tdSql.checkData(0,1,1.000000000)
tdSql.checkData(0,1,1.000000000)
tdSql.checkRows(13)
tdSql.checkRows(13)
# # bug for compute in functions
# # bug for compute in functions
# tdSql.query("select c1, abs(1/0) from ct1")
# tdSql.query(f"select c1, abs(1/0) from {dbname}.ct1")
# tdSql.checkData(0, 0, 8)
# tdSql.checkData(0, 0, 8)
# tdSql.checkData(0, 1, 1)
# tdSql.checkData(0, 1, 1)
tdSql.query("select c1, pow(1, 2.0) from ct1")
tdSql.query(f"select c1, pow(1, 2.0) from {dbname}.ct1")
tdSql.checkData(0,1,1.000000000)
tdSql.checkData(0,1,1.000000000)
tdSql.checkRows(13)
tdSql.checkRows(13)
# two cols start pow(x,y)
# two cols start pow(x,y)
tdSql.query("select c1,c2, pow(c1,c2) from ct1")
tdSql.query(f"select c1,c2, pow(c1,c2) from {dbname}.ct1")
tdSql.checkData(0,2,None)
tdSql.checkData(0,2,None)
tdSql.checkData(1,2,None)
tdSql.checkData(1,2,None)
tdSql.checkData(4,2,1.000000000)
tdSql.checkData(4,2,1.000000000)
tdSql.query("select c1,c2, pow(c2,c1) from ct1")
tdSql.query(f"select c1,c2, pow(c2,c1) from {dbname}.ct1")
self.check_result_auto_pow2("select c1, c2, c3 , c4, c5 from sub1_bound ","select pow(c1,2), pow(c2,2) ,pow(c3,2), pow(c4,2), pow(c5,2) from sub1_bound")
self.check_result_auto_pow2(f"select c1, c2, c3 , c4, c5 from {dbname}.sub1_bound ",f"select pow(c1,2), pow(c2,2) ,pow(c3,2), pow(c4,2), pow(c5,2) from {dbname}.sub1_bound")
self.check_result_auto_pow__10("select c1, c2, c3 , c4, c5 from sub1_bound ","select pow(c1,-10), pow(c2,-10) ,pow(c3,-10), pow(c4,-10), pow(c5,-10) from sub1_bound")
self.check_result_auto_pow__10(f"select c1, c2, c3 , c4, c5 from {dbname}.sub1_bound ",f"select pow(c1,-10), pow(c2,-10) ,pow(c3,-10), pow(c4,-10), pow(c5,-10) from {dbname}.sub1_bound")
self.check_result_auto_pow2("select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ","select pow(c1,2), pow(c2,2) ,pow(c3,2), pow(c3,2), pow(c2,2) ,pow(c1,2) from sub1_bound")
self.check_result_auto_pow2(f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select pow(c1,2), pow(c2,2) ,pow(c3,2), pow(c3,2), pow(c2,2) ,pow(c1,2) from {dbname}.sub1_bound")
self.check_result_auto_pow2("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound","select pow(abs(c1) ,2) from sub1_bound")
self.check_result_auto_pow2(f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound",f"select pow(abs(c1) ,2) from {dbname}.sub1_bound")
self.check_result_auto_pow2(f"select c5 from {dbname}.stb1 order by ts ",f"select pow(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_pow2(" select c5 from stb1 order by ts ","select pow(c5,2) from stb1 order by ts")
self.check_result_auto_pow2(f"select c5 from {dbname}.stb1 order by tbname ",f"select pow(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_pow2(" select c5 from stb1 order by tbname ","select pow(c5,2) from stb1 order by tbname")
self.check_result_auto_pow2(f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select pow(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(" select c5 from stb1 where c1 > 0 order by tbname ","select pow(c5,2) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select pow(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(" select c5 from stb1 where c1 > 0 order by tbname ","select pow(c5,2) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(" select t1,c5 from stb1 order by ts ","select pow(t1,2), pow(c5,2) from stb1 order by ts")
self.check_result_auto_pow2(" select t1,c5 from stb1 order by tbname ","select pow(t1,2) ,pow(c5,2) from stb1 order by tbname")
self.check_result_auto_pow2(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select pow(t1,2) ,pow(c5,2) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select pow(t1,2) , pow(c5,2) from stb1 where c1 > 0 order by tbname")
pass
self.check_result_auto_pow2(f"select t1,c5 from {dbname}.stb1 order by ts ",f"select pow(t1,2), pow(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_pow2(f"select t1,c5 from {dbname}.stb1 order by tbname ",f"select pow(t1,2) ,pow(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_pow2(f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select pow(t1,2) ,pow(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_pow2(f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select pow(t1,2) , pow(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")