fix case
This commit is contained in:
parent
adc047c6c1
commit
36a7f2884c
|
@ -25,6 +25,7 @@ BOOLEAN_COL = [ BOOL_COL, ]
|
||||||
TS_TYPE_COL = [ TS_COL, ]
|
TS_TYPE_COL = [ TS_COL, ]
|
||||||
|
|
||||||
ALL_COL = [ INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BOOL_COL, BINARY_COL, NCHAR_COL, TS_COL ]
|
ALL_COL = [ INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BOOL_COL, BINARY_COL, NCHAR_COL, TS_COL ]
|
||||||
|
DBNAME = "db"
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ 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 = zwtable_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" {join} {tb_list[i+1]} on {table_reference}.{filter}={tb_list[i+1]}.{filter}"
|
||||||
|
@ -86,32 +87,33 @@ class TDTestCase:
|
||||||
return f"select hyperloglog({select_clause}) from {from_clause} {where_condition} {group_condition}"
|
return f"select hyperloglog({select_clause}) from {from_clause} {where_condition} {group_condition}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def __tb_list(self):
|
def __tb_list(self, dbname=DBNAME):
|
||||||
return [
|
return [
|
||||||
"ct1",
|
f"{dbname}.ct1",
|
||||||
"ct4",
|
f"{dbname}.ct4",
|
||||||
"t1",
|
f"{dbname}.t1",
|
||||||
"ct2",
|
f"{dbname}.ct2",
|
||||||
"stb1",
|
f"{dbname}.stb1",
|
||||||
]
|
]
|
||||||
|
|
||||||
def sql_list(self):
|
def sql_list(self):
|
||||||
sqls = []
|
sqls = []
|
||||||
__no_join_tblist = self.__tb_list
|
__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)
|
tbname = tb.split(".")[-1]
|
||||||
for select_claus in select_claus_list:
|
select_claus_list = self.__query_condition(tbname)
|
||||||
group_claus = self.__group_condition(col=select_claus)
|
for select_claus in select_claus_list:
|
||||||
where_claus = self.__where_condition(query_conditon=select_claus)
|
group_claus = self.__group_condition(col=select_claus)
|
||||||
having_claus = self.__group_condition(col=select_claus, having=f"{select_claus} is not null")
|
where_claus = self.__where_condition(query_conditon=select_claus)
|
||||||
sqls.extend(
|
having_claus = self.__group_condition(col=select_claus, having=f"{select_claus} is not null")
|
||||||
(
|
sqls.extend(
|
||||||
self.__single_sql(select_claus, tb, where_claus, having_claus),
|
(
|
||||||
self.__single_sql(select_claus, tb,),
|
self.__single_sql(select_claus, tb, where_claus, having_claus),
|
||||||
self.__single_sql(select_claus, tb, where_condition=where_claus),
|
self.__single_sql(select_claus, tb,),
|
||||||
self.__single_sql(select_claus, tb, group_condition=group_claus),
|
self.__single_sql(select_claus, tb, where_condition=where_claus),
|
||||||
)
|
self.__single_sql(select_claus, tb, group_condition=group_claus),
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# return filter(None, sqls)
|
# return filter(None, sqls)
|
||||||
return list(filter(None, sqls))
|
return list(filter(None, sqls))
|
||||||
|
@ -124,54 +126,54 @@ class TDTestCase:
|
||||||
tdLog.info(f"sql: {sqls[i]}")
|
tdLog.info(f"sql: {sqls[i]}")
|
||||||
tdSql.query(sqls[i])
|
tdSql.query(sqls[i])
|
||||||
|
|
||||||
def __test_current(self):
|
def __test_current(self, dbname=DBNAME):
|
||||||
tdSql.query("select hyperloglog(ts) from ct1")
|
tdSql.query(f"select hyperloglog(ts) from {dbname}.ct1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query("select hyperloglog(c1) from ct2")
|
tdSql.query(f"select hyperloglog(c1) from {dbname}.ct2")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query("select hyperloglog(c1) from ct4 group by c1")
|
tdSql.query(f"select hyperloglog(c1) from {dbname}.ct4 group by c1")
|
||||||
tdSql.checkRows(self.rows + 3)
|
tdSql.checkRows(self.rows + 3)
|
||||||
tdSql.query("select hyperloglog(c1) from ct4 group by c7")
|
tdSql.query(f"select hyperloglog(c1) from {dbname}.ct4 group by c7")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.query("select hyperloglog(ct2.c1) from ct4 join ct2 on ct4.ts=ct2.ts")
|
tdSql.query(f"select hyperloglog(ct2.c1) from {dbname}.ct4 ct4 join {dbname}.ct2 ct2 on ct4.ts=ct2.ts")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, self.rows + 2)
|
tdSql.checkData(0, 0, self.rows + 2)
|
||||||
tdSql.query("select hyperloglog(c1), c1 from stb1 group by c1")
|
tdSql.query(f"select hyperloglog(c1), c1 from {dbname}.stb1 group by c1")
|
||||||
for i in range(tdSql.queryRows):
|
for i in range(tdSql.queryRows):
|
||||||
tdSql.checkData(i, 0, 1) if tdSql.queryResult[i][1] is not None else tdSql.checkData(i, 0, 0)
|
tdSql.checkData(i, 0, 1) if tdSql.queryResult[i][1] is not None else tdSql.checkData(i, 0, 0)
|
||||||
|
|
||||||
self.hyperloglog_check()
|
self.hyperloglog_check()
|
||||||
|
|
||||||
def __test_error(self):
|
def __test_error(self, dbname=DBNAME):
|
||||||
|
|
||||||
tdLog.printNoPrefix("===step 0: err case, must return err")
|
tdLog.printNoPrefix("===step 0: err case, must return err")
|
||||||
tdSql.error( "select hyperloglog() from ct1" )
|
tdSql.error( f"select hyperloglog() from {dbname}.ct1" )
|
||||||
tdSql.error( "select hyperloglog(c1, c2) from ct2" )
|
tdSql.error( f"select hyperloglog(c1, c2) from {dbname}.ct2" )
|
||||||
# tdSql.error( "select hyperloglog(1) from stb1" )
|
# tdSql.error( f"select hyperloglog(1) from {dbname}.stb1" )
|
||||||
# tdSql.error( "select hyperloglog(abs(c1)) from ct4" )
|
# tdSql.error( f"select hyperloglog(abs(c1)) from {dbname}.ct4" )
|
||||||
tdSql.error( "select hyperloglog(count(c1)) from t1" )
|
tdSql.error( f"select hyperloglog(count(c1)) from {dbname}.t1" )
|
||||||
# tdSql.error( "select hyperloglog(1) from ct2" )
|
# tdSql.error( f"select hyperloglog(1) from {dbname}.ct2" )
|
||||||
tdSql.error( f"select hyperloglog({NUM_COL[0]}, {NUM_COL[1]}) from ct4" )
|
tdSql.error( f"select hyperloglog({NUM_COL[0]}, {NUM_COL[1]}) from {dbname}.ct4" )
|
||||||
tdSql.error( ''' select hyperloglog(['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'])
|
tdSql.error( f'''select hyperloglog(['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'])
|
||||||
from ct1
|
from {dbname}.ct1
|
||||||
where ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null
|
where ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null
|
||||||
group by ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10']
|
group by ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10']
|
||||||
having ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null ''' )
|
having ['c1 + c1', 'c1 + c2', 'c1 + c3', 'c1 + c4', 'c1 + c5', 'c1 + c6', 'c1 + c7', 'c1 + c8', 'c1 + c9', 'c1 + c10'] is not null''' )
|
||||||
|
|
||||||
def all_test(self):
|
def all_test(self):
|
||||||
self.__test_error()
|
self.__test_error()
|
||||||
self.__test_current()
|
self.__test_current()
|
||||||
|
|
||||||
def __create_tb(self):
|
def __create_tb(self, dbname=DBNAME):
|
||||||
|
|
||||||
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 (t1 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
|
||||||
|
@ -181,9 +183,9 @@ 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}
|
{ i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}
|
||||||
def __create_stable(self,stbname='stb',column_dict={'ts':'timestamp','col1': 'tinyint','col2': 'smallint','col3': 'int',
|
def __create_stable(self, dbname=DBNAME, stbname='stb',column_dict={'ts':'timestamp','col1': 'tinyint','col2': 'smallint','col3': 'int',
|
||||||
'col4': 'bigint','col5': 'tinyint unsigned','col6': 'smallint unsigned','col7': 'int unsigned',
|
'col4': 'bigint','col5': 'tinyint unsigned','col6': 'smallint unsigned','col7': 'int unsigned',
|
||||||
'col8': 'bigint unsigned','col9': 'float','col10': 'double','col11': 'bool','col12': 'binary(20)','col13': 'nchar(20)'},
|
'col8': 'bigint unsigned','col9': 'float','col10': 'double','col11': 'bool','col12': 'binary(20)','col13': 'nchar(20)'},
|
||||||
tag_dict={'ts_tag':'timestamp','t1': 'tinyint','t2': 'smallint','t3': 'int',
|
tag_dict={'ts_tag':'timestamp','t1': 'tinyint','t2': 'smallint','t3': 'int',
|
||||||
|
@ -195,11 +197,7 @@ class TDTestCase:
|
||||||
column_sql += f"{k} {v},"
|
column_sql += f"{k} {v},"
|
||||||
for k,v in tag_dict.items():
|
for k,v in tag_dict.items():
|
||||||
tag_sql += f"{k} {v},"
|
tag_sql += f"{k} {v},"
|
||||||
tdSql.execute(f'create table if not exists {stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})')
|
tdSql.execute(f'create table if not exists {dbname}.{stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})')
|
||||||
|
|
||||||
def __insert_data(self):
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __hyperloglog_check_distribute(self):
|
def __hyperloglog_check_distribute(self):
|
||||||
dbname = "dbtest"
|
dbname = "dbtest"
|
||||||
|
@ -231,10 +229,10 @@ class TDTestCase:
|
||||||
}
|
}
|
||||||
tdSql.execute(f"create database if not exists {dbname} vgroups {vgroups_num}")
|
tdSql.execute(f"create database if not exists {dbname} vgroups {vgroups_num}")
|
||||||
tdSql.execute(f'use {dbname}')
|
tdSql.execute(f'use {dbname}')
|
||||||
self.__create_stable(stbname,column_dict,tag_dict)
|
self.__create_stable(dbname, stbname,column_dict,tag_dict)
|
||||||
for i in range(childtable_num):
|
for i in range(childtable_num):
|
||||||
tdSql.execute(f"create table {stbname}_{i} using {stbname} tags('beijing')")
|
tdSql.execute(f"create table {dbname}.{stbname}_{i} using {dbname}.{stbname} tags('beijing')")
|
||||||
tdSql.query('show tables')
|
tdSql.query(f'show {dbname}.tables')
|
||||||
vgroup_list = []
|
vgroup_list = []
|
||||||
for i in range(len(tdSql.queryResult)):
|
for i in range(len(tdSql.queryResult)):
|
||||||
vgroup_list.append(tdSql.queryResult[i][6])
|
vgroup_list.append(tdSql.queryResult[i][6])
|
||||||
|
@ -245,39 +243,39 @@ class TDTestCase:
|
||||||
tdLog.info(f'This scene with {vgroups_num} vgroups is ok!')
|
tdLog.info(f'This scene with {vgroups_num} vgroups is ok!')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
tdLog.exit('This scene does not meet the requirements with {vgroups_num} vgroup!\n')
|
tdLog.exit(f'This scene does not meet the requirements with {vgroups_num} vgroup!\n')
|
||||||
for i in range(row_num):
|
for i in range(row_num):
|
||||||
tdSql.execute(f"insert into stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{binary_str}%d', '{nchar_str}%d')"
|
tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{binary_str}%d', '{nchar_str}%d')"
|
||||||
% (ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
|
% (ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
|
||||||
for k in column_dict.keys():
|
for k in column_dict.keys():
|
||||||
tdSql.query(f"select hyperloglog({k}) from {stbname}")
|
tdSql.query(f"select hyperloglog({k}) from {dbname}.{stbname}")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query(f"select hyperloglog({k}) from {stbname} group by {k}")
|
tdSql.query(f"select hyperloglog({k}) from {dbname}.{stbname} group by {k}")
|
||||||
|
|
||||||
tdSql.execute(f'drop database {dbname}')
|
tdSql.execute(f'drop database {dbname}')
|
||||||
|
|
||||||
|
|
||||||
def __insert_data(self, rows):
|
def __insert_data(self, rows, dbname=DBNAME):
|
||||||
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 )
|
||||||
|
@ -293,7 +291,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 )
|
||||||
|
@ -309,13 +307,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 )
|
||||||
|
@ -333,22 +331,19 @@ class TDTestCase:
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.prepare()
|
tdSql.prepare(dbname=DBNAME)
|
||||||
|
|
||||||
tdLog.printNoPrefix("==========step1:create table")
|
tdLog.printNoPrefix("==========step1:create table")
|
||||||
self.__create_tb()
|
self.__create_tb(dbname=DBNAME)
|
||||||
|
|
||||||
tdLog.printNoPrefix("==========step2:insert data")
|
tdLog.printNoPrefix("==========step2:insert data")
|
||||||
self.rows = 10
|
self.rows = 10
|
||||||
self.__insert_data(self.rows)
|
self.__insert_data(self.rows,dbname=DBNAME)
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -10,9 +10,6 @@ import random ,math
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
updatecfgDict = {'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(f"start to excute {__file__}")
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
@ -23,16 +20,16 @@ class TDTestCase:
|
||||||
self.time_step = 1000
|
self.time_step = 1000
|
||||||
|
|
||||||
def insert_datas_and_check_irate(self ,tbnums , rownums , time_step ):
|
def insert_datas_and_check_irate(self ,tbnums , rownums , time_step ):
|
||||||
|
dbname = "test"
|
||||||
tdLog.info(" prepare datas for auto check irate function ")
|
tdLog.info(" prepare datas for auto check irate function ")
|
||||||
|
|
||||||
tdSql.execute(" create database test ")
|
tdSql.execute(f" create database {dbname}")
|
||||||
tdSql.execute(" use test ")
|
tdSql.execute(f" use {dbname} ")
|
||||||
tdSql.execute(" create stable stb (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint,\
|
tdSql.execute(f" create stable {dbname}.stb (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 (t1 int)")
|
c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int)")
|
||||||
for tbnum in range(tbnums):
|
for tbnum in range(tbnums):
|
||||||
tbname = "sub_tb_%d"%tbnum
|
tbname = f"sub_tb_{tbnum}"
|
||||||
tdSql.execute(" create table %s using stb tags(%d) "%(tbname , tbnum))
|
tdSql.execute(f" create table {dbname}.{tbname} using {dbname}.stb tags({tbnum}) ")
|
||||||
|
|
||||||
ts = self.ts
|
ts = self.ts
|
||||||
for row in range(rownums):
|
for row in range(rownums):
|
||||||
|
@ -47,10 +44,10 @@ class TDTestCase:
|
||||||
c8 = "'binary_val'"
|
c8 = "'binary_val'"
|
||||||
c9 = "'nchar_val'"
|
c9 = "'nchar_val'"
|
||||||
c10 = ts
|
c10 = ts
|
||||||
tdSql.execute(f" insert into {tbname} values ({ts},{c1},{c2},{c3},{c4},{c5},{c6},{c7},{c8},{c9},{c10})")
|
tdSql.execute(f" insert into {dbname}.{tbname} values ({ts},{c1},{c2},{c3},{c4},{c5},{c6},{c7},{c8},{c9},{c10})")
|
||||||
|
|
||||||
tdSql.execute("use test")
|
tdSql.execute(f"use {dbname}")
|
||||||
tbnames = ["stb", "sub_tb_1"]
|
tbnames = [f"{dbname}.stb", f"{dbname}.sub_tb_1"]
|
||||||
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
|
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
|
||||||
for tbname in tbnames:
|
for tbname in tbnames:
|
||||||
tdSql.query("desc {}".format(tbname))
|
tdSql.query("desc {}".format(tbname))
|
||||||
|
@ -58,8 +55,8 @@ class TDTestCase:
|
||||||
for coltype in coltypes:
|
for coltype in coltypes:
|
||||||
colname = coltype[0]
|
colname = coltype[0]
|
||||||
if coltype[1] in support_types and coltype[-1] != "TAG" :
|
if coltype[1] in support_types and coltype[-1] != "TAG" :
|
||||||
irate_sql = "select irate({}) from {}".format(colname, tbname)
|
irate_sql = f"select irate({colname}) from {tbname}"
|
||||||
origin_sql = "select tail({}, 2), cast(ts as bigint) from {} order by ts".format(colname, tbname)
|
origin_sql = f"select tail({colname}, 2), cast(ts as bigint) from {tbname} order by ts"
|
||||||
|
|
||||||
tdSql.query(irate_sql)
|
tdSql.query(irate_sql)
|
||||||
irate_result = tdSql.queryResult
|
irate_result = tdSql.queryResult
|
||||||
|
@ -77,53 +74,53 @@ class TDTestCase:
|
||||||
else:
|
else:
|
||||||
tdLog.exit(" irate work not as expected , sql is %s "% irate_sql)
|
tdLog.exit(" irate work not as expected , sql is %s "% irate_sql)
|
||||||
|
|
||||||
def prepare_tag_datas(self):
|
def prepare_tag_datas(self, dbname="testdb"):
|
||||||
# prepare datas
|
# prepare datas
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"create database if not exists testdb keep 3650 duration 1000")
|
f"create database if not exists {dbname} keep 3650 duration 1000")
|
||||||
tdSql.execute(" use testdb ")
|
tdSql.execute(f"use {dbname} ")
|
||||||
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, tag1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32))
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
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 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)
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
tdSql.execute(
|
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}" )')
|
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}" )')
|
||||||
|
|
||||||
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}, 'binary{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}, 'binary{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}, 'binary{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}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
|
||||||
)
|
)
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )")
|
f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
|
f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )")
|
f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
|
f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
|
||||||
|
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
|
f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
|
f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
|
||||||
tdSql.execute(
|
tdSql.execute(
|
||||||
"insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
|
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, "binary1", "nchar1", now()+1a )
|
( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a )
|
||||||
( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
|
( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
|
||||||
|
@ -139,109 +136,101 @@ class TDTestCase:
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_errors(self):
|
def test_errors(self, dbname="testdb"):
|
||||||
tdSql.execute("use testdb")
|
|
||||||
error_sql_lists = [
|
error_sql_lists = [
|
||||||
"select irate from t1",
|
f"select irate from {dbname}.t1",
|
||||||
"select irate(-+--+c1) from t1",
|
f"select irate(-+--+c1) from {dbname}.t1",
|
||||||
# "select +-irate(c1) from t1",
|
# f"select +-irate(c1) from {dbname}.t1",
|
||||||
# "select ++-irate(c1) from t1",
|
# f"select ++-irate(c1) from {dbname}.t1",
|
||||||
# "select ++--irate(c1) from t1",
|
# f"select ++--irate(c1) from {dbname}.t1",
|
||||||
# "select - -irate(c1)*0 from t1",
|
# f"select - -irate(c1)*0 from {dbname}.t1",
|
||||||
# "select irate(tbname+1) from t1 ",
|
# f"select irate(tbname+1) from {dbname}.t1 ",
|
||||||
"select irate(123--123)==1 from t1",
|
f"select irate(123--123)==1 from {dbname}.t1",
|
||||||
"select irate(c1) as 'd1' from t1",
|
f"select irate(c1) as 'd1' from {dbname}.t1",
|
||||||
"select irate(c1 ,c2 ) from t1",
|
f"select irate(c1 ,c2 ) from {dbname}.t1",
|
||||||
"select irate(c1 ,NULL) from t1",
|
f"select irate(c1 ,NULL) from {dbname}.t1",
|
||||||
"select irate(,) from t1;",
|
f"select irate(,) from {dbname}.t1;",
|
||||||
"select irate(irate(c1) ab from t1)",
|
f"select irate(irate(c1) ab from {dbname}.t1)",
|
||||||
"select irate(c1) as int from t1",
|
f"select irate(c1) as int from {dbname}.t1",
|
||||||
"select irate from stb1",
|
f"select irate from {dbname}.stb1",
|
||||||
# "select irate(-+--+c1) from stb1",
|
# f"select irate(-+--+c1) from {dbname}.stb1",
|
||||||
# "select +-irate(c1) from stb1",
|
# f"select +-irate(c1) from {dbname}.stb1",
|
||||||
# "select ++-irate(c1) from stb1",
|
# f"select ++-irate(c1) from {dbname}.stb1",
|
||||||
# "select ++--irate(c1) from stb1",
|
# f"select ++--irate(c1) from {dbname}.stb1",
|
||||||
# "select - -irate(c1)*0 from stb1",
|
# f"select - -irate(c1)*0 from {dbname}.stb1",
|
||||||
# "select irate(tbname+1) from stb1 ",
|
# f"select irate(tbname+1) from {dbname}.stb1 ",
|
||||||
"select irate(123--123)==1 from stb1",
|
f"select irate(123--123)==1 from {dbname}.stb1",
|
||||||
"select irate(c1) as 'd1' from stb1",
|
f"select irate(c1) as 'd1' from {dbname}.stb1",
|
||||||
"select irate(c1 ,c2 ) from stb1",
|
f"select irate(c1 ,c2 ) from {dbname}.stb1",
|
||||||
"select irate(c1 ,NULL) from stb1",
|
f"select irate(c1 ,NULL) from {dbname}.stb1",
|
||||||
"select irate(,) from stb1;",
|
f"select irate(,) from {dbname}.stb1;",
|
||||||
"select irate(abs(c1) ab from stb1)",
|
f"select irate(abs(c1) ab from {dbname}.stb1)",
|
||||||
"select irate(c1) as int from stb1"
|
f"select irate(c1) as int from {dbname}.stb1"
|
||||||
]
|
]
|
||||||
for error_sql in error_sql_lists:
|
for error_sql in error_sql_lists:
|
||||||
tdSql.error(error_sql)
|
tdSql.error(error_sql)
|
||||||
|
|
||||||
def support_types(self):
|
def support_types(self, dbname="testdb"):
|
||||||
tdSql.execute("use testdb")
|
tbnames = [f"{dbname}.stb1", f"{dbname}.t1", f"{dbname}.ct1", f"{dbname}.ct2"]
|
||||||
tbnames = ["stb1", "t1", "ct1", "ct2"]
|
|
||||||
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
|
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
|
||||||
for tbname in tbnames:
|
for tbname in tbnames:
|
||||||
tdSql.query("desc {}".format(tbname))
|
tdSql.query("desc {}".format(tbname))
|
||||||
coltypes = tdSql.queryResult
|
coltypes = tdSql.queryResult
|
||||||
for coltype in coltypes:
|
for coltype in coltypes:
|
||||||
colname = coltype[0]
|
colname = coltype[0]
|
||||||
irate_sql = "select irate({}) from {}".format(colname, tbname)
|
irate_sql = f"select irate({colname}) from {tbname}"
|
||||||
if coltype[1] in support_types:
|
if coltype[1] in support_types:
|
||||||
tdSql.query(irate_sql)
|
tdSql.query(irate_sql)
|
||||||
else:
|
else:
|
||||||
tdSql.error(irate_sql)
|
tdSql.error(irate_sql)
|
||||||
|
|
||||||
def basic_irate_function(self):
|
def basic_irate_function(self, dbname="testdb"):
|
||||||
|
|
||||||
# used for empty table , ct3 is empty
|
# used for empty table , {dbname}.ct3 is empty
|
||||||
tdSql.query("select irate(c1) from ct3")
|
tdSql.query(f"select irate(c1) from {dbname}.ct3")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
tdSql.query("select irate(c2) from ct3")
|
tdSql.query(f"select irate(c2) from {dbname}.ct3")
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
# used for regular table
|
# used for regular table
|
||||||
tdSql.query("select irate(c1) from t1")
|
tdSql.query(f"select irate(c1) from {dbname}.t1")
|
||||||
tdSql.checkData(0, 0, 0.000000386)
|
tdSql.checkData(0, 0, 0.000000386)
|
||||||
|
|
||||||
# used for sub table
|
# used for sub table
|
||||||
tdSql.query("select irate(abs(c1+c2)) from ct1")
|
tdSql.query(f"select irate(abs(c1+c2)) from {dbname}.ct1")
|
||||||
tdSql.checkData(0, 0, 0.000000000)
|
tdSql.checkData(0, 0, 0.000000000)
|
||||||
|
|
||||||
|
|
||||||
# mix with common col
|
# mix with common col
|
||||||
tdSql.error("select c1, irate(c1) from ct1")
|
tdSql.error(f"select c1, irate(c1) from {dbname}.ct1")
|
||||||
|
|
||||||
# mix with common functions
|
# mix with common functions
|
||||||
tdSql.error("select irate(c1), abs(c1) from ct4 ")
|
tdSql.error(f"select irate(c1), abs(c1) from {dbname}.ct4 ")
|
||||||
|
|
||||||
# agg functions mix with agg functions
|
# agg functions mix with agg functions
|
||||||
tdSql.query("select irate(c1), count(c5) from stb1 partition by tbname order by tbname")
|
tdSql.query(f"select irate(c1), count(c5) from {dbname}.stb1 partition by tbname order by tbname")
|
||||||
tdSql.checkData(0, 0, 0.000000000)
|
tdSql.checkData(0, 0, 0.000000000)
|
||||||
tdSql.checkData(1, 0, 0.000000000)
|
tdSql.checkData(1, 0, 0.000000000)
|
||||||
tdSql.checkData(0, 1, 13)
|
tdSql.checkData(0, 1, 13)
|
||||||
tdSql.checkData(1, 1, 9)
|
tdSql.checkData(1, 1, 9)
|
||||||
|
|
||||||
|
|
||||||
def irate_func_filter(self):
|
def irate_func_filter(self, dbname="testdb"):
|
||||||
tdSql.execute("use testdb")
|
|
||||||
tdSql.query(
|
tdSql.query(
|
||||||
"select irate(c1+2)/2 from ct4 where c1>5 ")
|
f"select irate(c1+2)/2 from {dbname}.ct4 where c1>5 ")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0.000000514)
|
tdSql.checkData(0, 0, 0.000000514)
|
||||||
|
|
||||||
tdSql.query(
|
tdSql.query(
|
||||||
"select irate(c1+c2)/10 from ct4 where c1=5 ")
|
f"select irate(c1+c2)/10 from {dbname}.ct4 where c1=5 ")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0.000000000)
|
tdSql.checkData(0, 0, 0.000000000)
|
||||||
|
|
||||||
tdSql.query(
|
tdSql.query(
|
||||||
"select irate(c1+c2)/10 from stb1 where c1 = 5 partition by tbname ")
|
f"select irate(c1+c2)/10 from {dbname}.stb1 where c1 = 5 partition by tbname ")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
tdSql.checkData(0, 0, 0.000000000)
|
tdSql.checkData(0, 0, 0.000000000)
|
||||||
|
|
||||||
|
|
||||||
def irate_Arithmetic(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,12 @@ python3 ./test.py -f 2-query/function_stateduration.py
|
||||||
python3 ./test.py -f 2-query/function_stateduration.py -R
|
python3 ./test.py -f 2-query/function_stateduration.py -R
|
||||||
python3 ./test.py -f 2-query/histogram.py
|
python3 ./test.py -f 2-query/histogram.py
|
||||||
python3 ./test.py -f 2-query/histogram.py -R
|
python3 ./test.py -f 2-query/histogram.py -R
|
||||||
|
python3 ./test.py -f 2-query/hyperloglog.py
|
||||||
|
python3 ./test.py -f 2-query/hyperloglog.py -R
|
||||||
|
python3 ./test.py -f 2-query/irate.py
|
||||||
|
# python3 ./test.py -f 2-query/irate.py -R
|
||||||
|
python3 ./test.py -f 2-query/join.py
|
||||||
|
python3 ./test.py -f 2-query/join.py -R
|
||||||
|
|
||||||
python3 ./test.py -f 2-query/interp.py
|
python3 ./test.py -f 2-query/interp.py
|
||||||
python3 ./test.py -f 2-query/interp.py -R
|
python3 ./test.py -f 2-query/interp.py -R
|
||||||
|
@ -124,14 +130,12 @@ python3 ./test.py -f 2-query/rtrim.py
|
||||||
python3 ./test.py -f 2-query/length.py
|
python3 ./test.py -f 2-query/length.py
|
||||||
python3 ./test.py -f 2-query/upper.py
|
python3 ./test.py -f 2-query/upper.py
|
||||||
python3 ./test.py -f 2-query/lower.py
|
python3 ./test.py -f 2-query/lower.py
|
||||||
python3 ./test.py -f 2-query/join.py
|
|
||||||
python3 ./test.py -f 2-query/join2.py
|
python3 ./test.py -f 2-query/join2.py
|
||||||
python3 ./test.py -f 2-query/substr.py
|
python3 ./test.py -f 2-query/substr.py
|
||||||
python3 ./test.py -f 2-query/union.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/spread.py
|
python3 ./test.py -f 2-query/spread.py
|
||||||
python3 ./test.py -f 2-query/hyperloglog.py
|
|
||||||
python3 ./test.py -f 2-query/leastsquares.py
|
python3 ./test.py -f 2-query/leastsquares.py
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +176,6 @@ python3 ./test.py -f 2-query/statecount.py
|
||||||
python3 ./test.py -f 2-query/tail.py
|
python3 ./test.py -f 2-query/tail.py
|
||||||
python3 ./test.py -f 2-query/ttl_comment.py
|
python3 ./test.py -f 2-query/ttl_comment.py
|
||||||
python3 ./test.py -f 2-query/twa.py
|
python3 ./test.py -f 2-query/twa.py
|
||||||
python3 ./test.py -f 2-query/irate.py
|
|
||||||
python3 ./test.py -f 2-query/queryQnode.py
|
python3 ./test.py -f 2-query/queryQnode.py
|
||||||
python3 ./test.py -f 2-query/max_partition.py
|
python3 ./test.py -f 2-query/max_partition.py
|
||||||
python3 ./test.py -f 2-query/last_row.py
|
python3 ./test.py -f 2-query/last_row.py
|
||||||
|
|
Loading…
Reference in New Issue