提交 bea875ae 编写于 作者: C cpwu

add case to support rest API

上级 8ae2907d
...@@ -311,7 +311,7 @@ class TDSql: ...@@ -311,7 +311,7 @@ class TDSql:
tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args) tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args)
def __check_equal(self, elm, expect_elm): def __check_equal(self, elm, expect_elm):
if not type(elm) in(list, tuple) and elm == expect_elm: if elm == expect_elm:
return True return True
if type(elm) in(list, tuple) and type(expect_elm) in(list, tuple): if type(elm) in(list, tuple) and type(expect_elm) in(list, tuple):
if len(elm) != len(expect_elm): if len(elm) != len(expect_elm):
......
...@@ -193,43 +193,38 @@ class TDTestCase: ...@@ -193,43 +193,38 @@ class TDTestCase:
# case17: only support normal table join # case17: only support normal table join
case17 = { case17 = {
"col": "t1.c1", "col": "table1.c1 ",
"table_expr": "t1, t2", "table_expr": "db.t1 as table1, db.t2 as table2",
"condition": "where t1.ts=t2.ts" "condition": "where table1.ts=table2.ts"
} }
self.checkdiff(**case17) self.checkdiff(**case17)
# case18~19: with group by # case18~19: with group by , function diff not support group by
# case18 = {
# "table_expr": "db.t1",
# "condition": "group by c6"
# }
# self.checkdiff(**case18)
case19 = { case19 = {
"table_expr": "db.stb1", "table_expr": "db.stb1 where tbname =='t0' ",
"condition": "partition by tbname order by tbname" # partition by tbname "condition": "partition by tbname order by tbname" # partition by tbname
} }
self.checkdiff(**case19) self.checkdiff(**case19)
# # case20~21: with order by # case20~21: with order by , Not a single-group group function
# case20 = {"condition": "order by ts"}
# self.checkdiff(**case20)
# # case22: with union # case22: with union
# case22 = { # case22 = {
# "condition": "union all select diff(c1) from t2" # "condition": "union all select diff(c1) from db.t2 "
# } # }
# self.checkdiff(**case22) # self.checkdiff(**case22)
tdSql.query("select count(c1) from db.t1 union all select count(c1) from db.t2")
# case23: with limit/slimit # case23: with limit/slimit
case23 = { case23 = {
"condition": "limit 1" "condition": "limit 1"
} }
self.checkdiff(**case23) self.checkdiff(**case23)
# case24 = { case24 = {
# "table_expr": "db.stb1", "table_expr": "db.stb1",
# "condition": "group by tbname slimit 1 soffset 1" "condition": "partition by tbname order by tbname slimit 1 soffset 1"
# } }
# self.checkdiff(**case24) self.checkdiff(**case24)
pass pass
...@@ -284,9 +279,9 @@ class TDTestCase: ...@@ -284,9 +279,9 @@ class TDTestCase:
tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1 tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1
# tdSql.error(self.diff_query_form(table_expr="db.stb1")) # select stb directly # tdSql.error(self.diff_query_form(table_expr="db.stb1")) # select stb directly
stb_join = { stb_join = {
"col": "stb1.c1", "col": "stable1.c1",
"table_expr": "stb1, stb2", "table_expr": "db.stb1 as stable1, db.stb2 as stable2",
"condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts" "condition": "where stable1.ts=stable2.ts and stable1.st1=stable2.st2 order by stable1.ts"
} }
tdSql.query(self.diff_query_form(**stb_join)) # stb join tdSql.query(self.diff_query_form(**stb_join)) # stb join
interval_sql = { interval_sql = {
...@@ -315,20 +310,20 @@ class TDTestCase: ...@@ -315,20 +310,20 @@ class TDTestCase:
for i in range(tbnum): for i in range(tbnum):
for j in range(data_row): for j in range(data_row):
tdSql.execute( tdSql.execute(
f"insert into t{i} values (" f"insert into db.t{i} values ("
f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, "
f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, " f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, "
f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )" f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )"
) )
tdSql.execute( tdSql.execute(
f"insert into t{i} values (" f"insert into db.t{i} values ("
f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, "
f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, " f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, "
f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )" f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )"
) )
tdSql.execute( tdSql.execute(
f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" f"insert into db.tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )"
) )
pass pass
...@@ -349,8 +344,8 @@ class TDTestCase: ...@@ -349,8 +344,8 @@ class TDTestCase:
"create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)" "create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
) )
for i in range(tbnum): for i in range(tbnum):
tdSql.execute(f"create table t{i} using db.stb1 tags({i})") tdSql.execute(f"create table db.t{i} using db.stb1 tags({i})")
tdSql.execute(f"create table tt{i} using db.stb2 tags({i})") tdSql.execute(f"create table db.tt{i} using db.stb2 tags({i})")
pass pass
def diff_support_stable(self): def diff_support_stable(self):
...@@ -398,8 +393,8 @@ class TDTestCase: ...@@ -398,8 +393,8 @@ class TDTestCase:
tdLog.printNoPrefix("######## insert only NULL test:") tdLog.printNoPrefix("######## insert only NULL test:")
for i in range(tbnum): for i in range(tbnum):
tdSql.execute(f"insert into t{i}(ts) values ({nowtime - 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5})")
tdSql.execute(f"insert into t{i}(ts) values ({nowtime + 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()
...@@ -430,9 +425,9 @@ class TDTestCase: ...@@ -430,9 +425,9 @@ class TDTestCase:
tdLog.printNoPrefix("######## insert data mix with NULL test:") tdLog.printNoPrefix("######## insert data mix with NULL test:")
for i in range(tbnum): for i in range(tbnum):
tdSql.execute(f"insert into t{i}(ts) values ({nowtime})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime})")
tdSql.execute(f"insert into t{i}(ts) values ({nowtime-(per_table_rows+3)*10})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime-(per_table_rows+3)*10})")
tdSql.execute(f"insert into t{i}(ts) values ({nowtime+(per_table_rows+3)*10})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime+(per_table_rows+3)*10})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()
......
...@@ -52,12 +52,12 @@ class TDTestCase: ...@@ -52,12 +52,12 @@ class TDTestCase:
return query_condition return query_condition
def __join_condition(self, tb_list, filter=PRIMARY_COL, INNER=False): def __join_condition(self, tb_list, filter=PRIMARY_COL, INNER=False, alias_tb1="tb1", alias_tb2="tb2"):
table_reference = tb_list[0] table_reference = tb_list[0]
join_condition = table_reference join_condition = table_reference
join = "inner join" if INNER else "join" join = "inner join" if INNER else "join"
for i in range(len(tb_list[1:])): for i in range(len(tb_list[1:])):
join_condition += f" {join} {tb_list[i+1]} on {table_reference}.{filter}={tb_list[i+1]}.{filter}" join_condition += f" as {alias_tb1} {join} {tb_list[i+1]} as {alias_tb2} on {alias_tb1}.{filter}={alias_tb2}.{filter}"
return join_condition return join_condition
......
...@@ -65,96 +65,8 @@ class TDTestCase: ...@@ -65,96 +65,8 @@ class TDTestCase:
''' '''
) )
def check_result_auto_log(self ,base , origin_query , log_query):
def check_result_auto_log(self ,origin_query , log_query):
log_result = tdSql.getResult(log_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
if elem == None:
elem = None
elif elem >0:
elem = math.log(elem)
elif elem <=0:
elem = None
row_check.append(elem)
auto_result.append(row_check)
check_status = True
for row_index , row in enumerate(log_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
if not check_status:
tdLog.notice("log function value has not as expected , sql is \"%s\" "%log_query )
sys.exit(1)
else:
tdLog.info("log value check pass , it work as expected ,sql is \"%s\" "%log_query )
def check_result_auto_log2(self ,origin_query , log_query):
log_result = tdSql.getResult(log_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
if elem == None:
elem = None
elif elem >0:
elem = math.log(elem,2)
elif elem <=0:
elem = None
row_check.append(elem)
auto_result.append(row_check)
check_status = True
for row_index , row in enumerate(log_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
if not check_status:
tdLog.notice("log function value has not as expected , sql is \"%s\" "%log_query )
sys.exit(1)
else:
tdLog.info("log value check pass , it work as expected ,sql is \"%s\" "%log_query )
def check_result_auto_log1(self ,origin_query , log_query):
log_result = tdSql.getResult(log_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
if elem == None:
elem = None
elif elem >0:
elem = None
elif elem <=0:
elem = None
row_check.append(elem)
auto_result.append(row_check)
check_status = True
for row_index , row in enumerate(log_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
if not check_status:
tdLog.notice("log function value has not as expected , sql is \"%s\" "%log_query )
sys.exit(1)
else:
tdLog.info("log value check pass , it work as expected ,sql is \"%s\" "%log_query )
def check_result_auto_log__10(self ,origin_query , log_query):
log_result = tdSql.getResult(log_query) log_result = tdSql.getResult(log_query)
origin_result = tdSql.getResult(origin_query) origin_result = tdSql.getResult(origin_query)
...@@ -163,26 +75,30 @@ class TDTestCase: ...@@ -163,26 +75,30 @@ class TDTestCase:
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
if elem == None: if base ==1:
elem = None
elif elem >0:
elem = None
elif elem <=0:
elem = None elem = None
else:
if elem == None:
elem = None
elif elem ==1:
elem = 0.0
elif elem >0 and elem !=1 :
if base==None :
elem = math.log(elem )
else:
print(base , elem)
elem = math.log(elem , base)
elif elem <=0:
elem = None
row_check.append(elem) row_check.append(elem)
auto_result.append(row_check) auto_result.append(row_check)
check_status = True tdSql.query(log_query)
for row_index , row in enumerate(log_result): for row_index , row in enumerate(log_result):
for col_index , elem in enumerate(row): for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem: tdSql.checkData(row_index , col_index ,auto_result[row_index][col_index])
check_status = False
if not check_status:
tdLog.notice("log function value has not as expected , sql is \"%s\" "%log_query )
sys.exit(1)
else:
tdLog.info("log value check pass , it work as expected ,sql is \"%s\" "%log_query )
def test_errors(self, dbname="db"): def test_errors(self, dbname="db"):
error_sql_lists = [ error_sql_lists = [
f"select log from {dbname}.t1", f"select log from {dbname}.t1",
...@@ -328,10 +244,10 @@ class TDTestCase: ...@@ -328,10 +244,10 @@ class TDTestCase:
tdSql.checkData(3 , 0, 1.098612289) tdSql.checkData(3 , 0, 1.098612289)
tdSql.checkData(4 , 0, 1.386294361) tdSql.checkData(4 , 0, 1.386294361)
self.check_result_auto_log( f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) from {dbname}.t1") self.check_result_auto_log( None , f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) from {dbname}.t1")
self.check_result_auto_log2( f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,2), log(c2 ,2) ,log(c3, 2), log(c4 ,2), log(c5 ,2) from {dbname}.t1") self.check_result_auto_log( 2 , f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,2), log(c2 ,2) ,log(c3, 2), log(c4 ,2), log(c5 ,2) from {dbname}.t1")
self.check_result_auto_log__10( f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,1), log(c2 ,1) ,log(c3, 1), log(c4 ,1), log(c5 ,1) from {dbname}.t1") self.check_result_auto_log( 1, f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,1), log(c2 ,1) ,log(c3, 1), log(c4 ,1), log(c5 ,1) from {dbname}.t1")
self.check_result_auto_log__10( f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,-10), log(c2 ,-10) ,log(c3, -10), log(c4 ,-10), log(c5 ,-10) from {dbname}.t1") self.check_result_auto_log( 10 ,f"select c1, c2, c3 , c4, c5 from {dbname}.t1", f"select log(c1 ,10), log(c2 ,10) ,log(c3, 10), log(c4 ,10), log(c5 ,10) from {dbname}.t1")
# used for sub table # used for sub table
tdSql.query(f"select c1 ,log(c1 ,3) from {dbname}.ct1") tdSql.query(f"select c1 ,log(c1 ,3) from {dbname}.ct1")
...@@ -349,9 +265,9 @@ class TDTestCase: ...@@ -349,9 +265,9 @@ class TDTestCase:
tdSql.checkData(3 , 2, 0.147315235) tdSql.checkData(3 , 2, 0.147315235)
tdSql.checkData(4 , 2, None) tdSql.checkData(4 , 2, None)
self.check_result_auto_log( f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) from {dbname}.ct1") self.check_result_auto_log( None ,f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) from {dbname}.ct1")
self.check_result_auto_log2( f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) from {dbname}.ct1") self.check_result_auto_log( 2, f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) from {dbname}.ct1")
self.check_result_auto_log__10( f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1,-10), log(c2,-10) ,log(c3,-10), log(c4,-10), log(c5,-10) from {dbname}.ct1") self.check_result_auto_log( 10 , f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select log(c1,10), log(c2,10) ,log(c3,10), log(c4,10), log(c5,10) from {dbname}.ct1")
# nest query for log functions # nest query for log functions
tdSql.query(f"select c1 , log(c1,3) ,log(log(c1,3),3) , log(log(log(c1,3),3),3) from {dbname}.ct1;") tdSql.query(f"select c1 , log(c1,3) ,log(log(c1,3),3) , log(log(log(c1,3),3),3) from {dbname}.ct1;")
...@@ -585,15 +501,15 @@ class TDTestCase: ...@@ -585,15 +501,15 @@ class TDTestCase:
tdSql.error( tdSql.error(
f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_log( f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) ,log(c6) from {dbname}.sub1_bound") self.check_result_auto_log(None , f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) ,log(c6) from {dbname}.sub1_bound")
self.check_result_auto_log2( f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) ,log(c6,2) from {dbname}.sub1_bound") self.check_result_auto_log( 2 , f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) ,log(c6,2) from {dbname}.sub1_bound")
self.check_result_auto_log__10( f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1,-10), log(c2,-10) ,log(c3,-10), log(c4,-10), log(c5,-10) ,log(c6,-10) from {dbname}.sub1_bound") self.check_result_auto_log( 10 , f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ", f"select log(c1,10), log(c2,10) ,log(c3,10), log(c4,10), log(c5,10) ,log(c6,10) from {dbname}.sub1_bound")
self.check_result_auto_log2( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c3,2), log(c2,2) ,log(c1,2) from {dbname}.sub1_bound") self.check_result_auto_log( 2 , f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select log(c1,2), log(c2,2) ,log(c3,2), log(c3,2), log(c2,2) ,log(c1,2) from {dbname}.sub1_bound")
self.check_result_auto_log( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select log(c1), log(c2) ,log(c3), log(c3), log(c2) ,log(c1) from {dbname}.sub1_bound") self.check_result_auto_log( None , f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select log(c1), log(c2) ,log(c3), log(c3), log(c2) ,log(c1) from {dbname}.sub1_bound")
self.check_result_auto_log2(f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound" , f"select log(abs(c1) ,2) from {dbname}.sub1_bound" ) self.check_result_auto_log(2 , f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound" , f"select log(abs(c1) ,2) from {dbname}.sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query(f"select log(abs(c1),2) ,log(abs(c2),2) , log(abs(c3),2) , log(abs(c4),2), log(abs(c5),2), log(abs(c6),2) from {dbname}.sub1_bound ") tdSql.query(f"select log(abs(c1),2) ,log(abs(c2),2) , log(abs(c3),2) , log(abs(c4),2), log(abs(c5),2), log(abs(c6),2) from {dbname}.sub1_bound ")
...@@ -647,15 +563,15 @@ class TDTestCase: ...@@ -647,15 +563,15 @@ class TDTestCase:
def support_super_table_test(self, dbname="db"): def support_super_table_test(self, dbname="db"):
self.check_result_auto_log2( f"select c5 from {dbname}.stb1 order by ts " , f"select log(c5,2) from {dbname}.stb1 order by ts" ) self.check_result_auto_log( 2 , f"select c5 from {dbname}.stb1 order by ts " , f"select log(c5,2) from {dbname}.stb1 order by ts" )
self.check_result_auto_log2( f"select c5 from {dbname}.stb1 order by tbname " , f"select log(c5,2) from {dbname}.stb1 order by tbname" ) self.check_result_auto_log( 2 ,f"select c5 from {dbname}.stb1 order by tbname " , f"select log(c5,2) from {dbname}.stb1 order by tbname" )
self.check_result_auto_log2( f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" ) self.check_result_auto_log( 2 ,f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" )
self.check_result_auto_log2( f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" ) self.check_result_auto_log( 2 , f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" )
self.check_result_auto_log2( f"select t1,c5 from {dbname}.stb1 order by ts " , f"select log(t1,2), log(c5,2) from {dbname}.stb1 order by ts" ) self.check_result_auto_log( 2 , f"select t1,c5 from {dbname}.stb1 order by ts " , f"select log(t1,2), log(c5,2) from {dbname}.stb1 order by ts" )
self.check_result_auto_log2( f"select t1,c5 from {dbname}.stb1 order by tbname " , f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 order by tbname" ) self.check_result_auto_log( 2 , f"select t1,c5 from {dbname}.stb1 order by tbname " , f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 order by tbname" )
self.check_result_auto_log2( f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" ) self.check_result_auto_log( 2 , f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" )
self.check_result_auto_log2( f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(t1,2) , log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" ) self.check_result_auto_log( 2 ,f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select log(t1,2) , log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname" )
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare() tdSql.prepare()
......
...@@ -96,16 +96,16 @@ class TDTestCase: ...@@ -96,16 +96,16 @@ class TDTestCase:
return sqls return sqls
def __test_current(self): def __test_current(self, dbname="db"):
tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tdLog.printNoPrefix("==========current sql condition check , must return query ok==========")
tbname = ["ct1", "ct2", "ct4", "t1", "stb1"] tbname = [f"{dbname}.ct1", f"{dbname}.ct2", f"{dbname}.ct4", f"{dbname}.t1", f"{dbname}.stb1"]
for tb in tbname: for tb in tbname:
self.__lower_current_check(tb) self.__lower_current_check(tb)
tdLog.printNoPrefix(f"==========current sql condition check in {tb} over==========") tdLog.printNoPrefix(f"==========current sql condition check in {tb} over==========")
def __test_error(self): def __test_error(self, dbname="db"):
tdLog.printNoPrefix("==========err sql condition check , must return error==========") tdLog.printNoPrefix("==========err sql condition check , must return error==========")
tbname = ["ct1", "ct2", "ct4", "t1", "stb1"] tbname = [f"{dbname}.ct1", f"{dbname}.ct2", f"{dbname}.ct4", f"{dbname}.t1", f"{dbname}.stb1"]
for tb in tbname: for tb in tbname:
for errsql in self.__lower_err_check(tb): for errsql in self.__lower_err_check(tb):
...@@ -113,22 +113,20 @@ class TDTestCase: ...@@ -113,22 +113,20 @@ class TDTestCase:
tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========")
def all_test(self): def all_test(self, dbname="db"):
self.__test_current() self.__test_current(dbname)
self.__test_error() self.__test_error(dbname)
def __create_tb(self, dbname="db"):
def __create_tb(self):
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
create_stb_sql = f'''create table stb1( create_stb_sql = f'''create table {dbname}.stb1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
) tags (t1 int) ) tags (tag1 int)
''' '''
create_ntb_sql = f'''create table t1( create_ntb_sql = f'''create table {dbname}.t1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
...@@ -138,78 +136,78 @@ class TDTestCase: ...@@ -138,78 +136,78 @@ class TDTestCase:
tdSql.execute(create_ntb_sql) tdSql.execute(create_ntb_sql)
for i in range(4): for i in range(4):
tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )')
def __insert_data(self, rows): def __insert_data(self, rows, dbname="db"):
now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
for i in range(rows): for i in range(rows):
tdSql.execute( tdSql.execute(
f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f'''insert into ct1 values f'''insert into {dbname}.ct1 values
( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', { now_time + 8 } ) ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } )
( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', { now_time + 9 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } )
''' '''
) )
tdSql.execute( tdSql.execute(
f'''insert into ct4 values f'''insert into {dbname}.ct4 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000+ 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( (
{ now_time + 5184000000}, {pow(2,31)-pow(2,15)}, {pow(2,63)-pow(2,30)}, 32767, 127, { now_time + 5184000000}, {pow(2,31)-pow(2,15)}, {pow(2,63)-pow(2,30)}, 32767, 127,
{ 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_limit-1", { now_time - 86400000} { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000}
) )
( (
{ now_time + 2592000000 }, {pow(2,31)-pow(2,16)}, {pow(2,63)-pow(2,31)}, 32766, 126, { now_time + 2592000000 }, {pow(2,31)-pow(2,16)}, {pow(2,63)-pow(2,31)}, 32766, 126,
{ 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_limit-2", { now_time - 172800000} { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000}
) )
''' '''
) )
tdSql.execute( tdSql.execute(
f'''insert into ct2 values f'''insert into {dbname}.ct2 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000+ 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( (
{ now_time + 5184000000 }, { -1 * pow(2,31) + pow(2,15) }, { -1 * pow(2,63) + pow(2,30) }, -32766, -126, { now_time + 5184000000 }, { -1 * pow(2,31) + pow(2,15) }, { -1 * pow(2,63) + pow(2,30) }, -32766, -126,
{ -1 * 3.2 * pow(10,38) }, { -1.2 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_limit-1", { now_time - 86400000 } { -1 * 3.2 * pow(10,38) }, { -1.2 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
) )
( (
{ now_time + 2592000000 }, { -1 * pow(2,31) + pow(2,16) }, { -1 * pow(2,63) + pow(2,31) }, -32767, -127, { now_time + 2592000000 }, { -1 * pow(2,31) + pow(2,16) }, { -1 * pow(2,63) + pow(2,31) }, -32767, -127,
{ - 3.3 * pow(10,38) }, { -1.3 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_limit-2", { now_time - 172800000 } { - 3.3 * pow(10,38) }, { -1.3 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
) )
''' '''
) )
for i in range(rows): for i in range(rows):
insert_data = f'''insert into t1 values insert_data = f'''insert into {dbname}.t1 values
( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2},
"binary_{i}", "nchar_{i}", { now_time - 1000 * i } ) "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } )
''' '''
tdSql.execute(insert_data) tdSql.execute(insert_data)
tdSql.execute( tdSql.execute(
f'''insert into t1 values f'''insert into {dbname}.t1 values
( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7200000 }, { pow(2,31) - pow(2,15) }, { pow(2,63) - pow(2,30) }, 32767, 127, ( { now_time + 7200000 }, { pow(2,31) - pow(2,15) }, { pow(2,63) - pow(2,30) }, 32767, 127,
{ 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 },
"binary_limit-1", "nchar_limit-1", { now_time - 86400000 } "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
) )
( (
{ now_time + 3600000 } , { pow(2,31) - pow(2,16) }, { pow(2,63) - pow(2,31) }, 32766, 126, { now_time + 3600000 } , { pow(2,31) - pow(2,16) }, { pow(2,63) - pow(2,31) }, 32766, 126,
{ 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 },
"binary_limit-2", "nchar_limit-2", { now_time - 172800000 } "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
) )
''' '''
) )
...@@ -227,10 +225,7 @@ class TDTestCase: ...@@ -227,10 +225,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step3:all check") tdLog.printNoPrefix("==========step3:all check")
self.all_test() self.all_test()
tdDnodes.stop(1) tdSql.execute("flush database db")
tdDnodes.start(1)
tdSql.execute("use db")
tdLog.printNoPrefix("==========step4:after wal, all check again ") tdLog.printNoPrefix("==========step4:after wal, all check again ")
self.all_test() self.all_test()
......
...@@ -307,7 +307,7 @@ class TDTestCase: ...@@ -307,7 +307,7 @@ class TDTestCase:
pass pass
def mavg_current_query(self) : def mavg_current_query(self, dbname="db") :
# table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
# c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16) # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
...@@ -325,17 +325,17 @@ class TDTestCase: ...@@ -325,17 +325,17 @@ class TDTestCase:
case6 = {"col": "c9"} case6 = {"col": "c9"}
self.checkmavg(**case6) self.checkmavg(**case6)
# # case7~8: nested query # case7~8: nested query
# case7 = {"table_expr": f"(select c1 from {dbname}.stb1)"} case7 = {"table_expr": f"(select c1 from {dbname}.stb1)"}
# self.checkmavg(**case7) self.checkmavg(**case7)
# case8 = {"table_expr": f"(select mavg(c1, 1) c1 from {dbname}.stb1 group by tbname)"} # case8 = {"table_expr": f"(select _c0, mavg(c1, 1) c1 from {dbname}.stb1 group by tbname)"}
# self.checkmavg(**case8) # self.checkmavg(**case8)
# case9~10: mix with tbname/ts/tag/col # case9~10: mix with tbname/ts/tag/col
# case9 = {"alias": ", tbname"} case9 = {"alias": ", tbname"}
# self.checkmavg(**case9) self.checkmavg(**case9)
# case10 = {"alias": ", _c0"} case10 = {"alias": ", _c0"}
# self.checkmavg(**case10) self.checkmavg(**case10)
# case11 = {"alias": ", st1"} # case11 = {"alias": ", st1"}
# self.checkmavg(**case11) # self.checkmavg(**case11)
# case12 = {"alias": ", c1"} # case12 = {"alias": ", c1"}
...@@ -356,7 +356,7 @@ class TDTestCase: ...@@ -356,7 +356,7 @@ class TDTestCase:
# case17: only support normal table join # case17: only support normal table join
case17 = { case17 = {
"col": "t1.c1", "col": "t1.c1",
"table_expr": "t1, t2", "table_expr": f"{dbname}.t1 t1, {dbname}.t2 t2",
"condition": "where t1.ts=t2.ts" "condition": "where t1.ts=t2.ts"
} }
self.checkmavg(**case17) self.checkmavg(**case17)
...@@ -367,14 +367,14 @@ class TDTestCase: ...@@ -367,14 +367,14 @@ class TDTestCase:
# } # }
# self.checkmavg(**case19) # self.checkmavg(**case19)
# case20~21: with order by # # case20~21: with order by
# case20 = {"condition": "order by ts"} # case20 = {"condition": "order by ts"}
# self.checkmavg(**case20) # self.checkmavg(**case20)
#case21 = { case21 = {
# "table_expr": f"{dbname}.stb1", "table_expr": f"{dbname}.stb1",
# "condition": "group by tbname order by tbname" "condition": "group by tbname order by tbname"
#} }
#self.checkmavg(**case21) self.checkmavg(**case21)
# # case22: with union # # case22: with union
# case22 = { # case22 = {
...@@ -398,7 +398,7 @@ class TDTestCase: ...@@ -398,7 +398,7 @@ class TDTestCase:
pass pass
def mavg_error_query(self) -> None : def mavg_error_query(self, dbname="db") -> None :
# unusual test # unusual test
# form test # form test
...@@ -419,9 +419,9 @@ class TDTestCase: ...@@ -419,9 +419,9 @@ class TDTestCase:
err8 = {"table_expr": ""} err8 = {"table_expr": ""}
self.checkmavg(**err8) # no table_expr self.checkmavg(**err8) # no table_expr
# err9 = {"col": "st1"} err9 = {"col": "st1"}
# self.checkmavg(**err9) # col: tag # self.checkmavg(**err9) # col: tag
# err10 = {"col": 1} err10 = {"col": 1}
# self.checkmavg(**err10) # col: value # self.checkmavg(**err10) # col: value
err11 = {"col": "NULL"} err11 = {"col": "NULL"}
self.checkmavg(**err11) # col: NULL self.checkmavg(**err11) # col: NULL
...@@ -496,7 +496,7 @@ class TDTestCase: ...@@ -496,7 +496,7 @@ class TDTestCase:
# "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts" # "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
# } # }
# self.checkmavg(**err44) # stb join # self.checkmavg(**err44) # stb join
tdSql.query("select mavg( stb1.c1 , 1 ) from stb1, stb2 where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts;") tdSql.query(f"select mavg( stb1.c1 , 1 ) from {dbname}.stb1 stb1, {dbname}.stb2 stb2 where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts;")
err45 = { err45 = {
"condition": "where ts>0 and ts < now interval(1h) fill(next)" "condition": "where ts>0 and ts < now interval(1h) fill(next)"
} }
......
...@@ -24,9 +24,6 @@ from util.dnodes import tdDnodes ...@@ -24,9 +24,6 @@ from util.dnodes import tdDnodes
from util.dnodes import * from util.dnodes import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
......
...@@ -67,6 +67,7 @@ class TDTestCase: ...@@ -67,6 +67,7 @@ class TDTestCase:
def check_result_auto_sin(self ,origin_query , pow_query): def check_result_auto_sin(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query) pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query) origin_result = tdSql.getResult(origin_query)
auto_result =[] auto_result =[]
...@@ -80,23 +81,11 @@ class TDTestCase: ...@@ -80,23 +81,11 @@ class TDTestCase:
elem = math.sin(elem) elem = math.sin(elem)
row_check.append(elem) row_check.append(elem)
auto_result.append(row_check) auto_result.append(row_check)
tdSql.query(pow_query)
check_status = True
for row_index , row in enumerate(pow_result): for row_index , row in enumerate(pow_result):
for col_index , elem in enumerate(row): for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] is None and elem: tdSql.checkData(row_index ,col_index ,auto_result[row_index][col_index])
check_status = False
elif auto_result[row_index][col_index] is not None and (auto_result[row_index][col_index] - elem > 0.00000001):
print("====,auto_result[row_index][col_index]:",auto_result[row_index][col_index], "elem:", elem)
check_status = False
else:
pass
if not check_status:
tdLog.notice("sin function value has not as expected , sql is \"%s\" "%pow_query )
sys.exit(1)
else:
tdLog.info("sin value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self, dbname="db"): def test_errors(self, dbname="db"):
error_sql_lists = [ error_sql_lists = [
...@@ -393,7 +382,7 @@ class TDTestCase: ...@@ -393,7 +382,7 @@ class TDTestCase:
tdSql.checkData(0,4,-0.100000000) tdSql.checkData(0,4,-0.100000000)
tdSql.checkData(0,5,0.000000000) tdSql.checkData(0,5,0.000000000)
def check_boundary_values(self, dbname="db"): def check_boundary_values(self, dbname="testdb"):
PI=3.1415926 PI=3.1415926
...@@ -418,7 +407,7 @@ class TDTestCase: ...@@ -418,7 +407,7 @@ class TDTestCase:
tdSql.error( tdSql.error(
f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_sin( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ", f"select sin(abs(c1)), sin(abs(c2)) ,sin(abs(c3)), sin(abs(c4)), sin(abs(c5)) from {dbname}.sub1_bound") self.check_result_auto_sin( f"select abs(c1), abs(c2), abs(c3) , abs(c4) from {dbname}.sub1_bound ", f"select sin(abs(c1)), sin(abs(c2)) ,sin(abs(c3)), sin(abs(c4)) from {dbname}.sub1_bound")
self.check_result_auto_sin( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select sin(c1), sin(c2) ,sin(c3), sin(c3), sin(c2) ,sin(c1) from {dbname}.sub1_bound") self.check_result_auto_sin( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select sin(c1), sin(c2) ,sin(c3), sin(c3), sin(c2) ,sin(c1) from {dbname}.sub1_bound")
...@@ -449,24 +438,21 @@ class TDTestCase: ...@@ -449,24 +438,21 @@ class TDTestCase:
tdSql.checkData(0,2,math.sin(32767.000000000)) tdSql.checkData(0,2,math.sin(32767.000000000))
tdSql.checkData(0,3,math.sin(63.500000000)) tdSql.checkData(0,3,math.sin(63.500000000))
tdSql.execute("create stable {dbname}.st (ts timestamp, num1 float, num2 double) tags (t1 int);") tdSql.execute(f"create stable {dbname}.st (ts timestamp, num1 float, num2 double) tags (t1 int);")
tdSql.execute(f'create table {dbname}.tb1 using {dbname}.st tags (1)') tdSql.execute(f'create table {dbname}.tb1 using {dbname}.st tags (1)')
tdSql.execute(f'create table {dbname}.tb2 using {dbname}.st tags (2)') tdSql.execute(f'create table {dbname}.tb2 using {dbname}.st tags (2)')
tdSql.execute(f'create table {dbname}.tb3 using {dbname}.st tags (3)') tdSql.execute(f'create table {dbname}.tb3 using {dbname}.st tags (3)')
tdSql.execute('insert into {dbname}.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 {dbname}.tb1 values (now()-30s, {}, {})'.format(PI ,PI )) tdSql.execute(f'insert into {dbname}.tb1 values (now()-30s, {PI}, {PI})')
tdSql.execute('insert into {dbname}.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 {dbname}.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 {dbname}.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 {dbname}.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 {dbname}.tb2 values (now()-30s, {}, {})'.format(PI ,PI )) tdSql.execute(f'insert into {dbname}.tb2 values (now()-30s, {PI}, {PI})')
tdSql.execute('insert into {dbname}.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 {dbname}.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 {dbname}.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})')
for i in range(100):
tdSql.execute('insert into {dbname}.tb3 values (now()+{}s, {}, {})'.format(i,PI*(5+i)/2 ,PI*(5+i)/2))
self.check_result_auto_sin(f"select num1,num2 from {dbname}.tb3;" , f"select sin(num1),sin(num2) from {dbname}.tb3") self.check_result_auto_sin(f"select num1,num2 from {dbname}.tb3;" , f"select sin(num1),sin(num2) from {dbname}.tb3")
...@@ -500,19 +486,20 @@ class TDTestCase: ...@@ -500,19 +486,20 @@ class TDTestCase:
self.basic_sin_function() self.basic_sin_function()
tdLog.printNoPrefix("==========step5: big number sin query ============") tdLog.printNoPrefix("==========step5: sin filter query ============")
self.test_big_number()
self.abs_func_filter()
tdLog.printNoPrefix("==========step6: sin boundary query ============") tdLog.printNoPrefix("==========step6: big number sin query ============")
self.check_boundary_values() self.test_big_number()
tdLog.printNoPrefix("==========step7: sin filter query ============") tdLog.printNoPrefix("==========step7: sin boundary query ============")
self.abs_func_filter() self.check_boundary_values()
tdLog.printNoPrefix("==========step8: check sin result of stable query ============") tdLog.printNoPrefix("==========step8: check sin result of stable query ============")
self.support_super_table_test() self.support_super_table_test()
......
...@@ -83,21 +83,11 @@ class TDTestCase: ...@@ -83,21 +83,11 @@ class TDTestCase:
row_check.append(elem) row_check.append(elem)
auto_result.append(row_check) auto_result.append(row_check)
check_status = True tdSql.query(pow_query)
for row_index , row in enumerate(pow_result): for row_index , row in enumerate(pow_result):
for col_index , elem in enumerate(row): for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): tdSql.checkData(row_index ,col_index ,auto_result[row_index][col_index])
check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False
else:
pass
if not check_status:
tdLog.notice("sqrt function value has not as expected , sql is \"%s\" "%pow_query )
sys.exit(1)
else:
tdLog.info("sqrt value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self, dbname="db"): def test_errors(self, dbname="db"):
error_sql_lists = [ error_sql_lists = [
...@@ -452,19 +442,19 @@ class TDTestCase: ...@@ -452,19 +442,19 @@ class TDTestCase:
) )
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )') tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.error( tdSql.error(
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_sqrt( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ", f"select sqrt(abs(c1)), sqrt(abs(c2)) ,sqrt(abs(c3)), sqrt(abs(c4)), sqrt(abs(c5)) from {dbname}.sub1_bound") self.check_result_auto_sqrt( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ", f"select sqrt(abs(c1)), sqrt(abs(c2)) ,sqrt(abs(c3)), sqrt(abs(c4)), sqrt(abs(c5)) from {dbname}.sub1_bound")
......
...@@ -59,7 +59,7 @@ class TDTestCase: ...@@ -59,7 +59,7 @@ class TDTestCase:
( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a )
( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) ( '2022-12-31 01:01:36.000', 9, -99999, -999, -99, -9.99, -99999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
''' '''
) )
...@@ -80,22 +80,10 @@ class TDTestCase: ...@@ -80,22 +80,10 @@ class TDTestCase:
elem = math.tan(elem) elem = math.tan(elem)
row_check.append(elem) row_check.append(elem)
auto_result.append(row_check) auto_result.append(row_check)
tdSql.query(pow_query)
check_status = True
for row_index , row in enumerate(pow_result): for row_index , row in enumerate(pow_result):
for col_index , elem in enumerate(row): for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): tdSql.checkData(row_index , col_index ,auto_result[row_index][col_index] )
check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False
else:
pass
if not check_status:
tdLog.notice("tan function value has not as expected , sql is \"%s\" "%pow_query )
sys.exit(1)
else:
tdLog.info("tan value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self, dbname="db"): def test_errors(self, dbname="db"):
error_sql_lists = [ error_sql_lists = [
...@@ -244,7 +232,7 @@ class TDTestCase: ...@@ -244,7 +232,7 @@ class TDTestCase:
tdSql.checkData(3, 4, 33) tdSql.checkData(3, 4, 33)
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_tan( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.t1", f"select tan(abs(c1)), tan(abs(c2)) ,tan(abs(c3)), tan(abs(c4)), tan(abs(c5)) from {dbname}.t1") self.check_result_auto_tan( f"select abs(c1), abs(c2), abs(c3) , abs(c4) from {dbname}.t1", f"select tan(abs(c1)), tan(abs(c2)) ,tan(abs(c3)), tan(abs(c4)) from {dbname}.t1")
# used for sub table # used for sub table
tdSql.query(f"select c2 ,tan(c2) from {dbname}.ct1") tdSql.query(f"select c2 ,tan(c2) from {dbname}.ct1")
...@@ -402,21 +390,21 @@ class TDTestCase: ...@@ -402,21 +390,21 @@ class TDTestCase:
) )
tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )') tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )')
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.error( tdSql.error(
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into {dbname}.sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_tan( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ", f"select tan(abs(c1)), tan(abs(c2)) ,tan(abs(c3)), tan(abs(c4)), tan(abs(c5)) from {dbname}.sub1_bound") self.check_result_auto_tan( f"select abs(c1), abs(c2), abs(c3) , abs(c4) from {dbname}.sub1_bound ", f"select tan(abs(c1)), tan(abs(c2)) ,tan(abs(c3)), tan(abs(c4)) from {dbname}.sub1_bound")
self.check_result_auto_tan( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select tan(c1), tan(c2) ,tan(c3), tan(c3), tan(c2) ,tan(c1) from {dbname}.sub1_bound") self.check_result_auto_tan( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select tan(c1), tan(c2) ,tan(c3), tan(c3), tan(c2) ,tan(c1) from {dbname}.sub1_bound")
...@@ -463,9 +451,6 @@ class TDTestCase: ...@@ -463,9 +451,6 @@ class TDTestCase:
tdSql.execute(f'insert into {dbname}.tb2 values (now()-10s, {PI*2}, {PI*2})') tdSql.execute(f'insert into {dbname}.tb2 values (now()-10s, {PI*2}, {PI*2})')
tdSql.execute(f'insert into {dbname}.tb2 values (now(), {PI*2.5}, {PI*2.5})') tdSql.execute(f'insert into {dbname}.tb2 values (now(), {PI*2.5}, {PI*2.5})')
for i in range(100):
tdSql.execute(f'insert into tb3 values (now()+{i}s, {PI*(5+i)/2}, {PI*(5+i)/2})')
self.check_result_auto_tan(f"select num1,num2 from {dbname}.tb3;" , f"select tan(num1),tan(num2) from {dbname}.tb3") self.check_result_auto_tan(f"select num1,num2 from {dbname}.tb3;" , f"select tan(num1),tan(num2) from {dbname}.tb3")
def support_super_table_test(self, dbname="db"): def support_super_table_test(self, dbname="db"):
......
...@@ -25,6 +25,7 @@ class TDTestCase: ...@@ -25,6 +25,7 @@ class TDTestCase:
self.ntbname = f'{self.dbname}.ntb' self.ntbname = f'{self.dbname}.ntb'
self.stbname = f'{self.dbname}.stb' self.stbname = f'{self.dbname}.stb'
self.ctbname = f'{self.dbname}.ctb' self.ctbname = f'{self.dbname}.ctb'
def check_ms_timestamp(self,unit,date_time): def check_ms_timestamp(self,unit,date_time):
if unit.lower() == '1a': if unit.lower() == '1a':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
...@@ -45,11 +46,12 @@ class TDTestCase: ...@@ -45,11 +46,12 @@ class TDTestCase:
elif unit.lower() == '1d': elif unit.lower() == '1d':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
ts_result = self.get_time.get_ms_timestamp(str(tdSql.queryResult[i][0])) ts_result = self.get_time.get_ms_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]/1000/60/60/24)*24*60*60*1000) tdSql.checkEqual(ts_result,int(date_time[i]/1000/60/60/24)*24*60*60*1000)
elif unit.lower() == '1w': elif unit.lower() == '1w':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
ts_result = self.get_time.get_ms_timestamp(str(tdSql.queryResult[i][0])) ts_result = self.get_time.get_ms_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]/1000/60/60/24/7)*7*24*60*60*1000) tdSql.checkEqual(ts_result,int(date_time[i]/1000/60/60/24/7)*7*24*60*60*1000)
def check_us_timestamp(self,unit,date_time): def check_us_timestamp(self,unit,date_time):
if unit.lower() == '1u': if unit.lower() == '1u':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
...@@ -74,47 +76,58 @@ class TDTestCase: ...@@ -74,47 +76,58 @@ class TDTestCase:
elif unit.lower() == '1d': elif unit.lower() == '1d':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
ts_result = self.get_time.get_us_timestamp(str(tdSql.queryResult[i][0])) ts_result = self.get_time.get_us_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]/1000/1000/60/60/24)*24*60*60*1000*1000 ) tdSql.checkEqual(ts_result,int(date_time[i]/1000/1000/60/60/24)*24*60*60*1000*1000 )
elif unit.lower() == '1w': elif unit.lower() == '1w':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
ts_result = self.get_time.get_us_timestamp(str(tdSql.queryResult[i][0])) ts_result = self.get_time.get_us_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]/1000/1000/60/60/24/7)*7*24*60*60*1000*1000) tdSql.checkEqual(ts_result,int(date_time[i]/1000/1000/60/60/24/7)*7*24*60*60*1000*1000)
def check_ns_timestamp(self,unit,date_time):
def check_ns_timestamp(self, unit, date_time:list):
if unit.lower() == '1b': if unit.lower() == '1b':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i])) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]))
elif unit.lower() == '1u': elif unit.lower() == '1u':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000)*1000) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000)*1000)
elif unit.lower() == '1a': elif unit.lower() == '1a':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000)*1000*1000) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000)*1000*1000)
elif unit.lower() == '1s': elif unit.lower() == '1s':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000)*1000*1000*1000) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000/1000)*1000*1000*1000)
elif unit.lower() == '1m': elif unit.lower() == '1m':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60)*60*1000*1000*1000) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000/1000/60)*60*1000*1000*1000)
elif unit.lower() == '1h': elif unit.lower() == '1h':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60)*60*60*1000*1000*1000 ) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000/1000/60/60)*60*60*1000*1000*1000 )
elif unit.lower() == '1d': elif unit.lower() == '1d':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24)*24*60*60*1000*1000*1000 ) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000/1000/60/60/24)*24*60*60*1000*1000*1000 )
elif unit.lower() == '1w': elif unit.lower() == '1w':
for i in range(len(self.ts_str)): for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24/7)*7*24*60*60*1000*1000*1000) ts_result = self.get_time.get_ns_timestamp(str(tdSql.queryResult[i][0]))
tdSql.checkEqual(ts_result,int(date_time[i]*1000/1000/1000/1000/1000/60/60/24/7)*7*24*60*60*1000*1000*1000)
def check_tb_type(self,unit,tb_type): def check_tb_type(self,unit,tb_type):
if tb_type.lower() == 'ntb': if tb_type.lower() == 'ntb':
tdSql.query(f'select timetruncate(ts,{unit}) from {self.ntbname}') tdSql.query(f'select timetruncate(ts,{unit}) from {self.ntbname}')
elif tb_type.lower() == 'ctb': elif tb_type.lower() == 'ctb':
tdSql.query(f'select timetruncate(ts,{unit}) from {self.ctbname}') tdSql.query(f'select timetruncate(ts,{unit}) from {self.ctbname}')
elif tb_type.lower() == 'stb': elif tb_type.lower() == 'stb':
tdSql.query(f'select timetruncate(ts,{unit}) from {self.stbname}') tdSql.query(f'select timetruncate(ts,{unit}) from {self.stbname}')
def data_check(self,date_time,precision,tb_type): def data_check(self,date_time,precision,tb_type):
for unit in self.time_unit: for unit in self.time_unit:
if (unit.lower() == '1u' and precision.lower() == 'ms') or (unit.lower() == '1b' and precision.lower() == 'us') or (unit.lower() == '1b' and precision.lower() == 'ms'): if (unit.lower() == '1u' and precision.lower() == 'ms') or (unit.lower() == '1b' and precision.lower() == 'us') or (unit.lower() == '1b' and precision.lower() == 'ms'):
if tb_type.lower() == 'ntb': if tb_type.lower() == 'ntb':
tdSql.error(f'select timetruncate(ts,{unit}) from {self.ntbname}') tdSql.error(f'select timetruncate(ts,{unit}) from {self.ntbname}')
elif tb_type.lower() == 'ctb': elif tb_type.lower() == 'ctb':
tdSql.error(f'select timetruncate(ts,{unit}) from {self.ctbname}') tdSql.error(f'select timetruncate(ts,{unit}) from {self.ctbname}')
...@@ -139,16 +152,19 @@ class TDTestCase: ...@@ -139,16 +152,19 @@ class TDTestCase:
tdSql.error(f'select timetruncate(ts,{unit}) from {self.ctbname}') tdSql.error(f'select timetruncate(ts,{unit}) from {self.ctbname}')
elif tb_type.lower() == 'stb': elif tb_type.lower() == 'stb':
tdSql.error(f'select timetruncate(ts,{unit}) from {self.stbname}') tdSql.error(f'select timetruncate(ts,{unit}) from {self.stbname}')
def function_check_ntb(self): def function_check_ntb(self):
for precision in self.db_param_precision: for precision in self.db_param_precision:
tdSql.execute(f'drop database if exists {self.dbname}') tdSql.execute(f'drop database if exists {self.dbname}')
tdSql.execute(f'create database {self.dbname} precision "{precision}"') tdSql.execute(f'create database {self.dbname} precision "{precision}"')
tdLog.info(f"=====now is in a {precision} database=====")
tdSql.execute(f'use {self.dbname}') tdSql.execute(f'use {self.dbname}')
tdSql.execute(f'create table {self.ntbname} (ts timestamp,c0 int)') tdSql.execute(f'create table {self.ntbname} (ts timestamp,c0 int)')
for ts in self.ts_str: for ts in self.ts_str:
tdSql.execute(f'insert into {self.ntbname} values("{ts}",1)') tdSql.execute(f'insert into {self.ntbname} values("{ts}",1)')
date_time = self.get_time.time_transform(self.ts_str,precision) date_time = self.get_time.time_transform(self.ts_str,precision)
self.data_check(date_time,precision,'ntb') self.data_check(date_time,precision,'ntb')
def function_check_stb(self): def function_check_stb(self):
for precision in self.db_param_precision: for precision in self.db_param_precision:
tdSql.execute(f'drop database if exists {self.dbname}') tdSql.execute(f'drop database if exists {self.dbname}')
...@@ -161,9 +177,11 @@ class TDTestCase: ...@@ -161,9 +177,11 @@ class TDTestCase:
date_time = self.get_time.time_transform(self.ts_str,precision) date_time = self.get_time.time_transform(self.ts_str,precision)
self.data_check(date_time,precision,'ctb') self.data_check(date_time,precision,'ctb')
self.data_check(date_time,precision,'stb') self.data_check(date_time,precision,'stb')
def run(self): def run(self):
self.function_check_ntb() self.function_check_ntb()
self.function_check_stb() self.function_check_stb()
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -26,20 +26,21 @@ class TDTestCase: ...@@ -26,20 +26,21 @@ class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), False)
def run(self): def run(self):
dbname="db"
tdSql.prepare() tdSql.prepare()
tdSql.error("create table ttl_table1(ts timestamp, i int) ttl 1.1") tdSql.error(f"create table {dbname}.ttl_table1(ts timestamp, i int) ttl 1.1")
tdSql.error("create table ttl_table2(ts timestamp, i int) ttl 1e1") tdSql.error(f"create table {dbname}.ttl_table2(ts timestamp, i int) ttl 1e1")
tdSql.error("create table ttl_table3(ts timestamp, i int) ttl -1") tdSql.error(f"create table {dbname}.ttl_table3(ts timestamp, i int) ttl -1")
print("============== STEP 1 ===== test normal table") print("============== STEP 1 ===== test normal table")
tdSql.execute("create table normal_table1(ts timestamp, i int)") tdSql.execute(f"create table {dbname}.normal_table1(ts timestamp, i int)")
tdSql.execute("create table normal_table2(ts timestamp, i int) comment '' ttl 3") tdSql.execute(f"create table {dbname}.normal_table2(ts timestamp, i int) comment '' ttl 3")
tdSql.execute("create table normal_table3(ts timestamp, i int) ttl 2100000000020 comment 'hello'") tdSql.execute(f"create table {dbname}.normal_table3(ts timestamp, i int) ttl 2100000000020 comment 'hello'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1') tdSql.checkData(0, 0, 'normal_table1')
...@@ -58,32 +59,32 @@ class TDTestCase: ...@@ -58,32 +59,32 @@ class TDTestCase:
tdSql.checkData(0, 7, 2147483647) tdSql.checkData(0, 7, 2147483647)
tdSql.checkData(0, 8, 'hello') tdSql.checkData(0, 8, 'hello')
tdSql.execute("alter table normal_table1 comment 'nihao'") tdSql.execute(f"alter table {dbname}.normal_table1 comment 'nihao'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1') tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 8, 'nihao') tdSql.checkData(0, 8, 'nihao')
tdSql.execute("alter table normal_table1 comment ''") tdSql.execute(f"alter table {dbname}.normal_table1 comment ''")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1') tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 8, '') tdSql.checkData(0, 8, '')
tdSql.execute("alter table normal_table2 comment 'fly'") tdSql.execute(f"alter table {dbname}.normal_table2 comment 'fly'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table2'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table2'")
tdSql.checkData(0, 0, 'normal_table2') tdSql.checkData(0, 0, 'normal_table2')
tdSql.checkData(0, 8, 'fly') tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table normal_table3 comment 'fly'") tdSql.execute(f"alter table {dbname}.normal_table3 comment 'fly'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'")
tdSql.checkData(0, 0, 'normal_table3') tdSql.checkData(0, 0, 'normal_table3')
tdSql.checkData(0, 8, 'fly') tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table normal_table1 ttl 1") tdSql.execute(f"alter table {dbname}.normal_table1 ttl 1")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1') tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 7, 1) tdSql.checkData(0, 7, 1)
tdSql.execute("alter table normal_table3 ttl 0") tdSql.execute(f"alter table {dbname}.normal_table3 ttl 0")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'") tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'")
tdSql.checkData(0, 0, 'normal_table3') tdSql.checkData(0, 0, 'normal_table3')
tdSql.checkData(0, 7, 0) tdSql.checkData(0, 7, 0)
...@@ -91,9 +92,9 @@ class TDTestCase: ...@@ -91,9 +92,9 @@ class TDTestCase:
print("============== STEP 2 ===== test super table") print("============== STEP 2 ===== test super table")
tdSql.execute("create table super_table1(ts timestamp, i int) tags(t int)") tdSql.execute(f"create table {dbname}.super_table1(ts timestamp, i int) tags(t int)")
tdSql.execute("create table super_table2(ts timestamp, i int) tags(t int) comment ''") tdSql.execute(f"create table {dbname}.super_table2(ts timestamp, i int) tags(t int) comment ''")
tdSql.execute("create table super_table3(ts timestamp, i int) tags(t int) comment 'super'") tdSql.execute(f"create table {dbname}.super_table3(ts timestamp, i int) tags(t int) comment 'super'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'") tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1') tdSql.checkData(0, 0, 'super_table1')
...@@ -110,32 +111,32 @@ class TDTestCase: ...@@ -110,32 +111,32 @@ class TDTestCase:
tdSql.checkData(0, 6, 'super') tdSql.checkData(0, 6, 'super')
tdSql.execute("alter table super_table1 comment 'nihao'") tdSql.execute(f"alter table {dbname}.super_table1 comment 'nihao'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'") tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1') tdSql.checkData(0, 0, 'super_table1')
tdSql.checkData(0, 6, 'nihao') tdSql.checkData(0, 6, 'nihao')
tdSql.execute("alter table super_table1 comment ''") tdSql.execute(f"alter table {dbname}.super_table1 comment ''")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'") tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1') tdSql.checkData(0, 0, 'super_table1')
tdSql.checkData(0, 6, '') tdSql.checkData(0, 6, '')
tdSql.execute("alter table super_table2 comment 'fly'") tdSql.execute(f"alter table {dbname}.super_table2 comment 'fly'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table2'") tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table2'")
tdSql.checkData(0, 0, 'super_table2') tdSql.checkData(0, 0, 'super_table2')
tdSql.checkData(0, 6, 'fly') tdSql.checkData(0, 6, 'fly')
tdSql.execute("alter table super_table3 comment 'tdengine'") tdSql.execute(f"alter table {dbname}.super_table3 comment 'tdengine'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table3'") tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table3'")
tdSql.checkData(0, 0, 'super_table3') tdSql.checkData(0, 0, 'super_table3')
tdSql.checkData(0, 6, 'tdengine') tdSql.checkData(0, 6, 'tdengine')
print("============== STEP 3 ===== test child table") print("============== STEP 3 ===== test child table")
tdSql.execute("create table child_table1 using super_table1 tags(1) ttl 10") tdSql.execute(f"create table {dbname}.child_table1 using {dbname}.super_table1 tags(1) ttl 10")
tdSql.execute("create table child_table2 using super_table1 tags(1) comment ''") tdSql.execute(f"create table {dbname}.child_table2 using {dbname}.super_table1 tags(1) comment ''")
tdSql.execute("create table child_table3 using super_table1 tags(1) comment 'child'") tdSql.execute(f"create table {dbname}.child_table3 using {dbname}.super_table1 tags(1) comment 'child'")
tdSql.execute("insert into child_table4 using super_table1 tags(1) values(now, 1)") tdSql.execute(f"insert into {dbname}.child_table4 using {dbname}.super_table1 tags(1) values(now, 1)")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
...@@ -160,38 +161,38 @@ class TDTestCase: ...@@ -160,38 +161,38 @@ class TDTestCase:
tdSql.checkData(0, 8, None) tdSql.checkData(0, 8, None)
tdSql.execute("alter table child_table1 comment 'nihao'") tdSql.execute(f"alter table {dbname}.child_table1 comment 'nihao'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1') tdSql.checkData(0, 0, 'child_table1')
tdSql.checkData(0, 8, 'nihao') tdSql.checkData(0, 8, 'nihao')
tdSql.execute("alter table child_table1 comment ''") tdSql.execute(f"alter table {dbname}.child_table1 comment ''")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1') tdSql.checkData(0, 0, 'child_table1')
tdSql.checkData(0, 8, '') tdSql.checkData(0, 8, '')
tdSql.execute("alter table child_table2 comment 'fly'") tdSql.execute(f"alter table {dbname}.child_table2 comment 'fly'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table2'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table2'")
tdSql.checkData(0, 0, 'child_table2') tdSql.checkData(0, 0, 'child_table2')
tdSql.checkData(0, 8, 'fly') tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table child_table3 comment 'tdengine'") tdSql.execute(f"alter table {dbname}.child_table3 comment 'tdengine'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'")
tdSql.checkData(0, 0, 'child_table3') tdSql.checkData(0, 0, 'child_table3')
tdSql.checkData(0, 8, 'tdengine') tdSql.checkData(0, 8, 'tdengine')
tdSql.execute("alter table child_table4 comment 'tdengine'") tdSql.execute(f"alter table {dbname}.child_table4 comment 'tdengine'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'")
tdSql.checkData(0, 0, 'child_table4') tdSql.checkData(0, 0, 'child_table4')
tdSql.checkData(0, 8, 'tdengine') tdSql.checkData(0, 8, 'tdengine')
tdSql.execute("alter table child_table4 ttl 9") tdSql.execute(f"alter table {dbname}.child_table4 ttl 9")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'")
tdSql.checkData(0, 0, 'child_table4') tdSql.checkData(0, 0, 'child_table4')
tdSql.checkData(0, 7, 9) tdSql.checkData(0, 7, 9)
tdSql.execute("alter table child_table3 ttl 9") tdSql.execute(f"alter table {dbname}.child_table3 ttl 9")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'") tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'")
tdSql.checkData(0, 0, 'child_table3') tdSql.checkData(0, 0, 'child_table3')
tdSql.checkData(0, 7, 9) tdSql.checkData(0, 7, 9)
...@@ -203,4 +204,3 @@ class TDTestCase: ...@@ -203,4 +204,3 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
...@@ -7,10 +7,7 @@ import platform ...@@ -7,10 +7,7 @@ import platform
import math import math
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 }
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143,
"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 }
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
...@@ -21,46 +18,45 @@ class TDTestCase: ...@@ -21,46 +18,45 @@ class TDTestCase:
self.row_nums = 100 self.row_nums = 100
self.time_step = 1000 self.time_step = 1000
def prepare_datas_of_distribute(self): def prepare_datas_of_distribute(self, dbname="testdb"):
# prepate datas for 20 tables distributed at different vgroups # prepate datas for 20 tables distributed at different vgroups
tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5")
tdSql.execute(" use testdb ")
tdSql.execute( tdSql.execute(
'''create table stb1 f'''create table {dbname}.stb1
(ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32))
''' '''
) )
for i in range(self.tb_nums): for i in range(self.tb_nums):
tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )')
ts = self.ts ts = self.ts
for j in range(self.row_nums): for j in range(self.row_nums):
ts+=j*self.time_step ts+=j*self.time_step
tdSql.execute( tdSql.execute(
f"insert into ct{i+1} values({ts}, 1, 11111, 111, 1, 1.11, 11.11, 2, 'binary{j}', 'nchar{j}', now()+{1*j}a )" f"insert into {dbname}.ct{i+1} values({ts}, 1, 11111, 111, 1, 1.11, 11.11, 2, 'binary{j}', 'nchar{j}', now()+{1*j}a )"
) )
tdSql.execute("insert into ct1 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct1 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute("insert into ct1 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct1 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute("insert into ct1 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct1 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdLog.info(" prepare data for distributed_aggregate done! ") tdLog.info(" prepare data for distributed_aggregate done! ")
def twa_support_types(self): def twa_support_types(self, dbname="testdb"):
tdSql.query("desc stb1 ") tdSql.query(f"desc {dbname}.stb1 ")
schema_list = tdSql.queryResult schema_list = tdSql.queryResult
for col_type in schema_list: for col_type in schema_list:
if col_type[1] in ["TINYINT" ,"SMALLINT","BIGINT" ,"INT","FLOAT","DOUBLE"]: if col_type[1] in ["TINYINT" ,"SMALLINT","BIGINT" ,"INT","FLOAT","DOUBLE"]:
tdSql.query(f" select twa({col_type[0]}) from stb1 partition by tbname ") tdSql.query(f"select twa({col_type[0]}) from {dbname}.stb1 partition by tbname ")
else: else:
tdSql.error(f" select twa({col_type[0]}) from stb1 partition by tbname ") tdSql.error(f"select twa({col_type[0]}) from {dbname}.stb1 partition by tbname ")
def check_distribute_datas(self): def check_distribute_datas(self, dbname="testdb"):
# get vgroup_ids of all # get vgroup_ids of all
tdSql.query("show vgroups ") tdSql.query(f"show {dbname}.vgroups ")
vgroups = tdSql.queryResult vgroups = tdSql.queryResult
vnode_tables={} vnode_tables={}
...@@ -69,7 +65,7 @@ class TDTestCase: ...@@ -69,7 +65,7 @@ class TDTestCase:
vnode_tables[vgroup_id[0]]=[] vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed # check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"select * from information_schema.ins_tables where db_name = 'testdb' and table_name like 'ct%'") tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult table_names = tdSql.queryResult
tablenames = [] tablenames = []
for table_name in table_names: for table_name in table_names:
...@@ -83,28 +79,28 @@ class TDTestCase: ...@@ -83,28 +79,28 @@ class TDTestCase:
if count < 2: if count < 2:
tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") tdLog.exit(" the datas of all not satisfy sub_table has been distributed ")
def distribute_twa_query(self): def distribute_twa_query(self, dbname="testdb"):
# basic filter # basic filter
tdSql.query(" select twa(c1) from ct1 ") tdSql.query(f"select twa(c1) from {dbname}.ct1 ")
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
tdSql.query(" select twa(c1) from stb1 partition by tbname ") tdSql.query(f"select twa(c1) from {dbname}.stb1 partition by tbname ")
tdSql.checkRows(self.tb_nums) tdSql.checkRows(self.tb_nums)
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
tdSql.query(" select twa(c2) from stb1 group by tbname ") tdSql.query(f"select twa(c2) from {dbname}.stb1 group by tbname ")
tdSql.checkRows(self.tb_nums) tdSql.checkRows(self.tb_nums)
tdSql.checkData(0,0,11111.000000000) tdSql.checkData(0,0,11111.000000000)
tdSql.query("select twa(c1+c2) from stb1 partition by tbname ") tdSql.query(f"select twa(c1+c2) from {dbname}.stb1 partition by tbname ")
tdSql.checkData(0,0,11112.000000000) tdSql.checkData(0,0,11112.000000000)
tdSql.query("select twa(c1) from stb1 partition by t1") tdSql.query(f"select twa(c1) from {dbname}.stb1 partition by t1")
tdSql.checkRows(self.tb_nums) tdSql.checkRows(self.tb_nums)
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
# union all # union all
tdSql.query(" select twa(c1) from stb1 partition by tbname union all select twa(c1) from stb1 partition by tbname ") tdSql.query(f"select twa(c1) from {dbname}.stb1 partition by tbname union all select twa(c1) from {dbname}.stb1 partition by tbname ")
tdSql.checkRows(40) tdSql.checkRows(40)
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
...@@ -112,26 +108,23 @@ class TDTestCase: ...@@ -112,26 +108,23 @@ class TDTestCase:
tdSql.execute(" create database if not exists db ") tdSql.execute(" create database if not exists db ")
tdSql.execute(" use db ") tdSql.execute(" use db ")
tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ")
tdSql.execute(" create table tb1 using st tags(1) ") tdSql.execute(" create table db.tb1 using db.st tags(1) ")
tdSql.execute(" create table tb2 using st tags(2) ") tdSql.execute(" create table db.tb2 using db.st tags(2) ")
for i in range(10): for i in range(10):
ts = i*10 + self.ts ts = i*10 + self.ts
tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)")
tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)")
tdSql.query(" select twa(tb1.c1), twa(tb2.c2) from tb1, tb2 where tb1.ts=tb2.ts ") tdSql.query(f"select twa(tb1.c1), twa(tb2.c2) from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts ")
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkData(0,0,4.500000000) tdSql.checkData(0,0,4.500000000)
tdSql.checkData(0,1,4.500000000) tdSql.checkData(0,1,4.500000000)
# group by
tdSql.execute(" use testdb ")
# mixup with other functions # mixup with other functions
tdSql.query(" select twa(c1),twa(c2),max(c1),elapsed(ts) from stb1 ") tdSql.query(f"select twa(c1),twa(c2),max(c1),elapsed(ts) from {dbname}.stb1 ")
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
tdSql.checkData(0,1,11111.000000000) tdSql.checkData(0,1,11111.000000000)
tdSql.checkData(0,2,1) tdSql.checkData(0,2,1)
......
...@@ -58,10 +58,10 @@ class TDTestCase: ...@@ -58,10 +58,10 @@ class TDTestCase:
def __join_condition(self, tb_list, filter=PRIMARY_COL, INNER=False): def __join_condition(self, tb_list, filter=PRIMARY_COL, INNER=False):
table_reference = tb_list[0] table_reference = tb_list[0]
join_condition = table_reference join_condition = f'{table_reference} {table_reference.split(".")[-1]}'
join = "inner join" if INNER else "join" join = "inner join" if INNER else "join"
for i in range(len(tb_list[1:])): for i in range(len(tb_list[1:])):
join_condition += f" {join} {tb_list[i+1]} on {table_reference}.{filter}={tb_list[i+1]}.{filter}" join_condition += f" {join} {tb_list[i+1]} {tb_list[i+1].split('.')[-1]} on {table_reference.split('.')[-1]}.{filter}={tb_list[i+1].split('.')[-1]}.{filter}"
return join_condition return join_condition
...@@ -76,7 +76,6 @@ class TDTestCase: ...@@ -76,7 +76,6 @@ class TDTestCase:
elif query_conditon.startswith("min"): elif query_conditon.startswith("min"):
query_conditon = query_conditon[4:-1] query_conditon = query_conditon[4:-1]
if query_conditon: if query_conditon:
return f" where {query_conditon} is not null" return f" where {query_conditon} is not null"
if col in NUM_COL: if col in NUM_COL:
...@@ -108,10 +107,10 @@ class TDTestCase: ...@@ -108,10 +107,10 @@ class TDTestCase:
return f"select {select_clause} from {from_clause} {where_condition} {group_condition}" return f"select {select_clause} from {from_clause} {where_condition} {group_condition}"
@property @property
def __join_tblist(self): def __join_tblist(self, dbname="db"):
return [ return [
["ct1", "t1"], [f"{dbname}.ct1", f"{dbname}.t1"],
["ct4", "t1"], [f"{dbname}.ct4", f"{dbname}.t1"],
# ["ct1", "ct2", "ct4"], # ["ct1", "ct2", "ct4"],
# ["ct1", "ct2", "t1"], # ["ct1", "ct2", "t1"],
# ["ct1", "ct4", "t1"], # ["ct1", "ct4", "t1"],
...@@ -120,10 +119,10 @@ class TDTestCase: ...@@ -120,10 +119,10 @@ class TDTestCase:
] ]
@property @property
def __tb_liast(self): def __tb_list(self, dbname="db"):
return [ return [
"ct1", f"{dbname}.ct1",
"ct4", f"{dbname}.ct4",
] ]
def sql_list(self): def sql_list(self):
...@@ -131,7 +130,8 @@ class TDTestCase: ...@@ -131,7 +130,8 @@ class TDTestCase:
__join_tblist = self.__join_tblist __join_tblist = self.__join_tblist
for join_tblist in __join_tblist: for join_tblist in __join_tblist:
for join_tb in join_tblist: for join_tb in join_tblist:
select_claus_list = self.__query_condition(join_tb) join_tb_name = join_tb.split(".")[-1]
select_claus_list = self.__query_condition(join_tb_name)
for select_claus in select_claus_list: for select_claus in select_claus_list:
group_claus = self.__group_condition( col=select_claus) group_claus = self.__group_condition( col=select_claus)
where_claus = self.__where_condition(query_conditon=select_claus) where_claus = self.__where_condition(query_conditon=select_claus)
...@@ -141,9 +141,10 @@ class TDTestCase: ...@@ -141,9 +141,10 @@ class TDTestCase:
self.__single_sql(select_claus, self.__join_condition(join_tblist, INNER=True), where_claus, having_claus), self.__single_sql(select_claus, self.__join_condition(join_tblist, INNER=True), where_claus, having_claus),
) )
) )
__no_join_tblist = self.__tb_liast __no_join_tblist = self.__tb_list
for tb in __no_join_tblist: for tb in __no_join_tblist:
select_claus_list = self.__query_condition(tb) tb_name = join_tb.split(".")[-1]
select_claus_list = self.__query_condition(tb_name)
for select_claus in select_claus_list: for select_claus in select_claus_list:
group_claus = self.__group_condition(col=select_claus) group_claus = self.__group_condition(col=select_claus)
where_claus = self.__where_condition(query_conditon=select_claus) where_claus = self.__where_condition(query_conditon=select_claus)
...@@ -230,31 +231,29 @@ class TDTestCase: ...@@ -230,31 +231,29 @@ class TDTestCase:
else: else:
tdSql.error(f"{sqls[i]} union {sqls[j+i]}") tdSql.error(f"{sqls[i]} union {sqls[j+i]}")
def __test_error(self): def __test_error(self, dbname="db"):
tdSql.error( "show tables union show tables" ) tdSql.error( f"show {dbname}.tables union show {dbname}.tables" )
tdSql.error( "create table errtb1 union all create table errtb2" ) tdSql.error( f"create table {dbname}.errtb1 union all create table {dbname}.errtb2" )
tdSql.error( "drop table ct1 union all drop table ct3" ) tdSql.error( f"drop table {dbname}.ct1 union all drop table {dbname}.ct3" )
tdSql.error( "select c1 from ct1 union all drop table ct3" ) tdSql.error( f"select c1 from {dbname}.ct1 union all drop table {dbname}.ct3" )
tdSql.error( "select c1 from ct1 union all '' " ) tdSql.error( f"select c1 from {dbname}.ct1 union all '' " )
tdSql.error( " '' union all select c1 from ct1 " ) tdSql.error( f" '' union all select c1 from{dbname}. ct1 " )
# tdSql.error( "select c1 from ct1 union select c1 from ct2 union select c1 from ct4 ")
def all_test(self): def all_test(self):
self.__test_error() self.__test_error()
self.union_check() self.union_check()
def __create_tb(self, dbname="db"):
def __create_tb(self):
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
create_stb_sql = f'''create table stb1( create_stb_sql = f'''create table {dbname}.stb1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
) tags (t1 int) ) tags (tag1 int)
''' '''
create_ntb_sql = f'''create table t1( create_ntb_sql = f'''create table {dbname}.t1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
...@@ -264,30 +263,29 @@ class TDTestCase: ...@@ -264,30 +263,29 @@ class TDTestCase:
tdSql.execute(create_ntb_sql) tdSql.execute(create_ntb_sql)
for i in range(4): for i in range(4):
tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )')
{ i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}
def __insert_data(self, rows): def __insert_data(self, rows, dbname="db"):
now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
for i in range(rows): for i in range(rows):
tdSql.execute( tdSql.execute(
f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f'''insert into ct1 values f'''insert into {dbname}.ct1 values
( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } ) ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } )
( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } )
''' '''
) )
tdSql.execute( tdSql.execute(
f'''insert into ct4 values f'''insert into {dbname}.ct4 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...@@ -303,7 +301,7 @@ class TDTestCase: ...@@ -303,7 +301,7 @@ class TDTestCase:
) )
tdSql.execute( tdSql.execute(
f'''insert into ct2 values f'''insert into {dbname}.ct2 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...@@ -319,13 +317,13 @@ class TDTestCase: ...@@ -319,13 +317,13 @@ class TDTestCase:
) )
for i in range(rows): for i in range(rows):
insert_data = f'''insert into t1 values insert_data = f'''insert into {dbname}.t1 values
( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2},
"binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } ) "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } )
''' '''
tdSql.execute(insert_data) tdSql.execute(insert_data)
tdSql.execute( tdSql.execute(
f'''insert into t1 values f'''insert into {dbname}.t1 values
( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
...@@ -341,7 +339,6 @@ class TDTestCase: ...@@ -341,7 +339,6 @@ class TDTestCase:
''' '''
) )
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
...@@ -355,8 +352,7 @@ class TDTestCase: ...@@ -355,8 +352,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step3:all check") tdLog.printNoPrefix("==========step3:all check")
self.all_test() self.all_test()
tdDnodes.stop(1) tdSql.execute("flush database db")
tdDnodes.start(1)
tdSql.execute("use db") tdSql.execute("use db")
......
此差异已折叠。
...@@ -95,16 +95,16 @@ class TDTestCase: ...@@ -95,16 +95,16 @@ class TDTestCase:
return sqls return sqls
def __test_current(self): def __test_current(self, dbname="db"):
tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tdLog.printNoPrefix("==========current sql condition check , must return query ok==========")
tbname = ["ct1", "ct2", "ct4", "t1", "stb1"] tbname = [f"{dbname}.ct1", f"{dbname}.ct2", f"{dbname}.ct4", f"{dbname}.t1", f"{dbname}.stb1"]
for tb in tbname: for tb in tbname:
self.__upper_current_check(tb) self.__upper_current_check(tb)
tdLog.printNoPrefix(f"==========current sql condition check in {tb} over==========") tdLog.printNoPrefix(f"==========current sql condition check in {tb} over==========")
def __test_error(self): def __test_error(self, dbname="db"):
tdLog.printNoPrefix("==========err sql condition check , must return error==========") tdLog.printNoPrefix("==========err sql condition check , must return error==========")
tbname = ["ct1", "ct2", "ct4", "t1", "stb1"] tbname = [f"{dbname}.ct1", f"{dbname}.ct2", f"{dbname}.ct4", f"{dbname}.t1", f"{dbname}.stb1"]
for tb in tbname: for tb in tbname:
for errsql in self.__upper_err_check(tb): for errsql in self.__upper_err_check(tb):
...@@ -112,22 +112,20 @@ class TDTestCase: ...@@ -112,22 +112,20 @@ class TDTestCase:
tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========")
def all_test(self): def all_test(self, dbname="db"):
self.__test_current() self.__test_current(dbname)
self.__test_error() self.__test_error(dbname)
def __create_tb(self, dbname="db"):
def __create_tb(self):
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
create_stb_sql = f'''create table stb1( create_stb_sql = f'''create table {dbname}.stb1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
) tags (t1 int) ) tags (tag1 int)
''' '''
create_ntb_sql = f'''create table t1( create_ntb_sql = f'''create table {dbname}.t1(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
...@@ -137,83 +135,82 @@ class TDTestCase: ...@@ -137,83 +135,82 @@ class TDTestCase:
tdSql.execute(create_ntb_sql) tdSql.execute(create_ntb_sql)
for i in range(4): for i in range(4):
tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )')
def __insert_data(self, rows): def __insert_data(self, rows, dbname="db"):
now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
for i in range(rows): for i in range(rows):
tdSql.execute( tdSql.execute(
f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar{i}', { now_time + 1 * i } )" f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
) )
tdSql.execute( tdSql.execute(
f'''insert into ct1 values f'''insert into {dbname}.ct1 values
( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', { now_time + 8 } ) ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } )
( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', { now_time + 9 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } )
''' '''
) )
tdSql.execute( tdSql.execute(
f'''insert into ct4 values f'''insert into {dbname}.ct4 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000+ 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( (
{ now_time + 5184000000}, {pow(2,31)-pow(2,15)}, {pow(2,63)-pow(2,30)}, 32767, 127, { now_time + 5184000000}, {pow(2,31)-pow(2,15)}, {pow(2,63)-pow(2,30)}, 32767, 127,
{ 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_limit-1", { now_time - 86400000} { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000}
) )
( (
{ now_time + 2592000000 }, {pow(2,31)-pow(2,16)}, {pow(2,63)-pow(2,31)}, 32766, 126, { now_time + 2592000000 }, {pow(2,31)-pow(2,16)}, {pow(2,63)-pow(2,31)}, 32766, 126,
{ 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_limit-2", { now_time - 172800000} { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000}
) )
''' '''
) )
tdSql.execute( tdSql.execute(
f'''insert into ct2 values f'''insert into {dbname}.ct2 values
( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3888000000+ 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( (
{ now_time + 5184000000 }, { -1 * pow(2,31) + pow(2,15) }, { -1 * pow(2,63) + pow(2,30) }, -32766, -126, { now_time + 5184000000 }, { -1 * pow(2,31) + pow(2,15) }, { -1 * pow(2,63) + pow(2,30) }, -32766, -126,
{ -1 * 3.2 * pow(10,38) }, { -1.2 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_limit-1", { now_time - 86400000 } { -1 * 3.2 * pow(10,38) }, { -1.2 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
) )
( (
{ now_time + 2592000000 }, { -1 * pow(2,31) + pow(2,16) }, { -1 * pow(2,63) + pow(2,31) }, -32767, -127, { now_time + 2592000000 }, { -1 * pow(2,31) + pow(2,16) }, { -1 * pow(2,63) + pow(2,31) }, -32767, -127,
{ - 3.3 * pow(10,38) }, { -1.3 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_limit-2", { now_time - 172800000 } { - 3.3 * pow(10,38) }, { -1.3 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
) )
''' '''
) )
for i in range(rows): for i in range(rows):
insert_data = f'''insert into t1 values insert_data = f'''insert into {dbname}.t1 values
( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2},
"binary_{i}", "nchar_{i}", { now_time - 1000 * i } ) "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } )
''' '''
tdSql.execute(insert_data) tdSql.execute(insert_data)
tdSql.execute( tdSql.execute(
f'''insert into t1 values f'''insert into {dbname}.t1 values
( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( { now_time + 7200000 }, { pow(2,31) - pow(2,15) }, { pow(2,63) - pow(2,30) }, 32767, 127, ( { now_time + 7200000 }, { pow(2,31) - pow(2,15) }, { pow(2,63) - pow(2,30) }, 32767, 127,
{ 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 },
"binary_limit-1", "nchar_limit-1", { now_time - 86400000 } "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
) )
( (
{ now_time + 3600000 } , { pow(2,31) - pow(2,16) }, { pow(2,63) - pow(2,31) }, 32766, 126, { now_time + 3600000 } , { pow(2,31) - pow(2,16) }, { pow(2,63) - pow(2,31) }, 32766, 126,
{ 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 },
"binary_limit-2", "nchar_limit-2", { now_time - 172800000 } "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
) )
''' '''
) )
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
...@@ -226,8 +223,7 @@ class TDTestCase: ...@@ -226,8 +223,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step3:all check") tdLog.printNoPrefix("==========step3:all check")
self.all_test() self.all_test()
tdDnodes.stop(1) tdSql.execute("flush database db")
tdDnodes.start(1)
tdSql.execute("use db") tdSql.execute("use db")
......
...@@ -14,43 +14,44 @@ class TDTestCase: ...@@ -14,43 +14,44 @@ class TDTestCase:
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
dbname = "db"
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
tdSql.execute( tdSql.execute(
'''create table stb1 f'''create table {dbname}.stb1
(ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 varchar(16),c9 nchar(32), c10 timestamp) (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 varchar(16),c9 nchar(32), c10 timestamp)
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' f'''
create table t1 create table {dbname}.t1
(ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 varchar(16),c9 nchar(32), c10 timestamp) (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 varchar(16),c9 nchar(32), c10 timestamp)
''' '''
) )
for i in range(4): for i in range(4):
tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )')
tdLog.printNoPrefix("==========step2:insert data") tdLog.printNoPrefix("==========step2:insert data")
for i in range(9): for i in range(9):
tdSql.execute( tdSql.execute(
f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'varchar{i}', 'nchar{i}', now()+{1*i}a )" f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'varchar{i}', 'nchar{i}', now()+{1*i}a )"
) )
tdSql.execute( tdSql.execute(
f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'varchar{i}', 'nchar{i}', now()+{1*i}a )" f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'varchar{i}', 'nchar{i}', now()+{1*i}a )"
) )
tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'varchar0', 'nchar0', now()+8a )") tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'varchar0', 'nchar0', now()+8a )")
tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'varchar9', 'nchar9', now()+9a )") tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'varchar9', 'nchar9', now()+9a )")
tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute( tdSql.execute(
f'''insert into t1 values f'''insert into {dbname}.t1 values
( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "varchar1", "nchar1", now()+1a ) ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "varchar1", "nchar1", now()+1a )
( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "varchar2", "nchar2", now()+2a ) ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "varchar2", "nchar2", now()+2a )
...@@ -70,7 +71,7 @@ class TDTestCase: ...@@ -70,7 +71,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step3: cast on varchar") tdLog.printNoPrefix("==========step3: cast on varchar")
tdSql.query("select c8 from ct1") tdSql.query(f"select c8 from {dbname}.ct1")
for i in range(tdSql.queryRows): for i in range(tdSql.queryRows):
tdSql.checkData(i,0, data_ct1_c8[i]) tdSql.checkData(i,0, data_ct1_c8[i])
......
...@@ -124,8 +124,14 @@ python3 ./test.py -f 2-query/leastsquares.py ...@@ -124,8 +124,14 @@ python3 ./test.py -f 2-query/leastsquares.py
python3 ./test.py -f 2-query/leastsquares.py -R python3 ./test.py -f 2-query/leastsquares.py -R
python3 ./test.py -f 2-query/length.py python3 ./test.py -f 2-query/length.py
python3 ./test.py -f 2-query/length.py -R python3 ./test.py -f 2-query/length.py -R
python3 ./test.py -f 2-query/log.py
# python3 ./test.py -f 2-query/log.py -R
python3 ./test.py -f 2-query/lower.py
python3 ./test.py -f 2-query/lower.py -R
python3 ./test.py -f 2-query/ltrim.py python3 ./test.py -f 2-query/ltrim.py
python3 ./test.py -f 2-query/ltrim.py -R python3 ./test.py -f 2-query/ltrim.py -R
python3 ./test.py -f 2-query/mavg.py
python3 ./test.py -f 2-query/mavg.py -R
python3 ./test.py -f 2-query/max_partition.py python3 ./test.py -f 2-query/max_partition.py
python3 ./test.py -f 2-query/max_partition.py -R python3 ./test.py -f 2-query/max_partition.py -R
python3 ./test.py -f 2-query/max.py python3 ./test.py -f 2-query/max.py
...@@ -147,7 +153,7 @@ python3 ./test.py -f 2-query/rtrim.py -R ...@@ -147,7 +153,7 @@ python3 ./test.py -f 2-query/rtrim.py -R
python3 ./test.py -f 2-query/sample.py python3 ./test.py -f 2-query/sample.py
python3 ./test.py -f 2-query/sample.py -R python3 ./test.py -f 2-query/sample.py -R
python3 ./test.py -f 2-query/sin.py python3 ./test.py -f 2-query/sin.py
# python3 ./test.py -f 2-query/sin.py -R python3 ./test.py -f 2-query/sin.py -R
python3 ./test.py -f 2-query/smaTest.py python3 ./test.py -f 2-query/smaTest.py
python3 ./test.py -f 2-query/smaTest.py -R python3 ./test.py -f 2-query/smaTest.py -R
python3 ./test.py -f 2-query/sml.py python3 ./test.py -f 2-query/sml.py
...@@ -155,7 +161,7 @@ python3 ./test.py -f 2-query/sml.py -R ...@@ -155,7 +161,7 @@ python3 ./test.py -f 2-query/sml.py -R
python3 ./test.py -f 2-query/spread.py python3 ./test.py -f 2-query/spread.py
python3 ./test.py -f 2-query/spread.py -R python3 ./test.py -f 2-query/spread.py -R
python3 ./test.py -f 2-query/sqrt.py python3 ./test.py -f 2-query/sqrt.py
# python3 ./test.py -f 2-query/sqrt.py -R python3 ./test.py -f 2-query/sqrt.py -R
python3 ./test.py -f 2-query/statecount.py python3 ./test.py -f 2-query/statecount.py
python3 ./test.py -f 2-query/statecount.py -R python3 ./test.py -f 2-query/statecount.py -R
python3 ./test.py -f 2-query/stateduration.py python3 ./test.py -f 2-query/stateduration.py
...@@ -167,32 +173,48 @@ python3 ./test.py -f 2-query/sum.py -R ...@@ -167,32 +173,48 @@ python3 ./test.py -f 2-query/sum.py -R
python3 ./test.py -f 2-query/tail.py python3 ./test.py -f 2-query/tail.py
python3 ./test.py -f 2-query/tail.py -R python3 ./test.py -f 2-query/tail.py -R
python3 ./test.py -f 2-query/tan.py python3 ./test.py -f 2-query/tan.py
python3 ./test.py -f 2-query/tan.py -R # python3 ./test.py -f 2-query/tan.py -R
python3 ./test.py -f 2-query/Timediff.py
python3 ./test.py -f 2-query/Timediff.py -R
python3 ./test.py -f 2-query/timetruncate.py
# python3 ./test.py -f 2-query/timetruncate.py -R
python3 ./test.py -f 2-query/timezone.py
python3 ./test.py -f 2-query/timezone.py -R
python3 ./test.py -f 2-query/To_iso8601.py
python3 ./test.py -f 2-query/To_iso8601.py -R
python3 ./test.py -f 2-query/To_unixtimestamp.py
python3 ./test.py -f 2-query/To_unixtimestamp.py -R
python3 ./test.py -f 2-query/Today.py
# python3 ./test.py -f 2-query/Today.py -R
python3 ./test.py -f 2-query/top.py
python3 ./test.py -f 2-query/top.py -R
python3 ./test.py -f 2-query/tsbsQuery.py
python3 ./test.py -f 2-query/tsbsQuery.py -R
python3 ./test.py -f 2-query/ttl_comment.py
python3 ./test.py -f 2-query/ttl_comment.py -R
python3 ./test.py -f 2-query/twa.py
python3 ./test.py -f 2-query/twa.py -R
python3 ./test.py -f 2-query/union.py
python3 ./test.py -f 2-query/union.py -R
python3 ./test.py -f 2-query/unique.py
python3 ./test.py -f 2-query/unique.py -R
python3 ./test.py -f 2-query/upper.py
python3 ./test.py -f 2-query/upper.py -R
python3 ./test.py -f 2-query/varchar.py
python3 ./test.py -f 2-query/varchar.py -R
python3 ./test.py -f 1-insert/update_data.py python3 ./test.py -f 1-insert/update_data.py
python3 ./test.py -f 1-insert/delete_data.py python3 ./test.py -f 1-insert/delete_data.py
python3 ./test.py -f 2-query/varchar.py
python3 ./test.py -f 2-query/upper.py
python3 ./test.py -f 2-query/lower.py
python3 ./test.py -f 2-query/join2.py python3 ./test.py -f 2-query/join2.py
python3 ./test.py -f 2-query/union.py
python3 ./test.py -f 2-query/union1.py python3 ./test.py -f 2-query/union1.py
python3 ./test.py -f 2-query/concat2.py python3 ./test.py -f 2-query/concat2.py
python3 ./test.py -f 2-query/timezone.py
python3 ./test.py -f 2-query/Today.py
python3 ./test.py -f 2-query/To_iso8601.py
python3 ./test.py -f 2-query/To_unixtimestamp.py
python3 ./test.py -f 2-query/timetruncate.py
python3 ./test.py -f 2-query/Timediff.py
python3 ./test.py -f 2-query/json_tag.py python3 ./test.py -f 2-query/json_tag.py
python3 ./test.py -f 2-query/top.py
python3 ./test.py -f 2-query/log.py
# python3 ./test.py -f 2-query/nestedQuery.py # python3 ./test.py -f 2-query/nestedQuery.py
# TD-15983 subquery output duplicate name column. # TD-15983 subquery output duplicate name column.
# Please Xiangyang Guo modify the following script # Please Xiangyang Guo modify the following script
...@@ -200,13 +222,8 @@ python3 ./test.py -f 2-query/log.py ...@@ -200,13 +222,8 @@ python3 ./test.py -f 2-query/log.py
python3 ./test.py -f 2-query/elapsed.py python3 ./test.py -f 2-query/elapsed.py
python3 ./test.py -f 2-query/csum.py python3 ./test.py -f 2-query/csum.py
python3 ./test.py -f 2-query/mavg.py
python3 ./test.py -f 2-query/function_diff.py python3 ./test.py -f 2-query/function_diff.py
python3 ./test.py -f 2-query/unique.py
python3 ./test.py -f 2-query/ttl_comment.py
python3 ./test.py -f 2-query/twa.py
python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 2-query/queryQnode.py
python3 ./test.py -f 2-query/tsbsQuery.py
python3 ./test.py -f 6-cluster/5dnode1mnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py
python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册