未验证 提交 0cc8f92d 编写于 作者: wmmhello's avatar wmmhello 提交者: GitHub

Merge branch 'main' into fix/TD-22671

...@@ -88,6 +88,10 @@ void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double ...@@ -88,6 +88,10 @@ void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double
} }
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
if (pLoadInfo == NULL) {
return NULL;
}
for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) { for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
pLoadInfo[i].currentLoadBlockIndex = 1; pLoadInfo[i].currentLoadBlockIndex = 1;
pLoadInfo[i].blockIndex[0] = -1; pLoadInfo[i].blockIndex[0] = -1;
......
...@@ -52,7 +52,7 @@ void streamCleanUp() { ...@@ -52,7 +52,7 @@ void streamCleanUp() {
void streamSchedByTimer(void* param, void* tmrId) { void streamSchedByTimer(void* param, void* tmrId) {
SStreamTask* pTask = (void*)param; SStreamTask* pTask = (void*)param;
if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) { if (streamTaskShouldStop(&pTask->status)) {
streamMetaReleaseTask(NULL, pTask); streamMetaReleaseTask(NULL, pTask);
return; return;
} }
......
...@@ -51,6 +51,16 @@ ...@@ -51,6 +51,16 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_26.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_26.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
......
...@@ -17,12 +17,12 @@ from util.dnodes import TDDnode ...@@ -17,12 +17,12 @@ from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
import subprocess import subprocess
BASEVERSION = "3.0.1.8" BASEVERSION = "3.0.2.3"
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' f'''
3.0 data compatibility test 3.0 data compatibility test
case1: basedata version is 3.0.1.8 case1: basedata version is {BASEVERSION}
''' '''
return return
......
...@@ -24,9 +24,7 @@ from util.dnodes import tdDnodes ...@@ -24,9 +24,7 @@ from util.dnodes import tdDnodes
from util.dnodes import * from util.dnodes import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 135}
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
...@@ -39,7 +37,9 @@ class TDTestCase: ...@@ -39,7 +37,9 @@ class TDTestCase:
self.db = "pre_suf" self.db = "pre_suf"
def dropandcreateDB_random(self,database,n,vgroups,table_prefix,table_suffix,check_result): def dropandcreateDB_random(self,database,n,vgroups,table_prefix,table_suffix,check_result_positive,check_result_negative):
#check_result_positive 检查前缀后缀是正数的,check_result_negative 检查前缀后缀是负数的(TS-3249)
tdLog.info(f"create start:n:{n},vgroups:{vgroups},table_prefix:{table_prefix},table_suffix:{table_suffix},check_result_positive:{check_result_positive},check_result_negative:{check_result_negative}")
ts = 1630000000000 ts = 1630000000000
num_random = 100 num_random = 100
fake = Faker('zh_CN') fake = Faker('zh_CN')
...@@ -56,6 +56,7 @@ class TDTestCase: ...@@ -56,6 +56,7 @@ 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) \ 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);''') 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);''')
#positive
for i in range(10*n): for i in range(10*n):
tdSql.execute('''create table bj_%d (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 ) ;'''%i) tdSql.execute('''create table bj_%d (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 ) ;'''%i)
tdSql.execute('''create table sh_%d (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 ) ;'''%i) tdSql.execute('''create table sh_%d (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 ) ;'''%i)
...@@ -106,11 +107,60 @@ class TDTestCase: ...@@ -106,11 +107,60 @@ class TDTestCase:
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, 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))) fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
#negative
for i in range(10*n):
tdSql.execute('''create table bj_table_%d_r_negative (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 ) ;'''%i)
tdSql.execute('''create table sh_table_%d_r_negative (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 ) ;'''%i)
tdSql.execute('''create table hn_table_%d_r_negative \
(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_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
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) ;'''%i)
tdSql.execute('''create table bj_stable_1_%d_negative using stable_1 tags('bj_stable_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 sh_table_%d_a_negative using stable_1 tags('sh_a_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 sh_table_%d_b_negative using stable_1 tags('sh_b_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 sh_table_%d_c_negative using stable_1 tags('sh_c_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 bj_table_%d_a_negative using stable_1 tags('bj_a_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 bj_table_%d_b_negative using stable_1 tags('bj_b_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 bj_table_%d_c_negative using stable_1 tags('bj_c_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 tj_table_%d_a_negative using stable_2 tags('tj_a_table_2_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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 tj_table_%d_b_negative using stable_2 tags('tj_b_table_2_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
%(i,i,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)))
# create stream # create stream
tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''')
# insert data # insert data positive
for i in range(num_random*n): for i in range(num_random*n):
tdSql.execute('''insert into bj_stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\ tdSql.execute('''insert into bj_stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
...@@ -180,8 +230,60 @@ class TDTestCase: ...@@ -180,8 +230,60 @@ class TDTestCase:
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr())) fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
# insert data negative
for i in range(num_random*n):
tdSql.execute('''insert into bj_stable_1_1_negative (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
% (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.pystr() , ts + i , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
tdSql.execute('''insert into bj_stable_1_2_negative (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)\
values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
% (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.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
tdSql.execute('''insert into bj_stable_1_3_negative (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
% (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.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
tdSql.execute('''insert into bj_stable_1_4_negative (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
% (ts + i*1000 +1, 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.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
tdSql.execute('''insert into bj_stable_1_5_negative (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
% (ts + i*1000 +10, 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.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
tdSql.query("select count(*) from stable_1;") tdSql.query("select count(*) from stable_1;")
tdSql.checkData(0,0,5*num_random*n) tdSql.checkData(0,0,10*num_random*n)
tdSql.query("select count(*) from hn_table_1_r;") tdSql.query("select count(*) from hn_table_1_r;")
tdSql.checkData(0,0,num_random*n) tdSql.checkData(0,0,num_random*n)
...@@ -220,39 +322,28 @@ class TDTestCase: ...@@ -220,39 +322,28 @@ class TDTestCase:
tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database) tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database)
print(tdSql.queryResult) tdLog.info(tdSql.queryResult)
# tdSql.query(" select table_prefix,table_suffix from information_schema.ins_databases where name = '%s';" %database)
# print(tdSql.queryResult)
#TD-19082
#tdSql.query(" select * from information_schema.ins_tables where db_name = '%s';" %database) tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' limit 3;" %database)
#print(tdSql.queryResult)
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s';" %database)
queryRows = len(tdSql.queryResult) queryRows = len(tdSql.queryResult)
for i in range(queryRows): for i in range(queryRows):
print("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0])) tdLog.info("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0]))
tdLog.info("\n=============flush database ====================\n") tdLog.info("\n=============flush database ====================\n")
tdSql.execute(" flush database %s;" %database) tdSql.execute(" flush database %s;" %database)
tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database) tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database)
print(tdSql.queryResult) tdLog.info(tdSql.queryResult)
# tdSql.query(" select table_prefix,table_suffix from information_schema.ins_databases where name = '%s';" %database)
# print(tdSql.queryResult)
#TD-19082
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s';" %database) tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' limit 3;" %database)
queryRows = len(tdSql.queryResult) queryRows = len(tdSql.queryResult)
for i in range(queryRows): for i in range(queryRows):
print("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0])) tdLog.info("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0]))
# check in one vgroup # check in one vgroup
if check_result == 'Y': if check_result_positive == 'Y':
#base table : sh_table_0_a #base table : sh_table_0_a
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_0_a';" %(database)) tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_0_a';" %(database))
base_value_table_name = tdSql.queryResult[0][0] base_value_table_name = tdSql.queryResult[0][0]
...@@ -324,9 +415,101 @@ class TDTestCase: ...@@ -324,9 +415,101 @@ class TDTestCase:
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_b';" %(database,i)) tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_b';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup) self.value_check(base_value_table_name,base_value_table_vgroup)
elif check_result_negative == 'Y':
#base table : sh_table_0_a
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_0_a_negative';" %(database))
base_value_table_name = tdSql.queryResult[0][0]
base_value_table_vgroup = tdSql.queryResult[0][1]
#check table :sh_table_i_a
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_a_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_a_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :sh_table_i_b
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_b_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_b_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :sh_table_i_c
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_c_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_c_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :sh_table_i_r
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_r_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_r_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#base table : bj_table_0_a
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_0_a_negative';" %(database))
base_value_table_name = tdSql.queryResult[0][0]
base_value_table_vgroup = tdSql.queryResult[0][1]
#check table :bj_table_i_a
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_a_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_a_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :bj_table_i_b
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_b_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_b_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :bj_table_i_c
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_c_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_c_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :bj_table_i_r
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_r_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_r_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#base table : hn_table_0_r
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='hn_table_0_r_negative';" %(database))
base_value_table_name = tdSql.queryResult[0][0]
base_value_table_vgroup = tdSql.queryResult[0][1]
#check table :hn_table_i_r
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'hn_table_%%_r_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='hn_table_%d_r_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#base table : tj_table_0_r
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_0_a_negative';" %(database))
base_value_table_name = tdSql.queryResult[0][0]
base_value_table_vgroup = tdSql.queryResult[0][1]
#check table :tj_table_i_a
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'tj_table_%%_a_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_a_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
#check table :tj_table_i_b
check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'tj_table_%%_b_negative';" %(database))
for i in range(check_rows):
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_b_negative';" %(database,i))
self.value_check(base_value_table_name,base_value_table_vgroup)
else: else:
pass pass
tdLog.info(f"create end:n:{n},vgroups:{vgroups},table_prefix:{table_prefix},table_suffix:{table_suffix},check_result_positive:{check_result_positive},check_result_negative:{check_result_negative}")
def value_check(self,base_value_table_name,base_value_table_vgroup): def value_check(self,base_value_table_name,base_value_table_vgroup):
check_value_table_name = tdSql.queryResult[0][0] check_value_table_name = tdSql.queryResult[0][0]
check_value_table_vgroup = tdSql.queryResult[0][1] check_value_table_vgroup = tdSql.queryResult[0][1]
...@@ -348,17 +531,28 @@ class TDTestCase: ...@@ -348,17 +531,28 @@ class TDTestCase:
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
#(self,database,n,vgroups,table_prefix,table_suffix) #(self,database,n,vgroups,table_prefix,table_suffix,check_result_positive,check_result_negative):
self.dropandcreateDB_random("%s" %self.db, 1,2,0,0,'N') #check_result_positive 检查前缀后缀是正数的,check_result_negative 检查前缀后缀是负数的(TS-3249)
self.dropandcreateDB_random("%s" %self.db, 1,2,0,2,'N') # self.dropandcreateDB_random("%s" %self.db, 1,2,0,0,'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,2,2,0,'N') # self.dropandcreateDB_random("%s" %self.db, 1,2,0,2,'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,2,3,3,'Y') # self.dropandcreateDB_random("%s" %self.db, 1,2,2,0,'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,3,3,3,'Y')
self.dropandcreateDB_random("%s" %self.db, 1,4,4,4,'Y') self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(0,3),random.randint(0,3),'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,5,5,5,'Y') self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(-10,0),random.randint(-10,0),'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(-191,0),random.randint(-191,0),'N','N')
self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(0,100),random.randint(0,91),'N','N')
# self.dropandcreateDB_random("%s" %self.db, 1,2,3,3,'Y','N')
# self.dropandcreateDB_random("%s" %self.db, 1,3,3,3,'Y','N')
# self.dropandcreateDB_random("%s" %self.db, 1,4,4,4,'Y','N')
# self.dropandcreateDB_random("%s" %self.db, 1,5,5,5,'Y','N')
self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(3,5),random.randint(3,5),'Y','N')
self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(-5,-1),0,'N','Y')
self.dropandcreateDB_random("%s" %self.db, 1,random.randint(1,5),random.randint(-5,-1),random.randint(-9,-0),'N','Y')
#taos -f sql # #taos -f sql
print("taos -f sql start!") print("taos -f sql start!")
taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename) taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
_ = subprocess.check_output(taos_cmd1, shell=True) _ = subprocess.check_output(taos_cmd1, shell=True)
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import random
import os
import time
import taos
import subprocess
from faker import Faker
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.testcasePath = os.path.split(__file__)[0]
self.testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.db = "sel_null"
def insert_data(self,database,vgroups):
num_random = 10
tdSql.execute('''drop database if exists %s ;''' %database)
tdSql.execute('''create database %s keep 36500 vgroups %d PRECISION 'us';'''%(database,vgroups))
tdSql.execute('''use %s;'''%database)
tdSql.execute('''create stable %s.stb0 (ts timestamp , c0 int , c1 double , c0null int , c1null double ) tags( t0 tinyint , t1 varchar(16) , 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);'''%database)
for i in range(5):
tdSql.execute('''create table %s.stb0_%d using %s.stb0 tags(%d,'varchar%d',%d,%d, %d, %d,%d,'binary%d','nchar%d',%d,%d,%d ) ;'''%(database,i,database,i,i,i,i,i,i,i,i,i,i,i,i))
# insert data
for i in range(num_random):
for j in range(50):
tdSql.execute('''insert into %s.stb0_0 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_1 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_2 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_3 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_4 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.query("select count(*) from %s.stb0;" %database)
tdSql.checkData(0,0,5*num_random*50)
tdSql.query("select count(*) from %s.stb0_0;"%database)
tdSql.checkData(0,0,num_random*50)
def ts_3085(self,database):
sql = "select count(c0null) from(select * from %s.stb0 limit 20,4) "%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
offset = random.randint(10,100)
for i in range(offset):
sql = "select count(c0null) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select count(c1null) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select count(c0) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(c1) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(t0) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(t1) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
def ts_2974_max(self,database):
sql = "select max(c0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c1) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c1),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c0null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c0null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c1null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c1null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(t0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t1) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t1),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_bool) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_bool),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_binary) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_binary),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_nchar) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_nchar),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_bigint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_bigint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_smallint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_smallint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_tinyint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_tinyint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_float) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_float),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_double) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_double),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
def ts_2974_min(self,database):
sql = "select min(c0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c1) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c1),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c0null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c0null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c1null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c1null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(t0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t1) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t1),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_bool) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_bool),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_binary) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_binary),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_nchar) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_nchar),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_bigint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_bigint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_smallint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_smallint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_tinyint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_tinyint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_float) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_float),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_double) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_double),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
def ts_2601(self,database):
tdSql.query("alter local 'keepcolumnname' '0';")
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now);"%(database)
tdSql.error(sql)
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"%(database)
tdSql.error(sql)
tdSql.query("alter local 'keepcolumnname' '1';")
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now);"%(database)
tdSql.query(sql)
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"%(database)
tdSql.query(sql)
def ts_3108(self,database):
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,2500)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')>now;"%(database)
tdSql.query(sql)
tdSql.checkRows(0)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')<now+1y;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,2500)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')>now+1y;"%(database)
tdSql.query(sql)
tdSql.checkRows(0)
def ts_3110(self,database):
sql1 = "select * from %s.stb0 order by ts desc limit 2;"%(database)
tdSql.query(sql1)
data1_0_0 = tdSql.getData(0,0)
data1_1_0 = tdSql.getData(1,0)
sql2 = "select * from (select * from %s.stb0 order by ts desc limit 2) order by ts;"%(database)
tdSql.query(sql2)
data2_0_0 = tdSql.getData(0,0)
data2_1_0 = tdSql.getData(1,0)
if (data1_0_0 == data2_1_0) and (data1_1_0 == data2_0_0):
tdLog.info("ts_3110: success")
else:
tdLog.exit("ts_3110: sql1 result:'%s' not equal sql2 result:'%s'" % (sql1,sql2))
def ts_3036(self,database):
sql1 = "select ts , c0 , c1 , c0null , c1null from (select ts , c0 , c1 , c0null , c1null from %s.stb0_0 where ts between now -1d and now +1d \
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_1 where ts between now -1d and now +1d \
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_2 where ts between now -1d and now +1d ) tt \
where ts < now order by tt.ts desc limit 2;"%(database,database,database)
tdSql.query(sql1)
data1_0_0 = tdSql.getData(0,0)
data1_1_0 = tdSql.getData(1,0)
sql2 = "select ts , c0 , c1 , c0null , c1null from (select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts > now \
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts = now \
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts < now ) tt \
where tt.ts between now -1d and now +1d and tt.tb in ('stb0_0','stb0_1','stb0_2') order by tt.ts desc limit 2;"%(database,database,database)
tdSql.query(sql2)
data2_0_0 = tdSql.getData(0,0)
data2_1_0 = tdSql.getData(1,0)
sql3 = "select ts , c0 , c1 , c0null , c1null from %s.stb0 \
where ts between now -1d and now +1d and tbname in ('stb0_0','stb0_1','stb0_2') order by ts desc limit 2;"%(database)
tdSql.query(sql3)
data3_0_0 = tdSql.getData(0,0)
data3_1_0 = tdSql.getData(1,0)
if (data1_0_0 == data2_0_0 == data3_0_0) and (data1_1_0 == data2_1_0 == data3_1_0):
tdLog.info("ts_3036: success")
else:
tdLog.exit("ts_3036: sql1 result:'%s' not equal sql2 result:'%s' or not equal sql3 result:'%s'" % (sql1,sql2,sql3))
def ts_23569(self,database):
tdSql.query("alter local 'keepcolumnname' '0';")
sql = "alter table %s.stb0 drop tag t10;"%(database)
tdSql.error(sql)
error_msg = tdSql.error(sql)
include_msg = 'Invalid tag name'
if include_msg in error_msg:
tdLog.info("ts_23569: success")
else:
tdLog.exit("ts_23569: include_msg:'%s' not in error_msg:'%s'" % (include_msg,error_msg))
tdSql.query("alter local 'keepcolumnname' '1';")
sql = "alter table %s.stb0 drop tag t10;"%(database)
tdSql.error(sql)
error_msg = tdSql.error(sql)
include_msg = 'Invalid tag name'
if include_msg in error_msg:
tdLog.info("ts_23569: success")
else:
tdLog.exit("ts_23569: include_msg:'%s' not in error_msg:'%s'" % (include_msg,error_msg))
def ts_23505(self,database):
sql = "create table %s.`12345` (`567` timestamp,num int);"%(database)
tdSql.execute(sql)
sql = "insert into %s.12345 values (now,1);"%(database)
tdSql.error(sql)
sql = "insert into %s.`12345` values (now,1);"%(database)
tdSql.execute(sql)
sql = "select * from %s.`12345` order by `567` desc limit 2;"%(database)
tdSql.query(sql)
tdSql.checkData(0,1,1)
sql = "drop table %s.`12345` ;"%(database)
tdSql.execute(sql)
sql = "select * from %s.`12345` order by `567` desc limit 2;"%(database)
tdSql.error(sql)
def run(self):
startTime = time.time()
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.insert_data("%s" %self.db,2)
self.ts_3085("%s" %self.db)
self.ts_2974_max("%s" %self.db)
self.ts_2974_min("%s" %self.db)
self.ts_2601("%s" %self.db)
self.ts_23569("%s" %self.db)
self.ts_3108("%s" %self.db)
self.ts_3110("%s" %self.db)
self.ts_23505("%s" %self.db)
self.ts_3036("%s" %self.db)
tdSql.query("flush database %s" %self.db)
self.ts_2974_max("%s" %self.db)
self.ts_2974_min("%s" %self.db)
self.ts_3085("%s" %self.db)
self.ts_2601("%s" %self.db)
self.ts_23569("%s" %self.db)
self.ts_3108("%s" %self.db)
self.ts_3110("%s" %self.db)
self.ts_23505("%s" %self.db)
self.ts_3036("%s" %self.db)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import os
import random
import re
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.testcasePath = os.path.split(__file__)[0]
self.testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def run_benchmark(self,dbname,tables,per_table_num,vgroups,replica):
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
print("%staosBenchmark -d %s -t %d -n %d -v %d -a %d -y " % (binPath,dbname,tables,per_table_num,vgroups,replica))
os.system("%staosBenchmark -d %s -t %d -n %d -v %d -a %d -y " % (binPath,dbname,tables,per_table_num,vgroups,replica))
def sql_query_time_cost(self,sql):
startTime = time.time()
tdSql.query(sql)
endTime = time.time()
tdLog.info("sql:%s query time cost (%d)s" % (sql,endTime - startTime))
def sql_limit_retun_n_slimit_return_error(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n = n;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num)
sql_0 = re.sub(r'\d\d',"0",sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d\d',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_data_limit_retun_n_slimit_return_error(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n = n;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num)
sql_0 = re.sub(r'\d\d',"0",sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d\d',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_limit_retun_1_slimit_return_error(self,sql,tables,per_table_num,base_fun,replace_fun):
#sql limit n =1;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(1)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(1)
sql_0 = re.sub(r'\d+',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_data_limit_retun_1_slimit_return_error(self,sql,tables,per_table_num,base_fun,replace_fun):
#sql limit n =1;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,1)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,1)
sql_0 = re.sub(r'\d+',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_last_limit_retun_1_slimit_return_error(self,sql,tables,per_table_num,base_fun,replace_fun):
#sql limit n =1;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
rows = tdSql.queryRows
if (rows >= 1 or rows <= 4):
tdLog.info("sql checkrows success")
else:
tdLog.exit(f"checkEqual error, sql_rows=={rows}")
self.sql_query_time_cost(nest_sql)
rows = tdSql.queryRows
if (rows >= 1 or rows <= 4):
tdLog.info("sql checkrows success")
else:
tdLog.exit(f"checkEqual error, sql_rows=={rows}")
sql_0 = re.sub(r'\d+',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_limit_retun_tables_slimit_return_error(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n;sql limit 0 = 0 ;sql slmit n = error;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_limit_retun_tables_slimit_return_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =tables;sql limit 0 = 0 ;sql slmit n = n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkRows(num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_retun_tables_slimit_return_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =tables;sql limit 0 = 0 ;sql slmit n = n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_retun_n_slimit_return_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n;sql limit 0 = 0 ;sql slmit n = 100;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkRows(tables)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_retun_n_slimit_return_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n;sql limit 0 = 0 ;sql slmit n = 100;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,tables)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_retun_tables_times_n_slimit_return_error(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*tables;sql limit 0 = 0 ;sql slmit n = tables*n;sql slimit 0 = 0
#interval
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num*tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d\d',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def sql_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*tables;sql limit 0 = 0 ;sql slmit n = per_table_num*n;sql slimit 0 = 0
#interval
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num*tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkRows(num*per_table_num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*tables;sql limit 0 = 0 ;sql slmit n = per_table_num*n;sql slimit 0 = 0
#interval
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num*tables)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num*tables)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num*per_table_num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_retun_n_slimit_return_per_table_num_times_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*tables;sql limit 0 = 0 ;sql slmit n = per_table_num*n;sql slimit 0 = 0
#interval
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkRows(tables*per_table_num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(tables*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*tables;sql limit 0 = 0 ;sql slmit n = per_table_num*n;sql slimit 0 = 0
#interval
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql) # \d是匹配数字字符[0-9],+匹配一个或多个
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','slimit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,tables*per_table_num)
nest_sql = nest_sql.replace('limit','slimit')
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,tables*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_not_test_slimitkeep_return_per_table_num_times_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql sql slmit n = per_table_num*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
sql = sql.replace('limit','limit')
self.sql_query_time_cost(sql)
tdSql.checkRows(num*per_table_num)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql sql slmit n = per_table_num*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
sql = sql.replace('limit','limit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num*per_table_num)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql sql slmit n = per_table_num*tables;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(tables*per_table_num)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(tables*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(self,sql,num,tables,per_table_num,base_fun,replace_fun):
#sql sql slmit n = per_table_num*tables;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,tables*per_table_num)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,tables*per_table_num)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(self,sql,num,num2,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*num2;sql limit 0 = 0 ;sql slmit n = num2*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num*num2)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
sql = sql.replace('limit','limit')
self.sql_query_time_cost(sql)
tdSql.checkRows(num*num2)
nest_sql = nest_sql.replace('limit','limit')
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num*num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(self,sql,num,num2,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*num2;sql limit 0 = 0 ;sql slmit n = num2*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num*num2)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num*num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
sql = sql.replace('limit','limit')
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num*num2)
nest_sql = nest_sql.replace('limit','limit')
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num*num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_limit_times_slimitkeep_return_n2(self,sql,num,num2,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*num2;sql limit 0 = 0 ;sql slmit n = num2*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkRows(num2)
self.sql_query_time_cost(nest_sql)
tdSql.checkRows(num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkRows(0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkRows(0)
def sql_data_limit_times_slimitkeep_return_n2(self,sql,num,num2,tables,per_table_num,base_fun,replace_fun):
#sql limit n =n*num2;sql limit 0 = 0 ;sql slmit n = num2*n;sql slimit 0 = 0
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,num2)
self.sql_query_time_cost(nest_sql)
tdSql.checkData(0,0,num2)
sql_0 = re.sub(r'\d\d',"0",sql)
self.sql_query_time_cost(sql_0)
tdSql.checkData(0,0,0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
self.sql_query_time_cost(nest_sql_0)
tdSql.checkData(0,0,0)
def sql_retun_error(self,sql,base_fun,replace_fun):
#sql limit n = error;sql limit 0 = error ;sql slmit n = error ;sql slimit 0 = error
sql = sql.replace('%s'%base_fun,'%s'%replace_fun)
nest_sql =" select * from (%s) " %sql
tdSql.error(sql)
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
sql = sql.replace('limit','slimit')
tdSql.error(sql)
nest_sql = nest_sql.replace('limit','slimit')
tdSql.error(nest_sql)
sql_0 = re.sub(r'\d+',"0",sql)
tdSql.error(sql_0)
nest_sql_0 = re.sub(r'\d\d',"0",nest_sql)
tdSql.error(nest_sql_0)
def fun_base(self,dbname,num,num2,tables,per_table_num,dbnamejoin,base_fun,replace_fun):
tdLog.info("base query ---------1----------")
sql = "select * from %s.meters limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.* from %s.meters a,%s.meters b where a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("base query ---------2----------")
sql = "select * from %s.meters where ts is not null limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.* from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("base query ---------3----------")
sql = "select * from %s.meters where ts is not null order by ts limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.* from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts order by b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("base query ---------4----------")
sql = "select * from %s.meters where ts is not null order by ts desc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.* from %s.meters a,%s.meters b where b.ts is not null and a.ts = b.ts order by a.ts desc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
def fun_count(self,dbname,num,num2,tables,per_table_num,dbnamejoin,base_fun,replace_fun):
tdLog.info("count query ---------1----------")
sql = "select count(*) from %s.meters limit %d" %(dbname,num)
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(a.*) from %s.meters a,%s.meters b where a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------2----------")
sql = "select count(*) from %s.meters where ts is not null limit %d" %(dbname,num)
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------3----------")
sql = "select count(*) from %s.meters where ts is not null order by ts limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select count(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts order by b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("count query ---------4----------")
sql = "select count(*) from %s.meters where ts is not null order by ts desc limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select count(a.*) from %s.meters a,%s.meters b where b.ts is not null and a.ts = b.ts order by a.ts desc limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("count query ---------5----------")
sql = "select count(*) from %s.meters where ts is not null group by tbname limit %d" %(dbname,num)
self.sql_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts group by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------6----------")
sql = "select count(*) from %s.meters where ts is not null partition by tbname limit %d" %(dbname,num)
self.sql_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------7----------")
sql = "select count(*) cc from %s.meters where ts is not null group by tbname order by cc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts group by b.tbname order by cc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------8----------")
sql = "select count(*) cc from %s.meters where ts is not null partition by tbname order by cc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by b.tbname order by cc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------9----------")
sql = "select count(*) cc from %s.meters where ts is not null interval(1a) limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------10----------")
sql = "select count(*) cc from %s.meters where ts is not null interval(1a) order by cc asc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) order by cc asc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------11----------")
sql = "select count(*) cc from %s.meters where ts is not null interval(1a) order by cc desc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) order by cc desc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------12----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null interval(1a) group by tbname limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) group by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("count query ---------13----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null interval(1a) partition by tbname limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) partition by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("count query ---------14----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) limit %d" %(dbname,num)
self.sql_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------15----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------16----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------17----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------18----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------19----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------20----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------21----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
tdLog.info("count query ---------22----------")
sql = "select tbname,count(*) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,count(*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
def fun_last(self,dbname,num,num2,tables,per_table_num,dbnamejoin,base_fun,replace_fun):
tdLog.info("last query ---------1----------")
sql = "select last(*) from %s.meters limit %d" %(dbname,num)
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_last_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_last_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_last_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_last_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------2----------")
sql = "select last(*) from %s.meters where ts is not null limit %d" %(dbname,num)
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_limit_retun_1_slimit_return_error(sql,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_last_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_last_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_limit_retun_1_slimit_return_error(sql_join,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_last_limit_retun_1_slimit_return_error(sql_union,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_last_limit_retun_1_slimit_return_error(sql_union_all,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------3----------")
sql = "select last(*) from %s.meters where ts is not null order by ts limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts order by b.ts limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("last query ---------4----------")
sql = "select last(*) from %s.meters where ts is not null order by ts desc limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where b.ts is not null and a.ts = b.ts order by a.ts desc limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("last query ---------5----------")
sql = "select last(*) from %s.meters where ts is not null group by tbname limit %d" %(dbname,num)
self.sql_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts group by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------6----------")
sql = "select last(*) from %s.meters where ts is not null partition by tbname limit %d" %(dbname,num)
self.sql_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_slimit_return_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.*) from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_slimit_return_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_slimit_return_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------7----------")
sql = "select last(ts) cc from %s.meters where ts is not null group by tbname order by cc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts group by b.tbname order by cc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------8----------")
sql = "select last(ts) cc from %s.meters where ts is not null partition by tbname order by cc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by b.tbname order by cc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------9----------")
sql = "select last(*) from %s.meters where ts is not null interval(1a) limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------10----------")
sql = "select last(ts) cc from %s.meters where ts is not null interval(1a) order by cc asc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) order by cc asc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------11----------")
sql = "select last(ts) cc from %s.meters where ts is not null interval(1a) order by cc desc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_error(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) order by cc desc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_error(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_error(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_error(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------12----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null interval(1a) group by tbname limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) group by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("last query ---------13----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null interval(1a) partition by tbname limit %d" %(dbname,num)
self.sql_retun_error(sql,base_fun,replace_fun)
sql = "select last(*) from (%s)" %sql
self.sql_retun_error(sql,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts interval(1a) partition by b.tbname limit %d" %(dbname,dbnamejoin,num)
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_join = "select last(*) from (%s)" %sql_join
self.sql_retun_error(sql_join,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_retun_error(sql_union,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_retun_error(sql_union_all,base_fun,replace_fun)
tdLog.info("last query ---------14----------")
sql = "select tbname,last(*) cc from %s.meters where ts is not null partition by tbname interval(1a) limit %d" %(dbname,num)
self.sql_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_tables_times_n_slimit_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------15----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------16----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc limit %d" %(dbname,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc limit %d" %(dbname,dbnamejoin,num)
self.sql_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_slimit_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------17----------")
sql = "select tbname,last(*) cc from %s.meters where ts is not null partition by tbname interval(1a) slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_n(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------18----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------19----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc slimit %d" %(dbname,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc slimit %d" %(dbname,dbnamejoin,num)
self.sql_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_join,num,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union,num,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_not_test_slimitkeep_return_per_table_num_times_tables(sql_union_all,num,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------20----------")
sql = "select tbname,last(*) cc from %s.meters where ts is not null partition by tbname interval(1a) slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.*) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_retun_n_times_n2_slimitkeep_return_n_times_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------21----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc asc slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc asc slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
tdLog.info("last query ---------22----------")
sql = "select tbname,last(ts) cc from %s.meters where ts is not null partition by tbname interval(1a) order by cc desc slimit %d limit %d" %(dbname,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql = "select count(*) from (%s)" %sql
self.sql_data_limit_times_slimitkeep_return_n2(sql,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql,sql)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select a.tbname,last(a.ts) cc from %s.meters a,%s.meters b where a.ts is not null and a.ts = b.ts partition by a.tbname interval(1a) order by cc desc slimit %d limit %d" %(dbname,dbnamejoin,num,num2)
self.sql_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_join = "select count(*) from (%s)" %sql_join
self.sql_data_limit_times_slimitkeep_return_n2(sql_join,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union = "(%s) union (%s)" %(sql_join,sql_join)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union,num,num2,tables,per_table_num,base_fun,replace_fun)
sql_union_all = "(%s) union all (%s)" %(sql_join,sql_union)
self.sql_data_limit_times_slimitkeep_return_n2(sql_union_all,num,num2,tables,per_table_num,base_fun,replace_fun)
def sql_base_check(self,sql1,sql2):
tdSql.query(sql1)
sql1_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql1,sql1_result))
tdSql.query(sql2)
sql2_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql2,sql2_result))
if sql1_result==sql2_result:
tdLog.info(f"checkEqual success, sql1_result={sql1_result},sql2_result={sql2_result}")
else :
tdLog.exit(f"checkEqual error, sql1_result=={sql1_result},sql2_result={sql2_result}")
def run_limit_slimit_sql(self,dbname,tables,per_table_num,dbnamejoin):
num,num2 = random.randint(10,100),random.randint(10,100)
self.sql_base(dbname,num,num2,tables,per_table_num,dbnamejoin)
tdSql.execute(" flush database %s;" %dbname)
self.sql_base(dbname,num,num2,tables,per_table_num,dbnamejoin)
def check_sub(self,dbname):
sql = "select count(*) from (select distinct(tbname) from %s.meters)" %dbname
self.sql_query_time_cost(sql)
num = tdSql.getData(0,0)
for i in range(0,num):
sql1 = "select count(*) from %s.d%d" %(dbname,i)
self.sql_query_time_cost(sql1)
sql1_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql1,sql1_result))
def sql_base(self,dbname,num,num2,tables,per_table_num,dbnamejoin):
sql = "select count(*) from %s.meters" %dbname
self.sql_query_time_cost(sql)
tdSql.checkData(0,0,tables*per_table_num)
sql = "select count(*) from %s.meters" %dbnamejoin
self.sql_query_time_cost(sql)
self.fun_base(dbname,num,num2,tables,per_table_num,dbnamejoin,'*','*')
# self.fun_count(dbname,num,num2,tables,per_table_num,dbnamejoin,'count','count')
# self.fun_last(dbname,num,num2,tables,per_table_num,dbnamejoin,'last','last')
# #self.fun_last(dbname,num,num2,tables,per_table_num,dbnamejoin,'last','last_row')
# self.fun_last(dbname,num,num2,tables,per_table_num,dbnamejoin,'last','first')
def test(self,dbname,tables,per_table_num,vgroups,replica,dbnamejoin):
self.run_benchmark(dbname,tables,per_table_num,vgroups,replica)
self.run_benchmark(dbnamejoin,tables,per_table_num,vgroups,replica)
self.run_limit_slimit_sql(dbname,tables,per_table_num,dbnamejoin)
def run(self):
startTime = time.time()
dbname = 'test'
dbnamejoin = 'testjoin'
vgroups = random.randint(1,8)
tables = random.randint(100,300)
per_table_num = random.randint(100,500)
replica = 1
#self.test('test',tables,per_table_num,vgroup,1)
#self.test('test',10000,150,vgroup,1)
self.test('test',100,150,vgroups,1,'testjoin') #方便调试,调试时不执行下面3个
# self.run_benchmark(dbname,tables,per_table_num,vgroups,replica)
# self.run_benchmark(dbnamejoin,tables*vgroups,per_table_num*vgroups,vgroups*2,replica) #方便测试不同数据量
# self.run_limit_slimit_sql(dbname,tables,per_table_num,dbnamejoin)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册