提交 b17fa86e 编写于 作者: L Liu Jicong

Merge branch '3.0' into feature/stream

...@@ -13,11 +13,11 @@ class TDTestCase: ...@@ -13,11 +13,11 @@ class TDTestCase:
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
# name of normal table # name of normal table
self.ntbname = 'ntb' self.ntbname = 'ntb'
# name of stable # name of stable
self.stbname = 'stb' self.stbname = 'stb'
# structure of column # structure of column
self.column_dict = { self.column_dict = {
'ts':'timestamp', 'ts':'timestamp',
'c1':'int', 'c1':'int',
'c2':'float', 'c2':'float',
...@@ -25,13 +25,13 @@ class TDTestCase: ...@@ -25,13 +25,13 @@ class TDTestCase:
'c4':'nchar(20)' 'c4':'nchar(20)'
} }
# structure of tag # structure of tag
self.tag_dict = { self.tag_dict = {
't0':'int' 't0':'int'
} }
# number of child tables # number of child tables
self.tbnum = 2 self.tbnum = 2
# values of tag,the number of values should equal to tbnum # values of tag,the number of values should equal to tbnum
self.tag_values = [ self.tag_values = [
f'10', f'10',
f'100' f'100'
] ]
...@@ -42,7 +42,7 @@ class TDTestCase: ...@@ -42,7 +42,7 @@ class TDTestCase:
] ]
self.error_param = [1,'now()'] self.error_param = [1,'now()']
def run(self): # sourcery skip: extract-duplicate-method def run(self): # sourcery skip: extract-duplicate-method
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create tables==========") tdLog.printNoPrefix("==========step1:create tables==========")
...@@ -93,11 +93,11 @@ class TDTestCase: ...@@ -93,11 +93,11 @@ class TDTestCase:
tdSql.query("select ts from ntb where to_unixtimestamp('1970-01-01T08:00:00+08:00')=0") tdSql.query("select ts from ntb where to_unixtimestamp('1970-01-01T08:00:00+08:00')=0")
tdSql.checkRows(3) tdSql.checkRows(3)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
\ No newline at end of file
...@@ -9,14 +9,14 @@ from util.cases import * ...@@ -9,14 +9,14 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , 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, "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} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.PI =3.1415926 self.PI =3.1415926
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -24,7 +24,7 @@ class TDTestCase: ...@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -66,14 +66,14 @@ class TDTestCase: ...@@ -66,14 +66,14 @@ class TDTestCase:
( '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 )
''' '''
) )
def check_result_auto_acos(self ,origin_query , pow_query): def check_result_auto_acos(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 =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -93,7 +93,7 @@ class TDTestCase: ...@@ -93,7 +93,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -101,7 +101,7 @@ class TDTestCase: ...@@ -101,7 +101,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select acos from t1", "select acos from t1",
...@@ -135,42 +135,42 @@ class TDTestCase: ...@@ -135,42 +135,42 @@ class TDTestCase:
] ]
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):
type_error_sql_lists = [ type_error_sql_lists = [
"select acos(ts) from t1" , "select acos(ts) from t1" ,
"select acos(c7) from t1", "select acos(c7) from t1",
"select acos(c8) from t1", "select acos(c8) from t1",
"select acos(c9) from t1", "select acos(c9) from t1",
"select acos(ts) from ct1" , "select acos(ts) from ct1" ,
"select acos(c7) from ct1", "select acos(c7) from ct1",
"select acos(c8) from ct1", "select acos(c8) from ct1",
"select acos(c9) from ct1", "select acos(c9) from ct1",
"select acos(ts) from ct3" , "select acos(ts) from ct3" ,
"select acos(c7) from ct3", "select acos(c7) from ct3",
"select acos(c8) from ct3", "select acos(c8) from ct3",
"select acos(c9) from ct3", "select acos(c9) from ct3",
"select acos(ts) from ct4" , "select acos(ts) from ct4" ,
"select acos(c7) from ct4", "select acos(c7) from ct4",
"select acos(c8) from ct4", "select acos(c8) from ct4",
"select acos(c9) from ct4", "select acos(c9) from ct4",
"select acos(ts) from stb1" , "select acos(ts) from stb1" ,
"select acos(c7) from stb1", "select acos(c7) from stb1",
"select acos(c8) from stb1", "select acos(c8) from stb1",
"select acos(c9) from stb1" , "select acos(c9) from stb1" ,
"select acos(ts) from stbbb1" , "select acos(ts) from stbbb1" ,
"select acos(c7) from stbbb1", "select acos(c7) from stbbb1",
"select acos(ts) from tbname", "select acos(ts) from tbname",
"select acos(c9) from tbname" "select acos(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select acos(c1) from t1", "select acos(c1) from t1",
"select acos(c2) from t1", "select acos(c2) from t1",
...@@ -200,16 +200,16 @@ class TDTestCase: ...@@ -200,16 +200,16 @@ class TDTestCase:
"select acos(c5) from stb1", "select acos(c5) from stb1",
"select acos(c6) from stb1", "select acos(c6) from stb1",
"select acos(c6) as alisb from stb1", "select acos(c6) as alisb from stb1",
"select acos(c6) alisb from stb1", "select acos(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_acos_function(self): def basic_acos_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -250,7 +250,7 @@ class TDTestCase: ...@@ -250,7 +250,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from t1") self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,acos(c2) from ct1") tdSql.query("select c2 ,acos(c2) from ct1")
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -266,7 +266,7 @@ class TDTestCase: ...@@ -266,7 +266,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_acos( "select c1, c2, c3 , c4, c5 from ct1", "select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from ct1") self.check_result_auto_acos( "select c1, c2, c3 , c4, c5 from ct1", "select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from ct1")
# nest query for acos functions # nest query for acos functions
tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;") tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -284,21 +284,21 @@ class TDTestCase: ...@@ -284,21 +284,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , None) tdSql.checkData(11 , 2 , None)
tdSql.checkData(11 , 3 , None) tdSql.checkData(11 , 3 , None)
# used for stable table # used for stable table
tdSql.query("select acos(c1) from stb1") tdSql.query("select acos(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select acos(c1) from stbbb1") tdSql.error("select acos(c1) from stbbb1")
tdSql.error("select acos(c1) from tbname") tdSql.error("select acos(c1) from tbname")
tdSql.error("select acos(c1) from ct5") tdSql.error("select acos(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, acos(c1) from ct1") tdSql.query("select c1, acos(c1) from ct1")
tdSql.query("select c2, acos(c2) from ct4") tdSql.query("select c2, acos(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ") tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,None) tdSql.checkData(3 , 1 ,None)
tdSql.checkData(3 , 2 ,None) tdSql.checkData(3 , 2 ,None)
...@@ -327,8 +327,8 @@ class TDTestCase: ...@@ -327,8 +327,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ") tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -397,10 +397,10 @@ class TDTestCase: ...@@ -397,10 +397,10 @@ class TDTestCase:
tdSql.checkData(0,3,0.000000000) tdSql.checkData(0,3,0.000000000)
tdSql.checkData(0,4,-0.100000000) tdSql.checkData(0,4,-0.100000000)
tdSql.checkData(0,5,2) tdSql.checkData(0,5,2)
def pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -429,11 +429,11 @@ class TDTestCase: ...@@ -429,11 +429,11 @@ class TDTestCase:
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 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_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from sub1_bound") self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from sub1_bound")
self.check_result_auto_acos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from sub1_bound") self.check_result_auto_acos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from sub1_bound")
self.check_result_auto_acos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select acos(abs(c1)) from sub1_bound" ) self.check_result_auto_acos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select acos(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select acos(abs(c1)) ,acos(abs(c2)) , acos(abs(c3)) , acos(abs(c4)), acos(abs(c5)), acos(abs(c6)) from sub1_bound ") tdSql.query("select acos(abs(c1)) ,acos(abs(c2)) , acos(abs(c3)) , acos(abs(c4)), acos(abs(c5)), acos(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,None) tdSql.checkData(0,0,None)
...@@ -492,41 +492,41 @@ class TDTestCase: ...@@ -492,41 +492,41 @@ class TDTestCase:
self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) ,acos(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) ,acos(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) , acos(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) , acos(c5) from stb1 where c1 > 0 order by tbname" )
pass 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()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: acos basic query ============") tdLog.printNoPrefix("==========step4: acos basic query ============")
self.basic_acos_function() self.basic_acos_function()
tdLog.printNoPrefix("==========step5: big number acos query ============") tdLog.printNoPrefix("==========step5: big number acos query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: acos boundary query ============") tdLog.printNoPrefix("==========step6: acos boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: acos filter query ============") tdLog.printNoPrefix("==========step7: acos filter query ============")
self.abs_func_filter() self.abs_func_filter()
tdLog.printNoPrefix("==========step7: acos filter query ============") tdLog.printNoPrefix("==========step7: acos filter query ============")
self.abs_func_filter() self.abs_func_filter()
......
...@@ -9,14 +9,14 @@ from util.cases import * ...@@ -9,14 +9,14 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , 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, "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} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.PI =3.1415926 self.PI =3.1415926
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -24,7 +24,7 @@ class TDTestCase: ...@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -66,14 +66,14 @@ class TDTestCase: ...@@ -66,14 +66,14 @@ class TDTestCase:
( '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 )
''' '''
) )
def check_result_auto_asin(self ,origin_query , pow_query): def check_result_auto_asin(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 =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -93,7 +93,7 @@ class TDTestCase: ...@@ -93,7 +93,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -101,7 +101,7 @@ class TDTestCase: ...@@ -101,7 +101,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("asin value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("asin value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select asin from t1", "select asin from t1",
...@@ -135,42 +135,42 @@ class TDTestCase: ...@@ -135,42 +135,42 @@ class TDTestCase:
] ]
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):
type_error_sql_lists = [ type_error_sql_lists = [
"select asin(ts) from t1" , "select asin(ts) from t1" ,
"select asin(c7) from t1", "select asin(c7) from t1",
"select asin(c8) from t1", "select asin(c8) from t1",
"select asin(c9) from t1", "select asin(c9) from t1",
"select asin(ts) from ct1" , "select asin(ts) from ct1" ,
"select asin(c7) from ct1", "select asin(c7) from ct1",
"select asin(c8) from ct1", "select asin(c8) from ct1",
"select asin(c9) from ct1", "select asin(c9) from ct1",
"select asin(ts) from ct3" , "select asin(ts) from ct3" ,
"select asin(c7) from ct3", "select asin(c7) from ct3",
"select asin(c8) from ct3", "select asin(c8) from ct3",
"select asin(c9) from ct3", "select asin(c9) from ct3",
"select asin(ts) from ct4" , "select asin(ts) from ct4" ,
"select asin(c7) from ct4", "select asin(c7) from ct4",
"select asin(c8) from ct4", "select asin(c8) from ct4",
"select asin(c9) from ct4", "select asin(c9) from ct4",
"select asin(ts) from stb1" , "select asin(ts) from stb1" ,
"select asin(c7) from stb1", "select asin(c7) from stb1",
"select asin(c8) from stb1", "select asin(c8) from stb1",
"select asin(c9) from stb1" , "select asin(c9) from stb1" ,
"select asin(ts) from stbbb1" , "select asin(ts) from stbbb1" ,
"select asin(c7) from stbbb1", "select asin(c7) from stbbb1",
"select asin(ts) from tbname", "select asin(ts) from tbname",
"select asin(c9) from tbname" "select asin(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select asin(c1) from t1", "select asin(c1) from t1",
"select asin(c2) from t1", "select asin(c2) from t1",
...@@ -200,16 +200,16 @@ class TDTestCase: ...@@ -200,16 +200,16 @@ class TDTestCase:
"select asin(c5) from stb1", "select asin(c5) from stb1",
"select asin(c6) from stb1", "select asin(c6) from stb1",
"select asin(c6) as alisb from stb1", "select asin(c6) as alisb from stb1",
"select asin(c6) alisb from stb1", "select asin(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_asin_function(self): def basic_asin_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -250,7 +250,7 @@ class TDTestCase: ...@@ -250,7 +250,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from t1") self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,asin(c2) from ct1") tdSql.query("select c2 ,asin(c2) from ct1")
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -266,7 +266,7 @@ class TDTestCase: ...@@ -266,7 +266,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_asin( "select c1, c2, c3 , c4, c5 from ct1", "select asin(c1), asin(c2) ,asin(c3), asin(c4), asin(c5) from ct1") self.check_result_auto_asin( "select c1, c2, c3 , c4, c5 from ct1", "select asin(c1), asin(c2) ,asin(c3), asin(c4), asin(c5) from ct1")
# nest query for asin functions # nest query for asin functions
tdSql.query("select c4 , asin(c4) ,asin(asin(c4)) , asin(asin(asin(c4))) from ct1;") tdSql.query("select c4 , asin(c4) ,asin(asin(c4)) , asin(asin(asin(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -284,21 +284,21 @@ class TDTestCase: ...@@ -284,21 +284,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , None) tdSql.checkData(11 , 2 , None)
tdSql.checkData(11 , 3 , None) tdSql.checkData(11 , 3 , None)
# used for stable table # used for stable table
tdSql.query("select asin(c1) from stb1") tdSql.query("select asin(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select asin(c1) from stbbb1") tdSql.error("select asin(c1) from stbbb1")
tdSql.error("select asin(c1) from tbname") tdSql.error("select asin(c1) from tbname")
tdSql.error("select asin(c1) from ct5") tdSql.error("select asin(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, asin(c1) from ct1") tdSql.query("select c1, asin(c1) from ct1")
tdSql.query("select c2, asin(c2) from ct4") tdSql.query("select c2, asin(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, asin(c1),asin(c1), asin(asin(c1)) from ct4 ") tdSql.query("select c1, asin(c1),asin(c1), asin(asin(c1)) from ct4 ")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,None) tdSql.checkData(3 , 1 ,None)
tdSql.checkData(3 , 2 ,None) tdSql.checkData(3 , 2 ,None)
...@@ -327,8 +327,8 @@ class TDTestCase: ...@@ -327,8 +327,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, asin(c1) -0 ,asin(c1-4)-0 from ct4 ") tdSql.query("select c1, asin(c1) -0 ,asin(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -397,10 +397,10 @@ class TDTestCase: ...@@ -397,10 +397,10 @@ class TDTestCase:
tdSql.checkData(0,3,1.000000000) tdSql.checkData(0,3,1.000000000)
tdSql.checkData(0,4,0.900000000) tdSql.checkData(0,4,0.900000000)
tdSql.checkData(0,5,2) tdSql.checkData(0,5,2)
def pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -429,11 +429,11 @@ class TDTestCase: ...@@ -429,11 +429,11 @@ class TDTestCase:
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 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_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from sub1_bound") self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from sub1_bound")
self.check_result_auto_asin( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select asin(c1), asin(c2) ,asin(c3), asin(c3), asin(c2) ,asin(c1) from sub1_bound") self.check_result_auto_asin( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select asin(c1), asin(c2) ,asin(c3), asin(c3), asin(c2) ,asin(c1) from sub1_bound")
self.check_result_auto_asin("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select asin(abs(c1)) from sub1_bound" ) self.check_result_auto_asin("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select asin(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select asin(abs(c1)) ,asin(abs(c2)) , asin(abs(c3)) , asin(abs(c4)), asin(abs(c5)), asin(abs(c6)) from sub1_bound ") tdSql.query("select asin(abs(c1)) ,asin(abs(c2)) , asin(abs(c3)) , asin(abs(c4)), asin(abs(c5)), asin(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,None) tdSql.checkData(0,0,None)
...@@ -492,37 +492,37 @@ class TDTestCase: ...@@ -492,37 +492,37 @@ class TDTestCase:
self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) ,asin(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) ,asin(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) , asin(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) , asin(c5) from stb1 where c1 > 0 order by tbname" )
pass 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()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: asin basic query ============") tdLog.printNoPrefix("==========step4: asin basic query ============")
self.basic_asin_function() self.basic_asin_function()
tdLog.printNoPrefix("==========step5: big number asin query ============") tdLog.printNoPrefix("==========step5: big number asin query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: asin boundary query ============") tdLog.printNoPrefix("==========step6: asin boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: asin filter query ============") tdLog.printNoPrefix("==========step7: asin filter query ============")
self.abs_func_filter() self.abs_func_filter()
......
...@@ -9,13 +9,13 @@ from util.cases import * ...@@ -9,13 +9,13 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , 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, "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} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -23,7 +23,7 @@ class TDTestCase: ...@@ -23,7 +23,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -65,14 +65,14 @@ class TDTestCase: ...@@ -65,14 +65,14 @@ class TDTestCase:
( '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 )
''' '''
) )
def check_result_auto_atan(self ,origin_query , pow_query): def check_result_auto_atan(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 =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -90,7 +90,7 @@ class TDTestCase: ...@@ -90,7 +90,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -98,7 +98,7 @@ class TDTestCase: ...@@ -98,7 +98,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("atan value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("atan value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select atan from t1", "select atan from t1",
...@@ -132,42 +132,42 @@ class TDTestCase: ...@@ -132,42 +132,42 @@ class TDTestCase:
] ]
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):
type_error_sql_lists = [ type_error_sql_lists = [
"select atan(ts) from t1" , "select atan(ts) from t1" ,
"select atan(c7) from t1", "select atan(c7) from t1",
"select atan(c8) from t1", "select atan(c8) from t1",
"select atan(c9) from t1", "select atan(c9) from t1",
"select atan(ts) from ct1" , "select atan(ts) from ct1" ,
"select atan(c7) from ct1", "select atan(c7) from ct1",
"select atan(c8) from ct1", "select atan(c8) from ct1",
"select atan(c9) from ct1", "select atan(c9) from ct1",
"select atan(ts) from ct3" , "select atan(ts) from ct3" ,
"select atan(c7) from ct3", "select atan(c7) from ct3",
"select atan(c8) from ct3", "select atan(c8) from ct3",
"select atan(c9) from ct3", "select atan(c9) from ct3",
"select atan(ts) from ct4" , "select atan(ts) from ct4" ,
"select atan(c7) from ct4", "select atan(c7) from ct4",
"select atan(c8) from ct4", "select atan(c8) from ct4",
"select atan(c9) from ct4", "select atan(c9) from ct4",
"select atan(ts) from stb1" , "select atan(ts) from stb1" ,
"select atan(c7) from stb1", "select atan(c7) from stb1",
"select atan(c8) from stb1", "select atan(c8) from stb1",
"select atan(c9) from stb1" , "select atan(c9) from stb1" ,
"select atan(ts) from stbbb1" , "select atan(ts) from stbbb1" ,
"select atan(c7) from stbbb1", "select atan(c7) from stbbb1",
"select atan(ts) from tbname", "select atan(ts) from tbname",
"select atan(c9) from tbname" "select atan(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select atan(c1) from t1", "select atan(c1) from t1",
"select atan(c2) from t1", "select atan(c2) from t1",
...@@ -197,16 +197,16 @@ class TDTestCase: ...@@ -197,16 +197,16 @@ class TDTestCase:
"select atan(c5) from stb1", "select atan(c5) from stb1",
"select atan(c6) from stb1", "select atan(c6) from stb1",
"select atan(c6) as alisb from stb1", "select atan(c6) as alisb from stb1",
"select atan(c6) alisb from stb1", "select atan(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_atan_function(self): def basic_atan_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -247,7 +247,7 @@ class TDTestCase: ...@@ -247,7 +247,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from t1") self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,atan(c2) from ct1") tdSql.query("select c2 ,atan(c2) from ct1")
tdSql.checkData(0, 1, 1.570785077) tdSql.checkData(0, 1, 1.570785077)
...@@ -263,7 +263,7 @@ class TDTestCase: ...@@ -263,7 +263,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_atan( "select c1, c2, c3 , c4, c5 from ct1", "select atan(c1), atan(c2) ,atan(c3), atan(c4), atan(c5) from ct1") self.check_result_auto_atan( "select c1, c2, c3 , c4, c5 from ct1", "select atan(c1), atan(c2) ,atan(c3), atan(c4), atan(c5) from ct1")
# nest query for atan functions # nest query for atan functions
tdSql.query("select c4 , atan(c4) ,atan(atan(c4)) , atan(atan(atan(c4))) from ct1;") tdSql.query("select c4 , atan(c4) ,atan(atan(c4)) , atan(atan(atan(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -281,21 +281,21 @@ class TDTestCase: ...@@ -281,21 +281,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , -1.000958403) tdSql.checkData(11 , 2 , -1.000958403)
tdSql.checkData(11 , 3 , -0.785877135) tdSql.checkData(11 , 3 , -0.785877135)
# used for stable table # used for stable table
tdSql.query("select atan(c1) from stb1") tdSql.query("select atan(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select atan(c1) from stbbb1") tdSql.error("select atan(c1) from stbbb1")
tdSql.error("select atan(c1) from tbname") tdSql.error("select atan(c1) from tbname")
tdSql.error("select atan(c1) from ct5") tdSql.error("select atan(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, atan(c1) from ct1") tdSql.query("select c1, atan(c1) from ct1")
tdSql.query("select c2, atan(c2) from ct4") tdSql.query("select c2, atan(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, atan(c1),atan(c1), atan(atan(c1)) from ct4 ") tdSql.query("select c1, atan(c1),atan(c1), atan(atan(c1)) from ct4 ")
...@@ -303,7 +303,7 @@ class TDTestCase: ...@@ -303,7 +303,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,1.405647649) tdSql.checkData(3 , 1 ,1.405647649)
tdSql.checkData(3 , 2 ,1.405647649) tdSql.checkData(3 , 2 ,1.405647649)
...@@ -324,8 +324,8 @@ class TDTestCase: ...@@ -324,8 +324,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, atan(c1) -0 ,atan(c1-4)-0 from ct4 ") tdSql.query("select c1, atan(c1) -0 ,atan(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -394,10 +394,10 @@ class TDTestCase: ...@@ -394,10 +394,10 @@ class TDTestCase:
tdSql.checkData(0,3,0.000000000) tdSql.checkData(0,3,0.000000000)
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 pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -426,11 +426,11 @@ class TDTestCase: ...@@ -426,11 +426,11 @@ class TDTestCase:
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 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_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from sub1_bound") self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from sub1_bound")
self.check_result_auto_atan( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select atan(c1), atan(c2) ,atan(c3), atan(c3), atan(c2) ,atan(c1) from sub1_bound") self.check_result_auto_atan( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select atan(c1), atan(c2) ,atan(c3), atan(c3), atan(c2) ,atan(c1) from sub1_bound")
self.check_result_auto_atan("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select atan(abs(c1)) from sub1_bound" ) self.check_result_auto_atan("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select atan(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select atan(abs(c1)) ,atan(abs(c2)) , atan(abs(c3)) , atan(abs(c4)), atan(abs(c5)), atan(abs(c6)) from sub1_bound ") tdSql.query("select atan(abs(c1)) ,atan(abs(c2)) , atan(abs(c3)) , atan(abs(c4)), atan(abs(c5)), atan(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,math.atan(2147483647)) tdSql.checkData(0,0,math.atan(2147483647))
...@@ -490,36 +490,36 @@ class TDTestCase: ...@@ -490,36 +490,36 @@ class TDTestCase:
self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) ,atan(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) ,atan(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) , atan(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) , atan(c5) from stb1 where c1 > 0 order by tbname" )
pass 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()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: atan basic query ============") tdLog.printNoPrefix("==========step4: atan basic query ============")
self.basic_atan_function() self.basic_atan_function()
tdLog.printNoPrefix("==========step5: big number atan query ============") tdLog.printNoPrefix("==========step5: big number atan query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: atan boundary query ============") tdLog.printNoPrefix("==========step6: atan boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: atan filter query ============") tdLog.printNoPrefix("==========step7: atan filter query ============")
self.abs_func_filter() self.abs_func_filter()
...@@ -527,7 +527,7 @@ class TDTestCase: ...@@ -527,7 +527,7 @@ class TDTestCase:
self.support_super_table_test() self.support_super_table_test()
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -50,7 +50,7 @@ class TDTestCase: ...@@ -50,7 +50,7 @@ class TDTestCase:
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(1, 0, None) tdSql.checkData(1, 0, None)
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table stb_1 using stb tags('beijing')") tdSql.execute("create table stb_1 using stb tags('beijing')")
tdSql.execute( tdSql.execute(
...@@ -115,7 +115,7 @@ class TDTestCase: ...@@ -115,7 +115,7 @@ class TDTestCase:
tdSql.query("select diff(col6) from stb_1") tdSql.query("select diff(col6) from stb_1")
tdSql.checkRows(10) tdSql.checkRows(10)
tdSql.execute('''create table stb1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, tdSql.execute('''create table stb1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table stb1_1 using stb tags('shanghai')") tdSql.execute("create table stb1_1 using stb tags('shanghai')")
......
...@@ -894,7 +894,7 @@ class TDTestCase: ...@@ -894,7 +894,7 @@ class TDTestCase:
tdSql.query(sql_common) tdSql.query(sql_common)
results= query_datas[0] results= query_datas[0]
if operator == "+": if operator == "+":
for data in query_datas[1:]: for data in query_datas[1:]:
results += data results += data
tdSql.checkData(0,0,results) tdSql.checkData(0,0,results)
......
...@@ -45,7 +45,7 @@ class TDTestCase: ...@@ -45,7 +45,7 @@ class TDTestCase:
case1: limit offset base function test case1: limit offset base function test
case2: offset return valid case2: offset return valid
''' '''
return return
def getBuildPath(self): def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
...@@ -71,7 +71,7 @@ class TDTestCase: ...@@ -71,7 +71,7 @@ class TDTestCase:
# self.create_tables(); # self.create_tables();
self.ts = 1500000000000 self.ts = 1500000000000
# stop # stop
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
...@@ -82,7 +82,7 @@ class TDTestCase: ...@@ -82,7 +82,7 @@ class TDTestCase:
def newcur(self,host,cfg): def newcur(self,host,cfg):
user = "root" user = "root"
password = "taosdata" password = "taosdata"
port =6030 port =6030
con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port)
cur=con.cursor() cur=con.cursor()
print(cur) print(cur)
...@@ -92,7 +92,7 @@ class TDTestCase: ...@@ -92,7 +92,7 @@ class TDTestCase:
def create_tables(self,host,dbname,stbname,count): def create_tables(self,host,dbname,stbname,count):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tsql.execute("use %s" %dbname) tsql.execute("use %s" %dbname)
...@@ -111,7 +111,7 @@ class TDTestCase: ...@@ -111,7 +111,7 @@ class TDTestCase:
tsql.execute(sql) tsql.execute(sql)
sql = pre_create sql = pre_create
# print(time.time()) # print(time.time())
# end sql # end sql
if sql != pre_create: if sql != pre_create:
# print(sql) # print(sql)
tsql.execute(sql) tsql.execute(sql)
...@@ -124,7 +124,7 @@ class TDTestCase: ...@@ -124,7 +124,7 @@ class TDTestCase:
def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount): def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tdLog.debug("create database %s"%dbname) tdLog.debug("create database %s"%dbname)
tsql.execute("drop database if exists %s"%dbname) tsql.execute("drop database if exists %s"%dbname)
...@@ -134,7 +134,7 @@ class TDTestCase: ...@@ -134,7 +134,7 @@ class TDTestCase:
threads = [] threads = []
for i in range(threadNumbers): for i in range(threadNumbers):
tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i))
threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,))) threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -144,7 +144,7 @@ class TDTestCase: ...@@ -144,7 +144,7 @@ class TDTestCase:
spendTime=end_time-start_time spendTime=end_time-start_time
speedCreate=threadNumbers*count/spendTime speedCreate=threadNumbers*count/spendTime
tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate)) tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate))
return return
# def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop): # def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop):
...@@ -171,7 +171,7 @@ class TDTestCase: ...@@ -171,7 +171,7 @@ class TDTestCase:
# print(sql) # print(sql)
tsql.execute(sql) tsql.execute(sql)
sql = "insert into %s_%d values " %(stbname,i) sql = "insert into %s_%d values " %(stbname,i)
# end sql # end sql
if sql != pre_insert: if sql != pre_insert:
# print(sql) # print(sql)
print(len(sql)) print(len(sql))
...@@ -186,7 +186,7 @@ class TDTestCase: ...@@ -186,7 +186,7 @@ class TDTestCase:
def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount): def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tdLog.debug("ready to inser data") tdLog.debug("ready to inser data")
...@@ -195,7 +195,7 @@ class TDTestCase: ...@@ -195,7 +195,7 @@ class TDTestCase:
threads = [] threads = []
for i in range(threadNumbers): for i in range(threadNumbers):
# tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) # tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i))
threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,))) threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -226,10 +226,10 @@ class TDTestCase: ...@@ -226,10 +226,10 @@ class TDTestCase:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found in %s" % buildPath)
taosBenchbin = buildPath+ "/build/bin/taosBenchmark" taosBenchbin = buildPath+ "/build/bin/taosBenchmark"
os.system("%s -f %s -y " %(taosBenchbin,jsonFile)) os.system("%s -f %s -y " %(taosBenchbin,jsonFile))
return return
def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count): def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count):
# count=50000 # count=50000
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
...@@ -243,7 +243,7 @@ class TDTestCase: ...@@ -243,7 +243,7 @@ class TDTestCase:
# tsql.getResult("show databases") # tsql.getResult("show databases")
# print(tdSql.queryResult) # print(tdSql.queryResult)
tsql.execute("use %s" %dbname) tsql.execute("use %s" %dbname)
threads = [] threads = []
for i in range(processNumbers): for i in range(processNumbers):
jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i) jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i)
...@@ -254,7 +254,7 @@ class TDTestCase: ...@@ -254,7 +254,7 @@ class TDTestCase:
os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile)) os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile))
os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile)) os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile))
os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile)) os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile))
threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,))) threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -276,8 +276,8 @@ class TDTestCase: ...@@ -276,8 +276,8 @@ class TDTestCase:
for i in range(stableCount): for i in range(stableCount):
tdSql.query("select count(*) from %s%d"%(stbname,i)) tdSql.query("select count(*) from %s%d"%(stbname,i))
tdSql.checkData(0,0,rowsPerSTable) tdSql.checkData(0,0,rowsPerSTable)
return return
# test case : Switch back and forth among the three queryPolicy(1\2\3) # test case : Switch back and forth among the three queryPolicy(1\2\3)
def test_case1(self): def test_case1(self):
self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10)
...@@ -303,7 +303,7 @@ class TDTestCase: ...@@ -303,7 +303,7 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.query("select max(c1) from stb10;") tdSql.query("select max(c1) from stb10;")
tdSql.checkData(0, 0, "%s"%maxQnode) tdSql.checkData(0, 0, "%s"%maxQnode)
tdSql.query("select min(c1) from stb11;") tdSql.query("select min(c1) from stb11;")
tdSql.checkData(0, 0, "%s"%minQnode) tdSql.checkData(0, 0, "%s"%minQnode)
tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
unionVnode=tdSql.queryResult unionVnode=tdSql.queryResult
...@@ -352,8 +352,8 @@ class TDTestCase: ...@@ -352,8 +352,8 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.query("select max(c1) from stb10;") tdSql.query("select max(c1) from stb10;")
assert maxQnode==tdSql.getData(0,0) assert maxQnode==tdSql.getData(0,0)
tdSql.query("select min(c1) from stb11;") tdSql.query("select min(c1) from stb11;")
assert minQnode==tdSql.getData(0,0) assert minQnode==tdSql.getData(0,0)
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
...@@ -417,7 +417,7 @@ class TDTestCase: ...@@ -417,7 +417,7 @@ class TDTestCase:
tdLog.exit("alter queryPolicy to %d failed"%queryPolicy) tdLog.exit("alter queryPolicy to %d failed"%queryPolicy)
tdSql.execute("use db1;") tdSql.execute("use db1;")
tdSql.error("select max(c1) from stb10;") tdSql.error("select max(c1) from stb10;")
tdSql.error("select min(c1) from stb11;") tdSql.error("select min(c1) from stb11;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
...@@ -452,20 +452,20 @@ class TDTestCase: ...@@ -452,20 +452,20 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.error("select max(c1) from stb10;") tdSql.error("select max(c1) from stb10;")
tdSql.error("select min(c1) from stb11;") tdSql.error("select min(c1) from stb11;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
# run case # run case
def run(self): def run(self):
# test qnode # test qnode
tdLog.debug(" test_case1 ............ [start]") tdLog.debug(" test_case1 ............ [start]")
self.test_case1() self.test_case1()
tdLog.debug(" test_case1 ............ [OK]") tdLog.debug(" test_case1 ............ [OK]")
tdLog.debug(" test_case2 ............ [start]") tdLog.debug(" test_case2 ............ [start]")
self.test_case2() self.test_case2()
tdLog.debug(" test_case2 ............ [OK]") tdLog.debug(" test_case2 ............ [OK]")
tdLog.debug(" test_case3 ............ [start]") tdLog.debug(" test_case3 ............ [start]")
self.test_case3() self.test_case3()
tdLog.debug(" test_case3 ............ [OK]") tdLog.debug(" test_case3 ............ [OK]")
...@@ -475,7 +475,7 @@ class TDTestCase: ...@@ -475,7 +475,7 @@ class TDTestCase:
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
return return
# #
# add case with filename # add case with filename
# #
......
...@@ -11,14 +11,14 @@ from util.sql import * ...@@ -11,14 +11,14 @@ from util.sql import *
from util.cases import * from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , 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, "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} "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__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -26,7 +26,7 @@ class TDTestCase: ...@@ -26,7 +26,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -68,7 +68,7 @@ class TDTestCase: ...@@ -68,7 +68,7 @@ class TDTestCase:
( '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 )
''' '''
) )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select unique from t1", "select unique from t1",
...@@ -119,40 +119,40 @@ class TDTestCase: ...@@ -119,40 +119,40 @@ class TDTestCase:
"select unique(c1) , diff(c1) from stb1 partition by tbname", "select unique(c1) , diff(c1) from stb1 partition by tbname",
#"select unique(c1) , abs(c1) from stb1 partition by tbname", # support #"select unique(c1) , abs(c1) from stb1 partition by tbname", # support
#"select unique(c1) , c1 from stb1 partition by tbname" # support #"select unique(c1) , c1 from stb1 partition by tbname" # support
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
pass pass
def support_types(self): def support_types(self):
other_no_value_types = [ other_no_value_types = [
"select unique(ts) from t1" , "select unique(ts) from t1" ,
"select unique(c7) from t1", "select unique(c7) from t1",
"select unique(c8) from t1", "select unique(c8) from t1",
"select unique(c9) from t1", "select unique(c9) from t1",
"select unique(ts) from ct1" , "select unique(ts) from ct1" ,
"select unique(c7) from ct1", "select unique(c7) from ct1",
"select unique(c8) from ct1", "select unique(c8) from ct1",
"select unique(c9) from ct1", "select unique(c9) from ct1",
"select unique(ts) from ct3" , "select unique(ts) from ct3" ,
"select unique(c7) from ct3", "select unique(c7) from ct3",
"select unique(c8) from ct3", "select unique(c8) from ct3",
"select unique(c9) from ct3", "select unique(c9) from ct3",
"select unique(ts) from ct4" , "select unique(ts) from ct4" ,
"select unique(c7) from ct4", "select unique(c7) from ct4",
"select unique(c8) from ct4", "select unique(c8) from ct4",
"select unique(c9) from ct4", "select unique(c9) from ct4",
"select unique(ts) from stb1 partition by tbname" , "select unique(ts) from stb1 partition by tbname" ,
"select unique(c7) from stb1 partition by tbname", "select unique(c7) from stb1 partition by tbname",
"select unique(c8) from stb1 partition by tbname", "select unique(c8) from stb1 partition by tbname",
"select unique(c9) from stb1 partition by tbname" "select unique(c9) from stb1 partition by tbname"
] ]
for type_sql in other_no_value_types: for type_sql in other_no_value_types:
tdSql.query(type_sql) tdSql.query(type_sql)
tdLog.info("support type ok , sql is : %s"%type_sql) tdLog.info("support type ok , sql is : %s"%type_sql)
type_sql_lists = [ type_sql_lists = [
"select unique(c1) from t1", "select unique(c1) from t1",
"select unique(c2) from t1", "select unique(c2) from t1",
...@@ -182,8 +182,8 @@ class TDTestCase: ...@@ -182,8 +182,8 @@ class TDTestCase:
"select unique(c5) from stb1 partition by tbname", "select unique(c5) from stb1 partition by tbname",
"select unique(c6) from stb1 partition by tbname", "select unique(c6) from stb1 partition by tbname",
"select unique(c6) as alisb from stb1 partition by tbname", "select unique(c6) as alisb from stb1 partition by tbname",
"select unique(c6) alisb from stb1 partition by tbname", "select unique(c6) alisb from stb1 partition by tbname",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
...@@ -194,18 +194,18 @@ class TDTestCase: ...@@ -194,18 +194,18 @@ class TDTestCase:
origin_sql = unique_sql.replace("unique(","").replace(")","") origin_sql = unique_sql.replace("unique(","").replace(")","")
tdSql.query(unique_sql) tdSql.query(unique_sql)
unique_result = tdSql.queryResult unique_result = tdSql.queryResult
unique_datas = [] unique_datas = []
for elem in unique_result: for elem in unique_result:
unique_datas.append(elem[0]) unique_datas.append(elem[0])
unique_datas.sort(key=lambda x: (x is None, x)) unique_datas.sort(key=lambda x: (x is None, x))
tdSql.query(origin_sql) tdSql.query(origin_sql)
origin_result = tdSql.queryResult origin_result = tdSql.queryResult
origin_datas = [] origin_datas = []
for elem in origin_result: for elem in origin_result:
origin_datas.append(elem[0]) origin_datas.append(elem[0])
pre_unique = [] pre_unique = []
for elem in origin_datas: for elem in origin_datas:
if elem in pre_unique: if elem in pre_unique:
...@@ -221,7 +221,7 @@ class TDTestCase: ...@@ -221,7 +221,7 @@ class TDTestCase:
def basic_unique_function(self): def basic_unique_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -242,19 +242,19 @@ class TDTestCase: ...@@ -242,19 +242,19 @@ class TDTestCase:
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select unique(c6) from ct3") tdSql.query("select unique(c6) from ct3")
# will support _rowts mix with # will support _rowts mix with
# tdSql.query("select unique(c6),_rowts from ct3") # tdSql.query("select unique(c6),_rowts from ct3")
# auto check for t1 table # auto check for t1 table
# used for regular table # used for regular table
tdSql.query("select unique(c1) from t1") tdSql.query("select unique(c1) from t1")
tdSql.query("desc t1") tdSql.query("desc t1")
col_lists_rows = tdSql.queryResult col_lists_rows = tdSql.queryResult
col_lists = [] col_lists = []
for col_name in col_lists_rows: for col_name in col_lists_rows:
col_lists.append(col_name[0]) col_lists.append(col_name[0])
for col in col_lists: for col in col_lists:
self.check_unique_table(f"select unique({col}) from t1") self.check_unique_table(f"select unique({col}) from t1")
...@@ -269,17 +269,17 @@ class TDTestCase: ...@@ -269,17 +269,17 @@ class TDTestCase:
#tdSql.error("select unique(c1),tbname from ct1") #support #tdSql.error("select unique(c1),tbname from ct1") #support
#tdSql.error("select unique(c1),t1 from ct1") #support #tdSql.error("select unique(c1),t1 from ct1") #support
# unique with common col # unique with common col
#tdSql.error("select unique(c1) ,ts from ct1") #tdSql.error("select unique(c1) ,ts from ct1")
#tdSql.error("select unique(c1) ,c1 from ct1") #tdSql.error("select unique(c1) ,c1 from ct1")
# unique with scalar function # unique with scalar function
#tdSql.error("select unique(c1) ,abs(c1) from ct1") #tdSql.error("select unique(c1) ,abs(c1) from ct1")
tdSql.error("select unique(c1) , unique(c2) from ct1") tdSql.error("select unique(c1) , unique(c2) from ct1")
#tdSql.error("select unique(c1) , abs(c2)+2 from ct1") #tdSql.error("select unique(c1) , abs(c2)+2 from ct1")
# unique with aggregate function
# unique with aggregate function
tdSql.error("select unique(c1) ,sum(c1) from ct1") tdSql.error("select unique(c1) ,sum(c1) from ct1")
tdSql.error("select unique(c1) ,max(c1) from ct1") tdSql.error("select unique(c1) ,max(c1) from ct1")
tdSql.error("select unique(c1) ,csum(c1) from ct1") tdSql.error("select unique(c1) ,csum(c1) from ct1")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(7, 0, 1) tdSql.checkData(7, 0, 1)
tdSql.checkData(8, 0, 0) tdSql.checkData(8, 0, 0)
# unique with union all # unique with union all
tdSql.query("select unique(c1) from ct4 union all select c1 from ct1") tdSql.query("select unique(c1) from ct4 union all select c1 from ct1")
tdSql.checkRows(23) tdSql.checkRows(23)
tdSql.query("select unique(c1) from ct4 union all select distinct(c1) from ct4") tdSql.query("select unique(c1) from ct4 union all select distinct(c1) from ct4")
...@@ -314,8 +314,8 @@ class TDTestCase: ...@@ -314,8 +314,8 @@ class TDTestCase:
tdSql.query("select unique(c2) from ct4 union all select abs(c2)/2 from ct4") tdSql.query("select unique(c2) from ct4 union all select abs(c2)/2 from ct4")
tdSql.checkRows(22) tdSql.checkRows(22)
# unique with join # unique with join
# prepare join datas with same ts # prepare join datas with same ts
tdSql.execute(" use db ") tdSql.execute(" use db ")
tdSql.execute(" create stable st1 (ts timestamp , num int) tags(ind int)") tdSql.execute(" create stable st1 (ts timestamp , num int) tags(ind int)")
...@@ -371,7 +371,7 @@ class TDTestCase: ...@@ -371,7 +371,7 @@ class TDTestCase:
tdSql.checkRows(10) tdSql.checkRows(10)
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(1, 0, -7.000000000) tdSql.checkData(1, 0, -7.000000000)
# bug for stable # bug for stable
#partition by tbname #partition by tbname
...@@ -380,8 +380,8 @@ class TDTestCase: ...@@ -380,8 +380,8 @@ class TDTestCase:
# tdSql.query(" select unique(c1) from stb1 partition by tbname ") # tdSql.query(" select unique(c1) from stb1 partition by tbname ")
# tdSql.checkRows(21) # tdSql.checkRows(21)
# group by # group by
tdSql.error("select unique(c1) from ct1 group by c1") tdSql.error("select unique(c1) from ct1 group by c1")
tdSql.error("select unique(c1) from ct1 group by tbname") tdSql.error("select unique(c1) from ct1 group by tbname")
...@@ -393,7 +393,7 @@ class TDTestCase: ...@@ -393,7 +393,7 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
# bug need fix # bug need fix
# tdSql.query("select tbname , tail(c1,2) from stb1 partition by tbname") # tdSql.query("select tbname , tail(c1,2) from stb1 partition by tbname")
# tdSql.checkRows(4) # tdSql.checkRows(4)
...@@ -411,7 +411,7 @@ class TDTestCase: ...@@ -411,7 +411,7 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
# # bug need fix # # bug need fix
# tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname ") # tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname ")
# tdSql.checkRows(2) # tdSql.checkRows(2)
# tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname order by tbname ") # tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname order by tbname ")
...@@ -430,7 +430,7 @@ class TDTestCase: ...@@ -430,7 +430,7 @@ class TDTestCase:
tdSql.query(" select unique(t1) from stb1 partition by tbname ") tdSql.query(" select unique(t1) from stb1 partition by tbname ")
tdSql.checkRows(2) tdSql.checkRows(2)
# nest query # nest query
tdSql.query(" select unique(c1) from (select _rowts , t1 ,c1 , tbname from stb1 ) ") tdSql.query(" select unique(c1) from (select _rowts , t1 ,c1 , tbname from stb1 ) ")
tdSql.checkRows(11) tdSql.checkRows(11)
tdSql.checkData(0,0,6) tdSql.checkData(0,0,6)
...@@ -439,7 +439,7 @@ class TDTestCase: ...@@ -439,7 +439,7 @@ class TDTestCase:
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,4) tdSql.checkData(0,0,4)
tdSql.checkData(1,0,1) tdSql.checkData(1,0,1)
def check_boundary_values(self): def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test") tdSql.execute("drop database if exists bound_test")
...@@ -467,11 +467,11 @@ class TDTestCase: ...@@ -467,11 +467,11 @@ class TDTestCase:
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+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 sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.query("select unique(c2) from sub1_bound order by 1 desc") tdSql.query("select unique(c2) from sub1_bound order by 1 desc")
tdSql.checkRows(5) tdSql.checkRows(5)
tdSql.checkData(0,0,9223372036854775807) tdSql.checkData(0,0,9223372036854775807)
...@@ -480,22 +480,22 @@ class TDTestCase: ...@@ -480,22 +480,22 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: floor basic query ============") tdLog.printNoPrefix("==========step4: floor basic query ============")
self.basic_unique_function() self.basic_unique_function()
tdLog.printNoPrefix("==========step5: floor boundary query ============") tdLog.printNoPrefix("==========step5: floor boundary query ============")
self.check_boundary_values() self.check_boundary_values()
......
...@@ -371,7 +371,7 @@ class TMQCom: ...@@ -371,7 +371,7 @@ class TMQCom:
elif (i % 3 == 0): elif (i % 3 == 0):
tagBinaryValue = 'changsha' tagBinaryValue = 'changsha'
sql += " %s.%s_%d using %s.%s tags (%d, %d, %d, '%s', '%s') values "%(dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,tagBinaryValue,tagBinaryValue) sql += " %s.%s%d using %s.%s tags (%d, %d, %d, '%s', '%s') values "%(dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,tagBinaryValue,tagBinaryValue)
for j in range(rowsPerTbl): for j in range(rowsPerTbl):
sql += "(%d, %d, %d, %d, 'binary_%d', 'nchar_%d', now) "%(startTs+j, j,j, j,i+ctbStartIdx,rowsBatched) sql += "(%d, %d, %d, %d, 'binary_%d', 'nchar_%d', now) "%(startTs+j, j,j, j,i+ctbStartIdx,rowsBatched)
rowsBatched += 1 rowsBatched += 1
...@@ -379,7 +379,7 @@ class TMQCom: ...@@ -379,7 +379,7 @@ class TMQCom:
tsql.execute(sql) tsql.execute(sql)
rowsBatched = 0 rowsBatched = 0
if j < rowsPerTbl - 1: if j < rowsPerTbl - 1:
sql = "insert into %s.%s_%d using %s.%s tags (%d, %d, %d, '%s', '%s') values " %(dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,tagBinaryValue,tagBinaryValue) sql = "insert into %s.%s%d using %s.%s tags (%d, %d, %d, '%s', '%s') values " %(dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,tagBinaryValue,tagBinaryValue)
else: else:
sql = "insert into " sql = "insert into "
#end sql #end sql
......
...@@ -17,7 +17,7 @@ from tmqCommon import * ...@@ -17,7 +17,7 @@ from tmqCommon import *
class TDTestCase: class TDTestCase:
def __init__(self): def __init__(self):
self.snapshot = 0 self.snapshot = 0
self.vgroups = 2 self.vgroups = 4
self.ctbNum = 1 self.ctbNum = 1
self.rowsPerTbl = 100000 self.rowsPerTbl = 100000
...@@ -235,18 +235,18 @@ class TDTestCase: ...@@ -235,18 +235,18 @@ class TDTestCase:
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
self.prepareTestEnv() # self.prepareTestEnv()
tdLog.printNoPrefix("=============================================") # tdLog.printNoPrefix("=============================================")
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") # tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
self.tmqCase1() # self.tmqCase1()
self.tmqCase2() # self.tmqCase2()
self.prepareTestEnv() self.prepareTestEnv()
tdLog.printNoPrefix("====================================================================") tdLog.printNoPrefix("====================================================================")
tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal")
self.snapshot = 1 self.snapshot = 1
self.tmqCase1() self.tmqCase1()
self.tmqCase2() # self.tmqCase2()
def stop(self): def stop(self):
......
...@@ -17,9 +17,10 @@ from tmqCommon import * ...@@ -17,9 +17,10 @@ from tmqCommon import *
class TDTestCase: class TDTestCase:
def __init__(self): def __init__(self):
self.snapshot = 0 self.snapshot = 0
self.vgroups = 2 self.vgroups = 4
self.ctbNum = 1 self.ctbNum = 100
self.rowsPerTbl = 100000 self.rowsPerTbl = 1000
self.autoCtbPrefix = 'aCtb'
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
...@@ -38,9 +39,9 @@ class TDTestCase: ...@@ -38,9 +39,9 @@ class TDTestCase:
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
'ctbPrefix': 'ctb', 'ctbPrefix': 'ctb',
'ctbStartIdx': 0, 'ctbStartIdx': 0,
'ctbNum': 1, 'ctbNum': 1000,
'rowsPerTbl': 100000, 'rowsPerTbl': 1000,
'batchNum': 1200, 'batchNum': 10000,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
'pollDelay': 3, 'pollDelay': 3,
'showMsg': 1, 'showMsg': 1,
...@@ -62,9 +63,9 @@ class TDTestCase: ...@@ -62,9 +63,9 @@ class TDTestCase:
tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
# tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix,
# ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
# startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
# tdLog.info("restart taosd to ensure that the data falls into the disk") # tdLog.info("restart taosd to ensure that the data falls into the disk")
# tdSql.query("flush database %s"%(paraDict['dbName'])) # tdSql.query("flush database %s"%(paraDict['dbName']))
...@@ -84,9 +85,9 @@ class TDTestCase: ...@@ -84,9 +85,9 @@ class TDTestCase:
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
'ctbPrefix': 'ctb', 'ctbPrefix': 'ctb',
'ctbStartIdx': 0, 'ctbStartIdx': 0,
'ctbNum': 1, 'ctbNum': 1000,
'rowsPerTbl': 100000, 'rowsPerTbl': 1000,
'batchNum': 3000, 'batchNum': 10000,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
'pollDelay': 5, 'pollDelay': 5,
'showMsg': 1, 'showMsg': 1,
...@@ -98,10 +99,11 @@ class TDTestCase: ...@@ -98,10 +99,11 @@ class TDTestCase:
paraDict['rowsPerTbl'] = self.rowsPerTbl paraDict['rowsPerTbl'] = self.rowsPerTbl
# update to half tables # update to half tables
paraDict['ctbNum'] = int(self.ctbNum/2)
paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2)
# tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix,
# ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
# startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
...@@ -113,10 +115,14 @@ class TDTestCase: ...@@ -113,10 +115,14 @@ class TDTestCase:
tdLog.info("create topic sql: %s"%sqlString) tdLog.info("create topic sql: %s"%sqlString)
tdSql.execute(sqlString) tdSql.execute(sqlString)
# paraDict['ctbNum'] = self.ctbNum paraDict['ctbNum'] = self.ctbNum
paraDict['rowsPerTbl'] = self.rowsPerTbl paraDict['rowsPerTbl'] = self.rowsPerTbl
consumerId = 0 consumerId = 0
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 3/2) if self.snapshot == 0:
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2))
elif self.snapshot == 1:
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2))
topicList = topicFromStb1 topicList = topicFromStb1
ifcheckdata = 1 ifcheckdata = 1
ifManualCommit = 1 ifManualCommit = 1
...@@ -129,7 +135,7 @@ class TDTestCase: ...@@ -129,7 +135,7 @@ class TDTestCase:
tdLog.info("start consume processor") tdLog.info("start consume processor")
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
tdLog.info("insert process end, and start to check consume result") tdLog.info("start to check consume result")
expectRows = 1 expectRows = 1
resultList = tmqCom.selectConsumeResult(expectRows) resultList = tmqCom.selectConsumeResult(expectRows)
totalConsumeRows = 0 totalConsumeRows = 0
...@@ -143,7 +149,7 @@ class TDTestCase: ...@@ -143,7 +149,7 @@ class TDTestCase:
if totalConsumeRows != expectrowcnt: if totalConsumeRows != expectrowcnt:
tdLog.exit("tmq consume rows error!") tdLog.exit("tmq consume rows error!")
tmqCom.checkFileContent(consumerId, queryString) # tmqCom.checkFileContent(consumerId, queryString)
tdSql.query("drop topic %s"%topicFromStb1) tdSql.query("drop topic %s"%topicFromStb1)
tdLog.printNoPrefix("======== test case 1 end ...... ") tdLog.printNoPrefix("======== test case 1 end ...... ")
...@@ -161,9 +167,9 @@ class TDTestCase: ...@@ -161,9 +167,9 @@ class TDTestCase:
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
'ctbPrefix': 'ctb', 'ctbPrefix': 'ctb',
'ctbStartIdx': 0, 'ctbStartIdx': 0,
'ctbNum': 1, 'ctbNum': 1000,
'rowsPerTbl': 10000, 'rowsPerTbl': 1000,
'batchNum': 5000, 'batchNum': 10000,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
'pollDelay': 5, 'pollDelay': 5,
'showMsg': 1, 'showMsg': 1,
...@@ -179,14 +185,20 @@ class TDTestCase: ...@@ -179,14 +185,20 @@ class TDTestCase:
tdSql.query("flush database %s"%(paraDict['dbName'])) tdSql.query("flush database %s"%(paraDict['dbName']))
# update to half tables # update to half tables
paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) paraDict['ctbNum'] = int(self.ctbNum/2)
paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2)
tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2)
tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix,
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2))
# tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
# ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="aCtby",
# startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2))
tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2))
tmqCom.initConsumerTable() tmqCom.initConsumerTable()
tdLog.info("create topics from stb1") tdLog.info("create topics from stb1")
...@@ -197,9 +209,14 @@ class TDTestCase: ...@@ -197,9 +209,14 @@ class TDTestCase:
tdSql.execute(sqlString) tdSql.execute(sqlString)
# paraDict['ctbNum'] = self.ctbNum # paraDict['ctbNum'] = self.ctbNum
paraDict['ctbNum'] = self.ctbNum
paraDict['rowsPerTbl'] = self.rowsPerTbl paraDict['rowsPerTbl'] = self.rowsPerTbl
consumerId = 1 consumerId = 1
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2) if self.snapshot == 0:
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2 + 1/2*1/2))
elif self.snapshot == 1:
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2))
topicList = topicFromStb1 topicList = topicFromStb1
ifcheckdata = 1 ifcheckdata = 1
ifManualCommit = 1 ifManualCommit = 1
...@@ -212,7 +229,7 @@ class TDTestCase: ...@@ -212,7 +229,7 @@ class TDTestCase:
tdLog.info("start consume processor") tdLog.info("start consume processor")
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
tdLog.info("insert process end, and start to check consume result") tdLog.info("start to check consume result")
expectRows = 1 expectRows = 1
resultList = tmqCom.selectConsumeResult(expectRows) resultList = tmqCom.selectConsumeResult(expectRows)
totalConsumeRows = 0 totalConsumeRows = 0
......
...@@ -178,6 +178,8 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py ...@@ -178,6 +178,8 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
#python3 ./test.py -f 7-tmq/tmqDnodeRestart.py #python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
#python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py
python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb.py
#------------querPolicy 2----------- #------------querPolicy 2-----------
...@@ -353,4 +355,4 @@ python3 ./test.py -f 2-query/twa.py -Q 3 ...@@ -353,4 +355,4 @@ python3 ./test.py -f 2-query/twa.py -Q 3
python3 ./test.py -f 2-query/irate.py -Q 3 python3 ./test.py -f 2-query/irate.py -Q 3
python3 ./test.py -f 2-query/function_null.py -Q 3 python3 ./test.py -f 2-query/function_null.py -Q 3
python3 ./test.py -f 2-query/count_partition.py -Q 3 python3 ./test.py -f 2-query/count_partition.py -Q 3
python3 ./test.py -f 2-query/max_partition.py -Q 3 python3 ./test.py -f 2-query/max_partition.py -Q 3
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册