From 1cba56860434f9053026523b132aeaa236b7afe6 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 11 Nov 2022 15:22:00 +0800 Subject: [PATCH 001/116] fix(query): report error if certain function query stable has duplicate timestamps TD-19892 --- source/libs/executor/src/executorimpl.c | 6 +++- source/libs/function/src/builtins.c | 4 +-- source/libs/function/src/builtinsimpl.c | 41 +++++++++++++++++++------ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 7d662f8784..5d4986186e 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -653,7 +653,11 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc pfCtx->pDstBlock = pResult; } - numOfRows = pfCtx->fpSet.process(pfCtx); + int32_t code = pfCtx->fpSet.process(pfCtx); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + numOfRows = pResInfo->numOfRes; } else if (fmIsAggFunc(pfCtx->functionId)) { // selective value output should be set during corresponding function execution if (fmIsSelectValueFunc(pfCtx->functionId)) { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index d3f03e8e9c..69b0ff1096 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2640,8 +2640,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "diff", .type = FUNCTION_TYPE_DIFF, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | - FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC, .translateFunc = translateDiff, .getEnvFunc = getDiffFuncEnv, .initFunc = diffFunctionSetup, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 6eb57c1a18..3f9fe46acd 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3325,6 +3325,7 @@ bool diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { SDiffInfo* pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo); pDiffInfo->hasPrev = false; pDiffInfo->prev.i64 = 0; + pDiffInfo->prevTs = -1; if (pCtx->numOfParams > 1) { pDiffInfo->ignoreNegative = pCtx->param[1].param.i; // TODO set correct param } else { @@ -3335,7 +3336,7 @@ bool diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { return true; } -static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv) { +static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv, int64_t ts) { switch (type) { case TSDB_DATA_TYPE_BOOL: pDiffInfo->prev.i64 = *(bool*)pv ? 1 : 0; @@ -3362,11 +3363,13 @@ static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv) { default: ASSERT(0); } + pDiffInfo->prevTs = ts; } static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SColumnInfoData* pOutput, int32_t pos, - int32_t order) { + int32_t order, int64_t ts) { int32_t factor = (order == TSDB_ORDER_ASC) ? 1 : -1; + pDiffInfo->prevTs = ts; switch (type) { case TSDB_DATA_TYPE_INT: { int32_t v = *(int32_t*)pv; @@ -3450,6 +3453,8 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + int32_t numOfElems = 0; int32_t startOffset = pCtx->offset; @@ -3471,7 +3476,10 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { char* pv = colDataGetData(pInputCol, i); if (pDiffInfo->hasPrev) { - doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); + if (tsList[i] == pDiffInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } + doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order, tsList[i]); // handle selectivity if (pCtx->subsidiaries.num > 0) { appendSelectivityValue(pCtx, i, pos); @@ -3479,7 +3487,7 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { numOfElems++; } else { - doSetPrevVal(pDiffInfo, pInputCol->info.type, pv); + doSetPrevVal(pDiffInfo, pInputCol->info.type, pv, tsList[i]); } pDiffInfo->hasPrev = true; @@ -3501,7 +3509,10 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { // there is a row of previous data block to be handled in the first place. if (pDiffInfo->hasPrev) { - doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); + if (tsList[i] == pDiffInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } + doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order, tsList[i]); // handle selectivity if (pCtx->subsidiaries.num > 0) { appendSelectivityValue(pCtx, i, pos); @@ -3509,15 +3520,15 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { numOfElems++; } else { - doSetPrevVal(pDiffInfo, pInputCol->info.type, pv); + doSetPrevVal(pDiffInfo, pInputCol->info.type, pv, tsList[i]); } pDiffInfo->hasPrev = true; } } - // initial value is not set yet - return numOfElems; + pResInfo->numOfRes = numOfElems; + return TSDB_CODE_SUCCESS; } int32_t getTopBotInfoSize(int64_t numOfItems) { return sizeof(STopBotRes) + numOfItems * sizeof(STopBotResItem); } @@ -6137,6 +6148,9 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) { if (!pDerivInfo->valueSet) { // initial value is not set yet pDerivInfo->valueSet = true; } else { + if (tsList[i] == pDerivInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } double r = ((v - pDerivInfo->prevValue) * pDerivInfo->tsWindow) / (tsList[i] - pDerivInfo->prevTs); if (pDerivInfo->ignoreNegative && r < 0) { } else { @@ -6175,6 +6189,9 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) { if (!pDerivInfo->valueSet) { // initial value is not set yet pDerivInfo->valueSet = true; } else { + if (tsList[i] == pDerivInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } double r = ((pDerivInfo->prevValue - v) * pDerivInfo->tsWindow) / (pDerivInfo->prevTs - tsList[i]); if (pDerivInfo->ignoreNegative && r < 0) { } else { @@ -6202,7 +6219,9 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) { } } - return numOfElems; + pResInfo->numOfRes = numOfElems; + + return TSDB_CODE_SUCCESS; } bool getIrateFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv) { @@ -6267,11 +6286,15 @@ int32_t irateFunction(SqlFunctionCtx* pCtx) { pRateInfo->lastKey = tsList[i]; continue; + } else if (tsList[i] == pRateInfo->lastKey) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; } if ((INT64_MIN == pRateInfo->firstKey) || tsList[i] > pRateInfo->firstKey) { pRateInfo->firstValue = v; pRateInfo->firstKey = tsList[i]; + } else if (tsList[i] == pRateInfo->firstKey) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; } } From eec1b0bfb0bfe8d2417d3cd3d4302169e0c2f169 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 11 Nov 2022 15:22:00 +0800 Subject: [PATCH 002/116] fix(query): report error if certain function query stable has duplicate timestamps TD-19892 --- source/libs/function/src/builtins.c | 8 +++++--- source/libs/function/src/builtinsimpl.c | 27 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 69b0ff1096..38c022fc6f 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2653,7 +2653,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "statecount", .type = FUNCTION_TYPE_STATE_COUNT, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + FUNC_MGT_FORBID_STREAM_FUNC, .translateFunc = translateStateCount, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, @@ -2664,7 +2665,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "stateduration", .type = FUNCTION_TYPE_STATE_DURATION, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + FUNC_MGT_FORBID_STREAM_FUNC, .translateFunc = translateStateDuration, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, @@ -2675,7 +2677,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "csum", .type = FUNCTION_TYPE_CSUM, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, .translateFunc = translateCsum, .getEnvFunc = getCsumFuncEnv, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 3f9fe46acd..60befbfba8 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -190,6 +190,8 @@ typedef struct SStateInfo { int64_t count; int64_t durationStart; }; + int64_t prevTs; + bool isPrevTsSet; } SStateInfo; typedef enum { @@ -4879,6 +4881,7 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { SStateInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; @@ -4891,7 +4894,15 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { } for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { + if (pInfo->isPrevTsSet == true && tsList[i] == pInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } else { + pInfo->prevTs = tsList[i]; + } + + pInfo->isPrevTsSet = true; numOfElems++; + if (colDataIsNull_f(pInputCol->nullbitmap, i)) { colDataAppendNULL(pOutput, i); // handle selectivity @@ -4917,7 +4928,8 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { } } - return numOfElems; + pResInfo->numOfRes = numOfElems; + return TSDB_CODE_SUCCESS; } int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { @@ -4940,11 +4952,19 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { int8_t op = getStateOpType(varDataVal(pCtx->param[1].param.pz)); if (STATE_OPER_INVALID == op) { - return 0; + return TSDB_CODE_INVALID_PARA; } for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { + if (pInfo->isPrevTsSet == true && tsList[i] == pInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } else { + pInfo->prevTs = tsList[i]; + } + + pInfo->isPrevTsSet = true; numOfElems++; + if (colDataIsNull_f(pInputCol->nullbitmap, i)) { colDataAppendNULL(pOutput, i); // handle selectivity @@ -4974,7 +4994,8 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { } } - return numOfElems; + pResInfo->numOfRes = numOfElems; + return TSDB_CODE_SUCCESS; } bool getCsumFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { From 2b53f7be8417c95bcfb2daab201063b90c1fcaf4 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 11 Nov 2022 15:22:00 +0800 Subject: [PATCH 003/116] fix(query): report error if certain function query stable has duplicate timestamps TD-19892 --- source/libs/function/src/builtins.c | 5 +++-- source/libs/function/src/builtinsimpl.c | 29 +++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 38c022fc6f..cfd94479cb 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2677,7 +2677,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "csum", .type = FUNCTION_TYPE_CSUM, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, .translateFunc = translateCsum, .getEnvFunc = getCsumFuncEnv, @@ -2690,7 +2690,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "mavg", .type = FUNCTION_TYPE_MAVG, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + FUNC_MGT_FORBID_STREAM_FUNC, .translateFunc = translateMavg, .getEnvFunc = getMavgFuncEnv, .initFunc = mavgFunctionSetup, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 60befbfba8..f23333a6d8 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -48,6 +48,9 @@ typedef struct SSumRes { double dsum; }; int16_t type; + int64_t prevTs; // used for csum only + bool isPrevTsSet; //used for csum only + } SSumRes; typedef struct SAvgRes { @@ -207,6 +210,8 @@ typedef enum { typedef struct SMavgInfo { int32_t pos; double sum; + int64_t prevTs; + bool isPrevTsSet; int32_t numOfPoints; bool pointsMeet; double points[]; @@ -5008,6 +5013,7 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { SSumRes* pSumRes = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; @@ -5016,6 +5022,13 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { int32_t type = pInputCol->info.type; int32_t startOffset = pCtx->offset; for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { + if (pSumRes->isPrevTsSet == true && tsList[i] == pSumRes->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } else { + pSumRes->prevTs = tsList[i]; + } + pSumRes->isPrevTsSet = true; + int32_t pos = startOffset + numOfElems; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { // colDataAppendNULL(pOutput, i); @@ -5053,7 +5066,8 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { numOfElems++; } - return numOfElems; + pResInfo->numOfRes = numOfElems; + return TSDB_CODE_SUCCESS; } bool getMavgFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { @@ -5069,6 +5083,8 @@ bool mavgFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { SMavgInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->pos = 0; pInfo->sum = 0; + pInfo->prevTs = -1; + pInfo->isPrevTsSet = false; pInfo->numOfPoints = pCtx->param[1].param.i; if (pInfo->numOfPoints < 1 || pInfo->numOfPoints > MAVG_MAX_POINTS_NUM) { return false; @@ -5083,6 +5099,7 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { SMavgInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pTsOutput = pCtx->pTsOutput; @@ -5092,6 +5109,13 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { int32_t type = pInputCol->info.type; int32_t startOffset = pCtx->offset; for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { + if (pInfo->isPrevTsSet == true && tsList[i] == pInfo->prevTs) { + return TSDB_CODE_FUNC_DUP_TIMESTAMP; + } else { + pInfo->prevTs = tsList[i]; + } + pInfo->isPrevTsSet = true; + int32_t pos = startOffset + numOfElems; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { // colDataAppendNULL(pOutput, i); @@ -5136,7 +5160,8 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { } } - return numOfElems; + pResInfo->numOfRes = numOfElems; + return TSDB_CODE_SUCCESS; } static SSampleInfo* getSampleOutputInfo(SqlFunctionCtx* pCtx) { From 8f55e007f4f3a8f98309b7fa9df9f28666f015ca Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 14 Nov 2022 16:23:52 +0800 Subject: [PATCH 004/116] refactor(sync): add trace log --- source/libs/sync/src/syncRaftLog.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index bc07781e5c..21f301308e 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -239,12 +239,12 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR return -1; } + int64_t ts1 = taosGetTimestampMs(); taosThreadMutexLock(&(pData->mutex)); - int64_t tsBegin = taosGetTimestampMs(); + int64_t ts2 = taosGetTimestampMs(); code = walReadVer(pWalHandle, index); - int64_t tsEnd = taosGetTimestampMs(); - int64_t tsElapsed = tsEnd - tsBegin; + int64_t ts3 = taosGetTimestampMs(); // code = walReadVerCached(pWalHandle, index); if (code != 0) { @@ -289,6 +289,18 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR */ taosThreadMutexUnlock(&(pData->mutex)); + int64_t ts4 = taosGetTimestampMs(); + + int64_t tsElapsed = ts4 - ts1; + int64_t tsElapsedLock = ts2 - ts1; + int64_t tsElapsedRead = ts3 - ts2; + int64_t tsElapsedBuild = ts4 - ts3; + + sNTrace(pData->pSyncNode, + "read index:%" PRId64 ", elapsed:%" PRId64 ", elapsed-lock:%" PRId64 ", elapsed-read:%" PRId64 + ", elapsed-build:%" PRId64, + index, tsElapsed, tsElapsedLock, tsElapsedRead, tsElapsedBuild); + return code; } From 5b51f97a48038ca6b9f8d70f246862ba11bf4f96 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 14 Nov 2022 16:52:39 +0800 Subject: [PATCH 005/116] more optimize --- source/dnode/vnode/src/inc/tsdb.h | 17 +++++------- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 31 ++++++++++++++-------- source/dnode/vnode/src/tsdb/tsdbUtil.c | 20 +++++++------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index ba9d68ee7f..c6e2842c32 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -108,8 +108,8 @@ static FORCE_INLINE int64_t tsdbLogicToFileSize(int64_t lSize, int32_t szPage) { #define TSDBROW_KEY(ROW) ((TSDBKEY){.version = TSDBROW_VERSION(ROW), .ts = TSDBROW_TS(ROW)}) #define tsdbRowFromTSRow(VERSION, TSROW) ((TSDBROW){.type = 0, .version = (VERSION), .pTSRow = (TSROW)}) #define tsdbRowFromBlockData(BLOCKDATA, IROW) ((TSDBROW){.type = 1, .pBlockData = (BLOCKDATA), .iRow = (IROW)}) -void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); -int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow); +void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); +// int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow); int32_t tsdbRowCmprFn(const void *p1, const void *p2); // SRowIter void tRowIterInit(SRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema); @@ -333,6 +333,8 @@ struct SVersionRange { typedef struct SMemSkipListNode SMemSkipListNode; struct SMemSkipListNode { int8_t level; + int64_t version; + STSRow *pTSRow; SMemSkipListNode *forwards[0]; }; typedef struct SMemSkipList { @@ -772,14 +774,6 @@ static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) { #define SL_NODE_FORWARD(n, l) ((n)->forwards[l]) #define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)]) -#define SL_NODE_DATA(n) (&SL_NODE_BACKWARD(n, (n)->level)) - -static FORCE_INLINE int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow) { - int32_t n = tGetI64(p, &pRow->version); - pRow->pTSRow = (STSRow *)(p + n); - n += pRow->pTSRow->len; - return n; -} static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { if (pIter == NULL) return NULL; @@ -798,8 +792,9 @@ static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { } } - tGetTSDBRow((uint8_t *)SL_NODE_DATA(pIter->pNode), &pIter->row); pIter->pRow = &pIter->row; + pIter->pRow->version = pIter->pNode->version; + pIter->pRow->pTSRow = pIter->pNode->pTSRow; return pIter->pRow; } diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 654afe1b6a..998409f34e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -21,7 +21,6 @@ #define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l)*2) #define SL_NODE_FORWARD(n, l) ((n)->forwards[l]) #define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)]) -#define SL_NODE_DATA(n) (&SL_NODE_BACKWARD(n, (n)->level)) #define SL_MOVE_BACKWARD 0x1 #define SL_MOVE_FROM_POS 0x2 @@ -394,7 +393,7 @@ _err: static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *pKey, int32_t flags) { SMemSkipListNode *px; SMemSkipListNode *pn; - TSDBKEY *pTKey; + TSDBKEY tKey = {0}; int32_t backward = flags & SL_MOVE_BACKWARD; int32_t fromPos = flags & SL_MOVE_FROM_POS; @@ -413,9 +412,10 @@ static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *p for (int8_t iLevel = pTbData->sl.level - 1; iLevel >= 0; iLevel--) { pn = SL_NODE_BACKWARD(px, iLevel); while (pn != pTbData->sl.pHead) { - pTKey = (TSDBKEY *)SL_NODE_DATA(pn); + tKey.version = pn->version; + tKey.ts = pn->pTSRow->ts; - int32_t c = tsdbKeyCmprFn(pTKey, pKey); + int32_t c = tsdbKeyCmprFn(&tKey, pKey); if (c <= 0) { break; } else { @@ -442,7 +442,10 @@ static void tbDataMovePosTo(STbData *pTbData, SMemSkipListNode **pos, TSDBKEY *p for (int8_t iLevel = pTbData->sl.level - 1; iLevel >= 0; iLevel--) { pn = SL_NODE_FORWARD(px, iLevel); while (pn != pTbData->sl.pTail) { - int32_t c = tsdbKeyCmprFn(SL_NODE_DATA(pn), pKey); + tKey.version = pn->version; + tKey.ts = pn->pTSRow->ts; + + int32_t c = tsdbKeyCmprFn(&tKey, pKey); if (c >= 0) { break; } else { @@ -467,8 +470,8 @@ static FORCE_INLINE int8_t tsdbMemSkipListRandLevel(SMemSkipList *pSl) { return level; } -static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListNode **pos, TSDBROW *pRow, - int8_t forward) { +static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListNode **pos, int64_t version, + STSRow *pRow, int8_t forward) { int32_t code = 0; int8_t level; SMemSkipListNode *pNode; @@ -477,13 +480,19 @@ static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListN // node level = tsdbMemSkipListRandLevel(&pTbData->sl); ASSERT(pPool != NULL); - pNode = (SMemSkipListNode *)vnodeBufPoolMalloc(pPool, SL_NODE_SIZE(level) + tPutTSDBRow(NULL, pRow)); + pNode = (SMemSkipListNode *)vnodeBufPoolMalloc(pPool, SL_NODE_SIZE(level)); if (pNode == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } pNode->level = level; - tPutTSDBRow((uint8_t *)SL_NODE_DATA(pNode), pRow); + pNode->version = version; + pNode->pTSRow = vnodeBufPoolMalloc(pPool, pRow->len); + if (NULL == pNode->pTSRow) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + memcpy(pNode->pTSRow, pRow, pRow->len); for (int8_t iLevel = level - 1; iLevel >= 0; iLevel--) { SMemSkipListNode *pn = pos[iLevel]; @@ -549,7 +558,7 @@ static int32_t tsdbInsertTableDataImpl(SMemTable *pMemTable, STbData *pTbData, i key.ts = row.pTSRow->ts; nRow++; tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_BACKWARD); - code = tbDataDoPut(pMemTable, pTbData, pos, &row, 0); + code = tbDataDoPut(pMemTable, pTbData, pos, version, row.pTSRow, 0); if (code) { goto _err; } @@ -570,7 +579,7 @@ static int32_t tsdbInsertTableDataImpl(SMemTable *pMemTable, STbData *pTbData, i if (SL_NODE_FORWARD(pos[0], 0) != pTbData->sl.pTail) { tbDataMovePosTo(pTbData, pos, &key, SL_MOVE_FROM_POS); } - code = tbDataDoPut(pMemTable, pTbData, pos, &row, 1); + code = tbDataDoPut(pMemTable, pTbData, pos, version, row.pTSRow, 1); if (code) { goto _err; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 755a551e20..0aa2c6ab83 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -565,15 +565,15 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * } } -int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow) { - int32_t n = 0; +// int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow) { +// int32_t n = 0; - n += tPutI64(p, pRow->version); - if (p) memcpy(p + n, pRow->pTSRow, pRow->pTSRow->len); - n += pRow->pTSRow->len; +// n += tPutI64(p, pRow->version); +// if (p) memcpy(p + n, pRow->pTSRow, pRow->pTSRow->len); +// n += pRow->pTSRow->len; - return n; -} +// return n; +// } int32_t tsdbRowCmprFn(const void *p1, const void *p2) { return tsdbKeyCmprFn(&TSDBROW_KEY((TSDBROW *)p1), &TSDBROW_KEY((TSDBROW *)p2)); @@ -1084,7 +1084,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch cv.flag = CV_FLAG_VALUE; if (IS_VAR_DATA_TYPE(pTColumn->type)) { - void *pData = (char*)pRow + *(int32_t *)(pRow->data + pTColumn->offset - sizeof(TSKEY)); + void *pData = (char *)pRow + *(int32_t *)(pRow->data + pTColumn->offset - sizeof(TSKEY)); cv.value.nData = varDataLen(pData); cv.value.pData = varDataVal(pData); } else { @@ -1106,7 +1106,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch cv.flag = CV_FLAG_VALUE; if (IS_VAR_DATA_TYPE(pTColumn->type)) { - void *pData = (char*)pRow + *(int32_t *)(pRow->data + pTColumn->offset - sizeof(TSKEY)); + void *pData = (char *)pRow + *(int32_t *)(pRow->data + pTColumn->offset - sizeof(TSKEY)); cv.value.nData = varDataLen(pData); cv.value.pData = varDataVal(pData); } else { @@ -1151,7 +1151,7 @@ static int32_t tBlockDataAppendKVRow(SBlockData *pBlockData, STSRow *pRow, STSch ASSERT(pTColumn->type == pColData->type); SColVal cv = {.cid = pTColumn->colId, .type = pTColumn->type}; - TDRowValT vt = TD_VTYPE_NONE; // default is NONE + TDRowValT vt = TD_VTYPE_NONE; // default is NONE SKvRowIdx *pKvIdx = NULL; while (kvIter < nKvCols) { From 10921cc09a512cf7ea1de8b71db488231b8bc3c7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 14 Nov 2022 17:13:22 +0800 Subject: [PATCH 006/116] more opt --- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 998409f34e..55c7576155 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -262,30 +262,27 @@ void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDa } bool tsdbTbDataIterNext(STbDataIter *pIter) { - SMemSkipListNode *pHead = pIter->pTbData->sl.pHead; - SMemSkipListNode *pTail = pIter->pTbData->sl.pTail; - pIter->pRow = NULL; if (pIter->backward) { - ASSERT(pIter->pNode != pTail); + ASSERT(pIter->pNode != pIter->pTbData->sl.pTail); - if (pIter->pNode == pHead) { + if (pIter->pNode == pIter->pTbData->sl.pHead) { return false; } pIter->pNode = SL_NODE_BACKWARD(pIter->pNode, 0); - if (pIter->pNode == pHead) { + if (pIter->pNode == pIter->pTbData->sl.pHead) { return false; } } else { - ASSERT(pIter->pNode != pHead); + ASSERT(pIter->pNode != pIter->pTbData->sl.pHead); - if (pIter->pNode == pTail) { + if (pIter->pNode == pIter->pTbData->sl.pTail) { return false; } pIter->pNode = SL_NODE_FORWARD(pIter->pNode, 0); - if (pIter->pNode == pTail) { + if (pIter->pNode == pIter->pTbData->sl.pTail) { return false; } } From ac8eeb87afdeb1ec1e676f4887500b1eab84f50a Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 14 Nov 2022 17:19:20 +0800 Subject: [PATCH 007/116] refactor(sync): modify error log --- source/libs/sync/src/syncMain.c | 8 ++++---- source/libs/sync/src/syncRaftLog.c | 12 ++++++------ source/libs/sync/src/syncUtil.c | 15 ++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 8bccf6840a..b94d807bcc 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1806,7 +1806,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_PING, atomic_load_64(&pNode->pingTimerLogicClock), pNode->pingTimerMS, pNode); if (code != 0) { - sNError(pNode, "failed to build ping msg"); + sError(pNode, "failed to build ping msg"); rpcFreeCont(rpcMsg.pCont); return; } @@ -1814,7 +1814,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { sNTrace(pNode, "enqueue ping msg"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { - sNError(pNode, "failed to sync enqueue ping msg since %s", terrstr()); + sError(pNode, "failed to sync enqueue ping msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); return; } @@ -1839,7 +1839,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pElectTimer->logicClock, pNode->electTimerMS, pNode); if (code != 0) { - sNError(pNode, "failed to build elect msg"); + sError(pNode, "failed to build elect msg"); taosMemoryFree(pElectTimer); return; } @@ -1849,7 +1849,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { - sNError(pNode, "failed to sync enqueue elect msg since %s", terrstr()); + sError(pNode, "failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); taosMemoryFree(pElectTimer); return; diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 21f301308e..b00ba3918c 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -198,9 +198,9 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr syncMeta.seqNum = pEntry->seqNum; syncMeta.term = pEntry->term; - int64_t tsWriteBegin = taosGetTimestampMs(); + int64_t tsWriteBegin = taosGetTimestampNs(); index = walAppendLog(pWal, pEntry->originalRpcType, syncMeta, pEntry->data, pEntry->dataLen); - int64_t tsWriteEnd = taosGetTimestampMs(); + int64_t tsWriteEnd = taosGetTimestampNs(); int64_t tsElapsed = tsWriteEnd - tsWriteBegin; if (index < 0) { @@ -239,12 +239,12 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR return -1; } - int64_t ts1 = taosGetTimestampMs(); + int64_t ts1 = taosGetTimestampNs(); taosThreadMutexLock(&(pData->mutex)); - int64_t ts2 = taosGetTimestampMs(); + int64_t ts2 = taosGetTimestampNs(); code = walReadVer(pWalHandle, index); - int64_t ts3 = taosGetTimestampMs(); + int64_t ts3 = taosGetTimestampNs(); // code = walReadVerCached(pWalHandle, index); if (code != 0) { @@ -289,7 +289,7 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR */ taosThreadMutexUnlock(&(pData->mutex)); - int64_t ts4 = taosGetTimestampMs(); + int64_t ts4 = taosGetTimestampNs(); int64_t tsElapsed = ts4 - ts1; int64_t tsElapsedLock = ts2 - ts1; diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index a575de7e56..b9a271ab9d 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -194,6 +194,7 @@ static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) { void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...) { if (pNode == NULL || pNode->pRaftCfg != NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; + int64_t currentTerm = pNode->pRaftStore->currentTerm; // save error code, otherwise it will be overwritten int32_t errCode = terrno; @@ -235,8 +236,8 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 ", snap-tm:%" PRIu64 ", sby:%d, aq:%d, bch:%d, r-num:%d, lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s", - pNode->vgId, syncStr(pNode->state), eventLog, pNode->pRaftStore->currentTerm, pNode->commitIndex, - logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, + pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex, + logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->pRaftCfg->isStandBy, aqItems, pNode->pRaftCfg->batchSize, pNode->replicaNum, pNode->pRaftCfg->lastConfigIndex, pNode->changing, pNode->restoreFinish, quorum, pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr); @@ -374,9 +375,9 @@ void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntries syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, - "recv sync-append-entries-reply from %s:%d {term:%" PRId64 ", pterm:%" PRId64 ", success:%d, match:%" PRId64 - "}, %s", - host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s); + "recv sync-append-entries-reply from %s:%d {term:%" PRId64 ", pterm:%" PRId64 + ", success:%d, lsend-index:%" PRId64 ", match:%" PRId64 "}, %s", + host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s); } void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, const char* s) { @@ -511,8 +512,8 @@ void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMs syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, "send sync-append-entries to %s:%d, {term:%" PRId64 ", pre-index:%" PRId64 ", pre-term:%" PRId64 - ", pterm:%" PRId64 ", cmt:%" PRId64 ", datalen:%d}, %s", - host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex, + ", lsend-index:%" PRId64 ", cmt:%" PRId64 ", datalen:%d}, %s", + host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, (pMsg->prevLogIndex + 1), pMsg->commitIndex, pMsg->dataLen, s); } From 21ba6fa328c250705b3914adeb2046a68590b70a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 14 Nov 2022 17:25:20 +0800 Subject: [PATCH 008/116] test: add asan case --- tests/parallel_test/cases.task | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 48215b1d47..a8e36e98ee 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -181,12 +181,12 @@ ,,,script,./test.sh -f tsim/show/basic.sim ,,y,script,./test.sh -f tsim/table/autocreate.sim ,,y,script,./test.sh -f tsim/table/basic1.sim -,,,script,./test.sh -f tsim/table/basic2.sim +,,y,script,./test.sh -f tsim/table/basic2.sim ,,y,script,./test.sh -f tsim/table/basic3.sim ,,y,script,./test.sh -f tsim/table/bigint.sim ,,y,script,./test.sh -f tsim/table/binary.sim ,,y,script,./test.sh -f tsim/table/bool.sim -,,,script,./test.sh -f tsim/table/column_name.sim +,,y,script,./test.sh -f tsim/table/column_name.sim ,,y,script,./test.sh -f tsim/table/column_num.sim ,,y,script,./test.sh -f tsim/table/column_value.sim ,,y,script,./test.sh -f tsim/table/column2.sim @@ -208,6 +208,7 @@ ,,y,script,./test.sh -f tsim/table/tinyint.sim ,,y,script,./test.sh -f tsim/table/vgroup.sim ,,,script,./test.sh -f tsim/stream/basic0.sim -g +,,,script,./test.sh -f tsim/stream/basic1.sim ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim From 6aefbbf3b22a7576d32a9007e4344651edc9fec0 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 14 Nov 2022 17:32:09 +0800 Subject: [PATCH 009/116] more optimize --- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 55c7576155..ddf2949607 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -18,7 +18,8 @@ #define MEM_MIN_HASH 1024 #define SL_MAX_LEVEL 5 -#define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l)*2) +// sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l) * 2 +#define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + ((l) << 4)) #define SL_NODE_FORWARD(n, l) ((n)->forwards[l]) #define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)]) From 76628a52e6cfe45b6229f0ef8252f1d76b45edbe Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 14 Nov 2022 17:33:48 +0800 Subject: [PATCH 010/116] fix(sync): do not use SNError --- source/libs/sync/src/syncMain.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index b94d807bcc..e802f60f30 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1806,7 +1806,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_PING, atomic_load_64(&pNode->pingTimerLogicClock), pNode->pingTimerMS, pNode); if (code != 0) { - sError(pNode, "failed to build ping msg"); + sError("failed to build ping msg"); rpcFreeCont(rpcMsg.pCont); return; } @@ -1814,7 +1814,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { sNTrace(pNode, "enqueue ping msg"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { - sError(pNode, "failed to sync enqueue ping msg since %s", terrstr()); + sError("failed to sync enqueue ping msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); return; } @@ -1839,7 +1839,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pElectTimer->logicClock, pNode->electTimerMS, pNode); if (code != 0) { - sError(pNode, "failed to build elect msg"); + sError("failed to build elect msg"); taosMemoryFree(pElectTimer); return; } @@ -1849,7 +1849,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { - sError(pNode, "failed to sync enqueue elect msg since %s", terrstr()); + sError("failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); taosMemoryFree(pElectTimer); return; @@ -1879,14 +1879,14 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { pNode->heartbeatTimerMS, pNode); if (code != 0) { - sNError(pNode, "failed to build heartbeat msg"); + sError("failed to build heartbeat msg"); return; } sNTrace(pNode, "enqueue heartbeat timer"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { - sNError(pNode, "failed to enqueue heartbeat msg since %s", terrstr()); + sError("failed to enqueue heartbeat msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); return; } @@ -1971,7 +1971,7 @@ static int32_t syncNodeEqNoop(SSyncNode* pNode) { sNTrace(pNode, "propose msg, type:noop"); code = (*pNode->syncEqMsg)(pNode->msgcb, &rpcMsg); if (code != 0) { - sNError(pNode, "failed to propose noop msg while enqueue since %s", terrstr()); + sError("failed to propose noop msg while enqueue since %s", terrstr()); } return code; @@ -2005,7 +2005,7 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) { if (ths->state == TAOS_SYNC_STATE_LEADER) { int32_t code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); if (code != 0) { - sNError(ths, "append noop error"); + sError("append noop error"); return -1; } } @@ -2109,7 +2109,7 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) { syncNodeFollowerCommit(ths, pMsg->fcIndex); } else { - sNError(ths, "error local cmd"); + sError("error local cmd"); } return 0; From 2f0dad7b1c3bef5f71849374394891bc3ac657d4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 14 Nov 2022 18:11:33 +0800 Subject: [PATCH 011/116] test: add asan case --- tests/parallel_test/cases.task | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 7ff3eb89e7..1174f46e65 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -138,7 +138,7 @@ ,,y,script,./test.sh -f tsim/parser/mixed_blocks.sim ,,y,script,./test.sh -f tsim/parser/nchar.sim ,,,script,./test.sh -f tsim/parser/nestquery.sim -,,,script,./test.sh -f tsim/parser/null_char.sim +,,y,script,./test.sh -f tsim/parser/null_char.sim ,,y,script,./test.sh -f tsim/parser/precision_ns.sim ,,,script,./test.sh -f tsim/parser/projection_limit_offset.sim ,,y,script,./test.sh -f tsim/parser/regex.sim @@ -147,7 +147,7 @@ ,,y,script,./test.sh -f tsim/parser/select_from_cache_disk.sim ,,y,script,./test.sh -f tsim/parser/select_with_tags.sim ,,y,script,./test.sh -f tsim/parser/selectResNum.sim -,,,script,./test.sh -f tsim/parser/set_tag_vals.sim +,,y,script,./test.sh -f tsim/parser/set_tag_vals.sim ,,y,script,./test.sh -f tsim/parser/single_row_in_tb.sim ,,,script,./test.sh -f tsim/parser/sliding.sim ,,y,script,./test.sh -f tsim/parser/slimit_alter_tags.sim @@ -178,7 +178,7 @@ ,,,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim -,,,script,./test.sh -f tsim/show/basic.sim +,,y,script,./test.sh -f tsim/show/basic.sim ,,y,script,./test.sh -f tsim/table/autocreate.sim ,,y,script,./test.sh -f tsim/table/basic1.sim ,,y,script,./test.sh -f tsim/table/basic2.sim @@ -193,9 +193,9 @@ ,,y,script,./test.sh -f tsim/table/createmulti.sim ,,y,script,./test.sh -f tsim/table/date.sim ,,y,script,./test.sh -f tsim/table/db.table.sim -,,,script,./test.sh -f tsim/table/delete_reuse1.sim -,,,script,./test.sh -f tsim/table/delete_reuse2.sim -,,,script,./test.sh -f tsim/table/delete_writing.sim +,,y,script,./test.sh -f tsim/table/delete_reuse1.sim +,,y,script,./test.sh -f tsim/table/delete_reuse2.sim +,,y,script,./test.sh -f tsim/table/delete_writing.sim ,,y,script,./test.sh -f tsim/table/describe.sim ,,y,script,./test.sh -f tsim/table/double.sim ,,y,script,./test.sh -f tsim/table/float.sim @@ -203,7 +203,7 @@ ,,y,script,./test.sh -f tsim/table/int.sim ,,y,script,./test.sh -f tsim/table/limit.sim ,,y,script,./test.sh -f tsim/table/smallint.sim -,,,script,./test.sh -f tsim/table/table_len.sim +,,y,script,./test.sh -f tsim/table/table_len.sim ,,y,script,./test.sh -f tsim/table/table.sim ,,y,script,./test.sh -f tsim/table/tinyint.sim ,,y,script,./test.sh -f tsim/table/vgroup.sim From d381b4da9331b6094807d8d39b9dbaacf0b363d0 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 14 Nov 2022 18:17:14 +0800 Subject: [PATCH 012/116] fix(sync): fix memory leak --- source/libs/sync/src/syncReplication.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 59afe814eb..6a7a2c18c1 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -72,7 +72,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh SRpcMsg rpcMsg = {0}; SyncAppendEntries* pMsg = NULL; - SSyncRaftEntry* pEntry; + SSyncRaftEntry* pEntry = NULL; int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry); if (code == 0) { @@ -99,6 +99,8 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } } + syncEntryDestory(pEntry); + // prepare msg ASSERT(pMsg != NULL); pMsg->srcId = pSyncNode->myRaftId; From b2f9eeb5bbc2a09c9123bd27eec29bfc516d39f3 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 14 Nov 2022 18:49:11 +0800 Subject: [PATCH 013/116] fix(query): fill operator memory leak fixed --- source/libs/executor/src/tfill.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index ddd948a6dd..c41376b2dc 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -513,6 +513,22 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) { // taosMemoryFreeClear(pFillInfo->pTags[i].tagVal); // } + // free pFillCol + if (pFillInfo->pFillCol) { + for (int32_t i = 0; i < pFillInfo->numOfCols; i++) { + SFillColInfo* pCol = &pFillInfo->pFillCol[i]; + if (!pCol->notFillCol) { + if (pCol->fillVal.nType == TSDB_DATA_TYPE_VARBINARY || pCol->fillVal.nType == TSDB_DATA_TYPE_VARCHAR || + pCol->fillVal.nType == TSDB_DATA_TYPE_NCHAR || pCol->fillVal.nType == TSDB_DATA_TYPE_JSON) { + if (pCol->fillVal.pz) { + taosMemoryFree(pCol->fillVal.pz); + pCol->fillVal.pz = NULL; + } + } + } + } + } + taosMemoryFreeClear(pFillInfo->pTags); taosMemoryFreeClear(pFillInfo->pFillCol); taosMemoryFreeClear(pFillInfo); From c47ac26e2165601e05221c3f752fbe177dfd4688 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 14 Nov 2022 19:12:39 +0800 Subject: [PATCH 014/116] fix: taosadapter windows install (#18124) * fix: sc create service in tdengine.iss * fix: upx on windows --- packaging/release.bat | 2 +- packaging/tools/tdengine.iss | 10 ++++++++++ tools/CMakeLists.txt | 15 ++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packaging/release.bat b/packaging/release.bat index 4ab7297f03..4c82c5ead5 100644 --- a/packaging/release.bat +++ b/packaging/release.bat @@ -39,7 +39,7 @@ if not exist %work_dir%\debug\ver-%2-x86 ( md %work_dir%\debug\ver-%2-x86 ) cd %work_dir%\debug\ver-%2-x64 -rem #call vcvarsall.bat x64 +call vcvarsall.bat x64 cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DWEBSOCKET=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64 cmake --build . rd /s /Q C:\TDengine diff --git a/packaging/tools/tdengine.iss b/packaging/tools/tdengine.iss index 981bee91b8..1c0c105179 100644 --- a/packaging/tools/tdengine.iss +++ b/packaging/tools/tdengine.iss @@ -61,6 +61,16 @@ Source: {#MyAppSourceDir}{#MyAppExeName}; DestDir: "{app}"; Excludes: {#MyAppExc Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs +[run] +Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe --win_service""" ; Flags: runhidden + +[UninstallRun] +RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden +RunOnceId: "stoptaosadapter"; Filename: {sys}\sc.exe; Parameters: "stop taosadapter" ; Flags: runhidden +RunOnceId: "deltaosd"; Filename: {sys}\sc.exe; Parameters: "delete taosd" ; Flags: runhidden +RunOnceId: "deltaosadapter"; Filename: {sys}\sc.exe; Parameters: "delete taosadapter" ; Flags: runhidden + [Registry] Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};C:\TDengine"; \ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 79be05e9fc..0f3c383b9e 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -87,6 +87,7 @@ ELSE () MESSAGE("CURRENT SOURCE DIR ${CMAKE_CURRENT_SOURCE_DIR}") IF (TD_WINDOWS) + MESSAGE("Building taosAdapter on Windows") INCLUDE(ExternalProject) ExternalProject_Add(taosadapter PREFIX "taosadapter" @@ -104,14 +105,18 @@ ELSE () COMMAND go build -a -o taosadapter-debug.exe -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}" INSTALL_COMMAND - COMMAND cmake -E time upx taosadapter ||: - COMMAND cmake -E copy taosadapter.exe ${CMAKE_BINARY_DIR}/build/bin + COMMAND cmake -E echo "Comparessing taosadapter.exe" + COMMAND cmake -E time upx taosadapter.exe + COMMAND cmake -E echo "Copy taosadapter.exe" + COMMAND cmake -E copy taosadapter.exe ${CMAKE_BINARY_DIR}/build/bin/taosadapter.exe COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taosadapter.toml" COMMAND cmake -E copy ./example/config/taosadapter.toml ${CMAKE_BINARY_DIR}/test/cfg/ - COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taosadapter-debug.exe" COMMAND cmake -E copy taosadapter-debug.exe ${CMAKE_BINARY_DIR}/build/bin ) ELSE (TD_WINDOWS) + MESSAGE("Building taosAdapter on non-Windows") INCLUDE(ExternalProject) ExternalProject_Add(taosadapter PREFIX "taosadapter" @@ -126,11 +131,15 @@ ELSE () COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}" COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}" INSTALL_COMMAND + COMMAND cmake -E echo "Comparessing taosadapter.exe" COMMAND upx taosadapter || : + COMMAND cmake -E echo "Copy taosadapter" COMMAND cmake -E copy taosadapter ${CMAKE_BINARY_DIR}/build/bin COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taosadapter.toml" COMMAND cmake -E copy ./example/config/taosadapter.toml ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taosadapter-debug" COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin ) ENDIF (TD_WINDOWS) From 7c8b2867cee0d21259419f564243fd507bdebc2b Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 14 Nov 2022 19:23:42 +0800 Subject: [PATCH 015/116] enh(stream): add stream task info into information schema --- include/common/systable.h | 1 + include/common/tmsg.h | 1 + source/common/src/systable.c | 12 ++- source/dnode/mnode/impl/src/mndShow.c | 2 + source/dnode/mnode/impl/src/mndStream.c | 108 +++++++++++++++++++++++- source/libs/wal/src/walMeta.c | 6 +- source/libs/wal/src/walWrite.c | 1 + 7 files changed, 127 insertions(+), 4 deletions(-) diff --git a/include/common/systable.h b/include/common/systable.h index 8b29525db3..57f85f16bc 100644 --- a/include/common/systable.h +++ b/include/common/systable.h @@ -46,6 +46,7 @@ extern "C" { #define TSDB_INS_TABLE_SUBSCRIPTIONS "ins_subscriptions" #define TSDB_INS_TABLE_TOPICS "ins_topics" #define TSDB_INS_TABLE_STREAMS "ins_streams" +#define TSDB_INS_TABLE_STREAM_TASKS "ins_stream_tasks" #define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_PERFS_TABLE_SMAS "perf_smas" diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 99c5c72e2f..3281bca96a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -119,6 +119,7 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_QUERIES, TSDB_MGMT_TABLE_VNODES, TSDB_MGMT_TABLE_APPS, + TSDB_MGMT_TABLE_STREAM_TASKS, TSDB_MGMT_TABLE_MAX, } EShowType; diff --git a/source/common/src/systable.c b/source/common/src/systable.c index d3d006ab35..c3a1f9f67e 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -134,7 +134,7 @@ static const SSysDbTableSchema userStbsSchema[] = { }; static const SSysDbTableSchema streamSchema[] = { - {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "stream_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, @@ -145,6 +145,15 @@ static const SSysDbTableSchema streamSchema[] = { {.name = "trigger", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, }; +static const SSysDbTableSchema streamTaskSchema[] = { + {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "task_id", .bytes = 8, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "node_type", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "node_id", .bytes = 8, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "level", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, +}; + static const SSysDbTableSchema userTblsSchema[] = { {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, @@ -287,6 +296,7 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false}, {TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false}, {TSDB_INS_TABLE_STREAMS, streamSchema, tListLen(streamSchema), false}, + {TSDB_INS_TABLE_STREAM_TASKS, streamTaskSchema, tListLen(streamTaskSchema), false}, {TSDB_INS_TABLE_VNODES, vnodesSchema, tListLen(vnodesSchema), true}, }; diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index b0af98b933..20c2ebb0a4 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -106,6 +106,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { type = TSDB_MGMT_TABLE_STREAMS; } else if (strncasecmp(name, TSDB_PERFS_TABLE_APPS, len) == 0) { type = TSDB_MGMT_TABLE_APPS; + } else if (strncasecmp(name, TSDB_INS_TABLE_STREAM_TASKS, len) == 0) { + type = TSDB_MGMT_TABLE_STREAM_TASKS; } else { // ASSERT(0); } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 594c13f957..c649180285 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -41,6 +41,8 @@ static int32_t mndProcessStreamMetaReq(SRpcMsg *pReq); static int32_t mndGetStreamMeta(SRpcMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta); static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextStream(SMnode *pMnode, void *pIter); +static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); +static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter); int32_t mndInitStream(SMnode *pMnode) { SSdbTable table = { @@ -62,6 +64,8 @@ int32_t mndInitStream(SMnode *pMnode) { mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STREAMS, mndRetrieveStream); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STREAMS, mndCancelGetNextStream); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndRetrieveStreamTask); + mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndCancelGetNextStreamTask); return sdbSetTable(pMnode->pSdb, table); } @@ -891,7 +895,7 @@ static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB SName n; int32_t cols = 0; - char streamName[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + char streamName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(streamName, mndGetDbStr(pStream->name), sizeof(streamName)); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)streamName, false); @@ -953,3 +957,105 @@ static void mndCancelGetNextStream(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; sdbCancelFetch(pSdb, pIter); } + +static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) { + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + int32_t numOfRows = 0; + SStreamObj *pStream = NULL; + + while (numOfRows < rowsCapacity) { + pShow->pIter = sdbFetch(pSdb, SDB_STREAM, pShow->pIter, (void **)&pStream); + if (pShow->pIter == NULL) break; + + // lock + taosRLockLatch(&pStream->lock); + // count task num + int32_t sz = taosArrayGetSize(pStream->tasks); + int32_t count = 0; + for (int32_t i = 0; i < sz; i++) { + SArray *pLevel = taosArrayGetP(pStream->tasks, i); + count += taosArrayGetSize(pLevel); + } + + if (numOfRows + count > rowsCapacity) { + blockDataEnsureCapacity(pBlock, numOfRows + count); + } + // add row for each task + for (int32_t i = 0; i < sz; i++) { + SArray *pLevel = taosArrayGetP(pStream->tasks, i); + int32_t levelCnt = taosArrayGetSize(pLevel); + for (int32_t j = 0; j < levelCnt; j++) { + SStreamTask *pTask = taosArrayGetP(pLevel, j); + + SColumnInfoData *pColInfo; + int32_t cols = 0; + + // stream name + char streamName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(streamName, mndGetDbStr(pStream->name), sizeof(streamName)); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)streamName, false); + + // task id + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTask->taskId, false); + + // node type + char nodeType[20 + VARSTR_HEADER_SIZE] = {0}; + varDataSetLen(nodeType, 5); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + if (pTask->nodeId > 0) { + memcpy(varDataVal(nodeType), "vnode", 5); + } else { + memcpy(varDataVal(nodeType), "snode", 5); + } + colDataAppend(pColInfo, numOfRows, nodeType, false); + + // node id + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + int32_t nodeId = TMAX(pTask->nodeId, 0); + colDataAppend(pColInfo, numOfRows, (const char *)&nodeId, false); + + // level + char level[20 + VARSTR_HEADER_SIZE] = {0}; + if (pTask->taskLevel == TASK_LEVEL__SOURCE) { + memcpy(varDataVal(level), "source", 6); + varDataSetLen(level, 6); + } else if (pTask->taskLevel == TASK_LEVEL__AGG) { + memcpy(varDataVal(level), "agg", 3); + varDataSetLen(level, 3); + } else if (pTask->taskLevel == TASK_LEVEL__SINK) { + memcpy(varDataVal(level), "sink", 4); + varDataSetLen(level, 4); + } else if (pTask->taskLevel == TASK_LEVEL__SINK) { + } + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&level, false); + + // status + char status[20 + VARSTR_HEADER_SIZE] = {0}; + char status2[20] = {0}; + strcpy(status, "normal"); + STR_WITH_MAXSIZE_TO_VARSTR(status, status2, sizeof(status)); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&status, false); + + numOfRows++; + } + } + + // unlock + taosRUnLockLatch(&pStream->lock); + + sdbRelease(pSdb, pStream); + } + + pShow->numOfRows += numOfRows; + return numOfRows; +} + +static void mndCancelGetNextStreamTask(SMnode *pMnode, void *pIter) { + SSdb *pSdb = pMnode->pSdb; + sdbCancelFetch(pSdb, pIter); +} diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 1c6e1a2e17..6cac4b6093 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -124,8 +124,8 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { goto _err; } - char* candidate = NULL; - char* haystack = buf; + char* candidate = NULL; + char* haystack = buf; int64_t pos = 0; SWalCkHead* logContent = NULL; @@ -414,8 +414,10 @@ int walCheckAndRepairMeta(SWal* pWal) { } ASSERT(pFileInfo->fileSize == 0); // remove the empty wal log, and its idx + wInfo("vgId:%d, wal remove empty file %s", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr); + wInfo("vgId:%d, wal remove empty file %s", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); // remove its meta entry taosArrayRemove(pWal->fileInfoSet, fileIdx); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 7ced5fae39..216dd5fcb1 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -407,6 +407,7 @@ int32_t walRollImpl(SWal *pWal) { } walBuildLogName(pWal, newFileFirstVer, fnameStr); pLogFile = taosOpenFile(fnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); + wDebug("vgId:%d, wal create new file for write:%s", pWal->cfg.vgId, fnameStr); if (pLogFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); code = -1; From 344395b05a151f59b9008d1ce06b8fea60fe7dfd Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Mon, 14 Nov 2022 20:57:29 +0800 Subject: [PATCH 016/116] fix(taosAdapter): fix log output (#18127) --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 79d54f522e..cc46ef9938 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 0d5663d + GIT_TAG ff7de07 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 6b473b7e18ce335aec7ab6bf05cc5a2cf060905f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 14 Nov 2022 21:10:02 +0800 Subject: [PATCH 017/116] test: asan case --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 1174f46e65..fac4210d88 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -68,7 +68,7 @@ ,,y,script,./test.sh -f tsim/insert/basic0.sim ,,y,script,./test.sh -f tsim/insert/basic1.sim ,,y,script,./test.sh -f tsim/insert/basic2.sim -,,,script,./test.sh -f tsim/insert/commit-merge0.sim +,,y,script,./test.sh -f tsim/insert/commit-merge0.sim ,,y,script,./test.sh -f tsim/insert/insert_drop.sim ,,y,script,./test.sh -f tsim/insert/insert_select.sim ,,y,script,./test.sh -f tsim/insert/null.sim @@ -109,7 +109,7 @@ ,,y,script,./test.sh -f tsim/parser/dbtbnameValidate.sim ,,y,script,./test.sh -f tsim/parser/distinct.sim ,,y,script,./test.sh -f tsim/parser/fill_us.sim -,,,script,./test.sh -f tsim/parser/fill.sim +,,y,script,./test.sh -f tsim/parser/fill.sim ,,y,script,./test.sh -f tsim/parser/first_last.sim ,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim ,,,script,./test.sh -f tsim/parser/function.sim From 7622361ea51c7038182b0192a73916c1280dbfa7 Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 00:28:36 +0800 Subject: [PATCH 018/116] docs: add media links --- docs/en/05-get-started/discord.svg | 7 +++++++ docs/en/05-get-started/github.svg | 6 ++++++ docs/en/05-get-started/index.md | 20 +++++++++++++++++- docs/en/05-get-started/linkedin.svg | 6 ++++++ docs/en/05-get-started/twitter.svg | 7 +++++++ docs/en/05-get-started/youtube.svg | 11 ++++++++++ docs/zh/05-get-started/channel.webp | Bin 0 -> 12650 bytes docs/zh/05-get-started/index.md | 21 +++++++++++++++---- docs/zh/05-get-started/official-account.webp | Bin 0 -> 11686 bytes docs/zh/05-get-started/tdengine.webp | Bin 24678 -> 0 bytes docs/zh/05-get-started/xiaot.webp | Bin 0 -> 12592 bytes 11 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 docs/en/05-get-started/discord.svg create mode 100644 docs/en/05-get-started/github.svg create mode 100644 docs/en/05-get-started/linkedin.svg create mode 100644 docs/en/05-get-started/twitter.svg create mode 100644 docs/en/05-get-started/youtube.svg create mode 100644 docs/zh/05-get-started/channel.webp create mode 100644 docs/zh/05-get-started/official-account.webp delete mode 100644 docs/zh/05-get-started/tdengine.webp create mode 100644 docs/zh/05-get-started/xiaot.webp diff --git a/docs/en/05-get-started/discord.svg b/docs/en/05-get-started/discord.svg new file mode 100644 index 0000000000..8218e3c3ca --- /dev/null +++ b/docs/en/05-get-started/discord.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/docs/en/05-get-started/github.svg b/docs/en/05-get-started/github.svg new file mode 100644 index 0000000000..493832ceb7 --- /dev/null +++ b/docs/en/05-get-started/github.svg @@ -0,0 +1,6 @@ + + + diff --git a/docs/en/05-get-started/index.md b/docs/en/05-get-started/index.md index a6b6721383..fec734b64d 100644 --- a/docs/en/05-get-started/index.md +++ b/docs/en/05-get-started/index.md @@ -3,6 +3,12 @@ title: Get Started description: This article describes how to install TDengine and test its performance. --- +import github from './github.svg' +import discord from './discord.svg' +import twitter from './twitter.svg' +import youtube from './youtube.svg' +import linkedin from './linkedin.svg' + You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud. The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to connectors for multiple languages, TDengine also provides a [RESTful interface](/reference/rest-api) through [taosAdapter](/reference/taosadapter). @@ -12,4 +18,16 @@ import DocCardList from '@theme/DocCardList'; import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; -``` \ No newline at end of file +``` + +### Join TDengine Community + + + + + + + + + +
Star GitHub

Star GitHub

Join Discord

Join Discord

Follow Twitter

Follow Twitter

Subscribe YouTube

Subscribe YouTube

Follow LinkedIn

Follow LinkedIn

diff --git a/docs/en/05-get-started/linkedin.svg b/docs/en/05-get-started/linkedin.svg new file mode 100644 index 0000000000..969c6f03af --- /dev/null +++ b/docs/en/05-get-started/linkedin.svg @@ -0,0 +1,6 @@ + + + diff --git a/docs/en/05-get-started/twitter.svg b/docs/en/05-get-started/twitter.svg new file mode 100644 index 0000000000..4825aa4ed0 --- /dev/null +++ b/docs/en/05-get-started/twitter.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/docs/en/05-get-started/youtube.svg b/docs/en/05-get-started/youtube.svg new file mode 100644 index 0000000000..20747b8b6a --- /dev/null +++ b/docs/en/05-get-started/youtube.svg @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/docs/zh/05-get-started/channel.webp b/docs/zh/05-get-started/channel.webp new file mode 100644 index 0000000000000000000000000000000000000000..8dba93d411d09f1b98e5d72f69cc98c78af5ddb1 GIT binary patch literal 12650 zcmV-wF_q3zNk&FuF#rHpMM6+kP&gn~F#rG%3jv)0Dv$w?0X}UklSZT>Bq1X5kFbCZ ziD_=nUKfEc|I7CvT~rlhf5*PU6P$?LR`?6KZh|}Fe> zgYobC@A*&OU#R~U`-kw~kl(dGV|c^uBUA62eQx_l_W#&V$iKh8!vA;v>-z2f5A|!` zKi+?D|55n6_{H`M>R;@i+`nMI#eTni^T8vQ^aJ?6^N;d>-9K?Zy8LJTH~7!Vf8YQA z|499r|1<6Z{CoMg`S0%EyPw?u|NsB{-@>cwUZDTR|EPby{`dZG;v@U-`5)>3H@)%x zf&Q!hkNZ#FFQISczt=zE|A_xJ|A+Vg|Id{(u?GDml7Fcquh}@2Hds-HVBLB$bk$}* zk09r1XD^7fF6Qu4mO&7VOkWZ@))=xy|IHIsCDH8!yYr^z``I=d)i%c@urgUN5lgsE z=<6TY>X_OrUqq<%Yz!aT!1o$y1n2am zJXhQ%V9uw`K_nv1sd3NUyZb8Q`(me8x{~fCAT1^PX@mDp!84)v)PXSx6vd# zu?kG%(^m%#hkTMv3U4c$?v_jv8g-WizCrD0zu1R9gyUYcA;uZ)tOiY*j^><=&mPqp zpQ}C^7vLf+gAMUt=UzC1FCasdFyQ~AfCJqgJ1JB5k{K0FtRT=Vsu(6tfq0!+2xRo#Ykw zL!sTZtGBQPj3h0(tHD)`r=)^X9^e+6x(}cIJtins${S2q?S~7M0uVq8f^xcr3&;w( zn$p|ulZ?pEWBsgQfID9=E}s#R8GX0?&iLdxkAP-~TlQcy_nE;5-^(S4K3mS=riC!W zobhX3UonYqqnZ}#Yj5?;TNK`U8nZ=xp}9RGKs+VTo!1nn!-^r+M^D<|T+K`ZyGrux zX&c(HE?QM@l7f@-aag)A&jno5T-9YRouiJf4)? z?8GU)cb!HK z1gkj*`B!U3qE@GvOV#k!qH4x)MmRxTx=s_{D?M#9rGK|~N;fq|rm%a323AXCN5w<5 zoc-EKt0(r6j!|X2(5}^i8}-l3B~x@(3}50r<^&>F))*pi3?5D_>*-dTVTN{ze%*c| zL;iZ!!!-9~(!LjMRefe;qs^BjZIP`Vvo&@jl>Rcv=(#J7c ze3}?XL~!v9Ds;E|iP&SAk!aR@7XmdE6dDF#IyR#XUd$dGq2`x9-s^Pz6HIdWfE3L% z`P2L3sq(E7s0J##k}Fovj`d(Vz5kg+;h!-#=LVgw@k_sK?D{T(#kXR{BbB3k>FbX6iP zBAm^ zf^q2nQg!&`1Man`I($%O`Gb;OQ;2>tkD#Ab$>B8yyH6>EZBlmphWwoj)pWs7h2#&0 z&bZ(OI7(I;&8BLv*6)^q#7lO@C9_$2VXn#H@DY3b62)3yDuRwz$d*e+=)y@f$u#3R zyt7^B9x4(r;)TuCRVmXgNwkq}bn~5wU_EwwO)FW%cFE6j|Gs-3aTR8NQia)gNReT> z!8yzV)k`i5@0-O~_mFhnM#>bYTxs&WWJhsq@nHP$?}(CTo$VGGnxTRm&~W)ge4+#F z+|Cf?wAhZtF=@Dy+$z-bWJsV=cCto+ZFegYB!~rBGR~=*zEzk&0Q`BL+#MF9qZ7NO z7PJDR(co-R#*nRa89Kc>NBPC;$5JQ(vy0?X+yHhBsuUVuU)bljnl3xhE^DFnS;J^K zlrgnIy_E^-igr5tvvu%ezFISF@6;txsu;dyYM}I039)cx3P?ntmb!<4*4tW;{%<5# z;nj~x?EZ+{;jV19$=*SPIG`ab;27K*%>!Vmr6qfy%*;aR9$SiAx9$8(W92{o*@s%A z?E^Df?QV}{%5#2X;Zwx4oBD?(lWKZ*N|>ycJ>Hyi5xIK-a~L(@E$31IOEcF zn=TnU$BqD;TekFCsc{6U{^G{Tps4t;g~2*WP&M)>8|kDWid86B2iMuD(h2<3OcU zai`<*w+aZN>f}AFR&Cr+1Tu0q@4=E5jKf=b!|Dn<`2}^2wwE=xO-EGnf42r{%NQdr zn~Wf!x5p>QD@X&(UI7p-b`CX4QxD#7+DCxN5ZN%@TF78$BJ*`nJ8ZNEphq;s$iYaF zH|KrTxl4}rV6_au8ur?f?3s)ixD=J(K16I8(8{gJNxCLd;RNy+x zgPK#Y?zsxOO3O44efc544PQXqYaoFW&V;W&npY~dXbby6#_HwKR#EGsK{Kf29kG9a zl|c$n<2ZkfVOOOJb{h7+7#R^-`FfgMs>Is4KEZ+-$a-Ql63oW7sDU7Yk~f~Lv&Ru< zED%`hf)~x%Jz%~zgWNjAV&6NIm-Z6njx}UkJU=0VdY@%UBLrEpjVnx1a`7$f4Pk3z z94AQl-xcp&KJ?`{Q`jV9k*amSs&CCuVq+o){2kl$eEp2wYXhOe0QD?x?q*(x`nN)w z-?RkMP=TpX$7fgl-Ut^SC|{0n$aG_5)D==&@%VUA3^O7t3KHz8%5txhMHu@u!}7{w zSi}_asYJCSR&Q17+6_%u)G}qNXHSFc0 z%|M(JhZHptRWCl@xbeNoZ?E`fhtj;47CwgkjKl;2x^~0VZ7u?@59oP&>-qse1Ibf6 zF?Xdo2;i*5?!^7Y0oMMNEo4jOqaB}JTjber_#?Qr%a!KX9x9PRLvtGZB`IgFI-VnB zj&nYE8+Sv8sUqu)P)?P=J_5#-jPR;DjE9O8}CZf!3R)JmOw&VsKnq{uRm0Avtdf=Pd}0Ipm}5on!de&b!e15TsXY`ajld0|IFD3Ek8t(W{6nXK zq*&_qiqXUX>ZH`bdrwimC3@A`7YfrLn>l7__^YU5H2ejJlJf%(7~<#j(aQ1vyqwdP zcDdPdxZ`fu4e=h=E*m(AYY>U2netY#cimB;rM9Vx@+St0u%YYmb&tqpX*M5sA%`$) zygj!zfaWcGciH-L+CH4GOmkkl^QL}~3|jVpWdfiUF$3G*1%swF_}IO3>Wzyql4@Ir z@}4y?RefLSm~MBLz^c|EX*rc;r;AcQ*)I3T!6RkpDEDm3cGMIeu)>BSQts>j>ytsL zzI#suEb3*{uKe$0$G@`9&0ighsfrr!+fl~ZLwgn(Q+yo{K|y8**4kNOv#BWtJJ#9{RC@YVB{U1xE56i z#edb5J)3F*bgBv8<}RnMF@|g?E6*e4q_m zt97k8BfJKugJt;xDmzsIG;-3!xI%F0I`MsNLc)P8^+>UdS1ICt9w}fR^STZILjVAI zM8l7A?`#i`Njo@%ToYgyGIIOu%tSp|H-MLm%6rV;)pkz>qMq2BzwXOeY<$6XAx!)w z%3Y|d9*3!OveaNmuNmLEy(~9SR*y@G&_Aym*K1b0J5#ovZsJJql}Kb#%FUJQ{N|qP$kR-0sp~TYddbo5Bpbgvh9_6dxETU7bFy=p{8n{$q)`OMG(-*mf+o5_ILg)@AC~_zs7y&^mHbtD0RL6WSLfMh{-Za z;Jy8)$d-V@if%%9)I-V2U<$&l>PxAcq9c!N_Q$`EBf?Y z;i{=}1Upf{vNru5!sEw5axnQS>*`=B;PA$f^=!zPY!JUGrkyb;V`D_zW@$Buim1NU zOUDH)oVUId4X~gc_vezfq8a1~0VPziJ>J~M9Q-E?-#}j#PFUW<1$X7VG{_O(_S9!w zM1IW$h9#zS8}ys7(*Oxl%pW<8+-6hTlrFvV=xg??B?hXGu?qp!9|6$KpVvnXqw_2e ze15amaPBCS?yIsf%*^X_zhuB_zr%QiJvEJLm+f!&0nnkU zqPLJVcGbFiBiLs{AqZobf+m)T#+pNQj z8IDXw-$mGF`qG_6RKwFw?9G&9A~?xBX-iCi#+pTat-Bp)c3Iw)kzf3&JneWNxXNA<}#`#oEVPp5d#klBN)PdaRuI(T*K+Mfk=WC1XQnT@;0X=Ueia&@Sk z3{3#`)a|O8vE0zTtdY%_Wkb2h%H+n$$EK~m$TJAWLrGb|y6m*n4o}4!@aA}AX22|O zY=&T!9aXV#+kNjUJC=Hs+&`%-f2x)2zHX^1p%8So#A^{<18bZh{Ow#P=Nb@=_4 ze8OS0AMq}Q>FnnI9sgyh{Imzo1vMFHIg064OPaXrD0TUiVi*6^Nk5?B17m_x)P;I^ z(vqG}08y!-MmNbAw6ILOTNlrJIU#I+J$pVDHg2mm#u_M~oXB%B$l&yehPAckWk64r zIK!q`yI6SGwP)&>ap+48;6e1nX{Zy^$WZc^s{DQ zga!>-Nb&3?7bnqVjtP##VYW_L1o}`(VFU{I`Gz#_$KJy7b&^wgCwnq1a)Im{J?JR4 zt5(WE$(%y1JQm~kkp?DgV6J~c_!nGt{}oIq)F)-CZZF*38&hWq0ns#Mf3G+VAH0`j z4xb}bU~Nh>e`Jfax_VeG)#t)!ZuyAI&EwwY%RNL1V-x^7^vRfJVD1T7>_qYkT}JvS zo4N@>bar5l`R2SZ4M7m&l=LvWC!8cn?4I?0TI|q>g;JYrPRb#tK7;mDcDzX0Y=hJZ zkFD#FsqA2&?p+dcInTV(?|A2<9AljFABFsS%Zs1eol2c9vnuSpSg;m?#VwwQ7%Sv- zj>qC1%Nu%w9x+1`I6E9B_Wf%K)aHdZqsm-B@6o{gt)zho0 z7URiHI%9hRWczH+jcj*mMjTBaA`!GK2>2ljSx=y)c%`&1X3Y<(VrRRTr&Mnbpl{YC zxSzp(vLIILZbwyPca{*a*8m50Ee0{LMgLKw`gk=!d?`A<+qmcC#cV zWzA=0nBizDZknXAe`I(RT_jW)PjVm*5&qdBMq)PDSx>H@ijX+kBAU_NOi-I%+X~2& zvU=207_jY~;s#3A1f`|CZ;BAl#E9S-hn>9~r_o${8xprjqgiYWs2VP1Z4-r-HjBFH zz}6w&Ek%x&`I>mH*>IV!!gIRA0$~$x&Y*TAcf7F1G7bdgJ0)_*{Q|QxRQR1bqN5^j z4^LJg%PomO;ff5RYhU0DHa1ztc)UQ^(S({gMKa!4m}=*2{?K}{=~3VxnNbKCLvc(Pys z9;UwYq&pwcK+`g{a0($e1Q`0=s9-?N1J%mi)FQJ~bzb$tX6g~I{#w-<_6(lWA z5;m5Vr_XrZMeRVoJ5b(9&QLNt?Pqo#HX;sLuX~M;V-qujSqaTBgf45UNeMLjL9jL` zeeiuKnEq73Qy~S-ImNWwbl=gj`)rjTF`d?=+IBw%Xk*~y1u=?e8a6**MIfeL(Q$x& zrT!N^Xh>N5pUQuGh^04x^fDAPx{b5C!ymQUhlfZ3V0GJ!P7AK-P1{ zwjP>HDIQ=_l(%B5JoT7j3|{`Aix}wsuOgi&z|WKX0&mv|u4@y*p~is81j*ePvo9)FIFPT;%f_o+zx)4Ii-@5v^#e=lwDyPF+rH% za-nC2nXPV!jzrvnbul{6-E#WHq|_d4-EJiIFXGc-TDCWJk4pFdJR;`#?N8ntY@=Rl z?lOnH{x&h7Ak~i;E}V!dWdAV>@s+ZJ?pz9*bV~bZ2Uck>2T5fzqGlNVj(%s&;&e+) z=LVQ&$5SV4Z#>{EAsPhf;9jt=qi++I+vc(#pFz{azVMvwkrNeL%)#egfghlfal5aV zk);6%bnI$1=@zGvF2qVOQbck=BHdn_~ny7epQwDmQA7rwz{^98!fys z0^+{2Bi~z}Fn2)5Tu5ra3KS?&3f|MdUC-J1ze1ZI)t-7EZmmz@eZ#YJel;yGEE>j{ zQ-)`G!cx72%I`zrqxlU0CgubFIn&!?RFGfMrahBxIlm{32LOU$Qf{o?zEFKlO(U0S zwEHaJ^cpPoK*5LN@hT7#Km8C!I1@})POnMV9hE~FUIQbI@*UR2chvYYizJvOEpDr@ z%IKg1FfaB^V?ISHg5cqL_RWKx&&6@N6)g#-m@45Xu>2rL7lo%^ zl};9u`?9z}dm@(9b`3aV>S45w{O74=CX z18@xD@$vWhJ$xN`(IpMZwoBfKBXlby(&d0cn4Moau=*f9fjvFW<)6G%0A+}p$bzEd zQl!xeTzfkeE0bM0NaD(vhb&< zitFtZFPnKrGRD)f+$cmh3z#c%bZ%Wo)YB&E*cB_oyW~Km49YEI%iIG1?7rQ!%%?cN z(P!^Y8?C}7RPyT7g}e1pHczCCGq-6ce$pxg4ptp51V};zVi)cCd{ldsyiM}$*Xz${ zHw_dBtS6EN{4duf_YmV^V zH6fu!GWtwLkH~THy`*2Cm0g}{xM)Wgw4QzmAYS*uQ%Fxc`2?19-o~hb;0EO@A@F}J zbAYZu)|b4)Ui+v?=Z^g{Z}KQmy7o1Ny_tq z)bzQEP#Oat#}Nu2LyQbTRZTcJduw1Ah?gKD@?b`$%***a^O>ARRX|WvTiI)3jiwXo zgz(huWOqZ@PjdAr7sa>wbE89^8;8G;W}sAW9!?-Jn_{~eDC{LjWCuGkh5y5s=091D z1vsXs+ILPQT1R?8F?)uK^4Gfqp*KS49ps6?eo6Q_XUevt&O@<}sXNi!s@a-k%VYc? zHU?3ys6bYC6i!4#iF;N^f(mVQB_rkgX2ABwbP7Pj3Wy!wf6c)`leKH*?%L=}X)DO)YPc3Ss-dCI1G|Y_bq4&|>eZVLRd1A~?cMQv<(l3+4Wb zmb}rw3|)JDQE@{Jxq^UtEwMPwl%}r1kQ%2!C_Xo;6qxALMN_@Xd~V3`-KWb{bjGr{ z>CF0KX=FUo`-+f;dy@JA*?rXCqeydaKR=&AA6)9)!Z{o9;RDrjsfT7(FVj;q2*ImrUIXKG1wmi4(yzTVW9_T=R)_@Ju(ff<5a!NdBDQD8M!?c$%eu0$9^aNN z)f^#q{+cvFLix~`fB%#dZ6Twm*( z*<4SkV{~RY4R1_FimPZ4d-flj&`}U0 z(DLUHM(rUT7?jXsvjb;(a2yw~HHgXyPCtZETm~1WLDaD!aI@JMcpS&90Tf2i^b0J( zQ`3XH8ta`g%wwmW`aErL2Mw+UU!tdD(HS1WZ$rLITp|bMywt5K`%3(`nYsnp0Ox-3 zuj{@NUs|UvJW36>?v7zH8Uc^c&6MWuM-LqPf{mvRkJCUoOjI@`*>Q|8p(E$?om1zS z`)!-E1bQf+{3uM1^6AcH%Dj(v#G~BCSaV3m3R&%CtEgm&(S9Zp$>!zh98GOZKpi9iQd+BV!mUwy}|7Idz~Y5 zJRQ1Wxk^;j0QOpiX$#?}4J(P;fH^UTfWM1-_~JJ!-D<&T+CyhEH+N#p>e(f|A*Uz` z3KB?fk9IpZ(FoUEdpN@XC6YSrbb{Zg!Xy`B^;}$Y_nCxxMH@r}{w`;mUGJn2fPItv z8*ihm#+iMV?83TRU@wOZzYh-xq*-i&D;Xr*6I+n*v!mT1{Vg2g)9%b7?B&0^7Z5`>sL$S0nl^pS^e0u$sBz+Dl@aS8{zle{fjI z9;vQSU3LI}?^JRuZ_Vsv8Yzzr6#>k@ts`z9?n=)SP1GV{zy!e;Y@no{ z71U(nz1&y!bQChFT;E50KDDlcm{RGSj7!qj(7mKc?2l7NHkG5BTCm{-ZT2JM%qrjO2J%Wawk?3AW{P|6`XwEwkO`AYhcQUhxrK1u0n$Z>3NX8l> z0)0!6*R*{cgY1;LB`JlyGQyXOGk^G&XtFkSwDa1$5e*`vs8Se)o0f~am=^Id6e2AI z6kCE18Bo{Nu1WduwazU`pz0@!7MGiem@^(p-!ZtM1EiTgPesX!@VGYOUY1IU)q2<{ zTc@7br#F^sHe*)|b5U3@p91JDWOe75lFO_ZwAL=kT!N$3W^ebI;&)O#$776f?!Pwf za%?xwS#sxjG*%aF8AwlUe<+J#utD1eVYk0UGS4Yoc$Dp5y*xgx>(9^(jz+N_^w)P# zI4f#rbZ^zuekqo^qF-27bSCmz-(UCYP3rIty8?nlVQ_8<}jV^i^bP zqn(%MxB%ZRtP<7HvE_PiN|M&qUpQg0lM1cGIY53BuZK;C(k=S%Ss=;CQmPts04>oO z51d&1!$o260;dpGybcU3L9BKR8*~LRHJkv6`oG<&VkeIOYY~a1JOHNmZlS!*3|=aPNXds%iL<+h$`j`wc3O@1?$dJfzEV zu@@}YZuI3Pq|hdaGT{9ySf3s3uJTFN`H1@$r087cvywmPqTxZBKneyH>@riyQX_fj z&-jvtpjz*%u5f3OhWz>}gp?j%x-3gR*JycpXD1+Sd_})YkM&s}XYoz*JC9+2_5yz{ z(=K^~Q-(SsH~vqt;1jz;vGxgG5DX&U75ulmeDd#AH`MlOlfO$n%qbyq`hGk6EB6+= zJo#pNJn4ww_{M55$FsShOAzICGxj;CPo3Q{X&AwHF@(Y7mdlW!aO9I9W zZ$EE;*y>(`+Js&Rbo!rKu5Cl1rcEsQIFFsoE_T5HiT3*7d!jd<9u%=&)!2Ue_?^C} zYhZ>4xe3$l=lWhJ>3tes!C2X~y}xsP;*!SwB)4iihbn@$88m5)IJ#4=Vg=7lHi}+8 zmmg!K4zc~FcQOOEqk-?0pJ*(YWY;YV%)5+4mV7BRAaX?LV34}UQK)xz2B<`BJ_iB8 zF3;Q&c}dF8Pc#bTILF|tR&ojaOQJE;%1NLoVf-i1k>^zJPH)$~;?JpH8IGsOe#{NKUaFW4->Gdj z=3YuZwo_vI6BYeJ*5!?9ZYpIaZWIux0*6DOfBnq?dSh!ea(s$aVlLhvgNPGG*}34c zss)fNS`RGBahpNP%CpOgGg;`Whq+RyA(y<~hlAM==rXZZQ<1)=ttSEONb9ppRDwkJRQB3QAKN8_dlCSr{r z7{QgA4Rl)OxZ10jCabS9Ef)(j3uKnEHmxisnZ3wBDWT%bMJ926FT#tARJ^#jM?s5F zQxFs|o2E|H>NPca@I0XzAyZY-HP}ryA>rC1IMS`NClG^yB#(ODJm?9%7maYEpV)w| zsK!Y`M&2~acOHqLNI8YNb37`l08!S{hzdNve8EmT`}3_7X7%=^b&?#~prh(@^pGSs zrhUj5hJ>!hRPwC^M0=w7Xa`=)VW4aN#kmp{vmno|G*Te49lOrnqzukZ)r_lXoe-EC zI55^2@yWG9Cp)_WLDcwLq^z#;U0GkShv!<}B{`3q{uK#SmUV@4^P4$1iE%i2VuHbL zkr0P&9-dPqB&Li^qI>DJWQxo1h0k`wqLj%cs`ijPzHX}?@Xiw07n^66iU7!-rfpdf zUz3GJh|wb6?om8LH%d2ddy@m0kO0CjSE?{Yv3c#}y`E&{)sk3Pf}nOM(@|1Rg9L1c zr~&mBM5=zMJ~yh9r_%sNu!?~`x+(n{0=nwV;;BfyR~8~s&{7EUna6GKI8NH9q{}(N zVxI2g>A}ftCWGE*Aza7qPm>rFj1(JMQz#xOVQn&jr$MWGKpnSUz=?1EQ&{p?5TAsR Y@|UA=C`^`i?e6IRT79jv)5(hf0N>oP)c^nh literal 0 HcmV?d00001 diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md index dec4d800bc..092523a556 100644 --- a/docs/zh/05-get-started/index.md +++ b/docs/zh/05-get-started/index.md @@ -3,7 +3,9 @@ title: 立即开始 description: '快速设置 TDengine 环境并体验其高效写入和查询' --- -import xiaot from './tdengine.webp' +import xiaot from './xiaot.webp' +import channel from './channel.webp' +import official_account from './official-account.webp' TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../reference/taosadapter) 提供 [RESTful 接口](../connector/rest-api)。 @@ -16,8 +18,19 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; ``` -### 开发者技术交流群 +### 加入 TDengine 官方社区 -微信扫描下面二维码,加“小 T”为好友,即可加入“物联网大数据技术前沿群”,与大家共同交流物联网大数据技术应用、TDengine 使用问题和技巧等话题。 +微信扫描以下二维码,学习了解 TDengine 的最新技术,与大家共同交流物联网大数据技术应用、TDengine 使用问题和技巧等话题。 -小 T 的二维码 + + + + + + + + + + + +
小 T 的二维码TDengine 微信视频号TDengine 微信公众号
加入“物联网大数据技术前沿群”
与大家进行技术交流
关注 TDengine 微信视频号
收看技术直播与教学视频
关注 TDengine 微信公众号
阅读核心技术与行业案例文章
diff --git a/docs/zh/05-get-started/official-account.webp b/docs/zh/05-get-started/official-account.webp new file mode 100644 index 0000000000000000000000000000000000000000..fcbc3107fc51ca5474be653302db777de7d1e775 GIT binary patch literal 11686 zcmV;XEm_i1Nk&GVEdT&lMM6+kP&goxEdT%z2LYV{Dv$w?0X}UilSQN=q!SqT$Up|f zw6}Z{Y_Yfoy>Bntvvp8H5%o>;SdBwha3`4RWek9?B>zhP1^UhVi}cIrU%!7{{`30F z`-T0(|A(=UxBoTy3HyWgNsN0^{&Drw?VsI$V86Wn$^G;GKl}IhZ`eP|KYo8~{p0?3 zs9&gmvVKK>aQ%||@re&I=nL_$=fCAY!T$7raQM&qPx0P`{j2{M_R01G{FC|L`2X$y zj9)zd)p>jUyVMi-|MrjlpWJ`Z`=$S({&)PZ{qOl70Dn9GWB-Hwhrp-vKkGm6|H6Nb z|E>Nz|No6}!bF(v9L$$B`;t6^t+;*c>6wEmDnj4oQ)soe_W0QgCtr~i^YN&JK=M6Y zS0WR&CMnF=^pn^dbPOwV1blbB<7pA-H+E!`y#XX8nx*1cn1d!g$zQ61YxSjS~C_NBtCdn3swd)hUFV zKK_06qz^pl(edIVbu|i+qD<6~8|x=5D&9-2J#2=~x!B~6cobAct)Z4r7s!~9J#Jm_ zF&#}s893;?#|$TLHllipN?4$$jdjl9h7&UVLFxb6zD3+tzWMQ}8;dd$(2-wv+s8O@ zhyzpZEAxzilQbEW9Mvb?KU8S6EnB6fznY@o)O^8@$HQ|C;nQo4lz3N^Rw%Bi=VhF% z<&84q(b8HCWUsj(^ie}QV*d1nM~miJb{u9aHfgFD+VD2p`|#HK2%8>TjQfd>YoK`Z)8U zDUfY($#*^wFv(536@-J-avmE?(S-umV}lY>B^sMX@lpyP~sRBNbB$YdZ+$@G&;^wCWzCkjy4u{CD#o% z@RwU^CO!xa|C(;<0w|`(R7nh|D{U{vgIR$IsJ(ad`hwB0F{ z*7&zxY?*sy)Z1d`YMgbm!D=e|5cAlbH4-)*VbAUcS2w76lT75BGb)L>cm@VyB7c{& zCw^~&Bk1Gg(WhozbTlvL-Yn{elfwfJ1Tmd#vQX$u-mIF|ta4?y-rphm$WfMDs|Vsz zAgAt%)Iehw+)XG?5^PxXG z_9ZTv4tqg3h)N?*$sbYlXvf+`@?x@Q0TrH`MgoJb+F}VCaZTAV#3MSRX8V|&izX(e z9Le53YvHsGYc3eeKjJ>?DuM7p2D~_m&G+WKVq&YBf_?U5@`9Oo26%K^GsM!OXzYL; z;x0ef&?nBMgn-M@WwsfVB8%;-Rs+PI2YTa)@>ZhXWo21NFqUqQbI3t{Fw2rwEmJnt z2m}MCjc)kb#MQC8llwB*cd8XYq|99Dl`7vf2aACJlJ#ZtI^%C247}gcx(f zWbFW@n5sHm1}vqAjp<^qeHk6x7RoJ-fB?<$?Y{W+8zN>5Cu^Q`9~9M-(`tFjUhjTp zT7Tk$3Z0uaP+vvdOkha7YFBVm+g!-0@^0k_ETkKEoIVf~FsTB$vP1*cqDhf#UW7~a zPwjoI@!OGBAdQ%pY~mRQt3&<($0}3>rP0UVj^9t}b$_0Hi3KJknvsqk0#Qbwn>zSA zF#aJBjjd1^9Tz2bE^3MSwrS1YX)Dv#&RIIL8h^l(Ws95O-zx)H^o6$Ri9$5j=fqUl zNp;F=KYyhTKmIM4o3m^DZ9xIB#Fiw?4d6TpR=yOMR%ZQ8!Fo z^4L)WRwcw_TI4&Pva(pU9Vpa`mgu%$#NHhlX@7sgkwhoFdq14ZO+jQVou#(Ys&8Ne$Dkbb+ zXxHCTMv+DXiP8r_fNGSxZ?d0noUGwti+P4QD&E?*B=iKBn_|g}E}?E$Q^cQJ-M3;L~I1iNd>?^I{8X&OuFiA6F_>W0gAG#k@iFCo3*z7*4I z6~)yQQwOkwgu4y58C}fHD0;a0IkF(v{tRK(@qz&YuZ>>WnFvbv6Ni4*J^g7P@tehx zZ*>z3zwZAz`ZnxclYzSA%f4LkZ(67Qa=uIP!{UY(;ocFtQ+ES@w}E|M`tD+k9sKnG zhM)aX`4&$sqj5O`25}#boAswf@$K0mL5`BS#yZ3DTZ(wS*(WD?piM!6= zFyUaw<+*`tTR78}=-ZthIPWz>pW}!|1x2R2cCSzf(3IMmHc5ewn!Yg(aOyXm0mo@f zX6(PdeKkgp!xZf(n>l2oXTOrkJ5T>?`kN%?ssV{cv~Wk!z%m2z&K=)8Q^C8Z0RA9) znVh}}WyaET4O&z#vLn_RbFsnl(gW~65tF`-Q;nVmw0(TdIp{iFmlw@`qlTzn*4FA~ zLeg!YAxOG`&i{jS^J7sdWR1reQZduH6J@AITKtR|w#Op8nYvrif~X0J`yef*=6+~f zCAj}cf_{D9C=-=|t_#%p1e4mw_-2Blm~m%cMYUj9kJpFF(B=AbGav(lPoZSu|Fd#) zHV#v1z9wO-xqlt~Zu~nMj$g`hJIYA?ClV_P2!3}L>#94ew&kmp$)#8}!6!Uo^adoQ zn+~RydSxC+izO1a_LFKuBaVj7H*{; zhOO_$2xX1b`^;>u#Em`_Y;^r@1rsMkFb||-?N(jqA1NanOotxiBP9WUWP|zi4;>i7 z-nwV|(o%FE#G)x_PdE0O1o{jNJnF4Y+i0nxec5}p_}+tjb;=dpB6Al84CbItD@4Ic zV;yn@|4!+z01jQ}vA-wghbl5nJVwWBixdCc1{W(4lQ#2_y>bLA#n$Smz8OgC(S#!W zeN~K`iCiU%j$7B@`=Z2Y&9`jU@YX~;sfS1dfsFUj*)Wmwm7UO2$9AKqG?fxH$vzOr zz%jQCOr`5GAIBDS92LG zko;wHkFlzd5X3{|IjJyNpcUdi$U+s>O@%)e_T%}Qe32TN ztm^HeM;u@hZ-89Pu9f#o6`*UXdv$ON6f;{_ft=$It7@`b&fSFqVa*sK$TRZ3r)Q}S zeDAgcp4mal=hqwN?i3;DKkhZeIFQifr>eGB+J8uiUmoZC)Y~`5svta z!`rKB@m!x5@eTM-x^IE_IZ_fn3;gvIDh3z&u>tgl0b0()+hxGJZtv^&iN>85@No!? z=%^U}3GOgRjDy7C$iQ|n49U}VKIsrjJ}4f9e7Ui1z&gEuT*DLiHyaMC! zc#R@7q7K3-MKRySS>$RZu{5t}1&g+RN?a!lm6}U985L+l$+xb-Xe;g*3&>UR*`n|l z9uJjS9_;*9BJC!l@z{cH=dS0DG_)Vh}Mw;fHHh=Xr8|Aq6s*rVf-((6;1%FYvjGM}%vmZNugZ<&>!cnk zwdQtmJIb|?HRhsJw#>pjul`PMnRZuOm_FV@&pZ=?mT*J{rDXaBxGd%`Rr6Vz9v#s;M<~CQ((M^FY*zulnBdbILvt* zcz)YoAnUPpE?Diju$#Ch^nEDb z7nf&8bQ>Cl)l=YJTS@9q%s;o5*f6*M{g)%yln-&{^8lpq22abg+MIdxPC&wR!9;mP zhKYET$>z**k!JBFXw9YL*d0G#)k8$SXE-a|E}W^zak)_8a$3)FQ(P?aTs34b<;N_o zYfeIMA23ojP$4rB_bZic?xJ zERX+^fECPA9C*iQ@+h4GwdMz<){p&v#?P~WF>6f!e^q#*@)(+lgnAm8)HUz9`P;pZ zj+Op2WsLV*;f>KDZD*XSltRt5>P1&|JOD(Q;JrNmqhy3~w?-X7!@|$lnw7T+O8-7v zl)`l++sDrD%*W5jW>s9t>Z=}*u~i&CSf@~1@tQdn)dV}d07AMF04?NRi<-9``6qhX zcEKrz-HX!Bv4c#80>S;E92LJsNh*H@4@pc4ViG5eD)(qsQu}sI@wdETBs%Sca%~ec z33j)Qhq&i-wA$a{Wag?L~m( zp$O+#Gmw2D5KPyHebe;xg9*5fEu@6GO6}F%UsNXj_4+EyRfuVigzAn+XsPR%sy{Rz zUda}Up;-cQLSUOO)Ws!#gfTuo1XPOyM~*k9wN!Gt1vU6+Fs9(DgS+-3VMO3qA>m;@ zM>VHKH6&``b7^&!7{?ktBh@#xB8&oD=JISbT?9ScND>m*K1%{T-ek$U?b$&A3U5c?DXCxSZdR^R_)?p5PyYy2rq4S3}uZ*sXKB|4(u}?8P0;#D|NqY z(R%|#eTlXxKNwSV6+RN)1kUqNI4AwD^C~^jiL3rK^s(dF($p( zsE*!*#GwY+${n9wx+dXsA9JYVAU02XtI9;U>X(60c;LO&l#d;7{B$ZLVpWakpz+^=DA&i(fp^NyW>r0Ct^n;TS>h zmH*07CsT{E{A1ILR@&1*1#!f)C$&tK@STY{hjfUM39*f=UJH>>E5#nX3@9t{x%OWE zH&tqqf5lpO4Qu<$(@=3Bkkk!{K*R%ayO4O}|H|D`NAJ%g&cv=o*jL9xIvutz*8_`w z)|_X+wAxVsRjDI42xuJWJLd(5Y-X&^R|2RD)|9v)93Ru+g7-(2-G_%3JRxHLCdb=j zzL0bnr@k6AdKWt}NQgEXUG?E26mznkn;fi3&=%{7CE}f2=j_hVM@VeWE^k8dp?(dC z#44vpgGG%cvJwP_uyxzvww-%!;Bsv1wOoD{ch1b>$Ejz%}2HEVRAnxBWT z^*$EdP3xo3EotcglM&hePqpu=#c@FXQT5$Py3pCIcdhV@dqaA&baC1mNE=dP?8d8y z1$3_%Cm${~NeA*C7C|y%TLpXT4EujzG+ZlpM%PHV+}DYrwFHO10-vD#t5z}KYO5Jc zG(u@!ABgIS`>ZZH&3`bbfB2j%4UvH9L{2@uWX~F)o0x5!xAgVAt&0Cbn|16(Tt(85 z!9@72gSQpxTgAHTEojoDjy5at6Y#8L4=$~~UwX1aabs657~iV;_jw|i(dFwuH|iER z6pz1U-xb&ub#0;@F4h5n2u_}kPxUlat7Wy30bU%8nf1yMHzIzpKva-VEDjhGM!MJ* zYOAOswcm9)m^RS358#zXfrqk2e=Os5n2w$+1=lt`etRAl`ijPsEttG2`9_uH&BT!G zEFIbfY-=MzvpuzhY9Qm(*ba&9(Nh;b|Kjke&oSO#?m`kr=N)6edB&r>#}I%@4cTyy z7iC>_FyLye+S0l#%n$@&3HYgolv2x{sC95aa>lWf06@_@e2YWacEClEwu#}G*d$DB|F{vpXwj-0V8jLSv)qraSCfDvAJWh{ zoSjBRY=?~-&{5p=|4n$c|H<4Y6<%O4H|C+OhjDK{3BPQiNtn+f+~Y__WKG>(!$GKU z#2Rlp{4^_&k5<^TS~wjhshPa&E#Rr)*fPfZaj{lqjJ}Wz-*x@hZTScK$dztkW(D<{aSQAj;Db7uj6t~;aZ?h|>&OTUd_y@A@<}*4`Zcf^^PqxOpP`ab z&>4qqUNDA`L@IttCl9Z3f2T8*>6-zPQoRj4H+vvGN3=yj>*UbSLtN7ZMsdX#h*#PjbjXLiL0`A|JoS?LyFVU<0V~%G~MFggt#jC z@;5~}ZqbbnpV>_b>ebOf=`6_=D{6C8v^d>*d$*TBA^B``4 zd~Nz*9)S-vRY;l6#}q%m!W~FA#Fsd<5<2Z{)i4rqK$hVMa6;R(n~l~h2j8VFi(`F3 z`}oCSe%T-t{WHI8^{aK=WHeTDT1hU~#$$uU;j52o%;YfLLJ&vRT92dfA}c>&sNsdf zF}27wB3B#>$jpAsl-|}ei9n}_f~?71d)cQoI!GXzq|OdayGnTx+&-%Uzccteb|3e) zMEMWGztpnmk9(aC{(U~n?M=&^tzZ~OEPc)xnc1J-GckFtEXaj_*yaWSdC|uaFK-C- zrPfgd+#3yyGzx+TQzx=3bvP3L#;R9=3y|Wo%ib?HR2LwP{%^I&I zm#~+u^VR5+56K-0I^pd!S-n;L1zI~IX7esRB<0zs$Lt>-5FqM1P%q^H?7V_%ZgG^D zpDqbCpkLC?PH*={e4ucS119a&$P;kmyk$}z=g;5Q)+1?&Qt$n69F?~{^GR!Kpr0K> z76dY-+ltx6TWKL+ZTtE7uh;q;nq1k}QkE?6wu7Nxaag|;d&9rn0l{hQr)e0_o%Fdi zsLk5vlvfV}hEMg~B40 z((W#(8kse));?;GCDd8ZEt%3^LT^pn%N}8~;2|O9LaXy~>|rD!upoH}=Mvs&4z5W! z6X#M(wALCK0wOfe0YF*dLp!4Wg3}PlnR3b2$D!&7MV|1f3@9_rp~{Tr>)w9Mf^xC{ z=BPz{aY$!?4LlTvr4qX_NiN&Lp}(DTn1Y`4u&OI!#7FlmZ1#I}WhZS%1Xp$wVZAuv z6fm~vM*c~658YoowlyS+oni|TUnz&IOvrIc=T0%`)q5gy#X1s(&bL; zNx;3_vWjoSTqSUx0b9SE$^w#Xa|rmz4>1*#3b^+wl)sU%9dLL`4$mZ9IOILYsIY#T zwlR|-5t`PSn_PI*qrD!vLa{2PrkdhF6%ub%S{VNIpP8%7t~Rv~zyx_E@k>odl(NGG zV-hU;1XWex0u%2!e-0^8#?669zM^h?2O@2PDuvB8NTEG&PEFUaNu1p6C92k`8vSjx zj=vIOaV&auOTVkhwgD7bea$# zfc~qvsA*xp>7%Beg|!%dI<*PjcRJvXaI~p)W^(O`O>Jo5W0t0z=`E*P7sFhqg8Snh zBZ;4_gmyYhwn~_AT`Mrtv&~+kcW2ukHnND&it(&PyTVk!&QLz6%u3dFCkPMeM>&=> ze>BPG86~;}$0A#IH0a-9l$(g2mA-gtCcNz@(7F?Z zVFy}7iMBbuBuFPYLpUq_02+UMUI+X7u@qfz-b+Ca!259WgvC|$B3oHwDu_mgjkYEd z(tLu&_=dP>nx?c+-b!U1qX@$aEq`6FxA_bp<1kJZDv3=|GC@;wy@xA$TkQoYj|{T7 z2Qh!R7FbZj$8-iU7!oyLtRp*?4ClHq!^XANq7YkC%4L101A8yZ?IQM$J)P-m)gDr4 z{(h&QCQgGIBJnA2WjHtE(on0GZ}Z0FDR6+zA1?*3m5>w9O$7m7XZFz+US~OJO)YV< z_;O=#FQApZtA(pk;QabinRxqDGa85FN40M&bups4ELW@nBZ6e#J+T}RMlurU``f(s zK-2Is{;&iHrx8BLCjup>US%?4l>N)R#^w_@));)j{Sxc17+o1sPiR`j;Ms?Jda2Ai z4a@g&xObLq_hc6Ab{_sX(PrT_n_-Gx7a}Ljl+tb67+8r*ITOLcQ*^gnr#)o*1#}PZ z?qR$LU^1+o9q0%gFlawiIc6k9?wZ6O=c(oUM7;YQIBo4gbt(f-Mw~!Mq~?Us0MIUj zSAyZuy#kAXVW=(6hhkb$Q%i9MiZutqXlMx&J+v8DB$g$~Yz`}DVW?CgXWloZ0{{>Y zIE;e}nhh|bY6dCB*l@|Z*Ac!XMWKBE`W|4?6`ylLbLb5j{LqXQ3Zx9TZ$5L0!vK<(t zh{C(aOCPq--RRv({g_$(6cLGq%32#OGAf(Z)(R4~o75|Lj`y&lmC*PRJmtVLa4u{z z5?s-YGMm?5{QLyaPBvj;q93A&eYF1eD$BO}n4} zLX96L_Qfp#cr9Qy+EH@(p_V_}#~ctMH8}E#B$K@OX4wrcP^OwtCnn*@Epm-EcT?E=b0Ez<&jHpk)i{>vSN!Wq!jsf#g6k!Q~hrUBEEH!pFIn{oLZvq_-a znu_;w&rIfR8y{U^f9c*@8iIP}A-GOUp;8~2iwR#w`VZsOc>|ROm8I$R8J9l|>;rpz z3Oi#?KwQm|JU<>iPH)D7JReDO4IWwVn;Z>5ZK-6Lq!3Gx9F^chTHM%FnAbSDi?M5P zCK=2j)|$-U+iZq7Yo0xL%s&hTx`5kb6ko1@kpB*NE54+I@-Jc`0XLpg<-6na43yFT zX+0XoGquPadq3Q`-nsupw;6!Q+9rndI7B@hj(pj_@U^Ifba9k>GLz8O;RHB{+o%*| zI8TBe9W|3WVguTb?Y?iLz)@SK)G5)=XP!hBUj}-_q~65;L9?KN`YcC?qJE%o%`SX8szN(YB#4|_!ifGq$9vFRS9u3v9_OI(tW`VX14Te^~&z0Mk&QwlY3Syv=I-ML+=cR{g(gitIJ0;es0)8WrdXoxDgj zwqjBZ%3=z;D}vjUyU{5|58e*(pQ81zPPrX#8Iond!c4EurV8D4lalbOkyj@^4P#(C z?T%+H1?8$=(*ll7tV)#f)6?A|#%dzi!nauAm~s%IpCTzCiWMtBxyzcZfP@k7OfLXJ z+^C=6M*{6@s1|KZ8MAkfk>jj|>lOjXsl}BumbqP8a-romsBf(jzzN@1UtT06DER|= z{?67?^^L0Pwwr?j(mtP8O(R?isztWOv7W*5kFc0;*PbJ2XHDe`&z7E@@WWVZ|vs7Q3l6^)qAn z$x7#fTd68*E=G&;ciQ}0G$Vc##;&!MK7G7~(WED<1>jP;Ia*u+9L>r5AFK8&23{WA z;O;C2EvA*Stoj`s<~&!tS-f6^T9VkL+pqOn6oh9Qln~lEoCJ;$^%!+@x_GaclBS@+{Q6EE)0g6 zh;#(S$QGb>gWkAHFWXjb`o~dm$OPHw8H zz6uIU=i7|NG^%J?&V%iR2MW`We%uImw`%a=LET$*sd&St^e4}!k0St}4s|d4g+!vJ zL#39QXjSSUgSb^&rDq%h6)TC_HX+A|M$UW7kxfOC*;R$m<$Em8Qi4!)bc|7?Jrk7BBgzEo9AKx9ebNkPJSaL${77HjJ zD6@We&zT$wQ>@J318||=|Lv!vw`iuq<07xnmlXmU(Sz(_zvrG zA{q2p!;_!TbB19~!*lj9-5WzlbXCzYX-AiHC<%K}(~%lGrDL+VdX#MvEEuw$oi!|bQSZMB zRH3~gRlwp%REC@1HX1eg+gc(`jaK{#a*wrV^ ze>@hkNIf)8T$|qo{j>iVmz0>(&D)8GxRwZd_VA#=?<HspL wDYutnJvgZO?pT+qP}nwr$(CZQHhO?th;bIJGOCo9z!|_wSfG|Eb)=60?}0&SW>f4n?Tt0bYCBJ8%CitR*g&yUg?ShrIV-NbfAK^e^nM z37`8n<)!KV>5Kjy{s9k6*Yc(Bo9#XCjxUmZ=~M54d+y`p)$Y#k@UQMK?vLfS?t%VI z@4yea&&==C>*+h}neT~5z(?W7>&xzP?QQQl@5=Z0AbLMe=hyD1@0;)H?6q!*3q$624LIv5(xZ-6y~g=f9Y;ueU3^*Sx-zlGbJ&#}Mq#a;md(nm-@`gn0j??8U3V#C+B}2ByP{I+$4X#79#(`K9*^{%csK=?d{LmDRXqv2 zbPesF6+(dgrRFOB-28V=!fPp7U!qP&=-)y1WqfcW`DBR^F4ulkqOKxc%qUUCDP2YIxbERk zRO-%?!`vGl(wif&(nl@O-pa5Qv~VLuk889$RzRXknT??e$S((?9lRsa_KMK9VA7so zjloGRW*jqAK`zI1%13EtQwQQr3!^}?0*+-q{8D8Bx&I38x>T}S@J`>fd}D^`-Z=4Z zXbF7KZ3eAz@eh8wxmB|03ki`NkMbw_Y7_E70=MLpG@txehQ{nkF!JOa#p%|7=tHjo z3)>kk$$DX0p%9$F6ocedg)>Rxi$Lq8$mfMR9R+FvtFS{$pdLZED0&6Jf=M~Sh&6Cq zwlJ)q$<9Hkj1~-^x<=)Tv*h2KuK}rP;T2~=gHRd*GYx7L;;Nr25m;l-!on!e`?S>t zP5pm`>gOtk$OYFQRn?6@jOL;Gnwt@i>C`o1{UxJB{KG`1M@6`MjQma_iTam4!lulN z-Sfn6V)}MwavI5eyg2l)&zS7U#{T;h*j&X+j44Z6a*`GKZdYXEax;EEac1dCG((dB%TCdaf2Scov1p9W?M+oxvlU@H|}Zy52`!#TKx4hnE{IUxDgW&p=$i9UlVTz?vF9)5y?f?I{cVL zK$E>;4l762sEn$hQ^nV{Gm(i3c*3gVH+d=$5)f*Q&qUTED*T|HAyv)AV1#1|g-mtC z$t$$}Ft+`gc(P*6`)t5U0Do^i`_@2dc{VW~D&znGqm?dm4w37GdQ z9LphAAL$UAL&Y>^GI7|+?t~vfcz+EQcE^UQ+Y2aI=dLu>KfkK2$DIHjrWW>sbQq;{ zBsnIrDzC}lAHk9f~tl23m zKS_C(>g<}@y!jJMI$lU)gQw#CA{@2+_K99@!}1;w~CYJ~CWX2&&f!4l`KwE(V+vXL>Q&WPO6gRQw%UN#u> zBTx6oaci~PUc1iYEb%@Hrj9c|^$VPYux3Z6*6btdU^+@sXZgs;aVP?Vxzcg&83~Gc zhHg9)#P2c+2om0C(&}~-zLh0|9u@~gOOu$zuf1?dF2_!rH#x__%q`gWR{Yh|+@Zzsl8NB+pK`FS=D%hQ(&jH6 z>%?D=`a{5Orp{1^z34Ogcy{MtL%~KHa0@(>kL9weO3zC$^n~oHo9A{ES`qd4BsOYn zyZUr*lBr;^^fm$%bh8HJowPEJP*>pn@Het7h)abBb7Pn&Cj6o?Yv6ux9oM7n)KYQ= zC73Td(`0u|-&!17DDu z->5uEhkWG4I^43k57L`qUZY#}efV4neZ+epCiz`>8u)V|iaOd18bIog!Rz*(?muna z(}WRwbe~uvvPP_F&WiS?L7og_9-;gHeVNHx-XELnqF{0^=l5i@ik!=xTE;l)%8_(U zv1+p&SbvV-rHp^7@MTm=%YxSsJoaLP4Cs|MDpb516*KaV=_^3P^#fRCO(k#9ak z|Cp_poexN1uYAm$!-KHPv46LTSm3y(6sm-E(IC;avqdq8HOf%*Lh^jkM!ru(FY}t} zmi1@h)1m^i1Pr=E2FE`2JoKmHLyqPF=s=s4$~JUqz7|J$0M0HqW8O1_5H!eurgGpF zyA@5r@zW)EdwJqbsO}D|o86y4=a5KVNHJe}LOw_{oZOC1VAw_)s-aK)k8p@MbTG5_ z(3~{G-ZH8Ay2SmJefC*h=kAG7O^_Z__8Q5B|9{`-TJ>hJ7VZcj1zkuzXC>29SXHfr9V}&Y=opQ|?UBl@IJ(gvu(VmK(y25~vv}d1L?<(p-4flk zMwG^*<-1bc>~ucE?ph>_V;$r(@4pA5ZG=+)BW_D}3b1W2nr*Or`8t1&--QiIsu1;& zzi3INFf_R2dU3A6xN-@ksG7s{D@oZ{l4aE#`N|5Vh4**+hzuDvj9u450kxRl5H)t4ZOYtT~xZjE&@2rpzK4&FLg*dE__P*cx-ndXAN!8he;ZVITil^S? z9suzV(Fh}B2dxPvCKK_trO}j|AAP)-_(i3fN z6}~t(gAAM*d(lKSqgy)n&MuXaD-<8a=LZpap9xJu~1ZD!VRVnT7=PZKe zm!&I?eL*Gm4Nym~iK)eF<3|wp$$}B#d!P_}-pF!@7@3v(p0+O*_z5JqT{BK>HX9{F z#QxQzN`7`vr7mLkN?$%%Il6N|pkeGC?Dq`LB-G@~!jgs=I8e4#+rkWGL=5u3Xg4Zi z52{O54hX`~_p52cxebkn-P(H#Fr0wVzg(i;F9j0xJcfQvb3}l}RLQ=ki0H7X%W3;t zZ#xKv(+9(}aIBxEEvpOdKdjas$+$!Q`t~7~t#z*71`$iLyViSnGoH=a7cVlQ`3(N} zP4@II z-hB#0+Egk^AElUiGph{Qo0^zzT8bH^YerLIj8N0BXH@_gN+Oppn^|GWs^+Ec3}yht z;3re#2$I0%s_$OL2UO;<2Tb$|u($41bn>V-PW$w8lZ*}Wgq6wM(fCo$wN9_c`LpWHQ^Ito_qDcy<(jCU~{xW ziaKCpBf4_$LX_}*UA(WQln7{R4>WB*EflS`e7`DzIY8atBm;6JL6n5QT=AJ_%;0$D z$<^y*D7fu#UCUbke`YoRCq4w<5Agf9gZ3X61pww`@Igz?rh4QKDe$!y^R5Z3ismrl zz%PST+w6Xl`3i zu#SE{it%NCVQSKZ-wMy%^qzM*EnDf{8b00{xnlZ`M+)9>g5eEsU_r!P5>Ex8;$3WpMe7T=b*BJmz zht(C(LURgFb06BHZ*7Z$hm&k+WO=P(j!|e4_f{u&7_}Q%D#X;zf z8dI`1QW=RWFGlOpH|q_NI`A-)n{JsrJe9G9^8G4Ooo6CpC3h1Ae!F)Q@Y;DZhEu;l z+JhreR8S^Fz4gUSwHC}MM51U*iiWW8{|Y}>yq-fG0MrCtAoCWBoLyujZYWdFcr>IJ zxlT}?r9DO$T_*r3wqnxynk#r5Puer1|D)}CJ?2bge|sk#&~fzy$4Oi@q2zg?y>aGE z{f64GG<1$Dp4JRepr!d+B(9&GF%I{Yhp2MJK6fPU4!+xTH*dU(K65UU$Mj$|dJQV& zbi_OvEX3?+k*?X4TUEKdrM)URYvNVX2&RcjQMSZS@vRMA3VK`Rnj}Q(K6U0aF$e_S z0z1FE?~Ioi{h6K=DDMo?;uL}bDfD+bIU{a)4NvjR?-0xC-!yXYY{T-QPpWb&6$GyZ zFPi8i7m!#ie?ia`oGc#X?(ooMPOlo!aD&q2*&_ z?Wc&gj#PT!1!Xu__!7Y>yl9fzZsakl3XH@l-YK@Vxo=xcW8u2$pM@qyCXKdy zD2FETPhMD0m~E6}L??%m6emMmKUq5#bAU)PLpdla|-rO;6c(lz4uS}#^U@Lk#3EjZU_7{Q82!-y@kzyOzQP!z{g z<0ZtQ?WdO%xj(Vj~S@b`khd;(~53pbPHi~ z!|av-c0%YM0t}F(lB+bA&j{?i2o3|h9d5~y7J7;*iZ4M*B&^zR2r@05Ji5+(UC9@$= zig7I;?MhyTR&Di>DGyHxCx;9{H5i(Kl^ZupNjj75V+Ay*W;@*GnKJZe&0-)VkXAA< zquE5SJu4n5)E=c9ci5Oy;wWw<=7*kq-};ihZ2ON}{=8q~gH8?J)gVrlS(w#GIs8j< z@H2WSKMTb%AAf$@mtfU5K%#RhD(YrL%z4}=yRH9*o?9wA1$ZKE@xX&aY@2Yv2#-fw z260Au>P@4XCMl3plF|JD@ukpMexp|KG-b&vHtKM$NaKhOv`MQ?&C?9-Z(a|*bG>y7 z>W?yIYboIdYBrfnYxmD3Xb9CXZQWN8bbSkC=ywQUp0ADTRG7H&NT6_S!4F< zP}W}K!6QhNn-ut;@u7^x&h_t|9pQ>XvU~?BC|9e~TqGs{)z3YAD?=Pdk z@DP%6@C$W@o@`5JG$3uFPC&)rd$G}^vYt%OJI*zr1UQIEafv*GFNjKObOF-NY!H(w zcygza$qp%7yvg9(4$4ui@?gTQ=x%n5Gfn}^auHcM0Wy=2o3LrRMUW4oKzPN-);au1w)=$Rtkx_ck!{qx$Ggmi zXWl@DqK{pl$XQ@xHGftSMD)H)!ECGmM76ry?!vRik>-H*Lsh24oYu>j)i!_!{^JW& zXy%@~3#2K?swsnEq~T&WAK@!TuprsXSy=K<&kcdO^> zJC3-!!{ZcqM(6v4!)7lcG-kur9f(`)BMbvWy>LhQ?bPKNoE8&vccP*Fm~bWx`O|TB zE}I=Ol?WJa3Vsp?S9#L)H&Y9Kz5+;0M|BSNdY8JWYWD@K=LV4ObR`8uAtd#oz~7A> z@wbSbAp#h|HyT=yK&z5X$jiJLM$O6viANDu9f4IHN=szTW87eg>MOGHJF~|xXPK;U z@qDWR)+;Re9*6Hclr`XG674-u!3SLwB>(DCGiSn;4#U9k+C^;`3&tL&Fy$R~ zR0WSP*sDdQsS9ZxIGo<;Iww{tnD^EkBh zij9m}aqc=R2GEr$%bY6WA?+#~&v5%G995(P^JlW1+~4^KqZpvH&ICFrQ-?0-QT=&y z1^LfR<2Q=cs_^{R;{#JUk~{slVsLx*{`SicZa<1^@+EM4yD<#3&_5sSa7e%9(C@Uh z$mv!7+qAib*(t{J77oX;EEzH(Yz6t>-TNS%i*hH~Ubxs0-Rz6>SE1FE$#2WH(F?~*?ilBzyL z^BCcom2hDdd~NGKgf~qhHot4gnjo>F9CljI>Aw@A%gx%u*-e^ z9^u3)5Mg`)2EMyt-l^7|=gzO5`8)#dTJ!CHv#nhU4JVnPFd9wjVC4gFBBbz#VNNWa zuuui=MugFNW70G_O%pk=E5W1mxG&b7XIS8M^-R(RS)Wx@lwDJUaxAE$=|9nIs$A7qw5+RY;|_{wBr@!V#r}k-aO1(4 z)V;_M>$x@snG!7h+1wU z1=iI3+d*us@j(UyKrMKlo3WO}dt*se72qHiTxz5yUvnQ7v%+*ifs_@uRl$LD1gf=?xn7vehJIM`fWG9Mh&|ZgGl+QPqdO`8yt}o$@wSj3D32 z^1xDq<7OOPXPFZ;A(yl3J+P+NyGPg5W%Hw>s8G@>L)L2l22Xh!Q zjkC+0xnaz`HK80+p}3MbF%)CVtf|v)&QzPS{Fgyb?Y+(7^^Szc!id6a1Px~srsMEo zEaAE5PN3bQYOBM0fSOghN(NQh)HP89e?24iG-%%qKt*SqxL!U}^l-7RorF@X(iuIh$2)xM_Dh9{FqTq#(7mypQbWz#(8}H!eb8F!6%A z9yRgnL#6MrsGdElmqMVaj%8oUq<>^-Y|SM?MfrFZnL5Z*8M_&uQFOn@)4m_Y$%A9# z#k7_07`6Ivp`Ban<)|8dQRxA?iBu+?l8$Yu&@zs|Fi=cOLrTHCfod}f+4Hc#r0n5-M$nHfBCylzSM6> zpzg1*d$&=i87X5ZEwAEsC$i@&#b!aAsheYqcq0}e;?Yyo)-jY^{XqE=fgZb$MW}V+ z+3>DRfLGXfhvrVEc`Bis3_aTR6D16%7Z9kA9p)D6z>aCXXjxGPiimvb`hGngoHx>9 z`vMuGjj!t_4$9`kKh{_s;4`_nK@47IfGnkCt=^C=C5|+tYZeuhU)+ov7*r0&5qmjm z&VQHvSJDmW82&^c@#LK`KqVjKFV2{R=apJ3TV zS!HADHR7>hg9CTsoRJ6DT* z&o=@zc<>M8Pc{NuhQRt{Wk(X^6k|+22+Qph25w^0s3-T@qYsqmwSZyxQwat!SivNI z3=NBjsJKV#gL6sN0^pI{DoK=xu|7DF+R10|+^jl5r7H+v4tq5Z(acixnRP!U$Wrw# za>LWPaiYH`$E&lrY3;X=DnU~^P-Q{f(8tjZXqGB0@WfzPlBAWlqkEBErr~SVNNd^o zF4;L>(Mh&PS1pR4`{XM7ZYDHnYfy8?-qFM;-*-*0{?=b(_rCQfYn(*Ac5n>;1pU)U zdk6>Q|C~JfD%w#EK?)^N1wVZ$M#))~wo-2gbAwR}t(#dkkPb*R3z+qz;u~!j^(mxE zyiIkbOE;_h>OB{>@w`@cdl4#Tw-#$6i+!@$GQlAljb^_3$q&sbp&nAY38s$C=+4}T zhYP5;I}_rEM1$=a?+H?!SCURF#g%N}F-pGhd4wF<7iBme-0SL`?>-%$9%MHsD{<$CS^j%tn=Iq8IpBr!}X>ORDuUsJm=E3O2m1``63>5F%t#E6`W|-tFUmHm-N0@fojcGb*@TZWq&) zTk0cNy;5xHuCSoY_%=F~T4o(lCh$7tD`m9v4a;jnw%hbUrmh>N_APImooD2J+hS|X zkxVEQ55&{K2yHF!{N=PAC>no6fi!-UtHn!v#GTI)>d&{uM}1~ zffz5P?g~M}2V)PcL(c;FCcl77wWxCZ{zl%GBdsmd;b4bbH6^!2qa!uZrYE3vJMFXm z-WWy*FKsrh;en}{W~gB(O7YT2P2o788+tUd0Bp)2uTIsZg9Vq`!Oom`-GISBUv)k@ zv5hrSnNf3Lg0scE;P_imv^<)GGTKD#A(7j*MZDH#gPG4w1Qyg#lZ%nYUv}7<+!Zq# zE(Xf(qc7hgO8CWpLtwx++du`B`>QwJCttDVB4!~zs}|nDxm(^iGGrd}@o^7DP1h9% zBCV^cBwgc|g)<*7kYv+CL*(-V4)1u*AY?L2=uEqkYW~__m_cc_!vDGP?;(ZXUQaN^ zsEusz2)q!D#Q%75J>fd$DDdef3;5@!}Hfk`74{5`tfUdKGZ_hSps--tFQkqKUa6U^K6zMA8qiR9OBSH|`L8+hd zHaZR7w^3p!OD--iq!cY)p*I5K+2Cn>8Zga}WwkB5{Ur6JkJ%TBb)Cf~O*hd=923{3 zi$X1jJ3>j4j7i@G@gj`(F;8>FhD*tYxr zolFtV?HR%Pk&H(ygy{f29*`y@fAg>#yS;NTBkq?E9N~+gEo>@;Ln5dsl-ymmPS1`} zsjvEKPZnLJcCE05A@4A9Gz`RCYrQe01usxSg5>K&Tb;9WbjUu@X1kavWy`?AlriZj zlbm6siYQhX<~S&N)!OYm+FRdjBl|=W0v?@ZO>(e(-XUm+ga6ZS1+Gf_2d@Abrm*E2S`MnpnS$ydTFK64Sb(! zKkRKUQ8?vmD7kn{{(>E@@v$h5yuiVp%q+y8AI`KEq4e&|for&swXoR8#G z(4ibL2faT);bEzZeBC#$u}^^$bM;4}p(;WCn8(r6yxSAGbwc$tCh#TP+I(ijOCpWg zdoi0G-)>rSw#>0!!Zm+c`?*-GX>V2gLtejY#OfK;&O6;anP;-6fKch`;-Nn1Xl9>R zE={|MGyup`r38vVU;=AG*khK&S6yV1R9$)&7+>1c6 zvUw#`L)V%2O~E{d@N*mn_BeE5m6WVMON9Ei#98Yp#c}Er&Xe#t|4c(B>g26Ic>pek zkP=t1-}l_)q7qx15h-Tyw@>1@ulU?I%THgcg33hl=E{5|@Z@Y89g;6glgHJ*zX2-a zJOx_**7!@!#J0RHrVf4WitM>~-j3P<#UC5hCnF!?|AsRZL2Li? zFtLU!s^?{ofuFq}$;gEmWEw+R&zpnJ)Sqw_fQf5%XTGH^*nP<}RzQjWzXN zfOOZg2TU}EPDuA@i7OVFmM9{xB>_&Y>I4@+%s%PpKvAO&S%G=_%X4U_UvzA^OagbX zFt8v=eAH7<{6_rdd=B!B?I3_0p+Fc!@NhR7|X zu_Pxl?D&tbP|`6$1)QuDC98iQVY^PU`VO}Li6jNa;-)0N253TJUVd+V)1Vh^qcrKHwV~KERa7U~{)mvm&Ey#6WDV5Ms0d@dI*CAc1Ou`qbAzsoc2*0f6 zL$oxdcfj`P4Ud^JCDNIRnOg|)*7NDxQw*um9&DQ5=lZ^(?oCOPL76xYLI`L6t4rJQM=$R=ewxk@I}2>0xb(W z5`?b0r8^xup<@tgBhavCYeEG0dFrrevZRu+Sy%o1JFp9Ukp9XdO;<+n+zy!uiy?@< zRYU)z*1umhIFKnN-)=)vE7Vd-!2<-q{|tVZgV~L|>Gi1yW-fTpp&w~rYsG%zSX?tv z##*8rX&FmyfWu3-aG{8#b}2nVuwf&ftFfFCMuGTjICnRX5ds0do559HIJ z5I|4*vfbOP{qRfHnfWR}R1aFrbs%5=J$KX51PuX(kmno8{B^Up3;8}v;aQ*+FGK{=ZCna1TcCRX!GGX72tXhij`w8d6) zoELdKI5qNB|BBC`C~lLQj(tDogVlDNquY5Ua~Vc>lQ0Fz4yM-XBg}q(Hhloq?|U4! zjQ~z{2GsrI7Jd=H6mn7X$lKL~x&~qri+>By-kWW-gpJ8VtgnvH*g`>1jIf8NR7vQnhJU{x3IrLKJVm!k# zG0ORIg#=xJ928eK-432is!@34@QG!Qbg2p@?6_nUK<%4M$fjTfClbA?j$Rpk(~k)f z^TXHhTmY6VyhvNVTI5RcBVIU-lxY2TG4t0ew*o$TfwJV;g3wv2boHn_uV`fRBxj{8 z7AUaVj9>o4AMvzm*ren_hZt$pPg=PAWH{jc+?x+Q>GGo0xe~yyetfzPbh$K;{-*si zh|^hFla6MOa`%gLFyY!3Jgoas%cUG?GW3zIUieGTdEqQNy5RE%WfPJed0|`)ak?GX z?$w|Cyl1_6p3?;cYDorr?Mb=;ojcGTuDlVRfV@hzFcQH~Q7A&a_ECfrll&W|Y4yoG zQzw$XcSg8&daWVsC2?B!gj<-uG5GCz3hz(fW{86b#xR=G{BRr13Bdo_?!oIlY6<3M zZPww&wYnhYG&4ltqqJl9OjCbh#E#&T9zN9am~LHl=iySm=^RCF-UFqWd(2U0kX5JJ>2jSnk|5W4$xQlyZKf#cC{OkA&-jUH9H+i1~NQ6k*Pr<_ zLsv_?*v6N-r|@vEUh4)fc*WkIv5s?#s<)d4wL1=>XiCBSOeJR^2rz%d!dHhQR=n!o}bDm@{IJT^jIw!cmh^A1D zte1%(Xp(|`%>_B&Q>m4AG7E?NIQt#1mm=VvwP>F$ebu=g4t(5%5Un`7zGufBK_GPC zM3sTqelRBV3x6^j@H|8amCl!^OM$fq3 zzQMoD@~7572zo)B5>OgBxF+%xApm~0knaMw++jgo(MwrEA%wd9X&`qVBA!XmG^<5s zaFrit39w+A=#I%$m)l5QNDfP_j)|0wD~#y#%k=$97LZ{$PFD4C$3!OT>EyYcGiL+} z2GOK-8CO9;pm(8`i8uyDhL&U|ia=!Mrv)0kY|4F$BsWboTZ6b=xN`U3k6W>#^1O$l%S$fbljOCu6nh*ktI zfM&GXedbFGa{iV8%n=gwBo;9_ZpDp+m?IU*9fX@=oI#4McA zpxHJ26C$K04#iv7_cLWILteIguUBMLk-Odx&AGDU<9`5F`WxIj)|l$9q~1~PTAkUZ zD^CA_KE-}0xFzMIQV)Z;w)7YrlX*X4^}prG;a)kbom_Ul)K!#hxLOAyhM_d@$HyUkjJ$YpNF_oncr z5-VOTm`Q{Z4R6?V{JfcXq3wssHx46Pyl^}=J5dONe^9bcNSJ9}<6jxwNrXXPC`bI( z$Y1_YOOf)?ihx{C?aeVBPgCTcj!vhd6>xtxfMK!Op-&W>(-_YL*n5_hSp?REN^432tpLNo53$A`1n3Se>i5Y~INnG{{fT9v0@MWpI#gFHEYobVZtW+WD`Ri*l4j zsYO9U1o7MQvB~V9f!iVn5$4r)bXl4z7f`qIHgMgE z{#drb0Z-qgIsj^0L4E4aRwU2O$pwnjM%iM4>+G99PsV9WCq!l)wxQU%W1(Sktmw04 zSe;(4Zc+t}s{j6?WT3y#oC6l_ln^5(g`TMQvbuCP0!oLHF&VeE&@`$nnOgzvutm8@ z$;ftqoU)xcwA&qV>>}PZ?Zk*SvrKME;#14=ds_OKSu6H)q1iHqNV0T^aVjV{xgh}{ z5a&h7zGNro3VSRZ?yLi#`@^`>Rf#H6h!cLe*MlYw$joTKPDItKGe=ltcyd8a5lbjr zF-v<{;STNGqYsY-^$>esFfW;5vwYPZ@X}lmd1DUgvEy1_-eTIB`MOBF;j;UdIKPn; zwF8<^a@={7lf>FWW!gxK4W-k@R|L)yGlioYMvxEOuRUC2aJl6jmpXQ!el+JyfB6cl zO=_d|s<;9VDf)?g1p0pkxq~1zk#!SF%Y+4GLfBsBycJTVFMs`ttk^i|6kq3qP^0!Q{K4(zfZ~ zwGvYP?Bw3bFpA>b%@{NA)S@Y*o+amZ*+K}JrlZ2+A4YX6%`KulxLWlilv&a2%Eg?* z8?|MmKy!MR-;-(luKO1yv2?^RTWF{4#1cx?WXLGZ?jj{?$uFg-DeUdTlRf%DcV^ntFGJ58qW0Npj zv`&eYs_%rDrw)c#@Xi`Ym+k>4Qu$?G-D?olhkmMrN2cNk*=)QaVbFr!NZypV#aqr8 zIf%CI-<-Fla@if7+yYX&Q!#1do@NfK2&u-d&VvM%Gn+t|U~yLxQ1H$Ss^YZK))#SWkz*1KmZ;1XJp z#A^)vg&SU2A|mt>mtVqriEv>i7DN$3&qAjs13?ZkQz|SVw!B3U(uxvqY)&-$w(B<2 zGvJwB_t4|hZ2tT4>g z;2aemfqdi0AWT4?qzqOYtQ1CE=}ns4g^{!$RmQT$$(^0S0U-;#FhjKGT1YXW4tqFa znvcWj)h!)PQmbRY@h_H2A$-Pt!tc@w8a4gI>7Av`<5*ynZAJ#H@8+=TG0_zFDa@Mn zdljW9r{t{LW=}zVRjgUUioIPLqWqC;b)Wcv4dRK*{kG9aS>DU)+~@4%&LQ(h)1T$< zGPF&ti%loVZqhyahaD+qh~;UgO-Ltzf8*m#9{Gr%mS$@9DrWpqQ(o^4Q4AN5@YIajxbaQOJTEz5u}yDMWbAeIc;i5{l)JSFmGo@*FAGey z!s8@$G!9=S()iKJtPJ6q=w#^Sv~Kc7lIwP)$8Q;n((Ty>AanGG71XJSNGl-MZXzdzXcc%c_pV*ey8VL{%~@_43MftwEIJ@nxyKRqa)|0z zRAvIbbvIBU#`syXAF}NPIWX$dsw`XHJIe}neT-%yJUYq<`2b}O97^V1(bd7|D&|Ip zNzTSwfdhE#`2l7h(Z>VkUbh?}AeH=FL^o3@+jA>vD!~Ec1!0ThhLz`hu`kDvgPyR~ z5_)n&o%kJAhVZ}-BDBTM0+68=`peg18jA@zE$$p4)@5=JYQ0IdE<{M;4a1K*CczW1 zu)S0q1`c1^n$@ABUPfb5UgZKMq>&?jq0{3n+`806%U`&tZma?hni8}l>MU-I zny5Ym#7Y-(xxjr(PqDazhEp~MnT0t{y#4-FuX?la3UuJTdzjX$!6QH`xrcg64Pm|m zf&3z6ee=2FqhfPU0X%wXxwgHNouWo3J%&H5{aXD z3`3ix$xr!O`oibRK~cw~8yN{Y;-U6PT5D-{a05<27RAW=nqt_@454FChK&{pU9+$~ zAV0t{yDeAokH=^71DhOt1GY#ZC}q@yQpe>Ln60MLU44`XsQaT;TKT^LdiHS3FLqqN zr<9-t2eb7=Yt_S)WZ&mF&u$jS@p-(4Ys4xB0C#nqOYO7QIg#ZIq3r!B#);Bp2}~y2 zIr*&-to-8K7KzuBkaE>Zf0sxFAhY-zdOvTV@??XtgVn(v_bP4eNe7L+O`;2s5l82Q z`k+^nYIPioK}CiAo+AqvzIFZ*AKp*N@Y;&^AIv(dxC302hG_TpN99)x~Oh#u%Yb1{DfdjLsyEqnWOGOfX@w<*dW(uQn=I10Je|K#->lvzl zWMj$Rx)*~5q)as#FW;GQ&Q@N2$&T|^SiKE94$+0EQz(oH<4??Rgw`#ruD=hs9AVIa zE!S=20RxJ>CcF~*(o2{hBqxLmhgwQc9H-BHuDvcgq}E-PDSb#jjQJuSfnOQ=Iq-!N zY+owZASrZU+FAV7!QvqI=+28@ti>QgC91LB;fFQ1+OB1s7B=ClU8W~E4#1V?18>#m z*@23WZ}^E3PZJA0Uy-UqUKGk^3v*^9-8xHMH$y^a53JRLqpY)ED*zA`*$$I~sI&3K zfQz#@*`oj*`I>?k9jx^fW~A`(6ab#v84nb`E+ND z?*}LPVC+JUqnh^J=J>Rkiw(H+Yif{#FDtc1vDAB$+ontb)78F(3XJ9((Za~D_~-aO z^jNj}$AdxN5FF|(j0MrGYOC*I?t<>$Sv|^EL-`(LG^``38}0!eqJ-9~&7s50E95*z z>erH*J2YW5%wDkdZ@;8I_kyL^g%DoGZX|hr_~Uy#o-w5SmoGvX5LqKTGg*pw9aNRP z!fb;foC$hZa}_cwIg)0zpq~$h0_I%m)Z}neoUo=cU*Z+3^P z5^MCD%BNoC(T_RD)k;X&sKbN>S4Xu{3%YupcpIhobe}iCWN_u>B`une~^N*)u#iS+F`B9q4l6IXpP^DKdzq#x+Lee6^$!{&-%5 z+xA5w-&dcZFttI80qV)IBXs_9CzXG_FK(u6deX8kx7fnj|I@n^B-%WDbF4KmS#zSw z>CVyc^F4qWHH|gEU?c1x+Ojz1qU#6yT)+|(AJhdFg(0MlqiL18PCH?t8+oMI(ZpT_ zunTe}(=R2M0fdojC|;?VX(q8d#d@~2=K8uyf^MBreBN9DmYY|(BLbxG!XR(XNB6tF z)9$APG^SK*>O$KaRWob!v&SK=&~fE!J+gk_0|-l zJrKpHqE9$Q0|X#GSO(>~5;)rJPtYw9v*;>|i0GU)*W|I*dc9|8p;?)p2Ek#{a!&ugHn!%^e z5Sd?ZgK?QHRBiz)qlPxM*iajB|7K^-CnD>NbL4ug@0xT*0M3OSWr~VgZB3VP$UGM1 zRhJb$p$SK^-@UQYmcBfS7FWL%NS zWtGCRC$u#x`)_6X?r3G)SkH|1x{KN##*bsD_Netld zx`^B}89=| z?|R#){p_Ar;2lO|XDprtrgxPH1{A$VeP;_Xi`dM8jO=+*iP0blbZRE#nrC4N|VS-Bu%F9qetor0>9ph2o~TbUo7TQ@$G9u;x0c9S%FQR8onf4NQN26IM=hyE*Gvb@i;$k4W}Z}c&hoWJs!L7R;l{hBx4p}{5#)kX8x*oLuX*&{}l0+ zQE>oEmxH@YaECAihr!)taJS$-xF@)V;O;QETd+WIcXxMp0>J{CxBI^Rs!yM~)u+0; z|Moq%Yug@b=U=_DeX1zv11`9)WcyapR%d24qkk3^oObf}N0Tzw(CaPiU(U;t(2NPQ zrKJDpC&{g?JF}Fg@6zuoTW0tmF8(;Re(x~aYPzfMC1n@c`!e#lu*W7-pAW^K*A)=F zV--Zfhs2sYpa&87`&<;>3UY%dK8e+zt6c3eH#^$ARhU*e0aYH!vg?8Q0_|o+$-W>Xvb?W2;3Y%ZY7QfHaSk>)mL-h84UiaG|~7 z^xiNaP7OO?Y4ZD=HrbouIRuMyMgQysNn{p)RGM$PIG%qRZ~IyJy-D-K+FWaZ$cYTs z@vCSGV1Xuh7Dh%LeSkD$)Ie$kgexQdXh>9?687zjnIB_&;4oXAJEdbK+I7IofY^gelLi60xP2k?F5 zO;_F?G09HqJ=7TIhkD?!7e>Wynz8yk+UIGrz;LBvglmR7go?YZ>u!Dvu^4xPc6Pa0 z_|q-DolIY07D0$>Om11}$}Z_-z|pPut$z5)cK=wjbFPwai;NqwikhJn$Eog#!(v6) z#j>@@Iw5(l%)I7GXRM;*%MQMZ>}&6CD!Dv)^iCvj_}#)WEpvU=CvRgA?}STLPU-eW z)-xNjYZHlRyuoX386Ea46FWDxC4RY_U=L07s*2QsUsb4bN7uy0llxEG)f8@#w-J{jFlp6EQ*5K%qbET4Fzl6 zitns=kWf)KJOsZZFgyYdXPdD$q*gr<3U>CzJxi_<(!XfHkPC7J8_vj|2R$03y2kkG z3VSkQJkl(?n~9kuPZ-q}Fz{NHp0TMm4lC3r^PSdUvk|Q~E<9^aGJO01F(^adzp84G zIb_Kb@me@@OQBl)^Sa%=_Bs4s=xAb#olU8KV3e!osX9}ba6g2 zUZjYq8htoy|8OcQ)qposgdwv;T}XTLpR!0L>2L+3l1*-mSh*W>=TI|dCE81V65|1R zg1!pFZ?k45bdp1=R3S|}1&81iq#_Yw*um$IDof?1^Ou4EzyBg)LDwvehv#~$Z;?tk zgX+{9S%mVJAbCjgraT!Yg#c{^dtL@N#wFjSxPAGksRVP;%<6&Fsv+V;dF_ZkWsV)wGd1e&=38#~;|5d)+w^LX-VrXo=bX4kpQB}40;^rxfKYAlG7qZe)$(VjhNhu1r4+@H{I zWcV57F2aC@zU}=Dx!5^YP)c4l9!1l)+YT)=dVV2Psn*?Mb_5_iteMR8=UJC(G`AQX z-us74ltMRi? zQiFh;MOewLmQ?yPQ_o>2Dc?xm*Vg2qGPk-z4{iaJ{L z8ATRXh)BUf&xj(zRG$jqq<+f7;-BSB%V@q~W*90L)Rfnhi98YRCfVw*yK~{picHRaDYRwwJlV=)fyW^{1tP(2sC&lQzvj|3 z?KlD>iyp;?Iy9#4({#O}>{SfV2QDAd=~|Iz8H_P`|FIWdA~)wiX=`4DeiuSZP@7gGsTllC;G z2R(avUupbtxEz^85|fdCTph!lQw-g=4I+^4NEYXABP^xdXpQY|)cVCZ|7makheFc6 zAhjZ69+}d%{6Uz%$^7q%0S!Q=O=7cghKd*&x`YRGp+-(j(iz@-=^mCD`7WI9OtCx} zD#r?xlly|#LX@3OED4oi{3epR%hXQdmA;PP02D6q&;f`o&{=_7qkS|)*s|DhyU346a z+cEXP=xIJ_X_V^T(tB+ZGjk*%!)L_YIbNc9TvVsE;{BMwHVM_ZNBLiaYC3{MS!0mT zAXJtbY|GWQBQForwBgktd``MqaEkvwsHP7*-fQpr>7AgrB{3zb9rBkSfc%5t_t6{W!K&%eG-^vMG@&hxvW6 z$W%6F?;9W7M~Qp(l1Dut4o{6Oo*Gcd!iZDZgK)kb%n_^HvoHRc{sxz;9W2qc^<@{? zZSr)*VSTaLaf6E%%t80Go{~9k*2}Xc%Pdp(wf`L-t1{d6^atRek6ohw*Hz7_&GJ$3eIaL{`9yq7X?;DG z-_@;Q_@OF`L`Dve1uZ{Oxp_zw!%PinPD1e%$I=_OfNDsKiV9A(jjR>ooVEiUK)?1G zG_iO&nY6m?A_#>(ohV9ty2)zsuuf1KRVN8m>B?LA}5o@wRIXEAbFDVk3zUnIG zR~Gk1GJWEkl)|Fhwwkh7Q1E~PRBtYIiUr}ypkW7=Tci~aV5MrL7QeO*+ifV}y*__a z78dgtkhQ&^%Ze+dK-hqY&s<#S;8>M#S6+XHaB4ee5Q@Q0By57HIy4 zXjTeWjwRyPpPIT>(wS!X)`Qzhn2jVRX*h=*w*CtN=7dx~5q%^o44lVxG(R%!ApBf3 zKyv<^B?+nIQ+|w>^Ct>z)eqG16?V*9oq}o8o~^qgr)F)mLz%AnzU^_a!TFPQOof%d z)gq_dxw_UkPWN^5KqumiE!glFIR zed&np6wE{r)g*8-=xvR+6gcwP=t!{tI5yV`B-|v3Q*h@c{&QTly`_H4mTQp-ZV(64v z`>i4am6HR+$a`03Gb?m2jTk4O=;z~CKPwW{8k{pbFQf4*R994PXF%43B(SCQ} zYeD77wHM1qMTo}{;Xl)828{V6OW_v0;M~SpJ-vT z0?#S$9JVf`j(!BHcI{%+=O{ecP>|JyNG$obR^?`fyZOST!r`MH8pWO zGc^Jzypk^I5-addm3_s;IfPub_GU0@YP9`ALBjKkH3$CG0x(0dR|0Cf52gK`HK~O4 z$ZgzR{o^K>j!4k1?vLfsSk&4&XJxdt`Gmwl2+}^w?PS(p7ZUof4I~7Vp>5LkyzkKXjmpOk^0X6J2=-_UelFAkgzK#K3k-HL;qJi%X>T4 zE3M&xfq;G8LaPL&HP&&M1q|ULar}?CXcg3nPde3SRkGA$Bp=_S_Q<&&D_J_lAhGJZ zb%Ft-B`H}_ysyH(yha%EJd}ry??aFCjHLGao4GUMZ5}X?;xvp0@w4lkZ&kmA)|4pZGbb?;n#m(((bhIxuCHTo*?#{&rBMm$(6kldkpmEUqGb6J1a7jrqg)Uc01r+&(zRT}qXDr9j zhqxp113Xv47mW;JWSV}TV%Wm>!8@b+*eQfLNKiH8AxgO;OR-mTz#bA*2iTQ#g#8OY z&yR%~V*lk&W&5apJy(VQ8E-9R`KQxCvzfkHVWL+N9Hka=%2Y=yb;veNZ)>=`CyC_&TLY(}o; z&tdS5ui4TIe?1ZD_$s06mRV?h8y}5~gmSI9{h~cM)t~DXvOsprpBjs&Du65r)}6-J zPWG5my=`olnh0?o*1LhoOj{>8UYw6hpReQ0Wg>*Bb#^ESo=x_`$w_6QTkRy_l7Zsb)eTkgJrP)v^%E2V`%nMy3QK;0%pr4lx%NC7s9 zV>SSJv`zq1-HlEa>Ufvluh!OUo?|!AfM@szgT*(|gxqw1idLt%e_=vf1o3<-G{N?? zndQj~Gr)C}vo|i-2%o3sVjwA?JB%9p&R1PAic?CH?i}E&7q+^|JJ_I&#%l96W*R!Y z8!N2Nko(MkKQ{zVb6gWmXe)1+{kxL2Zux^cKq$YB(%o|lxofle>%6gxU4!>&)Py%r z^!_(t4CU_)2}xvQ`ZifmfH?gUJS#Y3jX;9+nlH79135EL5(Mh-lii z>(BrKfC7+tw8 zjrl`74ui+vDO0fcc-akBWa8-Ww=^Zqj0eUJ7pTj&A7436Cj3lNd*OwtR$Tx@x>+~E zC2ku^isW5pu3!b(k4i`GHa{m=6)t*zwRxgsp_45fmDmE;u_}@V{4PiJsl8YRTH|Sf zd@=lL$dseF_b_uOEMI3)e+FB}NT1Nu3F%skU%vdNq%=B*3>Sh+mQHPvl<7nUSu=hE zVddhr9pXu1#ANia#R z&mVxYLb+6I20r_>Ow+k`cO2ut=VLp6|CK>;^%gL5zGw?VAQj+jdWU!h* zpgSCs&jK1Bj3W&`zAC&tD(r*@ADk36lRFn{k@1jLnk+63al&Z2w*lK#TbM-3ug%De z&r^Zy-_*V1H22WaAsDi7I8U^h@28_)Cwe;)$+LB0uDo`@$7#xGc!N_ixdLVzT(s6Y< zyeYi+F)$8b1J4}MH2q`|_#-)eTOpPQp^{ho$h*MlGipSe=z0jRVUq1!1X1sux`EMB z^-Ttj>H4xrSc@n36r5Vo!tc@dE1tT!yvHFOE9{S@1zC_OTsPqww$2^J%5UE{g2%gSZ>6VR`0?*PMaS z%kCqx(&}W=??em^bQC9&1Qx*Zf+_nS(@%;sTg5N$?bKkU+@p~!7s?&nhRehFj32Y4 zgcQ1;(;o#%V&Z=(F4C^>+0=$w1RiYUo6O|`t5UBhQ)gIVbUlgPmDp!C%!Lw^mRDbA z(Xv^S1nf1_T~;rtg%?i(RDRWTJy}fp@6pVgjH2E7Ml`hC_C8hg9z1Sy;yy#4M-Z)s z0G6*_J)A8VH=*0qcMV^QR#D8VttjI1K6iAxE91Au+LI)F{PbYslND*rPD^L#Sxy1F zyjTbnU)*ZbGEG=;EYGllUS>};AeZ~}At<@=h(}VpJU74gtZ5PPb##%~phNHBM2)ki z6l@0uE@!FE`A=N4_?q7lr-S%`*=QZG@i@ubSzxzfE4{r&te~`&8LL?b>e}Wsy@&z- zACsOFok=g^C#+Gw=;$EIq*F6uYtnnFZZw2mIaO7pI=tDm@|SY2j^RTwNNFxqY)|WW zBMw@9oQOS5c|%R|LMiEKK40^lS{Lcl0;p>X>1F5Ui2psYo(Ac2r1Wm*n4{@ch9An- zncL+NMQU&z9C{5LQKN{qe<>Cgo^!icy+?VW=V*P>&CT@7&@sQ=(0e=QO+nx;GEDY{ zQh;06@`gxh1|8BsnJ5h?X1Uk*lDq{)42^Q^(q>bJR!PaLJ+UPx!^^P34D%E>^a3$8 z2}@rGejhZK8Q;t|W0zGtb;C(?@rfAmqJTY>Jg@!g+6~3V@FP7nfH2eBQbcVT8wes8 zghG=D5S0CIiO{PqgzqfD>NZ0dC3p6x-Z$|zYr&;cT#Ln|au?+kmiV|^flje8gUsNY z4zGa#3dEzN3oER*sVcgjvU$Pv5%*vFft3H$#aUA8?_O2Pl!=`8YCE~^)8|H7S74@6 z|Ai27>kL>lO`i`f%y3=#T{>RZ<5~{>on$6%dMwph1iaG6dAVBZo$Yt$b`+TdJGiQP z@^M+9e@&4-j|Xcq+1k-rp4`ZO7gf5DO$dr{eVA|{Z>#LKHmfFwLt8tyu6IftWG%#5 z4>WKwcM9@BM>7ts6Hc3rT#VNWi%#Mv={bvfIvn>JAF zpV$>Cx06-&Gg17!dz@~V5YAe*{_%H3Ngs;Q8yT<8<7ri7uX@u;K)5v1_Q0R~fini!HQXSo$@h5e#b~@L4aV zn1Tale@KMP>MDSBZpeIY#)jbc^2?3B>m^~{*WxVN$S*&(nONhOY3$~S0-`wSr|UE% zyV~f|j@A2q9vxgwy1(&CCJy9CTK8sT31Z(`j_ltp&B@y%f5;wx*>#DVW~fEE`DEPa zv^F*Y3Y=J@HAvO2&8y2}nk64CYNx_3ArF#cXb_1Lh`Rv6F*udvH_Kz_EKaDW=SB1Q9#zKxtYrr5@S!$Z*8X10O-+K60ii=VqOs+w?S zB+74w$v={cT%#KUsAv}Kl-L@n2umD22T?h#&OTA6jcV0sZ7~x2tM6={4A*of6T=jK zgFFRS7oOD+8atU?HqM1hi#(<3QaOj|7!8<5X`vN^c6^kaI3xUi^&8F?Dn z{#5WY$3R7sqX$QsQMsvMDoGPMky=%qbcdn71AG4O_!q3ermMg}9HJch=cpw?Xc+PF*fC-P8vLAv5+KqQ#8aDRN2hZd9=Kj#)XJ zalbO52h9PRi!sxNGEZV{qdULsrsSH{Ycn>L%Ff+txku@P4kY}``s=q^7eQq^w$(^u zOd{_iB`x$CB4=NmKuZSQ3g5t_?dYB9_C?chN3QVS=k`HB42o2$p|cgz)4)yxL)cug4pV37t z$FKQt0vFmWzx*2H%}v~?!ESjbC=D-!dJTb@jNVKM3RDO(#T|lSlhyF9?9;&-{>QL}y^FdlRslYabhCMO~5OSFWT<3DZ9-_tN#Ej{q16Y#WKb3+8!qwu>mW zAZbKvQWM6ox&l}q$-HRd#lL*;V#IR@GNg5Z0D!cvyiD7_Hi**RwpIXuk`jRFUw{li zfWZa8{X;PS1^|Wxfbf4Y0H6Rv`v0*y4C8-uU;%&#TLAojbM*iD|Crpr`EU1sJyJXX zfb=hdXXoVPNPzi&7zP#&0R5kJ4t91Z%>SMWh5et3ur5%z|HVa!|IPVV>_7H@01=09 A6#xJL diff --git a/docs/zh/05-get-started/xiaot.webp b/docs/zh/05-get-started/xiaot.webp new file mode 100644 index 0000000000000000000000000000000000000000..91b3b3ef681a590c8526c92e91e58596a09a4085 GIT binary patch literal 12592 zcmV-0G0)CYNk&E}F#rHpMM6+kP&gnQF#rHC4gsA3Dv$w?0X}UklSU*Wq#+~muc&|x ziD_=t0H{{)JL1a9j^o^@d1LYyhL6(pZ_2;Yzq(likS63_F6iU3(~Y;FPLzYv^dAKSGJ&9nRPz^!~IX}t+i~u zkb<@icF8JN+@4d0&&z#OYZ`I+T=PkXx5U#vOLejfqWXAucM*9JT2oVx}m)6xzr=`Q-qc^hffQB1Ei&ir|uHG%N0s&ZkoYIie^Z zp1H91<_gEpyHhmh{lRGClsFCcUdt$e?gWdCC00_UdPj<_ZjI8*_v(wjavWNSA z8@D}F9aD*&`VECuDl_WXxpSZEECdYEQrp_rn`Geu>o#=Ar^)$@Hg^0Su63Tf>d;(V zYsJh!7j4&YgTg;L)mzt8>($HsboV>)E#!ktIANzu_lCyr;I_;|Do+DHY>5X(2}577 z-SybFp$INTQd-uobrRrPRqswhq|`@1DC4YM+$@CkUcU6;Ujb$xEnd)LL(&A~<)k17 zp$TL(3MJI6dUOown*_M3Jl}c&H&Ujy2}gX$$p4o{AKG}ueWNOKRbov*#RXNt+;X>L zuV|h|o8JPGjiK%VDcN`6B%cakFw{K|R9oKmPkR}mcib$gR|a;;I@;0vI?`izq?5HF zxNzTH55XQ)0AR_;&C$r;)Q=I)2hYST{Rk6>=+EZMddG(FVt^R}kxTl5l|D`voGry4 zaZTNbw&K3~@F7&}Ub5acAJOOkI!bZqX#NMOlqt%T^AY<(mg5VWeh+qusk4nSZ7EaqD+-Yw}fwhvs>ZyC?AjOhIj?+Z1j^H zaFtPxbXGaCS%BgIWtfq&Ma2TgYeZ0B^#jpOUK0fJCd0H8a{e{d>O*u(troWt= zRYXs!r!bdK=ilL>@#$ADa?^;n~9p_ zm5h~{J^qEUndtfB<-=giAAN}_?|j4e#v@Sh;e+02HuN_7ulu|_6=Jn^QPc0X^M6S; zQ1X*`@tL3j)obys|C_7=c#U6r9N7d7wycnH@3%lw;Uax#kv5|AT=6podM2;H;eT`| zrhsY!X+QR2^($et>mFhFI#iMS%V-d=y4&Kla?$1A&(|e#I!fb!3Lh36P5>YkdwKgA z;8p^vP}RSfentH)VLCou=K2Ij{2am6I(4nI540;yq?4~Q5;6)S+@M-whF$N+k)06g zX+Y(UE*km)P(d&ggU#Q(ZG74ybzEU?u*{n|nPbw$U^vIknAXP*D%&xO@){szz?0zI zq#8hXi>=GcXNmQBKbKtlzI6n#IRTi`XgmdhB@1JvJSY4Vwyhcxsew0%q|bass+Lc=1JCuIp}FV zW31VX^CEHUx#cKhw1dliOK09$1p3I6umbRU;@dwb@KB+N%HuEzv#{+eNxQDbq#ri= zLJ!@v!xK++p_I4R^^JN&bl3)nW0&Ka!tbmRCn_EeE<=0y2F z1XlJNKIw8WU#6`@YZ(biSw4HArTK`IUdj`mm7VeX63JT>saU(rcyZnMVjqHZT97J# zk~B{d|5x~+!Q^}q#|%Foqgs@7(I}Q?S`~Uc8S3pO1wn;CqN<52cZ~%LL?EXxdSu|B z8w~UlyKM{K)(bZOGA=K_M%ES0ezXykd)&y_OU=K8IkibU6)IsUrT_2}Xq7Tx(Xov9 z<0%=I|B7kqKvO?X{;oT_HeN5`qmz(CYY62qhxtup9hlE8HJT*hiy^$ps89Dyz~d$c z+8ko;tLD%^Ui(9Y#l)wu_Q!jWP#BO!DtzemH_Nd;-}aZYME^De4KT#AmL!`;i4ez^ zc3yhH_g&Td_Rjz_!!I~yMQ0MYx45=`Op3`rEnMr2JA~&iZzm*5V$5@NM$^CZJ}v)J z7K%nHIc7*^K=t_P7DF3jom{KBgtQ8-2^A&Cw^!o_wZ58=Vt{Y9_>Ek?S~Rj9ulQz?~#*~-6si!z4x7iiQExQM(-zK zG@PPt${YE6EDB<`kCV7gYU@CO5bw3*%!dpD3AgG*BiAVqT5FI8<<%nD$V>=VPs+SQ zIPv$wfWu1EFQ=zo008^zuJW1HO)r|x2-7?k)Ft6Hc34#VN;7E7(y2V>u;v3>&nm0USnpw9}M z?Pk?5e32{OQhTs(60$X_ArIGuildQ))h-*jmtCeI_ayLbJz*GxVvpu8c;^nnMSsI} zS{sAAI}W-a61#p#_}1419%>o~?L9X?pgdXN!@n=A?%ynrMC7YZgXdKenVpO+$j$bM z{AN!xI`vKu)P5IML}bMZZNDNohK@PVNDfhNZrn>bl-<8Db;^7OFkYytJh?&BonJy0 zaGNkWPXRRQ;m>pqP9#Bk)~gM+)KMzVI8IEZcJ`i_jH@H8;0vW#KIt7hP95FUl)^?rE(fbL6k~yf^ z3!mP}>#$3tJO3e<9h1V&Y_Ra}dl(>0`Lwl=$8uc{1h~h8e@Hw2ngJy@B`Il%BX;I{$0BeLIH3M&xP**CM6JRzm^Hrl`ZeuxC{C7z56?EM>P}H0s`F|HySsIvYkn5(D@bick%piSd2EfJ_U17E`gCt5( zm{M~3-aLq;HXti7dJzu#%)g`5$inaL>>xBulk!*4J%R}UOM00}qbTKvh_F(Ax3N{! zO@e19LZh&NtQ$^x>Je6M|&lcf^@z2_j&+ULOh2<~z3BHrOtV4EVuN8v{t7 z2|_Y1{$1_JjKx1qrN4|iBJQQhj+xxG1z^*JYcSw(oa=)iqYm)fNh#rhM1)=2of=cFBLif6kr z;9l8NBy`m;3XvG82T(@lvl{C-A|z&gFPhhC?H}@)3VOwO zN6(EVf?Y>_B{IHvPqejy&n+5Z7lxniFQnR1ttQrPFnW%Xv`*OG704rr<$jTN#OY%c zxgls+!g4WL4tm9A5s;_fjeb?A>pOf6-`$gv3kP8NVFF3Q=+UvpT?)#NyqB>19n(7# zj%mK`jA}uCf&SECSjg%m3C4NYn!(y7Lk%uNR=|mDwI{A%5Ix2PD2dcX{Zzy0(uMlu zlCH!WIrbBvr508mf#nf>LCuzO{mu>VvUq2Cvf!w=2uY3YznCQTbqcl{*PlvmBSCw| z9bELDfVZjxyGS`U@1S(Hl}cZbZxOF6QGH)X_^(gCYh;3c?!$X0&Il=-upFuQ3{$TXei6NbC`eB~8e3?fl&!zh#GJ-W8e_<@D8|ab}fUjgIr719Xf&(nAGk!8{ z=27|~e^wtmpoB(dRF&%643yeuG8b*^gJ9r+ydC~B4yXO#F~7arwfpM~zN$?->7sP! z4K_C&F2mB|k?kT1l}$Ug?3^uG!o-Bzuo*USrmj7vo}S1>HRH?8xgd1dDK~8Ktn19I zjNUmWnJt?b*Y7<~Hc`G1#Xzz=gj z+$|!vfcRoIfb^93$gyX~2}F+_mz}K>QSZj35|P1oiX4a0%DMBz`(xjicdrTSKuD_DZkxnvusUI-*$JrYn7*p zPy5L{(*#4qo^lLd*=0D{l|3g0qf`AiB5=0{utg zz~)3^xq^amX#V70`H2YZ63Bm~E|5m#B{MU`Ue&IF8x=iwVV|31Q=k!ikh{a%E6EjT&9rkjLIswJP>?0*k7Q-n}|Q!Y0Z z6MHPX(I7BLp?(4eII@u z$C9TTS_8WpVnf_y-%VwBMMO{T;RmLcm<=UAtP^nzd0&MCYXdY!HQ(ZzO5)0U_R9M zL%@TSTQoy3=&qN!x^%NqcN0OnE&W*%iZD4t5pdZj@lA%=71mQ_662NC)Ov#bV=Qz-1t?JcAypT}31SFAG3>8_0 zbw&U~$7zsKe_5?t?_Cp4M4xf((gnd;5l!JBi6#MyO#3G6Qivl=067hmt(E*%^NHt* z2up+>+(%ir?B^jPMGusonWHBbNQ3mn`u=cYm=#L0=q^7%;8a22HyBEB-UNA>K@tM&ks@ZKz4oSTEWn0blwa84_#05~AB zpu=$7PXOWbdk)E^-s>%5O@mtrI3Yzc9~nf><=&nda)E(h&SN*FW`4v7$K38n$d@o_ zW^u}EQ~7++yFw#-j}-|iW3(yuJYozvfgAjA_8tj?#c<$tGiH6yfv_GKi(=t(LDv}?)pgIg zfdobO7Jq-gdgHy+0J@bQ1TrphoiyD!{TV+aWf7puF`JYujEw&B7L|;6odWy0a(Kf^ z;yC=3xa%Ml#X}|2;;p2Sy-FSGnmA*V-Cay-0Ky87OgKO?KE$?&;FfCY8lC$pRIy@; zwV!Zu7!NFM<}SA*>%cSXJtFnUr!%C)l<3#VAGla2ldQmP7UmI|hDeFO+-J>kD8zlw z7SEYs=hdfS)O8N$yXt{rR%PH$2lujcwZ@l9v-+f61ELJHdN<~@huKVYE<{h$vTr#_ z`KA7$JUfj}sql*{*up|SP{xj#u1RI!w7d1n*kW0C#a{I0+PFL`h2+iOp9u`NV{9FpYXs zbwrJ5Kuu`n`Z#4p>tzqpueDL!dmKm88e+6aLyrE|fJ6P6+`s4G0@}k>QHgJAaV)VyUyh-ow9xCs949 zC8JT__u*WuBewLK0;T*k=(cPDB%GLA$-Dc(O9oL2iy{w9&Sdln^Al`Zsh(b83et+d zXtCz?9AIWBklW*cUk@V~$O{8YRhz6Pen^h0X|vIk$ys9iZ8UjmtrL!IV}mRgYBX_L z5uCWTWa_SSUjNzKOl$X&zd#rr=AxbU z^2pCJEVsXh*r`PmyZu~GX-A^~h6MyqmvGz4Ccg!P|A8yvTn1@DF~!tYBw9oQQY)wg zzLncyN>9%8^3>yMp3M#DCpl$%?}?;wL!w6G@79CkjJ=P(1+VnaD5rqxcg+iZN4sW< z)J0wihM}u&7jxNBlYP23UVBp4Y`A(hfOLrn!XEB*OVm);dEPdw|v18qo1(X_v_ z8C^XDY`bWiKkh70?BpP!dtsuQvQGOq=@P2A0Edheu)zdE3BkhVND$iIoLrY7%_!!q@;2{G^>AgTw$8lNL1WunWzOq(R27cB+KPn!75nb^~)U!h9$n4Y} z^`7ElJ=rUiUlJA)?c5yoE-3rZ*HZ!RQY4v{YQH2{jM+`Esxq~dFq-zsw%#eYn>Dbkz9wMXYMCx2UNF8&7J?;3`X-4vu;`j^gP)Sne{-#6Xuf zx3Y7ZfT`2Y-lf`h?#v=)JFU3vWOu+ll%!8Vv0xf8eS%9T_q+!7x1c38= zAq`nJA9@489p{$u4z@=43$lLlR@WgA&mfQ$g~&l+S5QH=TfMeTA`!XzBvTWRb@KE1 zPx*+wrIzvmj6=`;;vf76&4R7N=mFN)30&&(Q3efUaFgL(i>UpS?o3seY|()IC}(7CAhKXSZ=c#ClLt2i2Eq-@X2vAWGAMZ znx>3AwS?*hnI^ZJ63Wla8WC`{=#*1CSS#D zMdf7eTJbiaQRy7g7`*+V}WV3Qe;ZQV|o*XZT1yxlin1XMUAhgUMUF<-?r+m&rF9LU-D7f0}eE zN{bErsUO_N!_Il@{i%WLl#0!VmzuN$Mhc($DrS;>xE;iB(iS{RZWpw?RTNxv8%O^z z;vzc;4Smm;8K7T;Ihy^ZE3cY7p~es^50$r~&yKQ-(*4KZomH&#%t*Ma|JcZ1Phd=} z(3CN^LnhTOZx$lVNq5>QYRN}PvfR~@1b{G^o9j7Pfo{K4^&CNI>wfmV+_$NAZ-(zh z9lrSyDY;eBB}Bp3JM$)CBhR7!}Y97<$Nji;IQ9Bbn%)F*W4(_6}n~`I9*E{s=XiBmxrnN{D$5m8Ez(r;i)a50y_J zc1J>n&|ekS1U*#IDCDKoi$3NH?$II-W_N*O89`W%F0|(lU~NIH;2+B-ieAJtw@Y5^ zr%|A=zjr>@*tClbeQye{Ocd?2xes`mXY*585#%ns{?QZF{D6=B?L{+aV^LD>R?v+k z4btiCqyK|7!u@)8SfNcPLjSJ2~n4+1|jYhz7+hbE-q& zgs6o1KLojXDOMnxEuEKU{zA>9?Gs@>mnaPW)s3)9O_5{;j6#hk*~3;=9$v@b>J9bR zgMrJNoMqHX(sODbj2tgd$Ubg~g&mj_~8(!3koh1zKqX!*{v6KQx9 z(J7j0gc^fFpGD)P%1IlOZrJzNmfT+CqRMNss-NasZ~kRj(rt`qP?Tj`)p}^QPan8l z0xN%VK?>+5N9!;Wy|FADIB9Ur-bv@JDdA8dtSO*`ycxf)erm1&W6Ah3iE&O|134ku zc=pNF9W}{@0pVN?)3_rFqb3%RJg!qT+!s9~8wE!;g~ec-DMo4!37ke7Vp!w`?N5Ze z@leU2`ES;el29R47r&O(1E$`wc^3lxkQ(PFKhI}ZLndM+;|^V+01~qZOv(j_|FIfL zw2QENwGOO7E22jg>(Bf$PChWwo^!SSsof>okzP18 zD=X+?Xs*E?zmsoVQ11xyn4C+kb*oYMY!-uAKOWpTcs6v=<-voPua+bgex1}L@?>Bj zd-45Z^M6zm*h3|@zc(+8tDkMZ^;z_+Bj&9mIZH^}4qbn&6mQOI8bQ*aTK|tkAw%rO zb;nP5lA{FJ-aGbYiyTN68=YTV&3)IHLa!@|tOF^1v{=Ql3wK_AY*7IxZff4c$7G>{ zgDF>+#wBeXb$F%$-R^C6RYR3juf$R8dAc^6L**?;F$%!><|R$kQtV*7BnA!wK{SeH z_cX%7bCnNGNPa|`(B|DsXl=Q^)K$M7 zRCjEW8g7vc<$Bu}S~7WI@t(3j4R??O^AQ4J9YApfz`hM5+N-ZCBKRq5VF_X@vbJP% z1ESPw!8=KJ2+vQCj8B0AdxJqUq&AV}pLF&7XyJ!-)iV=5qTyeo`=kGb`W%Kjdh9a+YOr;v4 zw+d};XhEiR*S!#T8o!;!X=;Sy6q3OUdxSNR!&xia&s$P6y*qYL)GP1$#hV_+7Y8R3V7dy@qMV&sh zc%uBn4ZNQ#7@K?>7O5@ZS4wYs74x7Q@7v^z31@$ij}y#ilDTnS2O>|^~-9_NEBsFO!N+m1IXzC_O%K0aR)rY0%(hH=j8W$y$V5JANs_F_a;0e)`0swP7 zR~19APAcP~^+5SxPlzJ&(yw{Ed{&x4NPPkq#BA-`Fg1SOhts#U*bfT>KGH7~M1^(&UWxplmAWT_SkGb~8B)^kFcHVo z|3*tWr297pAA7<=tENI6mIsm21RgK{P#$pDX^2TanSzD)OZDryM-T>;>MI7(JSdZH z@&#Hm=PN`s^o353NPV;dUGpN_IeSd54O|IEs#?r4ukk1J_>GJ+F3&1E@=S2_0Wu|D zhf%U<<(uP`=VxE$K8U`3dcO?CU}$9Z-f&vb@&13a9i^rWj}1U&PR*Ih##PIQEa!Q2 zpWbt@h>CEWOb~lQyXRyjv7^qeBV18OA5TI zy&wNof$xMdyvsps8t0N=;YzfCWejhPMw&kUm<86xiU`qnZZKLRDEtJFtaC7hfZ><$ zm_;_68L`e=`ao!Abp$AN5kl`6+g(@BiY#0pe4DYMxHTA9w=! zHw&1ppJiy{y8%l>qlfLFCV^o1l$)_IlDRq74;`7g^A5*I0PyvwCWL4egFsmt{;*@f z%6w4w=K$H%nL#JrcK%|l@31tUN_!v8W!iC<=qUOzD;LecOwI&_sTQ`h|Mw*sH$m zWpoe=g;JNk8gDCl1M|h?x+3F8%LVSqS89HtGJJ>w{GmF7N8t7mD+LcKBPgcMl}fPe zbNW~zf__qVgaNHf8pC!K`8zpp2@q8t^2o(F0@pCKElVu0_CagpLS>1q^Rq@KrUhi4 zL&OONqSKwn{~+CuzbZm|ArK=p#eRE@z}W5M7<>f`KlZ?OU zRZvP=XW>MhC7vJcFfTv6=wdDL7ITK;Fl#0e@u}>e)?BSu!DD%rX||BZV^+Zt6jfaV zfO)!tC`q=QXS5c6NR2ml?XJdMY<|& z*Rpk)c<_#&bSYRm5k{1S)#x;EISCCbbtBPEjBiS*|Lu3+9E$9bS zfBi!QvIb}eBpwjLim%LgCh1q9EKyD&@aT^`^~iLx%=u8Ko7ua2h@D&4Hz*C1(@0W@ zB2g+!j!NJ;5Z1ca2YHCq4IYHFuvo`1ZjSlufxc>wLLO^`T2bDtd*~p<&rHEZJE@M( z`9KwI!T+yOu?8H{BN>=lASZdLfDCR(S2*Q1_&u3?%3M_ynEY5yMK?b@XGDw$G>xPL zq>SN|`PD;~Iu=%gdY$wx(mP0N2jPQ3lx;5bJ_NrKtOrL=ES1P^{@w$AAP#5PPfSJi z4L$Tt9_u1lb*Jd@xxmMbibUpRZWMn8&NGGZa8Xxz+&&a-;ZC`InZI@Y5q9`d!|{zp4@9FmGHfbo|K&&SZgQ&;nM}~YCZ(T z!ekZNm=Ne{wm54r4y|%A1F({_BWg26CazndX{;}G6m;pJe?~U1|1QbaQj#J8zO~Fi z3g<@T|64yC_KJPvnAfT+crb$rlE;tT@5~8Ruot&p(nTtt!)f>`&IRMgSEOPfUGeM^ z($9JU5zjyxv`B0=P;7M^o`y z96*~rW@JYS*^o-i=pVwJ9BgF0QjT@o?GN~GICtv^fo)FYA!7c_G0Pei(Luv~HUUY0 zKn$<O{KGrac+FjP`*Mx-D`D`n})AJu-43lP~1L9D^!l0rsRLBvV&CarVfq_W*fDQU!B zQR~O07y=9<2M-4;dw6eO2SAP1NhR1s3U4UM@Oc?=WW2J;-C)WMed+J^pzV%5X=T{M zEav1_5!bg-YVwPgrU@;vSlc71w5_os$j69t2y|~CpT>cbm;A-HO^nCtR580|W;BCX zoj2q&;p159S(Aqk9QxsG1MU`ncjr>4^!#wI8~-1_+ZBBLW>p@XEQZCrVDdTUh#6pqF|862xlXOcCn&N`CNF-YyQ z0?I1*uC)Ocr4AswQkKNc{4NI3KU|RXMApKN79kO~4T|^wK{W(^(gdNSj60DYHpwJ7 z$2MheDTty7nxpWZ8#Rh(!Q=|M>Q2VfEj9~ivo6z4Wh=$Nh`%a9om}%>aqp85*VGwb zl#!?N_0f%>@Z3xg*(uL2^sR*({1Lhlt+Oh;h$r zCo4$nnUa+LX2_M~9KCay1$Uza5oZOL<*pLVnXhY2mlAQZAl;eHL<6)La&x z6i1YEjUq=Qn6Sx35l{!2(vz|aTtsJXgD>vclFgFRS(RKg@z}SI1BdMFY2|%>j6lVa zw@B^v;>X|6OXDP-SC(!^>S(j+jg4TI)<6X%z>Pr5(bOk5NO(k$FmBItPvt?gU8LZF zG!WJqarLuuuqLAEfVyRwC0w8oLpUrOdFr%LyCy09)^(Dsp+xC^6?Br)=d02sk_o`A zmTiUM8ECBiJ!3==CS-SBoIxF^o)LeH12|9G^JZBPxaklrRqwlP)rlT0J;?XIbi6)S ze7iEKjGf}N{`Yl@+Vm#xt5M-j7BM~jCvEy6c#P-U|5MB+G03*KV?!1?jz$j7m2B@J5^1HmSPbUJ@sRAqq7srSuT4rU$Nzc ztaRCF|3|}C*EzbZnHLat9)0g2W&=|A!l8k)rlWG22S?#v;M!MdtAn0jmk@e==Pq}; zeYK<^s+R^Iq!Kxib^PZTA5G*16_XKyNQP+W+PgFSQV}%vm!T%I&)f7Z+vB8v6UD=V zu4|=FY)+qL<#C1)`{8|=&`-AjivCG3*>2{-F>dOor@$!2V97UD%>bcKXKCSjye5k7 z@QNI54?!sc(Ha&02eAqmPiU4C5IJBj?I=!D>phohZP4;sBDe9HYB6Qpye}<_mu)yu(23ySoMm?Ot zbH113vVkESXOyRv;T%=L&u Date: Tue, 15 Nov 2022 09:11:26 +0800 Subject: [PATCH 019/116] fix:applying non-zero offset in tqSink.c --- source/dnode/vnode/src/tq/tqSink.c | 6 ++++- tests/script/tsim/stream/basic1.sim | 35 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index f782411084..b2624d1bc1 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -31,7 +31,11 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl int64_t ts = *(int64_t*)colDataGetData(pTsCol, row); int64_t groupId = *(int64_t*)colDataGetData(pGidCol, row); char* name; - void* varTbName = colDataGetVarData(pTbNameCol, row); + void* varTbName = NULL; + if (!colDataIsNull(pTbNameCol, totRow, row, NULL)) { + varTbName = colDataGetVarData(pTbNameCol, row); + } + if (varTbName != NULL && varTbName != (void*)-1) { name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); memcpy(name, varDataVal(varTbName), varDataLen(varTbName)); diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index bb6604687c..bc076a194b 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -751,5 +751,40 @@ if $rows != 0 then endi +sql insert into t1 values(1648791223000,2,2,3,1.0); +sql insert into t1 values(1648791223000,10,2,3,1.0); +sql insert into t1 values(1648791233000,10,2,3,1.0); + +$loop_count = 0 +loop16: +sleep 200 +sql select * from streamt4; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 2 then + print =====rows=$rows + goto loop16 +endi + +sql insert into t1 values(1648791233000,2,2,3,1.0); + +$loop_count = 0 +loop17: +sleep 200 +sql select * from streamt4; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 1 then + print =====rows=$rows + goto loop17 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT From 4ae870bd81d78040f074a969d0c050a96133ac37 Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 09:24:20 +0800 Subject: [PATCH 020/116] docs: resolve ambiguous taosadapter heading --- docs/zh/14-reference/04-taosadapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md index ec023afd71..4e1e7b7ace 100644 --- a/docs/zh/14-reference/04-taosadapter.md +++ b/docs/zh/14-reference/04-taosadapter.md @@ -32,7 +32,7 @@ taosAdapter 提供以下功能: taosAdapter 是 TDengine 服务端软件 的一部分,如果您使用 TDengine server 您不需要任何额外的步骤来安装 taosAdapter。您可以从[涛思数据官方网站](https://taosdata.com/cn/all-downloads/)下载 TDengine server 安装包。如果需要将 taosAdapter 分离部署在 TDengine server 之外的服务器上,则应该在该服务器上安装完整的 TDengine 来安装 taosAdapter。如果您需要使用源代码编译生成 taosAdapter,您可以参考[构建 taosAdapter](https://github.com/taosdata/taosadapter/blob/3.0/BUILD-CN.md)文档。 -### start/stop taosAdapter +### 启动/停止 taosAdapter 在 Linux 系统上 taosAdapter 服务默认由 systemd 管理。使用命令 `systemctl start taosadapter` 可以启动 taosAdapter 服务。使用命令 `systemctl stop taosadapter` 可以停止 taosAdapter 服务。 From 14b4adc6ce79038ba9890c1f451fce260d57ff17 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 15 Nov 2022 09:39:17 +0800 Subject: [PATCH 021/116] fix: memory leak --- source/libs/scalar/src/filter.c | 24 ++--- source/libs/scalar/src/scalar.c | 149 +++++++++++++++++--------------- 2 files changed, 91 insertions(+), 82 deletions(-) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index df9a818fee..f5376eaf9e 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -248,9 +248,9 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } } -// if (optr == OP_TYPE_JSON_CONTAINS && type == TSDB_DATA_TYPE_JSON) { -// return 28; -// } + // if (optr == OP_TYPE_JSON_CONTAINS && type == TSDB_DATA_TYPE_JSON) { + // return 28; + // } switch (type) { case TSDB_DATA_TYPE_BOOL: @@ -1087,7 +1087,7 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, if (tmp == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - info->units = (SFilterUnit*)tmp; + info->units = (SFilterUnit *)tmp; memset(info->units + psize, 0, sizeof(*info->units) * FILTER_DEFAULT_UNIT_SIZE); } @@ -1169,7 +1169,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) { SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; out.columnData->info.type = type; - out.columnData->info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; //reserved space for simple_copy + out.columnData->info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; // reserved space for simple_copy for (int32_t i = 0; i < listNode->pNodeList->length; ++i) { SValueNode *valueNode = (SValueNode *)cell->pNode; @@ -1191,7 +1191,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) { filterAddField(info, NULL, (void **)&out.columnData->pData, FLD_TYPE_VALUE, &right, len, true); out.columnData->pData = NULL; } else { - void *data = taosMemoryCalloc(1, tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes); //reserved space for simple_copy + void *data = taosMemoryCalloc(1, tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes); // reserved space for simple_copy if (NULL == data) { FLT_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } @@ -1633,11 +1633,11 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) SValueNode *var = (SValueNode *)field->desc; SDataType *dType = &var->node.resType; - //if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) { - // qDebug("VAL%d => [type:TS][val:[%" PRIi64 "] - [%" PRId64 "]]", i, *(int64_t *)field->data, - // *(((int64_t *)field->data) + 1)); - //} else { - qDebug("VAL%d => [type:%d][val:%" PRIx64 "]", i, dType->type, var->datum.i); // TODO + // if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) { + // qDebug("VAL%d => [type:TS][val:[%" PRIi64 "] - [%" PRId64 "]]", i, *(int64_t *)field->data, + // *(((int64_t *)field->data) + 1)); + // } else { + qDebug("VAL%d => [type:%d][val:%" PRIx64 "]", i, dType->type, var->datum.i); // TODO //} } else if (field->data) { qDebug("VAL%d => [type:NIL][val:NIL]", i); // TODO @@ -1719,7 +1719,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) ctx->isrange); if (ctx->isrange) { SFilterRangeNode *r = ctx->rs; - int32_t tlen = 0; + int32_t tlen = 0; while (r) { char str[256] = {0}; if (FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_NULL)) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index fa71009365..00d6ea21a4 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -23,12 +23,13 @@ int32_t scalarGetOperatorParamNum(EOperatorType type) { int32_t sclConvertToTsValueNode(int8_t precision, SValueNode *valueNode) { char *timeStr = valueNode->datum.p; - int32_t code = - convertStringToTimestamp(valueNode->node.resType.type, valueNode->datum.p, precision, &valueNode->datum.i); + int64_t value = 0; + int32_t code = convertStringToTimestamp(valueNode->node.resType.type, valueNode->datum.p, precision, &value); if (code != TSDB_CODE_SUCCESS) { return code; } taosMemoryFree(timeStr); + valueNode->datum.i = value; valueNode->typeData = valueNode->datum.i; valueNode->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; @@ -61,7 +62,7 @@ int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarPara return TSDB_CODE_SUCCESS; } -int32_t sclConvertValueToSclParam(SValueNode* pValueNode, SScalarParam* out, int32_t* overflow) { +int32_t sclConvertValueToSclParam(SValueNode *pValueNode, SScalarParam *out, int32_t *overflow) { SScalarParam in = {.numOfRows = 1}; int32_t code = sclCreateColumnInfoData(&pValueNode->node.resType, 1, &in); if (code != TSDB_CODE_SUCCESS) { @@ -78,7 +79,7 @@ int32_t sclConvertValueToSclParam(SValueNode* pValueNode, SScalarParam* out, int } int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockList) { - SSDataBlock* pb = taosArrayGetP(pBlockList, 0); + SSDataBlock *pb = taosArrayGetP(pBlockList, 0); SScalarParam *pLeft = taosMemoryCalloc(1, sizeof(SScalarParam)); if (NULL == pLeft) { sclError("calloc %d failed", (int32_t)sizeof(SScalarParam)); @@ -90,7 +91,7 @@ int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockL if (pDst->numOfRows < pb->info.rows) { colInfoDataEnsureCapacity(pDst->columnData, pb->info.rows, true); } - + _bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(OP_TYPE_ASSIGN); OperatorFn(pLeft, pSrc, pDst, TSDB_ORDER_ASC); @@ -566,7 +567,7 @@ _return: SCL_RET(code); } -int32_t sclGetNodeRes(SNode* node, SScalarCtx *ctx, SScalarParam **res) { +int32_t sclGetNodeRes(SNode *node, SScalarCtx *ctx, SScalarParam **res) { if (NULL == node) { return TSDB_CODE_SUCCESS; } @@ -576,48 +577,53 @@ int32_t sclGetNodeRes(SNode* node, SScalarCtx *ctx, SScalarParam **res) { if (NULL == *res) { SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } - + SCL_ERR_RET(sclInitParam(node, *res, ctx, &rowNum)); return TSDB_CODE_SUCCESS; } -int32_t sclWalkCaseWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCell, SScalarParam *pCase, SScalarParam *pElse, SScalarParam *pComp, SScalarParam *output, int32_t rowIdx, int32_t totalRows, bool *complete) { - SNode *node = NULL; - SWhenThenNode* pWhenThen = NULL; - SScalarParam *pWhen = NULL; - SScalarParam *pThen = NULL; - int32_t code = 0; +int32_t sclWalkCaseWhenList(SScalarCtx *ctx, SNodeList *pList, struct SListCell *pCell, SScalarParam *pCase, + SScalarParam *pElse, SScalarParam *pComp, SScalarParam *output, int32_t rowIdx, + int32_t totalRows, bool *complete) { + SNode *node = NULL; + SWhenThenNode *pWhenThen = NULL; + SScalarParam *pWhen = NULL; + SScalarParam *pThen = NULL; + int32_t code = 0; + + for (SListCell *cell = pCell; (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); + cell = cell->pNext) { + pWhenThen = (SWhenThenNode *)node; - for (SListCell* cell = pCell; (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext) { - pWhenThen = (SWhenThenNode*)node; - SCL_ERR_RET(sclGetNodeRes(pWhenThen->pWhen, ctx, &pWhen)); SCL_ERR_RET(sclGetNodeRes(pWhenThen->pThen, ctx, &pThen)); - + vectorCompareImpl(pCase, pWhen, pComp, rowIdx, 1, TSDB_ORDER_ASC, OP_TYPE_EQUAL); - - bool *equal = (bool*)colDataGetData(pComp->columnData, rowIdx); + + bool *equal = (bool *)colDataGetData(pComp->columnData, rowIdx); if (*equal) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); + colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), + colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); if (0 == rowIdx && 1 == pCase->numOfRows && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); *complete = true; } - + goto _return; } } if (pElse) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); + colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), + colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); if (0 == rowIdx && 1 == pCase->numOfRows && 1 == pElse->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); *complete = true; } - + goto _return; } @@ -629,7 +635,7 @@ int32_t sclWalkCaseWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* } _return: - + sclFreeParam(pWhen); sclFreeParam(pThen); taosMemoryFree(pWhen); @@ -638,32 +644,34 @@ _return: SCL_RET(code); } -int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCell, SScalarParam *pElse, SScalarParam *output, - int32_t rowIdx, int32_t totalRows, bool *complete, bool preSingle) { - SNode *node = NULL; - SWhenThenNode* pWhenThen = NULL; - SScalarParam *pWhen = NULL; - SScalarParam *pThen = NULL; - int32_t code = 0; +int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList *pList, struct SListCell *pCell, SScalarParam *pElse, + SScalarParam *output, int32_t rowIdx, int32_t totalRows, bool *complete, bool preSingle) { + SNode *node = NULL; + SWhenThenNode *pWhenThen = NULL; + SScalarParam *pWhen = NULL; + SScalarParam *pThen = NULL; + int32_t code = 0; - for (SListCell* cell = pCell; (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext) { - pWhenThen = (SWhenThenNode*)node; + for (SListCell *cell = pCell; (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); + cell = cell->pNext) { + pWhenThen = (SWhenThenNode *)node; pWhen = NULL; pThen = NULL; - + SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pWhen, ctx, &pWhen)); SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pThen, ctx, &pThen)); - bool *whenValue = (bool*)colDataGetData(pWhen->columnData, (pWhen->numOfRows > 1 ? rowIdx : 0)); - + bool *whenValue = (bool *)colDataGetData(pWhen->columnData, (pWhen->numOfRows > 1 ? rowIdx : 0)); + if (*whenValue) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); + colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), + colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); if (preSingle && 0 == rowIdx && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); *complete = true; } - + goto _return; } @@ -674,13 +682,14 @@ int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCe } if (pElse) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); + colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), + colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); if (preSingle && 0 == rowIdx && 1 == pElse->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); *complete = true; } - + goto _return; } @@ -860,14 +869,14 @@ _return: } int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *output) { - int32_t code = 0; + int32_t code = 0; SScalarParam *pCase = NULL; SScalarParam *pElse = NULL; SScalarParam *pWhen = NULL; SScalarParam *pThen = NULL; SScalarParam comp = {0}; - int32_t rowNum = 1; - bool complete = false; + int32_t rowNum = 1; + bool complete = false; if (NULL == node->pWhenThenList || node->pWhenThenList->length <= 0) { sclError("invalid whenThen list"); @@ -875,24 +884,24 @@ int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *outp } if (ctx->pBlockList) { - SSDataBlock* pb = taosArrayGetP(ctx->pBlockList, 0); + SSDataBlock *pb = taosArrayGetP(ctx->pBlockList, 0); rowNum = pb->info.rows; output->numOfRows = pb->info.rows; } SCL_ERR_JRET(sclCreateColumnInfoData(&node->node.resType, rowNum, output)); - + SCL_ERR_JRET(sclGetNodeRes(node->pCase, ctx, &pCase)); SCL_ERR_JRET(sclGetNodeRes(node->pElse, ctx, &pElse)); SDataType compType = {0}; compType.type = TSDB_DATA_TYPE_BOOL; compType.bytes = tDataTypes[compType.type].bytes; - + SCL_ERR_JRET(sclCreateColumnInfoData(&compType, rowNum, &comp)); - SNode* tnode = NULL; - SWhenThenNode* pWhenThen = (SWhenThenNode*)node->pWhenThenList->pHead->pNode; + SNode *tnode = NULL; + SWhenThenNode *pWhenThen = (SWhenThenNode *)node->pWhenThenList->pHead->pNode; SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pWhen, ctx, &pWhen)); SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pThen, ctx, &pThen)); @@ -903,17 +912,19 @@ int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *outp if (pCase) { vectorCompare(pCase, pWhen, &comp, TSDB_ORDER_ASC, OP_TYPE_EQUAL); - + for (int32_t i = 0; i < rowNum; ++i) { - bool *equal = (bool*)colDataGetData(comp.columnData, (comp.numOfRows > 1 ? i : 0)); + bool *equal = (bool *)colDataGetData(comp.columnData, (comp.numOfRows > 1 ? i : 0)); if (*equal) { - colDataAppend(output->columnData, i, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? i : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? i : 0))); + colDataAppend(output->columnData, i, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? i : 0)), + colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? i : 0))); if (0 == i && 1 == pCase->numOfRows && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && rowNum > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); break; } } else { - SCL_ERR_JRET(sclWalkCaseWhenList(ctx, node->pWhenThenList, node->pWhenThenList->pHead->pNext, pCase, pElse, &comp, output, i, rowNum, &complete)); + SCL_ERR_JRET(sclWalkCaseWhenList(ctx, node->pWhenThenList, node->pWhenThenList->pHead->pNext, pCase, pElse, + &comp, output, i, rowNum, &complete)); if (complete) { break; } @@ -921,15 +932,17 @@ int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *outp } } else { for (int32_t i = 0; i < rowNum; ++i) { - bool *whenValue = (bool*)colDataGetData(pWhen->columnData, (pWhen->numOfRows > 1 ? i : 0)); + bool *whenValue = (bool *)colDataGetData(pWhen->columnData, (pWhen->numOfRows > 1 ? i : 0)); if (*whenValue) { - colDataAppend(output->columnData, i, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? i : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? i : 0))); + colDataAppend(output->columnData, i, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? i : 0)), + colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? i : 0))); if (0 == i && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && rowNum > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); break; } } else { - SCL_ERR_JRET(sclWalkWhenList(ctx, node->pWhenThenList, node->pWhenThenList->pHead->pNext, pElse, output, i, rowNum, &complete, (pWhen->numOfRows == 1 && pThen->numOfRows == 1))); + SCL_ERR_JRET(sclWalkWhenList(ctx, node->pWhenThenList, node->pWhenThenList->pHead->pNext, pElse, output, i, + rowNum, &complete, (pWhen->numOfRows == 1 && pThen->numOfRows == 1))); if (complete) { break; } @@ -965,7 +978,6 @@ _return: SCL_RET(code); } - EDealRes sclRewriteNullInOptr(SNode **pNode, SScalarCtx *ctx, EOperatorType opType) { if (opType <= OP_TYPE_CALC_MAX) { SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE); @@ -1089,8 +1101,7 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { SFunctionNode *node = (SFunctionNode *)*pNode; SNode *tnode = NULL; - if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) || - fmIsUserDefinedFunc(node->funcId)) { + if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) || fmIsUserDefinedFunc(node->funcId)) { return DEAL_RES_CONTINUE; } @@ -1229,20 +1240,20 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } -EDealRes sclRewriteCaseWhen(SNode** pNode, SScalarCtx *ctx) { +EDealRes sclRewriteCaseWhen(SNode **pNode, SScalarCtx *ctx) { SCaseWhenNode *node = (SCaseWhenNode *)*pNode; if ((!SCL_IS_CONST_NODE(node->pCase)) || (!SCL_IS_CONST_NODE(node->pElse))) { return DEAL_RES_CONTINUE; } - SNode* tnode = NULL; + SNode *tnode = NULL; FOREACH(tnode, node->pWhenThenList) { - SWhenThenNode* pWhenThen = (SWhenThenNode*)tnode; + SWhenThenNode *pWhenThen = (SWhenThenNode *)tnode; if (!SCL_IS_CONST_NODE(pWhenThen->pWhen) || !SCL_IS_CONST_NODE(pWhenThen->pThen)) { return DEAL_RES_CONTINUE; } - } + } SScalarParam output = {0}; ctx->code = sclExecCaseWhen(node, ctx, &output); @@ -1275,13 +1286,12 @@ EDealRes sclRewriteCaseWhen(SNode** pNode, SScalarCtx *ctx) { } nodesDestroyNode(*pNode); - *pNode = (SNode*)res; + *pNode = (SNode *)res; sclFreeParam(&output); return DEAL_RES_CONTINUE; } - EDealRes sclConstantsRewriter(SNode **pNode, void *pContext) { SScalarCtx *ctx = (SScalarCtx *)pContext; @@ -1408,9 +1418,9 @@ EDealRes sclWalkTarget(SNode *pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } -EDealRes sclWalkCaseWhen(SNode* pNode, SScalarCtx *ctx) { +EDealRes sclWalkCaseWhen(SNode *pNode, SScalarCtx *ctx) { SCaseWhenNode *node = (SCaseWhenNode *)pNode; - SScalarParam output = {0}; + SScalarParam output = {0}; ctx->code = sclExecCaseWhen(node, ctx, &output); if (ctx->code) { @@ -1425,11 +1435,10 @@ EDealRes sclWalkCaseWhen(SNode* pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } - EDealRes sclCalcWalker(SNode *pNode, void *pContext) { - if (QUERY_NODE_VALUE == nodeType(pNode) || QUERY_NODE_NODE_LIST == nodeType(pNode) - || QUERY_NODE_COLUMN == nodeType(pNode) || QUERY_NODE_LEFT_VALUE == nodeType(pNode) - || QUERY_NODE_WHEN_THEN == nodeType(pNode)) { + if (QUERY_NODE_VALUE == nodeType(pNode) || QUERY_NODE_NODE_LIST == nodeType(pNode) || + QUERY_NODE_COLUMN == nodeType(pNode) || QUERY_NODE_LEFT_VALUE == nodeType(pNode) || + QUERY_NODE_WHEN_THEN == nodeType(pNode)) { return DEAL_RES_CONTINUE; } From 3b1cd27367bc730c4b1a6f351bd572a3d88a3fc1 Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Tue, 15 Nov 2022 09:52:34 +0800 Subject: [PATCH 022/116] test:add test case for future timestamp insert --- tests/system-test/1-insert/InsertFuturets.py | 106 +++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tests/system-test/1-insert/InsertFuturets.py diff --git a/tests/system-test/1-insert/InsertFuturets.py b/tests/system-test/1-insert/InsertFuturets.py new file mode 100644 index 0000000000..a2f335e626 --- /dev/null +++ b/tests/system-test/1-insert/InsertFuturets.py @@ -0,0 +1,106 @@ +################################################################### +# 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 math +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +from util.sqlset import * +import time +import datetime +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.timestamp_ms = int(round(time.time()*1000)) + self.timestamp_us = int(round(time.time()*1000000)) + self.timestamp_ns = int(time.time_ns()) + self.ms_boundary = 31556995200000 + self.us_boundary = 31556995200000000 + self.ns_boundary = 9214646400000000000 + self.ntbname = 'ntb' + self.stbname = 'stb' + self.ctbname = 'ctb' + def insert_check(self,timestamp,tbname): + tdSql.execute(f'insert into {tbname} values({timestamp},1)') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkEqual(tdSql.queryResult[0][1],1) + tdSql.execute('flush database db') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkEqual(tdSql.queryResult[0][1],1) + tdSql.execute(f'insert into {tbname} values({timestamp},2)') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkEqual(tdSql.queryResult[0][1],2) + tdSql.execute('flush database db') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkEqual(tdSql.queryResult[0][1],2) + tdSql.execute(f'delete from {tbname} where ts = {timestamp}') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkRows(0) + tdSql.execute('flush database db') + tdSql.query(f'select * from {tbname} where ts = {timestamp}') + tdSql.checkRows(0) + + def insert_ms(self): + tdSql.prepare() + tdSql.execute('use db') + tdSql.execute(f'create table {self.ntbname} (ts timestamp,c0 int)') + timestamp = random.randint(self.timestamp_ms,self.ms_boundary-1) + self.insert_check(timestamp,self.ntbname) + self.insert_check(self.ms_boundary,self.ntbname) + tdSql.error(f'insert into {self.ntbname} values({self.ms_boundary+1},1)') + tdSql.execute(f'create table {self.stbname} (ts timestamp,c0 int) tags(t0 int)') + tdSql.execute(f'create table {self.ctbname} using {self.stbname} tags (1)') + self.insert_check(timestamp,self.ctbname) + self.insert_check(self.ms_boundary,self.ctbname) + tdSql.error(f'insert into {self.ctbname} values({self.ms_boundary+1},1)') + def insert_us(self): + tdSql.execute('create database db1 precision "us"') + tdSql.execute('use db1') + tdSql.execute(f'create table {self.ntbname} (ts timestamp,c0 int)') + timestamp = random.randint(self.timestamp_us,self.us_boundary-1) + self.insert_check(timestamp,self.ntbname) + self.insert_check(self.us_boundary,self.ntbname) + tdSql.error(f'insert into {self.ntbname} values({self.us_boundary+1},1)') + tdSql.execute(f'create table {self.stbname} (ts timestamp,c0 int) tags(t0 int)') + tdSql.execute(f'create table {self.ctbname} using {self.stbname} tags (1)') + self.insert_check(timestamp,self.ctbname) + self.insert_check(self.us_boundary,self.ctbname) + tdSql.error(f'insert into {self.ctbname} values({self.us_boundary+1},1)') + def insert_ns(self): + tdSql.execute('create database db2 precision "ns"') + tdSql.execute('use db2') + tdSql.execute(f'create table {self.ntbname} (ts timestamp,c0 int)') + timestamp = random.randint(self.timestamp_ns,self.ns_boundary-1) + self.insert_check(timestamp,self.ntbname) + self.insert_check(self.ns_boundary,self.ntbname) + tdSql.error(f'insert into {self.ntbname} values({self.ns_boundary+1},1)') + tdSql.execute(f'create table {self.stbname} (ts timestamp,c0 int) tags(t0 int)') + tdSql.execute(f'create table {self.ctbname} using {self.stbname} tags (1)') + self.insert_check(timestamp,self.ctbname) + self.insert_check(self.ns_boundary,self.ctbname) + tdSql.error(f'insert into {self.ctbname} values({self.ns_boundary+1},1)') + def run(self): + self.insert_ms() + self.insert_us() + self.insert_ns() + pass + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file From f59318a1f1e4ec10e83eb6b03b00c7fd188a99b5 Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 09:57:10 +0800 Subject: [PATCH 023/116] fix: skip bug of Docusaurus --- docs/zh/05-get-started/01-docker.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md index e772447db0..c6ae07c7c1 100644 --- a/docs/zh/05-get-started/01-docker.md +++ b/docs/zh/05-get-started/01-docker.md @@ -4,6 +4,9 @@ title: 通过 Docker 快速体验 TDengine description: 使用 Docker 快速体验 TDengine 的高效写入和查询 --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + 本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker,请使用[安装包的方式快速体验](../../get-started/package/)。如果您希望为 TDengine 贡献代码或对内部技术实现感兴趣,请参考 [TDengine GitHub 主页](https://github.com/taosdata/TDengine)下载源码构建和安装。 ## 启动 TDengine From 32550be9b6ca20848f47749a9d5095fc12ff1f33 Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Tue, 15 Nov 2022 09:59:10 +0800 Subject: [PATCH 024/116] test:add test case into ci --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index fac4210d88..52bd3bb852 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -432,6 +432,7 @@ ,,,system-test,python3 ./test.py -f 1-insert/update_data_muti_rows.py ,,,system-test,python3 ./test.py -f 1-insert/db_tb_name_check.py ,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py +,,,system-test,python3 ./test.py -f 1-insert/InsertFuturets.py ,,,system-test,python3 ./test.py -f 0-others/show.py ,,,system-test,python3 ./test.py -f 2-query/abs.py ,,,system-test,python3 ./test.py -f 2-query/abs.py -R From 3562011b93edec561180bd8547d3a10e0aeea08d Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:27:45 +0800 Subject: [PATCH 025/116] Update 02-database.md --- docs/zh/12-taos-sql/02-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index c76311f008..f1e7b0a385 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -142,7 +142,7 @@ SHOW CREATE DATABASE db_name; ### 查看数据库参数 ```sql -SHOW DATABASES \G; +select * from information_schema.ins_databases \G; ``` 会列出系统中所有数据库的配置参数,并且每行只显示一个参数。 From 5b8d0ae83715b59239efa608c741f3877fa966c2 Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:28:09 +0800 Subject: [PATCH 026/116] Update 02-database.md --- docs/en/12-taos-sql/02-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index 5a84bbf370..1aab3971e5 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -142,7 +142,7 @@ The preceding SQL statement can be used in migration scenarios. This command can ### View Database Configuration ```sql -SHOW DATABASES \G; +select * from information_schema.ins_databases \G; ``` The preceding SQL statement shows the value of each parameter for the specified database. One value is displayed per line. From 0d003bbb5d23d11854f03fdcc8492f314bb392ef Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 10:30:54 +0800 Subject: [PATCH 027/116] fix: memory in smworker.c --- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 1 + tests/parallel_test/cases.task | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 1381d4c391..f6942c8114 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -122,6 +122,7 @@ void smStopWorker(SSnodeMgmt *pMgmt) { for (int32_t i = 0; i < taosArrayGetSize(pMgmt->writeWroker); i++) { SMultiWorker *pWorker = taosArrayGetP(pMgmt->writeWroker, i); tMultiWorkerCleanup(pWorker); + taosMemoryFree(pWorker); } taosArrayDestroy(pMgmt->writeWroker); tSingleWorkerCleanup(&pMgmt->streamWorker); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index fac4210d88..bb2e101c06 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -98,7 +98,7 @@ ,,y,script,./test.sh -f tsim/parser/columnValue_int.sim ,,y,script,./test.sh -f tsim/parser/columnValue_smallint.sim ,,y,script,./test.sh -f tsim/parser/columnValue_tinyint.sim -,,,script,./test.sh -f tsim/parser/columnValue_unsign.sim +,,y,script,./test.sh -f tsim/parser/columnValue_unsign.sim ,,y,script,./test.sh -f tsim/parser/commit.sim ,,y,script,./test.sh -f tsim/parser/condition.sim ,,y,script,./test.sh -f tsim/parser/constCol.sim @@ -172,7 +172,7 @@ ,,,script,./test.sh -f tsim/query/session.sim ,,,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim -,,,script,./test.sh -f tsim/snode/basic1.sim +,,y,script,./test.sh -f tsim/snode/basic1.sim ,,,script,./test.sh -f tsim/mnode/basic1.sim ,,,script,./test.sh -f tsim/mnode/basic2.sim ,,,script,./test.sh -f tsim/mnode/basic3.sim @@ -208,12 +208,12 @@ ,,y,script,./test.sh -f tsim/table/tinyint.sim ,,y,script,./test.sh -f tsim/table/vgroup.sim ,,,script,./test.sh -f tsim/stream/basic0.sim -g -,,,script,./test.sh -f tsim/stream/basic1.sim +,,y,script,./test.sh -f tsim/stream/basic1.sim ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim -,,,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim +,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim ,,,script,./test.sh -f tsim/stream/distributeSession0.sim @@ -222,11 +222,11 @@ ,,,script,./test.sh -f tsim/stream/state0.sim ,,,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,,script,./test.sh -f tsim/stream/triggerSession0.sim -,,,script,./test.sh -f tsim/stream/partitionby.sim -,,,script,./test.sh -f tsim/stream/partitionby1.sim +,,y,script,./test.sh -f tsim/stream/partitionby.sim +,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/schedSnode.sim ,,,script,./test.sh -f tsim/stream/windowClose.sim -,,,script,./test.sh -f tsim/stream/ignoreExpiredData.sim +,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim ,,,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim From 6fdaa442ada74ea72968eeb67b28e96ca7869e1a Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:32:21 +0800 Subject: [PATCH 028/116] Update 02-database.md --- docs/en/12-taos-sql/02-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index 1aab3971e5..a12406fe43 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -142,7 +142,7 @@ The preceding SQL statement can be used in migration scenarios. This command can ### View Database Configuration ```sql -select * from information_schema.ins_databases \G; +SELECT * FROM INFORMATION_SCHEMA.INS_DATABASES WHERE NAME='DBNAME' \G; ``` The preceding SQL statement shows the value of each parameter for the specified database. One value is displayed per line. From 49b6b8752d42ed091cf03a7fe16b10065585a1b0 Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:32:56 +0800 Subject: [PATCH 029/116] Update 02-database.md --- docs/zh/12-taos-sql/02-database.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index f1e7b0a385..3918f240b4 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -142,10 +142,10 @@ SHOW CREATE DATABASE db_name; ### 查看数据库参数 ```sql -select * from information_schema.ins_databases \G; +SELECT * FROM INFORMATION_SCHEMA.INS_DATABASES WHERE NAME='DBNAME' \G; ``` -会列出系统中所有数据库的配置参数,并且每行只显示一个参数。 +会列出指定数据库的配置参数,并且每行只显示一个参数。 ## 删除过期数据 From 18eec5f351ece19d1573d2ab65068ff651905dd4 Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 10:35:04 +0800 Subject: [PATCH 030/116] fix: skip bug of Docusaurus --- docs/en/05-get-started/01-docker.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md index ac273daba4..0f9d79d34f 100644 --- a/docs/en/05-get-started/01-docker.md +++ b/docs/en/05-get-started/01-docker.md @@ -3,6 +3,9 @@ sidebar_label: Docker title: Quick Install on Docker --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + This document describes how to install TDengine in a Docker container and perform queries and inserts. - The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com). From a6a76adcbdd23738e336439f0bed6a2429c337fc Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 11:34:06 +0800 Subject: [PATCH 031/116] docs: fix bugs of style and import --- docs/en/05-get-started/01-docker.md | 3 -- docs/en/05-get-started/index.md | 10 +++---- docs/zh/05-get-started/01-docker.md | 3 -- docs/zh/05-get-started/index.md | 12 ++++---- docs/zh/14-reference/07-tdinsight/index.mdx | 33 ++++++++++++--------- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md index 0f9d79d34f..ac273daba4 100644 --- a/docs/en/05-get-started/01-docker.md +++ b/docs/en/05-get-started/01-docker.md @@ -3,9 +3,6 @@ sidebar_label: Docker title: Quick Install on Docker --- -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - This document describes how to install TDengine in a Docker container and perform queries and inserts. - The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com). diff --git a/docs/en/05-get-started/index.md b/docs/en/05-get-started/index.md index fec734b64d..373fa6e811 100644 --- a/docs/en/05-get-started/index.md +++ b/docs/en/05-get-started/index.md @@ -24,10 +24,10 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; - - - - - + + + + +
Star GitHub

Star GitHub

Join Discord

Join Discord

Follow Twitter

Follow Twitter

Subscribe YouTube

Subscribe YouTube

Follow LinkedIn

Follow LinkedIn

Star GitHub

Star GitHub

Join Discord

Join Discord

Follow Twitter

Follow Twitter

Subscribe YouTube

Subscribe YouTube

Follow LinkedIn

Follow LinkedIn

diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md index c6ae07c7c1..e772447db0 100644 --- a/docs/zh/05-get-started/01-docker.md +++ b/docs/zh/05-get-started/01-docker.md @@ -4,9 +4,6 @@ title: 通过 Docker 快速体验 TDengine description: 使用 Docker 快速体验 TDengine 的高效写入和查询 --- -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - 本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker,请使用[安装包的方式快速体验](../../get-started/package/)。如果您希望为 TDengine 贡献代码或对内部技术实现感兴趣,请参考 [TDengine GitHub 主页](https://github.com/taosdata/TDengine)下载源码构建和安装。 ## 启动 TDengine diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md index 092523a556..253eeeac01 100644 --- a/docs/zh/05-get-started/index.md +++ b/docs/zh/05-get-started/index.md @@ -24,13 +24,13 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; - - - + + + - - - + + +
小 T 的二维码TDengine 微信视频号TDengine 微信公众号小 T 的二维码TDengine 微信视频号TDengine 微信公众号
加入“物联网大数据技术前沿群”
与大家进行技术交流
关注 TDengine 微信视频号
收看技术直播与教学视频
关注 TDengine 微信公众号
阅读核心技术与行业案例文章
加入“物联网大数据技术前沿群”
与大家进行技术交流
关注 TDengine 微信视频号
收看技术直播与教学视频
关注 TDengine 微信公众号
阅读核心技术与行业案例文章
diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index ecd6362143..7f4c46a636 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -4,6 +4,9 @@ sidebar_label: TDinsight description: 基于Grafana的TDengine零依赖监控解决方案 --- +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + TDinsight 是使用监控数据库和 [Grafana] 对 TDengine 进行监控的解决方案。 TDengine 通过 [taosKeeper](../taosKeeper) 将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入指定数据库,并对重要的系统操作(比如登录、创建、删除数据库等)以及各种错误报警信息进行记录。通过 [Grafana] 和 [TDengine 数据源插件](https://github.com/taosdata/grafanaplugin/releases),TDinsight 将集群状态、节点信息、插入及查询请求、资源使用情况等进行可视化展示,同时还支持 vnode、dnode、mnode 节点状态异常告警,为开发者实时监控 TDengine 集群运行状态提供了便利。本文将指导用户安装 Grafana 服务器并通过 `TDinsight.sh` 安装脚本自动安装 TDengine 数据源插件及部署 TDinsight 可视化面板。 @@ -41,6 +44,7 @@ sudo apt-get install grafana ``` ### 在 CentOS / RHEL 上安装 Grafana + @@ -127,20 +131,20 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste 大多数命令行选项都可以通过环境变量获得同样的效果。 -| 短选项 | 长选项 | 环境变量 | 说明 | -| ------ | -------------------------- | ---------------------------- | --------------------------------------------------------------------------- | -| -v | --plugin-version | TDENGINE_PLUGIN_VERSION | TDengine 数据源插件版本,默认使用最新版。 | -| -P | --grafana-provisioning-dir | GF_PROVISIONING_DIR | Grafana 配置目录,默认为`/etc/grafana/provisioning/` | -| -G | --grafana-plugins-dir | GF_PLUGINS_DIR | Grafana 插件目录,默认为`/var/lib/grafana/plugins`。 | -| -O | --grafana-org-id | GF_ORG_ID | Grafana 组织 ID,默认为 1。 | -| -n | --tdengine-ds-name | TDENGINE_DS_NAME | TDengine 数据源名称,默认为 TDengine。 | -| -a | --tdengine-api | TDENGINE_API | TDengine REST API 端点。默认为`http://127.0.0.1:6041`。 | -| -u | --tdengine-user | TDENGINE_USER | TDengine 用户名。 [默认值:root] | -| -p | --tdengine-密码 | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | -| -i | --tdinsight-uid | TDINSIGHT_DASHBOARD_UID | TDinsight 仪表盘`uid`。 [默认值:tdinsight] | -| -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] | -| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | -| -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 | +| 短选项 | 长选项 | 环境变量 | 说明 | +| ------ | -------------------------- | ---------------------------- | ------------------------------------------------------- | +| -v | --plugin-version | TDENGINE_PLUGIN_VERSION | TDengine 数据源插件版本,默认使用最新版。 | +| -P | --grafana-provisioning-dir | GF_PROVISIONING_DIR | Grafana 配置目录,默认为`/etc/grafana/provisioning/` | +| -G | --grafana-plugins-dir | GF_PLUGINS_DIR | Grafana 插件目录,默认为`/var/lib/grafana/plugins`。 | +| -O | --grafana-org-id | GF_ORG_ID | Grafana 组织 ID,默认为 1。 | +| -n | --tdengine-ds-name | TDENGINE_DS_NAME | TDengine 数据源名称,默认为 TDengine。 | +| -a | --tdengine-api | TDENGINE_API | TDengine REST API 端点。默认为`http://127.0.0.1:6041`。 | +| -u | --tdengine-user | TDENGINE_USER | TDengine 用户名。 [默认值:root] | +| -p | --tdengine-密码 | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | +| -i | --tdinsight-uid | TDINSIGHT_DASHBOARD_UID | TDinsight 仪表盘`uid`。 [默认值:tdinsight] | +| -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] | +| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | +| -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 | 假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本: @@ -196,6 +200,7 @@ sudo grafana-cli \ [plugins] allow_loading_unsigned_plugins = tdengine-datasource ``` + ::: ### 启动 Grafana 服务 From d985cb714f86e91a844c557eaca3fd3e5b87de71 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 15 Nov 2022 11:38:01 +0800 Subject: [PATCH 032/116] fix: fix asan issues --- source/libs/scalar/src/filter.c | 4 ++++ source/libs/scalar/src/scalar.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index be085e6cbd..0f67947b1c 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -336,6 +336,10 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { __compar_fn_t filterGetCompFunc(int32_t type, int32_t optr) { return gDataCompare[filterGetCompFuncIdx(type, optr)]; } __compar_fn_t filterGetCompFuncEx(int32_t lType, int32_t rType, int32_t optr) { + if (TSDB_DATA_TYPE_NULL == rType) { + return NULL; + } + switch (lType) { case TSDB_DATA_TYPE_TINYINT: { if (IS_SIGNED_NUMERIC_TYPE(rType) || IS_FLOAT_TYPE(rType)) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index fa71009365..3644855094 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -599,7 +599,9 @@ int32_t sclWalkCaseWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* bool *equal = (bool*)colDataGetData(pComp->columnData, rowIdx); if (*equal) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); + bool isNull = colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)); + char *pData = isNull ? NULL : colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)); + colDataAppend(output->columnData, rowIdx, pData, isNull); if (0 == rowIdx && 1 == pCase->numOfRows && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); @@ -611,7 +613,9 @@ int32_t sclWalkCaseWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* } if (pElse) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); + bool isNull = colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)); + char *pData = isNull ? NULL : colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)); + colDataAppend(output->columnData, rowIdx, pData, isNull); if (0 == rowIdx && 1 == pCase->numOfRows && 1 == pElse->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); @@ -657,7 +661,9 @@ int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCe bool *whenValue = (bool*)colDataGetData(pWhen->columnData, (pWhen->numOfRows > 1 ? rowIdx : 0)); if (*whenValue) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0))); + bool isNull = colDataIsNull_s(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)); + char *pData = isNull ? NULL : colDataGetData(pThen->columnData, (pThen->numOfRows > 1 ? rowIdx : 0)); + colDataAppend(output->columnData, rowIdx, pData, isNull); if (preSingle && 0 == rowIdx && 1 == pWhen->numOfRows && 1 == pThen->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); @@ -674,7 +680,9 @@ int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCe } if (pElse) { - colDataAppend(output->columnData, rowIdx, colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)), colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0))); + bool isNull = colDataIsNull_s(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)); + char *pData = isNull ? NULL : colDataGetData(pElse->columnData, (pElse->numOfRows > 1 ? rowIdx : 0)); + colDataAppend(output->columnData, rowIdx, pData, isNull); if (preSingle && 0 == rowIdx && 1 == pElse->numOfRows && totalRows > 1) { SCL_ERR_JRET(sclExtendResRows(output, output, ctx->pBlockList)); From efde22f081ada7ac5f2e8ab07f0278c847a433fb Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 11:59:29 +0800 Subject: [PATCH 033/116] fix: memory leak --- include/common/tmsg.h | 1 + source/common/src/tmsg.c | 1 + source/dnode/mnode/impl/src/mndSubscribe.c | 1 + source/dnode/vnode/src/inc/tq.h | 3 +-- source/dnode/vnode/src/tq/tq.c | 8 +++++--- source/dnode/vnode/src/tq/tqMeta.c | 4 ++-- source/libs/executor/src/executor.c | 18 ++++++++++-------- source/libs/wal/src/walMgmt.c | 8 ++++++++ source/libs/wal/src/walWrite.c | 2 +- 9 files changed, 30 insertions(+), 16 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 3281bca96a..afe54bce0b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2627,6 +2627,7 @@ typedef struct { int32_t tEncodeSTqCheckInfo(SEncoder* pEncoder, const STqCheckInfo* pInfo); int32_t tDecodeSTqCheckInfo(SDecoder* pDecoder, STqCheckInfo* pInfo); +void tDeleteSTqCheckInfo(STqCheckInfo* pInfo); typedef struct { char topic[TSDB_TOPIC_FNAME_LEN]; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index bd8e34a395..fd445ff2ae 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5903,6 +5903,7 @@ int32_t tDecodeSTqCheckInfo(SDecoder *pDecoder, STqCheckInfo *pInfo) { } return 0; } +void tDeleteSTqCheckInfo(STqCheckInfo *pInfo) { taosArrayDestroy(pInfo->colIdList); } int32_t tEncodeDeleteRes(SEncoder *pCoder, const SDeleteRes *pRes) { int32_t nUid = taosArrayGetSize(pRes->uidList); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 71e0b09e02..14adeb0080 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -235,6 +235,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); mInfo("mq rebalance: remove vgId:%d from consumer:%" PRId64, pVgEp->vgId, consumerId); } + taosArrayDestroy(pConsumerEp->vgs); taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); // put into removed taosArrayPush(pOutput->removedConsumers, &consumerId); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index ef54adf0d6..8ae1c8720c 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -88,8 +88,7 @@ typedef struct { STqExecTb execTb; STqExecDb execDb; }; - int32_t numOfCols; // number of out pout column, temporarily used - SSchemaWrapper* pSchemaWrapper; // columns that are involved in query + int32_t numOfCols; // number of out pout column, temporarily used } STqExecHandle; typedef struct { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index f75dce8231..eafbd8464d 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -55,6 +55,7 @@ static void destroySTqHandle(void* data) { STqHandle* pData = (STqHandle*)data; qDestroyTask(pData->execHandle.task); if (pData->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { + taosMemoryFreeClear(pData->execHandle.execCol.qmsg); } else if (pData->execHandle.subType == TOPIC_SUB_TYPE__DB) { tqCloseReader(pData->execHandle.pExecReader); walCloseReader(pData->pWalReader); @@ -80,7 +81,6 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { pTq->pVnode = pVnode; pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK); - taosHashSetFreeFp(pTq->pHandle, destroySTqHandle); taosInitRWLatch(&pTq->pushLock); @@ -88,6 +88,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { taosHashSetFreeFp(pTq->pPushMgr, tqPushEntryFree); pTq->pCheckInfo = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK); + taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo); if (tqMetaOpen(pTq) < 0) { ASSERT(0); @@ -779,6 +780,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL } if (req.newConsumerId == -1) { tqError("vgId:%d, tq invalid rebalance request, new consumerId %" PRId64 "", req.vgId, req.newConsumerId); + taosMemoryFree(req.qmsg); return 0; } STqHandle tqHandle = {0}; @@ -815,8 +817,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL req.qmsg = NULL; pHandle->execHandle.task = - qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, - &pHandle->execHandle.pSchemaWrapper); + qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, NULL); ASSERT(pHandle->execHandle.task); void* scanner = NULL; qExtractStreamScanner(pHandle->execHandle.task, &scanner); @@ -864,6 +865,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); atomic_add_fetch_32(&pHandle->epoch, 1); + taosMemoryFree(req.qmsg); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { // TODO ASSERT(0); diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 27c491c86b..b021c5ee7f 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -305,8 +305,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq) { }; if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { - handle.execHandle.task = qCreateQueueExecTaskInfo( - handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, &handle.execHandle.pSchemaWrapper); + handle.execHandle.task = + qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, NULL); ASSERT(handle.execHandle.task); void* scanner = NULL; qExtractStreamScanner(handle.execHandle.task, &scanner); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 428af19a6c..e561b6e124 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -246,7 +246,9 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n } } - *pSchema = tCloneSSchemaWrapper(((SExecTaskInfo*)pTaskInfo)->schemaInfo.qsw); + if (pSchema) { + *pSchema = tCloneSSchemaWrapper(((SExecTaskInfo*)pTaskInfo)->schemaInfo.qsw); + } return pTaskInfo; } @@ -659,7 +661,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { return pTaskInfo->code; } -int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo *pInfo) { +int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo) { taosWLockLatch(&pTaskInfo->stopInfo.lock); taosArrayPush(pTaskInfo->stopInfo.pStopInfo, pInfo); taosWUnLockLatch(&pTaskInfo->stopInfo.lock); @@ -680,7 +682,7 @@ int32_t stopInfoComp(void const* lp, void const* rp) { return 0; } -void qRemoveTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo *pInfo) { +void qRemoveTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo) { taosWLockLatch(&pTaskInfo->stopInfo.lock); int32_t idx = taosArraySearchIdx(pTaskInfo->stopInfo.pStopInfo, pInfo, stopInfoComp, TD_EQ); if (idx >= 0) { @@ -696,8 +698,8 @@ void qStopTaskOperators(SExecTaskInfo* pTaskInfo) { int32_t num = taosArrayGetSize(pTaskInfo->stopInfo.pStopInfo); for (int32_t i = 0; i < num; ++i) { - SExchangeOpStopInfo *pStop = taosArrayGet(pTaskInfo->stopInfo.pStopInfo, i); - SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pStop->refId); + SExchangeOpStopInfo* pStop = taosArrayGet(pTaskInfo->stopInfo.pStopInfo, i); + SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pStop->refId); if (pExchangeInfo) { tsem_post(&pExchangeInfo->ready); taosReleaseRef(exchangeObjRefPool, pStop->refId); @@ -715,11 +717,11 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo) { } qDebug("%s execTask async killed", GET_TASKID(pTaskInfo)); - + setTaskKilled(pTaskInfo); qStopTaskOperators(pTaskInfo); - + return TSDB_CODE_SUCCESS; } @@ -1178,4 +1180,4 @@ void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { pSendInfo->fp(pSendInfo->param, &buf, pMsg->code); rpcFreeCont(pMsg->pCont); destroySendMsgInfo(pSendInfo); -} \ No newline at end of file +} diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 1a70a3038f..b78d5ca6c1 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -203,6 +203,14 @@ void walClose(SWal *pWal) { pWal->pIdxFile = NULL; taosArrayDestroy(pWal->fileInfoSet); pWal->fileInfoSet = NULL; + + void *pIter = NULL; + while (1) { + pIter = taosHashIterate(pWal->pRefHash, pIter); + if (pIter == NULL) break; + SWalRef *pRef = *(SWalRef **)pIter; + taosMemoryFree(pRef); + } taosHashCleanup(pWal->pRefHash); taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 216dd5fcb1..7c3b4cba30 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -26,7 +26,7 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) { while (1) { pIter = taosHashIterate(pWal->pRefHash, pIter); if (pIter == NULL) break; - SWalRef *pRef = (SWalRef *)pIter; + SWalRef *pRef = *(SWalRef **)pIter; if (pRef->refVer != -1 && pRef->refVer <= ver) { taosHashCancelIterate(pWal->pRefHash, pIter); taosThreadMutexUnlock(&pWal->mutex); From 3bc7916ba3917daecde2550edbacba7bcd4dbaed Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Tue, 15 Nov 2022 12:19:56 +0800 Subject: [PATCH 034/116] docs: optimize media icons --- docs/en/05-get-started/discord.svg | 2 +- docs/en/05-get-started/github.svg | 4 ++-- docs/en/05-get-started/index.md | 22 +++++++++++----------- docs/en/05-get-started/linkedin.svg | 2 +- docs/en/05-get-started/twitter.svg | 2 +- docs/en/05-get-started/youtube.svg | 2 +- docs/zh/05-get-started/index.md | 12 ++++++------ 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/en/05-get-started/discord.svg b/docs/en/05-get-started/discord.svg index 8218e3c3ca..99c02b6fb0 100644 --- a/docs/en/05-get-started/discord.svg +++ b/docs/en/05-get-started/discord.svg @@ -1,4 +1,4 @@ - + + diff --git a/docs/en/05-get-started/index.md b/docs/en/05-get-started/index.md index 373fa6e811..d80ec02268 100644 --- a/docs/en/05-get-started/index.md +++ b/docs/en/05-get-started/index.md @@ -3,11 +3,11 @@ title: Get Started description: This article describes how to install TDengine and test its performance. --- -import github from './github.svg' -import discord from './discord.svg' -import twitter from './twitter.svg' -import youtube from './youtube.svg' -import linkedin from './linkedin.svg' +import GitHubSVG from './github.svg' +import DiscordSVG from './discord.svg' +import TwitterSVG from './twitter.svg' +import YouTubeSVG from './youtube.svg' +import LinkedInSVG from './linkedin.svg' You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud. @@ -23,11 +23,11 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; ### Join TDengine Community - - - - - - + + + + + +
Star GitHub

Star GitHub

Join Discord

Join Discord

Follow Twitter

Follow Twitter

Subscribe YouTube

Subscribe YouTube

Follow LinkedIn

Follow LinkedIn

Star GitHub

Join Discord

Follow Twitter

Subscribe YouTube

Follow LinkedIn

diff --git a/docs/en/05-get-started/linkedin.svg b/docs/en/05-get-started/linkedin.svg index 969c6f03af..1eb6754f63 100644 --- a/docs/en/05-get-started/linkedin.svg +++ b/docs/en/05-get-started/linkedin.svg @@ -1,4 +1,4 @@ - + + +
-
小 T 的二维码 -TDengine 微信视频号 -TDengine 微信公众号 +小 T 的二维码 +TDengine 微信视频号 +TDengine 微信公众号 -加入“物联网大数据技术前沿群”
与大家进行技术交流 -关注 TDengine 微信视频号
收看技术直播与教学视频 -关注 TDengine 微信公众号
阅读核心技术与行业案例文章 +加入“物联网大数据技术前沿群”
与大家进行技术交流 +关注 TDengine 微信视频号
收看技术直播与教学视频 +关注 TDengine 微信公众号
阅读核心技术与行业案例文章 From 2da3cabd58526bc60c12a102ec05f18153762474 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 10:30:54 +0800 Subject: [PATCH 035/116] fix: memory in smworker.c --- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 1 + tests/parallel_test/cases.task | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 1381d4c391..f6942c8114 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -122,6 +122,7 @@ void smStopWorker(SSnodeMgmt *pMgmt) { for (int32_t i = 0; i < taosArrayGetSize(pMgmt->writeWroker); i++) { SMultiWorker *pWorker = taosArrayGetP(pMgmt->writeWroker, i); tMultiWorkerCleanup(pWorker); + taosMemoryFree(pWorker); } taosArrayDestroy(pMgmt->writeWroker); tSingleWorkerCleanup(&pMgmt->streamWorker); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index fac4210d88..2e9b942df4 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -98,7 +98,7 @@ ,,y,script,./test.sh -f tsim/parser/columnValue_int.sim ,,y,script,./test.sh -f tsim/parser/columnValue_smallint.sim ,,y,script,./test.sh -f tsim/parser/columnValue_tinyint.sim -,,,script,./test.sh -f tsim/parser/columnValue_unsign.sim +,,y,script,./test.sh -f tsim/parser/columnValue_unsign.sim ,,y,script,./test.sh -f tsim/parser/commit.sim ,,y,script,./test.sh -f tsim/parser/condition.sim ,,y,script,./test.sh -f tsim/parser/constCol.sim @@ -140,7 +140,7 @@ ,,,script,./test.sh -f tsim/parser/nestquery.sim ,,y,script,./test.sh -f tsim/parser/null_char.sim ,,y,script,./test.sh -f tsim/parser/precision_ns.sim -,,,script,./test.sh -f tsim/parser/projection_limit_offset.sim +,,y,script,./test.sh -f tsim/parser/projection_limit_offset.sim ,,y,script,./test.sh -f tsim/parser/regex.sim ,,y,script,./test.sh -f tsim/parser/select_across_vnodes.sim ,,y,script,./test.sh -f tsim/parser/select_distinct_tag.sim @@ -172,7 +172,7 @@ ,,,script,./test.sh -f tsim/query/session.sim ,,,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim -,,,script,./test.sh -f tsim/snode/basic1.sim +,,y,script,./test.sh -f tsim/snode/basic1.sim ,,,script,./test.sh -f tsim/mnode/basic1.sim ,,,script,./test.sh -f tsim/mnode/basic2.sim ,,,script,./test.sh -f tsim/mnode/basic3.sim @@ -208,12 +208,12 @@ ,,y,script,./test.sh -f tsim/table/tinyint.sim ,,y,script,./test.sh -f tsim/table/vgroup.sim ,,,script,./test.sh -f tsim/stream/basic0.sim -g -,,,script,./test.sh -f tsim/stream/basic1.sim +,,y,script,./test.sh -f tsim/stream/basic1.sim ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim -,,,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim +,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim ,,,script,./test.sh -f tsim/stream/distributeSession0.sim @@ -222,11 +222,11 @@ ,,,script,./test.sh -f tsim/stream/state0.sim ,,,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,,script,./test.sh -f tsim/stream/triggerSession0.sim -,,,script,./test.sh -f tsim/stream/partitionby.sim -,,,script,./test.sh -f tsim/stream/partitionby1.sim +,,y,script,./test.sh -f tsim/stream/partitionby.sim +,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/schedSnode.sim ,,,script,./test.sh -f tsim/stream/windowClose.sim -,,,script,./test.sh -f tsim/stream/ignoreExpiredData.sim +,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim ,,,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim From a57efc49b4520a566f539a6e3c139023e017c82a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 13:43:30 +0800 Subject: [PATCH 036/116] fix: memory leak of sync timer --- source/dnode/mnode/impl/src/mndSync.c | 1 + source/libs/sync/inc/syncInt.h | 2 +- source/libs/sync/src/syncMain.c | 34 ++++++++------------------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 450d7a30ed..4dd7e070b3 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -349,6 +349,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { } rpcFreeCont(req.pCont); + req.pCont = NULL; if (code != 0) { mError("trans:%d, failed to propose, code:0x%x", pMgmt->transId, code); return code; diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index e81f63d871..485186fda6 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -70,7 +70,7 @@ typedef struct SSyncTimer { uint64_t counter; int32_t timerMS; SRaftId destId; - void* pData; + SSyncHbTimerData hbData; } SSyncTimer; typedef struct SElectTimer { diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index e802f60f30..4fa4b7e49f 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -385,7 +385,7 @@ bool syncIsReadyForRead(int64_t rid) { if (!pSyncNode->pLogStore->syncLogIsEmpty(pSyncNode->pLogStore)) { SSyncRaftEntry* pEntry = NULL; int32_t code = pSyncNode->pLogStore->syncLogGetEntry( - pSyncNode->pLogStore, pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore), &pEntry); + pSyncNode->pLogStore, pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore), &pEntry); if (code == 0 && pEntry != NULL) { if (pEntry->originalRpcType == TDMT_SYNC_NOOP && pEntry->term == pSyncNode->pRaftStore->currentTerm) { ready = true; @@ -442,7 +442,9 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) { pMsg->newLeaderId.vgId = pSyncNode->vgId; pMsg->newNodeInfo = newLeader; - return syncNodePropose(pSyncNode, &rpcMsg, false); + int32_t ret = syncNodePropose(pSyncNode, &rpcMsg, false); + rpcFreeCont(rpcMsg.pCont); + return ret; } SSyncState syncGetState(int64_t rid) { @@ -645,13 +647,12 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { int32_t ret = 0; if (syncIsInit()) { - SSyncHbTimerData* pData = taosMemoryMalloc(sizeof(SSyncHbTimerData)); + SSyncHbTimerData* pData = &pSyncTimer->hbData; pData->pSyncNode = pSyncNode; pData->pTimer = pSyncTimer; pData->destId = pSyncTimer->destId; pData->logicClock = pSyncTimer->logicClock; - pSyncTimer->pData = pData; taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer); } else { sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId); @@ -664,7 +665,6 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { atomic_add_fetch_64(&pSyncTimer->logicClock, 1); taosTmrStop(pSyncTimer->pTimer); pSyncTimer->pTimer = NULL; - // taosMemoryFree(pSyncTimer->pData); return ret; } @@ -1086,15 +1086,8 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) { int32_t ret = 0; if (syncIsInit()) { pSyncNode->electTimerMS = ms; - - SElectTimer* pElectTimer = taosMemoryMalloc(sizeof(SElectTimer)); - pElectTimer->logicClock = pSyncNode->electTimerLogicClock; - pElectTimer->pSyncNode = pSyncNode; - pElectTimer->pData = NULL; - - taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pElectTimer, syncEnv()->pTimerManager, + taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager, &pSyncNode->pElectTimer); - } else { sError("vgId:%d, start elect timer error, sync env is stop", pSyncNode->vgId); } @@ -1827,20 +1820,17 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { } static void syncNodeEqElectTimer(void* param, void* tmrId) { + SSyncNode* pNode = param; + if (!syncIsInit()) return; - - SElectTimer* pElectTimer = param; - SSyncNode* pNode = pElectTimer->pSyncNode; - if (pNode == NULL) return; if (pNode->syncEqMsg == NULL) return; SRpcMsg rpcMsg = {0}; - int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pElectTimer->logicClock, pNode->electTimerMS, pNode); - + int32_t code = + syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pNode->electTimerLogicClock, pNode->electTimerMS, pNode); if (code != 0) { sError("failed to build elect msg"); - taosMemoryFree(pElectTimer); return; } @@ -1851,12 +1841,8 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); - taosMemoryFree(pElectTimer); - return; } - taosMemoryFree(pElectTimer); - #if 0 // reset timer ms if (syncIsInit() && pNode->electBaseLine > 0) { From 6c1361ef80e436aa3ecc03526d700e93a0833e69 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 15 Nov 2022 13:59:00 +0800 Subject: [PATCH 037/116] fix: null pointer check when invoke memcpy --- source/libs/executor/src/tsimplehash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 9fbe94200c..484d917069 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -93,7 +93,7 @@ static SHNode *doCreateHashNode(const void *key, size_t keyLen, const void *data pNewNode->keyLen = keyLen; pNewNode->dataLen = dataLen; pNewNode->next = NULL; - memcpy(GET_SHASH_NODE_DATA(pNewNode), data, dataLen); + if (data) memcpy(GET_SHASH_NODE_DATA(pNewNode), data, dataLen); memcpy(GET_SHASH_NODE_KEY(pNewNode, dataLen), key, keyLen); return pNewNode; } @@ -203,7 +203,7 @@ int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, size_t keyLen, cons pNewNode->next = pHashObj->hashList[slot]; pHashObj->hashList[slot] = pNewNode; atomic_add_fetch_64(&pHashObj->size, 1); - } else { // update data + } else if (data) { // update data memcpy(GET_SHASH_NODE_DATA(pNode), data, dataLen); } From b0ea0c0d7939e00fab03129dd034a92bd91162ce Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 14:04:44 +0800 Subject: [PATCH 038/116] test: add asan case --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 2e9b942df4..2369b238ea 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -242,8 +242,8 @@ ,,y,script,./test.sh -f tsim/stream/fillIntervalValue.sim ,,y,script,./test.sh -f tsim/trans/lossdata1.sim ,,y,script,./test.sh -f tsim/trans/create_db.sim -,,,script,./test.sh -f tsim/tmq/basic1.sim -,,,script,./test.sh -f tsim/tmq/basic2.sim +,,y,script,./test.sh -f tsim/tmq/basic1.sim +,,y,script,./test.sh -f tsim/tmq/basic2.sim ,,,script,./test.sh -f tsim/tmq/basic3.sim ,,,script,./test.sh -f tsim/tmq/basic4.sim ,,,script,./test.sh -f tsim/tmq/basic1Of2Cons.sim From ccd3bb20a74aa56efbf6f01844b0248f66885bd4 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 14:10:46 +0800 Subject: [PATCH 039/116] fix: reset cache when table is dropped --- source/dnode/vnode/src/tq/tqRead.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 48e69f8f4d..45873f2744 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -425,6 +425,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table", pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer); /*ASSERT(0);*/ + pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; } @@ -435,6 +436,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->msgIter.uid, pReader->cachedSchemaVer); /*ASSERT(0);*/ + pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; } From 76cd3122d1e848ce12cc78ac3a8e6f945e666b00 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 14:28:20 +0800 Subject: [PATCH 040/116] fix: memory leak --- source/common/src/tmsg.c | 4 ++++ source/dnode/mnode/impl/src/mndSubscribe.c | 4 ++++ source/dnode/vnode/src/tq/tq.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index fd445ff2ae..4485e8df0c 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -6027,9 +6027,13 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { void tDeleteSMqDataRsp(SMqDataRsp *pRsp) { taosArrayDestroy(pRsp->blockDataLen); + pRsp->blockDataLen = NULL; taosArrayDestroyP(pRsp->blockData, (FDelete)taosMemoryFree); + pRsp->blockData = NULL; taosArrayDestroyP(pRsp->blockSchema, (FDelete)tDeleteSSchemaWrapper); + pRsp->blockSchema = NULL; taosArrayDestroyP(pRsp->blockTbName, (FDelete)taosMemoryFree); + pRsp->blockTbName = NULL; } int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const STaosxRsp *pRsp) { diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 14adeb0080..fd79846104 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -471,8 +471,12 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu pConsumerNew->updateType = CONSUMER_UPDATE__TOUCH; mndReleaseConsumer(pMnode, pConsumerOld); if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) { + tDeleteSMqConsumerObj(pConsumerNew); + taosMemoryFree(pConsumerNew); goto REB_FAIL; } + tDeleteSMqConsumerObj(pConsumerNew); + taosMemoryFree(pConsumerNew); } // 3.2 set new consumer consumerNum = taosArrayGetSize(pOutput->newConsumers); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index eafbd8464d..1cc771dbb4 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -68,6 +68,7 @@ static void destroySTqHandle(void* data) { static void tqPushEntryFree(void* data) { STqPushEntry* p = *(void**)data; + tDeleteSMqDataRsp(&p->dataRsp); taosMemoryFree(p); } @@ -576,8 +577,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return 0; } } - taosWUnLockLatch(&pTq->pushLock); #endif + taosWUnLockLatch(&pTq->pushLock); if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { code = -1; From 82baf3aa76a4b30733b2a7ae6ff171e2a4d6be17 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 15 Nov 2022 14:37:10 +0800 Subject: [PATCH 041/116] fix test cases --- tests/system-test/2-query/csum.py | 32 +- tests/system-test/2-query/function_diff.py | 26 +- tests/system-test/2-query/irate.py | 2 +- tests/system-test/2-query/mavg.py | 21 +- tests/system-test/2-query/max_partition.py | 12 +- tests/system-test/2-query/nestedQuery.py | 3924 ++++++++++---------- tests/system-test/2-query/stablity.py | 3072 +++++++-------- tests/system-test/2-query/stablity_1.py | 58 +- 8 files changed, 3574 insertions(+), 3573 deletions(-) diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py index e933eb54cb..1e6b26ada0 100644 --- a/tests/system-test/2-query/csum.py +++ b/tests/system-test/2-query/csum.py @@ -24,7 +24,7 @@ from util.cases import * from util.sql import * from util.dnodes import * - +msec_per_min=60 * 1000 class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -54,7 +54,7 @@ class TDTestCase: if tdSql.queryRows == 0: tdSql.query(self.csum_query_form( - col=col, alias=alias, table_expr=table_expr, condition=condition + col=col, alias=alias, table_expr=table_expr.replace("csum", "ts, csum"), condition=condition )) print(f"case in {line}: ", end='') tdSql.checkRows(0) @@ -132,7 +132,7 @@ class TDTestCase: pre_result = np.array(pre_result, dtype = 'int64') pre_csum = np.cumsum(pre_result)[offset_val:] tdSql.query(self.csum_query_form( - col=col, alias=alias, table_expr=table_expr, condition=condition + col=col, alias=alias, table_expr=table_expr.replace("csum", "ts,csum"), condition=condition )) for i in range(tdSql.queryRows): @@ -163,7 +163,7 @@ class TDTestCase: self.checkcsum(**case6) # case7~8: nested query - case7 = {"table_expr": "(select c1 from db.stb1 order by ts, tbname )"} + case7 = {"table_expr": "(select ts,c1 from db.stb1 order by ts, tbname )"} self.checkcsum(**case7) case8 = {"table_expr": "(select csum(c1) c1 from db.t1)"} self.checkcsum(**case8) @@ -315,19 +315,19 @@ class TDTestCase: for j in range(data_row): tdSql.execute( f"insert into t{i} values (" - f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " + f"{basetime + (j+1)*10 + i * msec_per_min}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, " f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )" ) tdSql.execute( f"insert into t{i} values (" - f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " + f"{basetime - (j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, " f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )" ) tdSql.execute( - f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" + f"insert into tt{i} values ( {basetime-(j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)} )" ) pass @@ -366,26 +366,26 @@ class TDTestCase: tdLog.printNoPrefix("######## insert only NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5 + i * msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5 + i * msec_per_min})") self.csum_current_query() self.csum_error_query() tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):") self.csum_test_table(tbnum) tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") + f"({nowtime - (per_table_rows + 1) * 10 + i * msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") + f"({nowtime - (per_table_rows + 2) * 10 + i * msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") self.csum_current_query() self.csum_error_query() tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):") self.csum_test_table(tbnum) tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") + f"({nowtime - (per_table_rows + 1) * 10 + i * msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") + f"({nowtime - (per_table_rows + 2) * 10 + i * msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") self.csum_current_query() self.csum_error_query() @@ -398,9 +398,9 @@ class TDTestCase: tdLog.printNoPrefix("######## insert data mix with NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime-(per_table_rows+3)*10})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime+(per_table_rows+3)*10})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + i * msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime-(per_table_rows+3)*10 + i * msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime+(per_table_rows+3)*10 + i * msec_per_min})") self.csum_current_query() self.csum_error_query() diff --git a/tests/system-test/2-query/function_diff.py b/tests/system-test/2-query/function_diff.py index 4abef03037..c3f3789a69 100644 --- a/tests/system-test/2-query/function_diff.py +++ b/tests/system-test/2-query/function_diff.py @@ -24,7 +24,7 @@ from util.cases import * from util.sql import * from util.dnodes import * - +msec_per_min=60*1000 class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -312,19 +312,19 @@ class TDTestCase: for j in range(data_row): tdSql.execute( f"insert into db.t{i} values (" - f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " + f"{basetime + (j+1)*10 + i* msec_per_min}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, " f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )" ) tdSql.execute( f"insert into db.t{i} values (" - f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " + f"{basetime - (j+1) * 10 + i* msec_per_min}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, " f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )" ) tdSql.execute( - f"insert into db.tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" + f"insert into db.tt{i} values ( {basetime-(j+1) * 10 + i* msec_per_min}, {random.randint(1, 200)} )" ) pass @@ -394,26 +394,26 @@ class TDTestCase: tdLog.printNoPrefix("######## insert only NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime - 5 + i* msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + 5 + i* msec_per_min})") self.diff_current_query() self.diff_error_query() tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):") self.diff_test_table(tbnum) tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") + f"({nowtime - (per_table_rows + 1) * 10 + i* msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") + f"({nowtime - (per_table_rows + 2) * 10 + i* msec_per_min}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})") self.diff_current_query() self.diff_error_query() tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):") self.diff_test_table(tbnum) tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") + f"({nowtime - (per_table_rows + 1) * 10 + i* msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})") tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values " - f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") + f"({nowtime - (per_table_rows + 2) * 10 + i* msec_per_min}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})") self.diff_current_query() self.diff_error_query() @@ -426,9 +426,9 @@ class TDTestCase: tdLog.printNoPrefix("######## insert data mix with NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime-(per_table_rows+3)*10})") - tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime+(per_table_rows+3)*10})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime + i* msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime-(per_table_rows+3)*10 + i* msec_per_min})") + tdSql.execute(f"insert into db.t{i}(ts) values ({nowtime+(per_table_rows+3)*10 + i* msec_per_min})") self.diff_current_query() self.diff_error_query() diff --git a/tests/system-test/2-query/irate.py b/tests/system-test/2-query/irate.py index cee595d186..8aa2b3d420 100644 --- a/tests/system-test/2-query/irate.py +++ b/tests/system-test/2-query/irate.py @@ -34,7 +34,7 @@ class TDTestCase: ts = self.ts for row in range(rownums): - ts = self.ts + time_step*row + ts = self.ts + (time_step) * row + tbnum * 60 * 1000 c1 = random.randint(0,1000) c2 = random.randint(0,100000) c3 = random.randint(0,125) diff --git a/tests/system-test/2-query/mavg.py b/tests/system-test/2-query/mavg.py index ec4a087a8e..f76980106d 100644 --- a/tests/system-test/2-query/mavg.py +++ b/tests/system-test/2-query/mavg.py @@ -26,6 +26,7 @@ from util.sql import * from util.dnodes import * dbname = 'db' +msec_per_min = 60 * 1000 class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -327,7 +328,7 @@ class TDTestCase: self.checkmavg(**case6) # case7~8: nested query - case7 = {"table_expr": f"(select c1 from {dbname}.stb1)"} + case7 = {"table_expr": f"(select ts, c1 from {dbname}.stb1)"} self.checkmavg(**case7) # case8 = {"table_expr": f"(select _c0, mavg(c1, 1) c1 from {dbname}.stb1 group by tbname)"} # self.checkmavg(**case8) @@ -568,19 +569,19 @@ class TDTestCase: for j in range(data_row): tdSql.execute( f"insert into {dbname}.t{i} values (" - f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " + f"{basetime + (j+1)*10 + i * msec_per_min}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, " f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, " f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )" ) tdSql.execute( f"insert into {dbname}.t{i} values (" - f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " + f"{basetime - (j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, " f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, " f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )" ) tdSql.execute( - f"insert into {dbname}.tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )" + f"insert into {dbname}.tt{i} values ( {basetime-(j+1) * 10 + i * msec_per_min}, {random.randint(1, 200)} )" ) pass @@ -619,8 +620,8 @@ class TDTestCase: tdLog.printNoPrefix("######## insert only NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime - 5})") - tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + 5})") + tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime - 5 + i * msec_per_min})") + tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + 5 + i * msec_per_min})") self.mavg_current_query() self.mavg_error_query() @@ -651,9 +652,9 @@ class TDTestCase: tdLog.printNoPrefix("######## insert data mix with NULL test:") for i in range(tbnum): - tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime})") - tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime-(per_table_rows+3)*10})") - tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime+(per_table_rows+3)*10})") + tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime + i * msec_per_min})") + tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime-(per_table_rows+3)*10 + i * msec_per_min})") + tdSql.execute(f"insert into {dbname}.t{i}(ts) values ({nowtime+(per_table_rows+3)*10 + i * msec_per_min})") self.mavg_current_query() self.mavg_error_query() @@ -676,7 +677,7 @@ class TDTestCase: tdSql.checkRows(4) def mavg_support_stable(self): - tdSql.query(f" select mavg(1,3) from {dbname}.stb1 ") + tdSql.query(f"select mavg(1,3) from {dbname}.stb1 ") tdSql.checkRows(68) tdSql.checkData(0,0,1.000000000) tdSql.query(f"select mavg(c1,3) from {dbname}.stb1 partition by tbname ") diff --git a/tests/system-test/2-query/max_partition.py b/tests/system-test/2-query/max_partition.py index a9b7a14eb0..b14bc649dd 100644 --- a/tests/system-test/2-query/max_partition.py +++ b/tests/system-test/2-query/max_partition.py @@ -20,15 +20,15 @@ class TDTestCase: for i in range(tb_nums): tbname = f"{dbname}.sub_{stb_name}_{i}" - ts = self.ts + i*10000 + ts = self.ts + i*1000*120 tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") for row in range(row_nums): - ts = self.ts + row*1000 + ts = ts + row*1000 tdSql.execute(f"insert into {tbname} values({ts} , {row} , {row} , {row} , {row} , 1 , 2 , 'true' , 'binary_{row}' , 'nchar_{row}' , {row} , {row} , 1 ,2 )") for null in range(5): - ts = self.ts + row_nums*1000 + null*1000 + ts = ts + row_nums*1000 + null*1000 tdSql.execute(f"insert into {tbname} values({ts} , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )") def basic_query(self, dbname="db"): @@ -160,13 +160,13 @@ class TDTestCase: tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname interval(10s) slimit 5 soffset 1 ") tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname interval(10s)") - tdSql.checkRows(self.row_nums*2) + tdSql.checkRows(self.row_nums*10) tdSql.query(f"select unique(c1) from {dbname}.stb partition by tbname order by tbname") tdSql.query(f"select tbname , count(c1) from {dbname}.sub_stb_1 partition by tbname interval(10s)") tdSql.checkData(0,0,'sub_stb_1') - tdSql.checkData(0,1,self.row_nums) + tdSql.checkData(0,1, 4) tdSql.query(f"select c1 , mavg(c1 ,2 ) from {dbname}.stb partition by c1") tdSql.checkRows(90) @@ -193,7 +193,7 @@ class TDTestCase: tdSql.query(f"select c1 , DERIVATIVE(c1,2,1) from {dbname}.stb partition by c1 order by c1") tdSql.checkRows(90) # bug need fix - tdSql.checkData(0,1,None) + tdSql.checkData(0,1,0.0) tdSql.query(f"select tbname , max(c1) from {dbname}.stb partition by tbname order by tbname slimit 5 soffset 0 ") diff --git a/tests/system-test/2-query/nestedQuery.py b/tests/system-test/2-query/nestedQuery.py index b1008efa86..034ab8dcdc 100755 --- a/tests/system-test/2-query/nestedQuery.py +++ b/tests/system-test/2-query/nestedQuery.py @@ -24,10 +24,10 @@ from util.dnodes import tdDnodes from util.dnodes import * class TDTestCase: - updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , + updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143} - + def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) @@ -36,13 +36,13 @@ class TDTestCase: 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.num = 10 self.fornum = 15 - + self.db_nest = "nest" self.dropandcreateDB_random("%s" %self.db_nest, 1) - + # regular column select #q_select= ['ts' , '*' , 'q_int', 'q_bigint' , 'q_bigint' , 'q_smallint' , 'q_tinyint' , 'q_bool' , 'q_binary' , 'q_nchar' ,'q_float' , 'q_double' ,'q_ts '] self.q_select= ['q_int', 'q_bigint' , 'q_bigint' , 'q_smallint' , 'q_tinyint' , 'q_bool' , 'q_binary' , 'q_nchar' ,'q_float' , 'q_double' ,'q_ts ', 'q_int_null ', 'q_bigint_null ' , 'q_bigint_null ' , 'q_smallint_null ' , 'q_tinyint_null ' , 'q_bool_null ' , 'q_binary_null ' , 'q_nchar_null ' ,'q_float_null ' , 'q_double_null ' ,'q_ts_null '] @@ -55,11 +55,11 @@ class TDTestCase: self.qt_select= self.q_select + self.t_select # distinct regular column select - self.dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' , + self.dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' , 'distinct q_bool' , 'distinct q_binary' , 'distinct q_nchar' ,'distinct q_float' , 'distinct q_double' ,'distinct q_ts '] # distinct tag column select - self.dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' , + self.dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' , 'distinct t_bool' , 'distinct t_binary' , 'distinct t_nchar' ,'distinct t_float' , 'distinct t_double' ,'distinct t_ts '] # distinct regular and tag column select @@ -70,13 +70,13 @@ class TDTestCase: self.s_s_select= ['tbname' , '_rowts' , '_c0', '_C0' ] self.unionall_or_union= [ ' union ' , ' union all ' ] - # regular column where + # regular column where self.q_where = ['ts < now +1s','q_bigint >= -9223372036854775807 and q_bigint <= 9223372036854775807', 'q_int <= 2147483647 and q_int >= -2147483647', - 'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308', - 'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' , + 'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308', + 'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' , 'q_bool = true or q_bool = false' , 'q_bool in (0 , 1)' , 'q_bool in ( true , false)' , 'q_bool = 0 or q_bool = 1', - 'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767', - 'q_bigint not between 9223372036854775807 and -9223372036854775807','q_int not between 2147483647 and -2147483647','q_smallint not between 32767 and -32767', + 'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767', + 'q_bigint not between 9223372036854775807 and -9223372036854775807','q_int not between 2147483647 and -2147483647','q_smallint not between 32767 and -32767', 'q_tinyint between -127 and 127 ','q_float >= -3.4E38 ','q_float <= 3.4E38 ','q_double >= -1.7E308 ', 'q_double <= 1.7E308 ','q_float between -3.4E38 and 3.4E38 ','q_double between -1.7E308 and 1.7E308 ' ,'q_float not between 3.4E38 and -3.4E38 ','q_double not between 1.7E308 and -1.7E308 ', 'q_float is not null ' ,'q_double is not null ' ,'q_binary match \'binary\' ','q_binary nmatch \'binarynchar\' ','q_nchar match \'nchar\' ','q_nchar nmatch \'binarynchar\' ', @@ -89,38 +89,38 @@ class TDTestCase: 't1.q_smallint >= -32767 and t1.q_smallint <= 32767 and t2.q_smallint >= -32767 and t2.q_smallint <= 32767', 't1.q_tinyint >= -127 and t1.q_tinyint <= 127 and t2.q_tinyint >= -127 and t2.q_tinyint <= 127', 't1.q_float >= - 1.7E308 and t1.q_float <= 1.7E308 and t2.q_float >= - 1.7E308 and t2.q_float <= 1.7E308', - 't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308', - 't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' , - 't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' , - 't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' , + 't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308', + 't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' , + 't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' , + 't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' , 't1.q_bigint between -9223372036854775807 and 9223372036854775807 and t2.q_bigint between -9223372036854775807 and 9223372036854775807', 't1.q_int between -2147483647 and 2147483647 and t2.q_int between -2147483647 and 2147483647', - 't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767', + 't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767', 't1.q_tinyint between -127 and 127 and t2.q_tinyint between -127 and 127 ','t1.q_float between -1.7E308 and 1.7E308 and t2.q_float between -1.7E308 and 1.7E308', 't1.q_double between -1.7E308 and 1.7E308 and t2.q_double between -1.7E308 and 1.7E308', 't1.q_bigint not between 9223372036854775807 and -9223372036854775807 and t2.q_bigint not between 9223372036854775807 and -9223372036854775807', 't1.q_int not between 2147483647 and -2147483647 and t2.q_int not between 2147483647 and -2147483647', - 't1.q_smallint not between 32767 and -32767 and t2.q_smallint not between 32767 and -32767', + 't1.q_smallint not between 32767 and -32767 and t2.q_smallint not between 32767 and -32767', 't1.q_tinyint not between 127 and -127 and t2.q_tinyint not between 127 and -127 ','t1.q_float not between -1.7E308 and -1.7E308 and t2.q_float not between 1.7E308 and -1.7E308', 't1.q_double not between 1.7E308 and -1.7E308 and t2.q_double not between 1.7E308 and -1.7E308'] #TD-6201 ,'t1.q_bool between 0 and 1 or t2.q_bool between 0 and 1'] #'t1.q_bool = true and t1.q_bool = false and t2.q_bool = true and t2.q_bool = false' , 't1.q_bool = 0 and t1.q_bool = 1 and t2.q_bool = 0 and t2.q_bool = 1' , - self.q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' , - '(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' , + self.q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' , + '(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' , '(t1.q_bool in (0 , 1) or t2.q_bool in (0 , 1))' , '(t1.q_bool in ( true , false) or t2.q_bool in ( true , false))' , '(t1.q_bool = 0 or t1.q_bool = 1 or t2.q_bool = 0 or t2.q_bool = 1)' , '(t1.q_bigint between -9223372036854775807 and 9223372036854775807 or t2.q_bigint between -9223372036854775807 and 9223372036854775807)', '(t1.q_int between -2147483647 and 2147483647 or t2.q_int between -2147483647 and 2147483647)', - '(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)', + '(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)', '(t1.q_tinyint between -127 and 127 or t2.q_tinyint between -127 and 127 )','(t1.q_float between -1.7E308 and 1.7E308 or t2.q_float between -1.7E308 and 1.7E308)', '(t1.q_double between -1.7E308 and 1.7E308 or t2.q_double between -1.7E308 and 1.7E308)'] # tag column where self.t_where = ['ts < now +1s','t_bigint >= -9223372036854775807 and t_bigint <= 9223372036854775807','t_int <= 2147483647 and t_int >= -2147483647', 't_smallint >= -32767 and t_smallint <= 32767','q_tinyint >= -127 and t_tinyint <= 127','t_float >= -1.7E308 and t_float <= 1.7E308', - 't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' , + 't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' , 't_bool = true or t_bool = false' , 't_bool in (0 , 1)' , 't_bool in ( true , false)' , 't_bool = 0 or t_bool = 1', - 't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767', + 't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767', 't_tinyint between -127 and 127 ','t_float between -1.7E308 and 1.7E308','t_double between -1.7E308 and 1.7E308', 't_binary match \'binary\' ','t_binary nmatch \'binarynchar\' ','t_nchar match \'nchar\' ','t_nchar nmatch \'binarynchar\' ', 't_binary like \'binary%\' ','t_nchar like \'nchar%\' ','(t_binary like \'binary%\' or t_nchar = \'0\' ) ','(t_nchar like \'nchar%\' or t_binary = \'0\' ) ',] @@ -132,30 +132,30 @@ class TDTestCase: 't1.t_smallint >= -32767 and t1.t_smallint <= 32767 and t2.t_smallint >= -32767 and t2.t_smallint <= 32767', 't1.t_tinyint >= -127 and t1.t_tinyint <= 127 and t2.t_tinyint >= -127 and t2.t_tinyint <= 127', 't1.t_float >= -1.7E308 and t1.t_float <= 1.7E308 and t2.t_float >= -1.7E308 and t2.t_float <= 1.7E308', - 't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308', - '(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' , - '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , + 't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308', + '(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' , + '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , 't1.t_bool in (0 , 1) and t2.t_bool in (0 , 1)' , 't1.t_bool in ( true , false) and t2.t_bool in ( true , false)' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)', 't1.t_bigint between -9223372036854775807 and 9223372036854775807 and t2.t_bigint between -9223372036854775807 and 9223372036854775807', 't1.t_int between -2147483647 and 2147483647 and t2.t_int between -2147483647 and 2147483647', - 't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767', + 't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767', '(t1.t_tinyint between -127 and 127 and t2.t_tinyint between -127 and 127) ','t1.t_float between -1.7E308 and 1.7E308 and t2.t_float between -1.7E308 and 1.7E308', '(t1.t_double between -1.7E308 and 1.7E308 and t2.t_double between -1.7E308 and 1.7E308)'] #TD-6201,'t1.t_bool between 0 and 1 or t2.q_bool between 0 and 1'] - self.t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' , - '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , + self.t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' , + '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , '(t1.t_bool in (0 , 1) or t2.t_bool in (0 , 1))' , '(t1.t_bool in ( true , false) or t2.t_bool in ( true , false))' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)', '(t1.t_bigint between -9223372036854775807 and 9223372036854775807 or t2.t_bigint between -9223372036854775807 and 9223372036854775807)', '(t1.t_int between -2147483647 and 2147483647 or t2.t_int between -2147483647 and 2147483647)', - '(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)', + '(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)', '(t1.t_tinyint between -127 and 127 or t2.t_tinyint between -127 and 127 )','(t1.t_float between -1.7E308 and 1.7E308 or t2.t_float between -1.7E308 and 1.7E308)', '(t1.t_double between -1.7E308 and 1.7E308 or t2.t_double between -1.7E308 and 1.7E308)'] - + # self.t_u_where = ['t1.ts < now +1s'] # 超级表tag不支持,暂时注掉 # self.t_u_or_where = ['(t1.q_bool in (0 , 1))'] #超级表tag不支持,暂时注掉 - # regular and tag column where + # regular and tag column where self.qt_where = self.q_where + self.t_where #self.qt_where = self.q_where #超级表tag不支持,暂时注掉 self.qt_u_where = self.q_u_where + self.t_u_where @@ -171,88 +171,88 @@ class TDTestCase: self.session_where = ['session(ts,10a)' , 'session(ts,10s)', 'session(ts,10m)' , 'session(ts,10h)','session(ts,10d)' , 'session(ts,10w)'] self.session_u_where = ['session(t1.ts,10a)' , 'session(t1.ts,10s)', 'session(t1.ts,10m)' , 'session(t1.ts,10h)','session(t1.ts,10d)' , 'session(t1.ts,10w)', 'session(t2.ts,10a)' , 'session(t2.ts,10s)', 'session(t2.ts,10m)' , 'session(t2.ts,10h)','session(t2.ts,10d)' , 'session(t2.ts,10w)'] - + self.fill_where = ['FILL(NONE)','FILL(PREV)','FILL(NULL)','FILL(LINEAR)','FILL(NEXT)','FILL(VALUE, 1.23)'] - + self.state_window = ['STATE_WINDOW(q_tinyint)','STATE_WINDOW(q_bigint)','STATE_WINDOW(q_int)','STATE_WINDOW(q_bool)','STATE_WINDOW(q_smallint)'] self.state_u_window = ['STATE_WINDOW(t1.q_tinyint)','STATE_WINDOW(t1.q_bigint)','STATE_WINDOW(t1.q_int)','STATE_WINDOW(t1.q_bool)','STATE_WINDOW(t1.q_smallint)', 'STATE_WINDOW(t2.q_tinyint)','STATE_WINDOW(t2.q_bigint)','STATE_WINDOW(t2.q_int)','STATE_WINDOW(t2.q_bool)','STATE_WINDOW(t2.q_smallint)'] - # order by where + # order by where self.order_where = ['order by ts' , 'order by ts asc'] self.order_u_where = ['order by t1.ts' , 'order by t1.ts asc' , 'order by t2.ts' , 'order by t2.ts asc'] self.order_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' ] self.orders_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' , 'order by ts,loc' , 'order by ts,loc asc' , 'order by ts,loc desc'] - - self.group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', + + self.group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', 'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint', 'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' , - 'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', + 'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint', 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double '] - self.group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', + self.group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', 'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint', 'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' , - 'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', + 'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint', 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ', - 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', + 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', 'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint', 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' , - 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', + 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint', - 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] - - self.group_only_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', + 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] + + self.group_only_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', 'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint', 'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' ] - self.group_only_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', + self.group_only_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', 'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint', 'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' , - 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', + 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', 'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint', - 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ] - - self.partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', + 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ] + + self.partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint', 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double '] - self.partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', + self.partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint', 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ', - 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', + 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint', - 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] + 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] - - self.group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint', + + self.group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint', 'group by tbname,q_float', 'group by tbname,q_double' , 'group by tbname,q_binary', 'group by tbname,q_nchar', 'group by tbname,q_bool' ,'group by tbname ,q_bigint', 'group by tbname,q_binary ,q_nchar ,q_bool' , 'group by tbname,q_int ,q_smallint ,q_tinyint' , 'group by tbname,q_float ,q_double ' , - 'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', + 'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint', 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double '] - self.group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint', + self.group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint', 'group by t1.q_float', 'group by t1.q_double' , 'group by t1.q_binary', 'group by t1.q_nchar', 'group by t1.q_bool' ,'group by t1.q_bigint', 'group by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'group by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'group by t1.q_float ,t1.q_double ' , - 'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', + 'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint', 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ', - 'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint', + 'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint', 'group by t2.q_float', 'group by t2.q_double' , 'group by t2.q_binary', 'group by t2.q_nchar', 'group by t2.q_bool' ,'group by t2.q_bigint', 'group by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'group by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'group by t2.q_float ,t2.q_double ' , - 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', + 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint', - 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] - - self.partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', + 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] + + self.partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint', 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double '] - self.partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', + self.partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint', 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ', - 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', + 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint', - 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] - + 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] + self.having_support = ['having count(q_int) > 0','having count(q_bigint) > 0','having count(q_smallint) > 0','having count(q_tinyint) > 0','having count(q_float) > 0','having count(q_double) > 0','having count(q_bool) > 0', 'having avg(q_int) > 0','having avg(q_bigint) > 0','having avg(q_smallint) > 0','having avg(q_tinyint) > 0','having avg(q_float) > 0','having avg(q_double) > 0', 'having sum(q_int) > 0','having sum(q_bigint) > 0','having sum(q_smallint) > 0','having sum(q_tinyint) > 0','having sum(q_float) > 0','having sum(q_double) > 0', @@ -278,15 +278,15 @@ class TDTestCase: self.having_not_support = ['having TOP(q_int,10) > 0','having TOP(q_bigint,10) > 0','having TOP(q_smallint,10) > 0','having TOP(q_tinyint,10) > 0','having TOP(q_float,10) > 0','having TOP(q_double,10) > 0','having TOP(q_bool,10) > 0', 'having BOTTOM(q_int,10) > 0','having BOTTOM(q_bigint,10) > 0','having BOTTOM(q_smallint,10) > 0','having BOTTOM(q_tinyint,10) > 0','having BOTTOM(q_float,10) > 0','having BOTTOM(q_double,10) > 0','having BOTTOM(q_bool,10) > 0', 'having LEASTSQUARES(q_int) > 0','having LEASTSQUARES(q_bigint) > 0','having LEASTSQUARES(q_smallint) > 0','having LEASTSQUARES(q_tinyint) > 0','having LEASTSQUARES(q_float) > 0','having LEASTSQUARES(q_double) > 0','having LEASTSQUARES(q_bool) > 0', - 'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0', + 'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0', 'having PERCENTILE(q_int,10) > 0','having PERCENTILE(q_bigint,10) > 0','having PERCENTILE(q_smallint,10) > 0','having PERCENTILE(q_tinyint,10) > 0','having PERCENTILE(q_float,10) > 0','having PERCENTILE(q_double,10) > 0', 'having TOP(q_int_null,10) > 0','having TOP(q_bigint_null,10) > 0','having TOP(q_smallint_null,10) > 0','having TOP(q_tinyint_null,10) > 0','having TOP(q_float_null,10) > 0','having TOP(q_double_null,10) > 0','having TOP(q_bool_null,10) > 0', 'having BOTTOM(q_int_null,10) > 0','having BOTTOM(q_bigint_null,10) > 0','having BOTTOM(q_smallint_null,10) > 0','having BOTTOM(q_tinyint_null,10) > 0','having BOTTOM(q_float_null,10) > 0','having BOTTOM(q_double_null,10) > 0','having BOTTOM(q_bool_null,10) > 0', 'having LEASTSQUARES(q_int_null) > 0','having LEASTSQUARES(q_bigint_null) > 0','having LEASTSQUARES(q_smallint_null) > 0','having LEASTSQUARES(q_tinyint_null) > 0','having LEASTSQUARES(q_float_null) > 0','having LEASTSQUARES(q_double_null) > 0','having LEASTSQUARES(q_bool_null) > 0', - 'having FIRST(q_bool_null) > 0','having IRATE(q_bool_null) > 0','having PERCENTILE(q_bool_null,10) > 0','having avg(q_bool_null) > 0','having LAST_ROW(q_bool_null) > 0','having sum(q_bool_null) > 0','having STDDEV(q_bool_null) > 0','having APERCENTILE(q_bool_null,10) > 0','having TWA(q_bool_null) > 0','having LAST(q_bool_null) > 0', + 'having FIRST(q_bool_null) > 0','having IRATE(q_bool_null) > 0','having PERCENTILE(q_bool_null,10) > 0','having avg(q_bool_null) > 0','having LAST_ROW(q_bool_null) > 0','having sum(q_bool_null) > 0','having STDDEV(q_bool_null) > 0','having APERCENTILE(q_bool_null,10) > 0','having TWA(q_bool_null) > 0','having LAST(q_bool_null) > 0', 'having PERCENTILE(q_int_null,10) > 0','having PERCENTILE(q_bigint_null,10) > 0','having PERCENTILE(q_smallint_null,10) > 0','having PERCENTILE(q_tinyint_null,10) > 0','having PERCENTILE(q_float_null,10) > 0','having PERCENTILE(q_double_null,10) > 0'] self.having_tagnot_support = ['having LAST_ROW(q_int) > 0','having LAST_ROW(q_bigint) > 0','having LAST_ROW(q_smallint) > 0','having LAST_ROW(q_tinyint) > 0','having LAST_ROW(q_float) > 0','having LAST_ROW(q_double) > 0', - 'having LAST_ROW(q_int_null) > 0','having LAST_ROW(q_bigint_null) > 0','having LAST_ROW(q_smallint_null) > 0','having LAST_ROW(q_tinyint_null) > 0','having LAST_ROW(q_float_null) > 0','having LAST_ROW(q_double_null) > 0'] + 'having LAST_ROW(q_int_null) > 0','having LAST_ROW(q_bigint_null) > 0','having LAST_ROW(q_smallint_null) > 0','having LAST_ROW(q_tinyint_null) > 0','having LAST_ROW(q_float_null) > 0','having LAST_ROW(q_double_null) > 0'] self.having_support_j = ['having count(t1.q_int) > 0','having count(t1.q_bigint) > 0','having count(t1.q_smallint) > 0','having count(t1.q_tinyint) > 0','having count(t1.q_float) > 0','having count(t1.q_double) > 0','having count(t1.q_bool) > 0', 'having avg(t1.q_int) > 0','having avg(t1.q_bigint) > 0','having avg(t1.q_smallint) > 0','having avg(t1.q_tinyint) > 0','having avg(t1.q_float) > 0','having avg(t1.q_double) > 0', @@ -299,7 +299,7 @@ class TDTestCase: 'having FIRST(t1.q_int) > 0','having FIRST(t1.q_bigint) > 0','having FIRST(t1.q_smallint) > 0','having FIRST(t1.q_tinyint) > 0','having FIRST(t1.q_float) > 0','having FIRST(t1.q_double) > 0', 'having LAST(t1.q_int) > 0','having LAST(t1.q_bigint) > 0','having LAST(t1.q_smallint) > 0','having LAST(t1.q_tinyint) > 0','having LAST(t1.q_float) > 0','having LAST(t1.q_double) > 0', 'having APERCENTILE(t1.q_int,10) > 0','having APERCENTILE(t1.q_bigint,10) > 0','having APERCENTILE(t1.q_smallint,10) > 0','having APERCENTILE(t1.q_tinyint,10) > 0','having APERCENTILE(t1.q_float,10) > 0','having APERCENTILE(t1.q_double,10) > 0'] - + # limit offset where self.limit_where = ['limit 1 offset 1' , 'limit 1' , 'limit 2 offset 1' , 'limit 2', 'limit 12 offset 1' , 'limit 20', 'limit 20 offset 10' , 'limit 200'] self.limit1_where = ['limit 1 offset 1' , 'limit 1' ] @@ -308,8 +308,8 @@ class TDTestCase: # slimit soffset where self.slimit_where = ['slimit 1 soffset 1' , 'slimit 1' , 'slimit 2 soffset 1' , 'slimit 2'] self.slimit1_where = ['slimit 2 soffset 1' , 'slimit 1' ] - - # aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\] + + # aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\] # select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile] # calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\] # **_ns_** express is not support stable, therefore, separated from regular tables @@ -319,7 +319,7 @@ class TDTestCase: # calc_select_all calc_select_regular calc_select_in_ts calc_select_fill calc_select_not_interval # select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile] - + self.calc_select_all = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' , 'first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' , @@ -327,7 +327,7 @@ class TDTestCase: 'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' , 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'bottom(q_int_null,20)' , 'bottom(q_bigint_null,20)' , 'bottom(q_smallint_null,20)' , 'bottom(q_tinyint_null,20)' ,'bottom(q_float_null,20)' , 'bottom(q_double_null,20)' , 'top(q_int_null,20)' , 'top(q_bigint_null,20)' , 'top(q_smallint_null,20)' ,'top(q_tinyint_null,20)' ,'top(q_float_null,20)' ,'top(q_double_null,20)' , @@ -335,8 +335,8 @@ class TDTestCase: 'last(q_int_null)' , 'last(q_bigint_null)' , 'last(q_smallint_null)' , 'last(q_tinyint_null)' , 'last(q_float_null)' ,'last(q_double_null)' , 'last(q_binary_null)' ,'last(q_nchar_null)' ,'last(q_bool_null)' ,'last(q_ts_null)' , 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , - 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)' ,] self.calc_select_in_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , @@ -351,25 +351,25 @@ class TDTestCase: self.calc_select_in = ['min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' , 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)' , 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)'] - + self.calc_select_not_support_ts = ['first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' , 'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)', 'first(q_int_null)' , 'first(q_bigint_null)' , 'first(q_smallint_null)' , 'first(q_tinyint_null)' , 'first(q_float_null)' ,'first(q_double_null)' ,'first(q_binary_null)' ,'first(q_nchar_null)' ,'first(q_bool_null)' ,'first(q_ts_null)' , 'last(q_int_null)' , 'last(q_bigint_null)' , 'last(q_smallint_null)' , 'last(q_tinyint_null)' , 'last(q_float_null)' ,'last(q_double_null)' , 'last(q_binary_null)' ,'last(q_nchar_null)' ,'last(q_bool_null)' ,'last(q_ts_null)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', - 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)'] - + 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)'] + self.calc_select_support_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' , 'bottom(q_int_null,20)' , 'bottom(q_bigint_null,20)' , 'bottom(q_smallint_null,20)' , 'bottom(q_tinyint_null,20)' ,'bottom(q_float_null,20)' , 'bottom(q_double_null,20)' , @@ -378,11 +378,11 @@ class TDTestCase: 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)'] - + self.calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)', 'PERCENTILE(q_int_null,10)' ,'PERCENTILE(q_bigint_null,20)' , 'PERCENTILE(q_smallint_null,30)' ,'PERCENTILE(q_tinyint_null,40)' ,'PERCENTILE(q_float_null,50)' ,'PERCENTILE(q_double_null,60)'] - + self.calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] self.interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\''] @@ -417,21 +417,21 @@ class TDTestCase: 'bottom(t2.q_int_null,20)' , 'bottom(t2.q_bigint_null,20)' , 'bottom(t2.q_smallint_null,20)' , 'bottom(t2.q_tinyint_null,20)' ,'bottom(t2.q_float_null,20)' , 'bottom(t2.q_double_null,20)' , 'top(t2.q_int_null,20)' , 'top(t2.q_bigint_null,20)' , 'top(t2.q_smallint_null,20)' ,'top(t2.q_tinyint_null,20)' ,'top(t2.q_float_null,20)' ,'top(t2.q_double_null,20)' , 'min(t1.q_int_null)' , 'min(t1.q_bigint_null)' , 'min(t1.q_smallint_null)' , 'min(t1.q_tinyint_null)' , 'min(t1.q_float_null)' ,'min(t1.q_double_null)' , - 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , + 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , 'min(t2.q_int_null)' , 'min(t2.q_bigint_null)' , 'min(t2.q_smallint_null)' , 'min(t2.q_tinyint_null)' , 'min(t2.q_float_null)' ,'min(t2.q_double_null)' , 'max(t2.q_int_null)' , 'max(t2.q_bigint_null)' , 'max(t2.q_smallint_null)' , 'max(t2.q_tinyint_null)' ,'max(t2.q_float_null)' ,'max(t2.q_double_null)' ] self.calc_select_in_not_support_ts_j = ['apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' , 'apercentile(t1.q_int_null,20)' , 'apercentile(t1.q_bigint_null,20)' ,'apercentile(t1.q_smallint_null,20)' ,'apercentile(t1.q_tinyint_null,20)' ,'apercentile(t1.q_float_null,20)' ,'apercentile(t1.q_double_null,20)' , - 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , + 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' , - 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , + 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , 'last_row(t1.q_double_null)' , 'last_row(t1.q_bool_null)' ,'last_row(t1.q_binary_null)' ,'last_row(t1.q_nchar_null)' ,'last_row(t1.q_ts_null)' , 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' , 'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' , - 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , + 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)', - 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , + 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] self.calc_select_in_j = ['min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' , @@ -440,20 +440,20 @@ class TDTestCase: 'min(t1.q_int_null)' , 'min(t1.q_bigint_null)' , 'min(t1.q_smallint_null)' , 'min(t1.q_tinyint_null)' , 'min(t1.q_float_null)' ,'min(t1.q_double_null)' , 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , 'apercentile(t1.q_int_null,20)' , 'apercentile(t1.q_bigint_null,20)' ,'apercentile(t1.q_smallint_null,20)' ,'apercentile(t1.q_tinyint_null,20)' ,'apercentile(t1.q_float_null,20)' ,'apercentile(t1.q_double_null,20)' , - 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , + 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' , 'min(t2.q_int)' , 'min(t2.q_bigint)' , 'min(t2.q_smallint)' , 'min(t2.q_tinyint)' , 'min(t2.q_float)' ,'min(t2.q_double)' , 'max(t2.q_int)' , 'max(t2.q_bigint)' , 'max(t2.q_smallint)' , 'max(t2.q_tinyint)' ,'max(t2.q_float)' ,'max(t2.q_double)' , - 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , + 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , 'last_row(t1.q_double_null)' , 'last_row(t1.q_bool_null)' ,'last_row(t1.q_binary_null)' ,'last_row(t1.q_nchar_null)' ,'last_row(t1.q_ts_null)' , 'min(t2.q_int_null)' , 'min(t2.q_bigint_null)' , 'min(t2.q_smallint_null)' , 'min(t2.q_tinyint_null)' , 'min(t2.q_float_null)' ,'min(t2.q_double_null)' , 'max(t2.q_int_null)' , 'max(t2.q_bigint_null)' , 'max(t2.q_smallint_null)' , 'max(t2.q_tinyint_null)' ,'max(t2.q_float_null)' ,'max(t2.q_double_null)' , 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' , 'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' , - 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , + 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)', - 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , - 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] + 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , + 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] self.calc_select_all_j = self.calc_select_in_ts_j + self.calc_select_in_j self.calc_select_regular_j = [ 'PERCENTILE(t1.q_int,10)' ,'PERCENTILE(t1.q_bigint,20)' , 'PERCENTILE(t1.q_smallint,30)' ,'PERCENTILE(t1.q_tinyint,40)' ,'PERCENTILE(t1.q_float,50)' ,'PERCENTILE(t1.q_double,60)' , @@ -461,7 +461,7 @@ class TDTestCase: 'PERCENTILE(t1.q_int_null,10)' ,'PERCENTILE(t1.q_bigint_null,20)' , 'PERCENTILE(t1.q_smallint_null,30)' ,'PERCENTILE(t1.q_tinyint_null,40)' ,'PERCENTILE(t1.q_float_null,50)' ,'PERCENTILE(t1.q_double_null,60)' , 'PERCENTILE(t2.q_int_null,10)' ,'PERCENTILE(t2.q_bigint_null,20)' , 'PERCENTILE(t2.q_smallint_null,30)' ,'PERCENTILE(t2.q_tinyint_null,40)' ,'PERCENTILE(t2.q_float_null,50)' ,'PERCENTILE(t2.q_double_null,60)'] - + self.calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , 'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] self.interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' , @@ -495,7 +495,7 @@ class TDTestCase: self.calc_aggregate_groupbytbname = ['twa(q_int)' ,'twa(q_bigint)' , 'twa(q_smallint)' ,'twa(q_tinyint)' ,'twa (q_float)' ,'twa(q_double)' , 'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)', 'twa(q_int_null)' ,'twa(q_bigint_null)' , 'twa(q_smallint_null)' ,'twa(q_tinyint_null)' ,'twa (q_float_null)' ,'twa(q_double_null)' , - 'IRATE(q_int_null)' ,'IRATE(q_bigint_null)' , 'IRATE(q_smallint_null)' ,'IRATE(q_tinyint_null)' ,'IRATE (q_float_null)' ,'IRATE(q_double_null)'] + 'IRATE(q_int_null)' ,'IRATE(q_bigint_null)' , 'IRATE(q_smallint_null)' ,'IRATE(q_tinyint_null)' ,'IRATE (q_float_null)' ,'IRATE(q_double_null)'] #two table join self.calc_aggregate_all_j = ['count(t1.*)' , 'count(t1.q_int)' ,'count(t1.q_bigint)' , 'count(t1.q_smallint)' ,'count(t1.q_tinyint)' ,'count(t1.q_float)' , @@ -543,13 +543,13 @@ class TDTestCase: 'twa(t1.q_int_null)' ,'twa(t1.q_bigint_null)' , 'twa(t1.q_smallint_null)' ,'twa(t1.q_tinyint_null)' ,'twa (t1.q_float_null)' ,'twa(t1.q_double_null)' , 'IRATE(t1.q_int_null)' ,'IRATE(t1.q_bigint_null)' , 'IRATE(t1.q_smallint_null)' ,'IRATE(t1.q_tinyint_null)' ,'IRATE (t1.q_float_null)' ,'IRATE(t1.q_double_null)' , 'twa(t2.q_int_null)' ,'twa(t2.q_bigint_null)' , 'twa(t2.q_smallint_null)' ,'twa(t2.q_tinyint_null)' ,'twa (t2.q_float_null)' ,'twa(t2.q_double_null)' , - 'IRATE(t2.q_int_null)' ,'IRATE(t2.q_bigint_null)' , 'IRATE(t2.q_smallint_null)' ,'IRATE(t2.q_tinyint_null)' ,'IRATE (t2.q_float_null)' ,'IRATE(t2.q_double_null)' ] - + 'IRATE(t2.q_int_null)' ,'IRATE(t2.q_bigint_null)' , 'IRATE(t2.q_smallint_null)' ,'IRATE(t2.q_tinyint_null)' ,'IRATE (t2.q_float_null)' ,'IRATE(t2.q_double_null)' ] + # calc_calculate_all calc_calculate_regular calc_calculate_groupbytbname # calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\] - self.calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' , + self.calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' , '(SPREAD(q_int) + SPREAD(q_bigint))' , '(SPREAD(q_smallint) - SPREAD(q_float))', '(SPREAD(q_double) * SPREAD(q_tinyint))' , '(SPREAD(q_double) / SPREAD(q_float))', - 'SPREAD(q_ts_null)' , 'SPREAD(q_int_null)' ,'SPREAD(q_bigint_null)' , 'SPREAD(q_smallint_null)' ,'SPREAD(q_tinyint_null)' ,'SPREAD(q_float_null)' ,'SPREAD(q_double_null)' , + 'SPREAD(q_ts_null)' , 'SPREAD(q_int_null)' ,'SPREAD(q_bigint_null)' , 'SPREAD(q_smallint_null)' ,'SPREAD(q_tinyint_null)' ,'SPREAD(q_float_null)' ,'SPREAD(q_double_null)' , '(SPREAD(q_int_null) + SPREAD(q_bigint_null))' , '(SPREAD(q_smallint_null) - SPREAD(q_float_null))', '(SPREAD(q_double_null) * SPREAD(q_tinyint_null))' , '(SPREAD(q_double_null) / SPREAD(q_float_null))'] self.calc_calculate_regular = ['DIFF(q_int)' ,'DIFF(q_bigint)' , 'DIFF(q_smallint)' ,'DIFF(q_tinyint)' ,'DIFF(q_float)' ,'DIFF(q_double)' , 'DIFF(q_int,0)' ,'DIFF(q_bigint,0)' , 'DIFF(q_smallint,0)' ,'DIFF(q_tinyint,0)' ,'DIFF(q_float,0)' ,'DIFF(q_double,0)' , @@ -560,7 +560,7 @@ class TDTestCase: 'DIFF(q_int_null,1)' ,'DIFF(q_bigint_null,1)' , 'DIFF(q_smallint_null,1)' ,'DIFF(q_tinyint_null,1)' ,'DIFF(q_float_null,1)' ,'DIFF(q_double_null,1)' , 'DERIVATIVE(q_int_null,15s,0)' , 'DERIVATIVE(q_bigint_null,10s,1)' , 'DERIVATIVE(q_smallint_null,20s,0)' ,'DERIVATIVE(q_tinyint_null,10s,1)' ,'DERIVATIVE(q_float_null,6s,0)' ,'DERIVATIVE(q_double_null,3s,1)'] self.calc_calculate_groupbytbname = self.calc_calculate_regular - + #two table join self.calc_calculate_all_j = ['SPREAD(t1.ts)' , 'SPREAD(t1.q_ts)' , 'SPREAD(t1.q_int)' ,'SPREAD(t1.q_bigint)' , 'SPREAD(t1.q_smallint)' ,'SPREAD(t1.q_tinyint)' ,'SPREAD(t1.q_float)' ,'SPREAD(t1.q_double)' , 'SPREAD(t2.ts)' , 'SPREAD(t2.q_ts)' , 'SPREAD(t2.q_int)' ,'SPREAD(t2.q_bigint)' , 'SPREAD(t2.q_smallint)' ,'SPREAD(t2.q_tinyint)' ,'SPREAD(t2.q_float)' ,'SPREAD(t2.q_double)' , @@ -597,17 +597,17 @@ class TDTestCase: 'interval(1y,1n) ','interval(1n,1w) ','interval(1w,1d) ','interval(1d,1h) ','interval(1h,1m) ','interval(1m,1s) ','interval(1s,10a) ' ,'interval(100a,30a)'] self.conn1 = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos/") - self.cur1 = self.conn1.cursor() - print(self.cur1) + self.cur1 = self.conn1.cursor() + print(self.cur1) self.cur1.execute("use %s ;" %self.db_nest) sql = 'select * from stable_1 limit 5;' self.cur1.execute(sql) - + def data_matrix_equal(self, sql1,row1_s,row1_e,col1_s,col1_e, sql2,row2_s,row2_e,col2_s,col2_e): # ----row1_start----col1_start---- - # - - - - 是一个矩阵内的数据相等- - - - # - - - - - - - - - - - - - - - - + # - - - - 是一个矩阵内的数据相等- - - + # - - - - - - - - - - - - - - - - # ----row1_end------col1_end------ self.sql1 = sql1 list1 =[] @@ -619,9 +619,9 @@ class TDTestCase: #print("data=%s" %(tdSql.getData(i1,j1))) list1.append(tdSql.getData(i1,j1)) print("=====list1-------list1---=%s" %set(list1)) - + tdSql.execute("reset query cache;") - self.sql2 = sql2 + self.sql2 = sql2 list2 =[] tdSql.query(sql2) for i2 in range(row2_s-1,row2_e): @@ -630,8 +630,8 @@ class TDTestCase: #print("jjjj222=%d"%j2) #print("data=%s" %(tdSql.getData(i2,j2))) list2.append(tdSql.getData(i2,j2)) - print("=====list2-------list2---=%s" %set(list2)) - + print("=====list2-------list2---=%s" %set(list2)) + if (list1 == list2) and len(list2)>0: # print(("=====matrix===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2)) tdLog.info(("===matrix===sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2)) @@ -657,7 +657,7 @@ class TDTestCase: print(("=====matrix_error===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2)) tdLog.info(("sql1:'%s' matrix_result != sql2:'%s' matrix_result") %(sql1,sql2)) return tdSql.checkEqual(list1,list2) - + def restartDnodes(self): pass # tdDnodes.stop(1) @@ -681,7 +681,7 @@ class TDTestCase: 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) \ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - + tdSql.execute('''create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ q_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) ,\ @@ -693,35 +693,35 @@ class TDTestCase: 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) \ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - + #tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '0' , '0' , '0' , '0' , 0 , 'binary1' , 'nchar1' , '0' , '0' ,'0') ;''') - tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) tdSql.execute('''create table stable_1_2 using stable_1 tags('stable_1_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\') ;''') tdSql.execute('''create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\') ;''') #tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''') - tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) # tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,'0') ;''') # tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''') # tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''') - - tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,\'2099-09-09 09:09:09.090\') ;''') - tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) - tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,\'2099-09-09 09:09:09.090\') ;''') + tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + + tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) #regular table tdSql.execute('''create table regular_table_1 \ @@ -747,106 +747,106 @@ class TDTestCase: q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''') - for i in range(num_random*n): + for i in range(1, num_random*n + 1): tdSql.execute('''insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\ 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() , + '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 regular_table_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) \ 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() , + '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 stable_1_2 (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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*2, 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 regular_table_2 (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() , + '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 stable_1_2 (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 +1, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*2 +1, fake.random_int(min=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , + fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, 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 regular_table_2 (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 +1, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , + '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=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , + fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, 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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4, 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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4 +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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4 +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,3*num_random*n) tdSql.query("select count(*) from regular_table_1;") tdSql.checkData(0,0,num_random*n) - - def explain_sql(self,sql): - # #执行sql解析 - sql = "explain " + sql - tdLog.info(sql) + + def explain_sql(self,sql): + # #执行sql解析 + sql = "explain " + sql + tdLog.info(sql) tdSql.query(sql) #pass - + def data_check(self,sql,mark='mark') : tdLog.info("========mark==%s==="% mark); try: @@ -854,60 +854,60 @@ class TDTestCase: except: tdLog.info("sql is not support :=====%s; " %sql) tdSql.error(sql) - - + + def math_nest(self,mathlist): - - print("==========%s===start=============" %mathlist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %mathlist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (mathlist == ['ABS','SQRT']) or (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['FLOOR','CEIL','ROUND']) \ or (mathlist == ['CSUM']) : - math_functions = mathlist - fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] + math_functions = mathlist + fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)', - '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] + '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + elif (mathlist == ['UNIQUE']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : - math_functions = mathlist + math_functions = mathlist fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_binary)','(q_nchar)','(q_bool)','(q_ts)', - '(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)','(q_binary_null)','(q_nchar_null)','(q_bool_null)','(q_ts_null)'] + '(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)','(q_binary_null)','(q_nchar_null)','(q_bool_null)','(q_ts_null)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)','(t1.q_ts)','(t1.q_ts_null)', - '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)','(t2.q_ts)','(t2.q_ts_null)'] + '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)','(t2.q_ts)','(t2.q_ts_null)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (mathlist == ['TAIL']): - math_functions = mathlist - num = random.randint(1, 100) - offset_rows = random.randint(0, 100) + math_functions = mathlist + num = random.randint(1, 100) + offset_rows = random.randint(0, 100) fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)','(q_binary,num)','(q_nchar,num)','(q_bool,num)','(q_ts,num)', '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)','(q_binary_null,num)','(q_nchar_null,num)','(q_bool_null,num)','(q_ts_null,num)', '(q_bigint,num,offset_rows)','(q_smallint,num,offset_rows)','(q_tinyint,num,offset_rows)','(q_int,num,offset_rows)','(q_float,num,offset_rows)','(q_double,num,offset_rows)','(q_binary,num,offset_rows)','(q_nchar,num,offset_rows)','(q_bool,num,offset_rows)','(q_ts,num,offset_rows)', - '(q_bigint_null,num,offset_rows)','(q_smallint_null,num,offset_rows)','(q_tinyint_null,num,offset_rows)','(q_int_null,num,offset_rows)','(q_float_null,num,offset_rows)','(q_double_null,num,offset_rows)','(q_binary_null,num,offset_rows)','(q_nchar_null,num,offset_rows)','(q_bool_null,num,offset_rows)','(q_ts_null,num,offset_rows)'] + '(q_bigint_null,num,offset_rows)','(q_smallint_null,num,offset_rows)','(q_tinyint_null,num,offset_rows)','(q_int_null,num,offset_rows)','(q_float_null,num,offset_rows)','(q_double_null,num,offset_rows)','(q_binary_null,num,offset_rows)','(q_nchar_null,num,offset_rows)','(q_bool_null,num,offset_rows)','(q_ts_null,num,offset_rows)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) - + fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)','(t1.q_binary,num)','(t1.q_nchar,num)','(t1.q_bool,num)','(t1.q_ts,num)', '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)','(t1.q_binary_null,num)','(t1.q_nchar_null,num)','(t1.q_bool_null,num)','(t1.q_ts_null,num)', '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)','(t2.q_binary,num)','(t2.q_nchar,num)','(t2.q_bool,num)','(t2.q_ts,num)', @@ -915,224 +915,224 @@ class TDTestCase: '(t1.q_bigint,num,offset_rows)','(t1.q_smallint,num,offset_rows)','(t1.q_tinyint,num,offset_rows)','(t1.q_int,num,offset_rows)','(t1.q_float,num,offset_rows)','(t1.q_double,num,offset_rows)','(t1.q_binary,num,offset_rows)','(t1.q_nchar,num,offset_rows)','(t1.q_bool,num,offset_rows)','(t1.q_ts,num,offset_rows)', '(t1.q_bigint_null,num,offset_rows)','(t1.q_smallint_null,num,offset_rows)','(t1.q_tinyint_null,num,offset_rows)','(t1.q_int_null,num,offset_rows)','(t1.q_float_null,num,offset_rows)','(t1.q_double_null,num,offset_rows)','(t1.q_binary_null,num,offset_rows)','(t1.q_nchar_null,num,offset_rows)','(t1.q_bool_null,num,offset_rows)','(t1.q_ts_null,num,offset_rows)', '(t2.q_bigint,num,offset_rows)','(t2.q_smallint,num,offset_rows)','(t2.q_tinyint,num,offset_rows)','(t2.q_int,num,offset_rows)','(t2.q_float,num,offset_rows)','(t2.q_double,num,offset_rows)','(t2.q_binary,num,offset_rows)','(t2.q_nchar,num,offset_rows)','(t2.q_bool,num,offset_rows)','(t2.q_ts,num,offset_rows)', - '(t2.q_bigint_null,num,offset_rows)','(t2.q_smallint_null,num,offset_rows)','(t2.q_tinyint_null,num,offset_rows)','(t2.q_int_null,num,offset_rows)','(t2.q_float_null,num,offset_rows)','(t2.q_double_null,num,offset_rows)','(t2.q_binary_null,num,offset_rows)','(t2.q_nchar_null,num,offset_rows)','(t2.q_bool_null,num,offset_rows)','(t2.q_ts_null,num,offset_rows)'] + '(t2.q_bigint_null,num,offset_rows)','(t2.q_smallint_null,num,offset_rows)','(t2.q_tinyint_null,num,offset_rows)','(t2.q_int_null,num,offset_rows)','(t2.q_float_null,num,offset_rows)','(t2.q_double_null,num,offset_rows)','(t2.q_binary_null,num,offset_rows)','(t2.q_nchar_null,num,offset_rows)','(t2.q_bool_null,num,offset_rows)','(t2.q_ts_null,num,offset_rows)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) - + elif (mathlist == ['POW','LOG']) or (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) : - math_functions = mathlist - num = random.randint(1, 1000) + math_functions = mathlist + num = random.randint(1, 1000) fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)', - '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] + '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) - + fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)', '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)', '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)', - '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] + '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) elif (mathlist == ['statecount','stateduration']): - math_functions = mathlist - num = random.randint(-1000, 1000) - - operator = ['LT' , 'GT' ,'GE','NE','EQ'] - oper = str(random.sample(operator,1)).replace("[","").replace("]","")#.replace("'","") - + math_functions = mathlist + num = random.randint(-1000, 1000) + + operator = ['LT' , 'GT' ,'GE','NE','EQ'] + oper = str(random.sample(operator,1)).replace("[","").replace("]","")#.replace("'","") + fun_fix_column = ['(q_bigint,oper,num,time)','(q_smallint,oper,num,time)','(q_tinyint,oper,num,time)','(q_int,oper,num,time)','(q_float,oper,num,time)','(q_double,oper,num,time)', - '(q_bigint_null,oper,num,time)','(q_smallint_null,oper,num,time)','(q_tinyint_null,oper,num,time)','(q_int_null,oper,num,time)','(q_float_null,oper,num,time)','(q_double_null,oper,num,time)'] - + '(q_bigint_null,oper,num,time)','(q_smallint_null,oper,num,time)','(q_tinyint_null,oper,num,time)','(q_int_null,oper,num,time)','(q_float_null,oper,num,time)','(q_double_null,oper,num,time)'] + hanshu_select1 = random.sample(math_functions,1) fun_column_1 = random.sample(hanshu_select1,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select1).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_1 = math_fun_1.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select1).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_1 = math_fun_1.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - - hanshu_select2 = random.sample(math_functions,1) + + hanshu_select2 = random.sample(math_functions,1) fun_column_2 = random.sample(hanshu_select2,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select2).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select2).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") - math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) + fun_fix_column_j = ['(t1.q_bigint,oper,num,time)','(t1.q_smallint,oper,num,time)','(t1.q_tinyint,oper,num,time)','(t1.q_int,oper,num,time)','(t1.q_float,oper,num,time)','(t1.q_double,oper,num,time)', '(t1.q_bigint_null,oper,num,time)','(t1.q_smallint_null,oper,num,time)','(t1.q_tinyint_null,oper,num,time)','(t1.q_int_null,oper,num,time)','(t1.q_float_null,oper,num,time)','(t1.q_double_null,oper,num,time)', '(t2.q_bigint,oper,num,time)','(t2.q_smallint,oper,num,time)','(t2.q_tinyint,oper,num,time)','(t2.q_int,oper,num,time)','(t2.q_float,oper,num,time)','(t2.q_double,oper,num,time)', - '(t2.q_bigint_null,oper,num,time)','(t2.q_smallint_null,oper,num,time)','(t2.q_tinyint_null,oper,num,time)','(t2.q_int_null,oper,num,time)','(t2.q_float_null,oper,num,time)','(t2.q_double_null,oper,num,time)'] - + '(t2.q_bigint_null,oper,num,time)','(t2.q_smallint_null,oper,num,time)','(t2.q_tinyint_null,oper,num,time)','(t2.q_int_null,oper,num,time)','(t2.q_float_null,oper,num,time)','(t2.q_double_null,oper,num,time)'] + hanshu_select_join_1 = random.sample(math_functions,1) fun_column_join_1 = random.sample(hanshu_select_join_1,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select_join_1).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_join_1 = math_fun_join_1.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select_join_1).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_join_1 = math_fun_join_1.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - + hanshu_select_join_2 = random.sample(math_functions,1) fun_column_join_2 = random.sample(hanshu_select_join_2,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select_join_2).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_join_2 = math_fun_join_2.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select_join_2).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_join_2 = math_fun_join_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) elif(mathlist == ['HISTOGRAM']) : - math_functions = mathlist - fun_fix_column = ['(q_bigint','(q_smallint','(q_tinyint','(q_int','(q_float','(q_double','(q_bigint_null','(q_smallint_null','(q_tinyint_null','(q_int_null','(q_float_null','(q_double_null'] - + math_functions = mathlist + fun_fix_column = ['(q_bigint','(q_smallint','(q_tinyint','(q_int','(q_float','(q_double','(q_bigint_null','(q_smallint_null','(q_tinyint_null','(q_int_null','(q_float_null','(q_double_null'] + fun_fix_column_j = ['(t1.q_bigint','(t1.q_smallint','(t1.q_tinyint','(t1.q_int','(t1.q_float','(t1.q_double','(t1.q_bigint_null','(t1.q_smallint_null','(t1.q_tinyint_null','(t1.q_int_null','(t1.q_float_null','(t1.q_double_null', '(t2.q_bigint','(t2.q_smallint','(t2.q_tinyint','(t2.q_int','(t2.q_float','(t2.q_double','(t2.q_bigint_null','(t2.q_smallint_null','(t2.q_tinyint_null','(t2.q_int_null','(t2.q_float_null','(t2.q_double_null'] - - normalized = random.randint(0, 1) - + + normalized = random.randint(0, 1) + i = random.randint(1,3) if i == 1: - bin_type = 'user_input' + bin_type = 'user_input' bin_description = {-11111119395555977777} #9一会转译成, fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + elif i == 2: - bin_type = 'linear_bin' - true_false = random.randint(10, 11) + bin_type = 'linear_bin' + true_false = random.randint(10, 11) bin_description = {"ZstartZ": -333339, "ZwidthZ":559, "ZcountZ":59, "ZinfinityZ":'%d' %true_false} #Z一会转译成" ,9一会转译成 , fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + elif i == 3: - bin_type = 'log_bin' - true_false = random.randint(10, 11) + bin_type = 'log_bin' + true_false = random.randint(10, 11) bin_description = {"ZstartZ": -333339, "ZfactorZ":559, "ZcountZ":59, "ZinfinityZ":'%d' %true_false} #Z一会转译成" ,9一会转译成 , fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + tdSql.query("select 1-1 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']): - sql = "select ts1 , floor(asct1) from ( select " - sql += "%s as asct1, " % math_fun_1 - sql += "%s as asct2, " % math_fun_2 + sql = "select ts1 , floor(asct1) from ( select " + sql += "%s as asct1, " % math_fun_1 + sql += "%s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts1 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_1 + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_1 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts , abs(asct1) from ( select " - sql += "%s as asct1, " % math_fun_1 + sql += "%s as asct1, " % math_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2 from ( select " - sql += "%s as asct2, " % math_fun_2 + sql += "%s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) - self.explain_sql(sql) + self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ - or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']): + or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']): sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_1 + sql += "%s as asct1 " % math_fun_1 sql += "from regular_table_1 where " sql += "%s )" % random.choice(self.q_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select count(asct2) from ( select " - sql += "%s as asct2 " % math_fun_2 + sql += "%s as asct2 " % math_fun_2 sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + self.cur1.execute(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ @@ -1141,20 +1141,20 @@ class TDTestCase: sql += "%s as asct1, ts ," % math_fun_1 sql += "%s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % math_fun_2 sql += "%s as asct1, " % math_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1164,14 +1164,14 @@ class TDTestCase: sql += "%s as asct2 " % math_fun_2 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % math_fun_2 - sql += "%s as asct1 " % math_fun_1 + sql += "%s as asct1 " % math_fun_1 sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1181,35 +1181,35 @@ class TDTestCase: sql += "%s as asct1 " % math_fun_1 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 " % math_fun_2 sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) - sql += " order by asct1 asc " + sql += " order by asct1 asc " sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1 from ( select t1.ts as ts1," - sql += "%s as asct0, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "%s as asct2, " % math_fun_join_1 - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct0, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "%s as asct2, " % math_fun_join_1 + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) @@ -1217,32 +1217,32 @@ class TDTestCase: elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql += "%s as asct1 " % math_fun_join_2 sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts ," - sql += "%s, " % math_fun_1 + sql += "%s, " % math_fun_1 sql += "%s as asct1, " % random.choice(self.q_select) - sql += "%s as asct2, " % random.choice(self.q_select) + sql += "%s as asct2, " % random.choice(self.q_select) sql += "%s " % math_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) @@ -1254,9 +1254,9 @@ class TDTestCase: sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1265,32 +1265,32 @@ class TDTestCase: if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1 ,timediff(ts1,ts2), max(asct1) from ( select t1.ts,t1.ts as ts1," - sql += "%s as asct0, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % math_fun_join_1 + sql += "%s as asct0, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % math_fun_join_1 sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql += "%s as asct1 " % math_fun_join_2 sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1301,13 +1301,13 @@ class TDTestCase: sql = "select ts1,ts2 , abs(asct1) from ( select " sql += "%s as asct1, ts as ts1," % math_fun_1 sql += "%s as asct2, " % math_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -1320,12 +1320,12 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ @@ -1335,13 +1335,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % math_fun_1 sql += "%s as asct2, " % math_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -1355,7 +1355,7 @@ class TDTestCase: sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) @@ -1366,12 +1366,12 @@ class TDTestCase: if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts2 ,timediff(ts1,ts2) , max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql += "%s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -1379,27 +1379,27 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + self.restartDnodes() tdSql.query("select 1-10 as math_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -1424,8 +1424,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1442,12 +1442,12 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as math_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -1471,10 +1471,10 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : @@ -1489,8 +1489,8 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -1500,78 +1500,78 @@ class TDTestCase: if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts2 ,timediff(ts1,ts2), max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct111, " % random.choice(self.q_select) + sql += "%s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct111, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_join_2 sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts ," - sql += "%s as asct11, " % math_fun_1 + sql += "%s as asct11, " % math_fun_1 sql += "%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct13, " % random.choice(self.q_select) sql += "%s as asct14, " % math_fun_2 - sql += "%s as asct15 " % random.choice(self.t_select) + sql += "%s as asct15 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select " sql += "%s " % math_fun_2 - sql += "%s " % random.choice(self.t_select) + sql += "%s " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-14 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select avg(asct1),count(asct2) from ( select " - sql += "%s as asct1, " % math_fun_1 + sql += "%s as asct1, " % math_fun_1 sql += "%s as asct2" % math_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -1579,67 +1579,67 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_1 + sql += "%s as asct1 " % math_fun_1 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts ,timediff(ts1,ts), max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ - or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + #taos -f sql # startTime_taosf = time.time() print("taos -f %s sql start!" %mathlist) @@ -1648,274 +1648,274 @@ class TDTestCase: _ = subprocess.check_output(taos_cmd1, shell=True) print("taos -f %s sql over!" %mathlist) # endTime_taosf = time.time() - # print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %mathlist) + # print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %mathlist) def str_nest(self,strlist): - - print("==========%s===start=============" %strlist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %strlist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['LENGTH','CHAR_LENGTH']) \ or (strlist == ['']): - str_functions = strlist - fun_fix_column = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)'] + str_functions = strlist + fun_fix_column = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)'] fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)', - '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)'] + '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)'] fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - - fun_fix_column_s = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)','(loc)','(tbname)'] + + fun_fix_column_s = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)','(loc)','(tbname)'] fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)','(t1.loc)','(t1.tbname)', - '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)','(t2.loc)','(t2.tbname)'] + '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)','(t2.loc)','(t2.tbname)'] fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + elif (strlist == ['SUBSTR']) : - str_functions = strlist - pos = random.randint(1, 20) - sub_len = random.randint(1, 10) + str_functions = strlist + pos = random.randint(1, 20) + sub_len = random.randint(1, 10) fun_fix_column = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)', - '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)',] + '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)',] fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)', '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)', '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)', - '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)'] + '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)'] fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_s = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)','(loc,pos)', - '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)','(loc,pos,sub_len)',] + '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)','(loc,pos,sub_len)',] fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_s_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)','(t1.loc,pos)', '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)','(t1.loc,pos,sub_len)', '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)','(t2.loc,pos)', - '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)','(t2.loc,pos,sub_len)'] + '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)','(t2.loc,pos,sub_len)'] fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1) str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1) str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + elif (strlist == ['CONCAT']) : - str_functions = strlist - i = random.randint(2,4) + str_functions = strlist + i = random.randint(2,4) fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+column1+')' str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+column2+')' str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', - '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] + + column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+column_j1+')' str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + + column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+column_j2+')' str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_1 = str(random.sample(str_functions,1))+'('+column_s1+')' str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","") - - column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + + column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_2 = str(random.sample(str_functions,1))+'('+column_s2+')' str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+column_j_s1+')' str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","") - - column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+column_j_s2+')' str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","") - + elif (strlist == ['CONCAT_WS']): - str_functions = strlist - i = random.randint(2,4) + str_functions = strlist + i = random.randint(2,4) fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + separators = ['',' ','abc','123','!','@','#','$','%','^','&','*','(',')','-','_','+','=','{', '[','}',']','|',';',':',',','.','<','>','?','/','~','`','taos','涛思'] - separator = str(random.sample(separators,i)).replace("[","").replace("]","") - - column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + separator = str(random.sample(separators,i)).replace("[","").replace("]","") + + column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column1+')' str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column2+')' str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', - '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] + + column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j1+')' str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + + column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j2+')' str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s1+')' str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","") - - column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + + column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s2+')' str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s1+')' str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","") - - column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s2+')' str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","") - - + + tdSql.query("select 1-1 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) : - sql = "select t1s , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " - sql += "%s as asct1, " % str_fun_1 - sql += "%s as asct2, " % str_fun_2 + sql = "select t1s , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " + sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as t1s from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): - sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " - sql += "%s as asct1, " % str_fun_1 - sql += "%s as asct2, " % str_fun_2 + sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " + sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) : sql = "select ts , asct1 from ( select " - sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2 from ( select " - sql += "%s as asct2, " % str_fun_2 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) #sql += "%s " % random.choice(having_support) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) - self.explain_sql(sql) - elif (strlist == ['LENGTH','CHAR_LENGTH']): + self.explain_sql(sql) + elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1) from ( select " - sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select sum(asct2), min(asct2) from ( select " - sql += "%s as asct2, " % str_fun_2 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - + self.cur1.execute(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): @@ -1923,20 +1923,20 @@ class TDTestCase: sql += "%s as asct1 ," % str_fun_1 sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % str_fun_2 sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #tdSql.query(sql) #'unexpected end of data' # self.cur1.execute(sql) # self.explain_sql(sql) @@ -1945,92 +1945,92 @@ class TDTestCase: sql += "%s as asct1 ," % str_fun_1 sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % str_fun_2 sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "%s, " % str_fun_join_1 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "%s, " % str_fun_join_1 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "%s, " % str_fun_join_1 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "%s, " % str_fun_join_1 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts ," - sql += "%s, " % str_fun_1 + sql += "%s, " % str_fun_1 sql += "%s as asct21, " % random.choice(self.q_select) - sql += "%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct22, " % random.choice(self.q_select) sql += "%s " % str_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select ts ," - sql += "%s, " % str_fun_1 + sql += "%s, " % str_fun_1 sql += "%s as asct22, " % random.choice(self.q_select) - sql += "%s as asct21, " % random.choice(self.q_select) + sql += "%s as asct21, " % random.choice(self.q_select) sql += "%s " % str_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) @@ -2040,35 +2040,35 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts ,timediff(ts1,ts), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "%s, " % str_fun_join_1 + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "%s, " % str_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "%s, " % str_fun_join_1 + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "%s, " % str_fun_join_1 sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -2078,13 +2078,13 @@ class TDTestCase: sql = "select t1s ,ts1, LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " sql += "%s as asct1, ts as t1s," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -2094,18 +2094,18 @@ class TDTestCase: sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1, ts as ts1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as t1s from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): @@ -2114,13 +2114,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as st1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -2132,13 +2132,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as st1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) @@ -2148,12 +2148,12 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -2161,32 +2161,32 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - elif (strlist == ['LENGTH','CHAR_LENGTH']): - sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) - sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.t_join_where) - sql += "and %s " % random.choice(self.t_u_where) - sql += "and %s " % random.choice(self.t_u_or_where) - sql += "%s " % random.choice(self.order_u_where) - sql += "%s " % random.choice(self.limit1_where) - sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + elif (strlist == ['LENGTH','CHAR_LENGTH']): + sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " + sql += "%s " % random.choice(self.t_join_where) + sql += "and %s " % random.choice(self.t_u_where) + sql += "and %s " % random.choice(self.t_u_or_where) + sql += "%s " % random.choice(self.order_u_where) + sql += "%s " % random.choice(self.limit1_where) + sql += ") ;" + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + self.cur1.execute(sql) + self.explain_sql(sql) + self.restartDnodes() tdSql.query("select 1-10 as str_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -2210,11 +2210,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) - self.explain_sql(sql) + self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1 ," % str_fun_s_1 @@ -2235,12 +2235,12 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as str_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -2263,11 +2263,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) - self.explain_sql(sql) + self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1 ," % str_fun_s_1 @@ -2287,8 +2287,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -2297,85 +2297,85 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts ," - sql += "%s as asct10, " % str_fun_1 + sql += "%s as asct10, " % str_fun_1 sql += "%s as asct1, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % str_fun_2 - sql += "%s as asct14 " % random.choice(self.t_select) + sql += "%s as asct14 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - tdSql.checkRows(300) - self.cur1.execute(sql) - self.explain_sql(sql) - elif (strlist == ['LENGTH','CHAR_LENGTH']): - sql = "select ts ," - sql += "%s as asct1, " % str_fun_1 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % str_fun_2 - sql += "%s as asct14 " % random.choice(self.t_select) - sql += " from ( select * from stable_1 where " - sql += "%s " % random.choice(self.qt_where) - sql += "%s " % random.choice(self.order_where) - sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) - + elif (strlist == ['LENGTH','CHAR_LENGTH']): + sql = "select ts ," + sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % str_fun_2 + sql += "%s as asct14 " % random.choice(self.t_select) + sql += " from ( select * from stable_1 where " + sql += "%s " % random.choice(self.qt_where) + sql += "%s " % random.choice(self.order_where) + sql += ") ;" + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + tdSql.checkRows(300) + self.cur1.execute(sql) + self.explain_sql(sql) + tdSql.query("select 1-14 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " - sql += "%s as asct1, " % str_fun_s_1 + sql += "%s as asct1, " % str_fun_s_1 sql += "%s as asct2" % str_fun_s_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -2383,14 +2383,14 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " - sql += "%s as asct1, " % str_fun_s_1 + sql += "%s as asct1, " % str_fun_s_1 sql += "%s as asct2" % str_fun_s_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -2398,56 +2398,56 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts,ts2 ,timediff(ts,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts ," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14 " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14 " % random.choice(self.q_select) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f %s sql start!" %strlist) @@ -2456,215 +2456,215 @@ class TDTestCase: _ = subprocess.check_output(taos_cmd1, shell=True) print("taos -f %s sql over!" %strlist) endTime_taos_f = time.time() - print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %strlist) - + print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %strlist) + def time_nest(self,timelist): - - print("==========%s===start=============" %timelist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %timelist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (timelist == ['NOW','TODAY']) or (timelist == ['TIMEZONE']): - time_functions = timelist - fun_fix_column = ['()'] + time_functions = timelist + fun_fix_column = ['()'] fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - - fun_fix_column_j = ['()'] + + fun_fix_column_j = ['()'] fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (timelist == ['TIMETRUNCATE']): - time_functions = timelist - - t = time.time() - t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) + time_functions = timelist + + t = time.time() + t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - timeunits = ['1a' ,'1s', '1m' ,'1h', '1d'] - timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") - - column_1 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + timeunits = ['1a' ,'1s', '1m' ,'1h', '1d'] + timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") + + column_1 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] fun_column_1 = random.sample(time_functions,1)+random.sample(column_1,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - column_2 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] + + column_2 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] fun_column_2 = random.sample(time_functions,1)+random.sample(column_2,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - + + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t,'t_to_s'] - - column_j1 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t,'t_to_s'] + + column_j1 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j1,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - column_j2 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] + + column_j2 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j2,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) elif (timelist == ['TO_ISO8601']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() fun_fix_column = ['(now())','(ts)','(q_ts)','(_rowts)','(_c0)','(_C0)', '(1600000000000)','(1600000000000000)','(1600000000000000000)', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] - + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)','(now())', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] - + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (timelist == ['TO_UNIXTIMESTAMP']): - time_functions = timelist - - t = time.time() - t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) - fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)'] - + time_functions = timelist + + t = time.time() + t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) + fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)'] + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s) - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s) - - fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)'] - + + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)'] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s) - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s) elif (timelist == ['TIMEDIFF_1']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) timeunits = [ '1a' ,'1s', '1m' ,'1h', '1d'] - timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") - + timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") + fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_12 = ['(%s,%s,timeutil)'%(column_1,column_2)] fun_column_1 = random.sample(time_functions,1)+random.sample(column_12,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - - column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + + column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_34 = ['(%s,%s,timeutil)'%(column_3,column_4)] fun_column_2 = random.sample(time_functions,1)+random.sample(column_34,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) column_j12 = ['(%s,%s,timeutil)'%(column_j1,column_j2)] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j12,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - - column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) - column_j34 = ['(%s,%s,timeutil)'%(column_j3,column_j4)] + + column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + column_j34 = ['(%s,%s,timeutil)'%(column_j3,column_j4)] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j34,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") elif (timelist == ['TIMEDIFF_2']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) - + fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_12 = ['(%s,%s)'%(column_1,column_2)] fun_column_1 = random.sample(time_functions,1)+random.sample(column_12,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s).replace("_2","") - - column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + + column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_34 = ['(%s,%s)'%(column_3,column_4)] fun_column_2 = random.sample(time_functions,1)+random.sample(column_34,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s).replace("_2","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) column_j12 = ['(%s,%s)'%(column_j1,column_j2)] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j12,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s).replace("_2","") - - column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) - column_j34 = ['(%s,%s)'%(column_j3,column_j4)] + + column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + column_j34 = ['(%s,%s)'%(column_j3,column_j4)] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j34,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s).replace("_2","") - + elif (timelist == ['ELAPSED']): - time_functions = timelist - - fun_fix_column = ['(ts)','(_c0)','(_C0)','(_rowts)','(ts,time_unit)','(_c0,time_unit)','(_C0,time_unit)','(_rowts,time_unit)'] - - time_units = ['1s','1m','1h','1d','1a'] - time_unit1 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") - time_unit2 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") - + time_functions = timelist + + fun_fix_column = ['(ts)','(_c0)','(_C0)','(_rowts)','(ts,time_unit)','(_c0,time_unit)','(_C0,time_unit)','(_rowts,time_unit)'] + + time_units = ['1s','1m','1h','1d','1a'] + time_unit1 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") + time_unit2 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1) - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2) - - - fun_fix_column_j = ['(t1.ts)', '(t2.ts)','(t1.ts,time_unit)','(t1.ts,time_unit)','(t2.ts,time_unit)','(t2.ts,time_unit)'] - + + + fun_fix_column_j = ['(t1.ts)', '(t2.ts)','(t1.ts,time_unit)','(t1.ts,time_unit)','(t2.ts,time_unit)','(t2.ts,time_unit)'] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1) - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2) - - + + elif (timelist == ['CAST']) : - str_functions = timelist + str_functions = timelist #下面的4个是全的,这个只是1个 i = random.randint(1,4) if i ==1: @@ -2672,33 +2672,33 @@ class TDTestCase: fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null', 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null'] type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED'] - - type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - - type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null', 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null', 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null', - 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==2: print('===========cast_2===========') fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4'] type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") @@ -2706,285 +2706,285 @@ class TDTestCase: type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_binary4', - 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==3: print('===========cast_3===========') fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8'] type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") + fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8', - 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==4: print('===========cast_4===========') fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts'] type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - - fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") + + fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif (timelist == ['CAST_1']) : - str_functions = timelist - + str_functions = timelist + print('===========cast_1===========') fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null', 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null'] type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED'] - - type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_1","") - - type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_1","") + + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_1","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_1","") + fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null', 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null', 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null', - 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_1","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_1","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_1","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_1","") + elif (timelist == ['CAST_2']) : - str_functions = timelist + str_functions = timelist print('===========cast_2===========') fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4'] type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_2","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_2","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_2","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_2","") + fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_binary4', - 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_2","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_2","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_2","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_2","") + elif (timelist == ['CAST_3']) : - str_functions = timelist + str_functions = timelist print('===========cast_3===========') fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8'] type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_3","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_3","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_3","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_3","") + fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8', - 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_3","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_3","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_3","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_3","") + elif (timelist == ['CAST_4']) : - str_functions = timelist + str_functions = timelist print('===========cast_4===========') fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts'] type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_4","") - + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_4","") + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_4","") - - fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_4","") + + fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_4","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_4","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_4","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_4","") + tdSql.query("select 1-1 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): - sql = "select ts1 , timediff(asct1,now) from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2, " % time_fun_2 + sql = "select ts1 , timediff(asct1,now) from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts1 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) \ or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): - sql = "select ts2 , asct1,now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2, " % time_fun_2 + sql = "select ts2 , asct1,now(),today(),timezone() from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts2 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : - sql = "select max(asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2 " % time_fun_2 + sql = "select max(asct1),now(),today(),timezone() from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2 " % time_fun_2 sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(asct1,now),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , timediff(asct2,now),now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_2 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) #sql += "%s " % random.choice(having_support) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) + self.cur1.execute(sql) + self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts , (asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2,now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_2 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + self.cur1.execute(sql) + self.explain_sql(sql) + elif (timelist == ['ELAPSED']) : sql = "select min(asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1 " % time_fun_1 + sql += "%s as asct1 " % time_fun_1 sql += " from regular_table_1 where " sql += "%s )" % random.choice(self.q_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select avg(asct2),now(),today(),timezone() from ( select " - sql += "%s as asct2 " % time_fun_2 + sql += "%s as asct2 " % time_fun_2 sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - + self.cur1.execute(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ @@ -2993,20 +2993,20 @@ class TDTestCase: sql += "%s as asct1, ts ," % time_fun_1 sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % time_fun_2 sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += " order by asct1 desc " sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3015,176 +3015,176 @@ class TDTestCase: sql += "%s as asct1, ts ," % time_fun_1 sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % time_fun_2 sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += " order by asct1 desc " sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + elif (timelist == ['ELAPSED']) : sql = "select abs(asct1),now(),today(),timezone() from ( select " sql += "%s as asct1," % time_fun_1 sql += "%s as asct2 " % time_fun_2 sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2," % time_fun_2 sql += "%s as asct1 " % time_fun_1 sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) - sql += " order by asct1 asc " + sql += " order by asct1 asc " sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct11, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct12, " % time_fun_join_1 - sql += "t1.%s as asct111, " % random.choice(self.q_select) - sql += "t2.%s as asct121, " % random.choice(self.q_select) + sql += "%s as asct11, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct12, " % time_fun_join_1 + sql += "t1.%s as asct111, " % random.choice(self.q_select) + sql += "t2.%s as asct121, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), (asct1) from ( select t1.ts as ts1," - sql += "%s as asct10, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct11, " % time_fun_join_1 - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct10, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct11, " % time_fun_join_1 + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + elif (timelist == ['ELAPSED']) : sql = "select floor(asct1) from ( select " - sql += "%s as asct10, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct11" % time_fun_join_1 + sql += "%s as asct10, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct11" % time_fun_join_1 sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as time_nest from stable_1 limit 1;") for i in range(self.fornum): - if (timelist == ['ELAPSED']) : + if (timelist == ['ELAPSED']) : sql = "select now(),today(),timezone(), " - sql += "%s, " % time_fun_1 + sql += "%s, " % time_fun_1 sql += "%s " % time_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) else: sql = "select ts ,now(),today(),timezone(), " - sql += "%s as asct11, " % time_fun_1 + sql += "%s as asct11, " % time_fun_1 sql += "%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct13, " % random.choice(self.q_select) sql += "%s as asct14 " % time_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 1-6 as time_nest from stable_1 limit 1;") - for i in range(self.fornum): + for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts ,timediff(ts1,ts), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % time_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts ,timediff(ts1,ts), (asct1) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % time_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select (asct1)*111 from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct122 " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct122 " % time_fun_join_1 sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3195,15 +3195,15 @@ class TDTestCase: sql = "select ts1,m1 , timediff(asct1,now) from ( select " sql += "%s as asct1, ts as m1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) @@ -3211,15 +3211,15 @@ class TDTestCase: sql = "select tm1,tm2 , (asct1),now(),today(),timezone() from ( select " sql += "%s as asct1, ts as tm1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as tm2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) @@ -3230,12 +3230,12 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ @@ -3245,15 +3245,15 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as tm1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as tm2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) @@ -3263,18 +3263,18 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) tdSql.checkRows(300) - self.cur1.execute(sql) - self.explain_sql(sql) + self.cur1.execute(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select floor(abs(asct1)),now(),today(),timezone() " sql += "from ( select " @@ -3283,10 +3283,10 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) + tdSql.query(sql) + self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 1-9 as time_nest from stable_1 limit 1;") @@ -3294,12 +3294,12 @@ class TDTestCase: if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -3307,19 +3307,19 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1 from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -3327,27 +3327,27 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) + self.cur1.execute(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select min(asct1*110) from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) - + self.cur1.execute(sql) + self.explain_sql(sql) + self.restartDnodes() tdSql.query("select 1-10 as time_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -3372,8 +3372,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3397,11 +3397,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) + self.cur1.execute(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select abs(asct1),now(),today(),timezone() from ( select " sql += "%s as asct1 ," % time_fun_1 @@ -3416,12 +3416,12 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as time_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -3445,8 +3445,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3469,8 +3469,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3486,11 +3486,11 @@ class TDTestCase: sql += "%s as asct2 " % time_fun_2 sql += " from stable_2 where " sql += "%s " % random.choice(self.q_where) - sql += "order by asct1 " + sql += "order by asct1 " sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -3500,114 +3500,114 @@ class TDTestCase: if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1,now() from ( select t1.ts as ts1," - sql += "%s, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select min(floor(asct1)),now() from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(%s,now)," % time_fun_2 - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % time_fun_2 - sql += "%s as asct122 " % random.choice(self.t_select) + sql += "%s as asct122 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts ,now(),today(),timezone(), " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % time_fun_2 - sql += "%s as asct122 " % random.choice(self.t_select) + sql += "%s as asct122 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select now(),today(),timezone(), " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct12 " % time_fun_2 sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-14 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(asct1,now),timediff(now,asct2) from ( select ts ts ," - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -3615,14 +3615,14 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts , (asct1),now(),(now()),asct2 from ( select ts ts ," - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -3630,88 +3630,88 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select (asct1)*asct2,now(),(now()) from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts ,timediff(ts1,ts), timediff(asct1,now),timediff(now,asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts ,timediff(ts1,ts), asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select t1.ts as ts1," - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) + self.cur1.execute(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f %s sql start!" %timelist) @@ -3720,149 +3720,149 @@ class TDTestCase: _ = subprocess.check_output(taos_cmd1, shell=True) print("taos -f %s sql over!" %timelist) endTime_taos_f = time.time() - print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %timelist) + print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %timelist) def base_nest(self,baselist): - - print("==========%s===start=============" %baselist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %baselist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (baselist == ['A']) or (baselist == ['S']) or (baselist == ['F']) \ or (baselist == ['C']): - base_functions = baselist - fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] + base_functions = baselist + fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] fun_column_1 = random.sample(base_functions,1)+random.sample(fun_fix_column,1) base_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(base_functions,1)+random.sample(fun_fix_column,1) base_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)', - '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] + '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] fun_column_join_1 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1) base_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1) base_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (baselist == ['P']) or (baselist == ['M']) or (baselist == ['S'])or (baselist == ['T']): - base_functions = baselist - num = random.randint(0, 1000) + base_functions = baselist + num = random.randint(0, 1000) fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)', - '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] + '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] fun_column_1 = random.sample(base_functions,1)+random.sample(fun_fix_column,1) base_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num)) fun_column_2 = random.sample(base_functions,1)+random.sample(fun_fix_column,1) base_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num)) - + fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)', '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)', '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)', - '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] + '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] fun_column_join_1 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1) base_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num)) fun_column_join_2 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1) base_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num)) - + tdSql.query("select 1-1 as base_nest from stable_1 limit 1;") for i in range(self.fornum): - sql = "select ts , floor(asct1) from ( select " - sql += "%s as asct1, " % base_fun_1 - sql += "%s as asct2, " % base_fun_2 + sql = "select ts , floor(asct1) from ( select " + sql += "%s as asct1, " % base_fun_1 + sql += "%s as asct2, " % base_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) - + tdSql.query("select 1-2 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , abs(asct1) from ( select " - sql += "%s as asct1, " % base_fun_1 + sql += "%s as asct1, " % base_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2 from ( select " - sql += "%s as asct2, " % base_fun_2 + sql += "%s as asct2, " % base_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) #sql += "%s " % random.choice(having_support) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #tdSql.query(sql) - #self.cur1.execute(sql) - + #self.cur1.execute(sql) + tdSql.query("select 1-3 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , min(asct1) from ( select " sql += "%s as asct1, ts ," % base_fun_1 sql += "%s as asct2, " % base_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % base_fun_2 sql += "%s as asct1, " % base_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #tdSql.query(sql) #self.cur1.execute(sql) - + tdSql.query("select 1-4 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1 from ( select t1.ts as ts1," - sql += "%s, " % base_fun_join_1 - sql += "%s as asct1, " % base_fun_join_2 - sql += "%s, " % base_fun_join_1 - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) + sql += "%s, " % base_fun_join_1 + sql += "%s as asct1, " % base_fun_join_2 + sql += "%s, " % base_fun_join_1 + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) - + tdSql.query("select 1-5 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts ," - sql += "%s, " % base_fun_1 + sql += "%s, " % base_fun_1 + sql += "%s, " % random.choice(self.q_select) sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.q_select) sql += "%s " % base_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) @@ -3870,19 +3870,19 @@ class TDTestCase: tdSql.query("select 1-6 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % base_fun_join_1 - sql += "%s as asct1, " % base_fun_join_2 - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) - sql += "%s, " % base_fun_join_1 + sql += "%s, " % base_fun_join_1 + sql += "%s as asct1, " % base_fun_join_2 + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) + sql += "%s, " % base_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) tdSql.query("select 1-7 as base_nest from stable_1 limit 1;") @@ -3890,18 +3890,18 @@ class TDTestCase: sql = "select ts , abs(asct1) from ( select " sql += "%s as asct1, ts ," % base_fun_1 sql += "%s as asct2, " % base_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) - + tdSql.query("select 1-8 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts,floor(asct1) " @@ -3909,13 +3909,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts ," % base_fun_1 sql += "%s as asct2, " % base_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -3924,12 +3924,12 @@ class TDTestCase: tdSql.query("select 1-9 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % base_fun_join_1 - sql += "%s as asct1, " % base_fun_join_2 - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) + sql += "%s, " % base_fun_join_1 + sql += "%s as asct1, " % base_fun_join_2 + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -3937,11 +3937,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) - + self.restartDnodes() tdSql.query("select 1-10 as base_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -3964,11 +3964,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #tdSql.query(sql) #self.cur1.execute(sql) - + #3 inter union not support tdSql.query("select 1-11 as base_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -3992,53 +3992,53 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #TD-15837 tdSql.query(sql) # self.cur1.execute(sql) tdSql.query("select 1-12 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % base_fun_join_1 - sql += "%s as asct1, " % base_fun_join_2 - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) + sql += "%s, " % base_fun_join_1 + sql += "%s as asct1, " % base_fun_join_2 + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) - + tdSql.query("select 1-13 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts ," - sql += "%s, " % base_fun_1 + sql += "%s, " % base_fun_1 + sql += "%s, " % random.choice(self.q_select) sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.q_select) sql += "%s " % base_fun_2 - sql += "%s " % random.choice(self.t_select) + sql += "%s " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) - + tdSql.query("select 1-14 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select avg(asct1),count(asct2) from ( select " - sql += "%s as asct1, " % base_fun_1 + sql += "%s as asct1, " % base_fun_1 sql += "%s as asct2" % base_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -4046,33 +4046,33 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - + self.cur1.execute(sql) + tdSql.query("select 1-15 as base_nest from stable_1 limit 1;") for i in range(self.fornum): sql = "select ts , max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % base_fun_join_1 - sql += "%s as asct1, " % base_fun_join_2 - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) - sql += "t2.%s " % random.choice(self.q_select) + sql += "%s, " % base_fun_join_1 + sql += "%s as asct1, " % base_fun_join_2 + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) + sql += "t2.%s " % random.choice(self.q_select) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - self.cur1.execute(sql) - + self.cur1.execute(sql) + #taos -f sql startTime_taos_f = time.time() print("taos -f %s sql start!" %baselist) @@ -4080,35 +4080,35 @@ class TDTestCase: _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8") print("taos -f %s sql over!" %baselist) endTime_taos_f = time.time() - print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %baselist) - + print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %baselist) + def function_before_26(self): - + print('=====================2.6 old function start ===========') - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + #1 select * from (select column form regular_table where <\>\in\and\or order by) tdSql.query("select 1-1 from stable_1;") for i in range(self.fornum): sql = "select tas from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as tas from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) - sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + sql += ");" + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql,queryTimes=1) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) - - #1 outer union not support + + #1 outer union not support #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 1-2 from stable_1;") for i in range(self.fornum): @@ -4127,13 +4127,13 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) - + #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 1-2 from stable_1;") for i in range(self.fornum): @@ -4151,13 +4151,13 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(200) self.cur1.execute(sql) self.explain_sql(sql) - + #1 inter union not support tdSql.query("select 1-3 from stable_1;") for i in range(self.fornum): @@ -4167,7 +4167,7 @@ class TDTestCase: sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "" + sql += "" sql += " union all select " sql += "%s, " % random.choice(self.s_r_select) sql += "%s, " % random.choice(self.q_select) @@ -4175,13 +4175,13 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 1-3 from stable_1;") for i in range(self.fornum): sql = "select ts from ( select " @@ -4196,48 +4196,48 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) - - #join:select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by) + + #join:select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 1-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts as t1ts," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) sql += "t2.ts as t2ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) - sql += "and %s " % random.choice(self.q_u_or_where) + sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) - #2 select column from (select * form regular_table ) where <\>\in\and\or order by + #2 select column from (select * form regular_table ) where <\>\in\and\or order by #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 2-1 from stable_1;") for i in range(self.fornum): sql = "select ts ," sql += "%s, " % random.choice(self.s_r_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(100) self.cur1.execute(sql) @@ -4248,31 +4248,31 @@ class TDTestCase: tdSql.query("select 2-2 from stable_1;") for i in range(self.fornum): sql = "select ts , * from ( select t1.ts ," - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t1.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) - sql += "t2.%s, " % random.choice(self.q_select) + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t1.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) + sql += "t2.%s, " % random.choice(self.q_select) sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 ) where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.order_u_where) #sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.error(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.error(sql) - #3 select * from (select column\tag form stable where <\>\in\and\or order by ) + #3 select * from (select column\tag form stable where <\>\in\and\or order by ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 3-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) @@ -4284,39 +4284,39 @@ class TDTestCase: sql += "%s " % random.choice(self.s_r_select) sql += "from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) self.explain_sql(sql) - # select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by ) + # select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 3-2 from stable_1;") for i in range(self.fornum): #sql = "select ts , * from ( select t1.ts as t1ts , " sql = "select t1ts , t2ts from ( select t1.ts as t1ts , " - sql += "t1.%s as t11, " % random.choice(self.t_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t13, " % random.choice(self.t_select) - sql += "t2.%s as t14, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.t_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t13, " % random.choice(self.t_select) + sql += "t2.%s as t14, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.order_u_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #3 outer union not support self.restartDnodes() tdSql.query("select 3-3 from stable_1;") @@ -4336,10 +4336,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - tdSql.checkRows(300) + tdSql.checkRows(500) self.cur1.execute(sql) self.explain_sql(sql) for i in range(self.fornum): @@ -4357,13 +4357,13 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(600) self.cur1.execute(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 3-4 from stable_1;") for i in range(self.fornum): @@ -4380,9 +4380,9 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4390,53 +4390,53 @@ class TDTestCase: tdSql.query("select 3-5 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts as t1ts," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - tdSql.checkRows(300) + tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 3-6 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts as t1ts ," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) - tdSql.checkRows(300) + tdSql.checkRows(100) self.cur1.execute(sql) self.explain_sql(sql) - #4 select column from (select * form stable where <\>\in\and\or order by ) + #4 select column from (select * form stable where <\>\in\and\or order by ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 4-1 from stable_1;") for i in range(self.fornum): sql = "select ts , " sql += "%s as t11, " % random.choice(self.q_select) - sql += "%s as t12, " % random.choice(self.q_select) - sql += "%s " % random.choice(self.t_select) + sql += "%s as t12, " % random.choice(self.q_select) + sql += "%s " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(300) self.cur1.execute(sql) @@ -4451,8 +4451,8 @@ class TDTestCase: sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4462,12 +4462,12 @@ class TDTestCase: for i in range(self.fornum): sql = "select distinct c5_1 " sql += " from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += " as c5_1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4481,8 +4481,8 @@ class TDTestCase: sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_desc_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) tdSql.query("select 6-1 from stable_1;") for i in range(self.fornum): @@ -4490,8 +4490,8 @@ class TDTestCase: sql += "%s " % random.choice(self.dt_select) sql += " from stable_1 where " sql += "%s ) ;" % random.choice(self.qt_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4506,9 +4506,9 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[0] , self.limit_where[1]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.error(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.error(sql) tdSql.query("select 7-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " @@ -4517,8 +4517,8 @@ class TDTestCase: sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice([self.limit_where[0] , self.limit_where[1]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) tdSql.checkRows(1) self.cur1.execute(sql) @@ -4526,45 +4526,45 @@ class TDTestCase: #calc_select,TWA/Diff/Derivative/Irate are not allowed to apply to super table directly #8 select * from (select ts,calc form ragular_table where <\>\in\and\or order by ) - + # dcDB = self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 8-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select ts ," - sql += "%s " % random.choice(self.calc_select_support_ts) + sql += "%s " % random.choice(self.calc_select_support_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 8-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_not_support_ts) + sql += "%s " % random.choice(self.calc_select_not_support_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4572,130 +4572,130 @@ class TDTestCase: tdSql.query("select 8-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts, " - sql += "%s " % random.choice(self.calc_select_in_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_support_ts_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + self.cur1.execute(sql) + self.explain_sql(sql) - #9 select * from (select ts,calc form stable where <\>\in\and\or order by ) + #9 select * from (select ts,calc form stable where <\>\in\and\or order by ) # self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 9-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_not_support_ts) + sql += "%s " % random.choice(self.calc_select_not_support_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 9-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select ts ," - sql += "%s " % random.choice(self.calc_select_support_ts) + sql += "%s " % random.choice(self.calc_select_support_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 9-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 9-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts," - sql += "%s " % random.choice(self.calc_select_in_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_support_ts_j) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - - #10 select calc from (select * form regualr_table where <\>\in\and\or order by ) + + #10 select calc from (select * form regualr_table where <\>\in\and\or order by ) tdSql.query("select 10-1 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql = "select " + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "as calc10_1 from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #10-1 select calc from (select * form regualr_table where <\>\in\and\or order by ) - # rsDn = self.restartDnodes() + # rsDn = self.restartDnodes() # self.dropandcreateDB_random("%s" %db, 1) # rsDn = self.restartDnodes() tdSql.query("select 10-2 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql = "select " + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc10_2 from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - #10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by ) + #10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by ) tdSql.query("select 10-3 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "count(*) as calc10_3 " + sql = "select " + sql += "count(*) as calc10_3 " sql += " from ( select t1.ts as t11, t2.ts as t22 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += " and %s " % random.choice(self.q_u_or_where) @@ -4703,16 +4703,16 @@ class TDTestCase: sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 10-4 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "%s as calc10_4 " % random.choice(self.calc_select_all) + sql = "select " + sql += "%s as calc10_4 " % random.choice(self.calc_select_all) sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += " and %s " % random.choice(self.q_u_or_where) @@ -4720,84 +4720,84 @@ class TDTestCase: sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) - #11 select calc from (select * form stable where <\>\in\and\or order by limit ) + #11 select calc from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 11-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "as calc11_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - #11-1 select calc from (select * form stable where <\>\in\and\or order by limit ) + #11-1 select calc from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 11-2 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc11_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #11-2 select calc from (select * form stables where <\>\in\and\or order by limit ) tdSql.query("select 11-3 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) tdSql.query("select 11-4 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) - #12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit ) + #12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit ) ##self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 12-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4805,27 +4805,27 @@ class TDTestCase: tdSql.query("select 12-2 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) tdSql.query("select 12-2.2 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.error(sql) #12-1 select calc-diff from (select * form stable where <\>\in\and\or order by limit ) @@ -4833,15 +4833,15 @@ class TDTestCase: self.restartDnodes() for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4850,15 +4850,15 @@ class TDTestCase: #join query does not support group by for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular_j) + sql += "%s " % random.choice(self.calc_calculate_regular_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.partiton_where_j) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4867,31 +4867,31 @@ class TDTestCase: #join query does not support group by for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular_j) + sql += "%s " % random.choice(self.calc_calculate_regular_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #13 select calc-diff as diffns from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 13-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " as calc13_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4900,15 +4900,15 @@ class TDTestCase: tdSql.query("select 14-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) - sql += "%s " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) + sql += "%s " % random.choice(self.calc_aggregate_all) sql += " as calc14_3 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.group_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4917,16 +4917,16 @@ class TDTestCase: tdSql.query("select 14-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) - sql += "%s " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) + sql += "%s " % random.choice(self.calc_aggregate_all) sql += " as calc14_3 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where_regular) sql += "%s " % random.choice(self.slimit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4935,17 +4935,17 @@ class TDTestCase: tdSql.query("select 14-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) - sql += "%s " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) + sql += "%s " % random.choice(self.calc_aggregate_all_j) sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4953,17 +4953,17 @@ class TDTestCase: tdSql.query("select 14-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) - sql += "%s " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) + sql += "%s " % random.choice(self.calc_aggregate_all_j) sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -4972,48 +4972,48 @@ class TDTestCase: tdSql.query("select 15-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular) - sql += "%s " % random.choice(self.calc_aggregate_regular) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular) + sql += "%s " % random.choice(self.calc_aggregate_regular) sql += " as calc15_3 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s " % random.choice(self.group_where_regular) + sql += "%s " % random.choice(self.group_where_regular) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - self.data_check(sql,mark='15-1') - + tdLog.info(sql) + tdLog.info(len(sql)) + self.data_check(sql,mark='15-1') + tdSql.query("select 15-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_2 " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_2 " % random.choice(self.calc_aggregate_regular_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) - sql += "%s " % random.choice(self.group_where_regular_j) + sql += "%s " % random.choice(self.group_where_regular_j) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 15-2.2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j) - sql += "%s " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j) + sql += "%s " % random.choice(self.calc_aggregate_regular_j) sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) - sql += "%s " % random.choice(self.group_where_regular_j) + sql += "%s " % random.choice(self.group_where_regular_j) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5021,226 +5021,226 @@ class TDTestCase: tdSql.query("select 15-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) sql += " as calc15_3 from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_only_where) sql += "%s " % random.choice(self.having_support) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 15-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.group_only_where_j) sql += "%s " % random.choice(self.having_support_j) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 15-4.2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.group_where_j) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_u_where) - tdLog.info(sql) - tdLog.info(len(sql)) - self.data_check(sql,mark='15-4.2') + tdLog.info(sql) + tdLog.info(len(sql)) + self.data_check(sql,mark='15-4.2') tdSql.query("select 15-5 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) sql += " as calc15_3 from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_where) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - #16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset ) + #16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 16-1 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_1 , " % random.choice(self.calc_aggregate_all) - sql += "%s as calc16_2 " % random.choice(self.calc_select_in) + sql += "%s as calc16_1 , " % random.choice(self.calc_aggregate_all) + sql += "%s as calc16_2 " % random.choice(self.calc_select_in) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j) - sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) + sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-2.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j) - sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) + sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 16-3 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-4 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-4.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 16-5 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_1 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_2 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_3 " % random.choice(self.calc_calculate_all) + sql += "%s as calc16_2 , " % random.choice(self.calc_calculate_all) + sql += "%s as calc16_3 " % random.choice(self.calc_calculate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc16_1 " + sql += "order by calc16_1 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 16-6 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-7 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 16-8 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5249,56 +5249,56 @@ class TDTestCase: #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 17-1 from stable_1;") for i in range(self.fornum): - #this is having_support , but tag-select cannot mix with last_row,other select can + #this is having_support , but tag-select cannot mix with last_row,other select can sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 17-2 from stable_1;") for i in range(self.fornum): - #this is having_support , but tag-select cannot mix with last_row,other select can + #this is having_support , but tag-select cannot mix with last_row,other select can sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 17-2.2 from stable_1;") for i in range(self.fornum): - #this is having_support , but tag-select cannot mix with last_row,other select can + #this is having_support , but tag-select cannot mix with last_row,other select can sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5307,17 +5307,17 @@ class TDTestCase: for i in range(self.fornum): #this is having_tagnot_support , because tag-select cannot mix with last_row... sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5325,16 +5325,16 @@ class TDTestCase: for i in range(self.fornum): #this is having_tagnot_support , because tag-select cannot mix with last_row... sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5342,82 +5342,82 @@ class TDTestCase: for i in range(self.fornum): #this is having_tagnot_support , because tag-select cannot mix with last_row... sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 17-5 from stable_1;") for i in range(self.fornum): - #having_not_support + #having_not_support sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 17-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 17-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 17-7.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5425,48 +5425,48 @@ class TDTestCase: tdSql.query("select 17-8 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 17-9 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 17-10 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5474,48 +5474,48 @@ class TDTestCase: tdSql.query("select 18-1 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 18-2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 18-2.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) @@ -5523,258 +5523,258 @@ class TDTestCase: tdSql.query("select 18-3 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 18-4 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 18-4.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 18-5 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 18-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 18-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - #19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding + #19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 19-1 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.state_window) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.state_u_window) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-2.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_or_where) + sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.state_u_window) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + tdSql.query("select 19-3 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.state_window) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-4 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-4.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_or_where) + sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-5 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.state_window) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " sql += "%s " % random.choice(self.interval_sliding) - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.error(sql) - + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.error(sql) + tdSql.query("select 19-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) tdSql.query("select 19-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.qt_u_or_where) + sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - #20 select * from (select calc_select_fills form regualr_table or stable where <\>\in\and\or fill_where group by order by limit offset ) + #20 select * from (select calc_select_fills form regualr_table or stable where <\>\in\and\or fill_where group by order by limit offset ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 20-1 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill) - sql += "%s ," % random.choice(self.calc_select_fill) - sql += "%s " % random.choice(self.calc_select_fill) + sql += "%s ," % random.choice(self.calc_select_fill) + sql += "%s " % random.choice(self.calc_select_fill) sql += " from stable_1 where " - sql += "%s " % random.choice(self.interp_where) + sql += "%s " % random.choice(self.interp_where) sql += "%s " % random.choice(self.fill_where) sql += "%s " % random.choice(self.group_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) @@ -5782,303 +5782,303 @@ class TDTestCase: rsDn = self.restartDnodes() tdSql.query("select 20-2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill_j) - sql += "%s ," % random.choice(self.calc_select_fill_j) - sql += "%s " % random.choice(self.calc_select_fill_j) + sql += "%s ," % random.choice(self.calc_select_fill_j) + sql += "%s " % random.choice(self.calc_select_fill_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s and " % random.choice(self.t_join_where) - sql += "%s " % random.choice(self.interp_where_j) + sql += "%s " % random.choice(self.interp_where_j) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) tdSql.query("select 20-2.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill_j) - sql += "%s ," % random.choice(self.calc_select_fill_j) - sql += "%s " % random.choice(self.calc_select_fill_j) + sql += "%s ," % random.choice(self.calc_select_fill_j) + sql += "%s " % random.choice(self.calc_select_fill_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s and " % random.choice(self.qt_u_or_where) - sql += "%s " % random.choice(self.interp_where_j) + sql += "%s " % random.choice(self.interp_where_j) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) tdSql.query("select 20-3 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill) - sql += "%s ," % random.choice(self.calc_select_fill) - sql += "%s " % random.choice(self.calc_select_fill) + sql += "%s ," % random.choice(self.calc_select_fill) + sql += "%s " % random.choice(self.calc_select_fill) sql += " from stable_1 where " - sql += "%s " % self.interp_where[2] + sql += "%s " % self.interp_where[2] sql += "%s " % random.choice(self.fill_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) - + tdSql.query("select 20-4 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill_j) - sql += "%s ," % random.choice(self.calc_select_fill_j) - sql += "%s " % random.choice(self.calc_select_fill_j) - sql += " from stable_1 t1, table_1 t2 where t1.ts = t2.ts and " + sql += "%s ," % random.choice(self.calc_select_fill_j) + sql += "%s " % random.choice(self.calc_select_fill_j) + sql += " from stable_1 t1, table_1 t2 where t1.ts = t2.ts and " #sql += "%s and " % random.choice(self.t_join_where) sql += "%s " % self.interp_where_j[random.randint(0,5)] sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) #interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) tdSql.query("select 20-4.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill_j) - sql += "%s ," % random.choice(self.calc_select_fill_j) - sql += "%s " % random.choice(self.calc_select_fill_j) - sql += " from stable_1 t1, stable_1_1 t2 where t1.ts = t2.ts and " + sql += "%s ," % random.choice(self.calc_select_fill_j) + sql += "%s " % random.choice(self.calc_select_fill_j) + sql += " from stable_1 t1, stable_1_1 t2 where t1.ts = t2.ts and " sql += "%s and " % random.choice(self.qt_u_or_where) sql += "%s " % self.interp_where_j[random.randint(0,5)] sql += "%s " % random.choice(self.fill_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) ##interp不支持 tdSql.error(sql) #self.cur1.execute(sql) #self.explain_sql(sql) - + tdSql.query("select 20-5 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill) - sql += "%s ," % random.choice(self.calc_select_fill) - sql += "%s " % random.choice(self.calc_select_fill) + sql += "%s ," % random.choice(self.calc_select_fill) + sql += "%s " % random.choice(self.calc_select_fill) sql += " from regular_table_1 where " - sql += "%s " % self.interp_where[1] + sql += "%s " % self.interp_where[1] sql += "%s " % random.choice(self.fill_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) ##interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) tdSql.query("select 20-6 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s , " % random.choice(self.calc_select_fill_j) - sql += "%s ," % random.choice(self.calc_select_fill_j) - sql += "%s " % random.choice(self.calc_select_fill_j) + sql += "%s ," % random.choice(self.calc_select_fill_j) + sql += "%s " % random.choice(self.calc_select_fill_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " - #sql += "%s " % random.choice(self.interp_where_j) - sql += "%s " % self.interp_where_j[random.randint(0,5)] + #sql += "%s " % random.choice(self.interp_where_j) + sql += "%s " % self.interp_where_j[random.randint(0,5)] sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) ##interp不支持 tdSql.query(sql) #self.cur1.execute(sql) #self.explain_sql(sql) #1 select * from (select * from (select * form regular_table where <\>\in\and\or order by limit )) tdSql.query("select 1-1 from stable_1;") - for i in range(self.fornum): + for i in range(self.fornum): # sql_start = "select * from ( " # sql_end = ")" for_num = random.randint(1, 15); - sql = "select * from (" * for_num + sql = "select * from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_r_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.s_r_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ttt from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_r_select) - sql2 += "%s, " % random.choice(self.q_select) + sql2 += "%s, " % random.choice(self.s_r_select) + sql2 += "%s, " % random.choice(self.q_select) sql2 += "ts as tin from regular_table_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdLog.info(len(sql2)) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdLog.info(len(sql2)) + tdSql.query(sql2) self.cur1.execute(sql2) self.explain_sql(sql2) - + self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1) self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql ,1,10,3,3) self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3) - - tdLog.info("=====1-1==over=========") - + + tdLog.info("=====1-1==over=========") + for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select ts2 from (" * for_num + sql = "select ts2 from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_r_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.s_r_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts2 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_r_select) - sql2 += "%s, " % random.choice(self.q_select) + sql2 += "%s, " % random.choice(self.s_r_select) + sql2 += "%s, " % random.choice(self.q_select) sql2 += "ts as tt from regular_table_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdLog.info(len(sql2)) + sql2 += ")) " + tdLog.info(sql2) + tdLog.info(len(sql2)) tdSql.query(sql2) self.cur1.execute(sql2) - self.explain_sql(sql2) - + self.explain_sql(sql2) + self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1) - tdLog.info("=====1-2==over=========") - + tdLog.info("=====1-2==over=========") + #2 select * from (select * from (select * form stable where <\>\in\and\or order by limit )) tdSql.query("select 2-1 from stable_1;") for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select * from (" * for_num + sql = "select * from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.qt_select) + sql += "%s, " % random.choice(self.s_s_select) + sql += "%s, " % random.choice(self.qt_select) sql += "ts as tss from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_s_select) - sql2 += "%s, " % random.choice(self.qt_select) + sql2 += "%s, " % random.choice(self.s_s_select) + sql2 += "%s, " % random.choice(self.qt_select) sql2 += "ts as tst from stable_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdLog.info(len(sql2)) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdLog.info(len(sql2)) + tdSql.query(sql2) self.cur1.execute(sql2) self.explain_sql(sql2) - + self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3) - - tdLog.info("=====2-1==over=========") - + + tdLog.info("=====2-1==over=========") + for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select tsn from (" * for_num + sql = "select tsn from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.qt_select) + sql += "%s, " % random.choice(self.s_s_select) + sql += "%s, " % random.choice(self.qt_select) sql += "ts as tsn from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + sql2 = "select ts1 from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_s_select) - sql2 += "%s, " % random.choice(self.qt_select) + sql2 += "%s, " % random.choice(self.s_s_select) + sql2 += "%s, " % random.choice(self.qt_select) sql2 += "ts as ts1 from stable_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdLog.info(len(sql2)) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdLog.info(len(sql2)) + tdSql.query(sql2) self.cur1.execute(sql2) self.explain_sql(sql2) - + self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1) - tdLog.info("=====2-2==over=========") - - #3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit ) + tdLog.info("=====2-2==over=========") + + #3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 3-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.query(sql) - self.cur1.execute(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + self.cur1.execute(sql) self.explain_sql(sql) #4 select * from (select calc form stable where <\>\in\and\or order by limit ) tdSql.query("select 4-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) #sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) + tdLog.info(sql) + tdLog.info(len(sql)) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #5 select ts ,tbname from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 5-1 from stable_1;") for i in range(self.fornum): sql = "select ts , tbname , " - sql += "%s ," % random.choice(self.calc_calculate_regular) + sql += "%s ," % random.choice(self.calc_calculate_regular) sql += "%s ," % random.choice(self.dqt_select) sql += "%s " % random.choice(self.qt_select) sql += " from ( select * from stable_1 where " @@ -6086,9 +6086,9 @@ class TDTestCase: sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) - tdLog.info(len(sql)) - tdSql.error(sql) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.error(sql) #special sql tdSql.query("select 6-1 from stable_1;") @@ -6098,41 +6098,41 @@ class TDTestCase: sql = "select _block_dist() from (select * from stable_1);" tdSql.error(sql) sql = "select * from (select database());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select client_version());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select client_version() as version);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select server_version());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select server_version() as version);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select server_status());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) sql = "select * from (select server_status() as status);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f sql start!") @@ -6145,57 +6145,57 @@ class TDTestCase: print('=====================2.6 old function end ===========') - - + + def run(self): tdSql.prepare() - - startTime = time.time() - self.function_before_26() - + startTime = time.time() + + self.function_before_26() + self.math_nest(['UNIQUE']) - self.math_nest(['MODE']) + self.math_nest(['MODE']) self.math_nest(['SAMPLE']) - - # self.math_nest(['ABS','SQRT']) - # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) - # self.math_nest(['POW','LOG']) - # self.math_nest(['FLOOR','CEIL','ROUND']) - # self.math_nest(['MAVG']) - # self.math_nest(['HYPERLOGLOG']) - # self.math_nest(['TAIL']) + + # self.math_nest(['ABS','SQRT']) + # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) + # self.math_nest(['POW','LOG']) + # self.math_nest(['FLOOR','CEIL','ROUND']) + # self.math_nest(['MAVG']) + # self.math_nest(['HYPERLOGLOG']) + # self.math_nest(['TAIL']) # self.math_nest(['CSUM']) # self.math_nest(['statecount','stateduration']) - # self.math_nest(['HISTOGRAM']) - - # self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) - # self.str_nest(['LENGTH','CHAR_LENGTH']) - # self.str_nest(['SUBSTR']) - # self.str_nest(['CONCAT']) - # self.str_nest(['CONCAT_WS']) + # self.math_nest(['HISTOGRAM']) + + # self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) + # self.str_nest(['LENGTH','CHAR_LENGTH']) + # self.str_nest(['SUBSTR']) + # self.str_nest(['CONCAT']) + # self.str_nest(['CONCAT_WS']) # self.time_nest(['CAST']) #放到time里起来弄 # self.time_nest(['CAST_1']) # self.time_nest(['CAST_2']) # self.time_nest(['CAST_3']) # self.time_nest(['CAST_4']) - - - - # self.time_nest(['NOW','TODAY']) - # self.time_nest(['TIMEZONE']) - # self.time_nest(['TIMETRUNCATE']) + + + + # self.time_nest(['NOW','TODAY']) + # self.time_nest(['TIMEZONE']) + # self.time_nest(['TIMETRUNCATE']) # self.time_nest(['TO_ISO8601']) # self.time_nest(['TO_UNIXTIMESTAMP']) # self.time_nest(['ELAPSED']) self.time_nest(['TIMEDIFF_1']) self.time_nest(['TIMEDIFF_2']) - + endTime = time.time() print("total time %ds" % (endTime - startTime)) - + def stop(self): diff --git a/tests/system-test/2-query/stablity.py b/tests/system-test/2-query/stablity.py index 569bee62ec..ff026bf120 100755 --- a/tests/system-test/2-query/stablity.py +++ b/tests/system-test/2-query/stablity.py @@ -24,10 +24,10 @@ from util.dnodes import tdDnodes from util.dnodes import * class TDTestCase: - updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , + updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143} - + def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) @@ -36,13 +36,13 @@ class TDTestCase: 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.num = 10 self.fornum = 5 - + self.db_nest = "stab" self.dropandcreateDB_random("%s" %self.db_nest, 1) - + # regular column select self.q_select= ['q_int', 'q_bigint' , 'q_bigint' , 'q_smallint' , 'q_tinyint' , 'q_bool' , 'q_binary' , 'q_nchar' ,'q_float' , 'q_double' ,'q_ts ', 'q_int_null ', 'q_bigint_null ' , 'q_bigint_null ' , 'q_smallint_null ' , 'q_tinyint_null ' , 'q_bool_null ' , 'q_binary_null ' , 'q_nchar_null ' ,'q_float_null ' , 'q_double_null ' ,'q_ts_null '] @@ -53,11 +53,11 @@ class TDTestCase: self.qt_select= self.q_select + self.t_select # distinct regular column select - self.dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' , + self.dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' , 'distinct q_bool' , 'distinct q_binary' , 'distinct q_nchar' ,'distinct q_float' , 'distinct q_double' ,'distinct q_ts '] # distinct tag column select - self.dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' , + self.dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' , 'distinct t_bool' , 'distinct t_binary' , 'distinct t_nchar' ,'distinct t_float' , 'distinct t_double' ,'distinct t_ts '] # distinct regular and tag column select @@ -68,13 +68,13 @@ class TDTestCase: self.s_s_select= ['tbname' , '_rowts' , '_c0', '_C0' ] self.unionall_or_union= [ ' union ' , ' union all ' ] - # regular column where + # regular column where self.q_where = ['ts < now +1s','q_bigint >= -9223372036854775807 and q_bigint <= 9223372036854775807', 'q_int <= 2147483647 and q_int >= -2147483647', - 'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308', - 'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' , + 'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308', + 'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' , 'q_bool = true or q_bool = false' , 'q_bool in (0 , 1)' , 'q_bool in ( true , false)' , 'q_bool = 0 or q_bool = 1', - 'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767', - 'q_bigint not between 9223372036854775807 and -9223372036854775807','q_int not between 2147483647 and -2147483647','q_smallint not between 32767 and -32767', + 'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767', + 'q_bigint not between 9223372036854775807 and -9223372036854775807','q_int not between 2147483647 and -2147483647','q_smallint not between 32767 and -32767', 'q_tinyint between -127 and 127 ','q_float >= -3.4E38 ','q_float <= 3.4E38 ','q_double >= -1.7E308 ', 'q_double <= 1.7E308 ','q_float between -3.4E38 and 3.4E38 ','q_double between -1.7E308 and 1.7E308 ' ,'q_float not between 3.4E38 and -3.4E38 ','q_double not between 1.7E308 and -1.7E308 ', 'q_float is not null ' ,'q_double is not null ' ,'q_binary match \'binary\' ','q_binary nmatch \'binarynchar\' ','q_nchar match \'nchar\' ','q_nchar nmatch \'binarynchar\' ', @@ -88,38 +88,38 @@ class TDTestCase: 't1.q_smallint >= -32767 and t1.q_smallint <= 32767 and t2.q_smallint >= -32767 and t2.q_smallint <= 32767', 't1.q_tinyint >= -127 and t1.q_tinyint <= 127 and t2.q_tinyint >= -127 and t2.q_tinyint <= 127', 't1.q_float >= - 1.7E308 and t1.q_float <= 1.7E308 and t2.q_float >= - 1.7E308 and t2.q_float <= 1.7E308', - 't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308', - 't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' , - 't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' , - 't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' , + 't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308', + 't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' , + 't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' , + 't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' , 't1.q_bigint between -9223372036854775807 and 9223372036854775807 and t2.q_bigint between -9223372036854775807 and 9223372036854775807', 't1.q_int between -2147483647 and 2147483647 and t2.q_int between -2147483647 and 2147483647', - 't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767', + 't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767', 't1.q_tinyint between -127 and 127 and t2.q_tinyint between -127 and 127 ','t1.q_float between -1.7E308 and 1.7E308 and t2.q_float between -1.7E308 and 1.7E308', 't1.q_double between -1.7E308 and 1.7E308 and t2.q_double between -1.7E308 and 1.7E308', 't1.q_bigint not between 9223372036854775807 and -9223372036854775807 and t2.q_bigint not between 9223372036854775807 and -9223372036854775807', 't1.q_int not between 2147483647 and -2147483647 and t2.q_int not between 2147483647 and -2147483647', - 't1.q_smallint not between 32767 and -32767 and t2.q_smallint not between 32767 and -32767', + 't1.q_smallint not between 32767 and -32767 and t2.q_smallint not between 32767 and -32767', 't1.q_tinyint not between 127 and -127 and t2.q_tinyint not between 127 and -127 ','t1.q_float not between -1.7E308 and -1.7E308 and t2.q_float not between 1.7E308 and -1.7E308', 't1.q_double not between 1.7E308 and -1.7E308 and t2.q_double not between 1.7E308 and -1.7E308'] #TD-6201 ,'t1.q_bool between 0 and 1 or t2.q_bool between 0 and 1'] #'t1.q_bool = true and t1.q_bool = false and t2.q_bool = true and t2.q_bool = false' , 't1.q_bool = 0 and t1.q_bool = 1 and t2.q_bool = 0 and t2.q_bool = 1' , - self.q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' , - '(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' , + self.q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' , + '(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' , '(t1.q_bool in (0 , 1) or t2.q_bool in (0 , 1))' , '(t1.q_bool in ( true , false) or t2.q_bool in ( true , false))' , '(t1.q_bool = 0 or t1.q_bool = 1 or t2.q_bool = 0 or t2.q_bool = 1)' , '(t1.q_bigint between -9223372036854775807 and 9223372036854775807 or t2.q_bigint between -9223372036854775807 and 9223372036854775807)', '(t1.q_int between -2147483647 and 2147483647 or t2.q_int between -2147483647 and 2147483647)', - '(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)', + '(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)', '(t1.q_tinyint between -127 and 127 or t2.q_tinyint between -127 and 127 )','(t1.q_float between -1.7E308 and 1.7E308 or t2.q_float between -1.7E308 and 1.7E308)', '(t1.q_double between -1.7E308 and 1.7E308 or t2.q_double between -1.7E308 and 1.7E308)'] # tag column where self.t_where = ['ts < now +1s','t_bigint >= -9223372036854775807 and t_bigint <= 9223372036854775807','t_int <= 2147483647 and t_int >= -2147483647', 't_smallint >= -32767 and t_smallint <= 32767','q_tinyint >= -127 and t_tinyint <= 127','t_float >= -1.7E308 and t_float <= 1.7E308', - 't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' , + 't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' , 't_bool = true or t_bool = false' , 't_bool in (0 , 1)' , 't_bool in ( true , false)' , 't_bool = 0 or t_bool = 1', - 't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767', + 't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767', 't_tinyint between -127 and 127 ','t_float between -1.7E308 and 1.7E308','t_double between -1.7E308 and 1.7E308', 't_binary match \'binary\' ','t_binary nmatch \'binarynchar\' ','t_nchar match \'nchar\' ','t_nchar nmatch \'binarynchar\' ', 't_binary like \'binary%\' ','t_nchar like \'nchar%\' ','(t_binary like \'binary%\' or t_nchar = \'0\' ) ','(t_nchar like \'nchar%\' or t_binary = \'0\' ) ', @@ -132,38 +132,38 @@ class TDTestCase: 't1.t_smallint >= -32767 and t1.t_smallint <= 32767 and t2.t_smallint >= -32767 and t2.t_smallint <= 32767', 't1.t_tinyint >= -127 and t1.t_tinyint <= 127 and t2.t_tinyint >= -127 and t2.t_tinyint <= 127', 't1.t_float >= -1.7E308 and t1.t_float <= 1.7E308 and t2.t_float >= -1.7E308 and t2.t_float <= 1.7E308', - 't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308', - '(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' , - '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , + 't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308', + '(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' , + '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , 't1.t_bool in (0 , 1) and t2.t_bool in (0 , 1)' , 't1.t_bool in ( true , false) and t2.t_bool in ( true , false)' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)', 't1.t_bigint between -9223372036854775807 and 9223372036854775807 and t2.t_bigint between -9223372036854775807 and 9223372036854775807', 't1.t_int between -2147483647 and 2147483647 and t2.t_int between -2147483647 and 2147483647', - 't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767', + 't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767', '(t1.t_tinyint between -127 and 127 and t2.t_tinyint between -127 and 127) ','t1.t_float between -1.7E308 and 1.7E308 and t2.t_float between -1.7E308 and 1.7E308', '(t1.t_double between -1.7E308 and 1.7E308 and t2.t_double between -1.7E308 and 1.7E308)', '(t1.loc match \'[stable]\' and t2.loc match \'[stable]\')','(t1.loc nmatch \'[qqeqweq]\' and t2.loc nmatch \'[eqeqweq]\')', - '(t1.loc match \'[^stable]\' and t2.loc match \'[^stable]\')','(t1.loc nmatch \'[^qqeqweq]\' and t2.loc nmatch \'[^eqeqweq]\')', + '(t1.loc match \'[^stable]\' and t2.loc match \'[^stable]\')','(t1.loc nmatch \'[^qqeqweq]\' and t2.loc nmatch \'[^eqeqweq]\')', '(t1.t_binary match \'[stable]\' and t2.t_binary match \'[stable]\')','(t1.t_binary nmatch \'[qqeqweq]\' and t2.t_binary nmatch \'[eqeqweq]\')', - '(t1.t_binary match \'[^stable]\' and t2.t_binary match \'[^stable]\')','(t1.t_binary nmatch \'[^qqeqweq]\' and t2.t_binary nmatch \'[^eqeqweq]\')', + '(t1.t_binary match \'[^stable]\' and t2.t_binary match \'[^stable]\')','(t1.t_binary nmatch \'[^qqeqweq]\' and t2.t_binary nmatch \'[^eqeqweq]\')', '(t1.t_nchar match \'[stable]\' and t2.t_nchar match \'[stable]\')','(t1.t_nchar nmatch \'[qqeqweq]\' and t2.t_nchar nmatch \'[eqeqweq]\')', '(t1.t_nchar match \'[^stable]\' and t2.t_nchar match \'[^stable]\')','(t1.t_nchar nmatch \'[^qqeqweq]\' and t2.t_nchar nmatch \'[^eqeqweq]\')'] - self.t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' , - '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , + self.t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' , + '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' , '(t1.t_bool in (0 , 1) or t2.t_bool in (0 , 1))' , '(t1.t_bool in ( true , false) or t2.t_bool in ( true , false))' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)', '(t1.t_bigint between -9223372036854775807 and 9223372036854775807 or t2.t_bigint between -9223372036854775807 and 9223372036854775807)', '(t1.t_int between -2147483647 and 2147483647 or t2.t_int between -2147483647 and 2147483647)', - '(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)', + '(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)', '(t1.t_tinyint between -127 and 127 or t2.t_tinyint between -127 and 127 )','(t1.t_float between -1.7E308 and 1.7E308 or t2.t_float between -1.7E308 and 1.7E308)', '(t1.t_double between -1.7E308 and 1.7E308 or t2.t_double between -1.7E308 and 1.7E308)', '(t1.loc match \'[stable]\' or t2.loc match \'[stable]\')','(t1.loc nmatch \'[qqeqweq]\' or t2.loc nmatch \'[eqeqweq]\')', - '(t1.loc match \'[^stable]\' or t2.loc match \'[^stable]\')','(t1.loc nmatch \'[^qqeqweq]\' or t2.loc nmatch \'[^eqeqweq]\')' , + '(t1.loc match \'[^stable]\' or t2.loc match \'[^stable]\')','(t1.loc nmatch \'[^qqeqweq]\' or t2.loc nmatch \'[^eqeqweq]\')' , '(t1.t_binary match \'[stable]\' or t2.t_binary match \'[stable]\')','(t1.t_binary nmatch \'[qqeqweq]\' or t2.t_binary nmatch \'[eqeqweq]\')', - '(t1.t_binary match \'[^stable]\' or t2.t_binary match \'[^stable]\')','(t1.t_binary nmatch \'[^qqeqweq]\' or t2.t_binary nmatch \'[^eqeqweq]\')', + '(t1.t_binary match \'[^stable]\' or t2.t_binary match \'[^stable]\')','(t1.t_binary nmatch \'[^qqeqweq]\' or t2.t_binary nmatch \'[^eqeqweq]\')', '(t1.t_nchar match \'[stable]\' or t2.t_nchar match \'[stable]\')','(t1.t_nchar nmatch \'[qqeqweq]\' or t2.t_nchar nmatch \'[eqeqweq]\')', '(t1.t_nchar match \'[^stable]\' or t2.t_nchar match \'[^stable]\')','(t1.t_nchar nmatch \'[^qqeqweq]\' or t2.t_nchar nmatch \'[^eqeqweq]\')'] - # regular and tag column where + # regular and tag column where self.qt_where = self.q_where + self.t_where self.qt_u_where = self.q_u_where + self.t_u_where self.qt_u_or_where = self.q_u_or_where + self.t_u_or_where @@ -176,87 +176,87 @@ class TDTestCase: self.session_where = ['session(ts,10a)' , 'session(ts,10s)', 'session(ts,10m)' , 'session(ts,10h)','session(ts,10d)' , 'session(ts,10w)'] self.session_u_where = ['session(t1.ts,10a)' , 'session(t1.ts,10s)', 'session(t1.ts,10m)' , 'session(t1.ts,10h)','session(t1.ts,10d)' , 'session(t1.ts,10w)', 'session(t2.ts,10a)' , 'session(t2.ts,10s)', 'session(t2.ts,10m)' , 'session(t2.ts,10h)','session(t2.ts,10d)' , 'session(t2.ts,10w)'] - + self.fill_where = ['FILL(NONE)','FILL(PREV)','FILL(NULL)','FILL(LINEAR)','FILL(NEXT)','FILL(VALUE, 1.23)'] - + self.state_window = ['STATE_WINDOW(q_tinyint)','STATE_WINDOW(q_bigint)','STATE_WINDOW(q_int)','STATE_WINDOW(q_bool)','STATE_WINDOW(q_smallint)'] self.state_u_window = ['STATE_WINDOW(t1.q_tinyint)','STATE_WINDOW(t1.q_bigint)','STATE_WINDOW(t1.q_int)','STATE_WINDOW(t1.q_bool)','STATE_WINDOW(t1.q_smallint)', 'STATE_WINDOW(t2.q_tinyint)','STATE_WINDOW(t2.q_bigint)','STATE_WINDOW(t2.q_int)','STATE_WINDOW(t2.q_bool)','STATE_WINDOW(t2.q_smallint)'] - # order by where + # order by where self.order_where = ['order by ts' , 'order by ts asc'] self.order_u_where = ['order by t1.ts' , 'order by t1.ts asc' , 'order by t2.ts' , 'order by t2.ts asc'] self.order_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' ] self.orders_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' , 'order by ts,loc' , 'order by ts,loc asc' , 'order by ts,loc desc'] - - self.group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', + + self.group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', 'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint', 'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' , - 'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', + 'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint', 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double '] - self.group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', + self.group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', 'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint', 'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' , - 'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', + 'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint', 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ', - 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', + 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', 'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint', 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' , - 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', + 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint', - 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] - - self.group_only_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', + 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] + + self.group_only_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint', 'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint', 'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' ] - self.group_only_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', + self.group_only_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint', 'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint', 'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' , - 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', + 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint', 'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint', - 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ] - - self.partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', + 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ] + + self.partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint', 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint', 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double '] - self.partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', + self.partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint', 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint', 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ', - 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', + 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint', 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint', - 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] - - self.group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint', + 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double '] + + self.group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint', 'group by tbname,q_float', 'group by tbname,q_double' , 'group by tbname,q_binary', 'group by tbname,q_nchar', 'group by tbname,q_bool' ,'group by tbname ,q_bigint', 'group by tbname,q_binary ,q_nchar ,q_bool' , 'group by tbname,q_int ,q_smallint ,q_tinyint' , 'group by tbname,q_float ,q_double ' , - 'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', + 'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint', 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double '] - self.group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint', + self.group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint', 'group by t1.q_float', 'group by t1.q_double' , 'group by t1.q_binary', 'group by t1.q_nchar', 'group by t1.q_bool' ,'group by t1.q_bigint', 'group by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'group by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'group by t1.q_float ,t1.q_double ' , - 'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', + 'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint', 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ', - 'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint', + 'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint', 'group by t2.q_float', 'group by t2.q_double' , 'group by t2.q_binary', 'group by t2.q_nchar', 'group by t2.q_bool' ,'group by t2.q_bigint', 'group by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'group by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'group by t2.q_float ,t2.q_double ' , - 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', + 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint', - 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] - - self.partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', + 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] + + self.partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint', 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint', 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double '] - self.partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', + self.partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint', 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint', 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ', - 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', + 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint', 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint', - 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] - + 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double '] + self.having_support = ['having count(q_int) > 0','having count(q_bigint) > 0','having count(q_smallint) > 0','having count(q_tinyint) > 0','having count(q_float) > 0','having count(q_double) > 0','having count(q_bool) > 0', 'having avg(q_int) > 0','having avg(q_bigint) > 0','having avg(q_smallint) > 0','having avg(q_tinyint) > 0','having avg(q_float) > 0','having avg(q_double) > 0', 'having sum(q_int) > 0','having sum(q_bigint) > 0','having sum(q_smallint) > 0','having sum(q_tinyint) > 0','having sum(q_float) > 0','having sum(q_double) > 0', @@ -282,15 +282,15 @@ class TDTestCase: self.having_not_support = ['having TOP(q_int,10) > 0','having TOP(q_bigint,10) > 0','having TOP(q_smallint,10) > 0','having TOP(q_tinyint,10) > 0','having TOP(q_float,10) > 0','having TOP(q_double,10) > 0','having TOP(q_bool,10) > 0', 'having BOTTOM(q_int,10) > 0','having BOTTOM(q_bigint,10) > 0','having BOTTOM(q_smallint,10) > 0','having BOTTOM(q_tinyint,10) > 0','having BOTTOM(q_float,10) > 0','having BOTTOM(q_double,10) > 0','having BOTTOM(q_bool,10) > 0', 'having LEASTSQUARES(q_int) > 0','having LEASTSQUARES(q_bigint) > 0','having LEASTSQUARES(q_smallint) > 0','having LEASTSQUARES(q_tinyint) > 0','having LEASTSQUARES(q_float) > 0','having LEASTSQUARES(q_double) > 0','having LEASTSQUARES(q_bool) > 0', - 'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0', + 'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0', 'having PERCENTILE(q_int,10) > 0','having PERCENTILE(q_bigint,10) > 0','having PERCENTILE(q_smallint,10) > 0','having PERCENTILE(q_tinyint,10) > 0','having PERCENTILE(q_float,10) > 0','having PERCENTILE(q_double,10) > 0', 'having TOP(q_int_null,10) > 0','having TOP(q_bigint_null,10) > 0','having TOP(q_smallint_null,10) > 0','having TOP(q_tinyint_null,10) > 0','having TOP(q_float_null,10) > 0','having TOP(q_double_null,10) > 0','having TOP(q_bool_null,10) > 0', 'having BOTTOM(q_int_null,10) > 0','having BOTTOM(q_bigint_null,10) > 0','having BOTTOM(q_smallint_null,10) > 0','having BOTTOM(q_tinyint_null,10) > 0','having BOTTOM(q_float_null,10) > 0','having BOTTOM(q_double_null,10) > 0','having BOTTOM(q_bool_null,10) > 0', 'having LEASTSQUARES(q_int_null) > 0','having LEASTSQUARES(q_bigint_null) > 0','having LEASTSQUARES(q_smallint_null) > 0','having LEASTSQUARES(q_tinyint_null) > 0','having LEASTSQUARES(q_float_null) > 0','having LEASTSQUARES(q_double_null) > 0','having LEASTSQUARES(q_bool_null) > 0', - 'having FIRST(q_bool_null) > 0','having IRATE(q_bool_null) > 0','having PERCENTILE(q_bool_null,10) > 0','having avg(q_bool_null) > 0','having LAST_ROW(q_bool_null) > 0','having sum(q_bool_null) > 0','having STDDEV(q_bool_null) > 0','having APERCENTILE(q_bool_null,10) > 0','having TWA(q_bool_null) > 0','having LAST(q_bool_null) > 0', + 'having FIRST(q_bool_null) > 0','having IRATE(q_bool_null) > 0','having PERCENTILE(q_bool_null,10) > 0','having avg(q_bool_null) > 0','having LAST_ROW(q_bool_null) > 0','having sum(q_bool_null) > 0','having STDDEV(q_bool_null) > 0','having APERCENTILE(q_bool_null,10) > 0','having TWA(q_bool_null) > 0','having LAST(q_bool_null) > 0', 'having PERCENTILE(q_int_null,10) > 0','having PERCENTILE(q_bigint_null,10) > 0','having PERCENTILE(q_smallint_null,10) > 0','having PERCENTILE(q_tinyint_null,10) > 0','having PERCENTILE(q_float_null,10) > 0','having PERCENTILE(q_double_null,10) > 0'] self.having_tagnot_support = ['having LAST_ROW(q_int) > 0','having LAST_ROW(q_bigint) > 0','having LAST_ROW(q_smallint) > 0','having LAST_ROW(q_tinyint) > 0','having LAST_ROW(q_float) > 0','having LAST_ROW(q_double) > 0', - 'having LAST_ROW(q_int_null) > 0','having LAST_ROW(q_bigint_null) > 0','having LAST_ROW(q_smallint_null) > 0','having LAST_ROW(q_tinyint_null) > 0','having LAST_ROW(q_float_null) > 0','having LAST_ROW(q_double_null) > 0'] + 'having LAST_ROW(q_int_null) > 0','having LAST_ROW(q_bigint_null) > 0','having LAST_ROW(q_smallint_null) > 0','having LAST_ROW(q_tinyint_null) > 0','having LAST_ROW(q_float_null) > 0','having LAST_ROW(q_double_null) > 0'] self.having_support_j = ['having count(t1.q_int) > 0','having count(t1.q_bigint) > 0','having count(t1.q_smallint) > 0','having count(t1.q_tinyint) > 0','having count(t1.q_float) > 0','having count(t1.q_double) > 0','having count(t1.q_bool) > 0', 'having avg(t1.q_int) > 0','having avg(t1.q_bigint) > 0','having avg(t1.q_smallint) > 0','having avg(t1.q_tinyint) > 0','having avg(t1.q_float) > 0','having avg(t1.q_double) > 0', @@ -303,7 +303,7 @@ class TDTestCase: 'having FIRST(t1.q_int) > 0','having FIRST(t1.q_bigint) > 0','having FIRST(t1.q_smallint) > 0','having FIRST(t1.q_tinyint) > 0','having FIRST(t1.q_float) > 0','having FIRST(t1.q_double) > 0', 'having LAST(t1.q_int) > 0','having LAST(t1.q_bigint) > 0','having LAST(t1.q_smallint) > 0','having LAST(t1.q_tinyint) > 0','having LAST(t1.q_float) > 0','having LAST(t1.q_double) > 0', 'having APERCENTILE(t1.q_int,10) > 0','having APERCENTILE(t1.q_bigint,10) > 0','having APERCENTILE(t1.q_smallint,10) > 0','having APERCENTILE(t1.q_tinyint,10) > 0','having APERCENTILE(t1.q_float,10) > 0','having APERCENTILE(t1.q_double,10) > 0'] - + # limit offset where self.limit_where = ['limit 1 offset 1' , 'limit 1' , 'limit 2 offset 1' , 'limit 2', 'limit 12 offset 1' , 'limit 20', 'limit 20 offset 10' , 'limit 200'] self.limit1_where = ['limit 1 offset 1' , 'limit 1' ] @@ -312,7 +312,7 @@ class TDTestCase: # slimit soffset where self.slimit_where = ['slimit 1 soffset 1' , 'slimit 1' , 'slimit 2 soffset 1' , 'slimit 2'] self.slimit1_where = ['slimit 2 soffset 1' , 'slimit 1' ] - + self.calc_select_all = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' , 'first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' , @@ -320,7 +320,7 @@ class TDTestCase: 'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' , 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'bottom(q_int_null,20)' , 'bottom(q_bigint_null,20)' , 'bottom(q_smallint_null,20)' , 'bottom(q_tinyint_null,20)' ,'bottom(q_float_null,20)' , 'bottom(q_double_null,20)' , 'top(q_int_null,20)' , 'top(q_bigint_null,20)' , 'top(q_smallint_null,20)' ,'top(q_tinyint_null,20)' ,'top(q_float_null,20)' ,'top(q_double_null,20)' , @@ -328,8 +328,8 @@ class TDTestCase: 'last(q_int_null)' , 'last(q_bigint_null)' , 'last(q_smallint_null)' , 'last(q_tinyint_null)' , 'last(q_float_null)' ,'last(q_double_null)' , 'last(q_binary_null)' ,'last(q_nchar_null)' ,'last(q_bool_null)' ,'last(q_ts_null)' , 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , - 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)' ,] self.calc_select_in_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , @@ -344,25 +344,25 @@ class TDTestCase: self.calc_select_in = ['min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' , 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)' , 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)'] - + self.calc_select_not_support_ts = ['first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' , 'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' , - 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , + 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' , 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)', 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)', 'first(q_int_null)' , 'first(q_bigint_null)' , 'first(q_smallint_null)' , 'first(q_tinyint_null)' , 'first(q_float_null)' ,'first(q_double_null)' ,'first(q_binary_null)' ,'first(q_nchar_null)' ,'first(q_bool_null)' ,'first(q_ts_null)' , 'last(q_int_null)' , 'last(q_bigint_null)' , 'last(q_smallint_null)' , 'last(q_tinyint_null)' , 'last(q_float_null)' ,'last(q_double_null)' , 'last(q_binary_null)' ,'last(q_nchar_null)' ,'last(q_bool_null)' ,'last(q_ts_null)' , - 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , + 'last_row(q_int_null)' , 'last_row(q_bigint_null)' , 'last_row(q_smallint_null)' , 'last_row(q_tinyint_null)' , 'last_row(q_float_null)' , 'last_row(q_double_null)' , 'last_row(q_bool_null)' ,'last_row(q_binary_null)' ,'last_row(q_nchar_null)' ,'last_row(q_ts_null)', - 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)'] - + 'apercentile(q_int_null,20)' , 'apercentile(q_bigint_null,20)' ,'apercentile(q_smallint_null,20)' ,'apercentile(q_tinyint_null,20)' ,'apercentile(q_float_null,20)' ,'apercentile(q_double_null,20)'] + self.calc_select_support_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' , 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' , 'bottom(q_int_null,20)' , 'bottom(q_bigint_null,20)' , 'bottom(q_smallint_null,20)' , 'bottom(q_tinyint_null,20)' ,'bottom(q_float_null,20)' , 'bottom(q_double_null,20)' , @@ -371,11 +371,11 @@ class TDTestCase: 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' , 'min(q_int_null)' , 'min(q_bigint_null)' , 'min(q_smallint_null)' , 'min(q_tinyint_null)' , 'min(q_float_null)' ,'min(q_double_null)' , 'max(q_int_null)' , 'max(q_bigint_null)' , 'max(q_smallint_null)' , 'max(q_tinyint_null)' ,'max(q_float_null)' ,'max(q_double_null)'] - + self.calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)', 'PERCENTILE(q_int_null,10)' ,'PERCENTILE(q_bigint_null,20)' , 'PERCENTILE(q_smallint_null,30)' ,'PERCENTILE(q_tinyint_null,40)' ,'PERCENTILE(q_float_null,50)' ,'PERCENTILE(q_double_null,60)'] - + self.calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] self.interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\''] @@ -410,21 +410,21 @@ class TDTestCase: 'bottom(t2.q_int_null,20)' , 'bottom(t2.q_bigint_null,20)' , 'bottom(t2.q_smallint_null,20)' , 'bottom(t2.q_tinyint_null,20)' ,'bottom(t2.q_float_null,20)' , 'bottom(t2.q_double_null,20)' , 'top(t2.q_int_null,20)' , 'top(t2.q_bigint_null,20)' , 'top(t2.q_smallint_null,20)' ,'top(t2.q_tinyint_null,20)' ,'top(t2.q_float_null,20)' ,'top(t2.q_double_null,20)' , 'min(t1.q_int_null)' , 'min(t1.q_bigint_null)' , 'min(t1.q_smallint_null)' , 'min(t1.q_tinyint_null)' , 'min(t1.q_float_null)' ,'min(t1.q_double_null)' , - 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , + 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , 'min(t2.q_int_null)' , 'min(t2.q_bigint_null)' , 'min(t2.q_smallint_null)' , 'min(t2.q_tinyint_null)' , 'min(t2.q_float_null)' ,'min(t2.q_double_null)' , 'max(t2.q_int_null)' , 'max(t2.q_bigint_null)' , 'max(t2.q_smallint_null)' , 'max(t2.q_tinyint_null)' ,'max(t2.q_float_null)' ,'max(t2.q_double_null)' ] self.calc_select_in_not_support_ts_j = ['apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' , 'apercentile(t1.q_int_null,20)' , 'apercentile(t1.q_bigint_null,20)' ,'apercentile(t1.q_smallint_null,20)' ,'apercentile(t1.q_tinyint_null,20)' ,'apercentile(t1.q_float_null,20)' ,'apercentile(t1.q_double_null,20)' , - 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , + 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' , - 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , + 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , 'last_row(t1.q_double_null)' , 'last_row(t1.q_bool_null)' ,'last_row(t1.q_binary_null)' ,'last_row(t1.q_nchar_null)' ,'last_row(t1.q_ts_null)' , 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' , 'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' , - 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , + 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)', - 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , + 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] self.calc_select_in_j = ['min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' , @@ -433,20 +433,20 @@ class TDTestCase: 'min(t1.q_int_null)' , 'min(t1.q_bigint_null)' , 'min(t1.q_smallint_null)' , 'min(t1.q_tinyint_null)' , 'min(t1.q_float_null)' ,'min(t1.q_double_null)' , 'max(t1.q_int_null)' , 'max(t1.q_bigint_null)' , 'max(t1.q_smallint_null)' , 'max(t1.q_tinyint_null)' ,'max(t1.q_float_null)' ,'max(t1.q_double_null)' , 'apercentile(t1.q_int_null,20)' , 'apercentile(t1.q_bigint_null,20)' ,'apercentile(t1.q_smallint_null,20)' ,'apercentile(t1.q_tinyint_null,20)' ,'apercentile(t1.q_float_null,20)' ,'apercentile(t1.q_double_null,20)' , - 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , + 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' , 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' , 'min(t2.q_int)' , 'min(t2.q_bigint)' , 'min(t2.q_smallint)' , 'min(t2.q_tinyint)' , 'min(t2.q_float)' ,'min(t2.q_double)' , 'max(t2.q_int)' , 'max(t2.q_bigint)' , 'max(t2.q_smallint)' , 'max(t2.q_tinyint)' ,'max(t2.q_float)' ,'max(t2.q_double)' , - 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , + 'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' , 'last_row(t1.q_double_null)' , 'last_row(t1.q_bool_null)' ,'last_row(t1.q_binary_null)' ,'last_row(t1.q_nchar_null)' ,'last_row(t1.q_ts_null)' , 'min(t2.q_int_null)' , 'min(t2.q_bigint_null)' , 'min(t2.q_smallint_null)' , 'min(t2.q_tinyint_null)' , 'min(t2.q_float_null)' ,'min(t2.q_double_null)' , 'max(t2.q_int_null)' , 'max(t2.q_bigint_null)' , 'max(t2.q_smallint_null)' , 'max(t2.q_tinyint_null)' ,'max(t2.q_float_null)' ,'max(t2.q_double_null)' , 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' , 'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' , - 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , + 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' , 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)', - 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , - 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] + 'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' , + 'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)'] self.calc_select_all_j = self.calc_select_in_ts_j + self.calc_select_in_j self.calc_select_regular_j = [ 'PERCENTILE(t1.q_int,10)' ,'PERCENTILE(t1.q_bigint,20)' , 'PERCENTILE(t1.q_smallint,30)' ,'PERCENTILE(t1.q_tinyint,40)' ,'PERCENTILE(t1.q_float,50)' ,'PERCENTILE(t1.q_double,60)' , @@ -454,7 +454,7 @@ class TDTestCase: 'PERCENTILE(t1.q_int_null,10)' ,'PERCENTILE(t1.q_bigint_null,20)' , 'PERCENTILE(t1.q_smallint_null,30)' ,'PERCENTILE(t1.q_tinyint_null,40)' ,'PERCENTILE(t1.q_float_null,50)' ,'PERCENTILE(t1.q_double_null,60)' , 'PERCENTILE(t2.q_int_null,10)' ,'PERCENTILE(t2.q_bigint_null,20)' , 'PERCENTILE(t2.q_smallint_null,30)' ,'PERCENTILE(t2.q_tinyint_null,40)' ,'PERCENTILE(t2.q_float_null,50)' ,'PERCENTILE(t2.q_double_null,60)'] - + self.calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , 'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] self.interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' , @@ -486,7 +486,7 @@ class TDTestCase: self.calc_aggregate_groupbytbname = ['twa(q_int)' ,'twa(q_bigint)' , 'twa(q_smallint)' ,'twa(q_tinyint)' ,'twa (q_float)' ,'twa(q_double)' , 'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)', 'twa(q_int_null)' ,'twa(q_bigint_null)' , 'twa(q_smallint_null)' ,'twa(q_tinyint_null)' ,'twa (q_float_null)' ,'twa(q_double_null)' , - 'IRATE(q_int_null)' ,'IRATE(q_bigint_null)' , 'IRATE(q_smallint_null)' ,'IRATE(q_tinyint_null)' ,'IRATE (q_float_null)' ,'IRATE(q_double_null)'] + 'IRATE(q_int_null)' ,'IRATE(q_bigint_null)' , 'IRATE(q_smallint_null)' ,'IRATE(q_tinyint_null)' ,'IRATE (q_float_null)' ,'IRATE(q_double_null)'] #two table join self.calc_aggregate_all_j = ['count(t1.*)' , 'count(t1.q_int)' ,'count(t1.q_bigint)' , 'count(t1.q_smallint)' ,'count(t1.q_tinyint)' ,'count(t1.q_float)' , @@ -534,11 +534,11 @@ class TDTestCase: 'twa(t1.q_int_null)' ,'twa(t1.q_bigint_null)' , 'twa(t1.q_smallint_null)' ,'twa(t1.q_tinyint_null)' ,'twa (t1.q_float_null)' ,'twa(t1.q_double_null)' , 'IRATE(t1.q_int_null)' ,'IRATE(t1.q_bigint_null)' , 'IRATE(t1.q_smallint_null)' ,'IRATE(t1.q_tinyint_null)' ,'IRATE (t1.q_float_null)' ,'IRATE(t1.q_double_null)' , 'twa(t2.q_int_null)' ,'twa(t2.q_bigint_null)' , 'twa(t2.q_smallint_null)' ,'twa(t2.q_tinyint_null)' ,'twa (t2.q_float_null)' ,'twa(t2.q_double_null)' , - 'IRATE(t2.q_int_null)' ,'IRATE(t2.q_bigint_null)' , 'IRATE(t2.q_smallint_null)' ,'IRATE(t2.q_tinyint_null)' ,'IRATE (t2.q_float_null)' ,'IRATE(t2.q_double_null)' ] - - self.calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' , + 'IRATE(t2.q_int_null)' ,'IRATE(t2.q_bigint_null)' , 'IRATE(t2.q_smallint_null)' ,'IRATE(t2.q_tinyint_null)' ,'IRATE (t2.q_float_null)' ,'IRATE(t2.q_double_null)' ] + + self.calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' , '(SPREAD(q_int) + SPREAD(q_bigint))' , '(SPREAD(q_smallint) - SPREAD(q_float))', '(SPREAD(q_double) * SPREAD(q_tinyint))' , '(SPREAD(q_double) / SPREAD(q_float))', - 'SPREAD(q_ts_null)' , 'SPREAD(q_int_null)' ,'SPREAD(q_bigint_null)' , 'SPREAD(q_smallint_null)' ,'SPREAD(q_tinyint_null)' ,'SPREAD(q_float_null)' ,'SPREAD(q_double_null)' , + 'SPREAD(q_ts_null)' , 'SPREAD(q_int_null)' ,'SPREAD(q_bigint_null)' , 'SPREAD(q_smallint_null)' ,'SPREAD(q_tinyint_null)' ,'SPREAD(q_float_null)' ,'SPREAD(q_double_null)' , '(SPREAD(q_int_null) + SPREAD(q_bigint_null))' , '(SPREAD(q_smallint_null) - SPREAD(q_float_null))', '(SPREAD(q_double_null) * SPREAD(q_tinyint_null))' , '(SPREAD(q_double_null) / SPREAD(q_float_null))'] self.calc_calculate_regular = ['DIFF(q_int)' ,'DIFF(q_bigint)' , 'DIFF(q_smallint)' ,'DIFF(q_tinyint)' ,'DIFF(q_float)' ,'DIFF(q_double)' , 'DIFF(q_int,0)' ,'DIFF(q_bigint,0)' , 'DIFF(q_smallint,0)' ,'DIFF(q_tinyint,0)' ,'DIFF(q_float,0)' ,'DIFF(q_double,0)' , @@ -549,7 +549,7 @@ class TDTestCase: 'DIFF(q_int_null,1)' ,'DIFF(q_bigint_null,1)' , 'DIFF(q_smallint_null,1)' ,'DIFF(q_tinyint_null,1)' ,'DIFF(q_float_null,1)' ,'DIFF(q_double_null,1)' , 'DERIVATIVE(q_int_null,15s,0)' , 'DERIVATIVE(q_bigint_null,10s,1)' , 'DERIVATIVE(q_smallint_null,20s,0)' ,'DERIVATIVE(q_tinyint_null,10s,1)' ,'DERIVATIVE(q_float_null,6s,0)' ,'DERIVATIVE(q_double_null,3s,1)'] self.calc_calculate_groupbytbname = self.calc_calculate_regular - + #two table join self.calc_calculate_all_j = ['SPREAD(t1.ts)' , 'SPREAD(t1.q_ts)' , 'SPREAD(t1.q_int)' ,'SPREAD(t1.q_bigint)' , 'SPREAD(t1.q_smallint)' ,'SPREAD(t1.q_tinyint)' ,'SPREAD(t1.q_float)' ,'SPREAD(t1.q_double)' , 'SPREAD(t2.ts)' , 'SPREAD(t2.q_ts)' , 'SPREAD(t2.q_int)' ,'SPREAD(t2.q_bigint)' , 'SPREAD(t2.q_smallint)' ,'SPREAD(t2.q_tinyint)' ,'SPREAD(t2.q_float)' ,'SPREAD(t2.q_double)' , @@ -585,11 +585,11 @@ class TDTestCase: 'interval(1y,1n) ','interval(1n,1w) ','interval(1w,1d) ','interval(1d,1h) ','interval(1h,1m) ','interval(1m,1s) ','interval(1s,10a) ' ,'interval(100a,30a)'] self.conn1 = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos/") - self.cur1 = self.conn1.cursor() + self.cur1 = self.conn1.cursor() self.cur1.execute("use %s ;" %self.db_nest) sql = 'select * from stable_1 limit 5;' self.cur1.execute(sql) - + def dropandcreateDB_random(self,database,n): ts = 1630000000000 @@ -609,7 +609,7 @@ class TDTestCase: 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) \ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - + tdSql.execute('''create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \ q_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) ,\ @@ -621,28 +621,28 @@ class TDTestCase: 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) \ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''') - - tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + + tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) tdSql.execute('''create table stable_1_2 using stable_1 tags('stable_1_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\') ;''') tdSql.execute('''create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\') ;''') - tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,\'2099-09-09 09:09:09.090\') ;''') - tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) - tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' - %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), - fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , - fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) + tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;''' + %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1), + fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) , + fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) #regular table tdSql.execute('''create table regular_table_1 \ @@ -668,105 +668,105 @@ class TDTestCase: q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''') - for i in range(num_random*n): + for i in range(1, num_random*n + 1): tdSql.execute('''insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\ 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() , + '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 regular_table_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) \ 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() , + '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 stable_1_2 (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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*2, 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 regular_table_2 (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() , + '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 stable_1_2 (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 +1, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*2 +1, fake.random_int(min=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , + fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, 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 regular_table_2 (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 +1, fake.random_int(min=-2147483647, max=0, step=1), - fake.random_int(min=-9223372036854775807, max=0, step=1), - fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , - fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , + '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=-2147483647, max=0, step=1), + fake.random_int(min=-9223372036854775807, max=0, step=1), + fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) , + fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i +1, 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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4, 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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4 +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 stable_2_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) \ 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() , + 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;''' + % (ts + i*1000*60*60*4 +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,3*num_random*n) tdSql.query("select count(*) from regular_table_1;") tdSql.checkData(0,0,num_random*n) - - def explain_sql(self,sql): - # #执行sql解析 - sql = "explain " + sql - tdLog.info(sql) + + def explain_sql(self,sql): + # #执行sql解析 + sql = "explain " + sql + tdLog.info(sql) tdSql.query(sql) - + def data_check(self,sql,mark='mark') : tdLog.info("========mark==%s==="% mark); try: @@ -774,60 +774,60 @@ class TDTestCase: except: tdLog.info("sql is not support :=====%s; " %sql) tdSql.error(sql) - - + + def math_nest(self,mathlist): - - print("==========%s===start=============" %mathlist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %mathlist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + #self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (mathlist == ['ABS','SQRT']) or (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['FLOOR','CEIL','ROUND']) \ or (mathlist == ['CSUM']) : - math_functions = mathlist - fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] + math_functions = mathlist + fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)', - '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] + '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + elif (mathlist == ['UNIQUE']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : - math_functions = mathlist + math_functions = mathlist fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_binary)','(q_nchar)','(q_bool)','(q_ts)', - '(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)','(q_binary_null)','(q_nchar_null)','(q_bool_null)','(q_ts_null)'] + '(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)','(q_binary_null)','(q_nchar_null)','(q_bool_null)','(q_ts_null)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)','(t1.q_ts)','(t1.q_ts_null)', - '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)','(t2.q_ts)','(t2.q_ts_null)'] + '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)','(t2.q_ts)','(t2.q_ts_null)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (mathlist == ['TAIL']): - math_functions = mathlist - num = random.randint(1, 100) - offset_rows = random.randint(0, 100) + math_functions = mathlist + num = random.randint(1, 100) + offset_rows = random.randint(0, 100) fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)','(q_binary,num)','(q_nchar,num)','(q_bool,num)','(q_ts,num)', '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)','(q_binary_null,num)','(q_nchar_null,num)','(q_bool_null,num)','(q_ts_null,num)', '(q_bigint,num,offset_rows)','(q_smallint,num,offset_rows)','(q_tinyint,num,offset_rows)','(q_int,num,offset_rows)','(q_float,num,offset_rows)','(q_double,num,offset_rows)','(q_binary,num,offset_rows)','(q_nchar,num,offset_rows)','(q_bool,num,offset_rows)','(q_ts,num,offset_rows)', - '(q_bigint_null,num,offset_rows)','(q_smallint_null,num,offset_rows)','(q_tinyint_null,num,offset_rows)','(q_int_null,num,offset_rows)','(q_float_null,num,offset_rows)','(q_double_null,num,offset_rows)','(q_binary_null,num,offset_rows)','(q_nchar_null,num,offset_rows)','(q_bool_null,num,offset_rows)','(q_ts_null,num,offset_rows)'] + '(q_bigint_null,num,offset_rows)','(q_smallint_null,num,offset_rows)','(q_tinyint_null,num,offset_rows)','(q_int_null,num,offset_rows)','(q_float_null,num,offset_rows)','(q_double_null,num,offset_rows)','(q_binary_null,num,offset_rows)','(q_nchar_null,num,offset_rows)','(q_bool_null,num,offset_rows)','(q_ts_null,num,offset_rows)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) - + fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)','(t1.q_binary,num)','(t1.q_nchar,num)','(t1.q_bool,num)','(t1.q_ts,num)', '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)','(t1.q_binary_null,num)','(t1.q_nchar_null,num)','(t1.q_bool_null,num)','(t1.q_ts_null,num)', '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)','(t2.q_binary,num)','(t2.q_nchar,num)','(t2.q_bool,num)','(t2.q_ts,num)', @@ -835,207 +835,207 @@ class TDTestCase: '(t1.q_bigint,num,offset_rows)','(t1.q_smallint,num,offset_rows)','(t1.q_tinyint,num,offset_rows)','(t1.q_int,num,offset_rows)','(t1.q_float,num,offset_rows)','(t1.q_double,num,offset_rows)','(t1.q_binary,num,offset_rows)','(t1.q_nchar,num,offset_rows)','(t1.q_bool,num,offset_rows)','(t1.q_ts,num,offset_rows)', '(t1.q_bigint_null,num,offset_rows)','(t1.q_smallint_null,num,offset_rows)','(t1.q_tinyint_null,num,offset_rows)','(t1.q_int_null,num,offset_rows)','(t1.q_float_null,num,offset_rows)','(t1.q_double_null,num,offset_rows)','(t1.q_binary_null,num,offset_rows)','(t1.q_nchar_null,num,offset_rows)','(t1.q_bool_null,num,offset_rows)','(t1.q_ts_null,num,offset_rows)', '(t2.q_bigint,num,offset_rows)','(t2.q_smallint,num,offset_rows)','(t2.q_tinyint,num,offset_rows)','(t2.q_int,num,offset_rows)','(t2.q_float,num,offset_rows)','(t2.q_double,num,offset_rows)','(t2.q_binary,num,offset_rows)','(t2.q_nchar,num,offset_rows)','(t2.q_bool,num,offset_rows)','(t2.q_ts,num,offset_rows)', - '(t2.q_bigint_null,num,offset_rows)','(t2.q_smallint_null,num,offset_rows)','(t2.q_tinyint_null,num,offset_rows)','(t2.q_int_null,num,offset_rows)','(t2.q_float_null,num,offset_rows)','(t2.q_double_null,num,offset_rows)','(t2.q_binary_null,num,offset_rows)','(t2.q_nchar_null,num,offset_rows)','(t2.q_bool_null,num,offset_rows)','(t2.q_ts_null,num,offset_rows)'] + '(t2.q_bigint_null,num,offset_rows)','(t2.q_smallint_null,num,offset_rows)','(t2.q_tinyint_null,num,offset_rows)','(t2.q_int_null,num,offset_rows)','(t2.q_float_null,num,offset_rows)','(t2.q_double_null,num,offset_rows)','(t2.q_binary_null,num,offset_rows)','(t2.q_nchar_null,num,offset_rows)','(t2.q_bool_null,num,offset_rows)','(t2.q_ts_null,num,offset_rows)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)).replace("offset_rows",str(offset_rows)) - + elif (mathlist == ['POW','LOG']) or (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) : - math_functions = mathlist - num = random.randint(1, 1000) + math_functions = mathlist + num = random.randint(1, 1000) fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)', - '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] + '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)'] fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) - + fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)', '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)', '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)', - '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] + '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)'] fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num)) elif (mathlist == ['statecount','stateduration']): - math_functions = mathlist - num = random.randint(-1000, 1000) - - operator = ['LT' , 'GT' ,'GE','NE','EQ'] - oper = str(random.sample(operator,1)).replace("[","").replace("]","")#.replace("'","") - + math_functions = mathlist + num = random.randint(-1000, 1000) + + operator = ['LT' , 'GT' ,'GE','NE','EQ'] + oper = str(random.sample(operator,1)).replace("[","").replace("]","")#.replace("'","") + fun_fix_column = ['(q_bigint,oper,num,time)','(q_smallint,oper,num,time)','(q_tinyint,oper,num,time)','(q_int,oper,num,time)','(q_float,oper,num,time)','(q_double,oper,num,time)', - '(q_bigint_null,oper,num,time)','(q_smallint_null,oper,num,time)','(q_tinyint_null,oper,num,time)','(q_int_null,oper,num,time)','(q_float_null,oper,num,time)','(q_double_null,oper,num,time)'] - + '(q_bigint_null,oper,num,time)','(q_smallint_null,oper,num,time)','(q_tinyint_null,oper,num,time)','(q_int_null,oper,num,time)','(q_float_null,oper,num,time)','(q_double_null,oper,num,time)'] + hanshu_select1 = random.sample(math_functions,1) fun_column_1 = random.sample(hanshu_select1,1)+random.sample(fun_fix_column,1) math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select1).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_1 = math_fun_1.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select1).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_1 = math_fun_1.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - - hanshu_select2 = random.sample(math_functions,1) + + hanshu_select2 = random.sample(math_functions,1) fun_column_2 = random.sample(hanshu_select2,1)+random.sample(fun_fix_column,1) math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select2).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select2).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") - math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + math_fun_2 = math_fun_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) + fun_fix_column_j = ['(t1.q_bigint,oper,num,time)','(t1.q_smallint,oper,num,time)','(t1.q_tinyint,oper,num,time)','(t1.q_int,oper,num,time)','(t1.q_float,oper,num,time)','(t1.q_double,oper,num,time)', '(t1.q_bigint_null,oper,num,time)','(t1.q_smallint_null,oper,num,time)','(t1.q_tinyint_null,oper,num,time)','(t1.q_int_null,oper,num,time)','(t1.q_float_null,oper,num,time)','(t1.q_double_null,oper,num,time)', '(t2.q_bigint,oper,num,time)','(t2.q_smallint,oper,num,time)','(t2.q_tinyint,oper,num,time)','(t2.q_int,oper,num,time)','(t2.q_float,oper,num,time)','(t2.q_double,oper,num,time)', - '(t2.q_bigint_null,oper,num,time)','(t2.q_smallint_null,oper,num,time)','(t2.q_tinyint_null,oper,num,time)','(t2.q_int_null,oper,num,time)','(t2.q_float_null,oper,num,time)','(t2.q_double_null,oper,num,time)'] - + '(t2.q_bigint_null,oper,num,time)','(t2.q_smallint_null,oper,num,time)','(t2.q_tinyint_null,oper,num,time)','(t2.q_int_null,oper,num,time)','(t2.q_float_null,oper,num,time)','(t2.q_double_null,oper,num,time)'] + hanshu_select_join_1 = random.sample(math_functions,1) fun_column_join_1 = random.sample(hanshu_select_join_1,1)+random.sample(fun_fix_column_j,1) math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select_join_1).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_join_1 = math_fun_join_1.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select_join_1).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_join_1 = math_fun_join_1.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) - + hanshu_select_join_2 = random.sample(math_functions,1) fun_column_join_2 = random.sample(hanshu_select_join_2,1)+random.sample(fun_fix_column_j,1) math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + if str(hanshu_select_join_2).replace("[","").replace("]","").replace("'","") == 'statecount': math_fun_join_2 = math_fun_join_2.replace("oper","%s" %oper).replace(",time","").replace("num",str(num)) elif str(hanshu_select_join_2).replace("[","").replace("]","").replace("'","") == 'stateduration': - timeunit = ['1s' , '1m' ,'1h'] - time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") + timeunit = ['1s' , '1m' ,'1h'] + time = str(random.sample(timeunit,1)).replace("[","").replace("]","").replace("'","") math_fun_join_2 = math_fun_join_2.replace("oper","%s" %oper).replace("time","%s" %time).replace("num",str(num)) elif(mathlist == ['HISTOGRAM']) : - math_functions = mathlist - fun_fix_column = ['(q_bigint','(q_smallint','(q_tinyint','(q_int','(q_float','(q_double','(q_bigint_null','(q_smallint_null','(q_tinyint_null','(q_int_null','(q_float_null','(q_double_null'] - + math_functions = mathlist + fun_fix_column = ['(q_bigint','(q_smallint','(q_tinyint','(q_int','(q_float','(q_double','(q_bigint_null','(q_smallint_null','(q_tinyint_null','(q_int_null','(q_float_null','(q_double_null'] + fun_fix_column_j = ['(t1.q_bigint','(t1.q_smallint','(t1.q_tinyint','(t1.q_int','(t1.q_float','(t1.q_double','(t1.q_bigint_null','(t1.q_smallint_null','(t1.q_tinyint_null','(t1.q_int_null','(t1.q_float_null','(t1.q_double_null', '(t2.q_bigint','(t2.q_smallint','(t2.q_tinyint','(t2.q_int','(t2.q_float','(t2.q_double','(t2.q_bigint_null','(t2.q_smallint_null','(t2.q_tinyint_null','(t2.q_int_null','(t2.q_float_null','(t2.q_double_null'] - - normalized = random.randint(0, 1) - + + normalized = random.randint(0, 1) + i = random.randint(1,3) if i == 1: - bin_type = 'user_input' + bin_type = 'user_input' bin_description = {-11111119395555977777} #9一会转译成, fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',',"'%s'" % bin_description, ',', "%d" %normalized,')'] math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("{","[").replace("}","]").replace("9",",") - + elif i == 2: - bin_type = 'linear_bin' - true_false = random.randint(10, 11) + bin_type = 'linear_bin' + true_false = random.randint(10, 11) bin_description = {"ZstartZ": -333339, "ZwidthZ":559, "ZcountZ":59, "ZinfinityZ":'%d' %true_false} #Z一会转译成" ,9一会转译成 , fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + elif i == 3: - bin_type = 'log_bin' - true_false = random.randint(10, 11) + bin_type = 'log_bin' + true_false = random.randint(10, 11) bin_description = {"ZstartZ": -333339, "ZfactorZ":559, "ZcountZ":59, "ZinfinityZ":'%d' %true_false} #Z一会转译成" ,9一会转译成 , fun_column_1 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_2 = [math_functions , random.sample(fun_fix_column,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_join_1 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + fun_column_join_2 = [math_functions , random.sample(fun_fix_column_j,1), ',',"'%s'" %bin_type, ',','%s' % bin_description, ',', "%d" %normalized,')'] - math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") - + math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("9",",").replace("Z","\"").replace("10","false").replace("11","true").replace("\"{","'{").replace("}\"","}'") + tdSql.query("select 1-1 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']): - sql = "select %s as asct1, " % math_fun_1 - sql += "%s as asct2, " % math_fun_2 + sql = "select %s as asct1, " % math_fun_1 + sql += "%s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts1 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select %s as asct1 " % math_fun_1 + sql = "select %s as asct1 " % math_fun_1 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : - sql = "(select %s as asct1, " % math_fun_1 + sql = "(select %s as asct1, " % math_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) - sql += "(select %s as asct2, " % math_fun_2 + sql += "%s " % random.choice(self.unionall_or_union) + sql += "(select %s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) - self.explain_sql(sql) + self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ - or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']): - sql = "(select %s as asct1 " % math_fun_1 + or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']): + sql = "(select %s as asct1 " % math_fun_1 sql += "from regular_table_1 where " sql += "%s )" % random.choice(self.q_where) - sql += "%s " % random.choice(self.unionall_or_union) - sql += "(select %s as asct2 " % math_fun_2 + sql += "%s " % random.choice(self.unionall_or_union) + sql += "(select %s as asct2 " % math_fun_2 sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ @@ -1043,19 +1043,19 @@ class TDTestCase: sql = "(select %s as asct1, ts ," % math_fun_1 sql += "%s as asct2, " % math_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += ") %s (select " % random.choice(self.unionall_or_union) + sql += ") %s (select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % math_fun_2 sql += "%s as asct1, " % math_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MODE']) : @@ -1063,13 +1063,13 @@ class TDTestCase: sql += "%s as asct2 " % math_fun_2 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += ") %s (select " % random.choice(self.unionall_or_union) + sql += ") %s (select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % math_fun_2 - sql += "%s as asct1 " % math_fun_1 + sql += "%s as asct1 " % math_fun_1 sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['statecount','stateduration']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ @@ -1077,66 +1077,66 @@ class TDTestCase: sql = "(select %s as asct1 " % math_fun_1 sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += ") %s (select " % random.choice(self.unionall_or_union) + sql += ") %s (select " % random.choice(self.unionall_or_union) sql += "%s as asct1 " % math_fun_2 sql += " from regular_table_2 where " sql += "%s " % random.choice(self.q_where) - sql += " order by asct1 asc " + sql += " order by asct1 asc " sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1 from ( select t1.ts as ts1," - sql += "%s as asct0, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "%s as asct2, " % math_fun_join_1 - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct0, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "%s as asct2, " % math_fun_join_1 + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql += "%s as asct1 " % math_fun_join_2 sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts ," - sql += "%s, " % math_fun_1 + sql += "%s, " % math_fun_1 sql += "%s as asct1, " % random.choice(self.q_select) - sql += "%s as asct2, " % random.choice(self.q_select) + sql += "%s as asct2, " % random.choice(self.q_select) sql += "%s " % math_fun_2 - sql += " from regular_table_1" - tdLog.info(sql) + sql += " from regular_table_1" + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select " sql += "%s " % math_fun_2 - sql += " from regular_table_1" - tdLog.info(sql) - tdSql.query(sql) + sql += " from regular_table_1" + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-6 as math_nest from stable_1 limit 1;") @@ -1144,29 +1144,29 @@ class TDTestCase: if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1 ,timediff(ts1,ts2), max(asct1) from ( select t1.ts,t1.ts as ts1," - sql += "%s as asct0, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % math_fun_join_1 + sql += "%s as asct0, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % math_fun_join_1 sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql += "%s as asct1 " % math_fun_join_2 sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-7 as math_nest from stable_1 limit 1;") @@ -1176,13 +1176,13 @@ class TDTestCase: sql = "select ts1,ts2 , abs(asct1) from ( select " sql += "%s as asct1, ts as ts1," % math_fun_1 sql += "%s as asct2, " % math_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ @@ -1192,10 +1192,10 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ @@ -1203,12 +1203,12 @@ class TDTestCase: sql = "select %s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % math_fun_1 sql += "%s as asct2, " % math_fun_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ @@ -1216,7 +1216,7 @@ class TDTestCase: sql = "select %s as asct1 " % math_fun_1 sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -1224,33 +1224,33 @@ class TDTestCase: for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : - sql = "select %s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql = "select %s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select %s as asct1 " % math_fun_join_2 + sql = "select %s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-10 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ @@ -1273,7 +1273,7 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ @@ -1288,10 +1288,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as math_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -1314,8 +1314,8 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : @@ -1328,7 +1328,7 @@ class TDTestCase: sql += " from stable_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -1337,65 +1337,65 @@ class TDTestCase: if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts2 ,timediff(ts1,ts2), max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct111, " % random.choice(self.q_select) + sql += "%s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct111, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_join_2 sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts ," - sql += "%s as asct11, " % math_fun_1 + sql += "%s as asct11, " % math_fun_1 sql += "%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct13, " % random.choice(self.q_select) sql += "%s as asct14, " % math_fun_2 - sql += "%s as asct15 " % random.choice(self.t_select) + sql += "%s as asct15 " % random.choice(self.t_select) sql += " from stable_1 " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select " sql += "%s " % math_fun_2 - sql += "%s " % random.choice(self.t_select) + sql += "%s " % random.choice(self.t_select) sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-14 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select avg(asct1),count(asct2) from ( select " - sql += "%s as asct1, " % math_fun_1 + sql += "%s as asct1, " % math_fun_1 sql += "%s as asct2" % math_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -1403,322 +1403,322 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_1 + sql += "%s as asct1 " % math_fun_1 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as math_nest from stable_1 limit 1;") for i in range(self.fornum): if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) : sql = "select ts1,ts ,timediff(ts1,ts), max(asct1) from ( select t1.ts as ts1," - sql += "%s, " % math_fun_join_1 - sql += "%s as asct1, " % math_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % math_fun_join_1 + sql += "%s as asct1, " % math_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \ - or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : - sql = "select count(asct1) from ( select " - sql += "%s as asct1 " % math_fun_join_2 + or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) : + sql = "select count(asct1) from ( select " + sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #taos -f sql # startTime_taosf = time.time() print("taos -f %s sql start!" %mathlist) # taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename) # _ = subprocess.check_output(taos_cmd1, shell=True) - print("taos -f %s sql over!" %mathlist) - - print("=========%s====over=============" %mathlist) + print("taos -f %s sql over!" %mathlist) + + print("=========%s====over=============" %mathlist) def str_nest(self,strlist): - - print("==========%s===start=============" %strlist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %strlist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + #self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['LENGTH','CHAR_LENGTH']) \ or (strlist == ['']): - str_functions = strlist - fun_fix_column = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)'] + str_functions = strlist + fun_fix_column = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)'] fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)', - '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)'] + '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)'] fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - - fun_fix_column_s = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)','(loc)','(tbname)'] + + fun_fix_column_s = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)','(loc)','(tbname)'] fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)','(t1.loc)','(t1.tbname)', - '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)','(t2.loc)','(t2.tbname)'] + '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)','(t2.loc)','(t2.tbname)'] fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + elif (strlist == ['SUBSTR']) : - str_functions = strlist - pos = random.randint(1, 20) - sub_len = random.randint(1, 10) + str_functions = strlist + pos = random.randint(1, 20) + sub_len = random.randint(1, 10) fun_fix_column = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)', - '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)',] + '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)',] fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1) str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)', '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)', '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)', - '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)'] + '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)'] fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1) str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_s = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)','(loc,pos)', - '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)','(loc,pos,sub_len)',] + '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)','(loc,pos,sub_len)',] fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1) str_fun_s_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + fun_fix_column_s_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)','(t1.loc,pos)', '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)','(t1.loc,pos,sub_len)', '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)','(t2.loc,pos)', - '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)','(t2.loc,pos,sub_len)'] + '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)','(t2.loc,pos,sub_len)'] fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1) str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1) str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len)) - + elif (strlist == ['CONCAT']) : - str_functions = strlist - i = random.randint(2,4) + str_functions = strlist + i = random.randint(2,4) fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+column1+')' str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+column2+')' str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', - '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] + + column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+column_j1+')' str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + + column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+column_j2+')' str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_1 = str(random.sample(str_functions,1))+'('+column_s1+')' str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","") - - column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + + column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_2 = str(random.sample(str_functions,1))+'('+column_s2+')' str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+column_j_s1+')' str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","") - - column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+column_j_s2+')' str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","") - + elif (strlist == ['CONCAT_WS']): - str_functions = strlist - i = random.randint(2,4) + str_functions = strlist + i = random.randint(2,4) fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + separators = ['',' ','abc','123','!','@','#','$','%','^','&','*','(',')','-','_','+','=','{', '[','}',']','|',';',':',',','.','<','>','?','/','~','`','taos','涛思'] - separator = str(random.sample(separators,i)).replace("[","").replace("]","") - - column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + separator = str(random.sample(separators,i)).replace("[","").replace("]","") + + column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column1+')' str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column2+')' str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', - '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] + + column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j1+')' str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") + + column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j2+')' str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null', - 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] - - column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null'] + + column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s1+')' str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","") - - column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") + + column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","") fun_column_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s2+')' str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)', '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)', '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)', '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)'] - - column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s1+')' str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","") - - column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") + + column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","") fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s2+')' str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","") - - + + tdSql.query("select 1-1 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) : - sql = "select t1s , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " - sql += "%s as asct1, " % str_fun_1 - sql += "%s as asct2, " % str_fun_2 + sql = "select t1s , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " + sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as t1s from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): - sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " - sql += "%s as asct1, " % str_fun_1 - sql += "%s as asct2, " % str_fun_2 + sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " + sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) : sql = "select ts , asct1 from ( select " - sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2 from ( select " - sql += "%s as asct2, " % str_fun_2 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - elif (strlist == ['LENGTH','CHAR_LENGTH']): + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1) from ( select " - sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select sum(asct2), min(asct2) from ( select " - sql += "%s as asct2, " % str_fun_2 + sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): @@ -1726,100 +1726,100 @@ class TDTestCase: sql += "%s as asct1 ," % str_fun_1 sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % str_fun_2 sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1 ," % str_fun_1 sql += "%s as asct2, " % str_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2 ," % str_fun_2 sql += "%s as asct1, " % str_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "%s, " % str_fun_join_1 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "%s, " % str_fun_join_1 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "%s, " % str_fun_join_1 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t2.%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "%s, " % str_fun_join_1 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t2.%s as asct22, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts ," - sql += "%s, " % str_fun_1 + sql += "%s, " % str_fun_1 sql += "%s as asct21, " % random.choice(self.q_select) - sql += "%s as asct22, " % random.choice(self.q_select) + sql += "%s as asct22, " % random.choice(self.q_select) sql += "%s " % str_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select ts ," - sql += "%s, " % str_fun_1 + sql += "%s, " % str_fun_1 sql += "%s as asct22, " % random.choice(self.q_select) - sql += "%s as asct21, " % random.choice(self.q_select) + sql += "%s as asct21, " % random.choice(self.q_select) sql += "%s " % str_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -1827,32 +1827,32 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts ,timediff(ts1,ts), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "%s, " % str_fun_join_1 + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "%s, " % str_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_1 - sql += "%s as asct1, " % str_fun_join_2 - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct21, " % random.choice(self.q_select) - sql += "%s, " % str_fun_join_1 + sql += "%s as asct2, " % str_fun_join_1 + sql += "%s as asct1, " % str_fun_join_2 + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct21, " % random.choice(self.q_select) + sql += "%s, " % str_fun_join_1 sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-7 as str_nest from stable_1 limit 1;") @@ -1861,29 +1861,29 @@ class TDTestCase: sql = "select t1s ,ts1, LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " sql += "%s as asct1, ts as t1s," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1, ts as ts1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as t1s from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): @@ -1892,13 +1892,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as st1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): @@ -1907,13 +1907,13 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % str_fun_s_1 sql += "%s as asct2, " % str_fun_s_2 - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts as st1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -1921,12 +1921,12 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -1934,17 +1934,17 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -1952,11 +1952,11 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - - + + tdSql.query("select 1-10 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): @@ -1979,9 +1979,9 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1 ," % str_fun_s_1 @@ -2002,10 +2002,10 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as str_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -2028,9 +2028,9 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " sql += "%s as asct1 ," % str_fun_s_1 @@ -2050,7 +2050,7 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -2058,75 +2058,75 @@ class TDTestCase: for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts1,ts2 ,timediff(ts1,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct21, " % random.choice(self.q_select) - sql += "t1.%s as asct22, " % random.choice(self.q_select) - sql += "t2.%s as asct23, " % random.choice(self.q_select) - sql += "t2.%s as asct24, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct21, " % random.choice(self.q_select) + sql += "t1.%s as asct22, " % random.choice(self.q_select) + sql += "t2.%s as asct23, " % random.choice(self.q_select) + sql += "t2.%s as asct24, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts ," - sql += "%s as asct10, " % str_fun_1 + sql += "%s as asct10, " % str_fun_1 sql += "%s as asct1, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % str_fun_2 - sql += "%s as asct14 " % random.choice(self.t_select) + sql += "%s as asct14 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select ts ," - sql += "%s as asct1, " % str_fun_1 + sql += "%s as asct1, " % str_fun_1 sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % str_fun_2 - sql += "%s as asct14 " % random.choice(self.t_select) + sql += "%s as asct14 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-14 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select " - sql += "%s as asct1, " % str_fun_s_1 + sql += "%s as asct1, " % str_fun_s_1 sql += "%s as asct2" % str_fun_s_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -2134,12 +2134,12 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select " - sql += "%s as asct1, " % str_fun_s_1 + sql += "%s as asct1, " % str_fun_s_1 sql += "%s as asct2" % str_fun_s_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -2147,50 +2147,50 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as str_nest from stable_1 limit 1;") for i in range(self.fornum): if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']): sql = "select ts,ts2 ,timediff(ts,ts2), LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts ," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (strlist == ['LENGTH','CHAR_LENGTH']): sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % str_fun_join_s_1 - sql += "%s as asct1, " % str_fun_join_s_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14 " % random.choice(self.q_select) + sql += "%s as asct2, " % str_fun_join_s_1 + sql += "%s as asct1, " % str_fun_join_s_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14 " % random.choice(self.q_select) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f %s sql start!" %strlist) @@ -2198,215 +2198,215 @@ class TDTestCase: # _ = subprocess.check_output(taos_cmd1, shell=True) print("taos -f %s sql over!" %strlist) endTime_taos_f = time.time() - print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %strlist) - + print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %strlist) + def time_nest(self,timelist): - - print("==========%s===start=============" %timelist) - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + + print("==========%s===start=============" %timelist) + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + #self.dropandcreateDB_random("%s" %self.db_nest, 1) - + if (timelist == ['NOW','TODAY']) or (timelist == ['TIMEZONE']): - time_functions = timelist - fun_fix_column = ['()'] + time_functions = timelist + fun_fix_column = ['()'] fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - - fun_fix_column_j = ['()'] + + fun_fix_column_j = ['()'] fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (timelist == ['TIMETRUNCATE']): - time_functions = timelist - - t = time.time() - t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) + time_functions = timelist + + t = time.time() + t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - timeunits = ['1a' ,'1s', '1m' ,'1h', '1d'] - timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") - - column_1 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + timeunits = ['1a' ,'1s', '1m' ,'1h', '1d'] + timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") + + column_1 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] fun_column_1 = random.sample(time_functions,1)+random.sample(column_1,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - column_2 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] + + column_2 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))] fun_column_2 = random.sample(time_functions,1)+random.sample(column_2,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - + + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t,'t_to_s'] - - column_j1 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t,'t_to_s'] + + column_j1 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j1,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) - - column_j2 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] + + column_j2 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j2,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s) elif (timelist == ['TO_ISO8601']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() fun_fix_column = ['(now())','(ts)','(q_ts)','(_rowts)','(_c0)','(_C0)', '(1600000000000)','(1600000000000000)','(1600000000000000000)', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] - + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)','(now())', - '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] - + '(%d)' %t, '(%d000)' %t, '(%d000000)' %t] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","") - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","") elif (timelist == ['TO_UNIXTIMESTAMP']): - time_functions = timelist - - t = time.time() - t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) - fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)'] - + time_functions = timelist + + t = time.time() + t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) + fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)'] + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s) - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s) - - fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)'] - + + fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)'] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s) - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s) elif (timelist == ['TIMEDIFF_1']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) timeunits = [ '1a' ,'1s', '1m' ,'1h', '1d'] - timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") - + timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","") + fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_12 = ['(%s,%s,timeutil)'%(column_1,column_2)] fun_column_1 = random.sample(time_functions,1)+random.sample(column_12,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - - column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + + column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_34 = ['(%s,%s,timeutil)'%(column_3,column_4)] fun_column_2 = random.sample(time_functions,1)+random.sample(column_34,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) column_j12 = ['(%s,%s,timeutil)'%(column_j1,column_j2)] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j12,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") - - column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) - column_j34 = ['(%s,%s,timeutil)'%(column_j3,column_j4)] + + column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + column_j34 = ['(%s,%s,timeutil)'%(column_j3,column_j4)] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j34,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s).replace("_1","") elif (timelist == ['TIMEDIFF_2']): - time_functions = timelist - - t = time.time() + time_functions = timelist + + t = time.time() t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) - + fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_1,column_2 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_12 = ['(%s,%s)'%(column_1,column_2)] fun_column_1 = random.sample(time_functions,1)+random.sample(column_12,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s).replace("_2","") - - column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) + + column_3,column_4 = random.sample(fun_fix_column,1),random.sample(fun_fix_column,1) column_34 = ['(%s,%s)'%(column_3,column_4)] fun_column_2 = random.sample(time_functions,1)+random.sample(column_34,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s).replace("_2","") - + fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','1600000000000','1600000000000000','1600000000000000000', - '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] - - column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s'] + + column_j1,column_j2 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) column_j12 = ['(%s,%s)'%(column_j1,column_j2)] fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j12,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s).replace("_2","") - - column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) - column_j34 = ['(%s,%s)'%(column_j3,column_j4)] + + column_j3,column_j4 = random.sample(fun_fix_column_j,1),random.sample(fun_fix_column_j,1) + column_j34 = ['(%s,%s)'%(column_j3,column_j4)] fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j34,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'") time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s).replace("_2","") - + elif (timelist == ['ELAPSED']): - time_functions = timelist - - fun_fix_column = ['(ts)','(_c0)','(_C0)','(_rowts)','(ts,time_unit)','(_c0,time_unit)','(_C0,time_unit)','(_rowts,time_unit)'] - - time_units = ['1s','1m','1h','1d','1a'] - time_unit1 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") - time_unit2 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") - + time_functions = timelist + + fun_fix_column = ['(ts)','(_c0)','(_C0)','(_rowts)','(ts,time_unit)','(_c0,time_unit)','(_C0,time_unit)','(_rowts,time_unit)'] + + time_units = ['1s','1m','1h','1d','1a'] + time_unit1 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") + time_unit2 = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","") + fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1) - + fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1) time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2) - - - fun_fix_column_j = ['(t1.ts)', '(t2.ts)','(t1.ts,time_unit)','(t1.ts,time_unit)','(t2.ts,time_unit)','(t2.ts,time_unit)'] - + + + fun_fix_column_j = ['(t1.ts)', '(t2.ts)','(t1.ts,time_unit)','(t1.ts,time_unit)','(t2.ts,time_unit)','(t2.ts,time_unit)'] + fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1) - + fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1) time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2) - - + + elif (timelist == ['CAST']) : - str_functions = timelist + str_functions = timelist #下面的4个是全的,这个只是1个 i = random.randint(1,4) if i ==1: @@ -2414,33 +2414,33 @@ class TDTestCase: fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null', 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null'] type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED'] - - type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - - type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null', 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null', 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null', - 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==2: print('===========cast_2===========') fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4'] type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") @@ -2448,270 +2448,270 @@ class TDTestCase: type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_binary4', - 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==3: print('===========cast_3===========') fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8'] type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") + fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8', - 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif i==4: print('===========cast_4===========') fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts'] type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") - + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","") + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") - - fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","") + + fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","") + elif (timelist == ['CAST_1']) : - str_functions = timelist - + str_functions = timelist + print('===========cast_1===========') fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null', 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null'] type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED'] - - type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_1","") - - type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_1","") + + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_1","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_1","") + fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null', 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null', 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null', - 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_1","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_1","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_1","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_1","") + elif (timelist == ['CAST_2']) : - str_functions = timelist + str_functions = timelist print('===========cast_2===========') fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4'] type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_2","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_2","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_2","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_2","") + fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_binary4', - 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_binary','t2.q_binary_null','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_2","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_2","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_2","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_2","") + elif (timelist == ['CAST_3']) : - str_functions = timelist + str_functions = timelist print('===========cast_3===========') fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8'] type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_3","") + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_3","") type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_3","") - + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_3","") + fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8', - 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_3","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_3","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_3","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_3","") + elif (timelist == ['CAST_4']) : - str_functions = timelist + str_functions = timelist print('===========cast_4===========') fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts'] type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED'] - + type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')' - time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_4","") - + time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_4","") + type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')' - time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_4","") - - fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] - - type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_4","") + + fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts'] + + type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')' - time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_4","") - - type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") + time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_4","") + + type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","") fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')' - time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_4","") - + time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_4","") + tdSql.query("select 1-1 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): - sql = "select ts1 , timediff(asct1,now) from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2, " % time_fun_2 + sql = "select ts1 , timediff(asct1,now) from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts1 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) \ or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): - sql = "select ts2 , asct1,now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2, " % time_fun_2 + sql = "select ts2 , asct1,now(),today(),timezone() from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts2 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : - sql = "select max(asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 - sql += "%s as asct2 " % time_fun_2 + sql = "select max(asct1),now(),today(),timezone() from ( select " + sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct2 " % time_fun_2 sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-2 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(asct1,now),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , timediff(asct2,now),now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_2 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts , (asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s )" % random.choice(self.order_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select ts , asct2,now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_2 + sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts ts from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + elif (timelist == ['ELAPSED']) : sql = "select min(asct1),now(),today(),timezone() from ( select " - sql += "%s as asct1 " % time_fun_1 + sql += "%s as asct1 " % time_fun_1 sql += " from regular_table_1 where " sql += "%s )" % random.choice(self.q_where) - sql += "%s " % random.choice(self.unionall_or_union) + sql += "%s " % random.choice(self.unionall_or_union) sql += "select avg(asct2),now(),today(),timezone() from ( select " - sql += "%s as asct2 " % time_fun_2 + sql += "%s as asct2 " % time_fun_2 sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + tdSql.query("select 1-3 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ @@ -2720,19 +2720,19 @@ class TDTestCase: sql += "%s as asct1, ts ," % time_fun_1 sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % time_fun_2 sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += " order by asct1 desc " sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): @@ -2740,154 +2740,154 @@ class TDTestCase: sql += "%s as asct1, ts ," % time_fun_1 sql += "%s as asct2, " % time_fun_2 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2, ts ," % time_fun_2 sql += "%s as asct1, " % time_fun_1 sql += "%s, " % random.choice(self.s_s_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) sql += " order by asct1 desc " sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + elif (timelist == ['ELAPSED']) : sql = "select abs(asct1),now(),today(),timezone() from ( select " sql += "%s as asct1," % time_fun_1 sql += "%s as asct2 " % time_fun_2 sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s select " % random.choice(self.unionall_or_union) + sql += "%s select " % random.choice(self.unionall_or_union) sql += "%s as asct2," % time_fun_2 sql += "%s as asct1 " % time_fun_1 sql += "from regular_table_2 where " sql += "%s " % random.choice(self.q_where) - sql += " order by asct1 asc " + sql += " order by asct1 asc " sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-4 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct11, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct12, " % time_fun_join_1 - sql += "t1.%s as asct111, " % random.choice(self.q_select) - sql += "t2.%s as asct121, " % random.choice(self.q_select) + sql += "%s as asct11, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct12, " % time_fun_join_1 + sql += "t1.%s as asct111, " % random.choice(self.q_select) + sql += "t2.%s as asct121, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), (asct1) from ( select t1.ts as ts1," - sql += "%s as asct10, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct11, " % time_fun_join_1 - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct10, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct11, " % time_fun_join_1 + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) sql += "t2.ts as ts2 from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - elif (timelist == ['ELAPSED']) : + elif (timelist == ['ELAPSED']) : sql = "select floor(asct1) from ( select " - sql += "%s as asct10, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct11" % time_fun_join_1 + sql += "%s as asct10, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct11" % time_fun_join_1 sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s " % random.choice(self.q_u_or_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-5 as time_nest from stable_1 limit 1;") for i in range(self.fornum): - if (timelist == ['ELAPSED']) : + if (timelist == ['ELAPSED']) : sql = "select now(),today(),timezone(), " - sql += "%s, " % time_fun_1 + sql += "%s, " % time_fun_1 sql += "%s " % time_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) else: sql = "select ts ,now(),today(),timezone(), " - sql += "%s as asct11, " % time_fun_1 + sql += "%s as asct11, " % time_fun_1 sql += "%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % random.choice(self.q_select) + sql += "%s as asct13, " % random.choice(self.q_select) sql += "%s as asct14 " % time_fun_2 sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-6 as time_nest from stable_1 limit 1;") - for i in range(self.fornum): + for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts ,timediff(ts1,ts), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % time_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts ,timediff(ts1,ts), (asct1) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t2.%s as asct12, " % random.choice(self.q_select) - sql += "%s as asct13, " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t2.%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct13, " % time_fun_join_1 sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select (asct1)*111 from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "%s as asct122 " % time_fun_join_1 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "%s as asct122 " % time_fun_join_1 sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "and %s )" % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-7 as time_nest from stable_1 limit 1;") @@ -2897,27 +2897,27 @@ class TDTestCase: sql = "select ts1,m1 , timediff(asct1,now) from ( select " sql += "%s as asct1, ts as m1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as ts1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select tm1,tm2 , (asct1),now(),today(),timezone() from ( select " sql += "%s as asct1, ts as tm1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as tm2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select (asct1)/asct2 ,now(),today(),timezone() from ( select " @@ -2926,10 +2926,10 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-8 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ @@ -2939,14 +2939,14 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as tm1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as tm2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 , (asct1),now(),today(),timezone() " @@ -2954,15 +2954,15 @@ class TDTestCase: sql += "%s, " % random.choice(self.s_s_select) sql += "%s as asct1, ts as ts1," % time_fun_1 sql += "%s as asct2, " % time_fun_2 - sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.t_select) + sql += "%s as asct11, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.t_select) sql += "ts as ts2 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select floor(abs(asct1)),now(),today(),timezone() " sql += "from ( select " @@ -2971,8 +2971,8 @@ class TDTestCase: sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 1-9 as time_nest from stable_1 limit 1;") @@ -2980,12 +2980,12 @@ class TDTestCase: if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -2993,17 +2993,17 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1 from ( select t1.ts as ts1," - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) @@ -3011,24 +3011,24 @@ class TDTestCase: sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select min(asct1*110) from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "and %s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - - + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + + tdSql.query("select 1-10 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ @@ -3052,7 +3052,7 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): @@ -3075,9 +3075,9 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select abs(asct1),now(),today(),timezone() from ( select " sql += "%s as asct1 ," % time_fun_1 @@ -3092,10 +3092,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 1-11 as time_nest from stable_1 limit 1;") for i in range(self.fornum): @@ -3119,7 +3119,7 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): @@ -3141,7 +3141,7 @@ class TDTestCase: sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : @@ -3156,10 +3156,10 @@ class TDTestCase: sql += "%s as asct2 " % time_fun_2 sql += " from stable_2 where " sql += "%s " % random.choice(self.q_where) - sql += "order by asct1 " + sql += "order by asct1 " sql += "%s " % random.choice(self.limit1_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3168,100 +3168,100 @@ class TDTestCase: if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts2 ,timediff(ts1,ts2), timediff(asct1,now) from ( select t1.ts as ts1," - sql += "%s, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts2 ,timediff(ts1,ts2), asct1,now() from ( select t1.ts as ts1," - sql += "%s, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts as ts2 from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select min(floor(asct1)),now() from ( select " - sql += "%s as asct121, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct121, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "and %s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-13 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(%s,now)," % time_fun_2 - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % time_fun_2 - sql += "%s as asct122 " % random.choice(self.t_select) + sql += "%s as asct122 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts ,now(),today(),timezone(), " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct11, " % random.choice(self.q_select) - sql += "%s as asct12, " % random.choice(self.q_select) + sql += "%s as asct12, " % random.choice(self.q_select) sql += "%s as asct13, " % time_fun_2 - sql += "%s as asct122 " % random.choice(self.t_select) + sql += "%s as asct122 " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select now(),today(),timezone(), " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct12 " % time_fun_2 sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-14 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts , timediff(asct1,now),timediff(now,asct2) from ( select ts ts ," - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -3269,12 +3269,12 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts , (asct1),now(),(now()),asct2 from ( select ts ts ," - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) @@ -3282,78 +3282,78 @@ class TDTestCase: sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select (asct1)*asct2,now(),(now()) from ( select " - sql += "%s as asct1, " % time_fun_1 + sql += "%s as asct1, " % time_fun_1 sql += "%s as asct2" % time_fun_2 sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ) ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-15 as time_nest from stable_1 limit 1;") for i in range(self.fornum): if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\ or (timelist == ['TO_UNIXTIMESTAMP']) or (timelist == ['TIMEDIFF_1']) or (timelist == ['TIMEDIFF_2']): sql = "select ts1,ts ,timediff(ts1,ts), timediff(asct1,now),timediff(now,asct2) from ( select t1.ts as ts1," - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']): sql = "select ts1,ts ,timediff(ts1,ts), asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select t1.ts as ts1," - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1, " % time_fun_join_2 - sql += "t1.%s as asct11, " % random.choice(self.q_select) - sql += "t1.%s as asct12, " % random.choice(self.q_select) - sql += "t2.%s as asct13, " % random.choice(self.q_select) - sql += "t2.%s as asct14, " % random.choice(self.q_select) + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1, " % time_fun_join_2 + sql += "t1.%s as asct11, " % random.choice(self.q_select) + sql += "t1.%s as asct12, " % random.choice(self.q_select) + sql += "t2.%s as asct13, " % random.choice(self.q_select) + sql += "t2.%s as asct14, " % random.choice(self.q_select) sql += "t2.ts from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s " % random.choice(self.order_desc_where) sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) elif (timelist == ['ELAPSED']) : sql = "select asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select " - sql += "%s as asct2, " % time_fun_join_1 - sql += "%s as asct1 " % time_fun_join_2 + sql += "%s as asct2, " % time_fun_join_1 + sql += "%s as asct1 " % time_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) - sql += ") " + sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f %s sql start!" %timelist) @@ -3361,32 +3361,32 @@ class TDTestCase: # _ = subprocess.check_output(taos_cmd1, shell=True) print("taos -f %s sql over!" %timelist) endTime_taos_f = time.time() - print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) - - print("=========%s====over=============" %timelist) - + print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) + + print("=========%s====over=============" %timelist) + def function_before_26(self): - + print('=====================2.6 old function start ===========') - os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) - + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + self.dropandcreateDB_random("%s" %self.db_nest, 1) - + #1 select * from (select column form regular_table where <\>\in\and\or order by) tdSql.query("select 1-1 from stable_1;") for i in range(self.fornum): sql = "select tas from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as tas from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) - sql += ");" - tdLog.info(sql) + sql += ");" + tdLog.info(sql) tdSql.query(sql,queryTimes=1) self.explain_sql(sql) - - #1 outer union not support + + #1 outer union not support tdSql.query("select 1-2 from stable_1;") for i in range(self.fornum): sql = "select t1s from ( select " @@ -3403,10 +3403,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 1-2 from stable_1;") for i in range(self.fornum): @@ -3424,10 +3424,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #1 inter union not support tdSql.query("select 1-3 from stable_1;") for i in range(self.fornum): @@ -3437,7 +3437,7 @@ class TDTestCase: sql += "%s, " % random.choice(self.q_select) sql += "ts from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "" + sql += "" sql += " union all select " sql += "%s, " % random.choice(self.s_r_select) sql += "%s, " % random.choice(self.q_select) @@ -3445,10 +3445,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 1-3 from stable_1;") for i in range(self.fornum): sql = "select ts from ( select " @@ -3463,54 +3463,54 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - - #join:select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by) - tdSql.query("select 1-4 from stable_1;") - for i in range(self.fornum): - sql = "select * from ( select t1.ts as t1ts," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) - sql += "t2.ts as t2ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) - sql += "and %s " % random.choice(self.q_u_or_where) - sql += "%s " % random.choice(self.order_u_where) - sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #2 select column from (select * form regular_table ) where <\>\in\and\or order by + #join:select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by) + tdSql.query("select 1-4 from stable_1;") + for i in range(self.fornum): + sql = "select * from ( select t1.ts as t1ts," + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t2.ts as t2ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and " + sql += "%s " % random.choice(self.q_u_where) + sql += "and %s " % random.choice(self.q_u_or_where) + sql += "%s " % random.choice(self.order_u_where) + sql += ");" + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + + #2 select column from (select * form regular_table ) where <\>\in\and\or order by tdSql.query("select 2-1 from stable_1;") for i in range(self.fornum): sql = "select ts ," sql += "%s, " % random.choice(self.s_r_select) - sql += "%s " % random.choice(self.q_select) + sql += "%s " % random.choice(self.q_select) sql += " from ( select * from regular_table_1 ) where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #3 select * from (select column\tag form stable where <\>\in\and\or order by ) + #3 select * from (select column\tag form stable where <\>\in\and\or order by ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 3-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) tdSql.query(sql) self.explain_sql(sql) @@ -3520,37 +3520,37 @@ class TDTestCase: sql += "%s " % random.choice(self.s_r_select) sql += "from ( select " sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.q_select) - sql += "%s, " % random.choice(self.t_select) + sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.t_select) sql += "ts from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + tdSql.query(sql) self.explain_sql(sql) - # select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by ) + # select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by ) #self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 3-2 from stable_1;") for i in range(self.fornum): #sql = "select ts , * from ( select t1.ts as t1ts , " sql = "select t1ts , t2ts from ( select t1.ts as t1ts , " - sql += "t1.%s as t11, " % random.choice(self.t_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t13, " % random.choice(self.t_select) - sql += "t2.%s as t14, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.t_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t13, " % random.choice(self.t_select) + sql += "t2.%s as t14, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.order_u_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + #3 outer union not support - + tdSql.query("select 3-3 from stable_1;") for i in range(self.fornum): #sql = "select ts , * from ( select " @@ -3568,7 +3568,7 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) for i in range(self.fornum): @@ -3586,10 +3586,10 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #3 inter union not support tdSql.query("select 3-4 from stable_1;") for i in range(self.fornum): @@ -3606,53 +3606,53 @@ class TDTestCase: sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += ")" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) #join:select * from (select column form stable1,stable2 where t1.ts=t2.ts and <\>\in\and\or order by) tdSql.query("select 3-5 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts as t1ts," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 3-6 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts as t1ts ," - sql += "t1.%s as t11, " % random.choice(self.q_select) - sql += "t1.%s as t12, " % random.choice(self.q_select) - sql += "t2.%s as t21, " % random.choice(self.q_select) - sql += "t2.%s as t22, " % random.choice(self.q_select) + sql += "t1.%s as t11, " % random.choice(self.q_select) + sql += "t1.%s as t12, " % random.choice(self.q_select) + sql += "t2.%s as t21, " % random.choice(self.q_select) + sql += "t2.%s as t22, " % random.choice(self.q_select) sql += "t2.ts as t2ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += ");" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #4 select column from (select * form stable where <\>\in\and\or order by ) + #4 select column from (select * form stable where <\>\in\and\or order by ) tdSql.query("select 4-1 from stable_1;") for i in range(self.fornum): sql = "select ts , " sql += "%s as t11, " % random.choice(self.q_select) - sql += "%s as t12, " % random.choice(self.q_select) - sql += "%s " % random.choice(self.t_select) + sql += "%s as t12, " % random.choice(self.q_select) + sql += "%s " % random.choice(self.t_select) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3665,7 +3665,7 @@ class TDTestCase: sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3674,11 +3674,11 @@ class TDTestCase: for i in range(self.fornum): sql = "select distinct c5_1 " sql += " from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += " as c5_1 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3689,11 +3689,11 @@ class TDTestCase: sql += "%s " % random.choice(self.dt_select) sql += " from stable_1 where " sql += "%s ) ;" % random.choice(self.qt_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #7 select * from (select distinct(tag) form stable where <\>\in\and\or order by limit ) + #7 select * from (select distinct(tag) form stable where <\>\in\and\or order by limit ) tdSql.query("select 7-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " @@ -3702,7 +3702,7 @@ class TDTestCase: sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice([self.limit_where[0] , self.limit_where[1]] ) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3711,146 +3711,146 @@ class TDTestCase: tdSql.query("select 8-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select ts ," - sql += "%s " % random.choice(self.calc_select_support_ts) + sql += "%s " % random.choice(self.calc_select_support_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 8-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_not_support_ts) + sql += "%s " % random.choice(self.calc_select_not_support_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 8-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts, " - sql += "%s " % random.choice(self.calc_select_in_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_support_ts_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) - #9 select * from (select ts,calc form stable where <\>\in\and\or order by ) + #9 select * from (select ts,calc form stable where <\>\in\and\or order by ) # self.dropandcreateDB_random("%s" %db, 1) tdSql.query("select 9-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_not_support_ts) + sql += "%s " % random.choice(self.calc_select_not_support_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 9-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select ts ," - sql += "%s " % random.choice(self.calc_select_support_ts) + sql += "%s " % random.choice(self.calc_select_support_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 9-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 9-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select t1.ts," - sql += "%s " % random.choice(self.calc_select_in_support_ts_j) + sql += "%s " % random.choice(self.calc_select_in_support_ts_j) sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += " and %s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.order_u_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - - #10 select calc from (select * form regualr_table where <\>\in\and\or order by ) + + #10 select calc from (select * form regualr_table where <\>\in\and\or order by ) tdSql.query("select 10-1 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql = "select " + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "as calc10_1 from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #10-1 select calc from (select * form regualr_table where <\>\in\and\or order by ) tdSql.query("select 10-2 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql = "select " + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc10_2 from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by ) + #10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by ) tdSql.query("select 10-3 from stable_1;") for i in range(self.fornum): - sql = "select " - sql += "count(*) as calc10_3 " + sql = "select " + sql += "count(*) as calc10_3 " sql += " from ( select t1.ts as t11, t2.ts as t22 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += " and %s " % random.choice(self.q_u_or_where) @@ -3858,64 +3858,64 @@ class TDTestCase: sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #11 select calc from (select * form stable where <\>\in\and\or order by limit ) + #11 select calc from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 11-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "as calc11_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #11-1 select calc from (select * form stable where <\>\in\and\or order by limit ) + #11-1 select calc from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 11-2 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_select_all) + sql += "%s " % random.choice(self.calc_select_all) sql += "as calc11_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice(self.limit1_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - #12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit ) + #12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit ) tdSql.query("select 12-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.order_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) #12-1 select calc-diff from (select * form stable where <\>\in\and\or order by limit ) - tdSql.query("select 12-3 from stable_1;") + tdSql.query("select 12-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3923,14 +3923,14 @@ class TDTestCase: #join query does not support group by for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular_j) + sql += "%s " % random.choice(self.calc_calculate_regular_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.partiton_where_j) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3938,27 +3938,27 @@ class TDTestCase: #join query does not support group by for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_calculate_regular_j) + sql += "%s " % random.choice(self.calc_calculate_regular_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += ") " sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += " ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) - self.explain_sql(sql) + self.explain_sql(sql) #13 select calc-diff as diffns from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 13-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " as calc13_1 from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] ) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3966,14 +3966,14 @@ class TDTestCase: tdSql.query("select 14-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) - sql += "%s " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) + sql += "%s " % random.choice(self.calc_aggregate_all) sql += " as calc14_3 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.group_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3981,15 +3981,15 @@ class TDTestCase: tdSql.query("select 14-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) - sql += "%s " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all) + sql += "%s " % random.choice(self.calc_aggregate_all) sql += " as calc14_3 from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where_regular) sql += "%s " % random.choice(self.slimit1_where) sql += ") " - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -3997,32 +3997,32 @@ class TDTestCase: tdSql.query("select 14-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) - sql += "%s " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) + sql += "%s " % random.choice(self.calc_aggregate_all_j) sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 14-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) - sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) - sql += "%s " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j) + sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j) + sql += "%s " % random.choice(self.calc_aggregate_all_j) sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.partiton_where_j) sql += "%s " % random.choice(self.slimit1_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -4030,227 +4030,227 @@ class TDTestCase: tdSql.query("select 15-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular) - sql += "%s " % random.choice(self.calc_aggregate_regular) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular) + sql += "%s " % random.choice(self.calc_aggregate_regular) sql += " as calc15_3 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) - sql += "%s " % random.choice(self.group_where_regular) + sql += "%s " % random.choice(self.group_where_regular) sql += ") ;" - tdLog.info(sql) - self.data_check(sql,mark='15-1') - + tdLog.info(sql) + self.data_check(sql,mark='15-1') + tdSql.query("select 15-2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_2 " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_2 " % random.choice(self.calc_aggregate_regular_j) sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) - sql += "%s " % random.choice(self.group_where_regular_j) + sql += "%s " % random.choice(self.group_where_regular_j) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 15-2.2 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j) - sql += "%s " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j) + sql += "%s " % random.choice(self.calc_aggregate_regular_j) sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) - sql += "%s " % random.choice(self.group_where_regular_j) + sql += "%s " % random.choice(self.group_where_regular_j) sql += "%s " % random.choice(self.limit_u_where) sql += ") " sql += "%s ;" % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 15-3 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) sql += " as calc15_3 from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_only_where) sql += "%s " % random.choice(self.having_support) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 15-4 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j) sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.group_only_where_j) sql += "%s " % random.choice(self.having_support_j) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_u_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 15-5 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) - sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname) + sql += "%s " % random.choice(self.calc_aggregate_groupbytbname) sql += " as calc15_3 from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc15_1 " + sql += "order by calc15_1 " sql += "%s " % random.choice(self.limit_where) - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - #16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset ) + #16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset ) tdSql.query("select 16-1 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_1 , " % random.choice(self.calc_aggregate_all) - sql += "%s as calc16_2 " % random.choice(self.calc_select_in) + sql += "%s as calc16_1 , " % random.choice(self.calc_aggregate_all) + sql += "%s as calc16_2 " % random.choice(self.calc_select_in) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j) - sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) + sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-2.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j) - sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) + sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += ") " - sql += "order by calc16_0 " + sql += "order by calc16_0 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 16-3 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-4 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-4.2 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 16-5 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " + sql = "select * from ( select " sql += "%s as calc16_1 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_2 , " % random.choice(self.calc_calculate_all) - sql += "%s as calc16_3 " % random.choice(self.calc_calculate_all) + sql += "%s as calc16_2 , " % random.choice(self.calc_calculate_all) + sql += "%s as calc16_3 " % random.choice(self.calc_calculate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.group_where) sql += ") " - sql += "order by calc16_1 " + sql += "order by calc16_1 " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 16-6 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-7 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 16-8 from stable_1;") for i in range(self.fornum): - sql = "select * from ( select " - sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) + sql = "select * from ( select " + sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "limit 2 ) " sql += "%s " % random.choice(self.limit1_where) - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) @@ -4259,566 +4259,566 @@ class TDTestCase: for i in range(self.fornum): sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 17-2 from stable_1;") for i in range(self.fornum): - #this is having_support , but tag-select cannot mix with last_row,other select can + #this is having_support , but tag-select cannot mix with last_row,other select can sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-2.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 17-3 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-4 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-4.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-5 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.partiton_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 17-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-7.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 17-8 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 17-9 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 17-10 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.interval_sliding) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-1 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 18-2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-2.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 18-3 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-4 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-4.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-5 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.session_where) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 18-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 18-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.session_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - #19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding + #19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding tdSql.query("select 19-1 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) sql += " from regular_table_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.state_window) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 19-2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.state_u_window) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 19-2.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_or_where) + sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.state_u_window) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + tdSql.query("select 19-3 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all) sql += " from stable_1_1 where " - sql += "%s " % random.choice(self.q_where) + sql += "%s " % random.choice(self.q_where) sql += "%s " % random.choice(self.state_window) sql += "%s " % random.choice(self.limit1_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 19-4 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 19-4.2 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_or_where) + sql += "%s " % random.choice(self.q_u_or_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) - self.explain_sql(sql) - + tdLog.info(sql) + tdSql.query(sql) + self.explain_sql(sql) + tdSql.query("select 19-6 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.q_u_where) + sql += "%s " % random.choice(self.q_u_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) tdSql.query("select 19-7 from stable_1;") for i in range(self.fornum): sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000)) - sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) - sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j) + sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j) sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " - sql += "%s " % random.choice(self.qt_u_or_where) + sql += "%s " % random.choice(self.qt_u_or_where) sql += "%s " % random.choice(self.limit_u_where) sql += ") " - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) #1 select * from (select * from (select * form regular_table where <\>\in\and\or order by limit )) tdSql.query("select 1-1 from stable_1;") - for i in range(self.fornum): + for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select * from (" * for_num + sql = "select * from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_r_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.s_r_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ttt from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_r_select) - sql2 += "%s, " % random.choice(self.q_select) + sql2 += "%s, " % random.choice(self.s_r_select) + sql2 += "%s, " % random.choice(self.q_select) sql2 += "ts as tin from regular_table_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdSql.query(sql2) self.cur1.execute(sql2) - self.explain_sql(sql2) - - tdLog.info("=====1-1==over=========") - + self.explain_sql(sql2) + + tdLog.info("=====1-1==over=========") + for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select ts2 from (" * for_num + sql = "select ts2 from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_r_select) - sql += "%s, " % random.choice(self.q_select) + sql += "%s, " % random.choice(self.s_r_select) + sql += "%s, " % random.choice(self.q_select) sql += "ts as ts2 from regular_table_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_r_select) - sql2 += "%s, " % random.choice(self.q_select) + sql2 += "%s, " % random.choice(self.s_r_select) + sql2 += "%s, " % random.choice(self.q_select) sql2 += "ts as tt from regular_table_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) + sql2 += ")) " + tdLog.info(sql2) tdSql.query(sql2) - self.explain_sql(sql2) - tdLog.info("=====1-2==over=========") - + self.explain_sql(sql2) + tdLog.info("=====1-2==over=========") + #2 select * from (select * from (select * form stable where <\>\in\and\or order by limit )) tdSql.query("select 2-1 from stable_1;") for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select * from (" * for_num + sql = "select * from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.qt_select) + sql += "%s, " % random.choice(self.s_s_select) + sql += "%s, " % random.choice(self.qt_select) sql += "ts as tss from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + sql2 = "select * from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_s_select) - sql2 += "%s, " % random.choice(self.qt_select) + sql2 += "%s, " % random.choice(self.s_s_select) + sql2 += "%s, " % random.choice(self.qt_select) sql2 += "ts as tst from stable_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdSql.query(sql2) self.explain_sql(sql2) - - tdLog.info("=====2-1==over=========") - + + tdLog.info("=====2-1==over=========") + for i in range(self.fornum): for_num = random.randint(1, 15); - sql = "select tsn from (" * for_num + sql = "select tsn from (" * for_num sql += "select * from ( select * from ( select " - sql += "%s, " % random.choice(self.s_s_select) - sql += "%s, " % random.choice(self.qt_select) + sql += "%s, " % random.choice(self.s_s_select) + sql += "%s, " % random.choice(self.qt_select) sql += "ts as tsn from stable_1 where " sql += "%s " % random.choice(self.q_where) sql += ")) " - sql += ")" * for_num - tdLog.info(sql) - tdSql.query(sql) + sql += ")" * for_num + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) - + sql2 = "select ts1 from ( select * from ( select " - sql2 += "%s, " % random.choice(self.s_s_select) - sql2 += "%s, " % random.choice(self.qt_select) + sql2 += "%s, " % random.choice(self.s_s_select) + sql2 += "%s, " % random.choice(self.qt_select) sql2 += "ts as ts1 from stable_1 where " sql2 += "%s " % random.choice(self.q_where) - sql2 += ")) " - tdLog.info(sql2) - tdSql.query(sql2) + sql2 += ")) " + tdLog.info(sql2) + tdSql.query(sql2) self.cur1.execute(sql2) self.explain_sql(sql2) - tdLog.info("=====2-2==over=========") - - #3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit ) + tdLog.info("=====2-2==over=========") + + #3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 3-1 from stable_1;") for i in range(self.fornum): sql = "select " - sql += "%s " % random.choice(self.calc_calculate_regular) + sql += "%s " % random.choice(self.calc_calculate_regular) sql += " from ( select * from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) - tdSql.query(sql) + tdLog.info(sql) + tdSql.query(sql) self.explain_sql(sql) #4 select * from (select calc form stable where <\>\in\and\or order by limit ) tdSql.query("select 4-1 from stable_1;") for i in range(self.fornum): sql = "select * from ( select " - sql += "%s " % random.choice(self.calc_select_in_ts) + sql += "%s " % random.choice(self.calc_select_in_ts) sql += "from stable_1 where " sql += "%s " % random.choice(self.qt_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #5 select ts ,tbname from (select * form stable where <\>\in\and\or order by limit ) tdSql.query("select 5-1 from stable_1;") for i in range(self.fornum): sql = "select ts , tbname , " - sql += "%s ," % random.choice(self.calc_calculate_regular) + sql += "%s ," % random.choice(self.calc_calculate_regular) sql += "%s ," % random.choice(self.dqt_select) sql += "%s " % random.choice(self.qt_select) sql += " from ( select * from stable_1 where " @@ -4826,8 +4826,8 @@ class TDTestCase: sql += "%s " % random.choice(self.orders_desc_where) sql += "%s " % random.choice(self.limit_where) sql += ") ;" - tdLog.info(sql) - tdSql.error(sql) + tdLog.info(sql) + tdSql.error(sql) #special sql tdSql.query("select 6-1 from stable_1;") @@ -4837,34 +4837,34 @@ class TDTestCase: sql = "select _block_dist() from (select * from stable_1);" tdSql.error(sql) sql = "select * from (select database());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select client_version());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select client_version() as version);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select server_version());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select server_version() as version);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select server_status());" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) sql = "select * from (select server_status() as status);" - tdLog.info(sql) + tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - + #taos -f sql startTime_taos_f = time.time() print("taos -f sql start!") @@ -4875,56 +4875,56 @@ class TDTestCase: print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f)) print('=====================2.6 old function end ===========') - - + + def run(self): tdSql.prepare() - - startTime = time.time() - #self.function_before_26() - - self.dropandcreateDB_random("%s" %self.db_nest, 1) - + startTime = time.time() + + #self.function_before_26() + + self.dropandcreateDB_random("%s" %self.db_nest, 1) + self.math_nest(['UNIQUE']) - self.math_nest(['MODE']) + self.math_nest(['MODE']) self.math_nest(['SAMPLE']) - - self.math_nest(['ABS','SQRT']) - self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) - self.math_nest(['POW','LOG']) - self.math_nest(['FLOOR','CEIL','ROUND']) - self.math_nest(['MAVG']) - self.math_nest(['HYPERLOGLOG']) - self.math_nest(['TAIL']) + + self.math_nest(['ABS','SQRT']) + self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) + self.math_nest(['POW','LOG']) + self.math_nest(['FLOOR','CEIL','ROUND']) + self.math_nest(['MAVG']) + self.math_nest(['HYPERLOGLOG']) + self.math_nest(['TAIL']) self.math_nest(['CSUM']) self.math_nest(['statecount','stateduration']) - self.math_nest(['HISTOGRAM']) - - self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) - self.str_nest(['LENGTH','CHAR_LENGTH']) - self.str_nest(['SUBSTR']) - self.str_nest(['CONCAT']) - self.str_nest(['CONCAT_WS']) - self.time_nest(['CAST']) + self.math_nest(['HISTOGRAM']) + + self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) + self.str_nest(['LENGTH','CHAR_LENGTH']) + self.str_nest(['SUBSTR']) + self.str_nest(['CONCAT']) + self.str_nest(['CONCAT_WS']) + self.time_nest(['CAST']) self.time_nest(['CAST_1']) self.time_nest(['CAST_2']) self.time_nest(['CAST_3']) self.time_nest(['CAST_4']) - - self.time_nest(['NOW','TODAY']) - self.time_nest(['TIMEZONE']) - self.time_nest(['TIMETRUNCATE']) + + self.time_nest(['NOW','TODAY']) + self.time_nest(['TIMEZONE']) + self.time_nest(['TIMETRUNCATE']) self.time_nest(['TO_ISO8601']) self.time_nest(['TO_UNIXTIMESTAMP']) self.time_nest(['ELAPSED']) self.time_nest(['TIMEDIFF_1']) - self.time_nest(['TIMEDIFF_2']) + self.time_nest(['TIMEDIFF_2']) endTime = time.time() print("total time %ds" % (endTime - startTime)) - + def stop(self): diff --git a/tests/system-test/2-query/stablity_1.py b/tests/system-test/2-query/stablity_1.py index c1a5eea350..bde92fc9bd 100755 --- a/tests/system-test/2-query/stablity_1.py +++ b/tests/system-test/2-query/stablity_1.py @@ -17,52 +17,52 @@ class TDTestCase(TDTestCase): def run(self): tdSql.prepare() - - startTime = time.time() - self.function_before_26() - - self.dropandcreateDB_random("%s" %self.db_nest, 1) - + startTime = time.time() + + self.function_before_26() + + self.dropandcreateDB_random("%s" %self.db_nest, 1) + # self.math_nest(['UNIQUE']) - # self.math_nest(['MODE']) + # self.math_nest(['MODE']) # self.math_nest(['SAMPLE']) - - # self.math_nest(['ABS','SQRT']) - # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) - # self.math_nest(['POW','LOG']) - # self.math_nest(['FLOOR','CEIL','ROUND']) - # self.math_nest(['MAVG']) - # self.math_nest(['HYPERLOGLOG']) - # self.math_nest(['TAIL']) + + # self.math_nest(['ABS','SQRT']) + # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN']) + # self.math_nest(['POW','LOG']) + # self.math_nest(['FLOOR','CEIL','ROUND']) + # self.math_nest(['MAVG']) + # self.math_nest(['HYPERLOGLOG']) + # self.math_nest(['TAIL']) # self.math_nest(['CSUM']) # self.math_nest(['statecount','stateduration']) - # self.math_nest(['HISTOGRAM']) - - self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) - self.str_nest(['LENGTH','CHAR_LENGTH']) - self.str_nest(['SUBSTR']) - self.str_nest(['CONCAT']) - self.str_nest(['CONCAT_WS']) - self.time_nest(['CAST']) + # self.math_nest(['HISTOGRAM']) + + self.str_nest(['LTRIM','RTRIM','LOWER','UPPER']) + self.str_nest(['LENGTH','CHAR_LENGTH']) + self.str_nest(['SUBSTR']) + self.str_nest(['CONCAT']) + self.str_nest(['CONCAT_WS']) + self.time_nest(['CAST']) self.time_nest(['CAST_1']) self.time_nest(['CAST_2']) self.time_nest(['CAST_3']) self.time_nest(['CAST_4']) - - self.time_nest(['NOW','TODAY']) - self.time_nest(['TIMEZONE']) - self.time_nest(['TIMETRUNCATE']) + + self.time_nest(['NOW','TODAY']) + self.time_nest(['TIMEZONE']) + self.time_nest(['TIMETRUNCATE']) self.time_nest(['TO_ISO8601']) self.time_nest(['TO_UNIXTIMESTAMP']) self.time_nest(['ELAPSED']) self.time_nest(['TIMEDIFF_1']) - self.time_nest(['TIMEDIFF_2']) + self.time_nest(['TIMEDIFF_2']) endTime = time.time() print("total time %ds" % (endTime - startTime)) - + def stop(self): tdSql.close() From a90ce0008c35e22e52e2d94e2c01c5355ea935c6 Mon Sep 17 00:00:00 2001 From: "wenzhouwww@live.cn" Date: Tue, 15 Nov 2022 14:55:37 +0800 Subject: [PATCH 042/116] fix/release of CentOS about rpm packing can find python3 --- packaging/rpm/tdengine.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index 637d2d425a..e9d86219cb 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -2,6 +2,7 @@ %define userlocalpath /usr/local %define cfg_install_dir /etc/taos %define __strip /bin/true +%global __python /usr/bin/python3 Name: tdengine Version: %{_version} From 9d1cdb0b055e0ec3ee6c257719e158e58673c8e1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 15:13:59 +0800 Subject: [PATCH 043/116] test: add asan case --- tests/parallel_test/cases.task | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 2369b238ea..cf2e95e590 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -10,9 +10,9 @@ ,,y,script,./test.sh -f tsim/user/password.sim ,,y,script,./test.sh -f tsim/user/privilege_db.sim ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim -,,,script,./test.sh -f tsim/db/alter_option.sim -,,,script,./test.sh -f tsim/db/alter_replica_13.sim -,,,script,./test.sh -f tsim/db/alter_replica_31.sim +,,y,script,./test.sh -f tsim/db/alter_option.sim +,,y,script,./test.sh -f tsim/db/alter_replica_13.sim +,,y,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim ,,y,script,./test.sh -f tsim/db/basic3.sim @@ -20,7 +20,7 @@ ,,y,script,./test.sh -f tsim/db/basic5.sim ,,y,script,./test.sh -f tsim/db/basic6.sim ,,y,script,./test.sh -f tsim/db/commit.sim -,,,script,./test.sh -f tsim/db/create_all_options.sim +,,y,script,./test.sh -f tsim/db/create_all_options.sim ,,y,script,./test.sh -f tsim/db/delete_reuse1.sim ,,y,script,./test.sh -f tsim/db/delete_reuse2.sim ,,y,script,./test.sh -f tsim/db/delete_reusevnode.sim @@ -90,7 +90,7 @@ ,,y,script,./test.sh -f tsim/parser/auto_create_tb.sim ,,y,script,./test.sh -f tsim/parser/between_and.sim ,,y,script,./test.sh -f tsim/parser/binary_escapeCharacter.sim -,,,script,./test.sh -f tsim/parser/col_arithmetic_operation.sim +,,y,script,./test.sh -f tsim/parser/col_arithmetic_operation.sim ,,y,script,./test.sh -f tsim/parser/columnValue_bigint.sim ,,y,script,./test.sh -f tsim/parser/columnValue_bool.sim ,,y,script,./test.sh -f tsim/parser/columnValue_double.sim @@ -124,7 +124,7 @@ ,,y,script,./test.sh -f tsim/parser/import.sim ,,y,script,./test.sh -f tsim/parser/insert_multiTbl.sim ,,y,script,./test.sh -f tsim/parser/insert_tb.sim -,,,script,./test.sh -f tsim/parser/join_manyblocks.sim +,,y,script,./test.sh -f tsim/parser/join_manyblocks.sim ,,y,script,./test.sh -f tsim/parser/join_multitables.sim ,,y,script,./test.sh -f tsim/parser/join_multivnode.sim ,,y,script,./test.sh -f tsim/parser/join.sim @@ -173,9 +173,9 @@ ,,,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim -,,,script,./test.sh -f tsim/mnode/basic1.sim -,,,script,./test.sh -f tsim/mnode/basic2.sim -,,,script,./test.sh -f tsim/mnode/basic3.sim +,,y,script,./test.sh -f tsim/mnode/basic1.sim +,,y,script,./test.sh -f tsim/mnode/basic2.sim +,,y,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim ,,y,script,./test.sh -f tsim/show/basic.sim @@ -219,8 +219,8 @@ ,,,script,./test.sh -f tsim/stream/distributeSession0.sim ,,,script,./test.sh -f tsim/stream/session0.sim ,,,script,./test.sh -f tsim/stream/session1.sim -,,,script,./test.sh -f tsim/stream/state0.sim -,,,script,./test.sh -f tsim/stream/triggerInterval0.sim +,,y,script,./test.sh -f tsim/stream/state0.sim +,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/partitionby.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim @@ -288,11 +288,11 @@ ,,,script,./test.sh -f tsim/valgrind/checkError7.sim ,,,script,./test.sh -f tsim/valgrind/checkError8.sim ,,,script,./test.sh -f tsim/valgrind/checkUdf.sim -,,,script,./test.sh -f tsim/vnode/replica3_basic.sim -,,,script,./test.sh -f tsim/vnode/replica3_repeat.sim -,,,script,./test.sh -f tsim/vnode/replica3_vgroup.sim -,,,script,./test.sh -f tsim/vnode/replica3_many.sim -,,,script,./test.sh -f tsim/vnode/replica3_import.sim +,,y,script,./test.sh -f tsim/vnode/replica3_basic.sim +,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim +,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim +,,y,script,./test.sh -f tsim/vnode/replica3_many.sim +,,y,script,./test.sh -f tsim/vnode/replica3_import.sim ,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim @@ -307,7 +307,7 @@ ,,y,script,./test.sh -f tsim/scalar/in.sim ,,y,script,./test.sh -f tsim/scalar/scalar.sim ,,y,script,./test.sh -f tsim/scalar/filter.sim -,,,script,./test.sh -f tsim/scalar/caseWhen.sim +,,y,script,./test.sh -f tsim/scalar/caseWhen.sim ,,y,script,./test.sh -f tsim/alter/cached_schema_after_alter.sim ,,y,script,./test.sh -f tsim/alter/dnode.sim ,,y,script,./test.sh -f tsim/alter/table.sim From 5f824801d1c3aa67a5b930214c7f5793c49f3cae Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 15:28:08 +0800 Subject: [PATCH 044/116] test: add asan case --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index cf2e95e590..e15260a284 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -42,8 +42,8 @@ ,,,script,./test.sh -f tsim/dnode/balance3.sim ,,,script,./test.sh -f tsim/dnode/balancex.sim ,,y,script,./test.sh -f tsim/dnode/create_dnode.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim ,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim ,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim ,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim From 276fc51969dd57752a684832c50615d163ae3471 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 15 Nov 2022 15:28:51 +0800 Subject: [PATCH 045/116] fix: clear meta reader's decoder to free leaked memory --- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 6883354547..5c8c166833 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1189,6 +1189,8 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void vError("vgId:%d, delete error since %s, suid:%" PRId64 ", uid:%" PRId64 ", start ts:%" PRId64 ", end ts:%" PRId64, TD_VID(pVnode), terrstr(), deleteReq.suid, uid, pOneReq->ts, pOneReq->ts); } + + tDecoderClear(&mr.coder); } metaReaderClear(&mr); taosArrayDestroy(deleteReq.deleteReqs); From 5ad1bca624057d439bd97f9fec5e96f02cbe8dd5 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 15 Nov 2022 15:57:50 +0800 Subject: [PATCH 046/116] fix: free value return by tdb --- source/dnode/vnode/src/tq/tqMeta.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index b021c5ee7f..a15d19fbe1 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -179,6 +179,7 @@ int32_t tqMetaRestoreCheckInfo(STQ* pTq) { if (tDecodeSTqCheckInfo(&decoder, &info) < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; tdbFree(pKey); + tdbFree(pVal); tdbTbcClose(pCur); return -1; } @@ -186,11 +187,13 @@ int32_t tqMetaRestoreCheckInfo(STQ* pTq) { if (taosHashPut(pTq->pCheckInfo, info.topic, strlen(info.topic), &info, sizeof(STqCheckInfo)) < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; tdbFree(pKey); + tdbFree(pVal); tdbTbcClose(pCur); return -1; } } tdbFree(pKey); + tdbFree(pVal); tdbTbcClose(pCur); return 0; } From cfc00310809f3e40884df8eb98f2c001f3604fb6 Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Tue, 15 Nov 2022 15:58:47 +0800 Subject: [PATCH 047/116] chore: update taosws to fix some unhandled error --- cmake/taosws_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in index 33ca6c659c..5c448e2c1d 100644 --- a/cmake/taosws_CMakeLists.txt.in +++ b/cmake/taosws_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosws-rs ExternalProject_Add(taosws-rs GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git - GIT_TAG 38c4599 + GIT_TAG 7664c41 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 094ada1566b0f5d800a1da194c8c11b72769999a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 16:13:22 +0800 Subject: [PATCH 048/116] test: add tsan case --- tests/parallel_test/cases.task | 58 +++++++++++++++++----------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index e15260a284..2e964c3f42 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -12,7 +12,7 @@ ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim ,,y,script,./test.sh -f tsim/db/alter_replica_13.sim -,,y,script,./test.sh -f tsim/db/alter_replica_31.sim +,,,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim ,,y,script,./test.sh -f tsim/db/basic3.sim @@ -207,7 +207,7 @@ ,,y,script,./test.sh -f tsim/table/table.sim ,,y,script,./test.sh -f tsim/table/tinyint.sim ,,y,script,./test.sh -f tsim/table/vgroup.sim -,,,script,./test.sh -f tsim/stream/basic0.sim -g +,,n,script,./test.sh -f tsim/stream/basic0.sim -g ,,y,script,./test.sh -f tsim/stream/basic1.sim ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim @@ -228,14 +228,14 @@ ,,,script,./test.sh -f tsim/stream/windowClose.sim ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim -,,,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim +,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim ,,,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim -,,,script,./test.sh -f tsim/stream/partitionbyColumnState.sim -,,,script,./test.sh -f tsim/stream/deleteInterval.sim +,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim +,,y,script,./test.sh -f tsim/stream/deleteInterval.sim ,,,script,./test.sh -f tsim/stream/deleteSession.sim -,,,script,./test.sh -f tsim/stream/deleteState.sim +,,y,script,./test.sh -f tsim/stream/deleteState.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalDelete0.sim -,,,script,./test.sh -f tsim/stream/fillIntervalDelete1.sim +,,y,script,./test.sh -f tsim/stream/fillIntervalDelete1.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalLinear.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalPartitionBy.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalPrevNext.sim @@ -244,16 +244,16 @@ ,,y,script,./test.sh -f tsim/trans/create_db.sim ,,y,script,./test.sh -f tsim/tmq/basic1.sim ,,y,script,./test.sh -f tsim/tmq/basic2.sim -,,,script,./test.sh -f tsim/tmq/basic3.sim -,,,script,./test.sh -f tsim/tmq/basic4.sim -,,,script,./test.sh -f tsim/tmq/basic1Of2Cons.sim -,,,script,./test.sh -f tsim/tmq/basic2Of2Cons.sim -,,,script,./test.sh -f tsim/tmq/basic3Of2Cons.sim -,,,script,./test.sh -f tsim/tmq/basic4Of2Cons.sim -,,,script,./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim +,,y,script,./test.sh -f tsim/tmq/basic3.sim +,,y,script,./test.sh -f tsim/tmq/basic4.sim +,,y,script,./test.sh -f tsim/tmq/basic1Of2Cons.sim +,,y,script,./test.sh -f tsim/tmq/basic2Of2Cons.sim +,,y,script,./test.sh -f tsim/tmq/basic3Of2Cons.sim +,,y,script,./test.sh -f tsim/tmq/basic4Of2Cons.sim +,,y,script,./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim ,,,script,./test.sh -f tsim/tmq/topic.sim -,,,script,./test.sh -f tsim/tmq/snapshot.sim -,,,script,./test.sh -f tsim/tmq/snapshot1.sim +,,y,script,./test.sh -f tsim/tmq/snapshot.sim +,,y,script,./test.sh -f tsim/tmq/snapshot1.sim ,,y,script,./test.sh -f tsim/stable/alter_comment.sim ,,y,script,./test.sh -f tsim/stable/alter_count.sim ,,y,script,./test.sh -f tsim/stable/alter_import.sim @@ -279,15 +279,15 @@ ,,,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim ,,y,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim ,,,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim -,,,script,./test.sh -f tsim/valgrind/checkError1.sim -,,,script,./test.sh -f tsim/valgrind/checkError2.sim -,,,script,./test.sh -f tsim/valgrind/checkError3.sim -,,,script,./test.sh -f tsim/valgrind/checkError4.sim -,,,script,./test.sh -f tsim/valgrind/checkError5.sim -,,,script,./test.sh -f tsim/valgrind/checkError6.sim -,,,script,./test.sh -f tsim/valgrind/checkError7.sim -,,,script,./test.sh -f tsim/valgrind/checkError8.sim -,,,script,./test.sh -f tsim/valgrind/checkUdf.sim +,,n,script,./test.sh -f tsim/valgrind/checkError1.sim +,,n,script,./test.sh -f tsim/valgrind/checkError2.sim +,,n,script,./test.sh -f tsim/valgrind/checkError3.sim +,,n,script,./test.sh -f tsim/valgrind/checkError4.sim +,,n,script,./test.sh -f tsim/valgrind/checkError5.sim +,,n,script,./test.sh -f tsim/valgrind/checkError6.sim +,,n,script,./test.sh -f tsim/valgrind/checkError7.sim +,,n,script,./test.sh -f tsim/valgrind/checkError8.sim +,,n,script,./test.sh -f tsim/valgrind/checkUdf.sim ,,y,script,./test.sh -f tsim/vnode/replica3_basic.sim ,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim ,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim @@ -299,10 +299,10 @@ ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim ,,,script,./test.sh -f tsim/vnode/stable_replica3_dnode6.sim ,,,script,./test.sh -f tsim/vnode/stable_replica3_vnode3.sim -,,,script,./test.sh -f tsim/sync/3Replica1VgElect.sim -,,,script,./test.sh -f tsim/sync/3Replica5VgElect.sim -,,,script,./test.sh -f tsim/sync/oneReplica1VgElect.sim -,,,script,./test.sh -f tsim/sync/oneReplica5VgElect.sim +,,y,script,./test.sh -f tsim/sync/3Replica1VgElect.sim +,,y,script,./test.sh -f tsim/sync/3Replica5VgElect.sim +,,y,script,./test.sh -f tsim/sync/oneReplica1VgElect.sim +,,y,script,./test.sh -f tsim/sync/oneReplica5VgElect.sim ,,y,script,./test.sh -f tsim/catalog/alterInCurrent.sim ,,y,script,./test.sh -f tsim/scalar/in.sim ,,y,script,./test.sh -f tsim/scalar/scalar.sim From 91b098735cbea200df978a8bc9133fb8bc7c62fe Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 16:16:43 +0800 Subject: [PATCH 049/116] test: remove asan case --- tests/parallel_test/cases.task | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 2e964c3f42..67753d7f46 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -173,9 +173,9 @@ ,,,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim -,,y,script,./test.sh -f tsim/mnode/basic1.sim -,,y,script,./test.sh -f tsim/mnode/basic2.sim -,,y,script,./test.sh -f tsim/mnode/basic3.sim +,,,script,./test.sh -f tsim/mnode/basic1.sim +,,,script,./test.sh -f tsim/mnode/basic2.sim +,,,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim ,,y,script,./test.sh -f tsim/show/basic.sim @@ -288,7 +288,7 @@ ,,n,script,./test.sh -f tsim/valgrind/checkError7.sim ,,n,script,./test.sh -f tsim/valgrind/checkError8.sim ,,n,script,./test.sh -f tsim/valgrind/checkUdf.sim -,,y,script,./test.sh -f tsim/vnode/replica3_basic.sim +,,,script,./test.sh -f tsim/vnode/replica3_basic.sim ,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim ,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim ,,y,script,./test.sh -f tsim/vnode/replica3_many.sim From 9687d352e5981ffe68979382c84ce6ae79993c5e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 16:23:54 +0800 Subject: [PATCH 050/116] test: remove asan case --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 67753d7f46..9b1d829c9a 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -11,7 +11,7 @@ ,,y,script,./test.sh -f tsim/user/privilege_db.sim ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim -,,y,script,./test.sh -f tsim/db/alter_replica_13.sim +,,,script,./test.sh -f tsim/db/alter_replica_13.sim ,,,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim From 885c49b2ebedcb7fd0e1b4325300881f28aabc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chappyguoxy=E2=80=9D?= <“happy_guoxy@163.com”> Date: Tue, 15 Nov 2022 16:54:55 +0800 Subject: [PATCH 051/116] test: refine query cases --- tests/parallel_test/cases.task | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 9b1d829c9a..e58ad6b892 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -111,6 +111,9 @@ ,,y,script,./test.sh -f tsim/parser/fill_us.sim ,,y,script,./test.sh -f tsim/parser/fill.sim ,,y,script,./test.sh -f tsim/parser/first_last.sim +,,y,script,./test.sh -f tsim/parser/fill_stb.sim +,,y,script,./test.sh -f tsim/parser/interp.sim +#,,y,script,./test.sh -f tsim/parser/limit2.sim ,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim ,,,script,./test.sh -f tsim/parser/function.sim ,,y,script,./test.sh -f tsim/parser/groupby-basic.sim From 92e4ad1bdd2c04fc401ad3c6e4709e97a7696c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chappyguoxy=E2=80=9D?= <“happy_guoxy@163.com”> Date: Tue, 15 Nov 2022 16:55:12 +0800 Subject: [PATCH 052/116] test: refine query cases --- tests/script/tsim/parser/interp.sim | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/script/tsim/parser/interp.sim b/tests/script/tsim/parser/interp.sim index f6cfc86098..1b7878178c 100644 --- a/tests/script/tsim/parser/interp.sim +++ b/tests/script/tsim/parser/interp.sim @@ -68,12 +68,8 @@ print ================= TD-5931 sql create stable st5931(ts timestamp, f int) tags(t int) sql create table ct5931 using st5931 tags(1) sql create table nt5931(ts timestamp, f int) -sql select interp(*) from nt5931 where ts=now -sql select interp(*) from st5931 where ts=now -sql select interp(*) from ct5931 where ts=now - -if $rows != 0 then - return -1 -endi +sql_error select interp(*) from nt5931 where ts=now +sql_error select interp(*) from st5931 where ts=now +sql_error select interp(*) from ct5931 where ts=now system sh/exec.sh -n dnode1 -s stop -x SIGINT From b64de325708f6c3641bb984e72d05c3089816741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chappyguoxy=E2=80=9D?= <“happy_guoxy@163.com”> Date: Tue, 15 Nov 2022 16:55:34 +0800 Subject: [PATCH 053/116] test: refine query cases --- tests/script/tsim/parser/interp_test.sim | 2421 +--------------------- 1 file changed, 75 insertions(+), 2346 deletions(-) diff --git a/tests/script/tsim/parser/interp_test.sim b/tests/script/tsim/parser/interp_test.sim index 5c94b72b43..ae80cb09fd 100644 --- a/tests/script/tsim/parser/interp_test.sim +++ b/tests/script/tsim/parser/interp_test.sim @@ -23,60 +23,12 @@ sql use $db print ====== select interp from table $tb = $tbPrefix . 0 ## interp(*) from tb -sql select interp(*) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi +sql_error select interp(*) from $tb where ts = $ts0 ## interp + limit offset -sql select interp(*) from $tb where ts = $ts0 limit 5 offset 1 -if $rows != 0 then - return -1 -endi +sql_error select interp(*) from $tb where ts = $ts0 limit 5 offset 1 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 ## intp + aggregation functions $t = $ts0 + $delta @@ -91,2405 +43,182 @@ sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5) ### interp from tb + fill $t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t ## fill(none) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) + +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) ## fill(NULL) $t = $tsu - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc -if $rows != 1 then - return -1 -endi -if $data00 != @18-11-25 19:29:59.000@ then - return -1 -endi -if $data01 != NULL then - print expect NULL, actual $data01 - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != NULL then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data06 != NULL then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc $t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) ## fill(prev) $t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(prev) $t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) $t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - print expect 0.00000, actual:$data03 - return -1 -endi -# if $data04 != NULL then -# return -1 -# endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(prev) $t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) ## fill(linear) $t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -print $data03 -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) + # columns contain NULL values $t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(linear) print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -# columns contain NULL values +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) $t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) $t = $tsu + 1000 print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) ## fill(value) $t = $ts0 + 1000 print 91 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(value, -1, -2, -3) # table has NULL columns -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3) $t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) $t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi +sql_error select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) ### select interp from stable ## interp(*) from stb print select interp(*) from $stb where ts = $ts0 -sql select interp(*) from $stb where ts = $ts0 -if $rows != 1 then - return -1 -endi -$t = $ts0 + 1000 -print 92 +sql_error select interp(*) from $stb where ts = $ts0 + +sql_error select interp(*) from $stb where ts = $t -sql select interp(*) from $stb where ts = $t -if $rows != 0 then - return -1 -endi ## interp(*) from stb + group by -sql select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc +sql_error select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc print ====== select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data08 != intp_tb0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data28 != intp_tb2 then - return -1 -endi ## interp(*) from stb + group by + limit offset -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 -if $rows != 0 then - return -1 -endi -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 offset 1 +sql_error select interp(*) from $stb where ts = $ts0 group by tbname limit 0 + +sql_error select interp(*) from $stb where ts = $ts0 group by tbname limit 0 offset 1 ## interp(*) from stb + group by + fill(none) $t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(none) group by tbname -if $rows != 0 then - return -1 -endi +sql_error select interp(*) from $stb where ts = $t fill(none) group by tbname -sql select interp(*) from $stb where ts = $ts0 fill(none) group by tbname -if $rows != 4 then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi +sql_error select interp(*) from $stb where ts = $ts0 fill(none) group by tbname ## interp(*) from stb + group by + fill(none) $t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data12 != NULL then - return -1 -endi -if $data23 != NULL then - return -1 -endi -if $data34 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data16 != NULL then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data38 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi +sql_error select interp(*) from $stb where ts = $t fill(NULL) group by tbname -sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname +sql_error select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname print $rows -if $rows != 4 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi - ## interp(*) from stb + group by + fill(prev) $t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(prev) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00000 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != binary0 then - return -1 -endi -if $data29 != nchar0 then - return -1 -endi +sql_error select interp(*) from $stb where ts = $t fill(prev) group by tbname ## interp(*) from stb + group by + fill(linear) $t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(linear) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00167 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi +sql_error select interp(*) from $stb where ts = $t fill(linear) group by tbname ## interp(*) from stb + group by + fill(value) $t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != -2 then - return -1 -endi -if $data22 != -2 then - return -1 -endi -if $data23 != -2.00000 then - return -1 -endi -if $data24 != -2.000000000 then - return -1 -endi -if $data25 != -2 then - return -1 -endi -if $data26 != -2 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi +sql_error select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname sql_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12'; -sql select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi +sql_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' every(1s) fill(linear); -sql select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m); -if $rows != 1 then - return -1 -endi +sql_error select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m); -if $data00 != @18-11-25 18:30:00.000@ then - return -1 -endi +sql_error select interp(c1,c3,c4,ts) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m) fill(linear) -if $data01 != 3 then - return -1 -endi +sql_error select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear); -sql select interp(c1,c3,c4,ts) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m) fill(linear) -if $rows != 5 then - return -1 -endi +sql_error select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear) order by ts desc; -if $data00 != @18-11-25 17:54:00.000@ then - return -1 -endi +sql_error select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(2m) fill(linear) order by ts; -if $data01 != 0 then - return -1 -endi +sql_error select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts; -if $data02 != 0.00000 then - return -1 -endi +sql_error select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts desc; -if $data03 != 0.000000000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(linear); -if $data04 != @18-11-25 17:54:00.000@ then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(value, 1); -if $data10 != @18-11-25 18:12:00.000@ then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(NULL); -if $data11 != 1 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(prev); -if $data12 != 1.20000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(next); -if $data13 != 1.200000000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(linear); -if $data14 != @18-11-25 18:12:00.000@ then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(next); -if $data40 != @18-11-25 19:06:00.000@ then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(linear); -if $data41 != 6 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(prev); -if $data42 != 6.60000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(next); -if $data43 != 6.600000000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(linear); -if $data44 != @18-11-25 19:06:00.000@ then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(prev); +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(next); -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear); -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data51 != 0 then - return -1 -endi -if $data60 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(linear); +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(prev); -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear) order by ts desc; -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi -if $data60 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(next); -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(2m) fill(linear) order by ts; -if $rows != 9 then - return -1 -endi -if $data00 != @18-09-17 20:34:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data31 != 0.00000 then - return -1 -endi -if $data40 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data41 != 0.20000 then - return -1 -endi -if $data50 != @18-09-17 20:44:00.000@ then - return -1 -endi -if $data51 != 0.40000 then - return -1 -endi -if $data60 != @18-09-17 20:46:00.000@ then - return -1 -endi -if $data61 != 0.60000 then - return -1 -endi -if $data70 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data71 != 0.80000 then - return -1 -endi -if $data80 != @18-09-17 20:50:00.000@ then - return -1 -endi -if $data81 != 1.00000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(value, 1); +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(null); -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data31 != 0.20000 then - return -1 -endi -if $data40 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data41 != 0.50000 then - return -1 -endi -if $data50 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data51 != 0.80000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(linear); -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts desc; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data01 != 0.80000 then - return -1 -endi -if $data10 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data11 != 0.50000 then - return -1 -endi -if $data20 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data21 != 0.20000 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(prev); +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(next); +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(linear); -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(linear); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(prev); -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(value, 1); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 1.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 1.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 1.00000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(next); -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(NULL); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(prev); -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(prev); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(next); -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(next); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(prev); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(next); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(linear); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(prev); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(next); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(linear); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(prev); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(next); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(linear); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(prev); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(next); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(value, 1); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(null); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(linear); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(prev); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(next); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(linear); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(prev); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(next); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(linear); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(prev); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(next); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' every(1s); -if $rows != 1 then - return -1 -endi -if $data00 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data01 != 20.00000 then - return -1 -endi +sql_error select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' every(1s); From bd9f5338db1fb4abc64d09c489ed149e713adedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chappyguoxy=E2=80=9D?= <“happy_guoxy@163.com”> Date: Tue, 15 Nov 2022 16:55:54 +0800 Subject: [PATCH 054/116] test: refine query cases --- tests/script/tsim/parser/limit2_query.sim | 118 ++++++---------------- 1 file changed, 31 insertions(+), 87 deletions(-) diff --git a/tests/script/tsim/parser/limit2_query.sim b/tests/script/tsim/parser/limit2_query.sim index fc69035935..3c5002d591 100644 --- a/tests/script/tsim/parser/limit2_query.sim +++ b/tests/script/tsim/parser/limit2_query.sim @@ -80,7 +80,7 @@ endi sql_error select count(*) from $stb where t1 like 1 ##### aggregation on tb + where + fill + limit offset -sql select _wstart, max(c1) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) limit 10 offset 1 +sql select _wstart, max(c1) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1) limit 10 offset 1 if $rows != 10 then return -1 endi @@ -101,32 +101,26 @@ if $data91 != 5 then endi $tb5 = $tbPrefix . 5 -sql select max(c1), min(c2) from $tb5 where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4) limit 10 offset 1 +sql select max(c1), min(c2) from $tb5 where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) limit 10 offset 1 if $rows != 10 then return -1 endi -if $data00 != @18-09-17 09:05:00.000@ then +if $data00 != -1 then return -1 endi -if $data01 != -1 then +if $data01 != -2 then return -1 endi -if $data02 != -2 then +if $data10 != 1 then return -1 endi -if $data11 != 1 then +if $data11 != -2 then return -1 endi -if $data12 != -2 then +if $data90 != 5 then return -1 endi -if $data90 != @18-09-17 09:50:00.000@ then - return -1 -endi -if $data91 != 5 then - return -1 -endi -if $data92 != -2 then +if $data91 != -2 then return -1 endi @@ -135,7 +129,7 @@ endi $tb = $tbPrefix . 0 $limit = $rowNum $offset = $limit / 2 -sql select max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) limit $limit offset $offset +sql select max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2 ,-3, -4 , -5, -6 ,-7 ,'-8', '-9') limit $limit offset $offset if $rows != $limit then print expect $limit, actual $rows return -1 @@ -143,11 +137,8 @@ endi if $data01 != 0 then return -1 endi -if $data11 != -1 then - return -1 -endi -sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000, -2) limit 8200 +sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 8200 if $rows != 8200 then return -1 endi @@ -155,88 +146,56 @@ endi sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 100000; -sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000, -2) limit 10 offset 8190; +sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 10 offset 8190; if $rows != 10 then return -1 endi -if $data00 != @18-10-15 19:30:00.000@ then +if $data00 != 5 then return -1 endi -if $data01 != 5 then +if $data10 != -1000 then return -1 endi -if $data10 != @18-10-15 19:35:00.000@ then +if $data20 != 6 then return -1 endi -if $data11 != -1000 then +if $data30 != -1000 then return -1 endi -if $data20 != @18-10-15 19:40:00.000@ then - return -1 -endi - -if $data21 != 6 then - return -1 -endi - -if $data30 != @18-10-15 19:45:00.000@ then - return -1 -endi - -if $data31 != -1000 then - return -1 -endi - -sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000, -2) limit 10 offset 10001; +sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 10 offset 10001; if $rows != 10 then return -1 endi -if $data00 != @18-10-22 02:25:00.000@ then +if $data00 != -1000 then return -1 endi -if $data01 != -1000 then +if $data10 != 1 then return -1 endi -if $data10 != @18-10-22 02:30:00.000@ then +if $data20 != -1000 then return -1 endi -if $data11 != 1 then +if $data30 != 2 then return -1 endi -if $data20 != @18-10-22 02:35:00.000@ then - return -1 -endi - -if $data21 != -1000 then - return -1 -endi - -if $data30 != @18-10-22 02:40:00.000@ then - return -1 -endi - -if $data31 != 2 then - return -1 -endi - -sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000, -2) limit 10000 offset 10001; +sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 10000 offset 10001; print ====> needs to validate the last row result if $rows != 9998 then return -1 endi -sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000, -2) limit 100 offset 20001; +sql select max(c1) from lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1000) limit 100 offset 20001; if $rows != 0 then return -1 endi @@ -244,7 +203,7 @@ endi # tb + interval + fill(linear) + limit offset $limit = $rowNum $offset = $limit / 2 -sql select max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(linear) limit $limit offset $offset +sql select _wstart,max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(linear) limit $limit offset $offset if $rows != $limit then print expect $limit, actual $rows return -1 @@ -290,7 +249,7 @@ endi $limit = $rowNum $offset = $limit / 2 $offset = $offset + 10 -sql select max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 = 5 interval(5m) fill(value, -1, -2) limit $limit offset $offset +sql select _wstart,max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 = 5 interval(5m) fill(value, -1, -2 ,-3, -4 , -5, -6 ,-7 ,'-8', '-9') limit $limit offset $offset if $rows != $limit then return -1 endi @@ -324,20 +283,11 @@ endi if $data19 != NULL then return -1 endi -if $data16 != -2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data11 != -1 then - return -1 -endi $limit = $rowNum $offset = $limit * 2 $offset = $offset - 11 -sql select max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 = 5 interval(5m) fill(value, -1, -2) limit $limit offset $offset +sql select _wstart,max(c1), min(c2), sum(c3), avg(c4), stddev(c5), spread(c6), first(c7), last(c8), first(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 = 5 interval(5m) fill(value, -1, -2 ,-3, -4 , -5, -6 ,-7 ,'-8', '-9') limit $limit offset $offset if $rows != 10 then return -1 endi @@ -368,27 +318,21 @@ endi if $data19 != nchar5 then return -1 endi -if $data27 != 1 then - return -1 -endi -if $data38 != NULL then - return -1 -endi -if $data49 != NULL then - return -1 -endi ### [TBASE-350] ## stb + interval + fill + group by + limit offset -sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) group by t1 limit 2 offset 10 -if $rows != 20 then +sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') limit 2 offset 10 +if $rows != 2 then return -1 endi +#add one more test case +sql select max(c1), last(c8) from lm2_db0.lm2_tb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(linear) limit 10 offset 4089;" + $limit = 5 $offset = $rowNum * 2 $offset = $offset - 2 -sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) group by t1 order by t1 limit $limit offset $offset +sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4 ,-7 ,'-8', '-9') order by t1 limit $limit offset $offset if $rows != $tbNum then return -1 endi From 5434f996e80ad369508482a50408e2e87a97fce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chappyguoxy=E2=80=9D?= <“happy_guoxy@163.com”> Date: Tue, 15 Nov 2022 16:56:15 +0800 Subject: [PATCH 055/116] test: refine query cases --- tests/script/tsim/parser/fill_stb.sim | 66 +++++++++------------------ 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/tests/script/tsim/parser/fill_stb.sim b/tests/script/tsim/parser/fill_stb.sim index 6c61631aa8..66787b3606 100644 --- a/tests/script/tsim/parser/fill_stb.sim +++ b/tests/script/tsim/parser/fill_stb.sim @@ -97,8 +97,8 @@ $tsu = $tsu + $ts0 #endi # number of fill values exceeds number of selected columns -print select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) -sql select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) +print select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6) +sql select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6) $val = $rowNum * 2 $val = $val - 1 print $rows $val @@ -136,8 +136,8 @@ if $data74 != -4.00000 then endi ## fill(value) + group by -print select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) -sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) +print select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4, -5) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(value, -1, -2, -3, -4, -5) $val = $rowNum * 2 print $rowNum, $val @@ -154,8 +154,8 @@ if $data11 != -1 then endi # number of fill values is smaller than number of selected columns -print select _wstart, max(c1), max(c2), max(c3) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) -sql select _wstart, max(c1), max(c2), max(c3) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) +print select _wstart, max(c1), max(c2), max(c3) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6) if $data11 != 6 then return -1 endi @@ -170,7 +170,7 @@ endi sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) # fill_char_values_to_arithmetic_fields -sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') +sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') # fill_multiple_columns sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc) @@ -199,7 +199,7 @@ sql select max(c4) from $stb where t1 > 4 and ts >= $ts0 and ts <= $tsu partitio # return -1 #endi -sql select _wstart, min(c1), max(c4) from $stb where t1 > 4 and ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1) +sql select _wstart, min(c1), max(c4) from $stb where t1 > 4 and ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1) $val = $rowNum * 2 $val = $val - 1 if $rows != $val then @@ -222,52 +222,30 @@ if $data12 != -1.000000000 then endi # fill_into_nonarithmetic_fieds -print select _wstart, first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) -sql select _wstart, first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) +print select _wstart, first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '20000000', '20000000', '20000000') +sql select _wstart, first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '20000000', '20000000', '20000000') #if $data11 != 20000000 then #if $data11 != 1 then # return -1 #endi -sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1) -sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1) -sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1) +sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1', '1', '1') +sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1.1', '1.1', '1.1') +sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1', '1e1', '1e1') sql select first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1') # fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24 # fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24 sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') -sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true) +sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true', 'true') sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true') # fill nonarithmetic values into arithmetic fields -sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc); -sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); +sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'abc'); +sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); -sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1'); -$val = $rowNum * 2 -$val = $val - 1 -if $rows != $val then - return -1 -endi -if $data01 != $rowNum then - return -1 -endi -#if $data11 != 20 then -# return -1 -#endi +sql_error select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1'); -sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 2e1); -if $rows != $val then - return -1 -endi -if $data01 != $rowNum then - return -1 -endi -if $data11 != 20 then - return -1 -endi - -sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '20'); +sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20); if $rows != $val then return -1 endi @@ -377,23 +355,23 @@ endi ## NULL fill print fill(NULL) print select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL) limit 5 -sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL) limit 5 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(NULL) limit 5 if $rows != 25 then return -1 endi if $data01 != 0 then return -1 endi -if $data02 != 0 then +if $data02 != NULL then return -1 endi if $data06 != 1 then return -1 endi -if $data11 != 0 then +if $data11 != NULL then return -1 endi -if $data12 != 0 then +if $data12 != NULL then return -1 endi if $data18 != NULL then From 1963761cc26fb2a9f024418672d1818612eec373 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 15 Nov 2022 17:27:22 +0800 Subject: [PATCH 056/116] fix: asan error --- source/libs/parser/src/parTranslater.c | 1 + source/libs/planner/src/planOptimizer.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 8de130bbb5..9883c81819 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5679,6 +5679,7 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_CREATE_FUNC, (FSerializeFunc)tSerializeSCreateFuncReq, &req); } + tFreeSCreateFuncReq(&req); return code; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 79f33f3ac3..40b70d7d3e 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -833,6 +833,7 @@ static int32_t partitionAggCondConj(SAggLogicNode* pAgg, SNode** ppAggFuncCond, nodesDestroyNode(pTempAggFuncCond); nodesDestroyNode(pTempGroupKeyCond); } + nodesDestroyNode(pAgg->node.pConditions); pAgg->node.pConditions = NULL; return code; } @@ -853,8 +854,7 @@ static int32_t partitionAggCond(SAggLogicNode* pAgg, SNode** ppAggFunCond, SNode } static int32_t pushCondToAggCond(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode** pAggFuncCond) { - pushDownCondOptAppendCond(&pAgg->node.pConditions, pAggFuncCond); - return TSDB_CODE_SUCCESS; + return pushDownCondOptAppendCond(&pAgg->node.pConditions, pAggFuncCond); } typedef struct SRewriteAggGroupKeyCondContext { From 55a84dab92f833a7716abba68d3c90a4748f93ab Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 18:15:27 +0800 Subject: [PATCH 057/116] test: add asan case --- tests/parallel_test/cases.task | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 9b1d829c9a..abf5d76733 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -12,7 +12,7 @@ ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim ,,,script,./test.sh -f tsim/db/alter_replica_13.sim -,,,script,./test.sh -f tsim/db/alter_replica_31.sim +,,y,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim ,,y,script,./test.sh -f tsim/db/basic3.sim @@ -149,27 +149,27 @@ ,,y,script,./test.sh -f tsim/parser/selectResNum.sim ,,y,script,./test.sh -f tsim/parser/set_tag_vals.sim ,,y,script,./test.sh -f tsim/parser/single_row_in_tb.sim -,,,script,./test.sh -f tsim/parser/sliding.sim +,,y,script,./test.sh -f tsim/parser/sliding.sim ,,y,script,./test.sh -f tsim/parser/slimit_alter_tags.sim ,,y,script,./test.sh -f tsim/parser/slimit.sim ,,y,script,./test.sh -f tsim/parser/slimit1.sim ,,y,script,./test.sh -f tsim/parser/stableOp.sim ,,y,script,./test.sh -f tsim/parser/tags_dynamically_specifiy.sim -,,,script,./test.sh -f tsim/parser/tags_filter.sim -,,,script,./test.sh -f tsim/parser/tbnameIn.sim +,,y,script,./test.sh -f tsim/parser/tags_filter.sim +,,y,script,./test.sh -f tsim/parser/tbnameIn.sim ,,y,script,./test.sh -f tsim/parser/timestamp.sim ,,y,script,./test.sh -f tsim/parser/top_groupby.sim ,,y,script,./test.sh -f tsim/parser/topbot.sim ,,,script,./test.sh -f tsim/parser/union.sim ,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim -,,,script,./test.sh -f tsim/parser/where.sim +,,y,script,./test.sh -f tsim/parser/where.sim ,,y,script,./test.sh -f tsim/query/charScalarFunction.sim ,,y,script,./test.sh -f tsim/query/explain.sim ,,y,script,./test.sh -f tsim/query/interval-offset.sim ,,y,script,./test.sh -f tsim/query/interval.sim ,,y,script,./test.sh -f tsim/query/scalarFunction.sim ,,y,script,./test.sh -f tsim/query/scalarNull.sim -,,,script,./test.sh -f tsim/query/session.sim +,,y,script,./test.sh -f tsim/query/session.sim ,,,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim @@ -215,17 +215,17 @@ ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim -,,,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim +,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim ,,,script,./test.sh -f tsim/stream/distributeSession0.sim ,,,script,./test.sh -f tsim/stream/session0.sim -,,,script,./test.sh -f tsim/stream/session1.sim +,,y,script,./test.sh -f tsim/stream/session1.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim -,,,script,./test.sh -f tsim/stream/triggerSession0.sim +,,y,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/partitionby.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/schedSnode.sim -,,,script,./test.sh -f tsim/stream/windowClose.sim +,,y,script,./test.sh -f tsim/stream/windowClose.sim ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim @@ -251,7 +251,7 @@ ,,y,script,./test.sh -f tsim/tmq/basic3Of2Cons.sim ,,y,script,./test.sh -f tsim/tmq/basic4Of2Cons.sim ,,y,script,./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim -,,,script,./test.sh -f tsim/tmq/topic.sim +,,y,script,./test.sh -f tsim/tmq/topic.sim ,,y,script,./test.sh -f tsim/tmq/snapshot.sim ,,y,script,./test.sh -f tsim/tmq/snapshot1.sim ,,y,script,./test.sh -f tsim/stable/alter_comment.sim @@ -278,7 +278,7 @@ ,,,script,./test.sh -f tsim/sma/drop_sma.sim ,,,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim ,,y,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim -,,,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim +,,y,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim ,,n,script,./test.sh -f tsim/valgrind/checkError1.sim ,,n,script,./test.sh -f tsim/valgrind/checkError2.sim ,,n,script,./test.sh -f tsim/valgrind/checkError3.sim @@ -297,8 +297,8 @@ ,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim -,,,script,./test.sh -f tsim/vnode/stable_replica3_dnode6.sim -,,,script,./test.sh -f tsim/vnode/stable_replica3_vnode3.sim +,,y,script,./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +,,y,script,./test.sh -f tsim/vnode/stable_replica3_vnode3.sim ,,y,script,./test.sh -f tsim/sync/3Replica1VgElect.sim ,,y,script,./test.sh -f tsim/sync/3Replica5VgElect.sim ,,y,script,./test.sh -f tsim/sync/oneReplica1VgElect.sim From d696745e00495f54d9c647603be1c0bdcecd8467 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 15 Nov 2022 18:42:10 +0800 Subject: [PATCH 058/116] fix stack-buffer-overflow in timewindowoperator.c --- source/libs/executor/src/timewindowoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 40742087ea..6357af1d06 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -4290,7 +4290,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { // gap must be 0 - SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo)); + SArray* pWins = taosArrayInit(16, sizeof(SSessionKey)); doDeleteTimeWindows(&pInfo->streamAggSup, pBlock, pWins); removeSessionResults(pStUpdated, pWins); copyDeleteWindowInfo(pWins, pInfo->pStDeleted); From bf7ad8e85e04f0283431afcf47c5df287e003166 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 15 Nov 2022 18:51:55 +0800 Subject: [PATCH 059/116] fix(query): fix signed integer overflow in builtinsimpl.c TD-20403 --- source/libs/function/src/builtinsimpl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index d02d30dc60..22c61923eb 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2132,6 +2132,11 @@ int32_t stddevFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t type = pStddevRes->type; double avg; + if (pStddevRes->count == 0) { + GET_RES_INFO(pCtx)->numOfRes = 0; + return functionFinalize(pCtx, pBlock); + } + if (IS_SIGNED_NUMERIC_TYPE(type)) { avg = pStddevRes->isum / ((double)pStddevRes->count); pStddevRes->result = sqrt(fabs(pStddevRes->quadraticISum / ((double)pStddevRes->count) - avg * avg)); @@ -5651,6 +5656,10 @@ bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { } static double twa_get_area(SPoint1 s, SPoint1 e) { + if (e.key == INT64_MAX || s.key == INT64_MIN) { + return 0; + } + if ((s.val >= 0 && e.val >= 0) || (s.val <= 0 && e.val <= 0)) { return (s.val + e.val) * (e.key - s.key) / 2; } @@ -5945,6 +5954,8 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } else { if (pInfo->win.ekey == pInfo->win.skey) { pInfo->dOutput = pInfo->p.val; + } else if (pInfo->win.ekey == INT64_MAX || pInfo->win.skey == INT64_MIN) { //no data in timewindow + pInfo->dOutput = 0; } else { pInfo->dOutput = pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey); } From a9bf05bc018d338103c01874dc41b64fdd4ac054 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 18:32:08 +0800 Subject: [PATCH 060/116] refactor: stream meta ref count --- include/libs/stream/tstream.h | 7 +++- source/dnode/mnode/impl/src/mndStream.c | 1 + source/dnode/snode/src/snode.c | 23 ++++++++---- source/dnode/vnode/src/tq/tq.c | 48 ++++++++++++++++++------- source/libs/executor/src/scanoperator.c | 2 ++ source/libs/stream/src/streamMeta.c | 41 +++++++++++++++++++++ source/libs/wal/src/walRef.c | 4 +-- 7 files changed, 103 insertions(+), 23 deletions(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 0354078b7b..ecd1b6f916 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -338,7 +338,7 @@ typedef struct SStreamTask { int32_t recoverWaitingUpstream; int64_t checkReqId; SArray* checkReqIds; // shuffle - + int32_t refCnt; } SStreamTask; int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo); @@ -565,6 +565,7 @@ typedef struct SStreamMeta { TXN txn; FTaskExpand* expandFunc; int32_t vgId; + SRWLatch lock; } SStreamMeta; SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId); @@ -575,6 +576,10 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, c int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId); SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId); +SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId); +void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask); +void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId); + int32_t streamMetaBegin(SStreamMeta* pMeta); int32_t streamMetaCommit(SStreamMeta* pMeta); int32_t streamMetaRollBack(SStreamMeta* pMeta); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index c649180285..2cfb81a817 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -738,6 +738,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { } sdbRelease(pMnode->pSdb, pStream); + mndTransDrop(pTrans); return TSDB_CODE_ACTION_IN_PROGRESS; } diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index f53350c10b..aa55204ae5 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -36,13 +36,14 @@ void sndEnqueueStreamDispatch(SSnode *pSnode, SRpcMsg *pMsg) { int32_t taskId = req.taskId; - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessDispatchReq(pTask, &req, &rsp, false); + streamMetaReleaseTask(pSnode->pMeta, pTask); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); return; @@ -63,6 +64,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) { ASSERT(pTask->taskLevel == TASK_LEVEL__AGG); ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); + pTask->refCnt = 1; pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE; pTask->inputQueue = streamQueueOpen(); pTask->outputQueue = streamQueueOpen(); @@ -166,15 +168,17 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) { int32_t sndProcessTaskDropReq(SSnode *pSnode, char *msg, int32_t msgLen) { SVDropStreamTaskReq *pReq = (SVDropStreamTaskReq *)msg; - return streamMetaRemoveTask(pSnode->pMeta, pReq->taskId); + streamMetaRemoveTask1(pSnode->pMeta, pReq->taskId); + return 0; } int32_t sndProcessTaskRunReq(SSnode *pSnode, SRpcMsg *pMsg) { SStreamTaskRunReq *pReq = pMsg->pCont; int32_t taskId = pReq->taskId; - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, taskId); if (pTask) { streamProcessRunReq(pTask); + streamMetaReleaseTask(pSnode->pMeta, pTask); return 0; } else { return -1; @@ -191,13 +195,14 @@ int32_t sndProcessTaskDispatchReq(SSnode *pSnode, SRpcMsg *pMsg, bool exec) { tDecodeStreamDispatchReq(&decoder, &req); int32_t taskId = req.taskId; - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessDispatchReq(pTask, &req, &rsp, exec); + streamMetaReleaseTask(pSnode->pMeta, pTask); return 0; } else { return -1; @@ -215,13 +220,14 @@ int32_t sndProcessTaskRetrieveReq(SSnode *pSnode, SRpcMsg *pMsg) { tDecodeStreamRetrieveReq(&decoder, &req); tDecoderClear(&decoder); int32_t taskId = req.dstTaskId; - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessRetrieveReq(pTask, &req, &rsp); + streamMetaReleaseTask(pSnode->pMeta, pTask); tDeleteStreamRetrieveReq(&req); return 0; } else { @@ -232,9 +238,10 @@ int32_t sndProcessTaskRetrieveReq(SSnode *pSnode, SRpcMsg *pMsg) { int32_t sndProcessTaskDispatchRsp(SSnode *pSnode, SRpcMsg *pMsg) { SStreamDispatchRsp *pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); int32_t taskId = ntohl(pRsp->upstreamTaskId); - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, taskId); if (pTask) { streamProcessDispatchRsp(pTask, pRsp, pMsg->code); + streamMetaReleaseTask(pSnode->pMeta, pTask); return 0; } else { return -1; @@ -274,15 +281,17 @@ int32_t sndProcessTaskRecoverFinishReq(SSnode *pSnode, SRpcMsg *pMsg) { tDecoderClear(&decoder); // find task - SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, req.taskId); + SStreamTask *pTask = streamMetaAcquireTask(pSnode->pMeta, req.taskId); if (pTask == NULL) { return -1; } // do process request if (streamProcessRecoverFinishReq(pTask, req.childId) < 0) { + streamMetaReleaseTask(pSnode->pMeta, pTask); return -1; } + streamMetaReleaseTask(pSnode->pMeta, pTask); return 0; } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 1cc771dbb4..419d4c3b9b 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -882,6 +882,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); } + pTask->refCnt = 1; pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE; pTask->inputQueue = streamQueueOpen(); @@ -975,13 +976,15 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { .upstreamNodeId = req.upstreamNodeId, .upstreamTaskId = req.upstreamTaskId, }; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); if (pTask && atomic_load_8(&pTask->taskStatus) == TASK_STATUS__NORMAL) { rsp.status = 1; } else { rsp.status = 0; } + streamMetaReleaseTask(pTq->pStreamMeta, pTask); + tqDebug("tq recv task check req(reqId: %" PRId64 ") %d at node %d check req from task %d at node %d, status %d", rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); @@ -1027,12 +1030,14 @@ int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t version, char* msg, int32_ tqDebug("tq recv task check rsp(reqId: %" PRId64 ") %d at node %d check req from task %d at node %d, status %d", rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, rsp.upstreamTaskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, rsp.upstreamTaskId); if (pTask == NULL) { return -1; } - return streamProcessTaskCheckRsp(pTask, &rsp, version); + code = streamProcessTaskCheckRsp(pTask, &rsp, version); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); + return code; } int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) { @@ -1077,15 +1082,17 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { int32_t msgLen = pMsg->contLen; SStreamRecoverStep1Req* pReq = (SStreamRecoverStep1Req*)msg; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, pReq->taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, pReq->taskId); if (pTask == NULL) { return -1; } + ASSERT(pReq->taskId == pTask->taskId); // check param int64_t fillVer1 = pTask->startVer; if (fillVer1 <= 0) { ASSERT(0); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } @@ -1096,10 +1103,11 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { SStreamRecoverStep2Req req; code = streamBuildSourceRecover2Req(pTask, &req); if (code < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } - ASSERT(pReq->taskId == pTask->taskId); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); // serialize msg int32_t len = sizeof(SStreamRecoverStep1Req); @@ -1127,7 +1135,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t msgLen) { int32_t code; SStreamRecoverStep2Req* pReq = (SStreamRecoverStep2Req*)msg; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, pReq->taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, pReq->taskId); if (pTask == NULL) { return -1; } @@ -1135,27 +1143,33 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t m // do recovery step 2 code = streamSourceRecoverScanStep2(pTask, version); if (code < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } // restore param code = streamRestoreParam(pTask); if (code < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } // set status normal code = streamSetStatusNormal(pTask); if (code < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } // dispatch recover finish req to all related downstream task code = streamDispatchRecoverFinishReq(pTask); if (code < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } + streamMetaReleaseTask(pTq->pStreamMeta, pTask); + return 0; } @@ -1172,15 +1186,17 @@ int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, SRpcMsg* pMsg) { tDecoderClear(&decoder); // find task - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, req.taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, req.taskId); if (pTask == NULL) { return -1; } // do process request if (streamProcessRecoverFinishReq(pTask, req.childId) < 0) { + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return 0; } @@ -1354,9 +1370,10 @@ int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* pReq, int64_t ver) { int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) { SStreamTaskRunReq* pReq = pMsg->pCont; int32_t taskId = pReq->taskId; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); if (pTask) { streamProcessRunReq(pTask); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return 0; } else { return -1; @@ -1373,13 +1390,14 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) { tDecodeStreamDispatchReq(&decoder, &req); int32_t taskId = req.taskId; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessDispatchReq(pTask, &req, &rsp, exec); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return 0; } else { return -1; @@ -1389,10 +1407,11 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) { int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) { SStreamDispatchRsp* pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); int32_t taskId = ntohl(pRsp->upstreamTaskId); - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); tqDebug("recv dispatch rsp, code: %x", pMsg->code); if (pTask) { streamProcessDispatchRsp(pTask, pRsp, pMsg->code); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); return 0; } else { return -1; @@ -1401,7 +1420,8 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) { int32_t tqProcessTaskDropReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) { SVDropStreamTaskReq* pReq = (SVDropStreamTaskReq*)msg; - return streamMetaRemoveTask(pTq->pStreamMeta, pReq->taskId); + streamMetaRemoveTask1(pTq->pStreamMeta, pReq->taskId); + return 0; } int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) { @@ -1414,13 +1434,14 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) { tDecodeStreamRetrieveReq(&decoder, &req); tDecoderClear(&decoder); int32_t taskId = req.dstTaskId; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessRetrieveReq(pTask, &req, &rsp); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); tDeleteStreamRetrieveReq(&req); return 0; } else { @@ -1452,13 +1473,14 @@ int32_t vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) { int32_t taskId = req.taskId; - SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); + SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId); if (pTask) { SRpcMsg rsp = { .info = pMsg->info, .code = 0, }; streamProcessDispatchReq(pTask, &req, &rsp, false); + streamMetaReleaseTask(pTq->pStreamMeta, pTask); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); return 0; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index d2e59ea8e1..77d2aeba28 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2385,6 +2385,8 @@ static void destroyStreamScanOperatorInfo(void* param) { taosMemoryFree(pStreamScan->pPseudoExpr); } + cleanupExprSupp(&pStreamScan->tbnameCalSup); + updateInfoDestroy(pStreamScan->pUpdateInfo); blockDataDestroy(pStreamScan->pRes); blockDataDestroy(pStreamScan->pUpdateRes); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index da082b7f74..5ec8828c05 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -169,6 +169,47 @@ SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId) { } } +SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId) { + taosRLockLatch(&pMeta->lock); + + SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t)); + if (ppTask) { + SStreamTask* pTask = *ppTask; + if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__DROPPING) { + atomic_add_fetch_32(&pTask->refCnt, 1); + taosRUnLockLatch(&pMeta->lock); + return pTask; + } else { + taosRUnLockLatch(&pMeta->lock); + return NULL; + } + } + taosRUnLockLatch(&pMeta->lock); + return NULL; +} + +void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask) { + int32_t left = atomic_sub_fetch_32(&pTask->refCnt, 1); + ASSERT(left >= 0); + if (left == 0) { + ASSERT(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING); + tFreeSStreamTask(pTask); + } +} + +void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId) { + SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t)); + if (ppTask) { + SStreamTask* pTask = *ppTask; + taosHashRemove(pMeta->pTasks, &taskId, sizeof(int32_t)); + atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING); + + taosWLockLatch(&pMeta->lock); + streamMetaReleaseTask(pMeta, pTask); + taosWUnLockLatch(&pMeta->lock); + } +} + int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) { SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t)); if (ppTask) { diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c index f9994fd315..eae5d9f1a7 100644 --- a/source/libs/wal/src/walRef.c +++ b/source/libs/wal/src/walRef.c @@ -32,7 +32,7 @@ SWalRef *walOpenRef(SWal *pWal) { return pRef; } -#if 0 +#if 1 void walCloseRef(SWal *pWal, int64_t refId) { SWalRef **ppRef = taosHashGet(pWal->pRefHash, &refId, sizeof(int64_t)); if (ppRef == NULL) return; @@ -67,7 +67,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) { return 0; } -#if 0 +#if 1 void walUnrefVer(SWalRef *pRef) { pRef->refId = -1; pRef->refFile = -1; From c5aa7e072dd8780c9d8d34d08fac44dc1a1944b3 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 15 Nov 2022 19:17:28 +0800 Subject: [PATCH 061/116] refactor(sync): optimize, make LRU Cache hit more --- source/libs/sync/inc/syncInt.h | 1 + source/libs/sync/src/syncAppendEntries.c | 100 ++++++++++++++++++++--- source/libs/sync/src/syncCommit.c | 5 ++ source/libs/sync/src/syncMain.c | 81 ++++++++++++------ source/libs/sync/src/syncRaftEntry.c | 2 + source/libs/sync/src/syncRaftLog.c | 14 +++- source/libs/sync/src/syncReplication.c | 21 ++++- source/libs/sync/src/syncUtil.c | 36 ++++---- 8 files changed, 206 insertions(+), 54 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index e81f63d871..0e0042d526 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -225,6 +225,7 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode); int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg); int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg); SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode); +int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHandle** h); // raft state change -------------- void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term); diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index 4551702b34..df2ccee546 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -192,13 +192,34 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SSyncRaftEntry* pAppendEntry = syncEntryBuildFromAppendEntries(pMsg); ASSERT(pAppendEntry != NULL); - SyncIndex appendIndex = pMsg->prevLogIndex + 1; + SyncIndex appendIndex = pMsg->prevLogIndex + 1; + + LRUHandle* hLocal = NULL; + LRUHandle* hAppend = NULL; + + int32_t code = 0; SSyncRaftEntry* pLocalEntry = NULL; - int32_t code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, appendIndex, &pLocalEntry); + SLRUCache* pCache = ths->pLogStore->pCache; + hLocal = taosLRUCacheLookup(pCache, &appendIndex, sizeof(appendIndex)); + if (hLocal) { + pLocalEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, hLocal); + code = 0; + + sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", appendIndex, pLocalEntry->bytes, pLocalEntry); + + } else { + sNTrace(ths, "miss cache index:%" PRId64, appendIndex); + + code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, appendIndex, &pLocalEntry); + } + if (code == 0) { + // get local entry success + if (pLocalEntry->term == pAppendEntry->term) { // do nothing sNTrace(ths, "log match, do nothing, index:%" PRId64, appendIndex); + } else { // truncate code = ths->pLogStore->syncLogTruncate(ths->pLogStore, appendIndex); @@ -207,8 +228,18 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, truncate error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); - syncEntryDestory(pLocalEntry); - syncEntryDestory(pAppendEntry); + if (hLocal) { + taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false); + } else { + syncEntryDestory(pLocalEntry); + } + + if (hAppend) { + taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false); + } else { + syncEntryDestory(pAppendEntry); + } + goto _IGNORE; } @@ -219,10 +250,22 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, append error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); - syncEntryDestory(pLocalEntry); - syncEntryDestory(pAppendEntry); + if (hLocal) { + taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false); + } else { + syncEntryDestory(pLocalEntry); + } + + if (hAppend) { + taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false); + } else { + syncEntryDestory(pAppendEntry); + } + goto _IGNORE; } + + syncCacheEntry(ths->pLogStore, pAppendEntry, &hAppend); } } else { @@ -248,20 +291,42 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, log not exist, append error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); - syncEntryDestory(pLocalEntry); - syncEntryDestory(pAppendEntry); + if (hLocal) { + taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false); + } else { + syncEntryDestory(pLocalEntry); + } + + if (hAppend) { + taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false); + } else { + syncEntryDestory(pAppendEntry); + } + goto _IGNORE; } + syncCacheEntry(ths->pLogStore, pAppendEntry, &hAppend); + } else { - // error + // get local entry success char logBuf[128]; snprintf(logBuf, sizeof(logBuf), "ignore, get local entry error, append-index:%" PRId64 " err:%d", appendIndex, terrno); syncLogRecvAppendEntries(ths, pMsg, logBuf); - syncEntryDestory(pLocalEntry); - syncEntryDestory(pAppendEntry); + if (hLocal) { + taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false); + } else { + syncEntryDestory(pLocalEntry); + } + + if (hAppend) { + taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false); + } else { + syncEntryDestory(pAppendEntry); + } + goto _IGNORE; } } @@ -269,8 +334,17 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { // update match index pReply->matchIndex = pAppendEntry->index; - syncEntryDestory(pLocalEntry); - syncEntryDestory(pAppendEntry); + if (hLocal) { + taosLRUCacheRelease(ths->pLogStore->pCache, hLocal, false); + } else { + syncEntryDestory(pLocalEntry); + } + + if (hAppend) { + taosLRUCacheRelease(ths->pLogStore->pCache, hAppend, false); + } else { + syncEntryDestory(pAppendEntry); + } } else { // no append entries, do nothing diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index d2320fc6be..60bec6ab65 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -116,7 +116,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index)); if (h) { pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h); + + sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", index, pEntry->bytes, pEntry); + } else { + sNTrace(pSyncNode, "miss cache index:%" PRId64, index); + int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry); if (code != 0) { sNError(pSyncNode, "advance commit index error, read wal index:%" PRId64, index); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index e802f60f30..a59078fff6 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -383,15 +383,33 @@ bool syncIsReadyForRead(int64_t rid) { } else { if (!pSyncNode->pLogStore->syncLogIsEmpty(pSyncNode->pLogStore)) { + SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); SSyncRaftEntry* pEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry( - pSyncNode->pLogStore, pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore), &pEntry); + SLRUCache* pCache = pSyncNode->pLogStore->pCache; + LRUHandle* h = taosLRUCacheLookup(pCache, &lastIndex, sizeof(lastIndex)); + int32_t code = 0; + if (h) { + pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h); + code = 0; + + sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", lastIndex, pEntry->bytes, pEntry); + + } else { + sNTrace(pSyncNode, "miss cache index:%" PRId64, lastIndex); + + code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, lastIndex, &pEntry); + } + if (code == 0 && pEntry != NULL) { if (pEntry->originalRpcType == TDMT_SYNC_NOOP && pEntry->term == pSyncNode->pRaftStore->currentTerm) { ready = true; } - syncEntryDestory(pEntry); + if (h) { + taosLRUCacheRelease(pCache, h, false); + } else { + syncEntryDestory(pEntry); + } } } } @@ -1761,10 +1779,24 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { return 0; } - SyncTerm preTerm = 0; - SyncIndex preIndex = index - 1; + SyncTerm preTerm = 0; + SyncIndex preIndex = index - 1; + SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry); + SLRUCache* pCache = pSyncNode->pLogStore->pCache; + LRUHandle* h = taosLRUCacheLookup(pCache, &preIndex, sizeof(preIndex)); + int32_t code = 0; + if (h) { + pPreEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h); + code = 0; + + sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", preIndex, pPreEntry->bytes, pPreEntry); + + } else { + sNTrace(pSyncNode, "miss cache index:%" PRId64, preIndex); + + code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry); + } SSnapshot snapshot = {.data = NULL, .lastApplyIndex = SYNC_INDEX_INVALID, @@ -1774,7 +1806,13 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { if (code == 0) { ASSERT(pPreEntry != NULL); preTerm = pPreEntry->term; - taosMemoryFree(pPreEntry); + + if (h) { + taosLRUCacheRelease(pCache, h, false); + } else { + syncEntryDestory(pPreEntry); + } + return preTerm; } else { if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { @@ -1820,9 +1858,6 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { } taosTmrReset(syncNodeEqPingTimer, pNode->pingTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pPingTimer); - } else { - sTrace("==syncNodeEqPingTimer== pingTimerLogicClock:%" PRId64 ", pingTimerLogicClockUser:%" PRId64, - pNode->pingTimerLogicClock, pNode->pingTimerLogicClockUser); } } @@ -1856,16 +1891,6 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { } taosMemoryFree(pElectTimer); - -#if 0 - // reset timer ms - if (syncIsInit() && pNode->electBaseLine > 0) { - pNode->electTimerMS = syncUtilElectRandomMS(pNode->electBaseLine, 2 * pNode->electBaseLine); - taosTmrReset(syncNodeEqElectTimer, pNode->electTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pElectTimer); - } else { - sError("sync env is stop, syncNodeEqElectTimer"); - } -#endif } static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { @@ -1979,7 +2004,10 @@ static int32_t syncNodeEqNoop(SSyncNode* pNode) { static void deleteCacheEntry(const void* key, size_t keyLen, void* value) { taosMemoryFree(value); } -static int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHandle** h) { +int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHandle** h) { + SSyncLogStoreData* pData = pLogStore->data; + sNTrace(pData->pSyncNode, "in cache index:%" PRId64 ", bytes:%u, %p", pEntry->index, pEntry->bytes, pEntry); + int32_t code = 0; int32_t entryLen = sizeof(*pEntry) + pEntry->dataLen; LRUStatus status = taosLRUCacheInsert(pLogStore->pCache, &pEntry->index, sizeof(pEntry->index), pEntry, entryLen, @@ -2000,7 +2028,6 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) { ASSERT(pEntry != NULL); LRUHandle* h = NULL; - syncCacheEntry(ths->pLogStore, pEntry, &h); if (ths->state == TAOS_SYNC_STATE_LEADER) { int32_t code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); @@ -2008,6 +2035,8 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) { sError("append noop error"); return -1; } + + syncCacheEntry(ths->pLogStore, pEntry, &h); } if (h) { @@ -2143,7 +2172,6 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn } LRUHandle* h = NULL; - syncCacheEntry(ths->pLogStore, pEntry, &h); if (ths->state == TAOS_SYNC_STATE_LEADER) { // append entry @@ -2183,6 +2211,8 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn } } + syncCacheEntry(ths->pLogStore, pEntry, &h); + // if mulit replica, start replicate right now if (ths->replicaNum > 1) { syncNodeReplicate(ths); @@ -2349,7 +2379,12 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde LRUHandle* h = taosLRUCacheLookup(pCache, &i, sizeof(i)); if (h) { pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h); + + sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", i, pEntry->bytes, pEntry); + } else { + sNTrace(ths, "miss cache index:%" PRId64, i); + code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry); // ASSERT(code == 0); // ASSERT(pEntry != NULL); diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 540054e473..a759409163 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -92,6 +92,8 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) void syncEntryDestory(SSyncRaftEntry* pEntry) { if (pEntry != NULL) { taosMemoryFree(pEntry); + + sTrace("free entry: %p", pEntry); } } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index b00ba3918c..2b1cee51d7 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -37,7 +37,8 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { return NULL; } - pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5); + // pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5); + pLogStore->pCache = taosLRUCacheInit(100 * 1024 * 1024, 1, .5); if (pLogStore->pCache == NULL) { taosMemoryFree(pLogStore); terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; @@ -321,6 +322,17 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn return 0; } + // delete from cache + for (SyncIndex index = fromIndex; index <= wallastVer; ++index) { + SLRUCache* pCache = pData->pSyncNode->pLogStore->pCache; + LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index)); + if (h) { + sNTrace(pData->pSyncNode, "cache delete index:%" PRId64, index); + + taosLRUCacheRelease(pData->pSyncNode->pLogStore->pCache, h, true); + } + } + int32_t code = walRollback(pWal, fromIndex); if (code != 0) { int32_t err = terrno; diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 6a7a2c18c1..802595c55a 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -73,7 +73,20 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh SyncAppendEntries* pMsg = NULL; SSyncRaftEntry* pEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry); + SLRUCache* pCache = pSyncNode->pLogStore->pCache; + LRUHandle* h = taosLRUCacheLookup(pCache, &nextIndex, sizeof(nextIndex)); + int32_t code = 0; + if (h) { + pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h); + code = 0; + + sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", nextIndex, pEntry->bytes, pEntry); + + } else { + sNTrace(pSyncNode, "miss cache index:%" PRId64, nextIndex); + + code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry); + } if (code == 0) { ASSERT(pEntry != NULL); @@ -99,7 +112,11 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } } - syncEntryDestory(pEntry); + if (h) { + taosLRUCacheRelease(pCache, h, false); + } else { + syncEntryDestory(pEntry); + } // prepare msg ASSERT(pMsg != NULL); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index b9a271ab9d..fb1b07b0b6 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -212,7 +212,11 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo } char cfgStr[1024]; - syncCfg2SimpleStr(&(pNode->pRaftCfg->cfg), cfgStr, sizeof(cfgStr)); + if (pNode->pRaftCfg != NULL) { + syncCfg2SimpleStr(&(pNode->pRaftCfg->cfg), cfgStr, sizeof(cfgStr)); + } else { + return; + } char peerStr[1024] = "{"; syncPeerState2Str(pNode, peerStr, sizeof(peerStr)); @@ -230,17 +234,19 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo // restore error code terrno = errCode; - taosPrintLog(flags, level, dflag, - "vgId:%d, sync %s " - "%s" - ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 - ", snap-tm:%" PRIu64 ", sby:%d, aq:%d, bch:%d, r-num:%d, lcfg:%" PRId64 - ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s", - pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex, - logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, - pNode->pRaftCfg->isStandBy, aqItems, pNode->pRaftCfg->batchSize, pNode->replicaNum, - pNode->pRaftCfg->lastConfigIndex, pNode->changing, pNode->restoreFinish, quorum, - pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr); + if (pNode != NULL && pNode->pRaftCfg != NULL) { + taosPrintLog(flags, level, dflag, + "vgId:%d, sync %s " + "%s" + ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 + ", snap-tm:%" PRIu64 ", sby:%d, aq:%d, bch:%d, r-num:%d, lcfg:%" PRId64 + ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s", + pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex, + logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, + pNode->pRaftCfg->isStandBy, aqItems, pNode->pRaftCfg->batchSize, pNode->replicaNum, + pNode->pRaftCfg->lastConfigIndex, pNode->changing, pNode->restoreFinish, quorum, + pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr); + } } void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotSender* pSender, @@ -364,9 +370,9 @@ void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntries syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, - "send sync-append-entries-reply to %s:%d, {term:%" PRId64 ", pterm:%" PRId64 ", success:%d, match:%" PRId64 - "}, %s", - host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s); + "send sync-append-entries-reply to %s:%d, {term:%" PRId64 ", pterm:%" PRId64 + ", success:%d, lsend-index:%" PRId64 ", match:%" PRId64 "}, %s", + host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s); } void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) { From 20e31aacca9c3e5ca2d93c90853fa3524191efc4 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 19:48:16 +0800 Subject: [PATCH 062/116] fix(wal): set commit ver and snapshot ver after restore --- source/libs/wal/src/walWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 216dd5fcb1..1a75d5ed81 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -70,8 +70,8 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) { taosArrayClear(pWal->fileInfoSet); pWal->vers.firstVer = -1; pWal->vers.lastVer = ver; - pWal->vers.commitVer = ver - 1; - pWal->vers.snapshotVer = ver - 1; + pWal->vers.commitVer = ver; + pWal->vers.snapshotVer = ver; pWal->vers.verInSnapshotting = -1; taosThreadMutexUnlock(&pWal->mutex); From d5080b5ce631d38b47c666948a1e347df53ad44e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 19:55:40 +0800 Subject: [PATCH 063/116] test: add asan case --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index bfd93994eb..e4edc43600 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -228,7 +228,7 @@ ,,y,script,./test.sh -f tsim/stream/partitionby.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/schedSnode.sim -,,y,script,./test.sh -f tsim/stream/windowClose.sim +,,,script,./test.sh -f tsim/stream/windowClose.sim ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim From 6c0bbe684b0e2bd1a150c4540efc158921278f41 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 22:28:03 +0800 Subject: [PATCH 064/116] fix: heap-use-after-free in syncNodeEqPingTimer --- source/libs/sync/src/syncMain.c | 6 +++--- tests/parallel_test/cases.task | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index c39558ca1d..c623628978 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1842,7 +1842,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { return; } - sNTrace(pNode, "enqueue ping msg"); + sTrace(pNode, "enqueue ping msg"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { sError("failed to sync enqueue ping msg since %s", terrstr()); @@ -1870,7 +1870,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { } SyncTimeout* pTimeout = rpcMsg.pCont; - sNTrace(pNode, "enqueue elect msg lc:%" PRId64, pTimeout->logicClock); + sTrace(pNode, "enqueue elect msg lc:%" PRId64, pTimeout->logicClock); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { @@ -1894,7 +1894,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { return; } - sNTrace(pNode, "enqueue heartbeat timer"); + sTrace(pNode, "enqueue heartbeat timer"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { sError("failed to enqueue heartbeat msg since %s", terrstr()); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index e4edc43600..f0dff430b3 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -215,7 +215,7 @@ ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim -,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim +,,,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim From aab1ec632c304d8d9bb3615a90cfb3349799b52a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 15 Nov 2022 22:29:59 +0800 Subject: [PATCH 065/116] fix: heap-use-after-free in syncNodeEqPingTimer --- source/libs/sync/src/syncMain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index c623628978..514160235f 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1842,7 +1842,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { return; } - sTrace(pNode, "enqueue ping msg"); + sTrace("enqueue ping msg"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { sError("failed to sync enqueue ping msg since %s", terrstr()); @@ -1870,7 +1870,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { } SyncTimeout* pTimeout = rpcMsg.pCont; - sTrace(pNode, "enqueue elect msg lc:%" PRId64, pTimeout->logicClock); + sTrace("enqueue elect msg lc:%" PRId64, pTimeout->logicClock); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { @@ -1894,7 +1894,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { return; } - sTrace(pNode, "enqueue heartbeat timer"); + sTrace("enqueue heartbeat timer"); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { sError("failed to enqueue heartbeat msg since %s", terrstr()); From 6478fcb2c11ddab16b3cf90413450533c90f29dd Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 15 Nov 2022 22:32:52 +0800 Subject: [PATCH 066/116] fix(stream): check task --- source/dnode/vnode/src/tq/tq.c | 2 +- source/libs/wal/src/walWrite.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 419d4c3b9b..092128fe6e 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -983,7 +983,7 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { rsp.status = 0; } - streamMetaReleaseTask(pTq->pStreamMeta, pTask); + if (pTask) streamMetaReleaseTask(pTq->pStreamMeta, pTask); tqDebug("tq recv task check req(reqId: %" PRId64 ") %d at node %d check req from task %d at node %d, status %d", rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 7c3b4cba30..34195f0193 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -22,6 +22,8 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) { taosThreadMutexLock(&pWal->mutex); + wInfo("vgId:%d, restore from snapshot, version %" PRId64, pWal->cfg.vgId, ver); + void *pIter = NULL; while (1) { pIter = taosHashIterate(pWal->pRefHash, pIter); From 5cbbd9544900303b02153f282c5542067a212dd2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 09:41:02 +0800 Subject: [PATCH 067/116] test: add asan case --- tests/parallel_test/cases.task | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f0dff430b3..b9d5e6c03f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -118,8 +118,8 @@ ,,,script,./test.sh -f tsim/parser/function.sim ,,y,script,./test.sh -f tsim/parser/groupby-basic.sim ,,,script,./test.sh -f tsim/parser/groupby.sim -,,,script,./test.sh -f tsim/parser/having_child.sim -,,,script,./test.sh -f tsim/parser/having.sim +,,y,script,./test.sh -f tsim/parser/having_child.sim +,,y,script,./test.sh -f tsim/parser/having.sim ,,y,script,./test.sh -f tsim/parser/import_commit1.sim ,,y,script,./test.sh -f tsim/parser/import_commit2.sim ,,y,script,./test.sh -f tsim/parser/import_commit3.sim @@ -173,7 +173,7 @@ ,,y,script,./test.sh -f tsim/query/scalarFunction.sim ,,y,script,./test.sh -f tsim/query/scalarNull.sim ,,y,script,./test.sh -f tsim/query/session.sim -,,,script,./test.sh -f tsim/query/udf.sim +,,y,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim ,,,script,./test.sh -f tsim/mnode/basic1.sim @@ -215,11 +215,11 @@ ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim -,,,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim +,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim -,,,script,./test.sh -f tsim/stream/distributeSession0.sim +,,y,script,./test.sh -f tsim/stream/distributeSession0.sim ,,,script,./test.sh -f tsim/stream/session0.sim ,,y,script,./test.sh -f tsim/stream/session1.sim ,,y,script,./test.sh -f tsim/stream/state0.sim @@ -232,10 +232,10 @@ ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim -,,,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim +,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim ,,y,script,./test.sh -f tsim/stream/deleteInterval.sim -,,,script,./test.sh -f tsim/stream/deleteSession.sim +,,y,script,./test.sh -f tsim/stream/deleteSession.sim ,,y,script,./test.sh -f tsim/stream/deleteState.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalDelete0.sim ,,y,script,./test.sh -f tsim/stream/fillIntervalDelete1.sim From 475919dd771eaf167c142e3a1879e62ca530cc0b Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 10:10:02 +0800 Subject: [PATCH 068/116] refactor(sync): add rtt trace log --- source/libs/sync/src/syncAppendEntriesReply.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 875204c0a9..13ea250155 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -83,10 +83,14 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { ASSERT(pState != NULL); if (pMsg->lastSendIndex == pState->lastSendIndex) { + int64_t timeNow = taosGetTimestampMs(); + int64_t elapsed = timeNow - pState->lastSendTime; + sNTrace(ths, "sync-append-entries rtt elapsed:%" PRId64 ", index:%" PRId64, elapsed, pState->lastSendIndex); + syncNodeReplicateOne(ths, &(pMsg->srcId), true); } } syncLogRecvAppendEntriesReply(ths, pMsg, "process"); return 0; -} \ No newline at end of file +} From 023f61ccf5b775698a711d86db1df8880c047705 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 10:54:06 +0800 Subject: [PATCH 069/116] fix(sync): fix asan error, TD-20437 --- source/libs/sync/src/syncSnapshot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 9bc0a07d48..222b7c4e1e 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -192,7 +192,9 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // pMsg->privateTerm = pSender->privateTerm; - memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); + if (pSender->pCurrentBlock != NULL) { + memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); + } // send msg syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); From 853c22de287bbe02260503fba38877c862493b13 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 10:55:19 +0800 Subject: [PATCH 070/116] fix: memory leak while create stream --- source/dnode/mnode/impl/src/mndScheduler.c | 1 + source/dnode/mnode/impl/src/mndStream.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 7e7c6ee0b6..e1886511b7 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -508,6 +508,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { qDestroyQueryPlan(pPlan); return -1; } + sdbRelease(pSdb, pVgroup); } } qDestroyQueryPlan(pPlan); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 2cfb81a817..62247f2c2a 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -295,6 +295,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, return -1; } pObj->sourceDbUid = pSourceDb->uid; + mndReleaseDb(pMnode, pSourceDb); memcpy(pObj->targetSTbName, pCreate->targetStbFullName, TSDB_TABLE_FNAME_LEN); @@ -307,6 +308,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->targetStbUid = mndGenerateUid(pObj->targetSTbName, TSDB_TABLE_FNAME_LEN); pObj->targetDbUid = pTargetDb->uid; + mndReleaseDb(pMnode, pTargetDb); pObj->sql = pCreate->sql; pObj->ast = pCreate->ast; @@ -523,6 +525,7 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre tFreeSMCreateStbReq(&createReq); mndFreeStb(&stbObj); + mndReleaseDb(pMnode, pDb); return 0; _OVER: From 6c6d95d6cc2ff9d532da1c3de8b9022e60db4da7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 10:55:49 +0800 Subject: [PATCH 071/116] test: add asan case --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f0dff430b3..e45e82b277 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -119,7 +119,7 @@ ,,y,script,./test.sh -f tsim/parser/groupby-basic.sim ,,,script,./test.sh -f tsim/parser/groupby.sim ,,,script,./test.sh -f tsim/parser/having_child.sim -,,,script,./test.sh -f tsim/parser/having.sim +,,y,script,./test.sh -f tsim/parser/having.sim ,,y,script,./test.sh -f tsim/parser/import_commit1.sim ,,y,script,./test.sh -f tsim/parser/import_commit2.sim ,,y,script,./test.sh -f tsim/parser/import_commit3.sim @@ -220,7 +220,7 @@ ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim ,,,script,./test.sh -f tsim/stream/distributeSession0.sim -,,,script,./test.sh -f tsim/stream/session0.sim +,,y,script,./test.sh -f tsim/stream/session0.sim ,,y,script,./test.sh -f tsim/stream/session1.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim From 3ada61c346f46257e9eb146cc12bd620c71f4e9d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 11:13:53 +0800 Subject: [PATCH 072/116] restore some invalid code modify --- source/libs/sync/inc/syncInt.h | 2 +- source/libs/sync/src/syncMain.c | 39 +++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index e4d4b28b6b..0e0042d526 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -70,7 +70,7 @@ typedef struct SSyncTimer { uint64_t counter; int32_t timerMS; SRaftId destId; - SSyncHbTimerData hbData; + void* pData; } SSyncTimer; typedef struct SElectTimer { diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 514160235f..036127bf9c 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -665,12 +665,13 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { int32_t ret = 0; if (syncIsInit()) { - SSyncHbTimerData* pData = &pSyncTimer->hbData; + SSyncHbTimerData* pData = taosMemoryMalloc(sizeof(SSyncHbTimerData)); pData->pSyncNode = pSyncNode; pData->pTimer = pSyncTimer; pData->destId = pSyncTimer->destId; pData->logicClock = pSyncTimer->logicClock; + pSyncTimer->pData = pData; taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer); } else { sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId); @@ -1104,8 +1105,15 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) { int32_t ret = 0; if (syncIsInit()) { pSyncNode->electTimerMS = ms; - taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager, + + SElectTimer* pElectTimer = taosMemoryMalloc(sizeof(SElectTimer)); + pElectTimer->logicClock = pSyncNode->electTimerLogicClock; + pElectTimer->pSyncNode = pSyncNode; + pElectTimer->pData = NULL; + + taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pElectTimer, syncEnv()->pTimerManager, &pSyncNode->pElectTimer); + } else { sError("vgId:%d, start elect timer error, sync env is stop", pSyncNode->vgId); } @@ -1855,28 +1863,45 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { } static void syncNodeEqElectTimer(void* param, void* tmrId) { - SSyncNode* pNode = param; - if (!syncIsInit()) return; + + SElectTimer* pElectTimer = param; + SSyncNode* pNode = pElectTimer->pSyncNode; + if (pNode == NULL) return; if (pNode->syncEqMsg == NULL) return; SRpcMsg rpcMsg = {0}; - int32_t code = - syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pNode->electTimerLogicClock, pNode->electTimerMS, pNode); + int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pElectTimer->logicClock, pNode->electTimerMS, pNode); + if (code != 0) { sError("failed to build elect msg"); + taosMemoryFree(pElectTimer); return; } SyncTimeout* pTimeout = rpcMsg.pCont; - sTrace("enqueue elect msg lc:%" PRId64, pTimeout->logicClock); + sNTrace(pNode, "enqueue elect msg lc:%" PRId64, pTimeout->logicClock); code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg); if (code != 0) { sError("failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); + taosMemoryFree(pElectTimer); + return; } + + taosMemoryFree(pElectTimer); + +#if 0 + // reset timer ms + if (syncIsInit() && pNode->electBaseLine > 0) { + pNode->electTimerMS = syncUtilElectRandomMS(pNode->electBaseLine, 2 * pNode->electBaseLine); + taosTmrReset(syncNodeEqElectTimer, pNode->electTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pElectTimer); + } else { + sError("sync env is stop, syncNodeEqElectTimer"); + } +#endif } static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { From 015c00aaca11002a77f99848ee655301353787da Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 16 Nov 2022 11:16:32 +0800 Subject: [PATCH 073/116] fix(stream): timer refer stream task --- source/libs/stream/src/stream.c | 3 +++ source/libs/stream/src/streamMeta.c | 9 +++++++++ source/libs/wal/src/walWrite.c | 12 ++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index e6d5859163..79549675a3 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -51,6 +51,7 @@ void streamSchedByTimer(void* param, void* tmrId) { SStreamTask* pTask = (void*)param; if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) { + streamMetaReleaseTask(NULL, pTask); return; } @@ -80,6 +81,8 @@ void streamSchedByTimer(void* param, void* tmrId) { int32_t streamSetupTrigger(SStreamTask* pTask) { if (pTask->triggerParam != 0) { + int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); + ASSERT(ref == 2); pTask->timer = taosTmrStart(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer); pTask->triggerStatus = TASK_TRIGGER_STATUS__INACTIVE; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 5ec8828c05..a864814a74 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -80,7 +80,12 @@ void streamMetaClose(SStreamMeta* pMeta) { pIter = taosHashIterate(pMeta->pTasks, pIter); if (pIter == NULL) break; SStreamTask* pTask = *(SStreamTask**)pIter; + if (pTask->timer) { + taosTmrStop(pTask->timer); + pTask->timer = NULL; + } tFreeSStreamTask(pTask); + /*streamMetaReleaseTask(pMeta, pTask);*/ } taosHashCleanup(pMeta->pTasks); taosMemoryFree(pMeta->path); @@ -202,6 +207,10 @@ void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId) { if (ppTask) { SStreamTask* pTask = *ppTask; taosHashRemove(pMeta->pTasks, &taskId, sizeof(int32_t)); + /*if (pTask->timer) { + * taosTmrStop(pTask->timer);*/ + /*pTask->timer = NULL;*/ + /*}*/ atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING); taosWLockLatch(&pMeta->lock); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 34195f0193..0bc76e4084 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -102,6 +102,7 @@ int32_t walCommit(SWal *pWal, int64_t ver) { int32_t walRollback(SWal *pWal, int64_t ver) { taosThreadMutexLock(&pWal->mutex); + wInfo("vgId:%d, wal rollback for version %" PRId64, pWal->cfg.vgId, ver); int64_t code; char fnameStr[WAL_FILE_LEN]; if (ver > pWal->vers.lastVer || ver < pWal->vers.commitVer || ver <= pWal->vers.snapshotVer) { @@ -123,8 +124,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) { int fileSetSize = taosArrayGetSize(pWal->fileInfoSet); for (int i = pWal->writeCur + 1; i < fileSetSize; i++) { walBuildLogName(pWal, ((SWalFileInfo *)taosArrayGet(pWal->fileInfoSet, i))->firstVer, fnameStr); + wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); walBuildIdxName(pWal, ((SWalFileInfo *)taosArrayGet(pWal->fileInfoSet, i))->firstVer, fnameStr); + wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); } // pop from fileInfoSet @@ -157,6 +160,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); + wDebug("vgId:%d, wal truncate file %s", pWal->cfg.vgId, fnameStr); if (pLogFile == NULL) { // TODO terrno = TAOS_SYSTEM_ERROR(errno); @@ -324,9 +328,9 @@ int32_t walEndSnapshot(SWal *pWal) { pInfo++; } if (POINTER_DISTANCE(pInfo, pWal->fileInfoSet->pData) > 0) { - wDebug("vgId:%d, begin remove from %" PRId64, pWal->cfg.vgId, pInfo->firstVer); + wDebug("vgId:%d, wal end remove from %" PRId64, pWal->cfg.vgId, pInfo->firstVer); } else { - wDebug("vgId:%d, no remove", pWal->cfg.vgId); + wDebug("vgId:%d, wal no remove", pWal->cfg.vgId); } // iterate files, until the searched result for (SWalFileInfo *iter = pWal->fileInfoSet->pData; iter < pInfo; iter++) { @@ -343,12 +347,12 @@ int32_t walEndSnapshot(SWal *pWal) { for (int i = 0; i < deleteCnt; i++) { pInfo = taosArrayGet(pWal->fileInfoSet, i); walBuildLogName(pWal, pInfo->firstVer, fnameStr); - wDebug("vgId:%d, remove file %s", pWal->cfg.vgId, fnameStr); + wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr); if (taosRemoveFile(fnameStr) < 0) { goto UPDATE_META; } walBuildIdxName(pWal, pInfo->firstVer, fnameStr); - wDebug("vgId:%d, remove file %s", pWal->cfg.vgId, fnameStr); + wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr); if (taosRemoveFile(fnameStr) < 0) { ASSERT(0); } From cf7fe5bb1f59311ce14291b72fa6ba11f93d52af Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Wed, 16 Nov 2022 11:23:15 +0800 Subject: [PATCH 074/116] fix(ws): fix websocket connection error on windows release build Close [TS-2060](https://jira.taosdata.com:18080/browse/TS-2060) --- cmake/taosws_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in index 5c448e2c1d..7d48eb9d8a 100644 --- a/cmake/taosws_CMakeLists.txt.in +++ b/cmake/taosws_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosws-rs ExternalProject_Add(taosws-rs GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git - GIT_TAG 7664c41 + GIT_TAG 9843872 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 70f7d46bc7fd77de1edc034a734e168a7a08ebbb Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 11:30:29 +0800 Subject: [PATCH 075/116] fix: asan script error --- tests/script/test.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index 1e3319dd0a..3cc40a2927 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -7,6 +7,7 @@ ################################################## set +e +#set -x FILE_NAME= RELEASE=0 @@ -137,8 +138,15 @@ if [ -n "$FILE_NAME" ]; then $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME - $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan - $CODE_DIR/sh/checkAsan.sh + $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan + result=$? + echo "Execute result: " $result + + if [ $result -eq 0 ]; then + $CODE_DIR/sh/checkAsan.sh + else + exit 1 + fi fi else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f basicSuite.sim From 6febcbcfe5bf99d68633990c1b7506d96f9b4d6f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 12:33:30 +0800 Subject: [PATCH 076/116] fix: asan script error --- tests/script/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index 3cc40a2927..b3a3b1d61a 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -7,7 +7,7 @@ ################################################## set +e -#set -x +set -x FILE_NAME= RELEASE=0 From 6573e93b5441b83ca89fb1d0810d8dc9e1fe45a2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 12:52:47 +0800 Subject: [PATCH 077/116] fix: asan script error --- tests/script/test.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index b3a3b1d61a..e1db1c14de 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -7,7 +7,7 @@ ################################################## set +e -set -x +#set -x FILE_NAME= RELEASE=0 @@ -138,7 +138,8 @@ if [ -n "$FILE_NAME" ]; then $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME - $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan + echo "AsanDir:" $ASAN_DIR/tsim.asan + eval $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan result=$? echo "Execute result: " $result From 8f6ba995a51b8deb0f8de05d2c526293d1f7a7ba Mon Sep 17 00:00:00 2001 From: slzhou Date: Wed, 16 Nov 2022 13:27:53 +0800 Subject: [PATCH 078/116] fix: get group id from the group list when last row scan --- source/libs/executor/src/cachescanoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 6f9084ce52..b78ba8ac0a 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -208,7 +208,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { if (pInfo->pseudoExprSup.numOfExprs > 0) { SExprSupp* pSup = &pInfo->pseudoExprSup; - STableKeyInfo* pKeyInfo = &((STableKeyInfo*)pTableList)[0]; + STableKeyInfo* pKeyInfo = &((STableKeyInfo*)pList)[0]; pInfo->pRes->info.groupId = pKeyInfo->groupId; if (taosArrayGetSize(pInfo->pUidList) > 0) { From 058788b2eb5630a713f7a63b26701ce83e771d60 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 13:28:29 +0800 Subject: [PATCH 079/116] test: update asan case --- tests/parallel_test/cases.task | 16 ++++++++-------- tests/script/tsim/compute/diff2.sim | 2 +- tests/script/tsim/parser/function.sim | 8 ++++---- tests/script/tsim/parser/nestquery.sim | 14 +++++++------- tests/script/tsim/valgrind/checkError6.sim | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index b9d5e6c03f..0567f05d55 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -37,10 +37,10 @@ ,,y,script,./test.sh -f tsim/db/taosdlog.sim ,,,script,./test.sh -f tsim/dnode/balance_replica1.sim ,,,script,./test.sh -f tsim/dnode/balance_replica3.sim -,,,script,./test.sh -f tsim/dnode/balance1.sim -,,,script,./test.sh -f tsim/dnode/balance2.sim -,,,script,./test.sh -f tsim/dnode/balance3.sim -,,,script,./test.sh -f tsim/dnode/balancex.sim +#,,,script,./test.sh -f tsim/dnode/balance1.sim +#,,,script,./test.sh -f tsim/dnode/balance2.sim +#,,,script,./test.sh -f tsim/dnode/balance3.sim +#,,,script,./test.sh -f tsim/dnode/balancex.sim ,,y,script,./test.sh -f tsim/dnode/create_dnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim @@ -55,7 +55,7 @@ ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -,,,script,./test.sh -f tsim/dnode/vnode_clean.sim +#,,,script,./test.sh -f tsim/dnode/vnode_clean.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim @@ -115,7 +115,7 @@ ,,y,script,./test.sh -f tsim/parser/interp.sim #,,y,script,./test.sh -f tsim/parser/limit2.sim ,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim -,,,script,./test.sh -f tsim/parser/function.sim +,,y,script,./test.sh -f tsim/parser/function.sim ,,y,script,./test.sh -f tsim/parser/groupby-basic.sim ,,,script,./test.sh -f tsim/parser/groupby.sim ,,y,script,./test.sh -f tsim/parser/having_child.sim @@ -140,7 +140,7 @@ ,,,script,./test.sh -f tsim/parser/limit1.sim ,,y,script,./test.sh -f tsim/parser/mixed_blocks.sim ,,y,script,./test.sh -f tsim/parser/nchar.sim -,,,script,./test.sh -f tsim/parser/nestquery.sim +,,y,script,./test.sh -f tsim/parser/nestquery.sim ,,y,script,./test.sh -f tsim/parser/null_char.sim ,,y,script,./test.sh -f tsim/parser/precision_ns.sim ,,y,script,./test.sh -f tsim/parser/projection_limit_offset.sim @@ -296,7 +296,7 @@ ,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim ,,y,script,./test.sh -f tsim/vnode/replica3_many.sim ,,y,script,./test.sh -f tsim/vnode/replica3_import.sim -,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim +#,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim diff --git a/tests/script/tsim/compute/diff2.sim b/tests/script/tsim/compute/diff2.sim index 1cc2a87839..5848e05b1e 100644 --- a/tests/script/tsim/compute/diff2.sim +++ b/tests/script/tsim/compute/diff2.sim @@ -83,7 +83,7 @@ sql select diff(c1), diff(c2) from $tb sql select 2+diff(c1) from $tb sql select diff(c1+2) from $tb sql_error select diff(c1) from $tb where ts > 0 and ts < now + 100m interval(10m) -sql select diff(c1) from $mt +#sql select diff(c1) from $mt sql_error select diff(diff(c1)) from $tb sql_error select diff(c1) from m_di_tb1 where c2 like '2%' diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index ec9cdf2666..704b6eafb0 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -932,10 +932,10 @@ sql insert into t0 values('2020-1-1 1:4:10', 10); sql insert into t1 values('2020-1-1 1:1:2', 2); print ===========================>td-4739 -sql select diff(val) from (select derivative(k, 1s, 0) val from t1); -if $rows != 0 then - return -1 -endi +#sql select diff(val) from (select derivative(k, 1s, 0) val from t1); +#if $rows != 0 then +# return -1 +#endi sql insert into t1 values('2020-1-1 1:1:4', 20); sql insert into t1 values('2020-1-1 1:1:6', 200); diff --git a/tests/script/tsim/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim index dd7a0c6c81..494c3de99f 100644 --- a/tests/script/tsim/parser/nestquery.sim +++ b/tests/script/tsim/parser/nestquery.sim @@ -338,13 +338,13 @@ if $data03 != @20-09-15 00:00:00.000@ then return -1 endi -sql select diff(val) from (select c1 val from nest_tb0); -if $rows != 9999 then - return -1 -endi -if $data00 != 1 then - return -1 -endi +#sql select diff(val) from (select c1 val from nest_tb0); +#if $rows != 9999 then +# return -1 +#endi +#if $data00 != 1 then +# return -1 +#endi sql_error select last_row(*) from (select * from nest_tb0) having c1 > 0 diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 89b6cadef8..9432991d1c 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -92,7 +92,7 @@ sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol sql show table distributed stb sql select count(1) from stb sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) -sql select diff(tbcol) from stb where ts <= 1601481840000 +#sql select diff(tbcol) from stb where ts <= 1601481840000 sql select first(tbcol), last(tbcol) as c from stb group by tgcol sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) From b9e5b1f167df14096170cd6bb2f234365cf3268e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 13:29:52 +0800 Subject: [PATCH 080/116] \est: update asan case --- tests/script/tsim/valgrind/checkError6.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 9432991d1c..ef8fe930b9 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -176,7 +176,7 @@ sql select avg(tbcol) as c from stb group by tgcol sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) sql show table distributed stb sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) -sql select diff(tbcol) from stb where ts <= 1601481840000 +#sql select diff(tbcol) from stb where ts <= 1601481840000 sql select first(tbcol), last(tbcol) as c from stb group by tgcol sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) From 78378845cc15a3eb4fb8c7a516143bc5b7b15a45 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 16 Nov 2022 13:57:24 +0800 Subject: [PATCH 081/116] fix: memory leak --- source/libs/planner/src/planSpliter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 249ba1815d..489046d88e 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -596,6 +596,7 @@ static int32_t stbSplSplitSessionForStream(SSplitContext* pCxt, SStableSplitInfo int32_t index = 0; int32_t code = stbSplAppendWEnd(pPartWin, &index); if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode(pMergeWin->pTsEnd); pMergeWin->pTsEnd = nodesCloneNode(nodesListGetNode(pPartWin->node.pTargets, index)); if (NULL == pMergeWin->pTsEnd) { code = TSDB_CODE_OUT_OF_MEMORY; From 7bcd13e82ae20e39d4b2217d79b8d7e8f9f94a87 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 14:05:34 +0800 Subject: [PATCH 082/116] fix(sync): fix elect timer memory leak --- source/libs/sync/inc/syncInt.h | 14 +++++++---- source/libs/sync/src/syncMain.c | 44 ++++++++++++++------------------- source/libs/sync/src/syncUtil.c | 4 +-- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 0e0042d526..0507bb3661 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -41,7 +41,7 @@ typedef struct SSyncRespMgr SSyncRespMgr; typedef struct SSyncSnapshotSender SSyncSnapshotSender; typedef struct SSyncSnapshotReceiver SSyncSnapshotReceiver; typedef struct SSyncTimer SSyncTimer; -typedef struct SSyncHbTimerData SSyncHbTimerData; +typedef struct SSyncHbTimerParam SSyncHbTimerParam; typedef struct SyncSnapshotSend SyncSnapshotSend; typedef struct SyncSnapshotRsp SyncSnapshotRsp; typedef struct SyncLocalCmd SyncLocalCmd; @@ -56,12 +56,13 @@ typedef struct SRaftId { SyncGroupId vgId; } SRaftId; -typedef struct SSyncHbTimerData { +typedef struct SSyncHbTimerParam { SSyncNode* pSyncNode; SSyncTimer* pTimer; SRaftId destId; uint64_t logicClock; -} SSyncHbTimerData; + int64_t executeTime; +} SSyncHbTimerParam; typedef struct SSyncTimer { void* pTimer; @@ -73,11 +74,12 @@ typedef struct SSyncTimer { void* pData; } SSyncTimer; -typedef struct SElectTimer { +typedef struct SElectTimerParam { uint64_t logicClock; SSyncNode* pSyncNode; + int64_t executeTime; void* pData; -} SElectTimer; +} SElectTimerParam; typedef struct SPeerState { SyncIndex lastSendIndex; @@ -153,6 +155,7 @@ typedef struct SSyncNode { uint64_t electTimerLogicClock; TAOS_TMR_CALLBACK FpElectTimerCB; // Timer Fp uint64_t electTimerCounter; + SElectTimerParam electTimerParam; // heartbeat timer tmr_h pHeartbeatTimer; @@ -161,6 +164,7 @@ typedef struct SSyncNode { uint64_t heartbeatTimerLogicClockUser; TAOS_TMR_CALLBACK FpHeartbeatTimerCB; // Timer Fp uint64_t heartbeatTimerCounter; + SSyncHbTimerParam hbTimerParam; // peer heartbeat timer SSyncTimer peerHeartbeatTimerArr[TSDB_MAX_REPLICA]; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 036127bf9c..7484e93abe 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -665,7 +665,7 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { int32_t ret = 0; if (syncIsInit()) { - SSyncHbTimerData* pData = taosMemoryMalloc(sizeof(SSyncHbTimerData)); + SSyncHbTimerParam* pData = taosMemoryMalloc(sizeof(SSyncHbTimerParam)); pData->pSyncNode = pSyncNode; pData->pTimer = pSyncTimer; pData->destId = pSyncTimer->destId; @@ -1106,12 +1106,13 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) { if (syncIsInit()) { pSyncNode->electTimerMS = ms; - SElectTimer* pElectTimer = taosMemoryMalloc(sizeof(SElectTimer)); - pElectTimer->logicClock = pSyncNode->electTimerLogicClock; - pElectTimer->pSyncNode = pSyncNode; - pElectTimer->pData = NULL; + int64_t execTime = taosGetTimestampMs() + ms; + atomic_store_64(&(pSyncNode->electTimerParam.executeTime), execTime); + atomic_store_64(&(pSyncNode->electTimerParam.logicClock), pSyncNode->electTimerLogicClock); + pSyncNode->electTimerParam.pSyncNode = pSyncNode; + pSyncNode->electTimerParam.pData = NULL; - taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pElectTimer, syncEnv()->pTimerManager, + taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager, &pSyncNode->pElectTimer); } else { @@ -1865,18 +1866,21 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { static void syncNodeEqElectTimer(void* param, void* tmrId) { if (!syncIsInit()) return; - SElectTimer* pElectTimer = param; - SSyncNode* pNode = pElectTimer->pSyncNode; + SSyncNode* pNode = (SSyncNode*)param; if (pNode == NULL) return; if (pNode->syncEqMsg == NULL) return; + int64_t tsNow = taosGetTimestampMs(); + if (tsNow < pNode->electTimerParam.executeTime) return; + SRpcMsg rpcMsg = {0}; - int32_t code = syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pElectTimer->logicClock, pNode->electTimerMS, pNode); + int32_t code = + syncBuildTimeout(&rpcMsg, SYNC_TIMEOUT_ELECTION, pNode->electTimerParam.logicClock, pNode->electTimerMS, pNode); if (code != 0) { sError("failed to build elect msg"); - taosMemoryFree(pElectTimer); + return; } @@ -1887,21 +1891,9 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); - taosMemoryFree(pElectTimer); + return; } - - taosMemoryFree(pElectTimer); - -#if 0 - // reset timer ms - if (syncIsInit() && pNode->electBaseLine > 0) { - pNode->electTimerMS = syncUtilElectRandomMS(pNode->electBaseLine, 2 * pNode->electBaseLine); - taosTmrReset(syncNodeEqElectTimer, pNode->electTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pElectTimer); - } else { - sError("sync env is stop, syncNodeEqElectTimer"); - } -#endif } static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { @@ -1938,9 +1930,9 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { } static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { - SSyncHbTimerData* pData = (SSyncHbTimerData*)param; - SSyncNode* pSyncNode = pData->pSyncNode; - SSyncTimer* pSyncTimer = pData->pTimer; + SSyncHbTimerParam* pData = (SSyncHbTimerParam*)param; + SSyncNode* pSyncNode = pData->pSyncNode; + SSyncTimer* pSyncTimer = pData->pTimer; if (pSyncNode == NULL) { return; diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index fb1b07b0b6..1d0ad07c99 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -193,7 +193,7 @@ static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) { } void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...) { - if (pNode == NULL || pNode->pRaftCfg != NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; + if (pNode == NULL || pNode->pRaftCfg == NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; int64_t currentTerm = pNode->pRaftStore->currentTerm; // save error code, otherwise it will be overwritten @@ -554,4 +554,4 @@ void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteRepl syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, "send sync-request-vote-reply to %s:%d {term:%" PRId64 ", grant:%d}, %s", host, port, pMsg->term, pMsg->voteGranted, s); -} \ No newline at end of file +} From 81592dfb09bc18b5ecc49e7efb21bf4c03fc32bb Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 14:25:21 +0800 Subject: [PATCH 083/116] fix(sync): fix hb-timer memory leak --- source/libs/sync/inc/syncInt.h | 8 +++----- source/libs/sync/src/syncMain.c | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 0507bb3661..b7ca735ade 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -56,13 +56,12 @@ typedef struct SRaftId { SyncGroupId vgId; } SRaftId; -typedef struct SSyncHbTimerParam { +typedef struct SSyncHbTimerData { SSyncNode* pSyncNode; SSyncTimer* pTimer; SRaftId destId; uint64_t logicClock; - int64_t executeTime; -} SSyncHbTimerParam; +} SSyncHbTimerData; typedef struct SSyncTimer { void* pTimer; @@ -71,7 +70,7 @@ typedef struct SSyncTimer { uint64_t counter; int32_t timerMS; SRaftId destId; - void* pData; + SSyncHbTimerData hbData; } SSyncTimer; typedef struct SElectTimerParam { @@ -164,7 +163,6 @@ typedef struct SSyncNode { uint64_t heartbeatTimerLogicClockUser; TAOS_TMR_CALLBACK FpHeartbeatTimerCB; // Timer Fp uint64_t heartbeatTimerCounter; - SSyncHbTimerParam hbTimerParam; // peer heartbeat timer SSyncTimer peerHeartbeatTimerArr[TSDB_MAX_REPLICA]; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 7484e93abe..d47bf4f401 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -665,13 +665,12 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { int32_t ret = 0; if (syncIsInit()) { - SSyncHbTimerParam* pData = taosMemoryMalloc(sizeof(SSyncHbTimerParam)); + SSyncHbTimerData* pData = &pSyncTimer->hbData; pData->pSyncNode = pSyncNode; pData->pTimer = pSyncTimer; pData->destId = pSyncTimer->destId; pData->logicClock = pSyncTimer->logicClock; - pSyncTimer->pData = pData; taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer); } else { sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId); @@ -1930,9 +1929,9 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { } static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { - SSyncHbTimerParam* pData = (SSyncHbTimerParam*)param; - SSyncNode* pSyncNode = pData->pSyncNode; - SSyncTimer* pSyncTimer = pData->pTimer; + SSyncHbTimerData* pData = (SSyncHbTimerData*)param; + SSyncNode* pSyncNode = pData->pSyncNode; + SSyncTimer* pSyncTimer = pData->pTimer; if (pSyncNode == NULL) { return; From 4c912aa95537baf46a7cdf4eb336e62652eff2ef Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 14:28:20 +0800 Subject: [PATCH 084/116] fix(sync): fix hb-timer memory leak --- source/libs/sync/inc/syncInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index b7ca735ade..362618fece 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -41,7 +41,7 @@ typedef struct SSyncRespMgr SSyncRespMgr; typedef struct SSyncSnapshotSender SSyncSnapshotSender; typedef struct SSyncSnapshotReceiver SSyncSnapshotReceiver; typedef struct SSyncTimer SSyncTimer; -typedef struct SSyncHbTimerParam SSyncHbTimerParam; +typedef struct SSyncHbTimerData SSyncHbTimerData; typedef struct SyncSnapshotSend SyncSnapshotSend; typedef struct SyncSnapshotRsp SyncSnapshotRsp; typedef struct SyncLocalCmd SyncLocalCmd; From 1114bdefb4db0fbc44deeae53a283fd49dbfae77 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 14:31:17 +0800 Subject: [PATCH 085/116] fix: invalid log print --- source/libs/sync/src/syncUtil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 1d0ad07c99..b50336cd63 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -193,7 +193,7 @@ static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) { } void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...) { - if (pNode == NULL || pNode->pRaftCfg == NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; + if (pNode == NULL || pNode->pRaftCfg == NULL || pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; int64_t currentTerm = pNode->pRaftStore->currentTerm; // save error code, otherwise it will be overwritten @@ -252,7 +252,7 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotSender* pSender, const char* format, ...) { SSyncNode* pNode = pSender->pSyncNode; - if (pNode == NULL || pNode->pRaftCfg != NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; + if (pNode == NULL || pNode->pRaftCfg == NULL || pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) { @@ -304,7 +304,7 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotReceiver* pReceiver, const char* format, ...) { SSyncNode* pNode = pReceiver->pSyncNode; - if (pNode == NULL || pNode->pRaftCfg != NULL && pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; + if (pNode == NULL || pNode->pRaftCfg == NULL || pNode->pRaftStore == NULL || pNode->pLogStore == NULL) return; SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) { From aae3475900656d189ecaca5e46f36ce14ce0dcc6 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 14:36:51 +0800 Subject: [PATCH 086/116] fix(query): ASAN heap buffer overflow TD-20454 --- source/libs/function/src/builtinsimpl.c | 9 +++++++-- source/libs/scalar/src/sclfunc.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 10860d291f..ef04d2df65 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -4495,18 +4495,23 @@ bool histogramFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultIn pInfo->totalCount = 0; pInfo->normalized = 0; - int8_t binType = getHistogramBinType(varDataVal(pCtx->param[1].param.pz)); + char *binTypeStr = strndup(varDataVal(pCtx->param[1].param.pz), varDataLen(pCtx->param[1].param.pz)); + int8_t binType = getHistogramBinType(binTypeStr); + taosMemoryFree(binTypeStr); + if (binType == UNKNOWN_BIN) { return false; } - char* binDesc = varDataVal(pCtx->param[2].param.pz); + char* binDesc = strndup(varDataVal(pCtx->param[2].param.pz), varDataLen(pCtx->param[2].param.pz)); int64_t normalized = pCtx->param[3].param.i; if (normalized != 0 && normalized != 1) { return false; } if (!getHistogramBinDesc(pInfo, binDesc, binType, (bool)normalized)) { + taosMemoryFree(binDesc); return false; } + taosMemoryFree(binDesc); return true; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 22fa99d75d..bb4a36a4ce 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2748,14 +2748,19 @@ int32_t histogramScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarP int32_t numOfBins = 0; int32_t totalCount = 0; - int8_t binType = getHistogramBinType(varDataVal(pInput[1].columnData->pData)); - char *binDesc = varDataVal(pInput[2].columnData->pData); + char *binTypeStr = strndup(varDataVal(pInput[1].columnData->pData), varDataLen(pInput[1].columnData->pData)); + int8_t binType = getHistogramBinType(binTypeStr); + taosMemoryFree(binTypeStr); + + char *binDesc = strndup(varDataVal(pInput[2].columnData->pData), varDataLen(pInput[2].columnData->pData)); int64_t normalized = *(int64_t *)(pInput[3].columnData->pData); int32_t type = GET_PARAM_TYPE(pInput); if (!getHistogramBinDesc(&bins, &numOfBins, binDesc, binType, (bool)normalized)) { + taosMemoryFree(binDesc); return TSDB_CODE_FAILED; } + taosMemoryFree(binDesc); for (int32_t i = 0; i < pInput->numOfRows; ++i) { if (colDataIsNull_s(pInputData, i)) { @@ -2785,6 +2790,8 @@ int32_t histogramScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarP } } + colInfoDataEnsureCapacity(pOutputData, numOfBins, false); + for (int32_t k = 0; k < numOfBins; ++k) { int32_t len; char buf[512] = {0}; From cf601b206fdad4b51a331a9257528f48ac8ea104 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 14:36:51 +0800 Subject: [PATCH 087/116] fix(query): ASAN heap buffer overflow TD-20454 --- source/libs/function/src/builtinsimpl.c | 17 +++++++++++++++++ source/libs/scalar/src/sclfunc.c | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index ef04d2df65..4e1feb75b1 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -4366,6 +4366,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t int32_t numOfParams = cJSON_GetArraySize(binDesc); int32_t startIndex; if (numOfParams != 4) { + cJSON_Delete(binDesc); return false; } @@ -4376,15 +4377,18 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity"); if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { + cJSON_Delete(binDesc); return false; } if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 + cJSON_Delete(binDesc); return false; } if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { + cJSON_Delete(binDesc); return false; } @@ -4402,12 +4406,14 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t // linear bin process if (width->valuedouble == 0) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble + i * width->valuedouble; if (isinf(intervals[startIndex])) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; @@ -4416,22 +4422,26 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t // log bin process if (start->valuedouble == 0) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble * pow(factor->valuedouble, i * 1.0); if (isinf(intervals[startIndex])) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; } } else { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } @@ -4446,6 +4456,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t } } else if (cJSON_IsArray(binDesc)) { /* user input bins */ if (binType != USER_INPUT_BIN) { + cJSON_Delete(binDesc); return false; } numOfBins = cJSON_GetArraySize(binDesc); @@ -4453,6 +4464,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t cJSON* bin = binDesc->child; if (bin == NULL) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } int i = 0; @@ -4460,16 +4472,19 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t intervals[i] = bin->valuedouble; if (!cJSON_IsNumber(bin)) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (i != 0 && intervals[i] <= intervals[i - 1]) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } bin = bin->next; i++; } } else { + cJSON_Delete(binDesc); return false; } @@ -4482,6 +4497,8 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t } taosMemoryFree(intervals); + cJSON_Delete(binDesc); + return true; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index bb4a36a4ce..336bc6d533 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2620,6 +2620,7 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin int32_t numOfParams = cJSON_GetArraySize(binDesc); int32_t startIndex; if (numOfParams != 4) { + cJSON_Delete(binDesc); return false; } @@ -2630,15 +2631,18 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin cJSON *infinity = cJSON_GetObjectItem(binDesc, "infinity"); if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { + cJSON_Delete(binDesc); return false; } if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 + cJSON_Delete(binDesc); return false; } if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { + cJSON_Delete(binDesc); return false; } @@ -2656,12 +2660,14 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin // linear bin process if (width->valuedouble == 0) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble + i * width->valuedouble; if (isinf(intervals[startIndex])) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; @@ -2670,22 +2676,26 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin // log bin process if (start->valuedouble == 0) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble * pow(factor->valuedouble, i * 1.0); if (isinf(intervals[startIndex])) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; } } else { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } @@ -2700,6 +2710,7 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin } } else if (cJSON_IsArray(binDesc)) { /* user input bins */ if (binType != USER_INPUT_BIN) { + cJSON_Delete(binDesc); return false; } numOfBins = cJSON_GetArraySize(binDesc); @@ -2707,6 +2718,7 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin cJSON *bin = binDesc->child; if (bin == NULL) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } int i = 0; @@ -2714,16 +2726,19 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin intervals[i] = bin->valuedouble; if (!cJSON_IsNumber(bin)) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (i != 0 && intervals[i] <= intervals[i - 1]) { taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } bin = bin->next; i++; } } else { + cJSON_Delete(binDesc); return false; } @@ -2735,8 +2750,9 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin (*bins)[i].count = 0; } - cJSON_Delete(binDesc); taosMemoryFree(intervals); + cJSON_Delete(binDesc); + return true; } From ab57d069d4fe954fc1cad1e9ceb8ea8cf828b670 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 16 Nov 2022 15:18:31 +0800 Subject: [PATCH 088/116] enh(stream): add tbname map cache --- source/libs/executor/inc/executorimpl.h | 54 +++++++++++++------------ source/libs/executor/src/scanoperator.c | 32 ++++++++++++--- source/libs/wal/src/walWrite.c | 2 +- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index b0da277cfb..0e2635459d 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -154,8 +154,8 @@ typedef struct { } SSchemaInfo; typedef struct { - int32_t operatorType; - int64_t refId; + int32_t operatorType; + int64_t refId; } SExchangeOpStopInfo; typedef struct { @@ -261,10 +261,10 @@ typedef struct SLimitInfo { } SLimitInfo; typedef struct SExchangeInfo { - SArray* pSources; - SArray* pSourceDataInfo; - tsem_t ready; - void* pTransporter; + SArray* pSources; + SArray* pSourceDataInfo; + tsem_t ready; + void* pTransporter; // SArray, result block list, used to keep the multi-block that // passed by downstream operator SArray* pResultBlockList; @@ -275,7 +275,7 @@ typedef struct SExchangeInfo { SLoadRemoteDataInfo loadInfo; uint64_t self; SLimitInfo limitInfo; - int64_t openedTs; // start exec time stamp + int64_t openedTs; // start exec time stamp } SExchangeInfo; typedef struct SScanInfo { @@ -310,9 +310,9 @@ typedef struct { } SAggOptrPushDownInfo; typedef struct STableMetaCacheInfo { - SLRUCache* pTableMetaEntryCache; // 100 by default - uint64_t metaFetch; - uint64_t cacheHit; + SLRUCache* pTableMetaEntryCache; // 100 by default + uint64_t metaFetch; + uint64_t cacheHit; } STableMetaCacheInfo; typedef struct STableScanInfo { @@ -343,7 +343,7 @@ typedef struct STableMergeScanInfo { int32_t tableEndIndex; bool hasGroupId; uint64_t groupId; - SArray* queryConds; // array of queryTableDataCond + SArray* queryConds; // array of queryTableDataCond STsdbReader* pReader; SReadHandle readHandle; int32_t bufPageSize; @@ -358,7 +358,7 @@ typedef struct STableMergeScanInfo { int64_t numOfRows; SScanInfo scanInfo; int32_t scanTimes; - SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context + SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context SResultRowInfo* pResultRowInfo; int32_t* rowEntryInfoOffset; SExprInfo* pExpr; @@ -504,6 +504,7 @@ typedef struct SStreamScanInfo { STimeWindow updateWin; STimeWindowAggSupp twAggSup; SSDataBlock* pUpdateDataRes; + SHashObj* pGroupIdTbNameMap; // status for tmq SNodeList* pGroupTags; SNode* pTagCond; @@ -550,10 +551,10 @@ typedef struct SSysTableScanInfo { } SSysTableScanInfo; typedef struct SBlockDistInfo { - SSDataBlock* pResBlock; - STsdbReader* pHandle; - SReadHandle readHandle; - uint64_t uid; // table uid + SSDataBlock* pResBlock; + STsdbReader* pHandle; + SReadHandle readHandle; + uint64_t uid; // table uid } SBlockDistInfo; // todo remove this @@ -663,9 +664,9 @@ typedef struct SGroupbyOperatorInfo { SAggSupporter aggSup; SArray* pGroupCols; // group by columns, SArray SArray* pGroupColVals; // current group column values, SArray - bool isInit; // denote if current val is initialized or not - char* keyBuf; // group by keys for hash - int32_t groupKeyLen; // total group by column width + bool isInit; // denote if current val is initialized or not + char* keyBuf; // group by keys for hash + int32_t groupKeyLen; // total group by column width SGroupResInfo groupResInfo; SExprSupp scalarSup; } SGroupbyOperatorInfo; @@ -890,14 +891,14 @@ STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInter int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag); int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz); -void doDestroyExchangeOperatorInfo(void* param); +void doDestroyExchangeOperatorInfo(void* param); void setOperatorCompleted(SOperatorInfo* pOperator); -void setOperatorInfo(SOperatorInfo* pOperator, const char* name, int32_t type, bool blocking, int32_t status, void* pInfo, - SExecTaskInfo* pTaskInfo); +void setOperatorInfo(SOperatorInfo* pOperator, const char* name, int32_t type, bool blocking, int32_t status, + void* pInfo, SExecTaskInfo* pTaskInfo); void doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo); -int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, - SSDataBlock* pBlock, int32_t rows, const char* idStr, STableMetaCacheInfo * pCache); +int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, + int32_t rows, const char* idStr, STableMetaCacheInfo* pCache); void cleanupAggSup(SAggSupporter* pAggSup); void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle); @@ -992,7 +993,7 @@ void setTaskKilled(SExecTaskInfo* pTaskInfo); void queryCostStatis(SExecTaskInfo* pTaskInfo); void doDestroyTask(SExecTaskInfo* pTaskInfo); -void destroyOperatorInfo(SOperatorInfo* pOperator); +void destroyOperatorInfo(SOperatorInfo* pOperator); int32_t getMaximumIdleDurationSec(); /* @@ -1038,6 +1039,7 @@ void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKE uint64_t* pGp, void* pTbName); void printDataBlock(SSDataBlock* pBlock, const char* flag); uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId); +void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock); int32_t finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SExprSupp* pSup, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); @@ -1061,7 +1063,7 @@ int32_t setOutputBuf(SStreamState* pState, STimeWindow* win, SResultRow** pResul int32_t releaseOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResult); int32_t saveOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResult, int32_t resSize); void getNextIntervalWindow(SInterval* pInterval, STimeWindow* tw, int32_t order); -int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo *pInfo); +int32_t qAppendTaskStopInfo(SExecTaskInfo* pTaskInfo, SExchangeOpStopInfo* pInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 77d2aeba28..c93ca2b3f8 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1515,10 +1515,17 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; + char* tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; if (groupId == 0) { groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], version); } - appendOneRowToStreamSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, NULL); + if (pInfo->tbnameCalSup.pExprInfo) { + char* parTbname = taosHashGet(pInfo->pGroupIdTbNameMap, &groupId, sizeof(int64_t)); + memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); + varDataSetLen(tbname, strlen(varDataVal(tbname))); + } + appendOneRowToStreamSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, + tbname[0] == 0 ? NULL : tbname); } return TSDB_CODE_SUCCESS; } @@ -1562,9 +1569,16 @@ static void calBlockTag(SExprSupp* pTagCalSup, SSDataBlock* pBlock, SSDataBlock* blockDataDestroy(pSrcBlock); } -static void calBlockTbName(SExprSupp* pTbNameCalSup, SSDataBlock* pBlock) { +void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { + SExprSupp* pTbNameCalSup = &pInfo->tbnameCalSup; if (pTbNameCalSup == NULL || pTbNameCalSup->numOfExprs == 0) return; if (pBlock == NULL || pBlock->info.rows == 0) return; + if (pBlock->info.groupId) { + char* tbname = taosHashGet(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t)); + if (tbname != NULL) { + memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN); + } + } SSDataBlock* pSrcBlock = blockCopyOneRow(pBlock, 0); ASSERT(pSrcBlock->info.rows == 1); @@ -1592,6 +1606,11 @@ static void calBlockTbName(SExprSupp* pTbNameCalSup, SSDataBlock* pBlock) { pBlock->info.parTbName[0] = 0; } + if (pBlock->info.groupId) { + taosHashPut(pInfo->pGroupIdTbNameMap, &pBlock->info.groupId, sizeof(int64_t), pBlock->info.parTbName, + TSDB_TABLE_NAME_LEN); + } + blockDataDestroy(pSrcBlock); blockDataDestroy(pResBlock); } @@ -1713,7 +1732,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); blockDataFreeRes((SSDataBlock*)pBlock); - calBlockTbName(&pInfo->tbnameCalSup, pInfo->pRes); + calBlockTbName(pInfo, pInfo->pRes); return 0; } @@ -1960,7 +1979,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN) { SSDataBlock* pBlock = doTableScan(pInfo->pTableScanOp); if (pBlock != NULL) { - calBlockTbName(&pInfo->tbnameCalSup, pBlock); + calBlockTbName(pInfo, pBlock); updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); qDebug("stream recover scan get block, rows %d", pBlock->info.rows); return pBlock; @@ -2081,7 +2100,7 @@ FETCH_NEXT_BLOCK: pSDB->info.type = pInfo->scanMode == STREAM_SCAN_FROM_DATAREADER_RANGE ? STREAM_NORMAL : STREAM_PULL_DATA; checkUpdateData(pInfo, true, pSDB, false); // printDataBlock(pSDB, "stream scan update"); - calBlockTbName(&pInfo->tbnameCalSup, pSDB); + calBlockTbName(pInfo, pSDB); return pSDB; } blockDataCleanup(pInfo->pUpdateDataRes); @@ -2386,6 +2405,7 @@ static void destroyStreamScanOperatorInfo(void* param) { } cleanupExprSupp(&pStreamScan->tbnameCalSup); + taosHashCleanup(pStreamScan->pGroupIdTbNameMap); updateInfoDestroy(pStreamScan->pUpdateInfo); blockDataDestroy(pStreamScan->pRes); @@ -2443,6 +2463,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys if (initExprSupp(&pInfo->tbnameCalSup, pSubTableExpr, 1) != 0) { goto _error; } + pInfo->pGroupIdTbNameMap = + taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK); } if (pTableScanNode->pTags != NULL) { diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 0bc76e4084..4360141e74 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -328,7 +328,7 @@ int32_t walEndSnapshot(SWal *pWal) { pInfo++; } if (POINTER_DISTANCE(pInfo, pWal->fileInfoSet->pData) > 0) { - wDebug("vgId:%d, wal end remove from %" PRId64, pWal->cfg.vgId, pInfo->firstVer); + wDebug("vgId:%d, wal end remove for %" PRId64, pWal->cfg.vgId, pInfo->firstVer); } else { wDebug("vgId:%d, wal no remove", pWal->cfg.vgId); } From 201ce10fbc1dd39492c6f159835dc478f34a1050 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 15:45:40 +0800 Subject: [PATCH 089/116] fix: restore wal info changes --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 2 +- source/libs/sync/src/syncMain.c | 4 ++-- source/libs/wal/src/walWrite.c | 2 +- tests/parallel_test/cases.task | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 17bc1526b5..24240e82ef 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -287,7 +287,7 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) { vmReleaseVnode(pMgmt, pVnode); } if (size < 0) { - dError("vgId:%d, can't get size from queue since %s, qtype:%d", vgId, terrstr(), qtype); + dTrace("vgId:%d, can't get size from queue since %s, qtype:%d", vgId, terrstr(), qtype); size = 0; } return size; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 514160235f..42bb500705 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -429,7 +429,7 @@ bool syncIsReadyForRead(int64_t rid) { int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) { if (pSyncNode->peersNum == 0) { - sDebug("only one replica, cannot leader transfer"); + sDebug("vgId:%d, only one replica, cannot leader transfer", pSyncNode->vgId); terrno = TSDB_CODE_SYN_ONE_REPLICA; return -1; } @@ -445,7 +445,7 @@ int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) { int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) { if (pSyncNode->replicaNum == 1) { - sDebug("only one replica, cannot leader transfer"); + sDebug("vgId:%d, only one replica, cannot leader transfer", pSyncNode->vgId); terrno = TSDB_CODE_SYN_ONE_REPLICA; return -1; } diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 317ad129b0..9aa3dabf0c 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -325,7 +325,7 @@ int32_t walEndSnapshot(SWal *pWal) { SWalFileInfo *pInfo = taosArraySearch(pWal->fileInfoSet, &tmp, compareWalFileInfo, TD_LE); if (pInfo) { if (ver >= pInfo->lastVer) { - pInfo++; + pInfo--; } if (POINTER_DISTANCE(pInfo, pWal->fileInfoSet->pData) > 0) { wDebug("vgId:%d, wal end remove from %" PRId64, pWal->cfg.vgId, pInfo->firstVer); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0567f05d55..bb15cef204 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -37,10 +37,10 @@ ,,y,script,./test.sh -f tsim/db/taosdlog.sim ,,,script,./test.sh -f tsim/dnode/balance_replica1.sim ,,,script,./test.sh -f tsim/dnode/balance_replica3.sim -#,,,script,./test.sh -f tsim/dnode/balance1.sim -#,,,script,./test.sh -f tsim/dnode/balance2.sim -#,,,script,./test.sh -f tsim/dnode/balance3.sim -#,,,script,./test.sh -f tsim/dnode/balancex.sim +,,,script,./test.sh -f tsim/dnode/balance1.sim +,,,script,./test.sh -f tsim/dnode/balance2.sim +,,,script,./test.sh -f tsim/dnode/balance3.sim +,,,script,./test.sh -f tsim/dnode/balancex.sim ,,y,script,./test.sh -f tsim/dnode/create_dnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim @@ -55,7 +55,7 @@ ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -#,,,script,./test.sh -f tsim/dnode/vnode_clean.sim +,,,script,./test.sh -f tsim/dnode/vnode_clean.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim @@ -296,7 +296,7 @@ ,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim ,,y,script,./test.sh -f tsim/vnode/replica3_many.sim ,,y,script,./test.sh -f tsim/vnode/replica3_import.sim -#,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim +,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim From 56db6e66300226550f29f992599f7adf0667730f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 16 Nov 2022 15:47:40 +0800 Subject: [PATCH 090/116] fix: omit sma for all NONE/NULL column --- source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 8c1b0004a3..294a4bd3e4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -517,7 +517,7 @@ static int32_t tsdbWriteBlockSma(SDataFWriter *pWriter, SBlockData *pBlockData, for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData); - if ((!pColData->smaOn) || IS_VAR_DATA_TYPE(pColData->type)) continue; + if ((!pColData->smaOn) || IS_VAR_DATA_TYPE(pColData->type) || ((pColData->flag & HAS_VALUE) == 0)) continue; SColumnDataAgg sma = {.colId = pColData->cid}; tColDataCalcSMA[pColData->type](pColData, &sma.sum, &sma.max, &sma.min, &sma.numOfNull); From 84c9b79b4dc55e4a952e3e47dc893ffa56043546 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 16 Nov 2022 16:12:35 +0800 Subject: [PATCH 091/116] fix(sync): fix hb-timer heap-use-after-free --- source/libs/sync/src/syncMain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 514160235f..af033eb7b3 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2059,6 +2059,7 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SyncLocalCmd* pSyncMsg = rpcMsgLocalCmd.pCont; pSyncMsg->cmd = SYNC_LOCAL_CMD_FOLLOWER_CMT; pSyncMsg->fcIndex = pMsg->commitIndex; + SyncIndex fcIndex = pSyncMsg->fcIndex; if (ths->syncEqMsg != NULL && ths->msgcb != NULL) { int32_t code = ths->syncEqMsg(ths->msgcb, &rpcMsgLocalCmd); @@ -2066,7 +2067,7 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) { sError("vgId:%d, sync enqueue fc-commit msg error, code:%d", ths->vgId, code); rpcFreeCont(rpcMsgLocalCmd.pCont); } else { - sTrace("vgId:%d, sync enqueue fc-commit msg, fc-index:%" PRId64, ths->vgId, pSyncMsg->fcIndex); + sTrace("vgId:%d, sync enqueue fc-commit msg, fc-index:%" PRId64, ths->vgId, fcIndex); } } } From 08be4503c938f47a89c791d4de42aba23f3828ed Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 16 Nov 2022 16:25:58 +0800 Subject: [PATCH 092/116] fix: fix query thread stop issue --- source/libs/qworker/src/qworker.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index e45beb7e13..4caa266d8a 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -1191,6 +1191,8 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) { if (QW_QUERY_RUNNING(ctx)) { qwKillTaskHandle(ctx); + } else if (!QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) { + QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP); } QW_UNLOCK(QW_WRITE, &ctx->lock); From c928f03501a909c6625502722950b6b1a29f9387 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 16 Nov 2022 17:02:52 +0800 Subject: [PATCH 093/116] Update 13-schemaless.md --- docs/zh/14-reference/13-schemaless/13-schemaless.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md index b89f625376..3aebd616a0 100644 --- a/docs/zh/14-reference/13-schemaless/13-schemaless.md +++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md @@ -8,6 +8,8 @@ description: 'Schemaless 写入方式,可以免于预先创建超级表/子表 无模式写入方式建立的超级表及其对应的子表与通过 SQL 直接建立的超级表和子表完全没有区别,你也可以通过,SQL 语句直接向其中写入数据。需要注意的是,通过无模式写入方式建立的表,其表名是基于标签值按照固定的映射规则生成,所以无法明确地进行表意,缺乏可读性。 +注意:无模式写入会自动建表,不需要手动建表,手动建表的话可能会出现未知的错误。 + ## 无模式写入行协议 TDengine 的无模式写入的行协议兼容 InfluxDB 的 行协议(Line Protocol)、OpenTSDB 的 telnet 行协议、OpenTSDB 的 JSON 格式协议。但是使用这三种协议的时候,需要在 API 中指定输入内容使用解析协议的标准。 From 9dc37f2622fc22d43e9e5de530c2c4e7a9d83958 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 16 Nov 2022 17:05:20 +0800 Subject: [PATCH 094/116] Update 13-schemaless.md --- docs/en/14-reference/13-schemaless/13-schemaless.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md index 5b7924ce56..10321ab083 100644 --- a/docs/en/14-reference/13-schemaless/13-schemaless.md +++ b/docs/en/14-reference/13-schemaless/13-schemaless.md @@ -8,6 +8,9 @@ will automatically add the required columns to ensure that the data written by t The schemaless writing method creates super tables and their corresponding subtables. These are completely indistinguishable from the super tables and subtables created directly via SQL. You can write data directly to them via SQL statements. Note that the names of tables created by schemaless writing are based on fixed mapping rules for tag values, so they are not explicitly ideographic and they lack readability. +Tips: +The schemaless write will automatically create a table. You do not need to create a table manually, or an unknown error may occur. + ## Schemaless Writing Line Protocol TDengine's schemaless writing line protocol supports InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. However, when using these three protocols, you need to specify in the API the standard of the parsing protocol to be used for the input content. From a0e22ca68191e3178c4d6ee018f9db7f5c9f1edf Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 16 Nov 2022 17:14:02 +0800 Subject: [PATCH 095/116] enh: check function state --- source/libs/function/src/builtinsimpl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 35ad10ffbf..95f01b2127 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2821,6 +2821,8 @@ static void firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowInde if (!pInfo->hasResult) { pInfo->pos = saveTupleData(pCtx, rowIndex, pSrcBlock, NULL); + ASSERT(pCtx->subsidiaries.buf != NULL); + ASSERT(pCtx->subsidiaries.rowLen > 0); } else { updateTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos); } @@ -5111,7 +5113,6 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return pInfo->numSampled; } - bool getTailFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { #if 0 SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); From a115ff12999a27a4760fecf8ce1f005aa85eeb3e Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 17:25:57 +0800 Subject: [PATCH 096/116] fix(query): fix time precision convert overflow TD-20456 --- source/common/src/ttime.c | 35 +++++++++++++++++++++-------- source/libs/function/src/builtins.c | 22 +++++++++++++++++- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 1b140e6c04..721c6a6053 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -436,19 +436,21 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre ASSERT(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || toPrecision == TSDB_TIME_PRECISION_NANO); - double tempResult = (double)utime; - switch (fromPrecision) { case TSDB_TIME_PRECISION_MILLI: { switch (toPrecision) { case TSDB_TIME_PRECISION_MILLI: return utime; case TSDB_TIME_PRECISION_MICRO: - tempResult *= 1000; + if (utime > INT64_MAX / 1000) { + return INT64_MAX; + } utime *= 1000; goto end_; case TSDB_TIME_PRECISION_NANO: - tempResult *= 1000000; + if (utime > INT64_MAX / 1000000) { + return INT64_MAX; + } utime *= 1000000; goto end_; } @@ -460,7 +462,9 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre case TSDB_TIME_PRECISION_MICRO: return utime; case TSDB_TIME_PRECISION_NANO: - tempResult *= 1000; + if (utime > INT64_MAX / 1000) { + return INT64_MAX; + } utime *= 1000; goto end_; } @@ -482,8 +486,6 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } // end switch fromPrecision end_: - if (tempResult >= (double)INT64_MAX) return INT64_MAX; - if (tempResult <= (double)INT64_MIN) return INT64_MIN; // INT64_MIN means NULL return utime; } @@ -599,18 +601,33 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t timePrecision) { switch (unit) { case 's': + if (val > INT64_MAX / MILLISECOND_PER_SECOND) { + return -1; + } (*result) = convertTimePrecision(val * MILLISECOND_PER_SECOND, TSDB_TIME_PRECISION_MILLI, timePrecision); break; case 'm': + if (val > INT64_MAX / MILLISECOND_PER_MINUTE) { + return -1; + } (*result) = convertTimePrecision(val * MILLISECOND_PER_MINUTE, TSDB_TIME_PRECISION_MILLI, timePrecision); break; case 'h': + if (val > INT64_MAX / MILLISECOND_PER_MINUTE) { + return -1; + } (*result) = convertTimePrecision(val * MILLISECOND_PER_HOUR, TSDB_TIME_PRECISION_MILLI, timePrecision); break; case 'd': + if (val > INT64_MAX / MILLISECOND_PER_DAY) { + return -1; + } (*result) = convertTimePrecision(val * MILLISECOND_PER_DAY, TSDB_TIME_PRECISION_MILLI, timePrecision); break; case 'w': + if (val > INT64_MAX / MILLISECOND_PER_WEEK) { + return -1; + } (*result) = convertTimePrecision(val * MILLISECOND_PER_WEEK, TSDB_TIME_PRECISION_MILLI, timePrecision); break; case 'a': @@ -650,7 +667,7 @@ int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* dura /* get the basic numeric value */ int64_t timestamp = taosStr2Int64(token, &endPtr, 10); - if (errno != 0) { + if (timestamp < 0 || errno != 0) { return -1; } @@ -668,7 +685,7 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati /* get the basic numeric value */ *duration = taosStr2Int64(token, NULL, 10); - if (errno != 0) { + if (*duration < 0 || errno != 0) { return -1; } diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f877bef44d..fe010786eb 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -917,6 +917,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err int32_t startIndex; if (numOfParams != 4) { snprintf(errMsg, msgLen, "%s", msg1); + cJSON_Delete(binDesc); return false; } @@ -928,17 +929,20 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { snprintf(errMsg, msgLen, "%s", msg3); + cJSON_Delete(binDesc); return false; } if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 snprintf(errMsg, msgLen, "%s", msg4); + cJSON_Delete(binDesc); return false; } if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { snprintf(errMsg, msgLen, "%s", msg5); + cJSON_Delete(binDesc); return false; } @@ -957,6 +961,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (width->valuedouble == 0) { snprintf(errMsg, msgLen, "%s", msg6); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { @@ -964,6 +969,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (isinf(intervals[startIndex])) { snprintf(errMsg, msgLen, "%s", msg5); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; @@ -973,11 +979,13 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (start->valuedouble == 0) { snprintf(errMsg, msgLen, "%s", msg7); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) { snprintf(errMsg, msgLen, "%s", msg8); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } for (int i = 0; i < counter + 1; ++i) { @@ -985,6 +993,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (isinf(intervals[startIndex])) { snprintf(errMsg, msgLen, "%s", msg5); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } startIndex++; @@ -992,6 +1001,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err } else { snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } @@ -1007,6 +1017,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err } else if (cJSON_IsArray(binDesc)) { /* user input bins */ if (binType != USER_INPUT_BIN) { snprintf(errMsg, msgLen, "%s", msg3); + cJSON_Delete(binDesc); return false; } numOfBins = cJSON_GetArraySize(binDesc); @@ -1015,6 +1026,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (bin == NULL) { snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } int i = 0; @@ -1023,11 +1035,13 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err if (!cJSON_IsNumber(bin)) { snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } if (i != 0 && intervals[i] <= intervals[i - 1]) { snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); + cJSON_Delete(binDesc); return false; } bin = bin->next; @@ -1035,6 +1049,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err } } else { snprintf(errMsg, msgLen, "%s", msg3); + cJSON_Delete(binDesc); return false; } @@ -1464,11 +1479,16 @@ static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t uint8_t colType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); + SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); + SValueNode* pValue1 = (SValueNode*)pParamNode1; if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + if (pValue1->datum.i <= 0) { + return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); + } + SValueNode* pValue = (SValueNode*)pParamNode1; pValue->notReserved = true; From 5f6caecee0712836a4cf923f4ad31592f8c9d130 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 17:31:34 +0800 Subject: [PATCH 097/116] unified return format --- source/common/src/ttime.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 721c6a6053..ecf23c91bd 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -445,14 +445,12 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre if (utime > INT64_MAX / 1000) { return INT64_MAX; } - utime *= 1000; - goto end_; + return utime * 1000; case TSDB_TIME_PRECISION_NANO: if (utime > INT64_MAX / 1000000) { return INT64_MAX; } - utime *= 1000000; - goto end_; + return utime * 1000000; } } // end from milli case TSDB_TIME_PRECISION_MICRO: { @@ -465,8 +463,7 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre if (utime > INT64_MAX / 1000) { return INT64_MAX; } - utime *= 1000; - goto end_; + return utime * 1000; } } // end from micro case TSDB_TIME_PRECISION_NANO: { From 4b9f3cd007d31c6f2f01d51ad77304508e3427e9 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 17:31:34 +0800 Subject: [PATCH 098/116] unified return format --- source/common/src/ttime.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index ecf23c91bd..66d77192bd 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -482,7 +482,6 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } } // end switch fromPrecision -end_: return utime; } From 636b3f6b30d86cb2529c2c6e00489f1fbe379910 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 16 Nov 2022 17:38:49 +0800 Subject: [PATCH 099/116] fix: add sc start/stop instruction to windows installer (#18211) * fix: sc create service in tdengine.iss * fix: upx on windows * fix: add sc start/stop to installer --- packaging/tools/windows_before_install.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packaging/tools/windows_before_install.txt b/packaging/tools/windows_before_install.txt index b793a3e801..ef783bf10b 100644 --- a/packaging/tools/windows_before_install.txt +++ b/packaging/tools/windows_before_install.txt @@ -1,3 +1,6 @@ TDengine is a high-efficient, scalable, high-available distributed time-series database, which makes a lot of optimizations on inserting and querying data, which is far more efficient than normal regular databases. So TDengine can meet the high requirements of IOT and other areas on storing and querying a large amount of data. -TDengine will be installed under C:\TDengine, users can modify configuration file C:\TDengine\cfg\taos.cfg, set the log file path or other parameters. \ No newline at end of file +TDengine will be installed under C:\TDengine, users can modify configuration file C:\TDengine\cfg\taos.cfg, set the log file path or other parameters. +To start/stop TDengine with administrator privileges: sc start/stop taosd +To start/stop taosAdapter with administrator privileges: sc start/stop taosadapter +Please manually remove C:\TDengine from your system PATH environment after you remove TDengine software. From 851888c992d7a1109084f4fd5a10868590f4d898 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 16 Nov 2022 17:31:34 +0800 Subject: [PATCH 100/116] unified return format --- source/common/src/ttime.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 66d77192bd..a106a09a69 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -451,6 +451,9 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre return INT64_MAX; } return utime * 1000000; + default: + ASSERT(0); + return utime; } } // end from milli case TSDB_TIME_PRECISION_MICRO: { @@ -464,6 +467,9 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre return INT64_MAX; } return utime * 1000; + default: + ASSERT(0); + return utime; } } // end from micro case TSDB_TIME_PRECISION_NANO: { @@ -474,10 +480,13 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre return utime / 1000; case TSDB_TIME_PRECISION_NANO: return utime; + default: + ASSERT(0); + return utime; } } // end from nano default: { - assert(0); + ASSERT(0); return utime; // only to pass windows compilation } } // end switch fromPrecision From 0154256507c45c2e6a60a3665c2098c2b32b8583 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 18:13:26 +0800 Subject: [PATCH 101/116] test: add tsan case --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 436f1882b0..4c9715270d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -117,7 +117,7 @@ ,,y,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim ,,y,script,./test.sh -f tsim/parser/function.sim ,,y,script,./test.sh -f tsim/parser/groupby-basic.sim -,,,script,./test.sh -f tsim/parser/groupby.sim +,,y,script,./test.sh -f tsim/parser/groupby.sim ,,y,script,./test.sh -f tsim/parser/having_child.sim ,,y,script,./test.sh -f tsim/parser/having.sim ,,y,script,./test.sh -f tsim/parser/import_commit1.sim From e2005cfa86a6c66603b3b1df80c10bd40277861c Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 16 Nov 2022 18:48:08 +0800 Subject: [PATCH 102/116] fix(stream): skip check update for scalar --- source/dnode/mnode/impl/src/mndSubscribe.c | 4 ++-- source/libs/executor/src/scanoperator.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index fd79846104..58c89d76aa 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -996,7 +996,7 @@ static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)&pConsumerEp->consumerId, false); - mDebug("mnd show subscrptions: topic %s, consumer %" PRId64 "cgroup %s vgid %d", varDataVal(topic), + mDebug("mnd show subscriptions: topic %s, consumer %" PRId64 " cgroup %s vgid %d", varDataVal(topic), pConsumerEp->consumerId, varDataVal(cgroup), pVgEp->vgId); // offset @@ -1044,7 +1044,7 @@ static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, NULL, true); - mDebug("mnd show subscrptions(unassigned): topic %s, cgroup %s vgid %d", varDataVal(topic), varDataVal(cgroup), + mDebug("mnd show subscriptions(unassigned): topic %s, cgroup %s vgid %d", varDataVal(topic), varDataVal(cgroup), pVgEp->vgId); // offset diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c93ca2b3f8..229effc96b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1980,7 +1980,9 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { SSDataBlock* pBlock = doTableScan(pInfo->pTableScanOp); if (pBlock != NULL) { calBlockTbName(pInfo, pBlock); - updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); + if (pInfo->pUpdateInfo) { + updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); + } qDebug("stream recover scan get block, rows %d", pBlock->info.rows); return pBlock; } From 2b5257f9058004e5fd95047ce2d7f768fa76a021 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 20:31:00 +0800 Subject: [PATCH 103/116] fix: memory lead found in asan --- source/libs/wal/src/walMgmt.c | 2 +- source/util/src/terror.c | 7 ++++++- tests/parallel_test/cases.task | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index b78d5ca6c1..5d0f020b02 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -251,7 +251,7 @@ static void walFsyncAll() { int32_t code = taosFsyncFile(pWal->pLogFile); if (code != 0) { wError("vgId:%d, file:%" PRId64 ".log, failed to fsync since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), - strerror(code)); + strerror(errno)); } } pWal = taosIterateRef(tsWal.refSetId, pWal->refId); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index b406432616..43602a607a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -646,7 +646,12 @@ const char* tstrerror(int32_t err) { // this is a system errno if ((err & 0x00ff0000) == 0x00ff0000) { - return strerror(err & 0x0000ffff); + int32_t code = err & 0x0000ffff; + if (code >= 0 && code < 36) { + return strerror(code); + } else { + return "unknown err"; + } } int32_t s = 0; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 4c9715270d..cda3a900df 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -11,7 +11,7 @@ ,,y,script,./test.sh -f tsim/user/privilege_db.sim ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim -,,,script,./test.sh -f tsim/db/alter_replica_13.sim +,,y,script,./test.sh -f tsim/db/alter_replica_13.sim ,,y,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim @@ -176,9 +176,9 @@ ,,y,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim -,,,script,./test.sh -f tsim/mnode/basic1.sim -,,,script,./test.sh -f tsim/mnode/basic2.sim -,,,script,./test.sh -f tsim/mnode/basic3.sim +,,y,script,./test.sh -f tsim/mnode/basic1.sim +,,y,script,./test.sh -f tsim/mnode/basic2.sim +,,y,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim ,,y,script,./test.sh -f tsim/show/basic.sim From d110d4352cc473fec1c6ee719bad4f3f7f893fee Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 16 Nov 2022 21:02:59 +0800 Subject: [PATCH 104/116] fix: memory lead found in asan --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index cda3a900df..48e82f1492 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -55,7 +55,7 @@ ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -,,,script,./test.sh -f tsim/dnode/vnode_clean.sim +,,y,script,./test.sh -f tsim/dnode/vnode_clean.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim @@ -178,7 +178,7 @@ ,,y,script,./test.sh -f tsim/snode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic2.sim -,,y,script,./test.sh -f tsim/mnode/basic3.sim +,,,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim ,,y,script,./test.sh -f tsim/show/basic.sim From a54275a7b502bdbe49db424e9e23fe44ca036de4 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 16 Nov 2022 23:46:59 +0800 Subject: [PATCH 105/116] fix(query): support null columns sma optimization. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 71 +++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index af368d33e0..54a0ee6c32 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -88,6 +88,7 @@ typedef struct SBlockLoadSuppInfo { int16_t* colIds; // column ids for loading file block data int32_t numOfCols; char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated. + bool smaValid; // the sma on all queried columns are activated } SBlockLoadSuppInfo; typedef struct SLastBlockReader { @@ -213,11 +214,10 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); } -static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) { - SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; - +static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SSDataBlock* pBlock) { size_t numOfCols = blockDataGetNumOfCols(pBlock); + pSupInfo->smaValid = true; pSupInfo->numOfCols = numOfCols; pSupInfo->colIds = taosMemoryMalloc(numOfCols * sizeof(int16_t)); pSupInfo->buildBuf = taosMemoryCalloc(numOfCols, POINTER_BYTES); @@ -239,6 +239,28 @@ static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) { return TSDB_CODE_SUCCESS; } +static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) { + int32_t i = 0, j = 0; + + while(i < pSchema->numOfCols && j < pSupInfo->numOfCols) { + STColumn* pTCol = &pSchema->columns[i]; + if (pTCol->colId == pSupInfo->colIds[j]) { + if (!IS_BSMA_ON(pTCol)) { + pSupInfo->smaValid = false; + return; + } + + i += 1; + j += 1; + } else if (pTCol->colId < pSupInfo->colIds[j]) { + // do nothing + i += 1; + } else { + ASSERT(0); + } + } +} + static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) { int32_t num = numOfTables / pBuf->numPerBucket; int32_t remainder = numOfTables % pBuf->numPerBucket; @@ -580,7 +602,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd // allocate buffer in order to load data blocks from file SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - pSup->pColAgg = taosArrayInit(4, sizeof(SColumnDataAgg)); + pSup->pColAgg = taosArrayInit(pCond->numOfCols, sizeof(SColumnDataAgg)); pSup->plist = taosMemoryCalloc(pCond->numOfCols, POINTER_BYTES); if (pSup->pColAgg == NULL || pSup->plist == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -601,7 +623,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd goto _end; } - setColumnIdSlotList(pReader, pReader->pResBlock); + setColumnIdSlotList(&pReader->suppInfo, pReader->pResBlock); *ppReader = pReader; return code; @@ -3763,6 +3785,10 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL } } + if (pReader->pSchema != NULL) { + updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); + } + STsdbReader* p = pReader->innerReader[0] != NULL ? pReader->innerReader[0] : pReader; pReader->status.pTableMap = createDataBlockScanInfo(p, pTableList, numOfTables); @@ -4020,7 +4046,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS } // there is no statistics data for composed block - if (pReader->status.composedDataBlock) { + if (pReader->status.composedDataBlock || (!pReader->suppInfo.smaValid)) { *pBlockStatis = NULL; return TSDB_CODE_SUCCESS; } @@ -4060,7 +4086,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS int32_t i = 0, j = 0; size_t size = taosArrayGetSize(pSup->pColAgg); - +#if 0 while (j < numOfCols && i < size) { SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i); if (pAgg->colId == pSup->colIds[j]) { @@ -4068,6 +4094,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS pSup->plist[j] = pAgg; } else { *allHave = false; + break; } i += 1; j += 1; @@ -4077,12 +4104,40 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS j += 1; } } +#else + + // fill the all null data column + SArray* pNewAggList = taosArrayInit(numOfCols, sizeof(SColumnDataAgg)); + + while (j < numOfCols && i < size) { + SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i); + if (pAgg->colId == pSup->colIds[j]) { + taosArrayPush(pNewAggList, pAgg); + i += 1; + j += 1; + } else if (pAgg->colId < pSup->colIds[j]) { + i += 1; + } else if (pSup->colIds[j] < pAgg->colId) { + // all date in this block are null + SColumnDataAgg nullColAgg = {.colId = pSup->colIds[j], .numOfNull = pBlock->nRow}; + taosArrayPush(pNewAggList, &nullColAgg); + j += 1; + } + } + + taosArrayClear(pSup->pColAgg); + taosArrayAddAll(pSup->pColAgg, pNewAggList); + + for(int32_t k = 0; k < numOfCols; ++k) { + pSup->plist[k] = taosArrayGet(pSup->pColAgg, k); + } + +#endif pReader->cost.smaDataLoad += 1; *pBlockStatis = pSup->plist; tsdbDebug("vgId:%d, succeed to load block SMA for uid %" PRIu64 ", %s", 0, pFBlock->uid, pReader->idStr); - return code; } From 9c459a24e22932b0f7628f291a978683a3fc7fbb Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 17 Nov 2022 00:38:35 +0800 Subject: [PATCH 106/116] fix(query): fix memory leak. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 54a0ee6c32..1f200ea5d7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4132,6 +4132,8 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS pSup->plist[k] = taosArrayGet(pSup->pColAgg, k); } + taosArrayDestroy(pNewAggList); + #endif pReader->cost.smaDataLoad += 1; From a464053692a622e10c6023bb42b1c4a9bcc3466c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 17 Nov 2022 00:46:06 +0800 Subject: [PATCH 107/116] fix(query): set correct size of array list. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 1f200ea5d7..986cba8b17 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4128,7 +4128,8 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS taosArrayClear(pSup->pColAgg); taosArrayAddAll(pSup->pColAgg, pNewAggList); - for(int32_t k = 0; k < numOfCols; ++k) { + size_t num = taosArrayGetSize(pSup->pColAgg); + for(int32_t k = 0; k < num; ++k) { pSup->plist[k] = taosArrayGet(pSup->pColAgg, k); } From a2f3eeb6f7d69ea487115cd42b954a21e39f855f Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 17 Nov 2022 08:47:03 +0800 Subject: [PATCH 108/116] fix test cases --- tests/script/tsim/parser/function.sim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index ec9cdf2666..7f69aa2d02 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -821,10 +821,10 @@ sql insert into tm0 values('2015-08-18T00:18:00Z', 2.126) ('2015-08-18T00:24:00Z sql_error select derivative(ts) from tm0; sql_error select derivative(k) from tm0; -sql select derivative(k, 0, 0) from tm0; +sql_error select derivative(k, 0, 0) from tm0; sql_error select derivative(k, 1, 911) from tm0; sql_error select derivative(kx, 1s, 1) from tm0; -sql select derivative(k, -20s, 1) from tm0; +sql_error select derivative(k, -20s, 1) from tm0; sql select derivative(k, 20a, 0) from tm0; sql select derivative(k, 200a, 0) from tm0; sql select derivative(k, 999a, 0) from tm0; @@ -932,7 +932,7 @@ sql insert into t0 values('2020-1-1 1:4:10', 10); sql insert into t1 values('2020-1-1 1:1:2', 2); print ===========================>td-4739 -sql select diff(val) from (select derivative(k, 1s, 0) val from t1); +sql select diff(val) from (select ts, derivative(k, 1s, 0) val from t1); if $rows != 0 then return -1 endi @@ -1077,4 +1077,4 @@ endi if $data11 != NULL then print ======data11=$data11 return -1 -endi \ No newline at end of file +endi From 00937a7fc8efa9d5fb106bc2b642e027cf1bf449 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Nov 2022 09:06:09 +0800 Subject: [PATCH 109/116] fix:[ASAN] src/builtinsimpl.c:1084:41: runtime error: division by zero --- source/libs/function/src/builtinsimpl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index e57b9f9a34..23abf90b51 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1083,7 +1083,10 @@ int32_t avgFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SAvgRes* pAvgRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); int32_t type = pAvgRes->type; - if (IS_SIGNED_NUMERIC_TYPE(type)) { + if (pAvgRes->count == 0) { + // [ASAN] runtime error: division by zero + GET_RES_INFO(pCtx)->numOfRes = 0; + } else if (IS_SIGNED_NUMERIC_TYPE(type)) { pAvgRes->result = pAvgRes->sum.isum / ((double)pAvgRes->count); } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { pAvgRes->result = pAvgRes->sum.usum / ((double)pAvgRes->count); From d906c44c16803d53b76ab16e367cd709661eda71 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 17 Nov 2022 09:24:29 +0800 Subject: [PATCH 110/116] fix: memory leak in while balance vgroup --- source/dnode/mnode/impl/src/mndVgroup.c | 1 + tests/parallel_test/cases.task | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index e00d0d955e..9d3b86c79b 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1907,6 +1907,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) { } _OVER: + taosHashCleanup(pBalancedVgroups); mndTransDrop(pTrans); return code; } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 48e82f1492..7115e12252 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -55,7 +55,7 @@ ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -,,y,script,./test.sh -f tsim/dnode/vnode_clean.sim +,,,script,./test.sh -f tsim/dnode/vnode_clean.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim ,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim @@ -176,8 +176,8 @@ ,,y,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim -,,y,script,./test.sh -f tsim/mnode/basic1.sim -,,y,script,./test.sh -f tsim/mnode/basic2.sim +,,,script,./test.sh -f tsim/mnode/basic1.sim +,,,script,./test.sh -f tsim/mnode/basic2.sim ,,,script,./test.sh -f tsim/mnode/basic3.sim ,,,script,./test.sh -f tsim/mnode/basic4.sim ,,,script,./test.sh -f tsim/mnode/basic5.sim From 5161eca70fd77425f316c302cebfe9fff42670fb Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 17 Nov 2022 09:48:34 +0800 Subject: [PATCH 111/116] fix(stream): stop scan when no output --- include/libs/stream/tstreamUpdate.h | 2 +- source/libs/executor/src/scanoperator.c | 4 +++- source/libs/stream/src/streamExec.c | 7 ++++++- source/libs/stream/src/streamUpdate.c | 7 ++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/libs/stream/tstreamUpdate.h b/include/libs/stream/tstreamUpdate.h index 1c490852f9..ab328c6ad5 100644 --- a/include/libs/stream/tstreamUpdate.h +++ b/include/libs/stream/tstreamUpdate.h @@ -47,7 +47,7 @@ typedef struct SUpdateInfo { SUpdateInfo *updateInfoInitP(SInterval *pInterval, int64_t watermark); SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark); -void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol); +TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol); bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts); bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid); void updateInfoSetScanRange(SUpdateInfo *pInfo, STimeWindow *pWin, uint64_t groupId, uint64_t version); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 229effc96b..05ccda26c6 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1981,9 +1981,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { if (pBlock != NULL) { calBlockTbName(pInfo, pBlock); if (pInfo->pUpdateInfo) { - updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); + TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); } qDebug("stream recover scan get block, rows %d", pBlock->info.rows); + printDataBlock(pBlock, "scan recover"); return pBlock; } pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__NONE; diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index e7f2b60704..009f7eec9a 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -91,6 +91,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { void* exec = pTask->exec.executor; qSetStreamOpOpen(exec); + bool finished = false; while (1) { SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock)); @@ -106,7 +107,10 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { if (qExecTask(exec, &output, &ts) < 0) { ASSERT(0); } - if (output == NULL) break; + if (output == NULL) { + finished = true; + break; + } SSDataBlock block = {0}; assignOneDataBlock(&block, output); @@ -133,6 +137,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { streamDispatch(pTask); } + if (finished) break; } return 0; } diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 199892c241..15526cd8bb 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -163,9 +163,9 @@ bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) { return false; } -void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) { - if (pBlock == NULL || pBlock->info.rows == 0) return; - TSKEY maxTs = -1; +TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) { + if (pBlock == NULL || pBlock->info.rows == 0) return INT64_MIN; + TSKEY maxTs = INT64_MIN; int64_t tbUid = pBlock->info.uid; SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol); @@ -186,6 +186,7 @@ void updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t pr if (pMaxTs == NULL || *pMaxTs > maxTs) { taosHashPut(pInfo->pMap, &tbUid, sizeof(int64_t), &maxTs, sizeof(TSKEY)); } + return maxTs; } bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) { From ad78407ea78d009f6e7b7a3c3cf22ffc4abd9703 Mon Sep 17 00:00:00 2001 From: wenzhouwww Date: Thu, 17 Nov 2022 11:14:14 +0800 Subject: [PATCH 112/116] test: modify test case --- tests/system-test/7-tmq/tmqShow.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/system-test/7-tmq/tmqShow.py b/tests/system-test/7-tmq/tmqShow.py index 5e79f17459..8ec5e62ad9 100644 --- a/tests/system-test/7-tmq/tmqShow.py +++ b/tests/system-test/7-tmq/tmqShow.py @@ -135,12 +135,21 @@ class TDTestCase: if rows != len(topicNameList): tdLog.exit("show consumers rows error") - tdLog.info("check show subscriptions") - tdSql.query("show subscriptions") - tdLog.debug(tdSql.queryResult) - rows = tdSql.getRows() - expectSubscriptions = paraDict['vgroups'] * len(topicNameList) - tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions)) + for i in range(0, 10, 1): + tdLog.info("check show subscriptions") + tdSql.query("show subscriptions") + tdLog.debug(tdSql.queryResult) + rows = tdSql.getRows() + expectSubscriptions = paraDict['vgroups'] * len(topicNameList) + tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions)) + if rows != expectSubscriptions: + # tdLog.exit("show subscriptions rows error") + tdLog.info("continue retry[%d] to show subscriptions"%(i)) + time.sleep(1) + continue + else: + break + if rows != expectSubscriptions: tdLog.exit("show subscriptions rows error") From 507aa0c7f8b159fed9afd7858ebf3a7f0efb3ccd Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Nov 2022 13:35:23 +0800 Subject: [PATCH 113/116] fix:fill operator core --- source/libs/executor/src/executorimpl.c | 3 +- source/libs/executor/src/timewindowoperator.c | 2 + tests/script/tsim/parser/fill.sim | 99 +++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 39e876800f..cf890ac3d7 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1994,8 +1994,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp int32_t scanFlag = MAIN_SCAN; getTableScanInfo(pOperator, &order, &scanFlag); - int64_t ekey = - Q_STATUS_EQUAL(pTaskInfo->status, TASK_COMPLETED) ? pInfo->win.ekey : pInfo->existNewGroupBlock->info.window.ekey; + int64_t ekey = pInfo->existNewGroupBlock->info.window.ekey; taosResetFillInfo(pInfo->pFillInfo, getFillInfoStart(pInfo->pFillInfo)); blockDataCleanup(pInfo->pRes); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 87b4ed4c4a..fe29b8eda9 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -4898,6 +4898,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { if (pMiaInfo->groupId == 0) { if (pMiaInfo->groupId != pBlock->info.groupId) { pMiaInfo->groupId = pBlock->info.groupId; + pRes->info.groupId = pMiaInfo->groupId; } } else { if (pMiaInfo->groupId != pBlock->info.groupId) { @@ -4911,6 +4912,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { break; } else { // continue + pRes->info.groupId = pMiaInfo->groupId; } } diff --git a/tests/script/tsim/parser/fill.sim b/tests/script/tsim/parser/fill.sim index ea0311ebde..463328a019 100644 --- a/tests/script/tsim/parser/fill.sim +++ b/tests/script/tsim/parser/fill.sim @@ -1049,4 +1049,103 @@ print =============== clear # return -1 #endi + +print ============== fill + +sql drop database if exists test; +sql create database test vgroups 4; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql insert into t1 values(1648712211000,1,2,3); +sql insert into t1 values(1648712225000,2,2,3); +sql insert into t2 values(1648712212000,1,2,3); +sql insert into t2 values(1648712226000,2,2,3); + +$loop_count = 0 + +loop0: +sleep 200 + +sql select count(*) from(select count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(value, -1)); + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +if $data00 != 20026 then + print =====data00=$data00 + goto loop0 +endi + +if $data10 != 20026 then + print =====data10=$data10 + goto loop0 +endi + +sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(prev); + +if $rows != 40052 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(next); + +if $rows != 40052 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(linear); + +if $rows != 40052 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(NULL); + +if $rows != 40052 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(value, -1); + +if $rows != 20026 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(NULL); + +if $rows != 20026 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(prev); + +if $rows != 20026 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(next); + +if $rows != 20026 then + print =====rows=$rows + return -1 +endi + +sql select _wstart, count(a) from t1 where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(linear); + +if $rows != 20026 then + print =====rows=$rows + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT From effc38d21715536662abf204ef0c2775ecc9b1a2 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 17 Nov 2022 14:51:32 +0800 Subject: [PATCH 114/116] fix(sync): fix asan error, use rid in hbdata and syncnode --- source/libs/sync/inc/syncEnv.h | 5 ++++ source/libs/sync/inc/syncInt.h | 8 ++++-- source/libs/sync/src/syncEnv.c | 34 +++++++++++++++++++++++++ source/libs/sync/src/syncMain.c | 45 ++++++++++++++++++++++++++++----- 4 files changed, 84 insertions(+), 8 deletions(-) diff --git a/source/libs/sync/inc/syncEnv.h b/source/libs/sync/inc/syncEnv.h index 628e8874b4..04e8e5edd4 100644 --- a/source/libs/sync/inc/syncEnv.h +++ b/source/libs/sync/inc/syncEnv.h @@ -57,6 +57,11 @@ void syncNodeRemove(int64_t rid); SSyncNode* syncNodeAcquire(int64_t rid); void syncNodeRelease(SSyncNode* pNode); +int64_t syncHbTimerDataAdd(SSyncHbTimerData* pData); +void syncHbTimerDataRemove(int64_t rid); +SSyncHbTimerData* syncHbTimerDataAcquire(int64_t rid); +void syncHbTimerDataRelease(SSyncHbTimerData* pData); + #ifdef __cplusplus } #endif diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 362618fece..57f52c7d88 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -57,10 +57,11 @@ typedef struct SRaftId { } SRaftId; typedef struct SSyncHbTimerData { - SSyncNode* pSyncNode; + int64_t syncNodeRid; SSyncTimer* pTimer; SRaftId destId; uint64_t logicClock; + int64_t rid; } SSyncHbTimerData; typedef struct SSyncTimer { @@ -70,7 +71,7 @@ typedef struct SSyncTimer { uint64_t counter; int32_t timerMS; SRaftId destId; - SSyncHbTimerData hbData; + int64_t hbDataRid; } SSyncTimer; typedef struct SElectTimerParam { @@ -189,6 +190,8 @@ typedef struct SSyncNode { int64_t leaderTime; int64_t lastReplicateTime; + bool isStart; + } SSyncNode; // open/close -------------- @@ -198,6 +201,7 @@ void syncNodeStartStandBy(SSyncNode* pSyncNode); void syncNodeClose(SSyncNode* pSyncNode); void syncNodePreClose(SSyncNode* pSyncNode); int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak); +void syncHbTimerDataFree(SSyncHbTimerData* pData); // on message --------------------- int32_t syncNodeOnTimeout(SSyncNode* ths, const SRpcMsg* pMsg); diff --git a/source/libs/sync/src/syncEnv.c b/source/libs/sync/src/syncEnv.c index 2abc8c0b7f..43685f6496 100644 --- a/source/libs/sync/src/syncEnv.c +++ b/source/libs/sync/src/syncEnv.c @@ -20,6 +20,7 @@ static SSyncEnv gSyncEnv = {0}; static int32_t gNodeRefId = -1; +static int32_t gHbDataRefId = -1; static void syncEnvTick(void *param, void *tmrId); SSyncEnv *syncEnv() { return &gSyncEnv; } @@ -50,6 +51,13 @@ int32_t syncInit() { return -1; } + gHbDataRefId = taosOpenRef(200, (RefFp)syncHbTimerDataFree); + if (gHbDataRefId < 0) { + sError("failed to init hb-data ref"); + syncCleanUp(); + return -1; + } + sDebug("sync rsetId:%d is open", gNodeRefId); return 0; } @@ -64,6 +72,12 @@ void syncCleanUp() { taosCloseRef(gNodeRefId); gNodeRefId = -1; } + + if (gHbDataRefId != -1) { + sDebug("sync rsetId:%d is closed", gHbDataRefId); + taosCloseRef(gHbDataRefId); + gHbDataRefId = -1; + } } int64_t syncNodeAdd(SSyncNode *pNode) { @@ -88,6 +102,26 @@ SSyncNode *syncNodeAcquire(int64_t rid) { void syncNodeRelease(SSyncNode *pNode) { taosReleaseRef(gNodeRefId, pNode->rid); } +int64_t syncHbTimerDataAdd(SSyncHbTimerData *pData) { + pData->rid = taosAddRef(gHbDataRefId, pData); + if (pData->rid < 0) return -1; + return pData->rid; +} + +void syncHbTimerDataRemove(int64_t rid) { taosRemoveRef(gHbDataRefId, rid); } + +SSyncHbTimerData *syncHbTimerDataAcquire(int64_t rid) { + SSyncHbTimerData *pData = taosAcquireRef(gHbDataRefId, rid); + if (pData == NULL) { + sError("failed to acquire hb-timer-data from refId:%" PRId64, rid); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + } + + return pData; +} + +void syncHbTimerDataRelease(SSyncHbTimerData *pData) { taosReleaseRef(gHbDataRefId, pData->rid); } + #if 0 void syncEnvStartTimer() { taosTmrReset(gSyncEnv.FpEnvTickTimer, gSyncEnv.envTickTimerMS, &gSyncEnv, gSyncEnv.pTimerManager, diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 0370b3c5b1..369847b672 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -91,6 +91,7 @@ void syncStart(int64_t rid) { void syncStop(int64_t rid) { SSyncNode* pSyncNode = syncNodeAcquire(rid); if (pSyncNode != NULL) { + pSyncNode->isStart = false; syncNodeRelease(pSyncNode); syncNodeRemove(rid); } @@ -665,13 +666,20 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa static int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { int32_t ret = 0; if (syncIsInit()) { - SSyncHbTimerData* pData = &pSyncTimer->hbData; - pData->pSyncNode = pSyncNode; + SSyncHbTimerData* pData = syncHbTimerDataAcquire(pSyncTimer->hbDataRid); + if (pData == NULL) { + pData = taosMemoryMalloc(sizeof(SSyncHbTimerData)); + pData->rid = syncHbTimerDataAdd(pData); + } + pSyncTimer->hbDataRid = pData->rid; + + pData->syncNodeRid = pSyncNode->rid; pData->pTimer = pSyncTimer; pData->destId = pSyncTimer->destId; pData->logicClock = pSyncTimer->logicClock; - taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer); + taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, (void*)(pData->rid), syncEnv()->pTimerManager, + &pSyncTimer->pTimer); } else { sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId); } @@ -683,6 +691,8 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { atomic_add_fetch_64(&pSyncTimer->logicClock, 1); taosTmrStop(pSyncTimer->pTimer); pSyncTimer->pTimer = NULL; + syncHbTimerDataRemove(pSyncTimer->hbDataRid); + pSyncTimer->hbDataRid = -1; return ret; } @@ -960,6 +970,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // snapshotting atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID); + pSyncNode->isStart = true; sNTrace(pSyncNode, "sync open"); return pSyncNode; @@ -1027,6 +1038,8 @@ void syncNodePreClose(SSyncNode* pSyncNode) { syncNodeStopHeartbeatTimer(pSyncNode); } +void syncHbTimerDataFree(SSyncHbTimerData* pData) { taosMemoryFree(pData); } + void syncNodeClose(SSyncNode* pSyncNode) { if (pSyncNode == NULL) { return; @@ -1929,19 +1942,36 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { } static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { - SSyncHbTimerData* pData = (SSyncHbTimerData*)param; - SSyncNode* pSyncNode = pData->pSyncNode; - SSyncTimer* pSyncTimer = pData->pTimer; + int64_t hbDataRid = (int64_t)param; + SSyncHbTimerData* pData = syncHbTimerDataAcquire(hbDataRid); + if (pData == NULL) { + return; + } + + SSyncNode* pSyncNode = syncNodeAcquire(pData->syncNodeRid); if (pSyncNode == NULL) { + syncHbTimerDataRelease(pData); + return; + } + + SSyncTimer* pSyncTimer = pData->pTimer; + + if (!pSyncNode->isStart) { + syncNodeRelease(pSyncNode); + syncHbTimerDataRelease(pData); return; } if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { + syncNodeRelease(pSyncNode); + syncHbTimerDataRelease(pData); return; } if (pSyncNode->pRaftStore == NULL) { + syncNodeRelease(pSyncNode); + syncHbTimerDataRelease(pData); return; } @@ -1978,6 +2008,9 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { msgLogicClock); } } + + syncHbTimerDataRelease(pData); + syncNodeRelease(pSyncNode); } static int32_t syncNodeEqNoop(SSyncNode* pNode) { From 04c59ea5b33cf0c98a66446bc82eaea84481e861 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 17 Nov 2022 16:09:27 +0800 Subject: [PATCH 115/116] fix: limit doc error --- docs/en/12-taos-sql/19-limit.md | 4 ++-- docs/zh/12-taos-sql/19-limit.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en/12-taos-sql/19-limit.md b/docs/en/12-taos-sql/19-limit.md index 678c38a22e..f00ec90f57 100644 --- a/docs/en/12-taos-sql/19-limit.md +++ b/docs/en/12-taos-sql/19-limit.md @@ -23,7 +23,7 @@ The following characters cannot occur in a password: single quotation marks ('), ## General Limits -- Maximum length of database name is 32 bytes +- Maximum length of database name is 64 bytes - Maximum length of table name is 192 bytes, excluding the database name prefix and the separator. - Maximum length of each data row is 48K bytes. Note that the upper limit includes the extra 2 bytes consumed by each column of BINARY/NCHAR type. - The maximum length of a column name is 64 bytes. @@ -35,7 +35,7 @@ The following characters cannot occur in a password: single quotation marks ('), - Maximum numbers of databases, STables, tables are dependent only on the system resources. - The number of replicas can only be 1 or 3. - The maximum length of a username is 23 bytes. -- The maximum length of a password is 15 bytes. +- The maximum length of a password is 128 bytes. - The maximum number of rows depends on system resources. - The maximum number of vnodes in a database is 1024. diff --git a/docs/zh/12-taos-sql/19-limit.md b/docs/zh/12-taos-sql/19-limit.md index a9743addda..7b6692f1b7 100644 --- a/docs/zh/12-taos-sql/19-limit.md +++ b/docs/zh/12-taos-sql/19-limit.md @@ -24,19 +24,19 @@ description: 合法字符集和命名中的限制规则 ## 一般限制 -- 数据库名最大长度为 32 -- 表名最大长度为 192,不包括数据库名前缀和分隔符 +- 数据库名最大长度为 64 字节 +- 表名最大长度为 192 字节,不包括数据库名前缀和分隔符 - 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置) -- 列名最大长度为 64 +- 列名最大长度为 64 字节 - 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。 -- 标签名最大长度为 64 +- 标签名最大长度为 64 字节 - 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB - SQL 语句最大长度 1048576 个字符 - SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错 - 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制 - 数据库的副本数只能设置为 1 或 3 -- 用户名的最大长度是 23 个字节 -- 用户密码的最大长度是 15 个字节 +- 用户名的最大长度是 23 字节 +- 用户密码的最大长度是 128 字节 - 总数据行数取决于可用资源 - 单个数据库的虚拟结点数上限为 1024 From 09c76fed2d7cd5bb5876fc91a30e5dfdcf2b02c3 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Thu, 17 Nov 2022 18:05:19 +0800 Subject: [PATCH 116/116] TD-20478: update coverage test script --- tests/script/coverage_test.sh | 258 ++++++++++++++++------------------ 1 file changed, 123 insertions(+), 135 deletions(-) diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh index 457c9eae20..3983f533da 100755 --- a/tests/script/coverage_test.sh +++ b/tests/script/coverage_test.sh @@ -10,7 +10,8 @@ else fi today=`date +"%Y%m%d"` -TDENGINE_DIR=/root/pxiao/TDengine +TDENGINE_DIR=/root/TDengine +JDBC_DIR=/root/taos-connector-jdbc TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log # Color setting @@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m' GREEN_UNDERLINE='\033[4;32m' NC='\033[0m' -function buildTDengine { +function buildTDengine() { echo "check if TDengine need build" cd $TDENGINE_DIR git remote prune origin > /dev/null @@ -33,159 +34,145 @@ function buildTDengine { # reset counter lcov -d . --zerocounters - if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then echo "repo up-to-date" else echo "repo need to pull" fi - git reset --hard - git checkout -- . - git checkout $branch + git reset --hard + git checkout -- . + git checkout $branch + git checkout -- . git clean -dfx - git pull - git submodule update --init --recursive -f + git pull [ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug cd $TDENGINE_DIR/debug - echo "rebuild.." + echo "rebuild.." LOCAL_COMMIT=`git rev-parse --short @` rm -rf * if [ "$branch" == "3.0" ]; then echo "3.0 =============" - cmake -DCOVER=true -DBUILD_TEST=true .. + cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true .. else cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null fi - make -j4 + make -j make install } -function runGeneralCaseOneByOne { +function runCasesOneByOne () { while read -r line; do - if [[ $line =~ ^./test.sh* ]]; then - case=`echo $line | grep sim$ | awk '{print $NF}'` - - if [ -n "$case" ]; then - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && ./test.sh -f $case > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ - || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - fi + cmd=`echo $line | cut -d',' -f 5` + if [[ "$2" == "sim" ]] && [[ $cmd == *"test.sh"* ]]; then + case=`echo $cmd | cut -d' ' -f 3` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ + || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "system-test" ]] && [[ $line == *"system-test"* ]]; then + case=`echo $cmd | cut -d' ' -f 4` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "develop-test" ]] && [[ $line == *"develop-test"* ]]; then + case=`echo $cmd | cut -d' ' -f 4` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT fi done < $1 } -function runTestNGCaseOneByOne { - while read -r line; do - if [[ $line =~ ^taostest* ]]; then - case=`echo $line | cut -d' ' -f 3 | cut -d'=' -f 2` - yaml=`echo $line | cut -d' ' -f 2` - - if [ -n "$case" ]; then - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && taostest $yaml --case=$case --keep --disable_collection > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ - || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - fi - fi - done < $1 +function runUnitTest() { + echo "=== Run unit test case ===" + echo " $TDENGINE_DIR/debug" + cd $TDENGINE_DIR/debug + ctest -j12 + echo "3.0 unit test done" } -function runTest { - echo "run Test" - - if [ "$branch" == "3.0" ]; then - echo "start run unit test case ................" - echo " $TDENGINE_DIR/debug " - cd $TDENGINE_DIR/debug - ctest -j12 - echo "3.0 unit test done" - fi - +function runSimCases() { + echo "=== Run sim cases ===" + cd $TDENGINE_DIR/tests/script - - [ -d ../../sim ] && rm -rf ../../sim - [ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT - - runGeneralCaseOneByOne jenkins/basic.txt - - sed -i "1i\SIM cases test result" $TDENGINE_COVERAGE_REPORT - - totalSuccess=`grep 'success' $TDENGINE_COVERAGE_REPORT | wc -l` + runCasesOneByOne ../parallel_test/cases.task sim + + totalSuccess=`grep 'sim success' $TDENGINE_COVERAGE_REPORT | wc -l` if [ "$totalSuccess" -gt "0" ]; then - sed -i -e "2i\ ### Total $totalSuccess SIM test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT + echo "### Total $totalSuccess SIM test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - totalFailed=`grep 'failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` + totalFailed=`grep 'sim failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` if [ "$totalFailed" -ne "0" ]; then - sed -i "3i\### Total $totalFailed SIM test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT + echo "### Total $totalFailed SIM test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - sed "3G" $TDENGINE_COVERAGE_REPORT +} - stopTaosd - echo "run TestNG cases" - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 & - sleep 10 - cd $TDENGINE_DIR/../TestNG/cases - runTestNGCaseOneByOne ../scripts/cases.txt - echo "TestNG cases done" +function runPythonCases() { + echo "=== Run python cases ===" + + cd $TDENGINE_DIR/tests/system-test + runCasesOneByOne ../parallel_test/cases.task system-test - cd $TDENGINE_DIR/tests - rm -rf ../sim - /root/pxiao/test-all-coverage.sh full python $branch | tee -a $TDENGINE_COVERAGE_REPORT - - - sed -i "4i\Python cases test result" $TDENGINE_COVERAGE_REPORT - totalPySuccess=`grep 'python case(s) succeed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'` - if [ "$totalPySuccess" -gt "0" ]; then - sed -i -e "5i\ ### Total $totalPySuccess Python test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT - fi + cd $TDENGINE_DIR/tests/develop-test + runCasesOneByOne ../parallel_test/cases.task develop-test - totalPyFailed=`grep 'python case(s) failed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'` - if [ -z $totalPyFailed ]; then - sed -i "6i\\n" $TDENGINE_COVERAGE_REPORT - else - sed -i "6i\### Total $totalPyFailed Python test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT - fi - - echo "### run JDBC test cases ###" | tee -a $TDENGINE_COVERAGE_REPORT - # Test Connector - stopTaosd - nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 & - sleep 10 - - cd $TDENGINE_DIR/src/connector/jdbc - mvn clean package > /dev/null 2>&1 - mvn test > jdbc-out.log 2>&1 - tail -n 20 jdbc-out.log 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT - - # Test C Demo - stopTaosd - $TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null & - sleep 10 - yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT - - # Test waltest - dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'` - walDir=`find $dataDir -name "wal"|head -n1` - echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT - echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT - if [ -n "$walDir" ]; then - yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT + totalSuccess=`grep 'py success' $TDENGINE_COVERAGE_REPORT | wc -l` + if [ "$totalSuccess" -gt "0" ]; then + echo "### Total $totalSuccess python test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - # run Unit Test - echo "Run Unit Test: utilTest, queryTest and cliTest" - #$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!" - #$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!" - #$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!" + totalFailed=`grep 'py failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` + if [ "$totalFailed" -ne "0" ]; then + echo "### Total $totalFailed python test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT + fi +} + +function runJDBCCases() { + echo "=== Run JDBC cases ===" + + cd $JDBC_DIR + git checkout -- . + git reset --hard HEAD + git checkout main + git pull stopTaosd + stopTaosadapter + taosd -c /etc/taos >> /dev/null 2>&1 & + taosadapter >> /dev/null 2>&1 & + + mvn clean test > result.txt 2>&1 + summary=`grep "Tests run:" result.txt | tail -n 1` + echo -e "### JDBC test result: $summary ###" | tee -a $TDENGINE_COVERAGE_REPORT +} + +function runTest() { + echo "run Test" + + cd $TDENGINE_DIR + [ -d sim ] && rm -rf sim + [ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT + + runUnitTest + runSimCases + runPythonCases + runJDBCCases + + stopTaosd cd $TDENGINE_DIR/tests/script find . -name '*.sql' | xargs rm -f @@ -203,15 +190,18 @@ function lcovFunc { # remove exclude paths if [ "$branch" == "3.0" ]; then lcov --remove coverage.info \ - '*/contrib/*' '*/tests/*' '*/test/*'\ - '*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c'\ + '*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\ + '*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\ '*/texpr.c' '*/runUdf.c' '*/schDbg.c' '*/syncIO.c' '*/tdbOs.c' '*/pushServer.c' '*/osLz4.c'\ - '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\ - '*/tthread.c' '*/tversion.c'\ + '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\ + '*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/shellAuto.c' '*/shellTire.c'\ + '*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' '*/catalog.c'\ + '*/tqSnapshot.c' '*/tsdbSnapshot.c''*/metaSnapshot.c' '*/smaSnapshot.c' '*/tqOffsetSnapshot.c'\ + '*/vnodeSnapshot.c' '*/metaSnapshot.c' '*/tsdbSnapshot.c' '*/mndGrant.c' '*/mndSnode.c' '*/streamRecover.c'\ --rc lcov_branch_coverage=1 -o coverage.info else lcov --remove coverage.info \ - '*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c'\ + '*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c' '*/clientJniConnector.c'\ --rc lcov_branch_coverage=1 -o coverage.info fi @@ -257,35 +247,33 @@ function stopTaosd { echo "Stop tasod end" } -function runTestRandomFail { - exec_random_fail_sh=$1 - default_exec_sh=$TDENGINE_DIR/tests/script/sh/exec.sh - [ -f $exec_random_fail_sh ] && cp $exec_random_fail_sh $default_exec_sh || exit 1 +function stopTaosadapter { + echo "Stop taosadapter" + systemctl stop taosadapter.service + PID=`ps -ef|grep -w taosadapter | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosadapter + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done + echo "Stop tasoadapter end" - dnodes_random_fail_py=$TDENGINE_DIR/tests/pytest/util/dnodes-no-random-fail.py - default_dnodes_py=$TDENGINE_DIR/tests/pytest/util/dnodes.py - [ -f $dnodes_random_fail_py ] && cp $dnodes_random_fail_py $default_dnodes_py || exit 1 - - runTest NoRandomFail } -WORK_DIR=/root/pxiao +WORK_DIR=/root/ date >> $WORK_DIR/cron.log echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log stopTaosd + buildTDengine - -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-random-fail.sh -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-default.sh -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-no-random-fail.sh - runTest - lcovFunc -#sendReport + +sendReport stopTaosd date >> $WORK_DIR/cron.log -echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log +echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log \ No newline at end of file