提交 ce084390 编写于 作者: S Shengliang Guan

Merge branch '3.0' into fix/dnode

...@@ -1123,10 +1123,44 @@ void taosCfgDynamicOptions(const char *option, const char *value) { ...@@ -1123,10 +1123,44 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
if (strncasecmp(option, "debugFlag", 9) == 0) { if (strncasecmp(option, "debugFlag", 9) == 0) {
int32_t flag = atoi(value); int32_t flag = atoi(value);
taosSetAllDebugFlag(flag); taosSetAllDebugFlag(flag);
return;
} }
if (strcasecmp(option, "resetlog") == 0) { if (strcasecmp(option, "resetlog") == 0) {
taosResetLog(); taosResetLog();
cfgDumpCfg(tsCfg, 0, false); cfgDumpCfg(tsCfg, 0, false);
return;
} }
if (strcasecmp(option, "monitor") == 0) {
int32_t monitor = atoi(value);
uInfo("monitor set from %d to %d", tsEnableMonitor, monitor);
tsEnableMonitor = monitor;
return;
}
const char *options[] = {
"dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag",
"tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tmrDebugFlag",
"uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag",
};
int32_t *optionVars[] = {
&dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag,
&tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tmrDebugFlag,
&uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag,
};
int32_t optionSize = tListLen(options);
for (int32_t d = 0; d < optionSize; ++d) {
const char *optName = options[d];
int32_t optLen = strlen(optName);
if (strncasecmp(option, optName, optLen) != 0) continue;
int32_t flag = atoi(value);
uInfo("%s set from %d to %d", optName, *optionVars[d], flag);
*optionVars[d] = flag;
return;
}
uError("failed to cfg dynamic option:%s value:%s", option, value);
} }
...@@ -781,7 +781,13 @@ _OVER: ...@@ -781,7 +781,13 @@ _OVER:
} }
static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node; SMnode *pMnode = pReq->info.node;
const char *options[] = {
"debugFlag", "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag",
"tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag",
"tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag",
};
int32_t optionSize = tListLen(options);
SMCfgDnodeReq cfgReq = {0}; SMCfgDnodeReq cfgReq = {0};
if (tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) { if (tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) {
...@@ -802,27 +808,52 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { ...@@ -802,27 +808,52 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
SEpSet epSet = mndGetDnodeEpset(pDnode); SEpSet epSet = mndGetDnodeEpset(pDnode);
mndReleaseDnode(pMnode, pDnode); mndReleaseDnode(pMnode, pDnode);
SDCfgDnodeReq dcfgReq = {0}; SDCfgDnodeReq dcfgReq = {0};
if (strncasecmp(cfgReq.config, "debugFlag", 9) == 0) { if (strcasecmp(cfgReq.config, "resetlog") == 0) {
strcpy(dcfgReq.config, "resetlog");
} else if (strncasecmp(cfgReq.config, "monitor", 7) == 0) {
const char *value = cfgReq.value; const char *value = cfgReq.value;
int32_t flag = atoi(value); int32_t flag = atoi(value);
if (flag <= 0) { if (flag <= 0) {
flag = atoi(cfgReq.config + 10); flag = atoi(cfgReq.config + 8);
} }
if (flag <= 0 || flag > 255) { if (flag < 0 || flag > 2) {
mError("dnode:%d, failed to config debugFlag since value:%d", cfgReq.dnodeId, flag); mError("dnode:%d, failed to config monitor since value:%d", cfgReq.dnodeId, flag);
terrno = TSDB_CODE_INVALID_CFG; terrno = TSDB_CODE_INVALID_CFG;
return -1; return -1;
} }
strcpy(dcfgReq.config, "debugFlag"); strcpy(dcfgReq.config, "monitor");
snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag);
} else if (strcasecmp(cfgReq.config, "resetlog") == 0) {
strcpy(dcfgReq.config, "resetlog");
} else { } else {
terrno = TSDB_CODE_INVALID_CFG; bool findOpt = false;
mError("dnode:%d, failed to config since %s", cfgReq.dnodeId, terrstr()); for (int32_t d = 0; d < optionSize; ++d) {
return -1; const char *optName = options[d];
int32_t optLen = strlen(optName);
if (strncasecmp(cfgReq.config, optName, optLen) != 0) continue;
const char *value = cfgReq.value;
int32_t flag = atoi(value);
if (flag <= 0) {
flag = atoi(cfgReq.config + optLen + 1);
}
if (flag <= 0 || flag > 255) {
mError("dnode:%d, failed to config %s since value:%d", cfgReq.dnodeId, optName, flag);
terrno = TSDB_CODE_INVALID_CFG;
return -1;
}
tstrncpy(dcfgReq.config, optName, optLen + 1);
snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag);
findOpt = true;
}
if (!findOpt) {
terrno = TSDB_CODE_INVALID_CFG;
mError("dnode:%d, failed to config since %s", cfgReq.dnodeId, terrstr());
return -1;
}
} }
int32_t bufLen = tSerializeSDCfgDnodeReq(NULL, 0, &dcfgReq); int32_t bufLen = tSerializeSDCfgDnodeReq(NULL, 0, &dcfgReq);
...@@ -831,13 +862,14 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { ...@@ -831,13 +862,14 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
if (pBuf == NULL) return -1; if (pBuf == NULL) return -1;
tSerializeSDCfgDnodeReq(pBuf, bufLen, &dcfgReq); tSerializeSDCfgDnodeReq(pBuf, bufLen, &dcfgReq);
mDebug("dnode:%d, send config req to dnode, app:%p", cfgReq.dnodeId, pReq->info.ahandle); mInfo("dnode:%d, send config req to dnode, app:%p config:%s value:%s", cfgReq.dnodeId, pReq->info.ahandle,
dcfgReq.config, dcfgReq.value);
SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE, .pCont = pBuf, .contLen = bufLen}; SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE, .pCont = pBuf, .contLen = bufLen};
return tmsgSendReq(&epSet, &rpcMsg); return tmsgSendReq(&epSet, &rpcMsg);
} }
static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp) { static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp) {
mDebug("config rsp from dnode, app:%p", pRsp->info.ahandle); mInfo("config rsp from dnode, app:%p", pRsp->info.ahandle);
return 0; return 0;
} }
......
...@@ -293,7 +293,7 @@ int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader) { ...@@ -293,7 +293,7 @@ int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader) {
int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) { int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) {
if (pSyncNode->peersNum == 0) { if (pSyncNode->peersNum == 0) {
sError("only one replica, cannot leader transfer"); sDebug("only one replica, cannot leader transfer");
terrno = TSDB_CODE_SYN_ONE_REPLICA; terrno = TSDB_CODE_SYN_ONE_REPLICA;
return -1; return -1;
} }
...@@ -307,7 +307,7 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) { ...@@ -307,7 +307,7 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) {
int32_t ret = 0; int32_t ret = 0;
if (pSyncNode->replicaNum == 1) { if (pSyncNode->replicaNum == 1) {
sError("only one replica, cannot leader transfer"); sDebug("only one replica, cannot leader transfer");
terrno = TSDB_CODE_SYN_ONE_REPLICA; terrno = TSDB_CODE_SYN_ONE_REPLICA;
return -1; return -1;
} }
......
#======================b1-start=============== #======================b1-start===============
# ---- alter
./test.sh -f tsim/alter/cached_schema_after_alter.sim
./test.sh -f tsim/alter/dnode.sim
#./test.sh -f tsim/alter/table.sim
# ---- user # ---- user
./test.sh -f tsim/user/basic.sim ./test.sh -f tsim/user/basic.sim
./test.sh -f tsim/user/password.sim ./test.sh -f tsim/user/password.sim
......
...@@ -4,39 +4,34 @@ system sh/exec.sh -n dnode1 -s start ...@@ -4,39 +4,34 @@ system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql alter dnode 1 resetlog sql alter dnode 1 'resetlog'
sql alter dnode 1 monitor 1 sql alter dnode 1 'monitor' '1'
sql alter dnode 1 'monitor' '0'
sleep 3000 sql alter dnode 1 'monitor 1'
sql select * from log.dn sql alter dnode 1 'monitor 0'
if $rows <= 0 then
return -1
endi
print ======== step2 print ======== step2
sql_error alter dnode 1 'resetquerycache'
sql alter dnode 1 'debugFlag 135'
sql alter dnode 1 'dDebugFlag 131'
sql alter dnode 1 'vDebugFlag 131'
sql alter dnode 1 'mDebugFlag 131'
sql alter dnode 1 'wDebugFlag 131'
sql alter dnode 1 'sDebugFlag 131'
sql alter dnode 1 'tsdbDebugFlag 131'
sql alter dnode 1 'tqDebugFlag 131'
sql alter dnode 1 'fsDebugFlag 131'
sql alter dnode 1 'udfDebugFlag 131'
sql alter dnode 1 'smaDebugFlag 131'
sql alter dnode 1 'idxDebugFlag 131'
sql alter dnode 1 'tmrDebugFlag 131'
sql alter dnode 1 'uDebugFlag 131'
sql alter dnode 1 'smaDebugFlag 131'
sql alter dnode 1 'rpcDebugFlag 131'
sql alter dnode 1 'qDebugFlag 131'
sql alter dnode 1 resetquerycache sql_error alter dnode 2 'wDebugFlag 135'
sql alter dnode 1 debugFlag 135 sql_error alter dnode 2 'tmrDebugFlag 135'
sql alter dnode 1 debugFlag 131
sql alter dnode 1 monitor 0
sql alter dnode 1 debugFlag 135
sql alter dnode 1 monDebugFlag 135
sql alter dnode 1 vDebugFlag 135
sql alter dnode 1 mDebugFlag 135
sql alter dnode 1 cDebugFlag 135
sql alter dnode 1 httpDebugFlag 135
sql alter dnode 1 qDebugflag 135
sql alter dnode 1 sdbDebugFlag 135
sql alter dnode 1 uDebugFlag 135
sql alter dnode 1 tsdbDebugFlag 135
sql alter dnode 1 sDebugflag 135
sql alter dnode 1 rpcDebugFlag 135
sql alter dnode 1 dDebugFlag 135
sql alter dnode 1 mqttDebugFlag 135
sql alter dnode 1 wDebugFlag 135
sql alter dnode 1 tmrDebugFlag 135
sql_error alter dnode 2 wDebugFlag 135
sql_error alter dnode 2 tmrDebugFlag 135
print ======== step3 print ======== step3
sql_error alter $hostname1 debugFlag 135 sql_error alter $hostname1 debugFlag 135
...@@ -47,10 +42,10 @@ sql_error alter dnode $hostname2 debugFlag 135 ...@@ -47,10 +42,10 @@ sql_error alter dnode $hostname2 debugFlag 135
sql_error alter dnode $hostname2 monDebugFlag 135 sql_error alter dnode $hostname2 monDebugFlag 135
sql_error alter dnode $hostname2 vDebugFlag 135 sql_error alter dnode $hostname2 vDebugFlag 135
sql_error alter dnode $hostname2 mDebugFlag 135 sql_error alter dnode $hostname2 mDebugFlag 135
sql alter dnode $hostname1 debugFlag 135 sql_error alter dnode $hostname1 debugFlag 135
sql alter dnode $hostname1 monDebugFlag 135 sql_error alter dnode $hostname1 monDebugFlag 135
sql alter dnode $hostname1 vDebugFlag 135 sql_error alter dnode $hostname1 vDebugFlag 135
sql alter dnode $hostname1 tmrDebugFlag 131 sql_error alter dnode $hostname1 tmrDebugFlag 131
print ======== step4 print ======== step4
sql_error sql alter dnode 1 balance 0 sql_error sql alter dnode 1 balance 0
......
...@@ -315,9 +315,7 @@ endi ...@@ -315,9 +315,7 @@ endi
print ======== step9 print ======== step9
print ======== step10 print ======== step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000
sql use d1 sql use d1
sql describe tb sql describe tb
......
...@@ -13,11 +13,11 @@ class TDTestCase: ...@@ -13,11 +13,11 @@ class TDTestCase:
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
# name of normal table # name of normal table
self.ntbname = 'ntb' self.ntbname = 'ntb'
# name of stable # name of stable
self.stbname = 'stb' self.stbname = 'stb'
# structure of column # structure of column
self.column_dict = { self.column_dict = {
'ts':'timestamp', 'ts':'timestamp',
'c1':'int', 'c1':'int',
'c2':'float', 'c2':'float',
...@@ -25,13 +25,13 @@ class TDTestCase: ...@@ -25,13 +25,13 @@ class TDTestCase:
'c4':'nchar(20)' 'c4':'nchar(20)'
} }
# structure of tag # structure of tag
self.tag_dict = { self.tag_dict = {
't0':'int' 't0':'int'
} }
# number of child tables # number of child tables
self.tbnum = 2 self.tbnum = 2
# values of tag,the number of values should equal to tbnum # values of tag,the number of values should equal to tbnum
self.tag_values = [ self.tag_values = [
f'10', f'10',
f'100' f'100'
] ]
...@@ -42,7 +42,7 @@ class TDTestCase: ...@@ -42,7 +42,7 @@ class TDTestCase:
] ]
self.error_param = [1,'now()'] self.error_param = [1,'now()']
def run(self): # sourcery skip: extract-duplicate-method def run(self): # sourcery skip: extract-duplicate-method
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create tables==========") tdLog.printNoPrefix("==========step1:create tables==========")
...@@ -93,11 +93,11 @@ class TDTestCase: ...@@ -93,11 +93,11 @@ class TDTestCase:
tdSql.query("select ts from ntb where to_unixtimestamp('1970-01-01T08:00:00+08:00')=0") tdSql.query("select ts from ntb where to_unixtimestamp('1970-01-01T08:00:00+08:00')=0")
tdSql.checkRows(3) tdSql.checkRows(3)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
\ No newline at end of file
...@@ -9,14 +9,14 @@ from util.cases import * ...@@ -9,14 +9,14 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.PI =3.1415926 self.PI =3.1415926
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -24,7 +24,7 @@ class TDTestCase: ...@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -66,14 +66,14 @@ class TDTestCase: ...@@ -66,14 +66,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
''' '''
) )
def check_result_auto_acos(self ,origin_query , pow_query): def check_result_auto_acos(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query) pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query) origin_result = tdSql.getResult(origin_query)
auto_result =[] auto_result =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -93,7 +93,7 @@ class TDTestCase: ...@@ -93,7 +93,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -101,7 +101,7 @@ class TDTestCase: ...@@ -101,7 +101,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("acos value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select acos from t1", "select acos from t1",
...@@ -135,42 +135,42 @@ class TDTestCase: ...@@ -135,42 +135,42 @@ class TDTestCase:
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
def support_types(self): def support_types(self):
type_error_sql_lists = [ type_error_sql_lists = [
"select acos(ts) from t1" , "select acos(ts) from t1" ,
"select acos(c7) from t1", "select acos(c7) from t1",
"select acos(c8) from t1", "select acos(c8) from t1",
"select acos(c9) from t1", "select acos(c9) from t1",
"select acos(ts) from ct1" , "select acos(ts) from ct1" ,
"select acos(c7) from ct1", "select acos(c7) from ct1",
"select acos(c8) from ct1", "select acos(c8) from ct1",
"select acos(c9) from ct1", "select acos(c9) from ct1",
"select acos(ts) from ct3" , "select acos(ts) from ct3" ,
"select acos(c7) from ct3", "select acos(c7) from ct3",
"select acos(c8) from ct3", "select acos(c8) from ct3",
"select acos(c9) from ct3", "select acos(c9) from ct3",
"select acos(ts) from ct4" , "select acos(ts) from ct4" ,
"select acos(c7) from ct4", "select acos(c7) from ct4",
"select acos(c8) from ct4", "select acos(c8) from ct4",
"select acos(c9) from ct4", "select acos(c9) from ct4",
"select acos(ts) from stb1" , "select acos(ts) from stb1" ,
"select acos(c7) from stb1", "select acos(c7) from stb1",
"select acos(c8) from stb1", "select acos(c8) from stb1",
"select acos(c9) from stb1" , "select acos(c9) from stb1" ,
"select acos(ts) from stbbb1" , "select acos(ts) from stbbb1" ,
"select acos(c7) from stbbb1", "select acos(c7) from stbbb1",
"select acos(ts) from tbname", "select acos(ts) from tbname",
"select acos(c9) from tbname" "select acos(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select acos(c1) from t1", "select acos(c1) from t1",
"select acos(c2) from t1", "select acos(c2) from t1",
...@@ -200,16 +200,16 @@ class TDTestCase: ...@@ -200,16 +200,16 @@ class TDTestCase:
"select acos(c5) from stb1", "select acos(c5) from stb1",
"select acos(c6) from stb1", "select acos(c6) from stb1",
"select acos(c6) as alisb from stb1", "select acos(c6) as alisb from stb1",
"select acos(c6) alisb from stb1", "select acos(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_acos_function(self): def basic_acos_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -250,7 +250,7 @@ class TDTestCase: ...@@ -250,7 +250,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from t1") self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,acos(c2) from ct1") tdSql.query("select c2 ,acos(c2) from ct1")
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -266,7 +266,7 @@ class TDTestCase: ...@@ -266,7 +266,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_acos( "select c1, c2, c3 , c4, c5 from ct1", "select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from ct1") self.check_result_auto_acos( "select c1, c2, c3 , c4, c5 from ct1", "select acos(c1), acos(c2) ,acos(c3), acos(c4), acos(c5) from ct1")
# nest query for acos functions # nest query for acos functions
tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;") tdSql.query("select c4 , acos(c4) ,acos(acos(c4)) , acos(acos(acos(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -284,21 +284,21 @@ class TDTestCase: ...@@ -284,21 +284,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , None) tdSql.checkData(11 , 2 , None)
tdSql.checkData(11 , 3 , None) tdSql.checkData(11 , 3 , None)
# used for stable table # used for stable table
tdSql.query("select acos(c1) from stb1") tdSql.query("select acos(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select acos(c1) from stbbb1") tdSql.error("select acos(c1) from stbbb1")
tdSql.error("select acos(c1) from tbname") tdSql.error("select acos(c1) from tbname")
tdSql.error("select acos(c1) from ct5") tdSql.error("select acos(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, acos(c1) from ct1") tdSql.query("select c1, acos(c1) from ct1")
tdSql.query("select c2, acos(c2) from ct4") tdSql.query("select c2, acos(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ") tdSql.query("select c1, acos(c1),acos(c1), acos(acos(c1)) from ct4 ")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,None) tdSql.checkData(3 , 1 ,None)
tdSql.checkData(3 , 2 ,None) tdSql.checkData(3 , 2 ,None)
...@@ -327,8 +327,8 @@ class TDTestCase: ...@@ -327,8 +327,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ") tdSql.query("select c1, acos(c1) -0 ,acos(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -397,10 +397,10 @@ class TDTestCase: ...@@ -397,10 +397,10 @@ class TDTestCase:
tdSql.checkData(0,3,0.000000000) tdSql.checkData(0,3,0.000000000)
tdSql.checkData(0,4,-0.100000000) tdSql.checkData(0,4,-0.100000000)
tdSql.checkData(0,5,2) tdSql.checkData(0,5,2)
def pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -429,11 +429,11 @@ class TDTestCase: ...@@ -429,11 +429,11 @@ class TDTestCase:
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from sub1_bound") self.check_result_auto_acos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select acos(abs(c1)), acos(abs(c2)) ,acos(abs(c3)), acos(abs(c4)), acos(abs(c5)) from sub1_bound")
self.check_result_auto_acos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from sub1_bound") self.check_result_auto_acos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select acos(c1), acos(c2) ,acos(c3), acos(c3), acos(c2) ,acos(c1) from sub1_bound")
self.check_result_auto_acos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select acos(abs(c1)) from sub1_bound" ) self.check_result_auto_acos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select acos(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select acos(abs(c1)) ,acos(abs(c2)) , acos(abs(c3)) , acos(abs(c4)), acos(abs(c5)), acos(abs(c6)) from sub1_bound ") tdSql.query("select acos(abs(c1)) ,acos(abs(c2)) , acos(abs(c3)) , acos(abs(c4)), acos(abs(c5)), acos(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,None) tdSql.checkData(0,0,None)
...@@ -492,41 +492,41 @@ class TDTestCase: ...@@ -492,41 +492,41 @@ class TDTestCase:
self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) ,acos(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) ,acos(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) , acos(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_acos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select acos(t1) , acos(c5) from stb1 where c1 > 0 order by tbname" )
pass pass
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: acos basic query ============") tdLog.printNoPrefix("==========step4: acos basic query ============")
self.basic_acos_function() self.basic_acos_function()
tdLog.printNoPrefix("==========step5: big number acos query ============") tdLog.printNoPrefix("==========step5: big number acos query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: acos boundary query ============") tdLog.printNoPrefix("==========step6: acos boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: acos filter query ============") tdLog.printNoPrefix("==========step7: acos filter query ============")
self.abs_func_filter() self.abs_func_filter()
tdLog.printNoPrefix("==========step7: acos filter query ============") tdLog.printNoPrefix("==========step7: acos filter query ============")
self.abs_func_filter() self.abs_func_filter()
......
...@@ -9,14 +9,14 @@ from util.cases import * ...@@ -9,14 +9,14 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
self.PI =3.1415926 self.PI =3.1415926
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -24,7 +24,7 @@ class TDTestCase: ...@@ -24,7 +24,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -66,14 +66,14 @@ class TDTestCase: ...@@ -66,14 +66,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
''' '''
) )
def check_result_auto_asin(self ,origin_query , pow_query): def check_result_auto_asin(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query) pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query) origin_result = tdSql.getResult(origin_query)
auto_result =[] auto_result =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -93,7 +93,7 @@ class TDTestCase: ...@@ -93,7 +93,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -101,7 +101,7 @@ class TDTestCase: ...@@ -101,7 +101,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("asin value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("asin value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select asin from t1", "select asin from t1",
...@@ -135,42 +135,42 @@ class TDTestCase: ...@@ -135,42 +135,42 @@ class TDTestCase:
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
def support_types(self): def support_types(self):
type_error_sql_lists = [ type_error_sql_lists = [
"select asin(ts) from t1" , "select asin(ts) from t1" ,
"select asin(c7) from t1", "select asin(c7) from t1",
"select asin(c8) from t1", "select asin(c8) from t1",
"select asin(c9) from t1", "select asin(c9) from t1",
"select asin(ts) from ct1" , "select asin(ts) from ct1" ,
"select asin(c7) from ct1", "select asin(c7) from ct1",
"select asin(c8) from ct1", "select asin(c8) from ct1",
"select asin(c9) from ct1", "select asin(c9) from ct1",
"select asin(ts) from ct3" , "select asin(ts) from ct3" ,
"select asin(c7) from ct3", "select asin(c7) from ct3",
"select asin(c8) from ct3", "select asin(c8) from ct3",
"select asin(c9) from ct3", "select asin(c9) from ct3",
"select asin(ts) from ct4" , "select asin(ts) from ct4" ,
"select asin(c7) from ct4", "select asin(c7) from ct4",
"select asin(c8) from ct4", "select asin(c8) from ct4",
"select asin(c9) from ct4", "select asin(c9) from ct4",
"select asin(ts) from stb1" , "select asin(ts) from stb1" ,
"select asin(c7) from stb1", "select asin(c7) from stb1",
"select asin(c8) from stb1", "select asin(c8) from stb1",
"select asin(c9) from stb1" , "select asin(c9) from stb1" ,
"select asin(ts) from stbbb1" , "select asin(ts) from stbbb1" ,
"select asin(c7) from stbbb1", "select asin(c7) from stbbb1",
"select asin(ts) from tbname", "select asin(ts) from tbname",
"select asin(c9) from tbname" "select asin(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select asin(c1) from t1", "select asin(c1) from t1",
"select asin(c2) from t1", "select asin(c2) from t1",
...@@ -200,16 +200,16 @@ class TDTestCase: ...@@ -200,16 +200,16 @@ class TDTestCase:
"select asin(c5) from stb1", "select asin(c5) from stb1",
"select asin(c6) from stb1", "select asin(c6) from stb1",
"select asin(c6) as alisb from stb1", "select asin(c6) as alisb from stb1",
"select asin(c6) alisb from stb1", "select asin(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_asin_function(self): def basic_asin_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -250,7 +250,7 @@ class TDTestCase: ...@@ -250,7 +250,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from t1") self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,asin(c2) from ct1") tdSql.query("select c2 ,asin(c2) from ct1")
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -266,7 +266,7 @@ class TDTestCase: ...@@ -266,7 +266,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_asin( "select c1, c2, c3 , c4, c5 from ct1", "select asin(c1), asin(c2) ,asin(c3), asin(c4), asin(c5) from ct1") self.check_result_auto_asin( "select c1, c2, c3 , c4, c5 from ct1", "select asin(c1), asin(c2) ,asin(c3), asin(c4), asin(c5) from ct1")
# nest query for asin functions # nest query for asin functions
tdSql.query("select c4 , asin(c4) ,asin(asin(c4)) , asin(asin(asin(c4))) from ct1;") tdSql.query("select c4 , asin(c4) ,asin(asin(c4)) , asin(asin(asin(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -284,21 +284,21 @@ class TDTestCase: ...@@ -284,21 +284,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , None) tdSql.checkData(11 , 2 , None)
tdSql.checkData(11 , 3 , None) tdSql.checkData(11 , 3 , None)
# used for stable table # used for stable table
tdSql.query("select asin(c1) from stb1") tdSql.query("select asin(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select asin(c1) from stbbb1") tdSql.error("select asin(c1) from stbbb1")
tdSql.error("select asin(c1) from tbname") tdSql.error("select asin(c1) from tbname")
tdSql.error("select asin(c1) from ct5") tdSql.error("select asin(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, asin(c1) from ct1") tdSql.query("select c1, asin(c1) from ct1")
tdSql.query("select c2, asin(c2) from ct4") tdSql.query("select c2, asin(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, asin(c1),asin(c1), asin(asin(c1)) from ct4 ") tdSql.query("select c1, asin(c1),asin(c1), asin(asin(c1)) from ct4 ")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,None) tdSql.checkData(3 , 1 ,None)
tdSql.checkData(3 , 2 ,None) tdSql.checkData(3 , 2 ,None)
...@@ -327,8 +327,8 @@ class TDTestCase: ...@@ -327,8 +327,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, asin(c1) -0 ,asin(c1-4)-0 from ct4 ") tdSql.query("select c1, asin(c1) -0 ,asin(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -397,10 +397,10 @@ class TDTestCase: ...@@ -397,10 +397,10 @@ class TDTestCase:
tdSql.checkData(0,3,1.000000000) tdSql.checkData(0,3,1.000000000)
tdSql.checkData(0,4,0.900000000) tdSql.checkData(0,4,0.900000000)
tdSql.checkData(0,5,2) tdSql.checkData(0,5,2)
def pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -429,11 +429,11 @@ class TDTestCase: ...@@ -429,11 +429,11 @@ class TDTestCase:
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from sub1_bound") self.check_result_auto_asin( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select asin(abs(c1)), asin(abs(c2)) ,asin(abs(c3)), asin(abs(c4)), asin(abs(c5)) from sub1_bound")
self.check_result_auto_asin( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select asin(c1), asin(c2) ,asin(c3), asin(c3), asin(c2) ,asin(c1) from sub1_bound") self.check_result_auto_asin( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select asin(c1), asin(c2) ,asin(c3), asin(c3), asin(c2) ,asin(c1) from sub1_bound")
self.check_result_auto_asin("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select asin(abs(c1)) from sub1_bound" ) self.check_result_auto_asin("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select asin(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select asin(abs(c1)) ,asin(abs(c2)) , asin(abs(c3)) , asin(abs(c4)), asin(abs(c5)), asin(abs(c6)) from sub1_bound ") tdSql.query("select asin(abs(c1)) ,asin(abs(c2)) , asin(abs(c3)) , asin(abs(c4)), asin(abs(c5)), asin(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,None) tdSql.checkData(0,0,None)
...@@ -492,37 +492,37 @@ class TDTestCase: ...@@ -492,37 +492,37 @@ class TDTestCase:
self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) ,asin(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) ,asin(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) , asin(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_asin( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select asin(t1) , asin(c5) from stb1 where c1 > 0 order by tbname" )
pass pass
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: asin basic query ============") tdLog.printNoPrefix("==========step4: asin basic query ============")
self.basic_asin_function() self.basic_asin_function()
tdLog.printNoPrefix("==========step5: big number asin query ============") tdLog.printNoPrefix("==========step5: big number asin query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: asin boundary query ============") tdLog.printNoPrefix("==========step6: asin boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: asin filter query ============") tdLog.printNoPrefix("==========step7: asin filter query ============")
self.abs_func_filter() self.abs_func_filter()
......
...@@ -9,13 +9,13 @@ from util.cases import * ...@@ -9,13 +9,13 @@ from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, powSql): def init(self, conn, powSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -23,7 +23,7 @@ class TDTestCase: ...@@ -23,7 +23,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -65,14 +65,14 @@ class TDTestCase: ...@@ -65,14 +65,14 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
''' '''
) )
def check_result_auto_atan(self ,origin_query , pow_query): def check_result_auto_atan(self ,origin_query , pow_query):
pow_result = tdSql.getResult(pow_query) pow_result = tdSql.getResult(pow_query)
origin_result = tdSql.getResult(origin_query) origin_result = tdSql.getResult(origin_query)
auto_result =[] auto_result =[]
for row in origin_result: for row in origin_result:
row_check = [] row_check = []
for elem in row: for elem in row:
...@@ -90,7 +90,7 @@ class TDTestCase: ...@@ -90,7 +90,7 @@ class TDTestCase:
if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None):
check_status = False check_status = False
elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001):
check_status = False check_status = False
else: else:
pass pass
if not check_status: if not check_status:
...@@ -98,7 +98,7 @@ class TDTestCase: ...@@ -98,7 +98,7 @@ class TDTestCase:
sys.exit(1) sys.exit(1)
else: else:
tdLog.info("atan value check pass , it work as expected ,sql is \"%s\" "%pow_query ) tdLog.info("atan value check pass , it work as expected ,sql is \"%s\" "%pow_query )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select atan from t1", "select atan from t1",
...@@ -132,42 +132,42 @@ class TDTestCase: ...@@ -132,42 +132,42 @@ class TDTestCase:
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
def support_types(self): def support_types(self):
type_error_sql_lists = [ type_error_sql_lists = [
"select atan(ts) from t1" , "select atan(ts) from t1" ,
"select atan(c7) from t1", "select atan(c7) from t1",
"select atan(c8) from t1", "select atan(c8) from t1",
"select atan(c9) from t1", "select atan(c9) from t1",
"select atan(ts) from ct1" , "select atan(ts) from ct1" ,
"select atan(c7) from ct1", "select atan(c7) from ct1",
"select atan(c8) from ct1", "select atan(c8) from ct1",
"select atan(c9) from ct1", "select atan(c9) from ct1",
"select atan(ts) from ct3" , "select atan(ts) from ct3" ,
"select atan(c7) from ct3", "select atan(c7) from ct3",
"select atan(c8) from ct3", "select atan(c8) from ct3",
"select atan(c9) from ct3", "select atan(c9) from ct3",
"select atan(ts) from ct4" , "select atan(ts) from ct4" ,
"select atan(c7) from ct4", "select atan(c7) from ct4",
"select atan(c8) from ct4", "select atan(c8) from ct4",
"select atan(c9) from ct4", "select atan(c9) from ct4",
"select atan(ts) from stb1" , "select atan(ts) from stb1" ,
"select atan(c7) from stb1", "select atan(c7) from stb1",
"select atan(c8) from stb1", "select atan(c8) from stb1",
"select atan(c9) from stb1" , "select atan(c9) from stb1" ,
"select atan(ts) from stbbb1" , "select atan(ts) from stbbb1" ,
"select atan(c7) from stbbb1", "select atan(c7) from stbbb1",
"select atan(ts) from tbname", "select atan(ts) from tbname",
"select atan(c9) from tbname" "select atan(c9) from tbname"
] ]
for type_sql in type_error_sql_lists: for type_sql in type_error_sql_lists:
tdSql.error(type_sql) tdSql.error(type_sql)
type_sql_lists = [ type_sql_lists = [
"select atan(c1) from t1", "select atan(c1) from t1",
"select atan(c2) from t1", "select atan(c2) from t1",
...@@ -197,16 +197,16 @@ class TDTestCase: ...@@ -197,16 +197,16 @@ class TDTestCase:
"select atan(c5) from stb1", "select atan(c5) from stb1",
"select atan(c6) from stb1", "select atan(c6) from stb1",
"select atan(c6) as alisb from stb1", "select atan(c6) as alisb from stb1",
"select atan(c6) alisb from stb1", "select atan(c6) alisb from stb1",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
tdSql.query(type_sql) tdSql.query(type_sql)
def basic_atan_function(self): def basic_atan_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -247,7 +247,7 @@ class TDTestCase: ...@@ -247,7 +247,7 @@ class TDTestCase:
tdSql.checkData(5, 5, None) tdSql.checkData(5, 5, None)
self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from t1") self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from t1")
# used for sub table # used for sub table
tdSql.query("select c2 ,atan(c2) from ct1") tdSql.query("select c2 ,atan(c2) from ct1")
tdSql.checkData(0, 1, 1.570785077) tdSql.checkData(0, 1, 1.570785077)
...@@ -263,7 +263,7 @@ class TDTestCase: ...@@ -263,7 +263,7 @@ class TDTestCase:
tdSql.checkData(5 , 2, None) tdSql.checkData(5 , 2, None)
self.check_result_auto_atan( "select c1, c2, c3 , c4, c5 from ct1", "select atan(c1), atan(c2) ,atan(c3), atan(c4), atan(c5) from ct1") self.check_result_auto_atan( "select c1, c2, c3 , c4, c5 from ct1", "select atan(c1), atan(c2) ,atan(c3), atan(c4), atan(c5) from ct1")
# nest query for atan functions # nest query for atan functions
tdSql.query("select c4 , atan(c4) ,atan(atan(c4)) , atan(atan(atan(c4))) from ct1;") tdSql.query("select c4 , atan(c4) ,atan(atan(c4)) , atan(atan(atan(c4))) from ct1;")
tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 0 , 88)
...@@ -281,21 +281,21 @@ class TDTestCase: ...@@ -281,21 +281,21 @@ class TDTestCase:
tdSql.checkData(11 , 2 , -1.000958403) tdSql.checkData(11 , 2 , -1.000958403)
tdSql.checkData(11 , 3 , -0.785877135) tdSql.checkData(11 , 3 , -0.785877135)
# used for stable table # used for stable table
tdSql.query("select atan(c1) from stb1") tdSql.query("select atan(c1) from stb1")
tdSql.checkRows(25) tdSql.checkRows(25)
# used for not exists table # used for not exists table
tdSql.error("select atan(c1) from stbbb1") tdSql.error("select atan(c1) from stbbb1")
tdSql.error("select atan(c1) from tbname") tdSql.error("select atan(c1) from tbname")
tdSql.error("select atan(c1) from ct5") tdSql.error("select atan(c1) from ct5")
# mix with common col # mix with common col
tdSql.query("select c1, atan(c1) from ct1") tdSql.query("select c1, atan(c1) from ct1")
tdSql.query("select c2, atan(c2) from ct4") tdSql.query("select c2, atan(c2) from ct4")
# mix with common functions # mix with common functions
tdSql.query("select c1, atan(c1),atan(c1), atan(atan(c1)) from ct4 ") tdSql.query("select c1, atan(c1),atan(c1), atan(atan(c1)) from ct4 ")
...@@ -303,7 +303,7 @@ class TDTestCase: ...@@ -303,7 +303,7 @@ class TDTestCase:
tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 1 ,None)
tdSql.checkData(0 , 2 ,None) tdSql.checkData(0 , 2 ,None)
tdSql.checkData(0 , 3 ,None) tdSql.checkData(0 , 3 ,None)
tdSql.checkData(3 , 0 , 6) tdSql.checkData(3 , 0 , 6)
tdSql.checkData(3 , 1 ,1.405647649) tdSql.checkData(3 , 1 ,1.405647649)
tdSql.checkData(3 , 2 ,1.405647649) tdSql.checkData(3 , 2 ,1.405647649)
...@@ -324,8 +324,8 @@ class TDTestCase: ...@@ -324,8 +324,8 @@ class TDTestCase:
tdSql.query("select max(c5), count(c5) from stb1") tdSql.query("select max(c5), count(c5) from stb1")
tdSql.query("select max(c5), count(c5) from ct1") tdSql.query("select max(c5), count(c5) from ct1")
# # bug fix for compute # # bug fix for compute
tdSql.query("select c1, atan(c1) -0 ,atan(c1-4)-0 from ct4 ") tdSql.query("select c1, atan(c1) -0 ,atan(c1-4)-0 from ct4 ")
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
...@@ -394,10 +394,10 @@ class TDTestCase: ...@@ -394,10 +394,10 @@ class TDTestCase:
tdSql.checkData(0,3,0.000000000) tdSql.checkData(0,3,0.000000000)
tdSql.checkData(0,4,-0.100000000) tdSql.checkData(0,4,-0.100000000)
tdSql.checkData(0,5,0.000000000) tdSql.checkData(0,5,0.000000000)
def pow_Arithmetic(self): def pow_Arithmetic(self):
pass pass
def check_boundary_values(self): def check_boundary_values(self):
PI=3.1415926 PI=3.1415926
...@@ -426,11 +426,11 @@ class TDTestCase: ...@@ -426,11 +426,11 @@ class TDTestCase:
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from sub1_bound") self.check_result_auto_atan( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select atan(abs(c1)), atan(abs(c2)) ,atan(abs(c3)), atan(abs(c4)), atan(abs(c5)) from sub1_bound")
self.check_result_auto_atan( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select atan(c1), atan(c2) ,atan(c3), atan(c3), atan(c2) ,atan(c1) from sub1_bound") self.check_result_auto_atan( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select atan(c1), atan(c2) ,atan(c3), atan(c3), atan(c2) ,atan(c1) from sub1_bound")
self.check_result_auto_atan("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select atan(abs(c1)) from sub1_bound" ) self.check_result_auto_atan("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select atan(abs(c1)) from sub1_bound" )
# check basic elem for table per row # check basic elem for table per row
tdSql.query("select atan(abs(c1)) ,atan(abs(c2)) , atan(abs(c3)) , atan(abs(c4)), atan(abs(c5)), atan(abs(c6)) from sub1_bound ") tdSql.query("select atan(abs(c1)) ,atan(abs(c2)) , atan(abs(c3)) , atan(abs(c4)), atan(abs(c5)), atan(abs(c6)) from sub1_bound ")
tdSql.checkData(0,0,math.atan(2147483647)) tdSql.checkData(0,0,math.atan(2147483647))
...@@ -490,36 +490,36 @@ class TDTestCase: ...@@ -490,36 +490,36 @@ class TDTestCase:
self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) ,atan(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) ,atan(c5) from stb1 where c1 > 0 order by tbname" )
self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) , atan(c5) from stb1 where c1 > 0 order by tbname" ) self.check_result_auto_atan( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select atan(t1) , atan(c5) from stb1 where c1 > 0 order by tbname" )
pass pass
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: atan basic query ============") tdLog.printNoPrefix("==========step4: atan basic query ============")
self.basic_atan_function() self.basic_atan_function()
tdLog.printNoPrefix("==========step5: big number atan query ============") tdLog.printNoPrefix("==========step5: big number atan query ============")
self.test_big_number() self.test_big_number()
tdLog.printNoPrefix("==========step6: atan boundary query ============") tdLog.printNoPrefix("==========step6: atan boundary query ============")
self.check_boundary_values() self.check_boundary_values()
tdLog.printNoPrefix("==========step7: atan filter query ============") tdLog.printNoPrefix("==========step7: atan filter query ============")
self.abs_func_filter() self.abs_func_filter()
...@@ -527,7 +527,7 @@ class TDTestCase: ...@@ -527,7 +527,7 @@ class TDTestCase:
self.support_super_table_test() self.support_super_table_test()
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -50,7 +50,7 @@ class TDTestCase: ...@@ -50,7 +50,7 @@ class TDTestCase:
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(1, 0, None) tdSql.checkData(1, 0, None)
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table stb_1 using stb tags('beijing')") tdSql.execute("create table stb_1 using stb tags('beijing')")
tdSql.execute( tdSql.execute(
...@@ -115,7 +115,7 @@ class TDTestCase: ...@@ -115,7 +115,7 @@ class TDTestCase:
tdSql.query("select diff(col6) from stb_1") tdSql.query("select diff(col6) from stb_1")
tdSql.checkRows(10) tdSql.checkRows(10)
tdSql.execute('''create table stb1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, tdSql.execute('''create table stb1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table stb1_1 using stb tags('shanghai')") tdSql.execute("create table stb1_1 using stb tags('shanghai')")
......
...@@ -894,7 +894,7 @@ class TDTestCase: ...@@ -894,7 +894,7 @@ class TDTestCase:
tdSql.query(sql_common) tdSql.query(sql_common)
results= query_datas[0] results= query_datas[0]
if operator == "+": if operator == "+":
for data in query_datas[1:]: for data in query_datas[1:]:
results += data results += data
tdSql.checkData(0,0,results) tdSql.checkData(0,0,results)
......
...@@ -45,7 +45,7 @@ class TDTestCase: ...@@ -45,7 +45,7 @@ class TDTestCase:
case1: limit offset base function test case1: limit offset base function test
case2: offset return valid case2: offset return valid
''' '''
return return
def getBuildPath(self): def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
...@@ -71,7 +71,7 @@ class TDTestCase: ...@@ -71,7 +71,7 @@ class TDTestCase:
# self.create_tables(); # self.create_tables();
self.ts = 1500000000000 self.ts = 1500000000000
# stop # stop
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
...@@ -82,7 +82,7 @@ class TDTestCase: ...@@ -82,7 +82,7 @@ class TDTestCase:
def newcur(self,host,cfg): def newcur(self,host,cfg):
user = "root" user = "root"
password = "taosdata" password = "taosdata"
port =6030 port =6030
con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port)
cur=con.cursor() cur=con.cursor()
print(cur) print(cur)
...@@ -92,7 +92,7 @@ class TDTestCase: ...@@ -92,7 +92,7 @@ class TDTestCase:
def create_tables(self,host,dbname,stbname,count): def create_tables(self,host,dbname,stbname,count):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tsql.execute("use %s" %dbname) tsql.execute("use %s" %dbname)
...@@ -111,7 +111,7 @@ class TDTestCase: ...@@ -111,7 +111,7 @@ class TDTestCase:
tsql.execute(sql) tsql.execute(sql)
sql = pre_create sql = pre_create
# print(time.time()) # print(time.time())
# end sql # end sql
if sql != pre_create: if sql != pre_create:
# print(sql) # print(sql)
tsql.execute(sql) tsql.execute(sql)
...@@ -124,7 +124,7 @@ class TDTestCase: ...@@ -124,7 +124,7 @@ class TDTestCase:
def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount): def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tdLog.debug("create database %s"%dbname) tdLog.debug("create database %s"%dbname)
tsql.execute("drop database if exists %s"%dbname) tsql.execute("drop database if exists %s"%dbname)
...@@ -134,7 +134,7 @@ class TDTestCase: ...@@ -134,7 +134,7 @@ class TDTestCase:
threads = [] threads = []
for i in range(threadNumbers): for i in range(threadNumbers):
tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i))
threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,))) threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -144,7 +144,7 @@ class TDTestCase: ...@@ -144,7 +144,7 @@ class TDTestCase:
spendTime=end_time-start_time spendTime=end_time-start_time
speedCreate=threadNumbers*count/spendTime speedCreate=threadNumbers*count/spendTime
tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate)) tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate))
return return
# def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop): # def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop):
...@@ -171,7 +171,7 @@ class TDTestCase: ...@@ -171,7 +171,7 @@ class TDTestCase:
# print(sql) # print(sql)
tsql.execute(sql) tsql.execute(sql)
sql = "insert into %s_%d values " %(stbname,i) sql = "insert into %s_%d values " %(stbname,i)
# end sql # end sql
if sql != pre_insert: if sql != pre_insert:
# print(sql) # print(sql)
print(len(sql)) print(len(sql))
...@@ -186,7 +186,7 @@ class TDTestCase: ...@@ -186,7 +186,7 @@ class TDTestCase:
def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount): def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
tsql=self.newcur(host,config) tsql=self.newcur(host,config)
tdLog.debug("ready to inser data") tdLog.debug("ready to inser data")
...@@ -195,7 +195,7 @@ class TDTestCase: ...@@ -195,7 +195,7 @@ class TDTestCase:
threads = [] threads = []
for i in range(threadNumbers): for i in range(threadNumbers):
# tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) # tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i))
threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,))) threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -226,10 +226,10 @@ class TDTestCase: ...@@ -226,10 +226,10 @@ class TDTestCase:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found in %s" % buildPath)
taosBenchbin = buildPath+ "/build/bin/taosBenchmark" taosBenchbin = buildPath+ "/build/bin/taosBenchmark"
os.system("%s -f %s -y " %(taosBenchbin,jsonFile)) os.system("%s -f %s -y " %(taosBenchbin,jsonFile))
return return
def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count): def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count):
# count=50000 # count=50000
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
config = buildPath+ "../sim/dnode1/cfg/" config = buildPath+ "../sim/dnode1/cfg/"
...@@ -243,7 +243,7 @@ class TDTestCase: ...@@ -243,7 +243,7 @@ class TDTestCase:
# tsql.getResult("show databases") # tsql.getResult("show databases")
# print(tdSql.queryResult) # print(tdSql.queryResult)
tsql.execute("use %s" %dbname) tsql.execute("use %s" %dbname)
threads = [] threads = []
for i in range(processNumbers): for i in range(processNumbers):
jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i) jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i)
...@@ -254,7 +254,7 @@ class TDTestCase: ...@@ -254,7 +254,7 @@ class TDTestCase:
os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile)) os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile))
os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile)) os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile))
os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile)) os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile))
threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,))) threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,)))
start_time = time.time() start_time = time.time()
for tr in threads: for tr in threads:
tr.start() tr.start()
...@@ -276,8 +276,8 @@ class TDTestCase: ...@@ -276,8 +276,8 @@ class TDTestCase:
for i in range(stableCount): for i in range(stableCount):
tdSql.query("select count(*) from %s%d"%(stbname,i)) tdSql.query("select count(*) from %s%d"%(stbname,i))
tdSql.checkData(0,0,rowsPerSTable) tdSql.checkData(0,0,rowsPerSTable)
return return
# test case : Switch back and forth among the three queryPolicy(1\2\3) # test case : Switch back and forth among the three queryPolicy(1\2\3)
def test_case1(self): def test_case1(self):
self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10)
...@@ -303,7 +303,7 @@ class TDTestCase: ...@@ -303,7 +303,7 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.query("select max(c1) from stb10;") tdSql.query("select max(c1) from stb10;")
tdSql.checkData(0, 0, "%s"%maxQnode) tdSql.checkData(0, 0, "%s"%maxQnode)
tdSql.query("select min(c1) from stb11;") tdSql.query("select min(c1) from stb11;")
tdSql.checkData(0, 0, "%s"%minQnode) tdSql.checkData(0, 0, "%s"%minQnode)
tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
unionVnode=tdSql.queryResult unionVnode=tdSql.queryResult
...@@ -352,8 +352,8 @@ class TDTestCase: ...@@ -352,8 +352,8 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.query("select max(c1) from stb10;") tdSql.query("select max(c1) from stb10;")
assert maxQnode==tdSql.getData(0,0) assert maxQnode==tdSql.getData(0,0)
tdSql.query("select min(c1) from stb11;") tdSql.query("select min(c1) from stb11;")
assert minQnode==tdSql.getData(0,0) assert minQnode==tdSql.getData(0,0)
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
...@@ -417,7 +417,7 @@ class TDTestCase: ...@@ -417,7 +417,7 @@ class TDTestCase:
tdLog.exit("alter queryPolicy to %d failed"%queryPolicy) tdLog.exit("alter queryPolicy to %d failed"%queryPolicy)
tdSql.execute("use db1;") tdSql.execute("use db1;")
tdSql.error("select max(c1) from stb10;") tdSql.error("select max(c1) from stb10;")
tdSql.error("select min(c1) from stb11;") tdSql.error("select min(c1) from stb11;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
...@@ -452,20 +452,20 @@ class TDTestCase: ...@@ -452,20 +452,20 @@ class TDTestCase:
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.error("select max(c1) from stb10;") tdSql.error("select max(c1) from stb10;")
tdSql.error("select min(c1) from stb11;") tdSql.error("select min(c1) from stb11;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
# run case # run case
def run(self): def run(self):
# test qnode # test qnode
tdLog.debug(" test_case1 ............ [start]") tdLog.debug(" test_case1 ............ [start]")
self.test_case1() self.test_case1()
tdLog.debug(" test_case1 ............ [OK]") tdLog.debug(" test_case1 ............ [OK]")
tdLog.debug(" test_case2 ............ [start]") tdLog.debug(" test_case2 ............ [start]")
self.test_case2() self.test_case2()
tdLog.debug(" test_case2 ............ [OK]") tdLog.debug(" test_case2 ............ [OK]")
tdLog.debug(" test_case3 ............ [start]") tdLog.debug(" test_case3 ............ [start]")
self.test_case3() self.test_case3()
tdLog.debug(" test_case3 ............ [OK]") tdLog.debug(" test_case3 ............ [OK]")
...@@ -475,7 +475,7 @@ class TDTestCase: ...@@ -475,7 +475,7 @@ class TDTestCase:
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
return return
# #
# add case with filename # add case with filename
# #
......
...@@ -11,14 +11,14 @@ from util.sql import * ...@@ -11,14 +11,14 @@ from util.sql import *
from util.cases import * from util.cases import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143}
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def prepare_datas(self): def prepare_datas(self):
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -26,7 +26,7 @@ class TDTestCase: ...@@ -26,7 +26,7 @@ class TDTestCase:
tags (t1 int) tags (t1 int)
''' '''
) )
tdSql.execute( tdSql.execute(
''' '''
create table t1 create table t1
...@@ -68,7 +68,7 @@ class TDTestCase: ...@@ -68,7 +68,7 @@ class TDTestCase:
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
''' '''
) )
def test_errors(self): def test_errors(self):
error_sql_lists = [ error_sql_lists = [
"select unique from t1", "select unique from t1",
...@@ -119,40 +119,40 @@ class TDTestCase: ...@@ -119,40 +119,40 @@ class TDTestCase:
"select unique(c1) , diff(c1) from stb1 partition by tbname", "select unique(c1) , diff(c1) from stb1 partition by tbname",
#"select unique(c1) , abs(c1) from stb1 partition by tbname", # support #"select unique(c1) , abs(c1) from stb1 partition by tbname", # support
#"select unique(c1) , c1 from stb1 partition by tbname" # support #"select unique(c1) , c1 from stb1 partition by tbname" # support
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
pass pass
def support_types(self): def support_types(self):
other_no_value_types = [ other_no_value_types = [
"select unique(ts) from t1" , "select unique(ts) from t1" ,
"select unique(c7) from t1", "select unique(c7) from t1",
"select unique(c8) from t1", "select unique(c8) from t1",
"select unique(c9) from t1", "select unique(c9) from t1",
"select unique(ts) from ct1" , "select unique(ts) from ct1" ,
"select unique(c7) from ct1", "select unique(c7) from ct1",
"select unique(c8) from ct1", "select unique(c8) from ct1",
"select unique(c9) from ct1", "select unique(c9) from ct1",
"select unique(ts) from ct3" , "select unique(ts) from ct3" ,
"select unique(c7) from ct3", "select unique(c7) from ct3",
"select unique(c8) from ct3", "select unique(c8) from ct3",
"select unique(c9) from ct3", "select unique(c9) from ct3",
"select unique(ts) from ct4" , "select unique(ts) from ct4" ,
"select unique(c7) from ct4", "select unique(c7) from ct4",
"select unique(c8) from ct4", "select unique(c8) from ct4",
"select unique(c9) from ct4", "select unique(c9) from ct4",
"select unique(ts) from stb1 partition by tbname" , "select unique(ts) from stb1 partition by tbname" ,
"select unique(c7) from stb1 partition by tbname", "select unique(c7) from stb1 partition by tbname",
"select unique(c8) from stb1 partition by tbname", "select unique(c8) from stb1 partition by tbname",
"select unique(c9) from stb1 partition by tbname" "select unique(c9) from stb1 partition by tbname"
] ]
for type_sql in other_no_value_types: for type_sql in other_no_value_types:
tdSql.query(type_sql) tdSql.query(type_sql)
tdLog.info("support type ok , sql is : %s"%type_sql) tdLog.info("support type ok , sql is : %s"%type_sql)
type_sql_lists = [ type_sql_lists = [
"select unique(c1) from t1", "select unique(c1) from t1",
"select unique(c2) from t1", "select unique(c2) from t1",
...@@ -182,8 +182,8 @@ class TDTestCase: ...@@ -182,8 +182,8 @@ class TDTestCase:
"select unique(c5) from stb1 partition by tbname", "select unique(c5) from stb1 partition by tbname",
"select unique(c6) from stb1 partition by tbname", "select unique(c6) from stb1 partition by tbname",
"select unique(c6) as alisb from stb1 partition by tbname", "select unique(c6) as alisb from stb1 partition by tbname",
"select unique(c6) alisb from stb1 partition by tbname", "select unique(c6) alisb from stb1 partition by tbname",
] ]
for type_sql in type_sql_lists: for type_sql in type_sql_lists:
...@@ -194,18 +194,18 @@ class TDTestCase: ...@@ -194,18 +194,18 @@ class TDTestCase:
origin_sql = unique_sql.replace("unique(","").replace(")","") origin_sql = unique_sql.replace("unique(","").replace(")","")
tdSql.query(unique_sql) tdSql.query(unique_sql)
unique_result = tdSql.queryResult unique_result = tdSql.queryResult
unique_datas = [] unique_datas = []
for elem in unique_result: for elem in unique_result:
unique_datas.append(elem[0]) unique_datas.append(elem[0])
unique_datas.sort(key=lambda x: (x is None, x)) unique_datas.sort(key=lambda x: (x is None, x))
tdSql.query(origin_sql) tdSql.query(origin_sql)
origin_result = tdSql.queryResult origin_result = tdSql.queryResult
origin_datas = [] origin_datas = []
for elem in origin_result: for elem in origin_result:
origin_datas.append(elem[0]) origin_datas.append(elem[0])
pre_unique = [] pre_unique = []
for elem in origin_datas: for elem in origin_datas:
if elem in pre_unique: if elem in pre_unique:
...@@ -221,7 +221,7 @@ class TDTestCase: ...@@ -221,7 +221,7 @@ class TDTestCase:
def basic_unique_function(self): def basic_unique_function(self):
# basic query # basic query
tdSql.query("select c1 from ct3") tdSql.query("select c1 from ct3")
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select c1 from t1") tdSql.query("select c1 from t1")
...@@ -242,19 +242,19 @@ class TDTestCase: ...@@ -242,19 +242,19 @@ class TDTestCase:
tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select unique(c6) from ct3") tdSql.query("select unique(c6) from ct3")
# will support _rowts mix with # will support _rowts mix with
# tdSql.query("select unique(c6),_rowts from ct3") # tdSql.query("select unique(c6),_rowts from ct3")
# auto check for t1 table # auto check for t1 table
# used for regular table # used for regular table
tdSql.query("select unique(c1) from t1") tdSql.query("select unique(c1) from t1")
tdSql.query("desc t1") tdSql.query("desc t1")
col_lists_rows = tdSql.queryResult col_lists_rows = tdSql.queryResult
col_lists = [] col_lists = []
for col_name in col_lists_rows: for col_name in col_lists_rows:
col_lists.append(col_name[0]) col_lists.append(col_name[0])
for col in col_lists: for col in col_lists:
self.check_unique_table(f"select unique({col}) from t1") self.check_unique_table(f"select unique({col}) from t1")
...@@ -269,17 +269,17 @@ class TDTestCase: ...@@ -269,17 +269,17 @@ class TDTestCase:
#tdSql.error("select unique(c1),tbname from ct1") #support #tdSql.error("select unique(c1),tbname from ct1") #support
#tdSql.error("select unique(c1),t1 from ct1") #support #tdSql.error("select unique(c1),t1 from ct1") #support
# unique with common col # unique with common col
#tdSql.error("select unique(c1) ,ts from ct1") #tdSql.error("select unique(c1) ,ts from ct1")
#tdSql.error("select unique(c1) ,c1 from ct1") #tdSql.error("select unique(c1) ,c1 from ct1")
# unique with scalar function # unique with scalar function
#tdSql.error("select unique(c1) ,abs(c1) from ct1") #tdSql.error("select unique(c1) ,abs(c1) from ct1")
tdSql.error("select unique(c1) , unique(c2) from ct1") tdSql.error("select unique(c1) , unique(c2) from ct1")
#tdSql.error("select unique(c1) , abs(c2)+2 from ct1") #tdSql.error("select unique(c1) , abs(c2)+2 from ct1")
# unique with aggregate function
# unique with aggregate function
tdSql.error("select unique(c1) ,sum(c1) from ct1") tdSql.error("select unique(c1) ,sum(c1) from ct1")
tdSql.error("select unique(c1) ,max(c1) from ct1") tdSql.error("select unique(c1) ,max(c1) from ct1")
tdSql.error("select unique(c1) ,csum(c1) from ct1") tdSql.error("select unique(c1) ,csum(c1) from ct1")
...@@ -306,7 +306,7 @@ class TDTestCase: ...@@ -306,7 +306,7 @@ class TDTestCase:
tdSql.checkData(7, 0, 1) tdSql.checkData(7, 0, 1)
tdSql.checkData(8, 0, 0) tdSql.checkData(8, 0, 0)
# unique with union all # unique with union all
tdSql.query("select unique(c1) from ct4 union all select c1 from ct1") tdSql.query("select unique(c1) from ct4 union all select c1 from ct1")
tdSql.checkRows(23) tdSql.checkRows(23)
tdSql.query("select unique(c1) from ct4 union all select distinct(c1) from ct4") tdSql.query("select unique(c1) from ct4 union all select distinct(c1) from ct4")
...@@ -314,8 +314,8 @@ class TDTestCase: ...@@ -314,8 +314,8 @@ class TDTestCase:
tdSql.query("select unique(c2) from ct4 union all select abs(c2)/2 from ct4") tdSql.query("select unique(c2) from ct4 union all select abs(c2)/2 from ct4")
tdSql.checkRows(22) tdSql.checkRows(22)
# unique with join # unique with join
# prepare join datas with same ts # prepare join datas with same ts
tdSql.execute(" use db ") tdSql.execute(" use db ")
tdSql.execute(" create stable st1 (ts timestamp , num int) tags(ind int)") tdSql.execute(" create stable st1 (ts timestamp , num int) tags(ind int)")
...@@ -371,7 +371,7 @@ class TDTestCase: ...@@ -371,7 +371,7 @@ class TDTestCase:
tdSql.checkRows(10) tdSql.checkRows(10)
tdSql.checkData(0, 0, None) tdSql.checkData(0, 0, None)
tdSql.checkData(1, 0, -7.000000000) tdSql.checkData(1, 0, -7.000000000)
# bug for stable # bug for stable
#partition by tbname #partition by tbname
...@@ -380,8 +380,8 @@ class TDTestCase: ...@@ -380,8 +380,8 @@ class TDTestCase:
# tdSql.query(" select unique(c1) from stb1 partition by tbname ") # tdSql.query(" select unique(c1) from stb1 partition by tbname ")
# tdSql.checkRows(21) # tdSql.checkRows(21)
# group by # group by
tdSql.error("select unique(c1) from ct1 group by c1") tdSql.error("select unique(c1) from ct1 group by c1")
tdSql.error("select unique(c1) from ct1 group by tbname") tdSql.error("select unique(c1) from ct1 group by tbname")
...@@ -393,7 +393,7 @@ class TDTestCase: ...@@ -393,7 +393,7 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
# bug need fix # bug need fix
# tdSql.query("select tbname , tail(c1,2) from stb1 partition by tbname") # tdSql.query("select tbname , tail(c1,2) from stb1 partition by tbname")
# tdSql.checkRows(4) # tdSql.checkRows(4)
...@@ -411,7 +411,7 @@ class TDTestCase: ...@@ -411,7 +411,7 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
# # bug need fix # # bug need fix
# tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname ") # tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname ")
# tdSql.checkRows(2) # tdSql.checkRows(2)
# tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname order by tbname ") # tdSql.query(" select tbname , unique(c1) from stb1 where t1 = 0 partition by tbname order by tbname ")
...@@ -430,7 +430,7 @@ class TDTestCase: ...@@ -430,7 +430,7 @@ class TDTestCase:
tdSql.query(" select unique(t1) from stb1 partition by tbname ") tdSql.query(" select unique(t1) from stb1 partition by tbname ")
tdSql.checkRows(2) tdSql.checkRows(2)
# nest query # nest query
tdSql.query(" select unique(c1) from (select _rowts , t1 ,c1 , tbname from stb1 ) ") tdSql.query(" select unique(c1) from (select _rowts , t1 ,c1 , tbname from stb1 ) ")
tdSql.checkRows(11) tdSql.checkRows(11)
tdSql.checkData(0,0,6) tdSql.checkData(0,0,6)
...@@ -439,7 +439,7 @@ class TDTestCase: ...@@ -439,7 +439,7 @@ class TDTestCase:
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.checkData(0,0,4) tdSql.checkData(0,0,4)
tdSql.checkData(1,0,1) tdSql.checkData(1,0,1)
def check_boundary_values(self): def check_boundary_values(self):
tdSql.execute("drop database if exists bound_test") tdSql.execute("drop database if exists bound_test")
...@@ -467,11 +467,11 @@ class TDTestCase: ...@@ -467,11 +467,11 @@ class TDTestCase:
tdSql.execute( tdSql.execute(
f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.error( tdSql.error(
f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
) )
tdSql.query("select unique(c2) from sub1_bound order by 1 desc") tdSql.query("select unique(c2) from sub1_bound order by 1 desc")
tdSql.checkRows(5) tdSql.checkRows(5)
tdSql.checkData(0,0,9223372036854775807) tdSql.checkData(0,0,9223372036854775807)
...@@ -480,22 +480,22 @@ class TDTestCase: ...@@ -480,22 +480,22 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdLog.printNoPrefix("==========step1:create table ==============") tdLog.printNoPrefix("==========step1:create table ==============")
self.prepare_datas() self.prepare_datas()
tdLog.printNoPrefix("==========step2:test errors ==============") tdLog.printNoPrefix("==========step2:test errors ==============")
self.test_errors() self.test_errors()
tdLog.printNoPrefix("==========step3:support types ============") tdLog.printNoPrefix("==========step3:support types ============")
self.support_types() self.support_types()
tdLog.printNoPrefix("==========step4: floor basic query ============") tdLog.printNoPrefix("==========step4: floor basic query ============")
self.basic_unique_function() self.basic_unique_function()
tdLog.printNoPrefix("==========step5: floor boundary query ============") tdLog.printNoPrefix("==========step5: floor boundary query ============")
self.check_boundary_values() self.check_boundary_values()
......
...@@ -148,7 +148,7 @@ python3 ./test.py -f 7-tmq/subscribeDb2.py ...@@ -148,7 +148,7 @@ python3 ./test.py -f 7-tmq/subscribeDb2.py
python3 ./test.py -f 7-tmq/subscribeDb3.py python3 ./test.py -f 7-tmq/subscribeDb3.py
#python3 ./test.py -f 7-tmq/subscribeDb4.py #python3 ./test.py -f 7-tmq/subscribeDb4.py
python3 ./test.py -f 7-tmq/subscribeStb.py python3 ./test.py -f 7-tmq/subscribeStb.py
python3 ./test.py -f 7-tmq/subscribeStb0.py #python3 ./test.py -f 7-tmq/subscribeStb0.py
python3 ./test.py -f 7-tmq/subscribeStb1.py python3 ./test.py -f 7-tmq/subscribeStb1.py
python3 ./test.py -f 7-tmq/subscribeStb2.py python3 ./test.py -f 7-tmq/subscribeStb2.py
python3 ./test.py -f 7-tmq/subscribeStb3.py python3 ./test.py -f 7-tmq/subscribeStb3.py
...@@ -179,7 +179,7 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py ...@@ -179,7 +179,7 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
#python3 ./test.py -f 7-tmq/tmqDnodeRestart.py #python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
#python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py #python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py
#python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb.py python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb.py
#------------querPolicy 2----------- #------------querPolicy 2-----------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册