Merge branch 'main' of https://github.com/taosdata/TDengine into fix/TS-3222
This commit is contained in:
commit
4321012ac4
|
@ -132,11 +132,15 @@ int32_t dmRunDnode(SDnode *pDnode) {
|
|||
int32_t count = 0;
|
||||
if (dmOpenNodes(pDnode) != 0) {
|
||||
dError("failed to open nodes since %s", terrstr());
|
||||
dmCloseNodes(pDnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dmStartNodes(pDnode) != 0) {
|
||||
dError("failed to start nodes since %s", terrstr());
|
||||
dmSetStatus(pDnode, DND_STAT_STOPPED);
|
||||
dmStopNodes(pDnode);
|
||||
dmCloseNodes(pDnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -936,8 +936,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
|||
int tLen = 0;
|
||||
|
||||
if (tdbTbGet(pMeta->pUidIdx, &e.ctbEntry.suid, sizeof(tb_uid_t), &tData, &tLen) == 0) {
|
||||
version = ((SUidIdxVal *)tData)[0].version;
|
||||
STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = version};
|
||||
STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = ((SUidIdxVal *)tData)[0].version};
|
||||
if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &tData, &tLen) == 0) {
|
||||
SDecoder tdc = {0};
|
||||
SMetaEntry stbEntry = {0};
|
||||
|
|
|
@ -88,6 +88,10 @@ void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double
|
|||
}
|
||||
|
||||
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
|
||||
if (pLoadInfo == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
|
||||
pLoadInfo[i].currentLoadBlockIndex = 1;
|
||||
pLoadInfo[i].blockIndex[0] = -1;
|
||||
|
|
|
@ -221,6 +221,71 @@ static FORCE_INLINE int32_t sifInitJsonParam(SNode *node, SIFParam *param, SIFCt
|
|||
param->status = SFLT_COARSE_INDEX;
|
||||
return 0;
|
||||
}
|
||||
static int32_t sifNeedConvertCond(SNode *l, SNode *r) {
|
||||
if (nodeType(l) != QUERY_NODE_COLUMN || nodeType(r) != QUERY_NODE_VALUE) {
|
||||
return 0;
|
||||
}
|
||||
SColumnNode *c = (SColumnNode *)l;
|
||||
SValueNode *v = (SValueNode *)r;
|
||||
int32_t ctype = c->node.resType.type;
|
||||
int32_t vtype = v->node.resType.type;
|
||||
if (!IS_VAR_DATA_TYPE(ctype) && IS_VAR_DATA_TYPE(vtype)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int32_t sifInitParamValByCol(SNode *r, SNode *l, SIFParam *param, SIFCtx *ctx) {
|
||||
param->status = SFLT_COARSE_INDEX;
|
||||
SColumnNode *cn = (SColumnNode *)r;
|
||||
SValueNode *vn = (SValueNode *)l;
|
||||
if (vn->typeData == TSDB_DATA_TYPE_NULL && (vn->literal == NULL || strlen(vn->literal) == 0)) {
|
||||
param->status = SFLT_NOT_INDEX;
|
||||
return 0;
|
||||
}
|
||||
SDataType *pType = &cn->node.resType;
|
||||
int32_t type = pType->type;
|
||||
|
||||
SDataType *pVType = &vn->node.resType;
|
||||
int32_t vtype = pVType->type;
|
||||
char *pData = nodesGetValueFromNode(vn);
|
||||
int32_t valLen = 0;
|
||||
char **value = ¶m->condValue;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(type)) {
|
||||
int32_t dataLen = varDataTLen(pData);
|
||||
if (type == TSDB_DATA_TYPE_JSON) {
|
||||
if (*pData == TSDB_DATA_TYPE_NULL) {
|
||||
dataLen = 0;
|
||||
} else if (*pData == TSDB_DATA_TYPE_NCHAR) {
|
||||
dataLen = varDataTLen(pData);
|
||||
} else if (*pData == TSDB_DATA_TYPE_DOUBLE) {
|
||||
dataLen = LONG_BYTES;
|
||||
} else if (*pData == TSDB_DATA_TYPE_BOOL) {
|
||||
dataLen = CHAR_BYTES;
|
||||
}
|
||||
dataLen += CHAR_BYTES;
|
||||
}
|
||||
valLen = dataLen;
|
||||
} else {
|
||||
valLen = pType->bytes;
|
||||
}
|
||||
char *tv = taosMemoryCalloc(1, valLen + 1);
|
||||
if (tv == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(tv, pData, valLen);
|
||||
*value = tv;
|
||||
|
||||
param->colId = -1;
|
||||
param->colValType = (uint8_t)(vn->node.resType.type);
|
||||
if (vn->literal != NULL && strlen(vn->literal) <= sizeof(param->colName)) {
|
||||
memcpy(param->colName, vn->literal, strlen(vn->literal));
|
||||
} else {
|
||||
param->status = SFLT_NOT_INDEX;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
||||
param->status = SFLT_COARSE_INDEX;
|
||||
switch (nodeType(node)) {
|
||||
|
@ -317,8 +382,13 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
|
|||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
SIF_ERR_JRET(sifInitParam(node->pLeft, ¶mList[0], ctx));
|
||||
|
||||
if (nParam > 1) {
|
||||
// if (sifNeedConvertCond(node->pLeft, node->pRight)) {
|
||||
// SIF_ERR_JRET(sifInitParamValByCol(node->pLeft, node->pRight, ¶mList[1], ctx));
|
||||
// } else {
|
||||
SIF_ERR_JRET(sifInitParam(node->pRight, ¶mList[1], ctx));
|
||||
// }
|
||||
// if (paramList[0].colValType == TSDB_DATA_TYPE_JSON &&
|
||||
// ((SOperatorNode *)(node))->opType == OP_TYPE_JSON_CONTAINS) {
|
||||
// return TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -404,60 +474,149 @@ static FORCE_INLINE FilterFunc sifGetFilterFunc(EIndexQueryType type, bool *reve
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
int32_t sifStr2Num(char *buf, int32_t len, int8_t type, void *val) {
|
||||
// signed/unsigned/float
|
||||
if (IS_SIGNED_NUMERIC_TYPE(type)) {
|
||||
int64_t v = 0;
|
||||
if (0 != toInteger(buf, len, 10, &v)) {
|
||||
return -1;
|
||||
}
|
||||
if (type == TSDB_DATA_TYPE_BIGINT) {
|
||||
*(int64_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_INT) {
|
||||
*(int32_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_TINYINT) {
|
||||
*(int8_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_SMALLINT) {
|
||||
*(int16_t *)val = v;
|
||||
}
|
||||
} else if (IS_FLOAT_TYPE(type)) {
|
||||
if (type == TSDB_DATA_TYPE_FLOAT) {
|
||||
*(float *)val = taosStr2Float(buf, NULL);
|
||||
} else {
|
||||
*(double *)val = taosStr2Double(buf, NULL);
|
||||
}
|
||||
} else if (IS_UNSIGNED_NUMERIC_TYPE(type)) {
|
||||
uint64_t v = 0;
|
||||
if (0 != toUInteger(buf, len, 10, &v)) {
|
||||
return -1;
|
||||
}
|
||||
if (type == TSDB_DATA_TYPE_UBIGINT) {
|
||||
*(uint64_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_UINT) {
|
||||
*(uint32_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_UTINYINT) {
|
||||
*(uint8_t *)val = v;
|
||||
} else if (type == TSDB_DATA_TYPE_USMALLINT) {
|
||||
*(uint16_t *)val = v;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sifSetFltParam(SIFParam *left, SIFParam *right, SDataTypeBuf *typedata, SMetaFltParam *param) {
|
||||
int8_t ltype = left->colValType, rtype = right->colValType;
|
||||
static int32_t sifSetFltParam(SIFParam *left, SIFParam *right, SDataTypeBuf *typedata, SMetaFltParam *param) {
|
||||
int32_t code = 0;
|
||||
int8_t ltype = left->colValType, rtype = right->colValType;
|
||||
if (!IS_NUMERIC_TYPE(ltype) || !((IS_NUMERIC_TYPE(rtype)) || rtype == TSDB_DATA_TYPE_VARCHAR)) {
|
||||
return -1;
|
||||
}
|
||||
if (ltype == TSDB_DATA_TYPE_FLOAT) {
|
||||
float f = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, f);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, f);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_FLOAT, &f));
|
||||
}
|
||||
typedata->f = f;
|
||||
param->val = &typedata->f;
|
||||
} else if (ltype == TSDB_DATA_TYPE_DOUBLE) {
|
||||
double d = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, d);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, d);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_DOUBLE, &d));
|
||||
}
|
||||
typedata->d = d;
|
||||
param->val = &typedata->d;
|
||||
} else if (ltype == TSDB_DATA_TYPE_BIGINT) {
|
||||
int64_t i64 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i64);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i64);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_BIGINT, &i64));
|
||||
}
|
||||
typedata->i64 = i64;
|
||||
param->val = &typedata->i64;
|
||||
} else if (ltype == TSDB_DATA_TYPE_INT) {
|
||||
int32_t i32 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i32);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i32);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_INT, &i32));
|
||||
}
|
||||
typedata->i32 = i32;
|
||||
param->val = &typedata->i32;
|
||||
} else if (ltype == TSDB_DATA_TYPE_SMALLINT) {
|
||||
int16_t i16 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i16);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i16);
|
||||
} else {
|
||||
SIF_ERR_RET(
|
||||
sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_SMALLINT, &i16));
|
||||
}
|
||||
|
||||
typedata->i16 = i16;
|
||||
param->val = &typedata->i16;
|
||||
} else if (ltype == TSDB_DATA_TYPE_TINYINT) {
|
||||
int8_t i8 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i8)
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, i8);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_TINYINT, &i8));
|
||||
}
|
||||
typedata->i8 = i8;
|
||||
param->val = &typedata->i8;
|
||||
} else if (ltype == TSDB_DATA_TYPE_UBIGINT) {
|
||||
uint64_t u64 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u64);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u64);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UBIGINT, &u64));
|
||||
}
|
||||
typedata->u64 = u64;
|
||||
param->val = &typedata->u64;
|
||||
} else if (ltype == TSDB_DATA_TYPE_UINT) {
|
||||
uint32_t u32 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u32);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u32);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UINT, &u32));
|
||||
}
|
||||
typedata->u32 = u32;
|
||||
param->val = &typedata->u32;
|
||||
} else if (ltype == TSDB_DATA_TYPE_USMALLINT) {
|
||||
uint16_t u16 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u16);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u16);
|
||||
} else {
|
||||
SIF_ERR_RET(
|
||||
sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_USMALLINT, &u16));
|
||||
}
|
||||
typedata->u16 = u16;
|
||||
param->val = &typedata->u16;
|
||||
} else if (ltype == TSDB_DATA_TYPE_UTINYINT) {
|
||||
uint8_t u8 = 0;
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u8);
|
||||
if (IS_NUMERIC_TYPE(rtype)) {
|
||||
SIF_DATA_CONVERT(rtype, right->condValue, u8);
|
||||
} else {
|
||||
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UTINYINT, &u8));
|
||||
}
|
||||
typedata->u8 = u8;
|
||||
param->val = &typedata->u8;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFParam *output) {
|
||||
int ret = 0;
|
||||
|
@ -498,7 +657,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
|||
param.val = buf;
|
||||
}
|
||||
} else {
|
||||
sifSetFltParam(left, right, &typedata, ¶m);
|
||||
if (sifSetFltParam(left, right, &typedata, ¶m) != 0) return -1;
|
||||
}
|
||||
ret = metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ void streamCleanUp() {
|
|||
void streamSchedByTimer(void* param, void* tmrId) {
|
||||
SStreamTask* pTask = (void*)param;
|
||||
|
||||
if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
|
||||
if (streamTaskShouldStop(&pTask->status)) {
|
||||
streamMetaReleaseTask(NULL, pTask);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ void taosGetSystemLocale(char *outLocale, char *outCharset) {
|
|||
strcpy(outLocale, "en_US.UTF-8");
|
||||
} else {
|
||||
tstrncpy(outLocale, locale, TD_LOCALE_LEN);
|
||||
// printf("locale not configured, set to system default:%s", outLocale);
|
||||
printf("locale not configured, set to system default:%s\n", outLocale);
|
||||
}
|
||||
|
||||
// if user does not specify the charset, extract it from locale
|
||||
|
|
|
@ -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_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/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/dropDbR3ConflictTransaction.py -N 3
|
||||
|
|
|
@ -303,7 +303,7 @@ function run_thread() {
|
|||
if [ ! -z "$corefile" ]; then
|
||||
echo -e "\e[34m corefiles: $corefile \e[0m"
|
||||
local build_dir=$log_dir/build_${hosts[index]}
|
||||
local remote_build_dir="${workdirs[index]}/{DEBUGPATH}/build"
|
||||
local remote_build_dir="${workdirs[index]}/${DEBUGPATH}/build"
|
||||
# if [ $ent -ne 0 ]; then
|
||||
# remote_build_dir="${workdirs[index]}/{DEBUGPATH}/build"
|
||||
# fi
|
||||
|
|
|
@ -123,6 +123,17 @@ sql select * from $mt where tgcol = 1
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '1'
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "1"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -123,6 +123,15 @@ sql select * from $mt where tgcol = 1
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '1';
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol = "1.0"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -123,6 +123,16 @@ sql select * from $mt where tgcol = 1
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "1.0"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "1"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -123,6 +123,16 @@ sql select * from $mt where tgcol = 1
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '1'
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "1";
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -85,10 +85,22 @@ sql select * from $mt where tgcol <> 1
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '1'
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "1"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -115,14 +115,36 @@ sql select * from $mt where tgcol = 0
|
|||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '0'
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = "0"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol <> 0
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from $mt where tgcol = "1"
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from $mt where tgcol = '1'
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select * from $mt where tgcol <> 1
|
||||
if $rows != 100 then
|
||||
return -1
|
||||
|
|
|
@ -17,12 +17,12 @@ from util.dnodes import TDDnode
|
|||
from util.cluster import *
|
||||
import subprocess
|
||||
|
||||
BASEVERSION = "3.0.1.8"
|
||||
BASEVERSION = "3.0.2.3"
|
||||
class TDTestCase:
|
||||
def caseDescription(self):
|
||||
'''
|
||||
f'''
|
||||
3.0 data compatibility test
|
||||
case1: basedata version is 3.0.1.8
|
||||
case1: basedata version is {BASEVERSION}
|
||||
'''
|
||||
return
|
||||
|
||||
|
|
|
@ -24,9 +24,7 @@ from util.dnodes import tdDnodes
|
|||
from util.dnodes import *
|
||||
|
||||
class TDTestCase:
|
||||
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
|
||||
"jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
|
||||
"wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
|
||||
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 135}
|
||||
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
|
@ -39,7 +37,9 @@ class TDTestCase:
|
|||
|
||||
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
|
||||
num_random = 100
|
||||
fake = Faker('zh_CN')
|
||||
|
@ -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) \
|
||||
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):
|
||||
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)
|
||||
|
@ -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.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
|
||||
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):
|
||||
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) \
|
||||
|
@ -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.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.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.checkData(0,0,num_random*n)
|
||||
|
||||
|
@ -220,39 +322,28 @@ class TDTestCase:
|
|||
|
||||
|
||||
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)
|
||||
#print(tdSql.queryResult)
|
||||
|
||||
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)
|
||||
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")
|
||||
|
||||
tdSql.execute(" flush database %s;" %database)
|
||||
|
||||
tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database)
|
||||
print(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)
|
||||
tdLog.info(tdSql.queryResult)
|
||||
|
||||
tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' limit 3;" %database)
|
||||
queryRows = len(tdSql.queryResult)
|
||||
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
|
||||
if check_result == 'Y':
|
||||
if check_result_positive == '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';" %(database))
|
||||
base_value_table_name = tdSql.queryResult[0][0]
|
||||
|
@ -324,8 +415,100 @@ 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))
|
||||
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:
|
||||
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):
|
||||
check_value_table_name = tdSql.queryResult[0][0]
|
||||
|
@ -348,17 +531,28 @@ class TDTestCase:
|
|||
|
||||
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
|
||||
|
||||
#(self,database,n,vgroups,table_prefix,table_suffix)
|
||||
self.dropandcreateDB_random("%s" %self.db, 1,2,0,0,'N')
|
||||
self.dropandcreateDB_random("%s" %self.db, 1,2,0,2,'N')
|
||||
self.dropandcreateDB_random("%s" %self.db, 1,2,2,0,'N')
|
||||
self.dropandcreateDB_random("%s" %self.db, 1,2,3,3,'Y')
|
||||
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,5,5,5,'Y')
|
||||
#(self,database,n,vgroups,table_prefix,table_suffix,check_result_positive,check_result_negative):
|
||||
#check_result_positive 检查前缀后缀是正数的,check_result_negative 检查前缀后缀是负数的(TS-3249)
|
||||
# self.dropandcreateDB_random("%s" %self.db, 1,2,0,0,'N','N')
|
||||
# self.dropandcreateDB_random("%s" %self.db, 1,2,0,2,'N','N')
|
||||
# self.dropandcreateDB_random("%s" %self.db, 1,2,2,0,'N','N')
|
||||
|
||||
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,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!")
|
||||
taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
|
||||
_ = subprocess.check_output(taos_cmd1, shell=True)
|
||||
|
|
|
@ -0,0 +1,446 @@
|
|||
###################################################################
|
||||
# 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())
|
File diff suppressed because it is too large
Load Diff
|
@ -170,7 +170,7 @@ class TMQCom:
|
|||
if tdSql.getData(i, 1) == 1:
|
||||
loopFlag = 0
|
||||
break
|
||||
time.sleep(0.02)
|
||||
time.sleep(0.10)
|
||||
return
|
||||
|
||||
def create_database(self,tsql, dbName,dropFlag=1,vgroups=4,replica=1):
|
||||
|
|
Loading…
Reference in New Issue