未验证 提交 b32a6e84 编写于 作者: G Ganlin Zhao 提交者: GitHub

Merge pull request #14823 from taosdata/fix/merge_interval_agg

fix(test): fix test cases
......@@ -16,18 +16,18 @@ class TDTestCase:
self.rowNum = 10
self.ts = 1640966400000 # 2022-1-1 00:00:00.000
def check_customize_param_ms(self):
time_zone = time.strftime('%z')
tdSql.execute('create database db1 precision "ms"')
tdSql.execute('use db1')
tdSql.execute('create table if not exists ntb(ts timestamp, c1 int, c2 timestamp)')
for i in range(self.rowNum):
tdSql.execute("insert into ntb values(%d, %d, %d)"
tdSql.execute("insert into ntb values(%d, %d, %d)"
% (self.ts + i, i + 1, self.ts + i))
tdSql.query('select to_iso8601(ts) from ntb')
for i in range(self.rowNum):
tdSql.checkEqual(tdSql.queryResult[i][0],f'2022-01-01T00:00:00.00{i}{time_zone}')
timezone_list = ['+0000','+0100','+0200','+0300','+0330','+0400','+0500','+0530','+0600','+0700','+0800','+0900','+1000','+1100','+1200',\
'+00','+01','+02','+03','+04','+05','+06','+07','+08','+09','+10','+11','+12',\
'+00:00','+01:00','+02:00','+03:00','+03:30','+04:00','+05:00','+05:30','+06:00','+07:00','+08:00','+09:00','+10:00','+11:00','+12:00',\
......@@ -39,7 +39,7 @@ class TDTestCase:
tdSql.query(f'select to_iso8601(ts,"{j}") from ntb')
for i in range(self.rowNum):
tdSql.checkEqual(tdSql.queryResult[i][0],f'2022-01-01T00:00:00.00{i}{j}')
error_param_list = [0,100.5,'a','!']
for i in error_param_list:
tdSql.error(f'select to_iso8601(ts,"{i}") from ntb')
......@@ -47,7 +47,7 @@ class TDTestCase:
error_timezone_param = ['+13','-13','+1300','-1300','+0001','-0001','-0330','-0530']
for i in error_timezone_param:
tdSql.error(f'select to_iso8601(ts,"{i}") from ntb')
def check_base_function(self):
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create tables==========")
......@@ -75,12 +75,12 @@ class TDTestCase:
tdSql.query("select to_iso8601(ts) from ntb")
tdSql.checkRows(3)
tdSql.query("select to_iso8601(ts) from db.ntb")
tdSql.query("select to_iso8601(today()) from ntb")
tdSql.checkRows(3)
tdSql.query("select to_iso8601(now()) from ntb")
tdSql.checkRows(3)
tdSql.error("select to_iso8601(timezone()) from ntb")
tdSql.error("select to_iso8601('abc') from ntb")
......@@ -104,7 +104,7 @@ class TDTestCase:
for i in err_param:
tdSql.error(f"select to_iso8601({i}) from ntb")
tdSql.error(f"select to_iso8601({i}) from db.ntb")
tdSql.query("select to_iso8601(now) from stb")
tdSql.checkRows(3)
tdSql.query("select to_iso8601(now()) from stb")
......@@ -126,7 +126,7 @@ class TDTestCase:
tdSql.query(f"select to_iso8601(today()) {i}null from db.stb")
tdSql.checkRows(3)
tdSql.checkData(0,0,None)
def run(self): # sourcery skip: extract-duplicate-method
self.check_base_function()
self.check_customize_param_ms()
......
......@@ -58,7 +58,7 @@ class TDTestCase:
tag_sql += f"{k} {v},"
create_stb_sql = f'create table {stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})'
return create_stb_sql
def data_check(self,column_dict={},tbname = '',values_list = [],tb_num = 1,tb = 'tb',precision = 'ms'):
for k,v in column_dict.items():
num_up = 0
......@@ -175,7 +175,7 @@ class TDTestCase:
tdSql.execute('drop database db')
def run(self): # sourcery skip: extract-duplicate-method
self.today_check_ntb()
self.today_check_stb_tb()
......
......@@ -47,7 +47,7 @@ class TDTestCase:
c9 = "'nchar_val'"
c10 = ts
tdSql.execute(f" insert into {tbname} values ({ts},{c1},{c2},{c3},{c4},{c5},{c6},{c7},{c8},{c9},{c10})")
tdSql.execute("use test")
tbnames = ["stb", "sub_tb_1"]
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
......@@ -60,7 +60,7 @@ class TDTestCase:
origin_sql = "select {} from {} order by tbname".format(colname, tbname)
if coltype[1] in support_types:
self.check_result_auto(origin_sql , abs_sql)
def prepare_datas(self):
tdSql.execute(
......
......@@ -47,7 +47,7 @@ class TDTestCase:
c9 = "'nchar_val'"
c10 = ts
tdSql.execute(f" insert into {tbname} values ({ts},{c1},{c2},{c3},{c4},{c5},{c6},{c7},{c8},{c9},{c10})")
tdSql.execute("use test")
tbnames = ["stb", "sub_tb_1"]
support_types = ["BIGINT", "SMALLINT", "TINYINT", "FLOAT", "DOUBLE", "INT"]
......@@ -62,7 +62,7 @@ class TDTestCase:
cols = random.sample(colnames,3)
self.check_function("&",False,tbname,cols[0],cols[1],cols[2])
self.check_function("|",False,tbname,cols[0],cols[1],cols[2])
def prepare_datas(self):
tdSql.execute(
......@@ -215,14 +215,14 @@ class TDTestCase:
"abs value check pass , it work as expected ,sql is \"%s\" " % abs_query)
def check_function(self, opera ,agg, tbname , *args):
if opera =="&":
pass
elif opera =="|":
pass
else:
pass
work_sql = " select "
work_sql = " select "
for ind , arg in enumerate(args):
if ind ==len(args)-1:
work_sql += f"cast({arg} as bigint) "
......@@ -235,7 +235,7 @@ class TDTestCase:
work_sql+= f" from {tbname} "
tdSql.query(work_sql)
work_result = tdSql.queryResult
origin_sql = " select "
for ind , arg in enumerate(args):
if ind ==len(args)-1:
......@@ -323,7 +323,7 @@ class TDTestCase:
tdSql.checkData(0,0,None)
tdSql.checkData(1,0,640)
tdSql.checkData(10,0,0)
# used for regular table
tdSql.query("select abs(c1)&c3&c3 from t1")
tdSql.checkData(0, 0, None)
......@@ -349,7 +349,7 @@ class TDTestCase:
self.check_function("&",False,"stb1","c1","floor(t1)","abs(c1+c2)","t1+1")
self.check_function("&",True,"stb1","max(c1)","min(floor(t1))","sum(abs(c1+c2))","last(t1)+1")
self.check_function("&",False,"stb1","abs(abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))))","floor(t1)","abs(c1+c2)","t1+1")
# mix with common col
tdSql.query("select c1&abs(c1)&c2&c3 ,c1,c2, t1 from ct1")
tdSql.checkData(0, 0, 8)
......@@ -388,7 +388,7 @@ class TDTestCase:
# agg functions mix with agg functions
tdSql.query("select sum(c1&abs(c1)&c2&c3) ,max(c5), count(c5) from stb1")
tdSql.query("select max(c1)&max(c2)|first(ts), count(c5) from ct1")
# bug fix for compute
......@@ -409,7 +409,7 @@ class TDTestCase:
tdSql.checkData(1, 2, 894.900000000)
def check_boundary_values(self):
......@@ -490,7 +490,7 @@ class TDTestCase:
self.check_function("&", False ,"ct4","123","abs(c1)","t1","abs(t2)","abs(t3)","abs(t4)","t5")
self.check_function("&", False ,"ct4","c1+2","abs(t2+2)","t3","abs(t4)","abs(t5)","abs(c1)","t5")
tdSql.query(" select sum(c1) from stb1 where t1+10 >1; ")
tdSql.query(" select sum(c1) from stb1 where t1+10 >1; ")
tdSql.query("select c1 ,t1 from stb1 where t1 =0 ")
tdSql.checkRows(13)
self.check_function("&", False ,"t1","c1+2","abs(c2)")
......@@ -534,7 +534,7 @@ class TDTestCase:
self.support_super_table_test()
self.insert_datas_and_check_abs(self.tb_nums,self.row_nums,self.time_step)
def stop(self):
tdSql.close()
......
......@@ -44,7 +44,7 @@ class TDTestCase:
'col12': f'binary({self.binary_length})',
'col13': f'nchar({self.nchar_length})'
}
self.tag_dict = {
'ts_tag' : 'timestamp',
't1': 'tinyint',
......@@ -79,9 +79,9 @@ class TDTestCase:
self.tag_values = [
f'{self.tag_ts},{self.tag_tinyint},{self.tag_smallint},{self.tag_int},{self.tag_bigint},\
{self.tag_utint},{self.tag_usint},{self.tag_uint},{self.tag_ubint},{self.tag_float},{self.tag_double},{self.tag_bool},"{self.binary_str}","{self.nchar_str}"'
]
self.percent = [1,50,100]
self.param_list = ['default','t-digest']
def insert_data(self,column_dict,tbname,row_num):
......@@ -90,7 +90,7 @@ class TDTestCase:
insert_list = []
self.setsql.insert_values(column_dict,i,insert_sql,insert_list,self.ts)
def function_check_ntb(self):
tdSql.prepare()
tdSql.execute(self.setsql.set_create_normaltable_sql(self.ntbname,self.column_dict))
......@@ -126,7 +126,7 @@ class TDTestCase:
def run(self):
self.function_check_ntb()
self.function_check_stb()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -48,7 +48,7 @@ class TDTestCase:
'col12': 'binary(20)',
'col13': 'nchar(20)'
}
self.param_list = [1,100]
def insert_data(self,column_dict,tbname,row_num):
insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str)
......@@ -125,11 +125,11 @@ class TDTestCase:
self.bottom_check_data(f'{stbname}_{i}','child_table')
self.bottom_check_data(f'{stbname}','stable')
tdSql.execute(f'drop database {self.dbname}')
def run(self):
self.bottom_check_ntb()
self.bottom_check_stb()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -9,14 +9,14 @@ from util.sql import *
from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, logSql):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def prepare_datas(self):
tdSql.execute(
'''create table stb1
......@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql.execute(
'''
create table t1
......@@ -66,14 +66,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
def check_result_auto(self ,origin_query , ceil_query):
pass
ceil_result = tdSql.getResult(ceil_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
......@@ -88,13 +88,13 @@ class TDTestCase:
for row_index , row in enumerate(ceil_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
check_status = False
if not check_status:
tdLog.notice("ceil function value has not as expected , sql is \"%s\" "%ceil_query )
sys.exit(1)
else:
tdLog.info("ceil value check pass , it work as expected ,sql is \"%s\" "%ceil_query )
def test_errors(self):
error_sql_lists = [
"select ceil from t1",
......@@ -128,42 +128,42 @@ class TDTestCase:
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
def support_types(self):
type_error_sql_lists = [
"select ceil(ts) from t1" ,
"select ceil(ts) from t1" ,
"select ceil(c7) from t1",
"select ceil(c8) from t1",
"select ceil(c9) from t1",
"select ceil(ts) from ct1" ,
"select ceil(ts) from ct1" ,
"select ceil(c7) from ct1",
"select ceil(c8) from ct1",
"select ceil(c9) from ct1",
"select ceil(ts) from ct3" ,
"select ceil(ts) from ct3" ,
"select ceil(c7) from ct3",
"select ceil(c8) from ct3",
"select ceil(c9) from ct3",
"select ceil(ts) from ct4" ,
"select ceil(ts) from ct4" ,
"select ceil(c7) from ct4",
"select ceil(c8) from ct4",
"select ceil(c9) from ct4",
"select ceil(ts) from stb1" ,
"select ceil(ts) from stb1" ,
"select ceil(c7) from stb1",
"select ceil(c8) from stb1",
"select ceil(c9) from stb1" ,
"select ceil(ts) from stbbb1" ,
"select ceil(ts) from stbbb1" ,
"select ceil(c7) from stbbb1",
"select ceil(ts) from tbname",
"select ceil(c9) from tbname"
]
for type_sql in type_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists = [
"select ceil(c1) from t1",
"select ceil(c2) from t1",
......@@ -193,16 +193,16 @@ class TDTestCase:
"select ceil(c5) from stb1",
"select ceil(c6) from stb1",
"select ceil(c6) as alisb from stb1",
"select ceil(c6) alisb from stb1",
"select ceil(c6) as alisb from stb1",
"select ceil(c6) alisb from stb1",
]
for type_sql in type_sql_lists:
tdSql.query(type_sql)
def basic_ceil_function(self):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
......@@ -222,7 +222,7 @@ class TDTestCase:
tdSql.query("select ceil(c5) from ct3")
tdSql.checkRows(0)
tdSql.query("select ceil(c6) from ct3")
# used for regular table
tdSql.query("select ceil(c1) from t1")
tdSql.checkData(0, 0, None)
......@@ -240,7 +240,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from t1", "select (c1), ceil(c2) ,ceil(c3), ceil(c4), ceil(c5) from t1")
# used for sub table
tdSql.query("select ceil(c1) from ct1")
tdSql.checkData(0, 0, 8)
......@@ -252,20 +252,20 @@ class TDTestCase:
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct1", "select (c1), ceil(c2) ,ceil(c3), ceil(c4), ceil(c5) from ct1")
self.check_result_auto("select ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(c1)))))))))) nest_col_func from ct1;","select c1 from ct1" )
# used for stable table
# used for stable table
tdSql.query("select ceil(c1) from stb1")
tdSql.checkRows(25)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct4 ", "select (c1), ceil(c2) ,ceil(c3), ceil(c4), ceil(c5) from ct4")
self.check_result_auto("select ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(c1)))))))))) nest_col_func from ct4;" , "select c1 from ct4" )
# used for not exists table
tdSql.error("select ceil(c1) from stbbb1")
tdSql.error("select ceil(c1) from tbname")
tdSql.error("select ceil(c1) from ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, ceil(c1) from ct1")
tdSql.checkData(0 , 0 ,8)
tdSql.checkData(0 , 1 ,8)
......@@ -290,7 +290,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 , 6)
tdSql.checkData(3 , 2 ,6.66000)
......@@ -311,7 +311,7 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# bug fix for count
tdSql.query("select count(c1) from ct4 ")
tdSql.checkData(0,0,9)
......@@ -322,7 +322,7 @@ class TDTestCase:
tdSql.query("select count(*) from stb1 ")
tdSql.checkData(0,0,25)
# bug fix for compute
# bug fix for compute
tdSql.query("select c1, abs(c1) -0 ,ceil(c1)-0 from ct4 ")
tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None)
......@@ -373,10 +373,10 @@ class TDTestCase:
tdSql.checkData(0,3,8.000000000)
tdSql.checkData(0,4,7.900000000)
tdSql.checkData(0,5,3.000000000)
def ceil_Arithmetic(self):
pass
def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test")
......@@ -405,14 +405,14 @@ class TDTestCase:
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() )"
)
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() )"
)
self.check_result_auto( "select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ", "select ceil(c1), ceil(c2) ,ceil(c3), ceil(c4), ceil(c5) ,ceil(c6) from sub1_bound")
self.check_result_auto( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select ceil(c1), ceil(c2) ,ceil(c3), ceil(c3), ceil(c2) ,ceil(c1) from sub1_bound")
self.check_result_auto("select ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(ceil(c1)))))))))) nest_col_func from sub1_bound;" , "select ceil(c1) from sub1_bound" )
# check basic elem for table per row
tdSql.query("select ceil(c1+0.2) ,ceil(c2) , ceil(c3+0.3) , ceil(c4-0.3), ceil(c5/2), ceil(c6/2) from sub1_bound ")
tdSql.checkData(0, 0, 2147483648.000000000)
......@@ -426,7 +426,7 @@ class TDTestCase:
tdSql.checkData(4, 4, -169499995645668991474575059260979281920.000000000)
self.check_result_auto("select c1+1 ,c2 , c3*1 , c4/2, c5/2, c6 from sub1_bound" ,"select ceil(c1+1) ,ceil(c2) , ceil(c3*1) , ceil(c4/2), ceil(c5)/2, ceil(c6) from sub1_bound ")
def support_super_table_test(self):
tdSql.execute(" use db ")
self.check_result_auto( " select c5 from stb1 order by ts " , "select ceil(c5) from stb1 order by ts" )
......@@ -444,26 +444,26 @@ class TDTestCase:
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4: ceil basic query ============")
tdLog.printNoPrefix("==========step4: ceil basic query ============")
self.basic_ceil_function()
tdLog.printNoPrefix("==========step5: ceil boundary query ============")
tdLog.printNoPrefix("==========step5: ceil boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step6: ceil filter query ============")
tdLog.printNoPrefix("==========step6: ceil filter query ============")
self.abs_func_filter()
......
......@@ -9,13 +9,13 @@ from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def prepare_datas(self):
tdSql.execute(
'''create table stb1
......@@ -23,7 +23,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql.execute(
'''
create table t1
......@@ -65,14 +65,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
def check_result_auto_cos(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
......@@ -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):
check_status = False
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:
pass
if not check_status:
......@@ -98,7 +98,7 @@ class TDTestCase:
sys.exit(1)
else:
tdLog.info("cos value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self):
error_sql_lists = [
"select cos from t1",
......@@ -132,42 +132,42 @@ class TDTestCase:
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
def support_types(self):
type_error_sql_lists = [
"select cos(ts) from t1" ,
"select cos(ts) from t1" ,
"select cos(c7) from t1",
"select cos(c8) from t1",
"select cos(c9) from t1",
"select cos(ts) from ct1" ,
"select cos(ts) from ct1" ,
"select cos(c7) from ct1",
"select cos(c8) from ct1",
"select cos(c9) from ct1",
"select cos(ts) from ct3" ,
"select cos(ts) from ct3" ,
"select cos(c7) from ct3",
"select cos(c8) from ct3",
"select cos(c9) from ct3",
"select cos(ts) from ct4" ,
"select cos(ts) from ct4" ,
"select cos(c7) from ct4",
"select cos(c8) from ct4",
"select cos(c9) from ct4",
"select cos(ts) from stb1" ,
"select cos(ts) from stb1" ,
"select cos(c7) from stb1",
"select cos(c8) from stb1",
"select cos(c9) from stb1" ,
"select cos(ts) from stbbb1" ,
"select cos(ts) from stbbb1" ,
"select cos(c7) from stbbb1",
"select cos(ts) from tbname",
"select cos(c9) from tbname"
]
for type_sql in type_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists = [
"select cos(c1) from t1",
"select cos(c2) from t1",
......@@ -197,16 +197,16 @@ class TDTestCase:
"select cos(c5) from stb1",
"select cos(c6) from stb1",
"select cos(c6) as alisb from stb1",
"select cos(c6) alisb from stb1",
"select cos(c6) as alisb from stb1",
"select cos(c6) alisb from stb1",
]
for type_sql in type_sql_lists:
tdSql.query(type_sql)
def basic_cosin_function(self):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
......@@ -247,7 +247,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None)
self.check_result_auto_cos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from t1")
# used for sub table
tdSql.query("select c2 ,cos(c2) from ct1")
tdSql.checkData(0, 1, 0.975339851)
......@@ -263,7 +263,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None)
self.check_result_auto_cos( "select c1, c2, c3 , c4, c5 from ct1", "select cos(c1), cos(c2) ,cos(c3), cos(c4), cos(c5) from ct1")
# nest query for cos functions
tdSql.query("select c4 , cos(c4) ,cos(cos(c4)) , cos(cos(cos(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88)
......@@ -281,21 +281,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , 0.999207254)
tdSql.checkData(11 , 3 , 0.540969209)
# used for stable table
# used for stable table
tdSql.query("select cos(c1) from stb1")
tdSql.checkRows(25)
# used for not exists table
tdSql.error("select cos(c1) from stbbb1")
tdSql.error("select cos(c1) from tbname")
tdSql.error("select cos(c1) from ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, cos(c1) from ct1")
tdSql.query("select c2, cos(c2) from ct4")
# mix with common functions
tdSql.query("select c1, cos(c1),cos(c1), cos(cos(c1)) from ct4 ")
......@@ -303,7 +303,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,0.960170287)
tdSql.checkData(3 , 2 ,0.960170287)
......@@ -324,8 +324,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute
# # bug fix for compute
tdSql.query("select c1, cos(c1) -0 ,cos(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None)
......@@ -394,10 +394,10 @@ class TDTestCase:
tdSql.checkData(0,3,8.000000000)
tdSql.checkData(0,4,7.900000000)
tdSql.checkData(0,5,0.000000000)
def pow_Arithmetic(self):
pass
def check_boundary_values(self):
PI=3.1415926
......@@ -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() )"
)
self.check_result_auto_cos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from sub1_bound")
self.check_result_auto_cos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select cos(c1), cos(c2) ,cos(c3), cos(c3), cos(c2) ,cos(c1) from sub1_bound")
self.check_result_auto_cos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select cos(abs(c1)) from sub1_bound" )
# check basic elem for table per row
tdSql.query("select cos(abs(c1)) ,cos(abs(c2)) , cos(abs(c3)) , cos(abs(c4)), cos(abs(c5)), cos(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,math.cos(2147483647))
......@@ -489,36 +489,36 @@ class TDTestCase:
self.check_result_auto_cos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select cos(t1) ,cos(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_cos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select cos(t1) , cos(c5) from stb1 where c1 > 0 order by tbname" )
pass
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4: cos basic query ============")
tdLog.printNoPrefix("==========step4: cos basic query ============")
self.basic_cosin_function()
tdLog.printNoPrefix("==========step5: big number cos query ============")
tdLog.printNoPrefix("==========step5: big number cos query ============")
self.test_big_number()
tdLog.printNoPrefix("==========step6: cos boundary query ============")
tdLog.printNoPrefix("==========step6: cos boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step7: cos filter query ============")
tdLog.printNoPrefix("==========step7: cos filter query ============")
self.abs_func_filter()
......
......@@ -13,24 +13,24 @@ class TDTestCase:
def run(self):
tdSql.prepare()
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))''')
tdSql.execute("create table stb_1 using stb tags('beijing')")
tdSql.execute("create table stb_2 using stb tags('shanghai')")
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
tdSql.execute('''create table ntb(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)''')
for i in range(self.rowNum):
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
for i in range(self.rowNum):
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select count(*) from stb")
tdSql.checkData(0,0,20)
tdSql.query("select count(*) from db.stb")
......@@ -95,7 +95,7 @@ class TDTestCase:
tdSql.query("select count(ts) from db.stb_1")
tdSql.checkData(0,0,10)
tdSql.checkData(0,0,10)
tdSql.query("select count(ts) from db.stb_1")
tdSql.checkData(0,0,10)
tdSql.query("select count(col1) from stb_1")
......@@ -171,7 +171,7 @@ class TDTestCase:
tdSql.query("select count(col1),count(ts) from stb")
tdSql.checkData(0,0,20)
tdSql.checkData(0,1,21)
tdSql.query("select count(col1) from db.stb")
tdSql.checkData(0,0,20)
tdSql.query("select count(col1),count(ts) from db.stb")
......@@ -184,7 +184,7 @@ class TDTestCase:
tdSql.query("select count(col1) from stb group by col7")
tdSql.checkRows(3)
def stop(self):
......@@ -193,4 +193,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
......@@ -419,7 +419,7 @@ class TDTestCase:
tdSql.checkData(3,0,4)
tdSql.query("select csum(abs(c1))+2 from t1 ")
tdSql.checkRows(4)
def csum_support_stable(self):
tdSql.query(" select csum(1) from stb1 ")
tdSql.checkRows(70)
......@@ -434,17 +434,17 @@ class TDTestCase:
tdSql.query("select csum(st1+c1) from stb1 partition by tbname")
tdSql.checkRows(40)
# # bug need fix
# # bug need fix
# tdSql.query("select csum(st1+c1) from stb1 partition by tbname slimit 1 ")
# tdSql.checkRows(4)
# tdSql.error("select csum(st1+c1) from stb1 partition by tbname limit 1 ")
# bug need fix
# bug need fix
tdSql.query("select csum(st1+c1) from stb1 partition by tbname")
tdSql.checkRows(40)
tdSql.checkRows(40)
# bug need fix
# bug need fix
# tdSql.query("select tbname , csum(c1) from stb1 partition by tbname")
# tdSql.checkRows(40)
# tdSql.query("select tbname , csum(st1) from stb1 partition by tbname")
......@@ -452,7 +452,7 @@ class TDTestCase:
# tdSql.query("select tbname , csum(st1) from stb1 partition by tbname slimit 1")
# tdSql.checkRows(7)
# partition by tags
# partition by tags
# tdSql.query("select st1 , csum(c1) from stb1 partition by st1")
# tdSql.checkRows(40)
# tdSql.query("select csum(c1) from stb1 partition by st1")
......@@ -491,4 +491,4 @@ class TDTestCase:
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
......@@ -16,7 +16,7 @@ class TDTestCase:
def init(self, conn, logSql):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def prepare_datas(self):
tdSql.execute(
'''create table stb1
......@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql.execute(
'''
create table t1
......@@ -66,14 +66,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
def check_result_auto(self ,origin_query , floor_query):
pass
floor_result = tdSql.getResult(floor_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
......@@ -88,13 +88,13 @@ class TDTestCase:
for row_index , row in enumerate(floor_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
check_status = False
if not check_status:
tdLog.notice("floor function value has not as expected , sql is \"%s\" "%floor_query )
sys.exit(1)
else:
tdLog.info("floor value check pass , it work as expected ,sql is \"%s\" "%floor_query )
def test_errors(self):
error_sql_lists = [
"select floor from t1",
......@@ -128,42 +128,42 @@ class TDTestCase:
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
def support_types(self):
type_error_sql_lists = [
"select floor(ts) from t1" ,
"select floor(ts) from t1" ,
"select floor(c7) from t1",
"select floor(c8) from t1",
"select floor(c9) from t1",
"select floor(ts) from ct1" ,
"select floor(ts) from ct1" ,
"select floor(c7) from ct1",
"select floor(c8) from ct1",
"select floor(c9) from ct1",
"select floor(ts) from ct3" ,
"select floor(ts) from ct3" ,
"select floor(c7) from ct3",
"select floor(c8) from ct3",
"select floor(c9) from ct3",
"select floor(ts) from ct4" ,
"select floor(ts) from ct4" ,
"select floor(c7) from ct4",
"select floor(c8) from ct4",
"select floor(c9) from ct4",
"select floor(ts) from stb1" ,
"select floor(ts) from stb1" ,
"select floor(c7) from stb1",
"select floor(c8) from stb1",
"select floor(c9) from stb1" ,
"select floor(ts) from stbbb1" ,
"select floor(ts) from stbbb1" ,
"select floor(c7) from stbbb1",
"select floor(ts) from tbname",
"select floor(c9) from tbname"
]
for type_sql in type_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists = [
"select floor(c1) from t1",
"select floor(c2) from t1",
......@@ -193,16 +193,16 @@ class TDTestCase:
"select floor(c5) from stb1",
"select floor(c6) from stb1",
"select floor(c6) as alisb from stb1",
"select floor(c6) alisb from stb1",
"select floor(c6) as alisb from stb1",
"select floor(c6) alisb from stb1",
]
for type_sql in type_sql_lists:
tdSql.query(type_sql)
def basic_floor_function(self):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
......@@ -222,7 +222,7 @@ class TDTestCase:
tdSql.query("select floor(c5) from ct3")
tdSql.checkRows(0)
tdSql.query("select floor(c6) from ct3")
# used for regular table
tdSql.query("select floor(c1) from t1")
tdSql.checkData(0, 0, None)
......@@ -240,7 +240,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from t1", "select (c1), floor(c2) ,floor(c3), floor(c4), floor(c5) from t1")
# used for sub table
tdSql.query("select floor(c1) from ct1")
tdSql.checkData(0, 0, 8)
......@@ -252,20 +252,20 @@ class TDTestCase:
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct1", "select (c1), floor(c2) ,floor(c3), floor(c4), floor(c5) from ct1")
self.check_result_auto("select floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(c1)))))))))) nest_col_func from ct1;","select c1 from ct1" )
# used for stable table
# used for stable table
tdSql.query("select floor(c1) from stb1")
tdSql.checkRows(25)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct4 ", "select (c1), floor(c2) ,floor(c3), floor(c4), floor(c5) from ct4")
self.check_result_auto("select floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(c1)))))))))) nest_col_func from ct4;" , "select c1 from ct4" )
# used for not exists table
tdSql.error("select floor(c1) from stbbb1")
tdSql.error("select floor(c1) from tbname")
tdSql.error("select floor(c1) from ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, floor(c1) from ct1")
tdSql.checkData(0 , 0 ,8)
tdSql.checkData(0 , 1 ,8)
......@@ -290,7 +290,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 , 6)
tdSql.checkData(3 , 2 ,6.66000)
......@@ -311,7 +311,7 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# bug fix for count
tdSql.query("select count(c1) from ct4 ")
tdSql.checkData(0,0,9)
......@@ -322,7 +322,7 @@ class TDTestCase:
tdSql.query("select count(*) from stb1 ")
tdSql.checkData(0,0,25)
# bug fix for compute
# bug fix for compute
tdSql.query("select c1, abs(c1) -0 ,floor(c1)-0 from ct4 ")
tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None)
......@@ -373,10 +373,10 @@ class TDTestCase:
tdSql.checkData(0,3,8.000000000)
tdSql.checkData(0,4,7.900000000)
tdSql.checkData(0,5,3.000000000)
def floor_Arithmetic(self):
pass
def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test")
......@@ -405,14 +405,14 @@ class TDTestCase:
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() )"
)
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() )"
)
self.check_result_auto( "select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ", "select floor(c1), floor(c2) ,floor(c3), floor(c4), floor(c5) ,floor(c6) from sub1_bound")
self.check_result_auto( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select floor(c1), floor(c2) ,floor(c3), floor(c3), floor(c2) ,floor(c1) from sub1_bound")
self.check_result_auto("select floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(c1)))))))))) nest_col_func from sub1_bound;" , "select floor(c1) from sub1_bound" )
# check basic elem for table per row
tdSql.query("select floor(c1+0.2) ,floor(c2) , floor(c3+0.3) , floor(c4-0.3), floor(c5/2), floor(c6/2) from sub1_bound ")
tdSql.checkData(0, 0, 2147483647.000000000)
......@@ -444,26 +444,26 @@ class TDTestCase:
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4: floor basic query ============")
tdLog.printNoPrefix("==========step4: floor basic query ============")
self.basic_floor_function()
tdLog.printNoPrefix("==========step5: floor boundary query ============")
tdLog.printNoPrefix("==========step5: floor boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step6: floor filter query ============")
tdLog.printNoPrefix("==========step6: floor filter query ============")
self.abs_func_filter()
......
......@@ -370,17 +370,17 @@ class TDTestCase:
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.checkRows(190)
# # bug need fix
# # bug need fix
# tdSql.query("select diff(st1+c1) from stb1 partition by tbname slimit 1 ")
# tdSql.checkRows(19)
# tdSql.error("select diff(st1+c1) from stb1 partition by tbname limit 1 ")
# bug need fix
# bug need fix
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.checkRows(190)
# bug need fix
# bug need fix
# tdSql.query("select tbname , diff(c1) from stb1 partition by tbname")
# tdSql.checkRows(199)
# tdSql.query("select tbname , diff(st1) from stb1 partition by tbname")
......@@ -388,7 +388,7 @@ class TDTestCase:
# tdSql.query("select tbname , diff(st1) from stb1 partition by tbname slimit 1")
# tdSql.checkRows(19)
# partition by tags
# partition by tags
# tdSql.query("select st1 , diff(c1) from stb1 partition by st1")
# tdSql.checkRows(199)
# tdSql.query("select diff(c1) from stb1 partition by st1")
......@@ -488,4 +488,4 @@ class TDTestCase:
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
......@@ -11,7 +11,7 @@ from util.sql import *
from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
......@@ -388,11 +388,11 @@ class TDTestCase:
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() )"
)
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() )"
)
tdSql.query("select stateduration(c1,'GT',1,1s) from sub1_bound")
tdSql.checkRows(5)
......@@ -400,29 +400,29 @@ class TDTestCase:
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4:support opers ============")
tdLog.printNoPrefix("==========step4:support opers ============")
self.support_opers()
tdLog.printNoPrefix("==========step5: stateduration basic query ============")
tdLog.printNoPrefix("==========step5: stateduration basic query ============")
self.basic_stateduration_function()
tdLog.printNoPrefix("==========step6: stateduration boundary query ============")
tdLog.printNoPrefix("==========step6: stateduration boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step6: stateduration unit time test ============")
tdLog.printNoPrefix("==========step6: stateduration unit time test ============")
self.check_unit_time()
......
......@@ -34,7 +34,7 @@ class TDTestCase:
tag_sql += f"{k} {v},"
create_stb_sql = f'create table {stbname} (ts timestamp,{column_sql[:-1]}) tags({tag_sql[:-1]})'
return create_stb_sql
def last_check_stb_tb_base(self):
tdSql.prepare()
stbname = tdCom.getLongName(5, "letters")
......@@ -201,7 +201,7 @@ class TDTestCase:
tdSql.execute(f'use {dbname}')
# build 20 child tables,every table insert 10 rows
tdSql.execute(f'''create table {stbname}(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
tdSql.execute(f'''create table {stbname}(ts timestamp, col1 tinyint, col2 smallint, col3 int, 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)) tags(loc nchar(20))''')
for i in range(self.tbnum):
tdSql.execute(
......
......@@ -159,7 +159,7 @@ class TDTestCase:
return tdSql.error(self.mavg_query_form(
sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
table_expr=table_expr, condition=condition
))
))
if all(["group" in condition.lower(), "tbname" not in condition.lower()]):
print(f"case in {line}: ", end='')
......@@ -295,7 +295,7 @@ class TDTestCase:
pre_result = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
if (platform.system().lower() == 'windows' and pre_result.dtype == 'int32'):
pre_result = np.array(pre_result, dtype = 'int64')
pre_mavg = pre_mavg = np.convolve(pre_result, np.ones(k), "valid")[offset_val:]/k
tdSql.query(self.mavg_query_form(
sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
......@@ -669,7 +669,7 @@ class TDTestCase:
tdSql.checkData(0,0,1.000000000)
tdSql.checkData(1,0,1.000000000)
tdSql.checkData(5,0,1.000000000)
tdSql.query("select mavg(abs(c1),1) from t1")
tdSql.checkRows(4)
......@@ -688,17 +688,17 @@ class TDTestCase:
tdSql.query("select mavg(st1+c1,3) from stb1 partition by tbname")
tdSql.checkRows(20)
# # bug need fix
# # bug need fix
# tdSql.query("select mavg(st1+c1,3) from stb1 partition by tbname slimit 1 ")
# tdSql.checkRows(2)
# tdSql.error("select mavg(st1+c1,3) from stb1 partition by tbname limit 1 ")
# bug need fix
# bug need fix
tdSql.query("select mavg(st1+c1,3) from stb1 partition by tbname")
tdSql.checkRows(20)
# bug need fix
# bug need fix
# tdSql.query("select tbname , mavg(c1,3) from stb1 partition by tbname")
# tdSql.checkRows(38)
# tdSql.query("select tbname , mavg(st1,3) from stb1 partition by tbname")
......@@ -706,7 +706,7 @@ class TDTestCase:
# tdSql.query("select tbname , mavg(st1,3) from stb1 partition by tbname slimit 1")
# tdSql.checkRows(2)
# partition by tags
# partition by tags
# tdSql.query("select st1 , mavg(c1,3) from stb1 partition by st1")
# tdSql.checkRows(38)
# tdSql.query("select mavg(c1,3) from stb1 partition by st1")
......@@ -743,4 +743,4 @@ class TDTestCase:
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
......@@ -5,7 +5,7 @@ import numpy as np
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143,
"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 }
......@@ -19,15 +19,15 @@ class TDTestCase:
self.nchar_str = '涛思数据'
def max_check_stb_and_tb_base(self):
tdSql.prepare()
intData = []
intData = []
floatData = []
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, 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)) tags(loc nchar(20))''')
tdSql.execute("create table stb_1 using stb tags('beijing')")
for i in range(self.rowNum):
tdSql.execute(f"insert into stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')"
% (self.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))
intData.append(i + 1)
intData.append(i + 1)
floatData.append(i + 0.1)
for i in ['ts','col11','col12','col13']:
for j in ['db.stb','stb','db.stb_1','stb_1']:
......@@ -45,17 +45,17 @@ class TDTestCase:
tdSql.query("select max(col1) from stb where col2<=5")
tdSql.checkData(0,0,5)
tdSql.execute('drop database db')
def max_check_ntb_base(self):
tdSql.prepare()
intData = []
intData = []
floatData = []
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, 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))''')
for i in range(self.rowNum):
tdSql.execute(f"insert into ntb values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')"
% (self.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))
intData.append(i + 1)
intData.append(i + 1)
floatData.append(i + 0.1)
for i in ['ts','col11','col12','col13']:
for j in ['db.ntb','ntb']:
......@@ -79,7 +79,7 @@ class TDTestCase:
same_sql = f"select {col_name} from {tbname} order by {col_name} desc limit 1"
tdSql.query(max_sql)
max_result = tdSql.queryResult
max_result = tdSql.queryResult
tdSql.query(same_sql)
same_result = tdSql.queryResult
......@@ -91,7 +91,7 @@ class TDTestCase:
def support_distributed_aggregate(self):
# prepate datas for 20 tables distributed at different vgroups
tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5")
tdSql.execute(" use testdb ")
......@@ -161,17 +161,17 @@ class TDTestCase:
vgroups = tdSql.queryResult
vnode_tables={}
for vgroup_id in vgroups:
vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query("show tables like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
vnode_tables[table_name[6]].append(table_name[0])
vnode_tables[table_name[6]].append(table_name[0])
count = 0
for k ,v in vnode_tables.items():
......@@ -180,8 +180,8 @@ class TDTestCase:
if count < 2:
tdLog.exit(" the datas of all not satisfy sub_table has been distributed ")
# check max function work status
# check max function work status
tdSql.query("show tables like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
......@@ -190,23 +190,23 @@ class TDTestCase:
tdSql.query("desc stb1")
col_names = tdSql.queryResult
colnames = []
for col_name in col_names:
if col_name[1] in ["INT" ,"BIGINT" ,"SMALLINT" ,"TINYINT" , "FLOAT" ,"DOUBLE"]:
colnames.append(col_name[0])
for tablename in tablenames:
for colname in colnames:
self.check_max_functions(tablename,colname)
# max function with basic filter
# max function with basic filter
print(vnode_tables)
def run(self):
def run(self):
# max verifacation
# max verifacation
self.max_check_stb_and_tb_base()
self.max_check_ntb_base()
......
......@@ -12,30 +12,30 @@ class TDTestCase:
self.rowNum = 10
self.ts = 1537146000000
def run(self):
tdSql.prepare()
intData = []
intData = []
floatData = []
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))''')
tdSql.execute("create table stb_1 using stb tags('beijing')")
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
tdSql.execute('''create table ntb(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)''')
for i in range(self.rowNum):
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
intData.append(i + 1)
floatData.append(i + 0.1)
for i in range(self.rowNum):
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
intData.append(i + 1)
floatData.append(i + 0.1)
# max verifacation
# max verifacation
tdSql.error("select min(ts) from stb_1")
tdSql.error("select min(ts) from db.stb_1")
tdSql.error("select min(col7) from stb_1")
......@@ -206,7 +206,7 @@ class TDTestCase:
tdSql.query("select min(col1) from ntb where col2>=5")
tdSql.checkData(0,0,5)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -23,10 +23,10 @@ from util.dnodes import tdDnodes
from util.dnodes import *
class TDTestCase:
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......@@ -34,28 +34,28 @@ class TDTestCase:
testcasePath = os.path.split(__file__)[0]
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf %s/%s.sql" % (testcasePath,testcaseFilename))
now = time.time()
self.ts = int(round(now * 1000))
self.num = 10
self.fornum = 5
# def case_common(self):
# db = "nested"
# self.dropandcreateDB("%s" % db, 1)
# db = "nested"
# self.dropandcreateDB("%s" % db, 1)
# conn1 = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos/")
# cur1 = conn1.cursor()
# cur1 = conn1.cursor()
# cur1.execute('use "%s";' %self.db)
# sql = 'select * from stable_1 limit 5;'
# cur1.execute(sql)
# return(conn1,cur1)
# return(conn1,cur1)
def data_matrix_equal(self, sql1,row1_s,row1_e,col1_s,col1_e, sql2,row2_s,row2_e,col2_s,col2_e):
# ----row1_start----col1_start----
# - - - - 是一个矩阵内的数据相等- - -
# - - - - - - - - - - - - - - - -
# - - - - 是一个矩阵内的数据相等- - -
# - - - - - - - - - - - - - - - -
# ----row1_end------col1_end------
self.sql1 = sql1
list1 =[]
......@@ -67,9 +67,9 @@ class TDTestCase:
#print("data=%s" %(tdSql.getData(i1,j1)))
list1.append(tdSql.getData(i1,j1))
print("=====list1-------list1---=%s" %set(list1))
tdSql.execute("reset query cache;")
self.sql2 = sql2
self.sql2 = sql2
list2 =[]
tdSql.query(sql2)
for i2 in range(row2_s-1,row2_e):
......@@ -78,8 +78,8 @@ class TDTestCase:
#print("jjjj222=%d"%j2)
#print("data=%s" %(tdSql.getData(i2,j2)))
list2.append(tdSql.getData(i2,j2))
print("=====list2-------list2---=%s" %set(list2))
print("=====list2-------list2---=%s" %set(list2))
if (list1 == list2) and len(list2)>0:
# print(("=====matrix===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
tdLog.info(("===matrix===sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2))
......@@ -105,7 +105,7 @@ class TDTestCase:
print(("=====matrix_error===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
tdLog.info(("sql1:'%s' matrix_result != sql2:'%s' matrix_result") %(sql1,sql2))
return tdSql.checkEqual(list1,list2)
def restartDnodes(self):
pass
# tdDnodes.stop(1)
......@@ -125,7 +125,7 @@ class TDTestCase:
tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
......@@ -133,35 +133,35 @@ class TDTestCase:
tdSql.execute('''create stable stable_null_childtable (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
#tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '0' , '0' , '0' , '0' , 0 , 'binary1' , 'nchar1' , '0' , '0' ,'0') ;''')
tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_1_2 using stable_1 tags('stable_1_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\') ;''')
tdSql.execute('''create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\') ;''')
#tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
# tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,'0') ;''')
# tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
# tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,\'2099-09-09 09:09:09.090\') ;''')
tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
#regular table
tdSql.execute('''create table regular_table_1 \
......@@ -179,50 +179,50 @@ class TDTestCase:
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
for i in range(num_random*n):
tdSql.execute('''insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
for i in range(num_random*n):
tdSql.execute('''insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) ,
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) ,
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) ,
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) ,
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i +1))
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i +1))
tdSql.execute('''insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
tdSql.execute('''insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
% (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
# tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
# % (ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
# fake.random_int(min=-9223372036854775807, max=0, step=1),
# fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
# tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
# % (ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
# fake.random_int(min=-9223372036854775807, max=0, step=1),
# fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
# fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i))
tdSql.query("select count(*) from stable_1;")
......@@ -234,9 +234,9 @@ class TDTestCase:
def run(self):
tdSql.prepare()
os.system("rm -rf nestedQuery3.py.sql")
startTime = time.time()
startTime = time.time()
db = "nest"
self.dropandcreateDB_random("%s" %db, 1)
......@@ -252,11 +252,11 @@ class TDTestCase:
qt_select= q_select + t_select
# distinct regular column select
dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' ,
dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' ,
'distinct q_bool' , 'distinct q_binary' , 'distinct q_nchar' ,'distinct q_float' , 'distinct q_double' ,'distinct q_ts ']
# distinct tag column select
dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' ,
dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' ,
'distinct t_bool' , 'distinct t_binary' , 'distinct t_nchar' ,'distinct t_float' , 'distinct t_double' ,'distinct t_ts ']
# distinct regular and tag column select
......@@ -267,12 +267,12 @@ class TDTestCase:
s_s_select= ['tbname' , '_rowts' , '_c0', '_C0' ]
unionall_or_union= [ ' union ' , ' union all ' ]
# regular column where
# regular column where
q_where = ['ts < now +1s','q_bigint >= -9223372036854775807 and q_bigint <= 9223372036854775807', 'q_int <= 2147483647 and q_int >= -2147483647',
'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308',
'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' ,
'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308',
'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' ,
'q_bool = true or q_bool = false' , 'q_bool in (0 , 1)' , 'q_bool in ( true , false)' , 'q_bool = 0 or q_bool = 1',
'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767',
'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767',
'q_tinyint between -127 and 127 ','q_float >= -3.4E38 ','q_float <= 3.4E38 ','q_double >= -1.7E308 ',
'q_double <= 1.7E308 ','q_float between -3.4E38 and 3.4E38 ','q_double between -1.7E308 and 1.7E308 ' ,
'q_float is not null ' ,'q_double is not null ' ,]
......@@ -284,33 +284,33 @@ class TDTestCase:
't1.q_smallint >= -32767 and t1.q_smallint <= 32767 and t2.q_smallint >= -32767 and t2.q_smallint <= 32767',
't1.q_tinyint >= -127 and t1.q_tinyint <= 127 and t2.q_tinyint >= -127 and t2.q_tinyint <= 127',
't1.q_float >= - 1.7E308 and t1.q_float <= 1.7E308 and t2.q_float >= - 1.7E308 and t2.q_float <= 1.7E308',
't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308',
't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' ,
't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' ,
't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' ,
't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308',
't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' ,
't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' ,
't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' ,
't1.q_bigint between -9223372036854775807 and 9223372036854775807 and t2.q_bigint between -9223372036854775807 and 9223372036854775807',
't1.q_int between -2147483647 and 2147483647 and t2.q_int between -2147483647 and 2147483647',
't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767',
't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767',
't1.q_tinyint between -127 and 127 and t2.q_tinyint between -127 and 127 ','t1.q_float between -1.7E308 and 1.7E308 and t2.q_float between -1.7E308 and 1.7E308',
't1.q_double between -1.7E308 and 1.7E308 and t2.q_double between -1.7E308 and 1.7E308']
#TD-6201 ,'t1.q_bool between 0 and 1 or t2.q_bool between 0 and 1']
#'t1.q_bool = true and t1.q_bool = false and t2.q_bool = true and t2.q_bool = false' , 't1.q_bool = 0 and t1.q_bool = 1 and t2.q_bool = 0 and t2.q_bool = 1' ,
q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' ,
'(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' ,
q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' ,
'(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' ,
'(t1.q_bool in (0 , 1) or t2.q_bool in (0 , 1))' , '(t1.q_bool in ( true , false) or t2.q_bool in ( true , false))' , '(t1.q_bool = 0 or t1.q_bool = 1 or t2.q_bool = 0 or t2.q_bool = 1)' ,
'(t1.q_bigint between -9223372036854775807 and 9223372036854775807 or t2.q_bigint between -9223372036854775807 and 9223372036854775807)',
'(t1.q_int between -2147483647 and 2147483647 or t2.q_int between -2147483647 and 2147483647)',
'(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)',
'(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)',
'(t1.q_tinyint between -127 and 127 or t2.q_tinyint between -127 and 127 )','(t1.q_float between -1.7E308 and 1.7E308 or t2.q_float between -1.7E308 and 1.7E308)',
'(t1.q_double between -1.7E308 and 1.7E308 or t2.q_double between -1.7E308 and 1.7E308)']
# tag column where
t_where = ['ts < now +1s','t_bigint >= -9223372036854775807 and t_bigint <= 9223372036854775807','t_int <= 2147483647 and t_int >= -2147483647',
't_smallint >= -32767 and t_smallint <= 32767','q_tinyint >= -127 and t_tinyint <= 127','t_float >= -1.7E308 and t_float <= 1.7E308',
't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' ,
't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' ,
't_bool = true or t_bool = false' , 't_bool in (0 , 1)' , 't_bool in ( true , false)' , 't_bool = 0 or t_bool = 1',
't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767',
't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767',
't_tinyint between -127 and 127 ','t_float between -1.7E308 and 1.7E308','t_double between -1.7E308 and 1.7E308']
#TD-6201,'t_bool between 0 and 1'
......@@ -320,27 +320,27 @@ class TDTestCase:
't1.t_smallint >= -32767 and t1.t_smallint <= 32767 and t2.t_smallint >= -32767 and t2.t_smallint <= 32767',
't1.t_tinyint >= -127 and t1.t_tinyint <= 127 and t2.t_tinyint >= -127 and t2.t_tinyint <= 127',
't1.t_float >= -1.7E308 and t1.t_float <= 1.7E308 and t2.t_float >= -1.7E308 and t2.t_float <= 1.7E308',
't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308',
'(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' ,
'(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308',
'(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' ,
'(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
't1.t_bool in (0 , 1) and t2.t_bool in (0 , 1)' , 't1.t_bool in ( true , false) and t2.t_bool in ( true , false)' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)',
't1.t_bigint between -9223372036854775807 and 9223372036854775807 and t2.t_bigint between -9223372036854775807 and 9223372036854775807',
't1.t_int between -2147483647 and 2147483647 and t2.t_int between -2147483647 and 2147483647',
't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767',
't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767',
'(t1.t_tinyint between -127 and 127 and t2.t_tinyint between -127 and 127) ','t1.t_float between -1.7E308 and 1.7E308 and t2.t_float between -1.7E308 and 1.7E308',
'(t1.t_double between -1.7E308 and 1.7E308 and t2.t_double between -1.7E308 and 1.7E308)']
#TD-6201,'t1.t_bool between 0 and 1 or t2.q_bool between 0 and 1']
t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' ,
'(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' ,
'(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
'(t1.t_bool in (0 , 1) or t2.t_bool in (0 , 1))' , '(t1.t_bool in ( true , false) or t2.t_bool in ( true , false))' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)',
'(t1.t_bigint between -9223372036854775807 and 9223372036854775807 or t2.t_bigint between -9223372036854775807 and 9223372036854775807)',
'(t1.t_int between -2147483647 and 2147483647 or t2.t_int between -2147483647 and 2147483647)',
'(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)',
'(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)',
'(t1.t_tinyint between -127 and 127 or t2.t_tinyint between -127 and 127 )','(t1.t_float between -1.7E308 and 1.7E308 or t2.t_float between -1.7E308 and 1.7E308)',
'(t1.t_double between -1.7E308 and 1.7E308 or t2.t_double between -1.7E308 and 1.7E308)']
# regular and tag column where
# regular and tag column where
qt_where = q_where + t_where
qt_u_where = q_u_where + t_u_where
# now,qt_u_or_where is not support
......@@ -354,78 +354,78 @@ class TDTestCase:
session_where = ['session(ts,10a)' , 'session(ts,10s)', 'session(ts,10m)' , 'session(ts,10h)','session(ts,10d)' , 'session(ts,10w)']
session_u_where = ['session(t1.ts,10a)' , 'session(t1.ts,10s)', 'session(t1.ts,10m)' , 'session(t1.ts,10h)','session(t1.ts,10d)' , 'session(t1.ts,10w)',
'session(t2.ts,10a)' , 'session(t2.ts,10s)', 'session(t2.ts,10m)' , 'session(t2.ts,10h)','session(t2.ts,10d)' , 'session(t2.ts,10w)']
fill_where = ['FILL(NONE)','FILL(PREV)','FILL(NULL)','FILL(LINEAR)','FILL(NEXT)','FILL(VALUE, 1.23)']
state_window = ['STATE_WINDOW(q_tinyint)','STATE_WINDOW(q_bigint)','STATE_WINDOW(q_int)','STATE_WINDOW(q_bool)','STATE_WINDOW(q_smallint)']
state_u_window = ['STATE_WINDOW(t1.q_tinyint)','STATE_WINDOW(t1.q_bigint)','STATE_WINDOW(t1.q_int)','STATE_WINDOW(t1.q_bool)','STATE_WINDOW(t1.q_smallint)',
'STATE_WINDOW(t2.q_tinyint)','STATE_WINDOW(t2.q_bigint)','STATE_WINDOW(t2.q_int)','STATE_WINDOW(t2.q_bool)','STATE_WINDOW(t2.q_smallint)']
# order by where
# order by where
order_where = ['order by ts' , 'order by ts asc']
order_u_where = ['order by t1.ts' , 'order by t1.ts asc' , 'order by t2.ts' , 'order by t2.ts asc']
order_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' ]
orders_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' , 'order by loc' , 'order by loc asc' , 'order by loc desc']
group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint',
group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint',
'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint',
'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' ,
'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint',
'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double ']
group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint',
group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint',
'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint',
'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' ,
'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint',
'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ',
'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint',
'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint',
'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint',
'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ,
'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint',
'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint',
'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double ']
partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint',
'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ',
'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint',
'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint',
group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint',
'group by tbname,q_float', 'group by tbname,q_double' , 'group by tbname,q_binary', 'group by tbname,q_nchar', 'group by tbname,q_bool' ,'group by tbname ,q_bigint',
'group by tbname,q_binary ,q_nchar ,q_bool' , 'group by tbname,q_int ,q_smallint ,q_tinyint' , 'group by tbname,q_float ,q_double ' ,
'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint',
'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double ']
group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint',
group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint',
'group by t1.q_float', 'group by t1.q_double' , 'group by t1.q_binary', 'group by t1.q_nchar', 'group by t1.q_bool' ,'group by t1.q_bigint',
'group by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'group by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'group by t1.q_float ,t1.q_double ' ,
'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint',
'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ',
'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint',
'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint',
'group by t2.q_float', 'group by t2.q_double' , 'group by t2.q_binary', 'group by t2.q_nchar', 'group by t2.q_bool' ,'group by t2.q_bigint',
'group by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'group by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'group by t2.q_float ,t2.q_double ' ,
'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint',
'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint',
'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double ']
partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint',
'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ',
'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint',
'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
having_support = ['having count(q_int) > 0','having count(q_bigint) > 0','having count(q_smallint) > 0','having count(q_tinyint) > 0','having count(q_float) > 0','having count(q_double) > 0','having count(q_bool) > 0',
'having avg(q_int) > 0','having avg(q_bigint) > 0','having avg(q_smallint) > 0','having avg(q_tinyint) > 0','having avg(q_float) > 0','having avg(q_double) > 0',
'having sum(q_int) > 0','having sum(q_bigint) > 0','having sum(q_smallint) > 0','having sum(q_tinyint) > 0','having sum(q_float) > 0','having sum(q_double) > 0',
......@@ -440,9 +440,9 @@ class TDTestCase:
having_not_support = ['having TOP(q_int,10) > 0','having TOP(q_bigint,10) > 0','having TOP(q_smallint,10) > 0','having TOP(q_tinyint,10) > 0','having TOP(q_float,10) > 0','having TOP(q_double,10) > 0','having TOP(q_bool,10) > 0',
'having BOTTOM(q_int,10) > 0','having BOTTOM(q_bigint,10) > 0','having BOTTOM(q_smallint,10) > 0','having BOTTOM(q_tinyint,10) > 0','having BOTTOM(q_float,10) > 0','having BOTTOM(q_double,10) > 0','having BOTTOM(q_bool,10) > 0',
'having LEASTSQUARES(q_int) > 0','having LEASTSQUARES(q_bigint) > 0','having LEASTSQUARES(q_smallint) > 0','having LEASTSQUARES(q_tinyint) > 0','having LEASTSQUARES(q_float) > 0','having LEASTSQUARES(q_double) > 0','having LEASTSQUARES(q_bool) > 0',
'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0',
'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0',
'having PERCENTILE(q_int,10) > 0','having PERCENTILE(q_bigint,10) > 0','having PERCENTILE(q_smallint,10) > 0','having PERCENTILE(q_tinyint,10) > 0','having PERCENTILE(q_float,10) > 0','having PERCENTILE(q_double,10) > 0']
having_tagnot_support = ['having LAST_ROW(q_int) > 0','having LAST_ROW(q_bigint) > 0','having LAST_ROW(q_smallint) > 0','having LAST_ROW(q_tinyint) > 0','having LAST_ROW(q_float) > 0','having LAST_ROW(q_double) > 0']
having_tagnot_support = ['having LAST_ROW(q_int) > 0','having LAST_ROW(q_bigint) > 0','having LAST_ROW(q_smallint) > 0','having LAST_ROW(q_tinyint) > 0','having LAST_ROW(q_float) > 0','having LAST_ROW(q_double) > 0']
having_support_j = ['having count(t1.q_int) > 0','having count(t1.q_bigint) > 0','having count(t1.q_smallint) > 0','having count(t1.q_tinyint) > 0','having count(t1.q_float) > 0','having count(t1.q_double) > 0','having count(t1.q_bool) > 0',
'having avg(t1.q_int) > 0','having avg(t1.q_bigint) > 0','having avg(t1.q_smallint) > 0','having avg(t1.q_tinyint) > 0','having avg(t1.q_float) > 0','having avg(t1.q_double) > 0',
......@@ -455,7 +455,7 @@ class TDTestCase:
'having FIRST(t1.q_int) > 0','having FIRST(t1.q_bigint) > 0','having FIRST(t1.q_smallint) > 0','having FIRST(t1.q_tinyint) > 0','having FIRST(t1.q_float) > 0','having FIRST(t1.q_double) > 0',
'having LAST(t1.q_int) > 0','having LAST(t1.q_bigint) > 0','having LAST(t1.q_smallint) > 0','having LAST(t1.q_tinyint) > 0','having LAST(t1.q_float) > 0','having LAST(t1.q_double) > 0',
'having APERCENTILE(t1.q_int,10) > 0','having APERCENTILE(t1.q_bigint,10) > 0','having APERCENTILE(t1.q_smallint,10) > 0','having APERCENTILE(t1.q_tinyint,10) > 0','having APERCENTILE(t1.q_float,10) > 0','having APERCENTILE(t1.q_double,10) > 0']
# limit offset where
limit_where = ['limit 1 offset 1' , 'limit 1' , 'limit 2 offset 1' , 'limit 2', 'limit 12 offset 1' , 'limit 20', 'limit 20 offset 10' , 'limit 200']
limit1_where = ['limit 1 offset 1' , 'limit 1' ]
......@@ -464,8 +464,8 @@ class TDTestCase:
# slimit soffset where
slimit_where = ['slimit 1 soffset 1' , 'slimit 1' , 'slimit 2 soffset 1' , 'slimit 2']
slimit1_where = ['slimit 2 soffset 1' , 'slimit 1' ]
# aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\]
# aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\]
# select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile]
# calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\]
# **_ns_** express is not support stable, therefore, separated from regular tables
......@@ -475,7 +475,7 @@ class TDTestCase:
# calc_select_all calc_select_regular calc_select_in_ts calc_select_fill calc_select_not_interval
# select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile]
calc_select_all = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' ,
'first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' ,
......@@ -483,7 +483,7 @@ class TDTestCase:
'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ,
'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)']
calc_select_in_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
......@@ -494,23 +494,23 @@ class TDTestCase:
calc_select_in = ['min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ,
'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)']
calc_select_not_support_ts = ['first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' ,
'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)',
'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)']
'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)']
calc_select_support_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' ,
'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ]
calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)']
calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)']
interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\'']
......@@ -535,28 +535,28 @@ class TDTestCase:
]
calc_select_in_not_support_ts_j = ['apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' ,
'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' ,
'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' ,
'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)']
calc_select_in_j = ['min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' ,
'max(t1.q_int)' , 'max(t1.q_bigint)' , 'max(t1.q_smallint)' , 'max(t1.q_tinyint)' ,'max(t1.q_float)' ,'max(t1.q_double)' ,
'apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' ,
'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' ,
'min(t2.q_int)' , 'min(t2.q_bigint)' , 'min(t2.q_smallint)' , 'min(t2.q_tinyint)' , 'min(t2.q_float)' ,'min(t2.q_double)' ,
'max(t2.q_int)' , 'max(t2.q_bigint)' , 'max(t2.q_smallint)' , 'max(t2.q_tinyint)' ,'max(t2.q_float)' ,'max(t2.q_double)' ,
'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' ,
'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)']
'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)']
calc_select_all_j = calc_select_in_ts_j + calc_select_in_j
calc_select_regular_j = [ 'PERCENTILE(t1.q_int,10)' ,'PERCENTILE(t1.q_bigint,20)' , 'PERCENTILE(t1.q_smallint,30)' ,'PERCENTILE(t1.q_tinyint,40)' ,'PERCENTILE(t1.q_float,50)' ,'PERCENTILE(t1.q_double,60)' ,
'PERCENTILE(t2.q_int,10)' ,'PERCENTILE(t2.q_bigint,20)' , 'PERCENTILE(t2.q_smallint,30)' ,'PERCENTILE(t2.q_tinyint,40)' ,'PERCENTILE(t2.q_float,50)' ,'PERCENTILE(t2.q_double,60)']
calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' ,
'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)']
interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' ,
......@@ -578,7 +578,7 @@ class TDTestCase:
'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)']
calc_aggregate_groupbytbname = ['twa(q_int)' ,'twa(q_bigint)' , 'twa(q_smallint)' ,'twa(q_tinyint)' ,'twa (q_float)' ,'twa(q_double)' ,
'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)' ]
'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)' ]
#two table join
calc_aggregate_all_j = ['count(t1.*)' , 'count(t1.q_int)' ,'count(t1.q_bigint)' , 'count(t1.q_smallint)' ,'count(t1.q_tinyint)' ,'count(t1.q_float)' ,
......@@ -606,18 +606,18 @@ class TDTestCase:
calc_aggregate_groupbytbname_j = ['twa(t1.q_int)' ,'twa(t1.q_bigint)' , 'twa(t1.q_smallint)' ,'twa(t1.q_tinyint)' ,'twa (t1.q_float)' ,'twa(t1.q_double)' ,
'IRATE(t1.q_int)' ,'IRATE(t1.q_bigint)' , 'IRATE(t1.q_smallint)' ,'IRATE(t1.q_tinyint)' ,'IRATE (t1.q_float)' ,'IRATE(t1.q_double)' ,
'twa(t2.q_int)' ,'twa(t2.q_bigint)' , 'twa(t2.q_smallint)' ,'twa(t2.q_tinyint)' ,'twa (t2.q_float)' ,'twa(t2.q_double)' ,
'IRATE(t2.q_int)' ,'IRATE(t2.q_bigint)' , 'IRATE(t2.q_smallint)' ,'IRATE(t2.q_tinyint)' ,'IRATE (t2.q_float)' ,'IRATE(t2.q_double)' ]
'IRATE(t2.q_int)' ,'IRATE(t2.q_bigint)' , 'IRATE(t2.q_smallint)' ,'IRATE(t2.q_tinyint)' ,'IRATE (t2.q_float)' ,'IRATE(t2.q_double)' ]
# calc_calculate_all calc_calculate_regular calc_calculate_groupbytbname
# calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\]
calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' ,
calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' ,
'(SPREAD(q_int) + SPREAD(q_bigint))' , '(SPREAD(q_smallint) - SPREAD(q_float))', '(SPREAD(q_double) * SPREAD(q_tinyint))' , '(SPREAD(q_double) / SPREAD(q_float))']
calc_calculate_regular = ['DIFF(q_int)' ,'DIFF(q_bigint)' , 'DIFF(q_smallint)' ,'DIFF(q_tinyint)' ,'DIFF(q_float)' ,'DIFF(q_double)' ,
'DIFF(q_int,0)' ,'DIFF(q_bigint,0)' , 'DIFF(q_smallint,0)' ,'DIFF(q_tinyint,0)' ,'DIFF(q_float,0)' ,'DIFF(q_double,0)' ,
'DIFF(q_int,1)' ,'DIFF(q_bigint,1)' , 'DIFF(q_smallint,1)' ,'DIFF(q_tinyint,1)' ,'DIFF(q_float,1)' ,'DIFF(q_double,1)' ,
'DERIVATIVE(q_int,15s,0)' , 'DERIVATIVE(q_bigint,10s,1)' , 'DERIVATIVE(q_smallint,20s,0)' ,'DERIVATIVE(q_tinyint,10s,1)' ,'DERIVATIVE(q_float,6s,0)' ,'DERIVATIVE(q_double,3s,1)' ]
calc_calculate_groupbytbname = calc_calculate_regular
#two table join
calc_calculate_all_j = ['SPREAD(t1.ts)' , 'SPREAD(t1.q_ts)' , 'SPREAD(t1.q_int)' ,'SPREAD(t1.q_bigint)' , 'SPREAD(t1.q_smallint)' ,'SPREAD(t1.q_tinyint)' ,'SPREAD(t1.q_float)' ,'SPREAD(t1.q_double)' ,
'SPREAD(t2.ts)' , 'SPREAD(t2.q_ts)' , 'SPREAD(t2.q_int)' ,'SPREAD(t2.q_bigint)' , 'SPREAD(t2.q_smallint)' ,'SPREAD(t2.q_tinyint)' ,'SPREAD(t2.q_float)' ,'SPREAD(t2.q_double)' ,
......@@ -646,17 +646,17 @@ class TDTestCase:
#sql = "select ts , * from ( select " ===暂时不支持select * ,用下面这一行
sql = "select ts from ( select "
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(q_select)
sql += "ts from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(100)
#1 outer union not support
#1 outer union not support
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 1-2 from stable_1;")
for i in range(self.fornum):
......@@ -677,11 +677,11 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(100)
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 1-2 from stable_1;")
for i in range(self.fornum):
......@@ -702,11 +702,11 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(200)
#1 inter union not support
tdSql.query("select 1-3 from stable_1;")
for i in range(self.fornum):
......@@ -716,7 +716,7 @@ class TDTestCase:
sql += "%s, " % random.choice(q_select)
sql += "ts from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += ""
sql += ""
sql += " union select "
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
......@@ -724,8 +724,8 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15606 tdSql.query(sql)
# tdSql.checkRows(200)
tdSql.query("select 1-3 from stable_1;")
......@@ -743,60 +743,60 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15607 tdSql.query(sql)
# tdSql.checkRows(300)
#join:TD-6020\TD-6149 select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by)
#join:TD-6020\TD-6149 select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by)
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 1-4 from stable_1;")
for i in range(self.fornum):
#sql = "select ts , * from ( select t1.ts ,"
sql = "select * from ( select t1.ts ,"
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(order_u_where)
sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(100)
tdSql.query("select 1-5 from stable_1;")
for i in range(self.fornum):
sql = "select ts , * from ( select t1.ts ,"
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(order_u_where)
sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
# TD-15587 tdSql.query(sql)
# tdSql.checkRows(100)
#2 select column from (select * form regular_table ) where <\>\in\and\or order by
#2 select column from (select * form regular_table ) where <\>\in\and\or order by
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 2-1 from stable_1;")
for i in range(self.fornum):
sql = "select ts ,"
sql += "%s, " % random.choice(s_r_select)
sql += "%s " % random.choice(q_select)
sql += "%s " % random.choice(q_select)
sql += " from ( select * from regular_table_1 ) where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += " ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(100)
......@@ -805,31 +805,31 @@ class TDTestCase:
tdSql.query("select 2-2 from stable_1;")
for i in range(self.fornum):
sql = "select ts , * from ( select t1.ts ,"
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 ) where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(order_u_where)
#sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
#3 select * from (select column\tag form stable where <\>\in\and\or order by )
#3 select * from (select column\tag form stable where <\>\in\and\or order by )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 3-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(t_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(t_select)
sql += "ts from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(300)
......@@ -839,35 +839,35 @@ class TDTestCase:
sql += "%s " % random.choice(s_r_select)
sql += "from ( select "
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(t_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(t_select)
sql += "ts from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(300)
# select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by )
# select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 3-2 from stable_1;")
for i in range(self.fornum):
sql = "select ts , * from ( select t1.ts , "
sql += "t1.%s, " % random.choice(s_s_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(s_s_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(s_s_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(s_s_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(order_u_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
# TD-15609 tdSql.query(sql)
# tdSql.checkRows(100)
#3 outer union not support
rsDn = self.restartDnodes()
tdSql.query("select 3-3 from stable_1;")
......@@ -887,8 +887,8 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(200)
for i in range(self.fornum):
......@@ -907,11 +907,11 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(400)
#3 inter union not support
tdSql.query("select 3-4 from stable_1;")
for i in range(self.fornum):
......@@ -929,57 +929,57 @@ class TDTestCase:
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += ")"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
#join:select * from (select column form stable1,stable2 where t1.ts=t2.ts and <\>\in\and\or order by)
tdSql.query("select 3-5 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select t1.ts ,"
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_u_where)
sql += "%s " % random.choice(order_u_where)
sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
# TD-15609 tdSql.query(sql)
# tdSql.checkRows(100)
tdSql.query("select 3-6 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select t1.ts ,"
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t1.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.%s, " % random.choice(q_select)
sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_u_or_where)
sql += "%s " % random.choice(order_u_where)
sql += ");"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
# TD-15609 同上 tdSql.query(sql)
# tdSql.checkRows(100)
#4 select column from (select * form stable where <\>\in\and\or order by )
#4 select column from (select * form stable where <\>\in\and\or order by )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 4-1 from stable_1;")
for i in range(self.fornum):
sql = "select ts , "
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
sql += "%s " % random.choice(t_select)
sql += "%s, " % random.choice(q_select)
sql += "%s " % random.choice(t_select)
sql += " from ( select * from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15616 tdSql.query(sql)
# tdSql.checkRows(300)
......@@ -992,8 +992,8 @@ class TDTestCase:
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15500 tdSql.query(sql)
#5-1 select distinct column\tag from (select calc form stable where <\>\in\and\or order by limit offset )
......@@ -1001,13 +1001,13 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select distinct c5_1 "
sql += " from ( select "
sql += "%s " % random.choice(calc_select_in_ts)
sql += "%s " % random.choice(calc_select_in_ts)
sql += " as c5_1 from stable_1 where "
sql += "%s " % random.choice(qt_where)
#sql += "%s " % random.choice(order_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#tdSql.checkRows(1)有的函数还没有提交,会不返回结果,先忽略
......@@ -1020,8 +1020,8 @@ class TDTestCase:
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_desc_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
tdSql.query("select 6-1 from stable_1;")
for i in range(self.fornum):
......@@ -1029,8 +1029,8 @@ class TDTestCase:
sql += "%s " % random.choice(dt_select)
sql += " from stable_1 where "
sql += "%s ) ;" % random.choice(qt_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#tdSql.checkRows(1)#数量不一致,不在校验
......@@ -1044,8 +1044,8 @@ class TDTestCase:
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[0] , limit_where[1]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql) #distinct 和 order by 不能混合使用
tdSql.query("select 7-1 from stable_1;")
for i in range(self.fornum):
......@@ -1056,166 +1056,166 @@ class TDTestCase:
#sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[0] , limit_where[1]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
#calc_select,TWA/Diff/Derivative/Irate are not allowed to apply to super table directly
#8 select * from (select ts,calc form ragular_table where <\>\in\and\or order by )
# dcDB = self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 8-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select ts ,"
sql += "%s " % random.choice(calc_select_support_ts)
sql += "%s " % random.choice(calc_select_support_ts)
sql += "from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
tdSql.query("select 8-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_not_support_ts)
sql += "%s " % random.choice(calc_select_not_support_ts)
sql += "from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_in_ts)
sql += "%s " % random.choice(calc_select_in_ts)
sql += "from regular_table_1 where "
sql += "%s " % random.choice(q_where)
#sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
##top返回结果有问题nest.sql tdSql.checkRows(1)
tdSql.query("select 8-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select t1.ts, "
sql += "%s " % random.choice(calc_select_in_support_ts_j)
sql += "%s " % random.choice(calc_select_in_support_ts_j)
sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)# 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)# 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_in_not_support_ts_j)
sql += "%s " % random.choice(calc_select_in_not_support_ts_j)
sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
##top返回结果有问题 tdSql.checkRows(1)
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
##top返回结果有问题 tdSql.checkRows(1)
#9 select * from (select ts,calc form stable where <\>\in\and\or order by )
#9 select * from (select ts,calc form stable where <\>\in\and\or order by )
# self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 9-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_not_support_ts)
sql += "%s " % random.choice(calc_select_not_support_ts)
sql += "from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
tdSql.query("select 9-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select ts ,"
sql += "%s " % random.choice(calc_select_support_ts)
sql += "%s " % random.choice(calc_select_support_ts)
sql += "from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 9-3 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_in_not_support_ts_j)
sql += "%s " % random.choice(calc_select_in_not_support_ts_j)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += " and %s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
tdSql.query("select 9-4 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select t1.ts,"
sql += "%s " % random.choice(calc_select_in_support_ts_j)
sql += "%s " % random.choice(calc_select_in_support_ts_j)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += " and %s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#10 select calc from (select * form regualr_table where <\>\in\and\or order by )
#10 select calc from (select * form regualr_table where <\>\in\and\or order by )
tdSql.query("select 10-1 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_in_ts)
sql = "select "
sql += "%s " % random.choice(calc_select_in_ts)
sql += "as calc10_1 from ( select * from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
#10-1 select calc from (select * form regualr_table where <\>\in\and\or order by )
# rsDn = self.restartDnodes()
# rsDn = self.restartDnodes()
# self.dropandcreateDB_random("%s" %db, 1)
# rsDn = self.restartDnodes()
tdSql.query("select 10-2 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_all)
sql = "select "
sql += "%s " % random.choice(calc_select_all)
sql += "as calc10_2 from ( select * from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
# tdSql.checkRows(1)
#10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by )
#10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by )
tdSql.query("select 10-3 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s as calc10_3 " % random.choice(calc_select_all)
sql = "select "
sql += "%s as calc10_3 " % random.choice(calc_select_all)
sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += " and %s " % random.choice(q_u_or_where)
......@@ -1223,14 +1223,14 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
tdSql.query("select 10-4 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s as calc10_4 " % random.choice(calc_select_all)
sql = "select "
sql += "%s as calc10_4 " % random.choice(calc_select_all)
sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += " and %s " % random.choice(q_u_or_where)
......@@ -1238,112 +1238,112 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
# tdSql.checkRows(1)
#11 select calc from (select * form stable where <\>\in\and\or order by limit )
#11 select calc from (select * form stable where <\>\in\and\or order by limit )
tdSql.query("select 11-1 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_in_ts)
sql += "%s " % random.choice(calc_select_in_ts)
sql += "as calc11_1 from ( select * from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkRows(1)
#11-1 select calc from (select * form stable where <\>\in\and\or order by limit )
#11-1 select calc from (select * form stable where <\>\in\and\or order by limit )
tdSql.query("select 11-2 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_all)
sql += "%s " % random.choice(calc_select_all)
sql += "as calc11_1 from ( select * from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
#不好计算结果 tdSql.checkRows(1)
#11-2 select calc from (select * form stables where <\>\in\and\or order by limit )
tdSql.query("select 11-3 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_all)
sql += "%s " % random.choice(calc_select_all)
sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
tdSql.query("select 11-4 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_select_all)
sql += "%s " % random.choice(calc_select_all)
sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
#12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit )
#12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit )
##self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 12-1 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " from ( select * from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
##目前derivative不支持 tdSql.query(sql)
# tdSql.checkRows(1)
tdSql.query("select 12-2 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#目前derivative不支持 tdSql.query(sql)
# tdSql.checkRows(1)
tdSql.query("select 12-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#目前derivative不支持 tdSql.query(sql)
#12-1 select calc-diff from (select * form stable where <\>\in\and\or order by limit )
......@@ -1351,7 +1351,7 @@ class TDTestCase:
rsDn = self.restartDnodes()
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
......@@ -1359,15 +1359,15 @@ class TDTestCase:
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += " ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#目前derivative不支持 tdSql.query(sql)
tdSql.query("select 12-4 from stable_1;")
#join query does not support group by
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_calculate_regular_j)
sql += "%s " % random.choice(calc_calculate_regular_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(group_where_j)
......@@ -1375,15 +1375,15 @@ class TDTestCase:
#sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += " ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) 目前de函数不支持,另外看看需要不需要将group by和pari by分开
tdSql.query("select 12-5 from stable_1;")
#join query does not support group by
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_calculate_regular_j)
sql += "%s " % random.choice(calc_calculate_regular_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(group_where_j)
......@@ -1391,41 +1391,41 @@ class TDTestCase:
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += " ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#derivative not support tdSql.query(sql)
#13 select calc-diff as diffns from (select * form stable where <\>\in\and\or order by limit )
tdSql.query("select 13-1 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " as calc13_1 from ( select * from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(orders_desc_where)
sql += "%s " % random.choice([limit_where[2] , limit_where[3]] )
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#derivative not support tdSql.query(sql)
#14 select * from (select calc_aggregate_alls as agg from stable where <\>\in\and\or group by order by slimit soffset )
# TD-5955 select * from ( select count (q_double) from stable_1 where t_bool = true or t_bool = false group by loc order by ts asc slimit 1 ) ;
# TD-5955 select * from ( select count (q_double) from stable_1 where t_bool = true or t_bool = false group by loc order by ts asc slimit 1 ) ;
tdSql.query("select 14-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all)
sql += "%s " % random.choice(calc_aggregate_all)
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all)
sql += "%s " % random.choice(calc_aggregate_all)
sql += " as calc14_3 from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(group_where)
sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(slimit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15678 tdSql.query(sql)
# tdSql.checkRows(1)
......@@ -1433,9 +1433,9 @@ class TDTestCase:
tdSql.query("select 14-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all)
sql += "%s " % random.choice(calc_aggregate_all)
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all)
sql += "%s " % random.choice(calc_aggregate_all)
sql += " as calc14_3 from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(group_where)
......@@ -1444,310 +1444,310 @@ class TDTestCase:
sql += "%s " % random.choice(slimit1_where)
sql += ") "
sql += "%s " % random.choice(group_where)
tdLog.info(sql)
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15678 tdSql.query(sql)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
#14-2 select * from (select calc_aggregate_all_js as agg from stables where <\>\in\and\or group by order by slimit soffset )
tdSql.query("select 14-3 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all_j)
sql += "%s " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all_j)
sql += "%s " % random.choice(calc_aggregate_all_j)
sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(partiton_where_j)
sql += "%s " % random.choice(slimit1_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 14-4 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all_j)
sql += "%s " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_1, " % random.choice(calc_aggregate_all_j)
sql += "%s as calc14_2, " % random.choice(calc_aggregate_all_j)
sql += "%s " % random.choice(calc_aggregate_all_j)
sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(partiton_where_j)
sql += "%s " % random.choice(slimit1_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#15 TD-6320 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by slimit soffset )
tdSql.query("select 15-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular)
sql += "%s " % random.choice(calc_aggregate_regular)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular)
sql += "%s " % random.choice(calc_aggregate_regular)
sql += " as calc15_3 from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where_regular)
sql += "%s " % random.choice(group_where_regular)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #Invalid function name: twa'
# tdSql.checkRows(1)
tdSql.query("select 15-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular_j)
sql += "%s " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular_j)
sql += "%s " % random.choice(calc_aggregate_regular_j)
sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(group_where_regular_j)
sql += "%s " % random.choice(group_where_regular_j)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #Invalid function name: twa'
tdSql.query("select 15-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular_j)
sql += "%s " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_regular_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_regular_j)
sql += "%s " % random.choice(calc_aggregate_regular_j)
sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(group_where_regular_j)
sql += "%s " % random.choice(group_where_regular_j)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #Invalid function name: twa'
rsDn = self.restartDnodes()
tdSql.query("select 15-3 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s " % random.choice(calc_aggregate_groupbytbname)
sql += " as calc15_3 from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
sql += "%s " % random.choice(having_support)
sql += "%s " % random.choice(order_desc_where)
sql += ") "
sql += "order by calc15_1 "
sql += "order by calc15_1 "
sql += "%s " % random.choice(limit_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #Invalid function name: twa',可能还的去掉order by
tdSql.query("select 15-4 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s " % random.choice(calc_aggregate_groupbytbname_j)
sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(group_where_j)
sql += "%s " % random.choice(having_support_j)
#sql += "%s " % random.choice(orders_desc_where)
sql += ") "
sql += "order by calc15_1 "
sql += "order by calc15_1 "
sql += "%s " % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #'Invalid function name: irate'
tdSql.query("select 15-4.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname_j)
sql += "%s " % random.choice(calc_aggregate_groupbytbname_j)
sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(group_where_j)
sql += "%s " % random.choice(having_support_j)
sql += "%s " % random.choice(orders_desc_where)
sql += ") "
sql += "order by calc15_1 "
sql += "order by calc15_1 "
sql += "%s " % random.choice(limit_u_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15678 #tdSql.query(sql)
tdSql.query("select 15-5 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_1, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s as calc15_2, " % random.choice(calc_aggregate_groupbytbname)
sql += "%s " % random.choice(calc_aggregate_groupbytbname)
sql += " as calc15_3 from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
sql += ") "
sql += "order by calc15_1 "
sql += "order by calc15_1 "
sql += "%s " % random.choice(limit_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql) #'Invalid function name: irate'
#16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset )
#16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 16-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s as calc16_0 , " % random.choice(calc_calculate_all)
sql += "%s as calc16_1 , " % random.choice(calc_aggregate_all)
sql += "%s as calc16_2 " % random.choice(calc_select_in)
sql += "%s as calc16_1 , " % random.choice(calc_aggregate_all)
sql += "%s as calc16_2 " % random.choice(calc_select_in)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
#sql += "%s " % random.choice(having_support)having和 partition不能混合使用
sql += ") "
sql += "order by calc16_0 "
sql += "order by calc16_0 "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15651 tdSql.query(sql)
tdSql.query("select 16-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s as calc16_0 " % random.choice(calc_calculate_all_j)
sql += ", %s as calc16_1 " % random.choice(calc_aggregate_all_j)
#sql += ", %s as calc16_2 " % random.choice(calc_select_in_j)
sql += ", %s as calc16_1 " % random.choice(calc_aggregate_all_j)
#sql += ", %s as calc16_2 " % random.choice(calc_select_in_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += ") "
sql += "order by calc16_0 "
sql += "order by calc16_0 "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 16-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s as calc16_0 " % random.choice(calc_calculate_all_j)
sql += ", %s as calc16_1 " % random.choice(calc_aggregate_all_j)
sql += ", %s as calc16_1 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += ") "
sql += "order by calc16_0 "
sql += "order by calc16_0 "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 16-3 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular)
sql += " from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql)#Invalid function name: derivative'
tdSql.query("select 16-4 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular_j)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql)#Invalid function name: derivative'
tdSql.query("select 16-4.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular_j)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_regular_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#tdSql.query(sql)#Invalid function name: derivative'
tdSql.query("select 16-5 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s as calc16_1 , " % random.choice(calc_calculate_all)
sql += "%s as calc16_1 , " % random.choice(calc_calculate_regular)
sql += "%s as calc16_2 " % random.choice(calc_select_all)
sql += "%s as calc16_1 , " % random.choice(calc_calculate_regular)
sql += "%s as calc16_2 " % random.choice(calc_select_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
#sql += "%s " % random.choice(having_support)
sql += ") "
sql += "order by calc16_1 "
sql += "order by calc16_1 "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
# tdSql.query(sql)
tdSql.query("select 16-6 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(group_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#Invalid function name: derivative' tdSql.query(sql)
tdSql.query("select 16-7 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname_j)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#Invalid function name: derivative' tdSql.query(sql)
tdSql.query("select 16-8 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname_j)
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(calc_calculate_groupbytbname_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "limit 2 ) "
sql += "%s " % random.choice(limit1_where)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#Invalid function name: derivative' tdSql.query(sql)
#17 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or interval_sliding group by having order by limit offset )interval_sliding
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 17-1 from stable_1;")
for i in range(self.fornum):
#this is having_support , but tag-select cannot mix with last_row,other select can
#this is having_support , but tag-select cannot mix with last_row,other select can
sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_0 , " % random.choice(calc_calculate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(partiton_where)
......@@ -1757,17 +1757,17 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15719 tdSql.query(sql)
tdSql.query("select 17-2 from stable_1;")
for i in range(self.fornum):
#this is having_support , but tag-select cannot mix with last_row,other select can
#this is having_support , but tag-select cannot mix with last_row,other select can
sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_0 , " % random.choice(calc_calculate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1775,17 +1775,17 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-2.2 from stable_1;")
for i in range(self.fornum):
#this is having_support , but tag-select cannot mix with last_row,other select can
#this is having_support , but tag-select cannot mix with last_row,other select can
sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_0 , " % random.choice(calc_calculate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1793,8 +1793,8 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.restartDnodes()
......@@ -1802,8 +1802,8 @@ class TDTestCase:
for i in range(self.fornum):
#this is having_tagnot_support , because tag-select cannot mix with last_row...
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(partiton_where)
......@@ -1813,16 +1813,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15770 tdSql.query(sql)
tdSql.query("select 17-4 from stable_1;")
for i in range(self.fornum):
#this is having_tagnot_support , because tag-select cannot mix with last_row...
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1830,16 +1830,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-4.2 from stable_1;")
for i in range(self.fornum):
#this is having_tagnot_support , because tag-select cannot mix with last_row...
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1847,16 +1847,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-5 from stable_1;")
for i in range(self.fornum):
#having_not_support
#having_not_support
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(partiton_where)
......@@ -1866,15 +1866,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15719 tdSql.query(sql)
tdSql.query("select 17-6 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1882,15 +1882,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15770 tdSql.query(sql)
tdSql.query("select 17-7 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1898,15 +1898,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-7.2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1914,16 +1914,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.restartDnodes()
tdSql.query("select 17-8 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all)
sql += " from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1931,15 +1931,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-9 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1947,15 +1947,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 17-10 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal17_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(interval_sliding)
......@@ -1963,16 +1963,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#18 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding
tdSql.query("select 18-1 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += " from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(session_where)
......@@ -1981,15 +1981,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(session_u_where)
......@@ -1997,15 +1997,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(session_u_where)
......@@ -2013,16 +2013,16 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.restartDnodes()
tdSql.query("select 18-3 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(session_where)
......@@ -2031,15 +2031,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-4 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(session_u_where)
......@@ -2047,15 +2047,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-4.2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(session_u_where)
......@@ -2063,15 +2063,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-5 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(session_where)
......@@ -2080,15 +2080,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit1_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#TD-15770 tdSql.query(sql)
tdSql.query("select 18-6 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(t_join_where)
sql += "%s " % random.choice(session_u_where)
......@@ -2096,15 +2096,15 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 18-7 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(session_u_where)
......@@ -2112,426 +2112,426 @@ class TDTestCase:
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding
#19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 19-1 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += " from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(state_window)
#sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(state_u_window)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(state_u_window)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-3 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(state_window)
#sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-4 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(q_u_where)
#sql += "%s " % random.choice(state_window)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-4.2 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_or_where)
sql += "%s " % random.choice(q_u_or_where)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-5 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all)
sql += " from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(q_where)
sql += "%s " % random.choice(state_window)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit1_where)
sql += ") "
sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql) #'STATE_WINDOW not support for super table query'
tdSql.query("select 19-6 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(q_u_where)
sql += "%s " % random.choice(q_u_where)
#sql += "%s " % random.choice(state_window)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.query("select 19-7 from stable_1;")
for i in range(self.fornum):
sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_1 ," % random.choice(calc_aggregate_all_j)
sql += "%s as cal19_2 " % random.choice(calc_aggregate_all_j)
sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(qt_u_or_where)
#sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
#sql += "%s " % random.choice(interval_sliding)
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#20 select * from (select calc_select_fills form regualr_table or stable where <\>\in\and\or fill_where group by order by limit offset )
#20 select * from (select calc_select_fills form regualr_table or stable where <\>\in\and\or fill_where group by order by limit offset )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 20-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += " from stable_1 where "
sql += "%s " % random.choice(interp_where)
sql += "%s " % random.choice(interp_where)
sql += "%s " % random.choice(fill_where)
sql += "%s " % random.choice(group_where)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#interp不支持 tdSql.query(sql)
rsDn = self.restartDnodes()
tdSql.query("select 20-2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s and " % random.choice(t_join_where)
sql += "%s " % random.choice(interp_where_j)
sql += "%s " % random.choice(interp_where_j)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#interp不支持 tdSql.query(sql)
tdSql.query("select 20-2.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s and " % random.choice(qt_u_or_where)
sql += "%s " % random.choice(interp_where_j)
sql += "%s " % random.choice(interp_where_j)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#interp不支持 tdSql.query(sql)
tdSql.query("select 20-3 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += " from stable_1 where "
sql += "%s " % interp_where[2]
sql += "%s " % interp_where[2]
sql += "%s " % random.choice(fill_where)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#interp不支持 tdSql.query(sql)
tdSql.query("select 20-4 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1, table_1 t2 where t1.ts = t2.ts and "
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1, table_1 t2 where t1.ts = t2.ts and "
#sql += "%s and " % random.choice(t_join_where)
sql += "%s " % interp_where_j[random.randint(0,5)]
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
#interp不支持 tdSql.query(sql)
tdSql.query("select 20-4.2 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1, stable_1_1 t2 where t1.ts = t2.ts and "
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from stable_1 t1, stable_1_1 t2 where t1.ts = t2.ts and "
sql += "%s and " % random.choice(qt_u_or_where)
sql += "%s " % interp_where_j[random.randint(0,5)]
sql += "%s " % random.choice(fill_where)
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
##interp不支持 tdSql.error(sql)
tdSql.query("select 20-5 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += "%s ," % random.choice(calc_select_fill)
sql += "%s " % random.choice(calc_select_fill)
sql += " from regular_table_1 where "
sql += "%s " % interp_where[1]
sql += "%s " % interp_where[1]
sql += "%s " % random.choice(fill_where)
sql += "%s " % random.choice(order_where)
sql += "%s " % random.choice(limit_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
##interp不支持 tdSql.query(sql)
tdSql.query("select 20-6 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql = "select * from ( select "
sql += "%s , " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += "%s ," % random.choice(calc_select_fill_j)
sql += "%s " % random.choice(calc_select_fill_j)
sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
#sql += "%s " % random.choice(interp_where_j)
sql += "%s " % interp_where_j[random.randint(0,5)]
#sql += "%s " % random.choice(interp_where_j)
sql += "%s " % interp_where_j[random.randint(0,5)]
sql += "%s " % random.choice(order_u_where)
sql += "%s " % random.choice(limit_u_where)
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
##interp不支持 tdSql.query(sql)
#1 select * from (select * from (select * form regular_table where <\>\in\and\or order by limit ))
tdSql.query("select 1-1 from stable_1;")
for i in range(self.fornum):
for i in range(self.fornum):
# sql_start = "select * from ( "
# sql_end = ")"
for_num = random.randint(1, 15);
sql = "select * from (" * for_num
sql = "select * from (" * for_num
sql += "select * from ( select * from ( select "
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
sql += "ts from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += ")) "
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 = "select * from ( select * from ( select "
sql2 += "%s, " % random.choice(s_r_select)
sql2 += "%s, " % random.choice(q_select)
sql2 += "%s, " % random.choice(s_r_select)
sql2 += "%s, " % random.choice(q_select)
sql2 += "ts from regular_table_1 where "
sql2 += "%s " % random.choice(q_where)
sql2 += ")) "
tdLog.info(sql2)
tdLog.info(len(sql2))
sql2 += ")) "
tdLog.info(sql2)
tdLog.info(len(sql2))
self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql ,1,10,3,3)
self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3)
for i in range(self.fornum):
for_num = random.randint(1, 15);
sql = "select ts from (" * for_num
sql = "select ts from (" * for_num
sql += "select * from ( select * from ( select "
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
sql += "%s, " % random.choice(s_r_select)
sql += "%s, " % random.choice(q_select)
sql += "ts from regular_table_1 where "
sql += "%s " % random.choice(q_where)
sql += ")) "
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 = "select * from ( select * from ( select "
sql2 += "%s, " % random.choice(s_r_select)
sql2 += "%s, " % random.choice(q_select)
sql2 += "%s, " % random.choice(s_r_select)
sql2 += "%s, " % random.choice(q_select)
sql2 += "ts from regular_table_1 where "
sql2 += "%s " % random.choice(q_where)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
#2 select * from (select * from (select * form stable where <\>\in\and\or order by limit ))
tdSql.query("select 2-1 from stable_1;")
for i in range(self.fornum):
for_num = random.randint(1, 15);
sql = "select * from (" * for_num
sql = "select * from (" * for_num
sql += "select * from ( select * from ( select "
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(qt_select)
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(qt_select)
sql += "ts from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += ")) "
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 = "select * from ( select * from ( select "
sql2 += "%s, " % random.choice(s_s_select)
sql2 += "%s, " % random.choice(qt_select)
sql2 += "%s, " % random.choice(s_s_select)
sql2 += "%s, " % random.choice(qt_select)
sql2 += "ts from stable_1 where "
sql2 += "%s " % random.choice(q_where)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3)
for i in range(self.fornum):
for_num = random.randint(1, 15);
sql = "select ts from (" * for_num
sql = "select ts from (" * for_num
sql += "select * from ( select * from ( select "
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(qt_select)
sql += "%s, " % random.choice(s_s_select)
sql += "%s, " % random.choice(qt_select)
sql += "ts from stable_1 where "
sql += "%s " % random.choice(q_where)
sql += ")) "
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql += ")" * for_num
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 = "select ts from ( select * from ( select "
sql2 += "%s, " % random.choice(s_s_select)
sql2 += "%s, " % random.choice(qt_select)
sql2 += "%s, " % random.choice(s_s_select)
sql2 += "%s, " % random.choice(qt_select)
sql2 += "ts from stable_1 where "
sql2 += "%s " % random.choice(q_where)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
sql2 += ")) "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
#3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit )
#3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit )
#self.dropandcreateDB_random("%s" %db, 1)
tdSql.query("select 3-1 from stable_1;")
for i in range(self.fornum):
sql = "select "
sql += "%s " % random.choice(calc_calculate_regular)
sql += "%s " % random.choice(calc_calculate_regular)
sql += " from ( select * from stable_1 where "
sql += "%s " % random.choice(qt_where)
sql += "%s " % random.choice(orders_desc_where)
sql += "%s " % random.choice(limit_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
#'Invalid function name: derivative' tdSql.query(sql)
tdLog.info(sql)
tdLog.info(len(sql))
#'Invalid function name: derivative' tdSql.query(sql)
#4 select * from (select calc form stable where <\>\in\and\or order by limit )
tdSql.query("select 4-1 from stable_1;")
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(calc_select_in_ts)
sql += "%s " % random.choice(calc_select_in_ts)
sql += "from stable_1 where "
sql += "%s " % random.choice(qt_where)
#sql += "%s " % random.choice(order_desc_where)
sql += "%s " % random.choice(limit_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
#5 select ts ,tbname from (select * form stable where <\>\in\and\or order by limit )
tdSql.query("select 5-1 from stable_1;")
for i in range(self.fornum):
sql = "select ts , tbname , "
sql += "%s ," % random.choice(calc_calculate_regular)
sql += "%s ," % random.choice(calc_calculate_regular)
sql += "%s ," % random.choice(dqt_select)
sql += "%s " % random.choice(qt_select)
sql += " from ( select * from stable_1 where "
......@@ -2539,9 +2539,9 @@ class TDTestCase:
sql += "%s " % random.choice(orders_desc_where)
sql += "%s " % random.choice(limit_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
#special sql
tdSql.query("select 6-1 from stable_1;")
......@@ -2570,7 +2570,7 @@ class TDTestCase:
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
......
......@@ -8,14 +8,14 @@ from util.sql import *
from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, logSql):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def prepare_datas(self):
tdSql.execute(
'''create table stb1
......@@ -23,7 +23,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql.execute(
'''
create table t1
......@@ -65,14 +65,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
def check_result_auto(self ,origin_query , round_query):
pass
round_result = tdSql.getResult(round_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
......@@ -87,13 +87,13 @@ class TDTestCase:
for row_index , row in enumerate(round_result):
for col_index , elem in enumerate(row):
if auto_result[row_index][col_index] != elem:
check_status = False
check_status = False
if not check_status:
tdLog.notice("round function value has not as expected , sql is \"%s\" "%round_query )
sys.exit(1)
else:
tdLog.info("round value check pass , it work as expected ,sql is \"%s\" "%round_query )
def test_errors(self):
error_sql_lists = [
"select round from t1",
......@@ -127,42 +127,42 @@ class TDTestCase:
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
def support_types(self):
type_error_sql_lists = [
"select round(ts) from t1" ,
"select round(ts) from t1" ,
"select round(c7) from t1",
"select round(c8) from t1",
"select round(c9) from t1",
"select round(ts) from ct1" ,
"select round(ts) from ct1" ,
"select round(c7) from ct1",
"select round(c8) from ct1",
"select round(c9) from ct1",
"select round(ts) from ct3" ,
"select round(ts) from ct3" ,
"select round(c7) from ct3",
"select round(c8) from ct3",
"select round(c9) from ct3",
"select round(ts) from ct4" ,
"select round(ts) from ct4" ,
"select round(c7) from ct4",
"select round(c8) from ct4",
"select round(c9) from ct4",
"select round(ts) from stb1" ,
"select round(ts) from stb1" ,
"select round(c7) from stb1",
"select round(c8) from stb1",
"select round(c9) from stb1" ,
"select round(ts) from stbbb1" ,
"select round(ts) from stbbb1" ,
"select round(c7) from stbbb1",
"select round(ts) from tbname",
"select round(c9) from tbname"
]
for type_sql in type_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists = [
"select round(c1) from t1",
"select round(c2) from t1",
......@@ -192,16 +192,16 @@ class TDTestCase:
"select round(c5) from stb1",
"select round(c6) from stb1",
"select round(c6) as alisb from stb1",
"select round(c6) alisb from stb1",
"select round(c6) as alisb from stb1",
"select round(c6) alisb from stb1",
]
for type_sql in type_sql_lists:
tdSql.query(type_sql)
def basic_round_function(self):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
......@@ -221,7 +221,7 @@ class TDTestCase:
tdSql.query("select round(c5) from ct3")
tdSql.checkRows(0)
tdSql.query("select round(c6) from ct3")
# used for regular table
tdSql.query("select round(c1) from t1")
tdSql.checkData(0, 0, None)
......@@ -239,7 +239,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from t1", "select (c1), round(c2) ,round(c3), round(c4), round(c5) from t1")
# used for sub table
tdSql.query("select round(c1) from ct1")
tdSql.checkData(0, 0, 8)
......@@ -251,20 +251,20 @@ class TDTestCase:
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct1", "select (c1), round(c2) ,round(c3), round(c4), round(c5) from ct1")
self.check_result_auto("select round(round(round(round(round(round(round(round(round(round(c1)))))))))) nest_col_func from ct1;","select c1 from ct1" )
# used for stable table
# used for stable table
tdSql.query("select round(c1) from stb1")
tdSql.checkRows(25)
self.check_result_auto( "select c1, c2, c3 , c4, c5 from ct4 ", "select (c1), round(c2) ,round(c3), round(c4), round(c5) from ct4")
self.check_result_auto("select round(round(round(round(round(round(round(round(round(round(c1)))))))))) nest_col_func from ct4;" , "select c1 from ct4" )
# used for not exists table
tdSql.error("select round(c1) from stbbb1")
tdSql.error("select round(c1) from tbname")
tdSql.error("select round(c1) from ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, round(c1) from ct1")
tdSql.checkData(0 , 0 ,8)
tdSql.checkData(0 , 1 ,8)
......@@ -289,7 +289,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 , 6)
tdSql.checkData(3 , 2 ,6.66000)
......@@ -315,7 +315,7 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# bug fix for count
tdSql.query("select count(c1) from ct4 ")
tdSql.checkData(0,0,9)
......@@ -326,7 +326,7 @@ class TDTestCase:
tdSql.query("select count(*) from stb1 ")
tdSql.checkData(0,0,25)
# bug fix for compute
# bug fix for compute
tdSql.query("select c1, abs(c1) -0 ,round(c1)-0 from ct4 ")
tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None)
......@@ -378,10 +378,10 @@ class TDTestCase:
tdSql.checkData(0,4,7.900000000)
tdSql.checkData(0,5,3.000000000)
tdSql.checkData(0,6,7.500000000)
def round_Arithmetic(self):
pass
def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test")
......@@ -410,14 +410,14 @@ class TDTestCase:
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() )"
)
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() )"
)
self.check_result_auto( "select c1, c2, c3 , c4, c5 ,c6 from sub1_bound ", "select round(c1), round(c2) ,round(c3), round(c4), round(c5) ,round(c6) from sub1_bound")
self.check_result_auto( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select round(c1), round(c2) ,round(c3), round(c3), round(c2) ,round(c1) from sub1_bound")
self.check_result_auto("select round(round(round(round(round(round(round(round(round(round(c1)))))))))) nest_col_func from sub1_bound;" , "select round(c1) from sub1_bound" )
# check basic elem for table per row
tdSql.query("select round(c1+0.2) ,round(c2) , round(c3+0.3) , round(c4-0.3), round(c5/2), round(c6/2) from sub1_bound ")
tdSql.checkData(0, 0, 2147483647.000000000)
......@@ -444,32 +444,32 @@ class TDTestCase:
self.check_result_auto( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select round(t1) ,round(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select round(t1) , round(c5) from stb1 where c1 > 0 order by tbname" )
pass
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4: round basic query ============")
tdLog.printNoPrefix("==========step4: round basic query ============")
self.basic_round_function()
tdLog.printNoPrefix("==========step5: round boundary query ============")
tdLog.printNoPrefix("==========step5: round boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step6: round filter query ============")
tdLog.printNoPrefix("==========step6: round filter query ============")
self.abs_func_filter()
......
......@@ -9,13 +9,13 @@ from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def prepare_datas(self):
tdSql.execute(
'''create table stb1
......@@ -23,7 +23,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql.execute(
'''
create table t1
......@@ -65,14 +65,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
def check_result_auto_sqrt(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query)
auto_result =[]
for row in origin_result:
row_check = []
for elem in row:
......@@ -92,7 +92,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False
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:
pass
if not check_status:
......@@ -100,7 +100,7 @@ class TDTestCase:
sys.exit(1)
else:
tdLog.info("sqrt value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self):
error_sql_lists = [
"select sqrt from t1",
......@@ -134,42 +134,42 @@ class TDTestCase:
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)
def support_types(self):
type_error_sql_lists = [
"select sqrt(ts) from t1" ,
"select sqrt(ts) from t1" ,
"select sqrt(c7) from t1",
"select sqrt(c8) from t1",
"select sqrt(c9) from t1",
"select sqrt(ts) from ct1" ,
"select sqrt(ts) from ct1" ,
"select sqrt(c7) from ct1",
"select sqrt(c8) from ct1",
"select sqrt(c9) from ct1",
"select sqrt(ts) from ct3" ,
"select sqrt(ts) from ct3" ,
"select sqrt(c7) from ct3",
"select sqrt(c8) from ct3",
"select sqrt(c9) from ct3",
"select sqrt(ts) from ct4" ,
"select sqrt(ts) from ct4" ,
"select sqrt(c7) from ct4",
"select sqrt(c8) from ct4",
"select sqrt(c9) from ct4",
"select sqrt(ts) from stb1" ,
"select sqrt(ts) from stb1" ,
"select sqrt(c7) from stb1",
"select sqrt(c8) from stb1",
"select sqrt(c9) from stb1" ,
"select sqrt(ts) from stbbb1" ,
"select sqrt(ts) from stbbb1" ,
"select sqrt(c7) from stbbb1",
"select sqrt(ts) from tbname",
"select sqrt(c9) from tbname"
]
for type_sql in type_error_sql_lists:
tdSql.error(type_sql)
type_sql_lists = [
"select sqrt(c1) from t1",
"select sqrt(c2) from t1",
......@@ -199,16 +199,16 @@ class TDTestCase:
"select sqrt(c5) from stb1",
"select sqrt(c6) from stb1",
"select sqrt(c6) as alisb from stb1",
"select sqrt(c6) alisb from stb1",
"select sqrt(c6) as alisb from stb1",
"select sqrt(c6) alisb from stb1",
]
for type_sql in type_sql_lists:
tdSql.query(type_sql)
def basic_sqrt_function(self):
# basic query
# basic query
tdSql.query("select c1 from ct3")
tdSql.checkRows(0)
tdSql.query("select c1 from t1")
......@@ -249,7 +249,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None)
self.check_result_auto_sqrt( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select sqrt(abs(c1)), sqrt(abs(c2)) ,sqrt(abs(c3)), sqrt(abs(c4)), sqrt(abs(c5)) from t1")
# used for sub table
tdSql.query("select c2 ,sqrt(c2) from ct1")
tdSql.checkData(0, 1, 298.140906284)
......@@ -265,7 +265,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None)
self.check_result_auto_sqrt( "select c1, c2, c3 , c4, c5 from ct1", "select sqrt(c1), sqrt(c2) ,sqrt(c3), sqrt(c4), sqrt(c5) from ct1")
# nest query for sqrt functions
tdSql.query("select c4 , sqrt(c4) ,sqrt(sqrt(c4)) , sqrt(sqrt(sqrt(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88)
......@@ -283,18 +283,18 @@ class TDTestCase:
tdSql.checkData(11 , 2 , None)
tdSql.checkData(11 , 3 , None)
# used for stable table
# used for stable table
tdSql.query("select sqrt(c1) from stb1")
tdSql.checkRows(25)
# used for not exists table
tdSql.error("select sqrt(c1) from stbbb1")
tdSql.error("select sqrt(c1) from tbname")
tdSql.error("select sqrt(c1) from ct5")
# mix with common col
# mix with common col
tdSql.query("select c1, sqrt(c1) from ct1")
tdSql.checkData(0 , 0 ,8)
tdSql.checkData(0 , 1 ,2.828427125)
......@@ -314,7 +314,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,2.449489743)
tdSql.checkData(3 , 2 ,2.449489743)
......@@ -335,7 +335,7 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1")
# bug fix for count
tdSql.query("select count(c1) from ct4 ")
tdSql.checkData(0,0,9)
......@@ -346,7 +346,7 @@ class TDTestCase:
tdSql.query("select count(*) from stb1 ")
tdSql.checkData(0,0,25)
# # bug fix for compute
# # bug fix for compute
tdSql.query("select c1, sqrt(c1) -0 ,sqrt(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None)
......@@ -397,16 +397,16 @@ class TDTestCase:
tdSql.checkRows(13)
# # bug for compute in functions
# tdSql.query("select c1, abs(1/0) from ct1")
# tdSql.query("select c1, abs(1/0) from ct1")
# tdSql.checkData(0, 0, 8)
# tdSql.checkData(0, 1, 1)
tdSql.query("select c1, sqrt(1) from ct1")
tdSql.query("select c1, sqrt(1) from ct1")
tdSql.checkData(0, 1, 1.000000000)
tdSql.checkRows(13)
# two cols start sqrt(x,y)
tdSql.query("select c1,c2, sqrt(c2) from ct1")
tdSql.query("select c1,c2, sqrt(c2) from ct1")
tdSql.checkData(0, 2, 298.140906284)
tdSql.checkData(1, 2, 278.885281074)
tdSql.checkData(4, 2, 0.000000000)
......@@ -445,10 +445,10 @@ class TDTestCase:
tdSql.checkData(0,3,1.000000000)
tdSql.checkData(0,4,0.900000000)
tdSql.checkData(0,5,1.000000000)
def pow_Arithmetic(self):
pass
def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test")
......@@ -475,11 +475,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() )"
)
self.check_result_auto_sqrt( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select sqrt(abs(c1)), sqrt(abs(c2)) ,sqrt(abs(c3)), sqrt(abs(c4)), sqrt(abs(c5)) from sub1_bound")
self.check_result_auto_sqrt( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select sqrt(c1), sqrt(c2) ,sqrt(c3), sqrt(c3), sqrt(c2) ,sqrt(c1) from sub1_bound")
self.check_result_auto_sqrt("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select sqrt(abs(c1)) from sub1_bound" )
# check basic elem for table per row
tdSql.query("select sqrt(abs(c1)) ,sqrt(abs(c2)) , sqrt(abs(c3)) , sqrt(abs(c4)), sqrt(abs(c5)), sqrt(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,math.sqrt(2147483647))
......@@ -504,7 +504,7 @@ class TDTestCase:
tdSql.checkData(0,1,math.sqrt(9223372036854775807))
tdSql.checkData(0,2,math.sqrt(32767.000000000))
tdSql.checkData(0,3,math.sqrt(63.500000000))
def support_super_table_test(self):
tdSql.execute(" use db ")
self.check_result_auto_sqrt( " select c5 from stb1 order by ts " , "select sqrt(c5) from stb1 order by ts" )
......@@ -522,42 +522,42 @@ class TDTestCase:
tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============")
tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============")
tdLog.printNoPrefix("==========step3:support types ============")
self.support_types()
tdLog.printNoPrefix("==========step4: sqrt basic query ============")
tdLog.printNoPrefix("==========step4: sqrt basic query ============")
self.basic_sqrt_function()
tdLog.printNoPrefix("==========step5: big number sqrt query ============")
tdLog.printNoPrefix("==========step5: big number sqrt query ============")
self.test_big_number()
tdLog.printNoPrefix("==========step6: base number for sqrt query ============")
tdLog.printNoPrefix("==========step6: base number for sqrt query ============")
self.pow_base_test()
tdLog.printNoPrefix("==========step7: sqrt boundary query ============")
tdLog.printNoPrefix("==========step7: sqrt boundary query ============")
self.check_boundary_values()
tdLog.printNoPrefix("==========step8: sqrt filter query ============")
tdLog.printNoPrefix("==========step8: sqrt filter query ============")
self.abs_func_filter()
tdLog.printNoPrefix("==========step9: check sqrt result of stable query ============")
self.support_super_table_test()
self.support_super_table_test()
def stop(self):
tdSql.close()
......
......@@ -11,7 +11,7 @@ from util.sql import *
from util.cases import *
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,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
......@@ -476,7 +476,7 @@ class TDTestCase:
self.check_unit_time()
self.query_precision()
def stop(self):
......
......@@ -25,10 +25,10 @@ class TDTestCase:
def run(self):
tdSql.prepare()
# timestamp = 1ms , time_unit = 1s
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
tdSql.execute('''create table test(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)''')
for i in range(self.row_num):
tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
integer_list = [1,2,3,4,11,12,13,14]
float_list = [5,6]
......@@ -72,10 +72,10 @@ class TDTestCase:
tdSql.error(f"select stateduration(col1,{i},5) from test")
# timestamp = 1s, time_unit =1s
tdSql.execute('''create table test1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
tdSql.execute('''create table test1(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)''')
for i in range(self.row_num):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
for i in integer_list:
......
......@@ -18,24 +18,24 @@ class TDTestCase:
self.arithmetic_operators = ['+','-','*','/']
self.arithmetic_values = [0,1,100,15.5]
# name of normal table
self.ntbname = 'ntb'
self.ntbname = 'ntb'
# name of stable
self.stbname = 'stb'
self.stbname = 'stb'
# structure of column
self.column_dict = {
self.column_dict = {
'ts':'timestamp',
'c1':'int',
'c2':'float',
'c3':'double'
}
# structure of tag
self.tag_dict = {
self.tag_dict = {
't0':'int'
}
# number of child tables
self.tbnum = 2
self.tbnum = 2
# values of tag,the number of values should equal to tbnum
self.tag_values = [
self.tag_values = [
f'10',
f'100'
]
......@@ -62,7 +62,7 @@ class TDTestCase:
time_zone = time_zone_1 + " " + time_zone_2
print("expected time zone: " + time_zone)
return time_zone
def tb_type_check(self,tb_type):
if tb_type in ['normal_table','child_table']:
tdSql.checkRows(len(self.values_list))
......@@ -115,7 +115,7 @@ class TDTestCase:
timezone = self.get_system_timezone()
self.timezone_check_ntb(timezone)
self.timezone_check_stb(timezone)
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
......
......@@ -45,7 +45,7 @@ class TDTestCase:
'col12': 'binary(20)',
'col13': 'nchar(20)'
}
self.param_list = [1,100]
def insert_data(self,column_dict,tbname,row_num):
......@@ -107,7 +107,7 @@ class TDTestCase:
tdSql.execute(f"create database if not exists {dbname} vgroups 2")
tdSql.execute(f'use {dbname}')
tdSql.execute(self.setsql.set_create_stable_sql(stbname,self.column_dict,tag_dict))
for i in range(self.tbnum):
tdSql.execute(f"create table {stbname}_{i} using {stbname} tags({tag_values[0]})")
self.insert_data(self.column_dict,f'{stbname}_{i}',self.rowNum)
......@@ -141,7 +141,7 @@ class TDTestCase:
self.top_check_ntb()
self.top_check_stb()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册