fix test cases

This commit is contained in:
Ganlin Zhao 2022-11-15 14:37:10 +08:00
parent 2b53f7be84
commit 82baf3aa76
8 changed files with 3574 additions and 3573 deletions

View File

@ -24,7 +24,7 @@ from util.cases import *
from util.sql import * from util.sql import *
from util.dnodes import * from util.dnodes import *
msec_per_min=60 * 1000
class TDTestCase: class TDTestCase:
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
@ -54,7 +54,7 @@ class TDTestCase:
if tdSql.queryRows == 0: if tdSql.queryRows == 0:
tdSql.query(self.csum_query_form( tdSql.query(self.csum_query_form(
col=col, alias=alias, table_expr=table_expr, condition=condition col=col, alias=alias, table_expr=table_expr.replace("csum", "ts, csum"), condition=condition
)) ))
print(f"case in {line}: ", end='') print(f"case in {line}: ", end='')
tdSql.checkRows(0) tdSql.checkRows(0)
@ -132,7 +132,7 @@ class TDTestCase:
pre_result = np.array(pre_result, dtype = 'int64') pre_result = np.array(pre_result, dtype = 'int64')
pre_csum = np.cumsum(pre_result)[offset_val:] pre_csum = np.cumsum(pre_result)[offset_val:]
tdSql.query(self.csum_query_form( tdSql.query(self.csum_query_form(
col=col, alias=alias, table_expr=table_expr, condition=condition col=col, alias=alias, table_expr=table_expr.replace("csum", "ts,csum"), condition=condition
)) ))
for i in range(tdSql.queryRows): for i in range(tdSql.queryRows):
@ -163,7 +163,7 @@ class TDTestCase:
self.checkcsum(**case6) self.checkcsum(**case6)
# case7~8: nested query # case7~8: nested query
case7 = {"table_expr": "(select c1 from db.stb1 order by ts, tbname )"} case7 = {"table_expr": "(select ts,c1 from db.stb1 order by ts, tbname )"}
self.checkcsum(**case7) self.checkcsum(**case7)
case8 = {"table_expr": "(select csum(c1) c1 from db.t1)"} case8 = {"table_expr": "(select csum(c1) c1 from db.t1)"}
self.checkcsum(**case8) self.checkcsum(**case8)
@ -315,19 +315,19 @@ class TDTestCase:
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 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 + i * msec_per_min}, {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 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 + i * msec_per_min}, {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 tt{i} values ( {basetime-(j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)} )"
) )
pass pass
@ -366,26 +366,26 @@ 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 db.t{i}(ts) values ({nowtime - 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5 + i * msec_per_min})")
tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5 + i * msec_per_min})")
self.csum_current_query() self.csum_current_query()
self.csum_error_query() self.csum_error_query()
tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):") tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
self.csum_test_table(tbnum) self.csum_test_table(tbnum)
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") f"({nowtime - (per_table_rows + 1) * 10 + i * msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") f"({nowtime - (per_table_rows + 2) * 10 + i * msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
self.csum_current_query() self.csum_current_query()
self.csum_error_query() self.csum_error_query()
tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):") tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
self.csum_test_table(tbnum) self.csum_test_table(tbnum)
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") f"({nowtime - (per_table_rows + 1) * 10 + i * msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") f"({nowtime - (per_table_rows + 2) * 10 + i * msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
self.csum_current_query() self.csum_current_query()
self.csum_error_query() self.csum_error_query()
@ -398,9 +398,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 db.t{i}(ts) values ({nowtime})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + i * msec_per_min})")
tdSql.execute(f"insert into db.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 + i * msec_per_min})")
tdSql.execute(f"insert into db.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 + i * msec_per_min})")
self.csum_current_query() self.csum_current_query()
self.csum_error_query() self.csum_error_query()

View File

@ -24,7 +24,7 @@ from util.cases import *
from util.sql import * from util.sql import *
from util.dnodes import * from util.dnodes import *
msec_per_min=60*1000
class TDTestCase: class TDTestCase:
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
@ -312,19 +312,19 @@ class TDTestCase:
for j in range(data_row): for j in range(data_row):
tdSql.execute( tdSql.execute(
f"insert into db.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 + i* msec_per_min}, {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 db.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 + i* msec_per_min}, {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 db.tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" f"insert into db.tt{i} values ( {basetime-(j+1) * 10 + i* msec_per_min}, {random.randint(1, 200)} )"
) )
pass pass
@ -394,26 +394,26 @@ 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 db.t{i}(ts) values ({nowtime - 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5 + i* msec_per_min})")
tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5 + i* msec_per_min})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()
tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):") tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
self.diff_test_table(tbnum) self.diff_test_table(tbnum)
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") f"({nowtime - (per_table_rows + 1) * 10 + i* msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") f"({nowtime - (per_table_rows + 2) * 10 + i* msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()
tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):") tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
self.diff_test_table(tbnum) self.diff_test_table(tbnum)
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") f"({nowtime - (per_table_rows + 1) * 10 + i* msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") f"({nowtime - (per_table_rows + 2) * 10 + i* msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()
@ -426,9 +426,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 db.t{i}(ts) values ({nowtime})") tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + i* msec_per_min})")
tdSql.execute(f"insert into db.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 + i* msec_per_min})")
tdSql.execute(f"insert into db.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 + i* msec_per_min})")
self.diff_current_query() self.diff_current_query()
self.diff_error_query() self.diff_error_query()

View File

@ -34,7 +34,7 @@ class TDTestCase:
ts = self.ts ts = self.ts
for row in range(rownums): for row in range(rownums):
ts = self.ts + time_step*row ts = self.ts + (time_step) * row + tbnum * 60 * 1000
c1 = random.randint(0,1000) c1 = random.randint(0,1000)
c2 = random.randint(0,100000) c2 = random.randint(0,100000)
c3 = random.randint(0,125) c3 = random.randint(0,125)

View File

@ -26,6 +26,7 @@ from util.sql import *
from util.dnodes import * from util.dnodes import *
dbname = 'db' dbname = 'db'
msec_per_min = 60 * 1000
class TDTestCase: class TDTestCase:
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
@ -327,7 +328,7 @@ class TDTestCase:
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 ts, c1 from {dbname}.stb1)"}
self.checkmavg(**case7) self.checkmavg(**case7)
# case8 = {"table_expr": f"(select _c0, 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)
@ -568,19 +569,19 @@ class TDTestCase:
for j in range(data_row): for j in range(data_row):
tdSql.execute( tdSql.execute(
f"insert into {dbname}.t{i} values (" f"insert into {dbname}.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 + i * msec_per_min}, {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 {dbname}.t{i} values (" f"insert into {dbname}.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 + i * msec_per_min}, {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 {dbname}.tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" f"insert into {dbname}.tt{i} values ( {basetime-(j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)} )"
) )
pass pass
@ -619,8 +620,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 {dbname}.t{i}(ts) values ({nowtime - 5})") tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime - 5 + i * msec_per_min})")
tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + 5})") tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + 5 + i * msec_per_min})")
self.mavg_current_query() self.mavg_current_query()
self.mavg_error_query() self.mavg_error_query()
@ -651,9 +652,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 {dbname}.t{i}(ts) values ({nowtime})") tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + i * msec_per_min})")
tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime-(per_table_rows+3)*10})") tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime-(per_table_rows+3)*10 + i * msec_per_min})")
tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime+(per_table_rows+3)*10})") tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime+(per_table_rows+3)*10 + i * msec_per_min})")
self.mavg_current_query() self.mavg_current_query()
self.mavg_error_query() self.mavg_error_query()
@ -676,7 +677,7 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
def mavg_support_stable(self): def mavg_support_stable(self):
tdSql.query(f" select mavg(1,3) from {dbname}.stb1 ") tdSql.query(f"select mavg(1,3) from {dbname}.stb1 ")
tdSql.checkRows(68) tdSql.checkRows(68)
tdSql.checkData(0,0,1.000000000) tdSql.checkData(0,0,1.000000000)
tdSql.query(f"select mavg(c1,3) from {dbname}.stb1 partition by tbname ") tdSql.query(f"select mavg(c1,3) from {dbname}.stb1 partition by tbname ")

