tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# bug fix for count
tdSql.query("select count(c1) from ct4 ")
tdSql.checkData(0,0,9)
...
...
@@ -450,7 +450,7 @@ class TDTestCase:
tdSql.query("select count(*) from stb1 ")
tdSql.checkData(0,0,25)
# # bug fix for compute
# # bug fix for compute
tdSql.query("select c1, log(c1 ,2) -0 ,log(c1-4 ,2)-0 from ct4 ")
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
...
...
@@ -507,40 +507,40 @@ class TDTestCase:
# base is an regular number ,int or double
tdSql.query("select c1, log(c1, 2) from ct1")
tdSql.checkData(0,1,3.000000000)
tdSql.query("select c1, log(c1, 2.0) from ct1")
tdSql.query("select c1, log(c1, 2.0) from ct1")
tdSql.checkData(0,1,3.000000000)
tdSql.query("select c1, log(1, 2.0) from ct1")
tdSql.query("select c1, log(1, 2.0) from ct1")
tdSql.checkData(0,1,0.000000000)
tdSql.checkRows(13)
# # bug for compute in functions
# tdSql.query("select c1, abs(1/0) from ct1")
# tdSql.query("select c1, abs(1/0) from ct1")
# tdSql.checkData(0, 0, 8)
# tdSql.checkData(0, 1, 1)
tdSql.query("select c1, log(1, 2.0) from ct1")
tdSql.query("select c1, log(1, 2.0) from ct1")
tdSql.checkData(0,1,0.000000000)
tdSql.checkRows(13)
# two cols start log(x,y)
tdSql.query("select c1,c2, log(c1,c2) from ct1")
tdSql.query("select c1,c2, log(c1,c2) from ct1")
tdSql.checkData(0,2,0.182485070)
tdSql.checkData(1,2,0.172791608)
tdSql.checkData(4,2,None)
tdSql.query("select c1,c2, log(c2,c1) from ct1")
tdSql.query("select c1,c2, log(c2,c1) from ct1")
tdSql.checkData(0,2,5.479900349)
tdSql.checkData(1,2,5.787318105)
tdSql.checkData(4,2,None)
tdSql.query("select c1, log(2.0 , c1) from ct1")
tdSql.query("select c1, log(2.0 , c1) from ct1")
tdSql.checkData(0,1,0.333333333)
tdSql.checkData(1,1,0.356207187)
tdSql.checkData(4,1,None)
tdSql.query("select c1, log(2.0 , ceil(abs(c1))) from ct1")
tdSql.query("select c1, log(2.0 , ceil(abs(c1))) from ct1")
tdSql.checkData(0,1,0.333333333)
tdSql.checkData(1,1,0.356207187)
tdSql.checkData(4,1,None)
...
...
@@ -580,10 +580,10 @@ class TDTestCase:
tdSql.checkData(0,3,8.000000000)
tdSql.checkData(0,4,7.900000000)
tdSql.checkData(0,5,3.000000000)
deflog_Arithmetic(self):
pass
defcheck_boundary_values(self):
tdSql.execute("drop database if exists bound_test")
...
...
@@ -612,13 +612,13 @@ class TDTestCase:
self.check_result_auto_log("select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ","select log(c1), log(c2) ,log(c3), log(c4), log(c5) ,log(c6) from sub1_bound")
self.check_result_auto_log2("select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ","select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) ,log(c6,2) from sub1_bound")
self.check_result_auto_log__10("select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ","select log(c1,-10), log(c2,-10) ,log(c3,-10), log(c4,-10), log(c5,-10) ,log(c6,-10) from sub1_bound")
self.check_result_auto_log2("select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ","select log(c1,2), log(c2,2) ,log(c3,2), log(c3,2), log(c2,2) ,log(c1,2) from sub1_bound")
self.check_result_auto_log("select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ","select log(c1), log(c2) ,log(c3), log(c3), log(c2) ,log(c1) from sub1_bound")
self.check_result_auto_log2("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound","select log(abs(c1) ,2) from sub1_bound")
self.check_result_auto_log2(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select log(t1,2) ,log(c5,2) from stb1 where c1 > 0 order by tbname")
self.check_result_auto_log2(" select t1,c5 from stb1 where c1 > 0 order by tbname ","select log(t1,2) , log(c5,2) from stb1 where c1 > 0 order by tbname")
query_sql=f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c1 > 2 and c1 >= 3 or c1 < 1 or c1 <= 0 or c1 =2 or c1 != 1 or c1 <> 1 and c1 is null or c1 between 2 and 3 and c1 not between 1 and 1 and c1 in (2, 3) and c1 not in (1, 2)'
res=tdSql.query(query_sql)
tdSql.checkRows(1)
defqueryUtinyintCol(self,tb_name,check_elm=None):
select_elm="*"ifcheck_elmisNoneelsecheck_elm
# >
...
...
@@ -497,7 +497,7 @@ class TDTestCase:
query_sql=f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c10 > 2 and c10 >= 3 or c10 < 1 or c10 <= 0 or c10 =2 or c10 != 1 or c10 <> 1 and c10 is null or c10 between 2 and 3 and c10 not between 1 and 1 and c10 in (2, 3) and c10 not in (1, 2)'
res=tdSql.query(query_sql)
tdSql.checkRows(10)
defquerySmallintCol(self,tb_name,check_elm=None):
select_elm="*"ifcheck_elmisNoneelsecheck_elm
# >
...
...
@@ -582,7 +582,7 @@ class TDTestCase:
query_sql=f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c2 > 0 and c2 >= 1 or c2 < 4 and c2 <= 3 and c2 != 1 and c2 <> 2 and c2 = 3 or c2 is not null and c2 between 2 and 3 and c2 not between 1 and 2 and c2 in (2,3) and c2 not in (1,2)'
query_sql=f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c3 > 0 and c3 >= 1 or c3 < 5 and c3 <= 4 and c3 != 2 and c3 <> 2 and c3 = 4 or c3 is not null and c3 between 2 and 4 and c3 not between 1 and 2 and c3 in (2,4) and c3 not in (1,2)'
tdSql.query(query_sql)
tdSql.checkRows(11)
defqueryUintCol(self,tb_name,check_elm=None):
select_elm="*"ifcheck_elmisNoneelsecheck_elm
# >
...
...
@@ -1086,7 +1086,7 @@ class TDTestCase:
query_sql=f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c5 > 0 and c5 >= 1 or c5 < 5 and c5 <= 6.6 and c5 != 2 and c5 <> 2 and c5 = 4 or c5 is not null and c5 between 2 and 4 and c5 not between 1 and 2 and c5 in (2,4) and c5 not in (1,2)'
tdSql.query(query_sql)
tdSql.checkRows(11)
defqueryDoubleCol(self,tb_name,check_elm=None):
select_elm="*"ifcheck_elmisNoneelsecheck_elm
# >
...
...
@@ -1711,19 +1711,19 @@ class TDTestCase:
tdSql.checkRows(4)
tdSql.checkEqual(self.queryLastC10(query_sql),7)
## condition_A or (condition_B and condition_C) or (condition_D and condition_E) and condition_F
## condition_A or (condition_B and condition_C) or (condition_D and condition_E) and condition_F
query_sql=f'select * from {tb_name} where c1 != 1 or (c2 <= 1 and c3 <4) or (c3 >= 4 or c7 is not Null) and c9 <> true'
tdSql.query(query_sql)
tdSql.checkRows(3)
tdSql.checkEqual(self.queryLastC10(query_sql),10)
## (condition_A or (condition_B and condition_C) or (condition_D and condition_E)) and condition_F
## (condition_A or (condition_B and condition_C) or (condition_D and condition_E)) and condition_F
query_sql=f'select * from {tb_name} where (c1 != 1 or (c2 <= 2 and c3 >= 4) or (c3 >= 4 or c7 is not Null)) and c9 != false'
tdSql.query(query_sql)
tdSql.checkRows(9)
tdSql.checkEqual(self.queryLastC10(query_sql),9)
## (condition_A or condition_B) or (condition_C or condition_D) and (condition_E or condition_F or condition_G)
## (condition_A or condition_B) or (condition_C or condition_D) and (condition_E or condition_F or condition_G)
query_sql=f'select * from {tb_name} where c1 != 1 or (c2 <= 3 and c3 > 4) and c3 <= 5 and (c7 is not Null and c9 != false)'
tdSql.query(query_sql)
tdSql.checkRows(2)
...
...
@@ -1780,17 +1780,17 @@ class TDTestCase:
tdSql.query(query_sql)
tdSql.checkRows(55)
## condition_A or (condition_B and condition_C) or (condition_D and condition_E) and condition_F
## condition_A or (condition_B and condition_C) or (condition_D and condition_E) and condition_F
query_sql=f'select * from {tb_name} where t1 != 1 or (t2 <= 1 and t3 <4) or (t3 >= 4 or t7 is not Null) and t9 <> true'
tdSql.query(query_sql)
tdSql.checkRows(55)
## (condition_A or (condition_B and condition_C) or (condition_D and condition_E)) and condition_F
## (condition_A or (condition_B and condition_C) or (condition_D and condition_E)) and condition_F
query_sql=f'select * from {tb_name} where (t1 != 1 or (t2 <= 2 and t3 >= 4) or (t3 >= 4 or t7 is not Null)) and t9 != false'
tdSql.query(query_sql)
tdSql.checkRows(55)
## (condition_A or condition_B) or (condition_C or condition_D) and (condition_E or condition_F or condition_G)
## (condition_A or condition_B) or (condition_C or condition_D) and (condition_E or condition_F or condition_G)
query_sql=f'select * from {tb_name} where t1 != 1 or (t2 <= 3 and t3 > 4) and t3 <= 5 and (t7 is not Null and t9 != false)'