View File

@ -20,15 +20,15 @@ class TDTestCase:
for i in range(tb_nums): for i in range(tb_nums):
tbname = f"{dbname}.sub_{stb_name}_{i}" tbname = f"{dbname}.sub_{stb_name}_{i}"
ts = self.ts + i*10000 ts = self.ts + i*1000*120
tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )")
for row in range(row_nums): for row in range(row_nums):
ts = self.ts + row*1000 ts = ts + row*1000
tdSql.execute(f"insert into {tbname} values({ts} , {row} , {row} , {row} , {row} , 1 , 2 , 'true' , 'binary_{row}' , 'nchar_{row}' , {row} , {row} , 1 ,2 )") tdSql.execute(f"insert into {tbname} values({ts} , {row} , {row} , {row} , {row} , 1 , 2 , 'true' , 'binary_{row}' , 'nchar_{row}' , {row} , {row} , 1 ,2 )")
for null in range(5): for null in range(5):
ts = self.ts + row_nums*1000 + null*1000 ts = ts + row_nums*1000 + null*1000
tdSql.execute(f"insert into {tbname} values({ts} , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )") tdSql.execute(f"insert into {tbname} values({ts} , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )")
def basic_query(self, dbname="db"): def basic_query(self, dbname="db"):
@ -160,13 +160,13 @@ class TDTestCase:
tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname interval(10s) slimit 5 soffset 1 ") tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname interval(10s) slimit 5 soffset 1 ")
tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname interval(10s)") tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname interval(10s)")
tdSql.checkRows(self.row_nums*2) tdSql.checkRows(self.row_nums*10)
tdSql.query(f"select unique(c1) from {dbname}.stb partition by tbname order by tbname") tdSql.query(f"select unique(c1) from {dbname}.stb partition by tbname order by tbname")
tdSql.query(f"select tbname , count(c1) from {dbname}.sub_stb_1 partition by tbname interval(10s)") tdSql.query(f"select tbname , count(c1) from {dbname}.sub_stb_1 partition by tbname interval(10s)")
tdSql.checkData(0,0,'sub_stb_1') tdSql.checkData(0,0,'sub_stb_1')
tdSql.checkData(0,1,self.row_nums) tdSql.checkData(0,1, 4)
tdSql.query(f"select c1 , mavg(c1 ,2 ) from {dbname}.stb partition by c1") tdSql.query(f"select c1 , mavg(c1 ,2 ) from {dbname}.stb partition by c1")
tdSql.checkRows(90) tdSql.checkRows(90)
@ -193,7 +193,7 @@ class TDTestCase:
tdSql.query(f"select c1 , DERIVATIVE(c1,2,1) from {dbname}.stb partition by c1 order by c1") tdSql.query(f"select c1 , DERIVATIVE(c1,2,1) from {dbname}.stb partition by c1 order by c1")
tdSql.checkRows(90) tdSql.checkRows(90)
# bug need fix # bug need fix
tdSql.checkData(0,1,None) tdSql.checkData(0,1,0.0)
tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname order by tbname slimit 5 soffset 0 ") tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname order by tbname slimit 5 soffset 0 ")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,52 +17,52 @@ class TDTestCase(TDTestCase):
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
startTime = time.time()
self.function_before_26() startTime = time.time()
self.dropandcreateDB_random("%s" %self.db_nest, 1) self.function_before_26()
self.dropandcreateDB_random("%s" %self.db_nest, 1)
# self.math_nest(['UNIQUE']) # self.math_nest(['UNIQUE'])
# self.math_nest(['MODE']) # self.math_nest(['MODE'])
# self.math_nest(['SAMPLE']) # self.math_nest(['SAMPLE'])
# self.math_nest(['ABS','SQRT']) # self.math_nest(['ABS','SQRT'])
# self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
# self.math_nest(['POW','LOG']) # self.math_nest(['POW','LOG'])
# self.math_nest(['FLOOR','CEIL','ROUND']) # self.math_nest(['FLOOR','CEIL','ROUND'])
# self.math_nest(['MAVG']) # self.math_nest(['MAVG'])
# self.math_nest(['HYPERLOGLOG']) # self.math_nest(['HYPERLOGLOG'])
# self.math_nest(['TAIL']) # self.math_nest(['TAIL'])
# self.math_nest(['CSUM']) # self.math_nest(['CSUM'])
# self.math_nest(['statecount','stateduration']) # self.math_nest(['statecount','stateduration'])
# self.math_nest(['HISTOGRAM']) # self.math_nest(['HISTOGRAM'])
self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) self.str_nest(['LTRIM','RTRIM','LOWER','UPPER'])
self.str_nest(['LENGTH','CHAR_LENGTH']) self.str_nest(['LENGTH','CHAR_LENGTH'])
self.str_nest(['SUBSTR']) self.str_nest(['SUBSTR'])
self.str_nest(['CONCAT']) self.str_nest(['CONCAT'])
self.str_nest(['CONCAT_WS']) self.str_nest(['CONCAT_WS'])
self.time_nest(['CAST']) self.time_nest(['CAST'])
self.time_nest(['CAST_1']) self.time_nest(['CAST_1'])
self.time_nest(['CAST_2']) self.time_nest(['CAST_2'])
self.time_nest(['CAST_3']) self.time_nest(['CAST_3'])
self.time_nest(['CAST_4']) self.time_nest(['CAST_4'])
self.time_nest(['NOW','TODAY']) self.time_nest(['NOW','TODAY'])
self.time_nest(['TIMEZONE']) self.time_nest(['TIMEZONE'])
self.time_nest(['TIMETRUNCATE']) self.time_nest(['TIMETRUNCATE'])
self.time_nest(['TO_ISO8601']) self.time_nest(['TO_ISO8601'])
self.time_nest(['TO_UNIXTIMESTAMP']) self.time_nest(['TO_UNIXTIMESTAMP'])
self.time_nest(['ELAPSED']) self.time_nest(['ELAPSED'])
self.time_nest(['TIMEDIFF_1']) self.time_nest(['TIMEDIFF_1'])
self.time_nest(['TIMEDIFF_2']) self.time_nest(['TIMEDIFF_2'])
endTime = time.time() endTime = time.time()
print("total time %ds" % (endTime - startTime)) print("total time %ds" % (endTime - startTime))
def stop(self): def stop(self):
tdSql.close() tdSql.close()