Merge branch '3.0' into feature/TD-13041

This commit is contained in:
wangmm0220 2022-07-14 10:22:15 +08:00
commit 3b4c2826b4
140 changed files with 3564 additions and 5443 deletions

View File

@ -98,10 +98,10 @@ int32_t create_stream() {
/*const char* sql = "select min(k), max(k), sum(k) as sum_of_k from st1";*/ /*const char* sql = "select min(k), max(k), sum(k) as sum_of_k from st1";*/
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/ /*const char* sql = "select sum(k) from tu1 interval(10m)";*/
/*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/ /*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
pRes = taos_query( pRes =
pConn, taos_query(pConn,
"create stream stream1 trigger max_delay 10s into outstb as select _wstartts, sum(k) from st1 partition " "create stream stream1 trigger max_delay 10s into outstb as select _wstart, sum(k) from st1 partition "
"by tbname session(ts, 10s) "); "by tbname session(ts, 10s) ");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
printf("failed to create stream stream1, reason:%s\n", taos_errstr(pRes)); printf("failed to create stream stream1, reason:%s\n", taos_errstr(pRes));
return -1; return -1;

View File

@ -213,63 +213,64 @@
#define TK_NK_ARROW 195 #define TK_NK_ARROW 195
#define TK_ROWTS 196 #define TK_ROWTS 196
#define TK_TBNAME 197 #define TK_TBNAME 197
#define TK_QSTARTTS 198 #define TK_QSTART 198
#define TK_QENDTS 199 #define TK_QEND 199
#define TK_WSTARTTS 200 #define TK_QDURATION 200
#define TK_WENDTS 201 #define TK_WSTART 201
#define TK_WDURATION 202 #define TK_WEND 202
#define TK_CAST 203 #define TK_WDURATION 203
#define TK_NOW 204 #define TK_CAST 204
#define TK_TODAY 205 #define TK_NOW 205
#define TK_TIMEZONE 206 #define TK_TODAY 206
#define TK_CLIENT_VERSION 207 #define TK_TIMEZONE 207
#define TK_SERVER_VERSION 208 #define TK_CLIENT_VERSION 208
#define TK_SERVER_STATUS 209 #define TK_SERVER_VERSION 209
#define TK_CURRENT_USER 210 #define TK_SERVER_STATUS 210
#define TK_COUNT 211 #define TK_CURRENT_USER 211
#define TK_LAST_ROW 212 #define TK_COUNT 212
#define TK_BETWEEN 213 #define TK_LAST_ROW 213
#define TK_IS 214 #define TK_BETWEEN 214
#define TK_NK_LT 215 #define TK_IS 215
#define TK_NK_GT 216 #define TK_NK_LT 216
#define TK_NK_LE 217 #define TK_NK_GT 217
#define TK_NK_GE 218 #define TK_NK_LE 218
#define TK_NK_NE 219 #define TK_NK_GE 219
#define TK_MATCH 220 #define TK_NK_NE 220
#define TK_NMATCH 221 #define TK_MATCH 221
#define TK_CONTAINS 222 #define TK_NMATCH 222
#define TK_JOIN 223 #define TK_CONTAINS 223
#define TK_INNER 224 #define TK_JOIN 224
#define TK_SELECT 225 #define TK_INNER 225
#define TK_DISTINCT 226 #define TK_SELECT 226
#define TK_WHERE 227 #define TK_DISTINCT 227
#define TK_PARTITION 228 #define TK_WHERE 228
#define TK_BY 229 #define TK_PARTITION 229
#define TK_SESSION 230 #define TK_BY 230
#define TK_STATE_WINDOW 231 #define TK_SESSION 231
#define TK_SLIDING 232 #define TK_STATE_WINDOW 232
#define TK_FILL 233 #define TK_SLIDING 233
#define TK_VALUE 234 #define TK_FILL 234
#define TK_NONE 235 #define TK_VALUE 235
#define TK_PREV 236 #define TK_NONE 236
#define TK_LINEAR 237 #define TK_PREV 237
#define TK_NEXT 238 #define TK_LINEAR 238
#define TK_HAVING 239 #define TK_NEXT 239
#define TK_RANGE 240 #define TK_HAVING 240
#define TK_EVERY 241 #define TK_RANGE 241
#define TK_ORDER 242 #define TK_EVERY 242
#define TK_SLIMIT 243 #define TK_ORDER 243
#define TK_SOFFSET 244 #define TK_SLIMIT 244
#define TK_LIMIT 245 #define TK_SOFFSET 245
#define TK_OFFSET 246 #define TK_LIMIT 246
#define TK_ASC 247 #define TK_OFFSET 247
#define TK_NULLS 248 #define TK_ASC 248
#define TK_ID 249 #define TK_NULLS 249
#define TK_NK_BITNOT 250 #define TK_ID 250
#define TK_VALUES 251 #define TK_NK_BITNOT 251
#define TK_IMPORT 252 #define TK_VALUES 252
#define TK_NK_SEMI 253 #define TK_IMPORT 253
#define TK_FILE 254 #define TK_NK_SEMI 254
#define TK_FILE 255
#define TK_NK_SPACE 300 #define TK_NK_SPACE 300
#define TK_NK_COMMENT 301 #define TK_NK_COMMENT 301

View File

@ -34,7 +34,7 @@ typedef enum EFunctionType {
FUNCTION_TYPE_ELAPSED, FUNCTION_TYPE_ELAPSED,
FUNCTION_TYPE_IRATE, FUNCTION_TYPE_IRATE,
FUNCTION_TYPE_LAST_ROW, FUNCTION_TYPE_LAST_ROW,
FUNCTION_TYPE_LAST_ROWT, //TODO: removed FUNCTION_TYPE_LAST_ROWT, // TODO: removed
FUNCTION_TYPE_MAX, FUNCTION_TYPE_MAX,
FUNCTION_TYPE_MIN, FUNCTION_TYPE_MIN,
FUNCTION_TYPE_MODE, FUNCTION_TYPE_MODE,
@ -114,10 +114,11 @@ typedef enum EFunctionType {
// pseudo column function // pseudo column function
FUNCTION_TYPE_ROWTS = 3500, FUNCTION_TYPE_ROWTS = 3500,
FUNCTION_TYPE_TBNAME, FUNCTION_TYPE_TBNAME,
FUNCTION_TYPE_QSTARTTS, FUNCTION_TYPE_QSTART,
FUNCTION_TYPE_QENDTS, FUNCTION_TYPE_QEND,
FUNCTION_TYPE_WSTARTTS, FUNCTION_TYPE_QDURATION,
FUNCTION_TYPE_WENDTS, FUNCTION_TYPE_WSTART,
FUNCTION_TYPE_WEND,
FUNCTION_TYPE_WDURATION, FUNCTION_TYPE_WDURATION,
// internal function // internal function
@ -197,6 +198,7 @@ bool fmIsInterpFunc(int32_t funcId);
bool fmIsLastRowFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId);
bool fmIsSystemInfoFunc(int32_t funcId); bool fmIsSystemInfoFunc(int32_t funcId);
bool fmIsImplicitTsFunc(int32_t funcId); bool fmIsImplicitTsFunc(int32_t funcId);
bool fmIsClientPseudoColumnFunc(int32_t funcId);
int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc);

View File

@ -228,7 +228,7 @@ typedef struct SFillNode {
ENodeType type; // QUERY_NODE_FILL ENodeType type; // QUERY_NODE_FILL
EFillMode mode; EFillMode mode;
SNode* pValues; // SNodeListNode SNode* pValues; // SNodeListNode
SNode* pWStartTs; // _wstartts pseudo column SNode* pWStartTs; // _wstart pseudo column
STimeWindow timeRange; STimeWindow timeRange;
} SFillNode; } SFillNode;
@ -248,6 +248,7 @@ typedef struct SSelectStmt {
SNodeList* pOrderByList; // SOrderByExprNode SNodeList* pOrderByList; // SOrderByExprNode
SLimitNode* pLimit; SLimitNode* pLimit;
SLimitNode* pSlimit; SLimitNode* pSlimit;
STimeWindow timeRange;
char stmtName[TSDB_TABLE_NAME_LEN]; char stmtName[TSDB_TABLE_NAME_LEN];
uint8_t precision; uint8_t precision;
int32_t selectFuncNum; int32_t selectFuncNum;

View File

@ -181,6 +181,7 @@ typedef struct SRequestSendRecvBody {
tsem_t rspSem; // not used now tsem_t rspSem; // not used now
__taos_async_fn_t queryFp; __taos_async_fn_t queryFp;
__taos_async_fn_t fetchFp; __taos_async_fn_t fetchFp;
EQueryExecMode execMode;
void* param; void* param;
SDataBuf requestMsg; SDataBuf requestMsg;
int64_t queryJob; // query job, created according to sql query DAG. int64_t queryJob; // query job, created according to sql query DAG.

View File

@ -153,7 +153,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
*pRequest = createRequest(connId, TSDB_SQL_SELECT); *pRequest = createRequest(connId, TSDB_SQL_SELECT);
if (*pRequest == NULL) { if (*pRequest == NULL) {
tscError("failed to malloc sqlObj, %s", sql); tscError("failed to malloc sqlObj, %s", sql);
return TSDB_CODE_TSC_OUT_OF_MEMORY; return terrno;
} }
(*pRequest)->sqlstr = taosMemoryMalloc(sqlLen + 1); (*pRequest)->sqlstr = taosMemoryMalloc(sqlLen + 1);
@ -933,6 +933,8 @@ SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool vali
void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta) { void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta) {
int32_t code = 0; int32_t code = 0;
pRequest->body.execMode = pQuery->execMode;
switch (pQuery->execMode) { switch (pQuery->execMode) {
case QUERY_EXEC_MODE_LOCAL: case QUERY_EXEC_MODE_LOCAL:
asyncExecLocalCmd(pRequest, pQuery); asyncExecLocalCmd(pRequest, pQuery);
@ -1149,7 +1151,6 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
SRequestObj* pRequest = createRequest(pTscObj->id, TDMT_MND_CONNECT); SRequestObj* pRequest = createRequest(pTscObj->id, TDMT_MND_CONNECT);
if (pRequest == NULL) { if (pRequest == NULL) {
destroyTscObj(pTscObj); destroyTscObj(pTscObj);
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
return NULL; return NULL;
} }

View File

@ -49,7 +49,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
} }
// this function may be called by user or system, or by both simultaneously. // this function may be called by user or system, or by both simultaneously.
void taos_cleanup(void) { void taos_cleanup(void) {
tscInfo("start to cleanup client environment"); tscDebug("start to cleanup client environment");
if (atomic_val_compare_exchange_32(&sentinel, TSC_VAR_NOT_RELEASE, TSC_VAR_RELEASED) != TSC_VAR_NOT_RELEASE) { if (atomic_val_compare_exchange_32(&sentinel, TSC_VAR_NOT_RELEASE, TSC_VAR_RELEASED) != TSC_VAR_NOT_RELEASE) {
return; return;
} }
@ -58,7 +58,10 @@ void taos_cleanup(void) {
clientReqRefPool = -1; clientReqRefPool = -1;
taosCloseRef(id); taosCloseRef(id);
cleanupTaskQueue(); hbMgrCleanUp();
catalogDestroy();
schedulerDestroy();
fmFuncMgtDestroy(); fmFuncMgtDestroy();
qCleanupKeywordsTable(); qCleanupKeywordsTable();
@ -67,12 +70,11 @@ void taos_cleanup(void) {
clientConnRefPool = -1; clientConnRefPool = -1;
taosCloseRef(id); taosCloseRef(id);
hbMgrCleanUp();
catalogDestroy();
schedulerDestroy();
rpcCleanup(); rpcCleanup();
tscDebug("rpc cleanup");
cleanupTaskQueue();
tscInfo("all local resources released"); tscInfo("all local resources released");
taosCleanupCfg(); taosCleanupCfg();
taosCloseLog(); taosCloseLog();
@ -852,27 +854,24 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
} }
// all data has returned to App already, no need to try again // all data has returned to App already, no need to try again
if (pResultInfo->completed && (pRequest->body.queryJob != 0)) { if (pResultInfo->completed) {
pResultInfo->numOfRows = 0; // it is a local executed query, no need to do async fetch
if (QUERY_EXEC_MODE_LOCAL == pRequest->body.execMode) {
ASSERT(pResultInfo->numOfRows >= 0);
if (pResultInfo->localResultFetched) {
pResultInfo->numOfRows = 0;
pResultInfo->current = 0;
} else {
pResultInfo->localResultFetched = true;
}
} else {
pResultInfo->numOfRows = 0;
}
pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows); pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
return; return;
} }
// it is a local executed query, no need to do async fetch
if (pRequest->body.queryJob == 0) {
ASSERT(pResultInfo->completed && pResultInfo->numOfRows >= 0);
if (pResultInfo->localResultFetched) {
pResultInfo->numOfRows = 0;
pResultInfo->current = 0;
pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
} else {
pResultInfo->localResultFetched = true;
pRequest->body.fetchFp(param, pRequest, pResultInfo->numOfRows);
}
return;
}
SSchedulerReq req = { SSchedulerReq req = {
.syncReq = false, .syncReq = false,
.fetchFp = fetchCallback, .fetchFp = fetchCallback,

View File

@ -1174,8 +1174,6 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows)
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) { int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
int32_t code = 0; int32_t code = 0;
// ASSERT(numOfRows > 0);
if (numOfRows == 0) { if (numOfRows == 0) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -138,7 +138,7 @@ void *tsdbGetIdx(SMeta *pMeta);
void *tsdbGetIvtIdx(SMeta *pMeta); void *tsdbGetIvtIdx(SMeta *pMeta);
int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader); int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader);
int32_t tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds); int32_t tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray* pTableUids);
int32_t tsdbLastrowReaderClose(void *pReader); int32_t tsdbLastrowReaderClose(void *pReader);
int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid);

View File

@ -107,7 +107,7 @@ int32_t tsdbLastrowReaderClose(void* pReader) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t* slotIds) { int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t* slotIds, SArray* pTableUidList) {
if (pReader == NULL || pResBlock == NULL) { if (pReader == NULL || pResBlock == NULL) {
return TSDB_CODE_INVALID_PARA; return TSDB_CODE_INVALID_PARA;
} }
@ -144,14 +144,15 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t
// appended or not. // appended or not.
if (internalResult) { if (internalResult) {
pResBlock->info.rows -= 1; pResBlock->info.rows -= 1;
taosArrayClear(pTableUidList);
} }
saveOneRow(pRow, pResBlock, pr, slotIds); saveOneRow(pRow, pResBlock, pr, slotIds);
taosArrayPush(pTableUidList, &pKeyInfo->uid);
internalResult = true; internalResult = true;
lastKey = pRow->ts; lastKey = pRow->ts;
} }
// taosMemoryFree(pRow);
tsdbCacheRelease(lruCache, h); tsdbCacheRelease(lruCache, h);
} }
} else if (pr->type == LASTROW_RETRIEVE_TYPE_ALL) { } else if (pr->type == LASTROW_RETRIEVE_TYPE_ALL) {
@ -174,6 +175,7 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t
// tsdbCacheLastArray2Row(pLast, &pRow, pr->pSchema); // tsdbCacheLastArray2Row(pLast, &pRow, pr->pSchema);
saveOneRow(pRow, pResBlock, pr, slotIds); saveOneRow(pRow, pResBlock, pr, slotIds);
taosArrayPush(pTableUidList, &pKeyInfo->uid);
// taosMemoryFree(pRow); // taosMemoryFree(pRow);
tsdbCacheRelease(lruCache, h); tsdbCacheRelease(lruCache, h);

View File

@ -234,6 +234,7 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) {
} }
taosArrayDestroy(p->delSkyline); taosArrayDestroy(p->delSkyline);
taosArrayDestroy(p->pBlockList);
p->delSkyline = NULL; p->delSkyline = NULL;
} }
@ -302,9 +303,9 @@ static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) {
STimeWindow win = {0}; STimeWindow win = {0};
while (1) { while (1) {
// if (pReader->pFileReader != NULL) { if (pReader->pFileReader != NULL) {
// tsdbDataFReaderClose(&pReader->pFileReader); tsdbDataFReaderClose(&pReader->pFileReader);
// } }
pReader->status.pCurrentFileset = (SDFileSet*)taosArrayGet(pIter->pFileList, pIter->index); pReader->status.pCurrentFileset = (SDFileSet*)taosArrayGet(pIter->pFileList, pIter->index);
@ -696,12 +697,14 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, uint32_
void* p = taosArrayPush(pScanInfo->pBlockList, &block); void* p = taosArrayPush(pScanInfo->pBlockList, &block);
if (p == NULL) { if (p == NULL) {
tMapDataClear(&mapData);
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
(*numOfBlocks) += 1; (*numOfBlocks) += 1;
} }
tMapDataClear(&mapData);
if (pScanInfo->pBlockList != NULL && taosArrayGetSize(pScanInfo->pBlockList) > 0) { if (pScanInfo->pBlockList != NULL && taosArrayGetSize(pScanInfo->pBlockList) > 0) {
(*numOfValidTables) += 1; (*numOfValidTables) += 1;
} }
@ -1308,6 +1311,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
pReader->idStr); pReader->idStr);
pBlockIter->index = asc ? 0 : (numOfBlocks - 1); pBlockIter->index = asc ? 0 : (numOfBlocks - 1);
cleanupBlockOrderSupporter(&sup);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1990,6 +1995,7 @@ static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pRead
static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) { static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
SReaderStatus* pStatus = &pReader->status; SReaderStatus* pStatus = &pReader->status;
SArray* pIndexList = taosArrayInit(4, sizeof(SBlockIdx));
while (1) { while (1) {
bool hasNext = filesetIteratorNext(&pStatus->fileIter, pReader); bool hasNext = filesetIteratorNext(&pStatus->fileIter, pReader);
@ -1997,9 +2003,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
break; break;
} }
SArray* pIndexList = taosArrayInit(4, sizeof(SBlockIdx)); taosArrayClear(pIndexList);
int32_t code = doLoadBlockIndex(pReader, pReader->pFileReader, pIndexList); int32_t code = doLoadBlockIndex(pReader, pReader->pFileReader, pIndexList);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
taosArrayDestroy(pIndexList);
return code; return code;
} }
@ -2007,6 +2014,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
uint32_t numOfValidTable = 0; uint32_t numOfValidTable = 0;
code = doLoadFileBlock(pReader, pIndexList, &numOfValidTable, numOfBlocks); code = doLoadFileBlock(pReader, pIndexList, &numOfValidTable, numOfBlocks);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
taosArrayDestroy(pIndexList);
return code; return code;
} }
@ -2014,10 +2022,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) {
break; break;
} }
} }
// no blocks in current file, try next files // no blocks in current file, try next files
} }
taosArrayDestroy(pIndexList);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -3081,10 +3089,13 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa
SDataBlockIter* pBlockIter = &pStatus->blockIter; SDataBlockIter* pBlockIter = &pStatus->blockIter;
pTableBlockInfo->numOfFiles += pStatus->fileIter.numOfFiles; pTableBlockInfo->numOfFiles += pStatus->fileIter.numOfFiles;
pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks;
if (pBlockIter->numOfBlocks > 0) {
pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks;
}
pTableBlockInfo->numOfTables = numOfTables; pTableBlockInfo->numOfTables = numOfTables;
bool hasNext = true; bool hasNext = (pBlockIter->numOfBlocks > 0);
while (true) { while (true) {
if (hasNext) { if (hasNext) {

View File

@ -1293,7 +1293,7 @@ void catalogDestroy(void) {
if (!taosCheckCurrentInDll()) { if (!taosCheckCurrentInDll()) {
ctgClearCacheEnqueue(NULL, true, true, true); ctgClearCacheEnqueue(NULL, true, true, true);
taosThreadJoin(gCtgMgmt.updateThread, NULL); taosThreadJoin(gCtgMgmt.updateThread, NULL);
} }
taosHashCleanup(gCtgMgmt.pCluster); taosHashCleanup(gCtgMgmt.pCluster);

View File

@ -322,6 +322,7 @@ typedef struct SLastrowScanInfo {
void *pLastrowReader; void *pLastrowReader;
SArray *pColMatchInfo; SArray *pColMatchInfo;
int32_t *pSlotIds; int32_t *pSlotIds;
SExprSupp pseudoExprSup;
} SLastrowScanInfo; } SLastrowScanInfo;
typedef enum EStreamScanMode { typedef enum EStreamScanMode {
@ -790,6 +791,8 @@ int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaul
void doSetOperatorCompleted(SOperatorInfo* pOperator); void doSetOperatorCompleted(SOperatorInfo* pOperator);
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock);
int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr,
SSDataBlock* pBlock, const char* idStr);
void cleanupAggSup(SAggSupporter* pAggSup); void cleanupAggSup(SAggSupporter* pAggSup);
void destroyBasicOperatorInfo(void* param, int32_t numOfOutput); void destroyBasicOperatorInfo(void* param, int32_t numOfOutput);

View File

@ -45,20 +45,20 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead
int32_t numOfCols = 0; int32_t numOfCols = 0;
pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->pScanCols, pScanNode->node.pOutputDataBlockDesc, &numOfCols, pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->pScanCols, pScanNode->node.pOutputDataBlockDesc, &numOfCols,
COL_MATCH_FROM_COL_ID); COL_MATCH_FROM_COL_ID);
int32_t* pCols = taosMemoryMalloc(numOfCols * sizeof(int32_t));
for (int32_t i = 0; i < taosArrayGetSize(pInfo->pColMatchInfo); ++i) {
SColMatchInfo* pColMatch = taosArrayGet(pInfo->pColMatchInfo, i);
pCols[i] = pColMatch->colId;
}
int32_t code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds); int32_t code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
goto _error; goto _error;
} }
tsdbLastRowReaderOpen(readHandle->vnode, LASTROW_RETRIEVE_TYPE_ALL, pTableList, taosArrayGetSize(pInfo->pColMatchInfo), tsdbLastRowReaderOpen(readHandle->vnode, LASTROW_RETRIEVE_TYPE_SINGLE, pTableList, taosArrayGetSize(pInfo->pColMatchInfo),
&pInfo->pLastrowReader); &pInfo->pLastrowReader);
taosMemoryFree(pCols);
if (pScanNode->pScanPseudoCols != NULL) {
SExprSupp* pPseudoExpr = &pInfo->pseudoExprSup;
pPseudoExpr->pExprInfo = createExprInfo(pScanNode->pScanPseudoCols, NULL, &pPseudoExpr->numOfExprs);
pPseudoExpr->pCtx = createSqlFunctionCtx(pPseudoExpr->pExprInfo, pPseudoExpr->numOfExprs, &pPseudoExpr->rowEntryInfoOffset);
}
pOperator->name = "LastrowScanOperator"; pOperator->name = "LastrowScanOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN;
@ -100,7 +100,20 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
// check if it is a group by tbname // check if it is a group by tbname
if (size == taosArrayGetSize(pInfo->pTableList)) { if (size == taosArrayGetSize(pInfo->pTableList)) {
blockDataCleanup(pInfo->pRes); blockDataCleanup(pInfo->pRes);
tsdbRetrieveLastRow(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds); SArray* pUidList = taosArrayInit(1, sizeof(tb_uid_t));
int32_t code = tsdbRetrieveLastRow(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pUidList);
if (code != TSDB_CODE_SUCCESS) {
longjmp(pTaskInfo->env, code);
}
// check for tag values
if (pInfo->pRes->info.rows > 0 && pInfo->pseudoExprSup.numOfExprs > 0) {
SExprSupp* pSup = &pInfo->pseudoExprSup;
pInfo->pRes->info.uid = *(tb_uid_t*) taosArrayGet(pUidList, 0);
addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, GET_TASKID(pTaskInfo));
}
doSetOperatorCompleted(pOperator);
return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes; return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes;
} else { } else {
// todo fetch the result for each group // todo fetch the result for each group

View File

@ -1483,8 +1483,8 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
} else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) { } else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) {
// do nothing, todo refactor // do nothing, todo refactor
} else { } else {
// expand the result into multiple rows. E.g., _wstartts, top(k, 20) // expand the result into multiple rows. E.g., _wstart, top(k, 20)
// the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows. // the _wstart needs to copy to 20 following rows, since the results of top-k expands to 20 different rows.
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, slotId);
char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo); char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo);
for (int32_t k = 0; k < pRow->numOfRows; ++k) { for (int32_t k = 0; k < pRow->numOfRows; ++k) {
@ -1555,8 +1555,8 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
} else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) { } else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) {
// do nothing, todo refactor // do nothing, todo refactor
} else { } else {
// expand the result into multiple rows. E.g., _wstartts, top(k, 20) // expand the result into multiple rows. E.g., _wstart, top(k, 20)
// the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows. // the _wstart needs to copy to 20 following rows, since the results of top-k expands to 20 different rows.
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, slotId); SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, slotId);
char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo); char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo);
if (pCtx[j].increase) { if (pCtx[j].increase) {
@ -3475,9 +3475,12 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
static void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) { static void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) {
for (int32_t i = 0; i < numOfExprs; ++i) { for (int32_t i = 0; i < numOfExprs; ++i) {
SExprInfo* pExprInfo = &pExpr[i]; SExprInfo* pExprInfo = &pExpr[i];
if (pExprInfo->pExpr->nodeType == QUERY_NODE_COLUMN) { for(int32_t j = 0; j < pExprInfo->base.numOfParams; ++j) {
taosMemoryFree(pExprInfo->base.pParam[0].pCol); if (pExprInfo->base.pParam[j].type == FUNC_PARAM_TYPE_COLUMN) {
taosMemoryFreeClear(pExprInfo->base.pParam[j].pCol);
}
} }
taosMemoryFree(pExprInfo->base.pParam); taosMemoryFree(pExprInfo->base.pParam);
taosMemoryFree(pExprInfo->pExpr); taosMemoryFree(pExprInfo->pExpr);
} }
@ -3685,10 +3688,20 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param); taosMemoryFreeClear(param);
} }
static void freeItem(void* pItem) {
void** p = pItem;
if (*p != NULL) {
taosMemoryFreeClear(*p);
}
}
void destroyAggOperatorInfo(void* param, int32_t numOfOutput) { void destroyAggOperatorInfo(void* param, int32_t numOfOutput) {
SAggOperatorInfo* pInfo = (SAggOperatorInfo*)param; SAggOperatorInfo* pInfo = (SAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo); cleanupBasicInfo(&pInfo->binfo);
cleanupAggSup(&pInfo->aggSup);
taosArrayDestroyEx(pInfo->groupResInfo.pRows, freeItem);
taosMemoryFreeClear(param); taosMemoryFreeClear(param);
} }
@ -4334,6 +4347,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTaskInfo->code = code; pTaskInfo->code = code;
return NULL; return NULL;
} }
code = extractTableSchemaInfo(pHandle, pTableScanNode->scan.uid, pTaskInfo); code = extractTableSchemaInfo(pHandle, pTableScanNode->scan.uid, pTaskInfo);
if (code) { if (code) {
pTaskInfo->code = terrno; pTaskInfo->code = terrno;
@ -4349,7 +4363,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) { } else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) {
return createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo); return createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) { } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) {
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode; STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
STimeWindowAggSupp twSup = { STimeWindowAggSupp twSup = {

View File

@ -39,8 +39,6 @@ static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capac
static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size, static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size,
const char* dbName); const char* dbName);
static int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr,
SSDataBlock* pBlock, const char* idStr);
static bool processBlockWithProbability(const SSampleExecInfo* pInfo); static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
bool processBlockWithProbability(const SSampleExecInfo* pInfo) { bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
@ -198,12 +196,6 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
pCost->skipBlocks += 1; pCost->skipBlocks += 1;
// clear all data in pBlock that are set when handing the previous block
for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); ++i) {
SColumnInfoData* pcol = taosArrayGet(pBlock->pDataBlock, i);
pcol->pData = NULL;
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) { } else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) {
pCost->loadBlockStatis += 1; pCost->loadBlockStatis += 1;
@ -320,8 +312,6 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
int32_t dstSlotId = pExpr->base.resSchema.slotId; int32_t dstSlotId = pExpr->base.resSchema.slotId;
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId); SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId);
colInfoDataEnsureCapacity(pColInfoData, pBlock->info.rows);
colInfoDataCleanup(pColInfoData, pBlock->info.rows); colInfoDataCleanup(pColInfoData, pBlock->info.rows);
int32_t functionId = pExpr->pExpr->_function.functionId; int32_t functionId = pExpr->pExpr->_function.functionId;
@ -1157,10 +1147,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
SOperatorInfo* pOperator = pInfo->pStreamScanOp; SOperatorInfo* pOperator = pInfo->pStreamScanOp;
SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo;
blockDataEnsureCapacity(pInfo->pRes, pBlock->info.rows);
pInfo->pRes->info.rows = pBlock->info.rows; pInfo->pRes->info.rows = pBlock->info.rows;
pInfo->pRes->info.uid = pBlock->info.uid; pInfo->pRes->info.uid = pBlock->info.uid;
pInfo->pRes->info.type = STREAM_NORMAL; pInfo->pRes->info.type = STREAM_NORMAL;
pInfo->pRes->info.capacity = pBlock->info.rows;
uint64_t* groupIdPre = taosHashGet(pOperator->pTaskInfo->tableqinfoList.map, &pBlock->info.uid, sizeof(int64_t)); uint64_t* groupIdPre = taosHashGet(pOperator->pTaskInfo->tableqinfoList.map, &pBlock->info.uid, sizeof(int64_t));
if (groupIdPre) { if (groupIdPre) {
@ -1186,7 +1177,10 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
for (int32_t j = 0; j < blockDataGetNumOfCols(pBlock); ++j) { for (int32_t j = 0; j < blockDataGetNumOfCols(pBlock); ++j) {
SColumnInfoData* pResCol = bdGetColumnInfoData(pBlock, j); SColumnInfoData* pResCol = bdGetColumnInfoData(pBlock, j);
if (pResCol->info.colId == pColMatchInfo->colId) { if (pResCol->info.colId == pColMatchInfo->colId) {
taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, pResCol);
SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId);
colDataAssign(pDst, pResCol, pBlock->info.rows, &pInfo->pRes->info);
// taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, pResCol);
colExists = true; colExists = true;
break; break;
} }
@ -2396,6 +2390,7 @@ int32_t createScanTableListInfo(STableScanPhysiNode* pTableScanNode, SReadHandle
qDebug("no table qualified for query, TID:0x%" PRIx64 ", QID:0x%" PRIx64, taskId, queryId); qDebug("no table qualified for query, TID:0x%" PRIx64 ", QID:0x%" PRIx64, taskId, queryId);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
pTableListInfo->needSortTableByGroupId = pTableScanNode->groupSort; pTableListInfo->needSortTableByGroupId = pTableScanNode->groupSort;
code = generateGroupIdMap(pTableListInfo, pHandle, pTableScanNode->pGroupTags); code = generateGroupIdMap(pTableListInfo, pHandle, pTableScanNode->pGroupTags);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
@ -2569,9 +2564,11 @@ static SSDataBlock* getTableDataBlock(void* param) {
SDataBlockInfo binfo = pBlock->info; SDataBlockInfo binfo = pBlock->info;
tsdbRetrieveDataBlockInfo(reader, &binfo); tsdbRetrieveDataBlockInfo(reader, &binfo);
binfo.capacity = binfo.rows; blockDataEnsureCapacity(pBlock, binfo.rows);
blockDataEnsureCapacity(pBlock, binfo.capacity); pBlock->info.type = binfo.type;
pBlock->info = binfo; pBlock->info.uid = binfo.uid;
pBlock->info.window = binfo.window;
pBlock->info.rows = binfo.rows;
uint32_t status = 0; uint32_t status = 0;
int32_t code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, readerIdx, pBlock, &status); int32_t code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, readerIdx, pBlock, &status);
@ -2598,11 +2595,19 @@ static SSDataBlock* getTableDataBlock(void* param) {
return NULL; return NULL;
} }
SArray* generateSortByTsInfo(int32_t order) { SArray* generateSortByTsInfo(SArray* colMatchInfo, int32_t order) {
int32_t tsTargetSlotId = 0;
for (int32_t i = 0; i < taosArrayGetSize(colMatchInfo); ++i) {
SColMatchInfo* colInfo = taosArrayGet(colMatchInfo, i);
if (colInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
tsTargetSlotId = colInfo->targetSlotId;
}
}
SArray* pList = taosArrayInit(1, sizeof(SBlockOrderInfo)); SArray* pList = taosArrayInit(1, sizeof(SBlockOrderInfo));
SBlockOrderInfo bi = {0}; SBlockOrderInfo bi = {0};
bi.order = order; bi.order = order;
bi.slotId = 0; bi.slotId = tsTargetSlotId;
bi.nullFirst = NULL_ORDER_FIRST; bi.nullFirst = NULL_ORDER_FIRST;
taosArrayPush(pList, &bi); taosArrayPush(pList, &bi);
@ -2851,7 +2856,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
pInfo->sortSourceParams = taosArrayInit(64, sizeof(STableMergeScanSortSourceParam)); pInfo->sortSourceParams = taosArrayInit(64, sizeof(STableMergeScanSortSourceParam));
pInfo->pSortInfo = generateSortByTsInfo(pInfo->cond.order); pInfo->pSortInfo = generateSortByTsInfo(pInfo->pColMatchInfo, pInfo->cond.order);
pInfo->pSortInputBlock = createOneDataBlock(pInfo->pResBlock, false); pInfo->pSortInputBlock = createOneDataBlock(pInfo->pResBlock, false);
int32_t rowSize = pInfo->pResBlock->info.rowSize; int32_t rowSize = pInfo->pResBlock->info.rowSize;

View File

@ -1600,7 +1600,7 @@ static bool timeWindowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols, SInt
} }
void increaseTs(SqlFunctionCtx* pCtx) { void increaseTs(SqlFunctionCtx* pCtx) {
if (pCtx[0].pExpr->pExpr->_function.pFunctNode->funcType == FUNCTION_TYPE_WSTARTTS) { if (pCtx[0].pExpr->pExpr->_function.pFunctNode->funcType == FUNCTION_TYPE_WSTART) {
pCtx[0].increase = true; pCtx[0].increase = true;
} }
} }

View File

@ -47,6 +47,7 @@ extern "C" {
#define FUNC_MGT_FORBID_WINDOW_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(18) #define FUNC_MGT_FORBID_WINDOW_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(18)
#define FUNC_MGT_FORBID_GROUP_BY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19) #define FUNC_MGT_FORBID_GROUP_BY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19)
#define FUNC_MGT_SYSTEM_INFO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20) #define FUNC_MGT_SYSTEM_INFO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20)
#define FUNC_MGT_CLIENT_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)

View File

@ -2784,28 +2784,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.finalizeFunc = NULL .finalizeFunc = NULL
}, },
{ {
.name = "_qstartts", .name = "_qstart",
.type = FUNCTION_TYPE_QSTARTTS, .type = FUNCTION_TYPE_QSTART,
.classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC,
.translateFunc = translateTimePseudoColumn, .translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv, .getEnvFunc = NULL,
.initFunc = NULL, .initFunc = NULL,
.sprocessFunc = qStartTsFunction, .sprocessFunc = NULL,
.finalizeFunc = NULL .finalizeFunc = NULL
}, },
{ {
.name = "_qendts", .name = "_qend",
.type = FUNCTION_TYPE_QENDTS, .type = FUNCTION_TYPE_QEND,
.classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC,
.translateFunc = translateTimePseudoColumn, .translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv, .getEnvFunc = NULL,
.initFunc = NULL, .initFunc = NULL,
.sprocessFunc = qEndTsFunction, .sprocessFunc = NULL,
.finalizeFunc = NULL .finalizeFunc = NULL
}, },
{ {
.name = "_wstartts", .name = "_qduration",
.type = FUNCTION_TYPE_WSTARTTS, .type = FUNCTION_TYPE_QDURATION,
.classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC,
.translateFunc = translateWduration,
.getEnvFunc = NULL,
.initFunc = NULL,
.sprocessFunc = NULL,
.finalizeFunc = NULL
},
{
.name = "_wstart",
.type = FUNCTION_TYPE_WSTART,
.classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC,
.translateFunc = translateTimePseudoColumn, .translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv, .getEnvFunc = getTimePseudoFuncEnv,
@ -2814,8 +2824,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.finalizeFunc = NULL .finalizeFunc = NULL
}, },
{ {
.name = "_wendts", .name = "_wend",
.type = FUNCTION_TYPE_WENDTS, .type = FUNCTION_TYPE_WEND,
.classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC,
.translateFunc = translateTimePseudoColumn, .translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv, .getEnvFunc = getTimePseudoFuncEnv,

View File

@ -80,11 +80,12 @@ typedef struct STopBotRes {
} STopBotRes; } STopBotRes;
typedef struct SFirstLastRes { typedef struct SFirstLastRes {
bool hasResult; bool hasResult;
// used for last_row function only, isNullRes in SResultRowEntry can not be passed to downstream.So, // used for last_row function only, isNullRes in SResultRowEntry can not be passed to downstream.So,
// this attribute is required // this attribute is required
bool isNull; bool isNull;
int32_t bytes; int32_t bytes;
int64_t ts;
char buf[]; char buf[];
} SFirstLastRes; } SFirstLastRes;
@ -2951,6 +2952,7 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo);
colDataAppend(pCol, pBlock->info.rows, pRes->buf, pRes->isNull||pResInfo->isNullRes); colDataAppend(pCol, pBlock->info.rows, pRes->buf, pRes->isNull||pResInfo->isNullRes);
// handle selectivity // handle selectivity
STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY));
setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows);
@ -5557,6 +5559,10 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0); SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0);
if (pData->totalRows == 0) {
pData->minRows = 0;
}
int32_t row = 0; int32_t row = 0;
char st[256] = {0}; char st[256] = {0};
double totalRawSize = pData->totalRows * pData->rowSize; double totalRawSize = pData->totalRows * pData->rowSize;
@ -5568,10 +5574,14 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
varDataSetLen(st, len); varDataSetLen(st, len);
colDataAppend(pColInfo, row++, st, false); colDataAppend(pColInfo, row++, st, false);
int64_t avgRows = 0;
if (pData->numOfBlocks > 0) {
avgRows = pData->totalRows / pData->numOfBlocks;
}
len = sprintf(st + VARSTR_HEADER_SIZE, len = sprintf(st + VARSTR_HEADER_SIZE,
"Total_Rows=[%" PRId64 "] Inmem_Rows=[%d] MinRows=[%d] MaxRows=[%d] Average_Rows=[%" PRId64 "]", "Total_Rows=[%" PRId64 "] Inmem_Rows=[%d] MinRows=[%d] MaxRows=[%d] Average_Rows=[%" PRId64 "]",
pData->totalRows, pData->numOfInmemRows, pData->minRows, pData->maxRows, pData->totalRows, pData->numOfInmemRows, pData->minRows, pData->maxRows, avgRows);
pData->totalRows / pData->numOfBlocks);
varDataSetLen(st, len); varDataSetLen(st, len);
colDataAppend(pColInfo, row++, st, false); colDataAppend(pColInfo, row++, st, false);
@ -5988,7 +5998,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) {
SInputColumnInfoData* pInput = &pCtx->input; SInputColumnInfoData* pInput = &pCtx->input;
SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pInputCol = pInput->pData[0];
int32_t type = pInputCol->info.type; int32_t type = pInputCol->info.type;
int32_t bytes = pInputCol->info.bytes; int32_t bytes = pInputCol->info.bytes;
pInfo->bytes = bytes; pInfo->bytes = bytes;
@ -5999,7 +6009,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) {
char* data = colDataGetData(pInputCol, i); char* data = colDataGetData(pInputCol, i);
TSKEY cts = getRowPTs(pInput->pPTS, i); TSKEY cts = getRowPTs(pInput->pPTS, i);
if (pResInfo->numOfRes == 0 || *(TSKEY*)(pInfo->buf + bytes) < cts) { if (pResInfo->numOfRes == 0 || pInfo->ts < cts) {
if (colDataIsNull_s(pInputCol, i)) { if (colDataIsNull_s(pInputCol, i)) {
pInfo->isNull = true; pInfo->isNull = true;
@ -6012,8 +6022,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) {
memcpy(pInfo->buf, data, bytes); memcpy(pInfo->buf, data, bytes);
} }
*(TSKEY*)(pInfo->buf + bytes) = cts; pInfo->ts = cts;
pInfo->hasResult = true; pInfo->hasResult = true;
pResInfo->numOfRes = 1; pResInfo->numOfRes = 1;

View File

@ -183,6 +183,8 @@ bool fmIsSystemInfoFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId,
bool fmIsImplicitTsFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_IMPLICIT_TS_FUNC); } bool fmIsImplicitTsFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_IMPLICIT_TS_FUNC); }
bool fmIsClientPseudoColumnFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_CLIENT_PC_FUNC); }
bool fmIsInterpFunc(int32_t funcId) { bool fmIsInterpFunc(int32_t funcId) {
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false; return false;
@ -227,8 +229,8 @@ bool fmIsInvertible(int32_t funcId) {
case FUNCTION_TYPE_SUM: case FUNCTION_TYPE_SUM:
case FUNCTION_TYPE_STDDEV: case FUNCTION_TYPE_STDDEV:
case FUNCTION_TYPE_AVG: case FUNCTION_TYPE_AVG:
case FUNCTION_TYPE_WSTARTTS: case FUNCTION_TYPE_WSTART:
case FUNCTION_TYPE_WENDTS: case FUNCTION_TYPE_WEND:
case FUNCTION_TYPE_WDURATION: case FUNCTION_TYPE_WDURATION:
res = true; res = true;
break; break;

View File

@ -127,6 +127,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
COPY_SCALAR_FIELD(isDuration); COPY_SCALAR_FIELD(isDuration);
COPY_SCALAR_FIELD(translate); COPY_SCALAR_FIELD(translate);
COPY_SCALAR_FIELD(notReserved); COPY_SCALAR_FIELD(notReserved);
COPY_SCALAR_FIELD(isNull);
COPY_SCALAR_FIELD(placeholderNo); COPY_SCALAR_FIELD(placeholderNo);
COPY_SCALAR_FIELD(typeData); COPY_SCALAR_FIELD(typeData);
COPY_SCALAR_FIELD(unit); COPY_SCALAR_FIELD(unit);

View File

@ -225,6 +225,8 @@ const char* nodesNodeName(ENodeType type) {
return "PhysiBlockDistScan"; return "PhysiBlockDistScan";
case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN:
return "PhysiLastRowScan"; return "PhysiLastRowScan";
case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN:
return "PhysiTableMergeScan";
case QUERY_NODE_PHYSICAL_PLAN_PROJECT: case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return "PhysiProject"; return "PhysiProject";
case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN:
@ -2712,6 +2714,7 @@ static const char* jkValueLiteral = "Literal";
static const char* jkValueDuration = "Duration"; static const char* jkValueDuration = "Duration";
static const char* jkValueTranslate = "Translate"; static const char* jkValueTranslate = "Translate";
static const char* jkValueNotReserved = "NotReserved"; static const char* jkValueNotReserved = "NotReserved";
static const char* jkValueIsNull = "IsNull";
static const char* jkValueDatum = "Datum"; static const char* jkValueDatum = "Datum";
static int32_t datumToJson(const void* pObj, SJson* pJson) { static int32_t datumToJson(const void* pObj, SJson* pJson) {
@ -2798,6 +2801,9 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkValueNotReserved, pNode->notReserved); code = tjsonAddBoolToObject(pJson, jkValueNotReserved, pNode->notReserved);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkValueIsNull, pNode->isNull);
}
if (TSDB_CODE_SUCCESS == code && pNode->translate) { if (TSDB_CODE_SUCCESS == code && pNode->translate) {
code = datumToJson(pNode, pJson); code = datumToJson(pNode, pJson);
} }
@ -2945,6 +2951,9 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkValueNotReserved, &pNode->notReserved); code = tjsonGetBoolValue(pJson, jkValueNotReserved, &pNode->notReserved);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkValueIsNull, &pNode->isNull);
}
if (TSDB_CODE_SUCCESS == code && pNode->translate) { if (TSDB_CODE_SUCCESS == code && pNode->translate) {
code = jsonToDatum(pJson, pNode); code = jsonToDatum(pJson, pNode);
} }

View File

@ -956,7 +956,6 @@ void nodesDestroyNode(SNode* pNode) {
} }
case QUERY_NODE_PHYSICAL_SUBPLAN: { case QUERY_NODE_PHYSICAL_SUBPLAN: {
SSubplan* pSubplan = (SSubplan*)pNode; SSubplan* pSubplan = (SSubplan*)pNode;
// nodesDestroyList(pSubplan->pChildren);
nodesClearList(pSubplan->pChildren); nodesClearList(pSubplan->pChildren);
nodesDestroyNode((SNode*)pSubplan->pNode); nodesDestroyNode((SNode*)pSubplan->pNode);
nodesDestroyNode((SNode*)pSubplan->pDataSink); nodesDestroyNode((SNode*)pSubplan->pDataSink);
@ -965,25 +964,9 @@ void nodesDestroyNode(SNode* pNode) {
nodesClearList(pSubplan->pParents); nodesClearList(pSubplan->pParents);
break; break;
} }
case QUERY_NODE_PHYSICAL_PLAN: { case QUERY_NODE_PHYSICAL_PLAN:
SQueryPlan* pPlan = (SQueryPlan*)pNode; nodesDestroyList(((SQueryPlan*)pNode)->pSubplans);
if (NULL != pPlan->pSubplans) {
// only need to destroy the top-level subplans, because they will recurse to all the subplans below
bool first = true;
SNode* pElement = NULL;
FOREACH(pElement, pPlan->pSubplans) {
if (first) {
// first = false;
nodesDestroyNode(pElement);
} else {
nodesClearList(((SNodeListNode*)pElement)->pNodeList);
taosMemoryFreeClear(pElement);
}
}
nodesClearList(pPlan->pSubplans);
}
break; break;
}
default: default:
break; break;
} }
@ -1709,6 +1692,11 @@ int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots) {
} }
void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal) { void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
if (pNode->isNull) {
pVal->nType = TSDB_DATA_TYPE_NULL;
pVal->nLen = tDataTypes[TSDB_DATA_TYPE_NULL].bytes;
return;
}
pVal->nType = pNode->node.resType.type; pVal->nType = pNode->node.resType.type;
pVal->nLen = pNode->node.resType.bytes; pVal->nLen = pNode->node.resType.bytes;
switch (pNode->node.resType.type) { switch (pNode->node.resType.type) {
@ -1789,7 +1777,7 @@ static EDealRes classifyConditionImpl(SNode* pNode, void* pContext) {
SClassifyConditionCxt* pCxt = (SClassifyConditionCxt*)pContext; SClassifyConditionCxt* pCxt = (SClassifyConditionCxt*)pContext;
if (QUERY_NODE_COLUMN == nodeType(pNode)) { if (QUERY_NODE_COLUMN == nodeType(pNode)) {
SColumnNode* pCol = (SColumnNode*)pNode; SColumnNode* pCol = (SColumnNode*)pNode;
if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId && TSDB_SYSTEM_TABLE != pCol->tableType) {
pCxt->hasPrimaryKey = true; pCxt->hasPrimaryKey = true;
} else if (pCol->hasIndex) { } else if (pCol->hasIndex) {
pCxt->hasTagIndexCol = true; pCxt->hasTagIndexCol = true;

View File

@ -520,7 +520,9 @@ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B).
cmd ::= query_expression(A). { pCxt->pRootNode = A; } cmd ::= query_expression(A). { pCxt->pRootNode = A; }
/************************************************ insert **************************************************************/ /************************************************ insert **************************************************************/
cmd ::= INSERT INTO full_table_name(A) specific_cols_opt(B) query_expression(C). { pCxt->pRootNode = createInsertStmt(pCxt, A, B, C); } cmd ::= INSERT INTO full_table_name(A)
NK_LP col_name_list(B) NK_RP query_expression(C). { pCxt->pRootNode = createInsertStmt(pCxt, A, B, C); }
cmd ::= INSERT INTO full_table_name(A) query_expression(B). { pCxt->pRootNode = createInsertStmt(pCxt, A, NULL, B); }
/************************************************ literal *************************************************************/ /************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); } literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); }
@ -675,10 +677,11 @@ column_reference(A) ::= table_name(B) NK_DOT column_name(C).
pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= table_name(B) NK_DOT TBNAME(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &C, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)))); } pseudo_column(A) ::= table_name(B) NK_DOT TBNAME(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &C, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)))); }
pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }

View File

@ -598,7 +598,7 @@ SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) {
nodesDestroyNode((SNode*)fill); nodesDestroyNode((SNode*)fill);
CHECK_OUT_OF_MEM(fill->pWStartTs); CHECK_OUT_OF_MEM(fill->pWStartTs);
} }
strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstartts"); strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstart");
return (SNode*)fill; return (SNode*)fill;
} }
@ -740,6 +740,7 @@ SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pPr
select->pFromTable = pTable; select->pFromTable = pTable;
sprintf(select->stmtName, "%p", select); sprintf(select->stmtName, "%p", select);
select->isTimeLineResult = true; select->isTimeLineResult = true;
select->timeRange = TSWINDOW_INITIALIZER;
return (SNode*)select; return (SNode*)select;
} }

View File

@ -240,12 +240,13 @@ static SKeyword keywordTable[] = {
{"WITH", TK_WITH}, {"WITH", TK_WITH},
{"WRITE", TK_WRITE}, {"WRITE", TK_WRITE},
{"_C0", TK_ROWTS}, {"_C0", TK_ROWTS},
{"_QENDTS", TK_QENDTS}, {"_QDURATION", TK_QDURATION},
{"_QSTARTTS", TK_QSTARTTS}, {"_QEND", TK_QEND},
{"_QSTART", TK_QSTART},
{"_ROWTS", TK_ROWTS}, {"_ROWTS", TK_ROWTS},
{"_WDURATION", TK_WDURATION}, {"_WDURATION", TK_WDURATION},
{"_WENDTS", TK_WENDTS}, {"_WEND", TK_WEND},
{"_WSTARTTS", TK_WSTARTTS}, {"_WSTART", TK_WSTART},
// {"ID", TK_ID}, // {"ID", TK_ID},
// {"STRING", TK_STRING}, // {"STRING", TK_STRING},
// {"EQ", TK_EQ}, // {"EQ", TK_EQ},

View File

@ -496,7 +496,7 @@ static bool isPrimaryKeyImpl(SNode* pExpr) {
SFunctionNode* pFunc = (SFunctionNode*)pExpr; SFunctionNode* pFunc = (SFunctionNode*)pExpr;
if (FUNCTION_TYPE_SELECT_VALUE == pFunc->funcType) { if (FUNCTION_TYPE_SELECT_VALUE == pFunc->funcType) {
return isPrimaryKeyImpl(nodesListGetNode(pFunc->pParameterList, 0)); return isPrimaryKeyImpl(nodesListGetNode(pFunc->pParameterList, 0));
} else if (FUNCTION_TYPE_WSTARTTS == pFunc->funcType || FUNCTION_TYPE_WENDTS == pFunc->funcType) { } else if (FUNCTION_TYPE_WSTART == pFunc->funcType || FUNCTION_TYPE_WEND == pFunc->funcType) {
return true; return true;
} }
} }
@ -1197,7 +1197,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
} }
} }
static int32_t rewriteSystemInfoFuncImpl(STranslateContext* pCxt, char* pLiteral, SNode** pNode) { static int32_t rewriteFuncToValue(STranslateContext* pCxt, char* pLiteral, SNode** pNode) {
SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
if (NULL == pVal) { if (NULL == pVal) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
@ -1228,7 +1228,7 @@ static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
} }
return rewriteSystemInfoFuncImpl(pCxt, pCurrDb, pNode); return rewriteFuncToValue(pCxt, pCurrDb, pNode);
} }
static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) {
@ -1236,7 +1236,7 @@ static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) {
if (NULL == pVer) { if (NULL == pVer) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); return rewriteFuncToValue(pCxt, pVer, pNode);
} }
static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) {
@ -1244,7 +1244,7 @@ static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode)
if (NULL == pVer) { if (NULL == pVer) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); return rewriteFuncToValue(pCxt, pVer, pNode);
} }
static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) {
@ -1252,7 +1252,7 @@ static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) {
return TSDB_CODE_RPC_NETWORK_UNAVAIL; return TSDB_CODE_RPC_NETWORK_UNAVAIL;
} }
char* pStatus = taosMemoryStrDup((void*)"1"); char* pStatus = taosMemoryStrDup((void*)"1");
return rewriteSystemInfoFuncImpl(pCxt, pStatus, pNode); return rewriteFuncToValue(pCxt, pStatus, pNode);
} }
static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) {
@ -1263,7 +1263,7 @@ static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) {
if (NULL == pUserConn) { if (NULL == pUserConn) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
return rewriteSystemInfoFuncImpl(pCxt, pUserConn, pNode); return rewriteFuncToValue(pCxt, pUserConn, pNode);
} }
static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) {
@ -1317,10 +1317,60 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p
return code; return code;
} }
static int32_t rewriteQueryTimeFunc(STranslateContext* pCxt, int64_t val, SNode** pNode) {
if (INT64_MIN == val || INT64_MAX == val) {
return rewriteFuncToValue(pCxt, NULL, pNode);
}
char* pStr = taosMemoryCalloc(1, 20);
if (NULL == pStr) {
return TSDB_CODE_OUT_OF_MEMORY;
}
snprintf(pStr, 20, "%" PRId64 "", val);
return rewriteFuncToValue(pCxt, pStr, pNode);
}
static int32_t rewriteQstartFunc(STranslateContext* pCxt, SNode** pNode) {
return rewriteQueryTimeFunc(pCxt, ((SSelectStmt*)pCxt->pCurrStmt)->timeRange.skey, pNode);
}
static int32_t rewriteQendFunc(STranslateContext* pCxt, SNode** pNode) {
return rewriteQueryTimeFunc(pCxt, ((SSelectStmt*)pCxt->pCurrStmt)->timeRange.ekey, pNode);
}
static int32_t rewriteQdurationFunc(STranslateContext* pCxt, SNode** pNode) {
STimeWindow range = ((SSelectStmt*)pCxt->pCurrStmt)->timeRange;
if (INT64_MIN == range.skey || INT64_MAX == range.ekey) {
return rewriteQueryTimeFunc(pCxt, INT64_MIN, pNode);
}
return rewriteQueryTimeFunc(pCxt, range.ekey - range.skey + 1, pNode);
}
static int32_t rewriteClientPseudoColumnFunc(STranslateContext* pCxt, SNode** pNode) {
if (NULL == pCxt->pCurrStmt || QUERY_NODE_SELECT_STMT != nodeType(pCxt->pCurrStmt) ||
pCxt->currClause <= SQL_CLAUSE_WHERE) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "Illegal pseudo column");
}
switch (((SFunctionNode*)*pNode)->funcType) {
case FUNCTION_TYPE_QSTART:
return rewriteQstartFunc(pCxt, pNode);
case FUNCTION_TYPE_QEND:
return rewriteQendFunc(pCxt, pNode);
case FUNCTION_TYPE_QDURATION:
return rewriteQdurationFunc(pCxt, pNode);
default:
break;
}
return TSDB_CODE_PAR_INTERNAL_ERROR;
}
static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pFunc) { static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pFunc) {
if (fmIsSystemInfoFunc((*pFunc)->funcId)) { if (fmIsSystemInfoFunc((*pFunc)->funcId)) {
return rewriteSystemInfoFunc(pCxt, (SNode**)pFunc); return rewriteSystemInfoFunc(pCxt, (SNode**)pFunc);
} }
if (fmIsClientPseudoColumnFunc((*pFunc)->funcId)) {
return rewriteClientPseudoColumnFunc(pCxt, (SNode**)pFunc);
}
return translateNoramlFunction(pCxt, *pFunc); return translateNoramlFunction(pCxt, *pFunc);
} }
@ -2077,7 +2127,7 @@ static int32_t getTimeRange(SNode** pPrimaryKeyCond, STimeWindow* pTimeRange, bo
return code; return code;
} }
static int32_t getFillTimeRange(STranslateContext* pCxt, SNode* pWhere, STimeWindow* pTimeRange) { static int32_t getQueryTimeRange(STranslateContext* pCxt, SNode* pWhere, STimeWindow* pTimeRange) {
if (NULL == pWhere) { if (NULL == pWhere) {
*pTimeRange = TSWINDOW_INITIALIZER; *pTimeRange = TSWINDOW_INITIALIZER;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -2138,16 +2188,13 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t translateFill(STranslateContext* pCxt, SNode* pWhere, SIntervalWindowNode* pInterval) { static int32_t translateFill(STranslateContext* pCxt, SSelectStmt* pSelect, SIntervalWindowNode* pInterval) {
if (NULL == pInterval->pFill) { if (NULL == pInterval->pFill) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t code = getFillTimeRange(pCxt, pWhere, &(((SFillNode*)pInterval->pFill)->timeRange)); ((SFillNode*)pInterval->pFill)->timeRange = pSelect->timeRange;
if (TSDB_CODE_SUCCESS == code) { return checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval);
code = checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval);
}
return code;
} }
static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char unit) { static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char unit) {
@ -2234,7 +2281,7 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode*
static int32_t translateIntervalWindow(STranslateContext* pCxt, SSelectStmt* pSelect, SIntervalWindowNode* pInterval) { static int32_t translateIntervalWindow(STranslateContext* pCxt, SSelectStmt* pSelect, SIntervalWindowNode* pInterval) {
int32_t code = checkIntervalWindow(pCxt, pInterval); int32_t code = checkIntervalWindow(pCxt, pInterval);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = translateFill(pCxt, pSelect->pWhere, pInterval); code = translateFill(pCxt, pSelect, pInterval);
} }
return code; return code;
} }
@ -2329,7 +2376,7 @@ static int32_t translateInterpFill(STranslateContext* pCxt, SSelectStmt* pSelect
code = translateExpr(pCxt, &pSelect->pFill); code = translateExpr(pCxt, &pSelect->pFill);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = getFillTimeRange(pCxt, pSelect->pRange, &(((SFillNode*)pSelect->pFill)->timeRange)); code = getQueryTimeRange(pCxt, pSelect->pRange, &(((SFillNode*)pSelect->pFill)->timeRange));
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery); code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery);
@ -2361,9 +2408,13 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartiti
return translateExprList(pCxt, pPartitionByList); return translateExprList(pCxt, pPartitionByList);
} }
static int32_t translateWhere(STranslateContext* pCxt, SNode** pWhere) { static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->currClause = SQL_CLAUSE_WHERE; pCxt->currClause = SQL_CLAUSE_WHERE;
return translateExpr(pCxt, pWhere); int32_t code = translateExpr(pCxt, &pSelect->pWhere);
if (TSDB_CODE_SUCCESS == code) {
code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange);
}
return code;
} }
static int32_t translateFrom(STranslateContext* pCxt, SNode* pTable) { static int32_t translateFrom(STranslateContext* pCxt, SNode* pTable) {
@ -2494,7 +2545,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
int32_t code = translateFrom(pCxt, pSelect->pFromTable); int32_t code = translateFrom(pCxt, pSelect->pFromTable);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision; pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision;
code = translateWhere(pCxt, &pSelect->pWhere); code = translateWhere(pCxt, pSelect);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = translatePartitionBy(pCxt, pSelect->pPartitionByList); code = translatePartitionBy(pCxt, pSelect->pPartitionByList);
@ -2680,7 +2731,8 @@ static int32_t partitionDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelet
} }
static int32_t translateDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelete) { static int32_t translateDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelete) {
int32_t code = translateWhere(pCxt, &pDelete->pWhere); pCxt->currClause = SQL_CLAUSE_WHERE;
int32_t code = translateExpr(pCxt, &pDelete->pWhere);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = partitionDeleteWhere(pCxt, pDelete); code = partitionDeleteWhere(pCxt, pDelete);
} }
@ -3507,7 +3559,7 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
nodesDestroyNode((SNode*)pSelect); nodesDestroyNode((SNode*)pSelect);
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
strcpy(pFunc->functionName, "_wstartts"); strcpy(pFunc->functionName, "_wstart");
nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc);
SNode* pProject = NULL; SNode* pProject = NULL;
FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); }
@ -4336,14 +4388,14 @@ static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) {
SSelectStmt* pSelect = (SSelectStmt*)pStmt; SSelectStmt* pSelect = (SSelectStmt*)pStmt;
SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0);
if (NULL == pSelect->pWindow || if (NULL == pSelect->pWindow ||
(QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstartts", ((SFunctionNode*)pProj)->functionName))) { (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstart", ((SFunctionNode*)pProj)->functionName))) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pFunc) { if (NULL == pFunc) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
strcpy(pFunc->functionName, "_wstartts"); strcpy(pFunc->functionName, "_wstart");
strcpy(pFunc->node.aliasName, pFunc->functionName); strcpy(pFunc->node.aliasName, pFunc->functionName);
int32_t code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); int32_t code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {

View File

@ -187,7 +187,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC: case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC:
return "%s function is not supported in fill query"; return "%s function is not supported in fill query";
case TSDB_CODE_PAR_INVALID_WINDOW_PC: case TSDB_CODE_PAR_INVALID_WINDOW_PC:
return "_WSTARTTS, _WENDTS and _WDURATION can only be used in window query"; return "_WSTART, _WEND and _WDURATION can only be used in window query";
case TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC: case TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC:
return "%s function is not supported in time window query"; return "%s function is not supported in time window query";
case TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC: case TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC:

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ TEST_F(ParserSelectTest, condition) {
TEST_F(ParserSelectTest, pseudoColumn) { TEST_F(ParserSelectTest, pseudoColumn) {
useDb("root", "test"); useDb("root", "test");
run("SELECT _WSTARTTS, _WENDTS, COUNT(*) FROM t1 INTERVAL(10s)"); run("SELECT _WSTART, _WEND, COUNT(*) FROM t1 INTERVAL(10s)");
} }
TEST_F(ParserSelectTest, pseudoColumnSemanticCheck) { TEST_F(ParserSelectTest, pseudoColumnSemanticCheck) {
@ -286,7 +286,7 @@ TEST_F(ParserSelectTest, intervalSemanticCheck) {
run("SELECT HISTOGRAM(c1, 'log_bin', '{\"start\": -33,\"factor\": 55,\"count\": 5,\"infinity\": false}', 1) FROM t1 " run("SELECT HISTOGRAM(c1, 'log_bin', '{\"start\": -33,\"factor\": 55,\"count\": 5,\"infinity\": false}', 1) FROM t1 "
"WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' INTERVAL(10s) FILL(NULL)", "WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' INTERVAL(10s) FILL(NULL)",
TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC); TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC);
run("SELECT _WSTARTTS, _WENDTS, _WDURATION, sum(c1) FROM t1", TSDB_CODE_PAR_INVALID_WINDOW_PC); run("SELECT _WSTART, _WEND, _WDURATION, sum(c1) FROM t1", TSDB_CODE_PAR_INVALID_WINDOW_PC);
} }
TEST_F(ParserSelectTest, interp) { TEST_F(ParserSelectTest, interp) {
@ -310,11 +310,11 @@ TEST_F(ParserSelectTest, subquery) {
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 INTERVAL(1m)) INTERVAL(1n)"); run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 INTERVAL(1m)) INTERVAL(1n)");
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstartts FROM st1s1 INTERVAL(1m)) INTERVAL(1n)"); run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstart FROM st1s1 INTERVAL(1m)) INTERVAL(1n)");
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)"); run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstartts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)"); run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstart FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");
run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)"); run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)");

View File

@ -59,7 +59,7 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) {
strcpy(pCol->node.aliasName, pToBeRewrittenExpr->aliasName); strcpy(pCol->node.aliasName, pToBeRewrittenExpr->aliasName);
strcpy(pCol->colName, ((SExprNode*)pExpr)->aliasName); strcpy(pCol->colName, ((SExprNode*)pExpr)->aliasName);
if (QUERY_NODE_FUNCTION == nodeType(pExpr)) { if (QUERY_NODE_FUNCTION == nodeType(pExpr)) {
if (FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pExpr)->funcType) { if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pExpr)->funcType) {
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID; pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
} else if (FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pExpr)->funcType) { } else if (FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pExpr)->funcType) {
pCol->colType = COLUMN_TYPE_TBNAME; pCol->colType = COLUMN_TYPE_TBNAME;

View File

@ -795,15 +795,15 @@ static EDealRes rewriteAggGroupKeyCondForPushDownImpl(SNode** pNode, void* pCont
if (0 == strcmp(((SExprNode*)pGroup)->aliasName, ((SColumnNode*)(*pNode))->colName)) { if (0 == strcmp(((SExprNode*)pGroup)->aliasName, ((SColumnNode*)(*pNode))->colName)) {
SNode* pExpr = nodesCloneNode(pGroup); SNode* pExpr = nodesCloneNode(pGroup);
if (pExpr == NULL) { if (pExpr == NULL) {
pCxt->errCode = terrno; pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
return DEAL_RES_ERROR; return DEAL_RES_ERROR;
} }
nodesDestroyNode(*pNode); nodesDestroyNode(*pNode);
*pNode = pExpr; *pNode = pExpr;
return DEAL_RES_IGNORE_CHILD;
} }
} }
} }
return DEAL_RES_IGNORE_CHILD;
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
@ -864,16 +864,16 @@ static EDealRes rewriteProjectCondForPushDownImpl(SNode** ppNode, void* pContext
if (0 == strcmp(((SExprNode*)pProjection)->aliasName, ((SColumnNode*)(*ppNode))->colName)) { if (0 == strcmp(((SExprNode*)pProjection)->aliasName, ((SColumnNode*)(*ppNode))->colName)) {
SNode* pExpr = nodesCloneNode(pProjection); SNode* pExpr = nodesCloneNode(pProjection);
if (pExpr == NULL) { if (pExpr == NULL) {
pCxt->errCode = terrno; pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
return DEAL_RES_ERROR; return DEAL_RES_ERROR;
} }
nodesDestroyNode(*ppNode); nodesDestroyNode(*ppNode);
*ppNode = pExpr; *ppNode = pExpr;
return DEAL_RES_IGNORE_CHILD;
} // end if expr alias name equal column name } // end if expr alias name equal column name
} // end for each project } // end for each project
} // end if target node equals cond column node } // end if target node equals cond column node
} // end for each targets } // end for each targets
return DEAL_RES_IGNORE_CHILD;
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
@ -1211,7 +1211,7 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo
int32_t smaFuncIndex = -1; int32_t smaFuncIndex = -1;
*pWStrartIndex = -1; *pWStrartIndex = -1;
FOREACH(pFunc, pFuncs) { FOREACH(pFunc, pFuncs) {
if (FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pFunc)->funcType) { if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) {
*pWStrartIndex = index; *pWStrartIndex = index;
} }
smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs); smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs);
@ -1255,7 +1255,7 @@ static SNode* smaIndexOptCreateWStartTs() {
if (NULL == pWStart) { if (NULL == pWStart) {
return NULL; return NULL;
} }
strcpy(pWStart->functionName, "_wstartts"); strcpy(pWStart->functionName, "_wstart");
snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart); snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart);
if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pWStart, NULL, 0)) { if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pWStart, NULL, 0)) {
nodesDestroyNode((SNode*)pWStart); nodesDestroyNode((SNode*)pWStart);
@ -2057,11 +2057,11 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) {
((SExprNode*)*pNode)->aliasName); ((SExprNode*)*pNode)->aliasName);
nodesDestroyNode(*pNode); nodesDestroyNode(*pNode);
*pNode = pExpr; *pNode = pExpr;
return DEAL_RES_IGNORE_CHILD;
} }
} }
} }
} }
return DEAL_RES_IGNORE_CHILD;
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
@ -2103,11 +2103,12 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) { if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) {
return false; return false;
} }
SScanLogicNode *pScan = (SScanLogicNode*)pNode; SScanLogicNode* pScan = (SScanLogicNode*)pNode;
if (NULL != pScan->pScanCols) { if (NULL != pScan->pScanCols) {
return false; return false;
} }
if (NULL == pNode->pParent || QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) || 1 != LIST_LENGTH(pNode->pParent->pChildren)) { if (NULL == pNode->pParent || QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent) ||
1 != LIST_LENGTH(pNode->pParent->pChildren)) {
return false; return false;
} }

View File

@ -308,7 +308,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) {
int32_t index = 0; int32_t index = 0;
SNode* pFunc = NULL; SNode* pFunc = NULL;
FOREACH(pFunc, pFuncs) { FOREACH(pFunc, pFuncs) {
if (FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pFunc)->funcType) { if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) {
*pIndex = index; *pIndex = index;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -319,7 +319,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) {
if (NULL == pWStart) { if (NULL == pWStart) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
strcpy(pWStart->functionName, "_wstartts"); strcpy(pWStart->functionName, "_wstart");
snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart); snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart);
int32_t code = fmGetFuncInfo(pWStart, NULL, 0); int32_t code = fmGetFuncInfo(pWStart, NULL, 0);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
@ -333,7 +333,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) {
int32_t index = 0; int32_t index = 0;
SNode* pFunc = NULL; SNode* pFunc = NULL;
FOREACH(pFunc, pWin->pFuncs) { FOREACH(pFunc, pWin->pFuncs) {
if (FUNCTION_TYPE_WENDTS == ((SFunctionNode*)pFunc)->funcType) { if (FUNCTION_TYPE_WEND == ((SFunctionNode*)pFunc)->funcType) {
*pIndex = index; *pIndex = index;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -344,7 +344,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) {
if (NULL == pWEnd) { if (NULL == pWEnd) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
strcpy(pWEnd->functionName, "_wendts"); strcpy(pWEnd->functionName, "_wend");
snprintf(pWEnd->node.aliasName, sizeof(pWEnd->node.aliasName), "%s.%p", pWEnd->functionName, pWEnd); snprintf(pWEnd->node.aliasName, sizeof(pWEnd->node.aliasName), "%s.%p", pWEnd->functionName, pWEnd);
int32_t code = fmGetFuncInfo(pWEnd, NULL, 0); int32_t code = fmGetFuncInfo(pWEnd, NULL, 0);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {

View File

@ -137,6 +137,17 @@ TEST_F(PlanBasicTest, sampleFunc) {
run("SELECT SAMPLE(c1, 10) FROM st1 PARTITION BY TBNAME"); run("SELECT SAMPLE(c1, 10) FROM st1 PARTITION BY TBNAME");
} }
TEST_F(PlanBasicTest, pseudoColumn) {
useDb("root", "test");
run("SELECT _QSTART, _QEND, _QDURATION FROM t1");
run("SELECT _QSTART, _QEND, _QDURATION FROM t1 WHERE ts BETWEEN '2017-7-14 18:00:00' AND '2017-7-14 19:00:00'");
run("SELECT _QSTART, _QEND, _QDURATION, _WSTART, _WEND, _WDURATION, COUNT(*) FROM t1 "
"WHERE ts BETWEEN '2017-7-14 18:00:00' AND '2017-7-14 19:00:00' INTERVAL(10S)");
}
TEST_F(PlanBasicTest, withoutFrom) { TEST_F(PlanBasicTest, withoutFrom) {
useDb("root", "test"); useDb("root", "test");

View File

@ -29,7 +29,7 @@ TEST_F(PlanIntervalTest, basic) {
TEST_F(PlanIntervalTest, pseudoCol) { TEST_F(PlanIntervalTest, pseudoCol) {
useDb("root", "test"); useDb("root", "test");
run("SELECT _WSTARTTS, _WDURATION, _WENDTS, COUNT(*) FROM t1 INTERVAL(10s)"); run("SELECT _WSTART, _WDURATION, _WEND, COUNT(*) FROM t1 INTERVAL(10s)");
} }
TEST_F(PlanIntervalTest, fill) { TEST_F(PlanIntervalTest, fill) {
@ -59,9 +59,9 @@ TEST_F(PlanIntervalTest, stable) {
run("SELECT COUNT(*) FROM st1 INTERVAL(10s)"); run("SELECT COUNT(*) FROM st1 INTERVAL(10s)");
run("SELECT _WSTARTTS, COUNT(*) FROM st1 INTERVAL(10s)"); run("SELECT _WSTART, COUNT(*) FROM st1 INTERVAL(10s)");
run("SELECT _WSTARTTS, COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)"); run("SELECT _WSTART, COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)");
run("SELECT TBNAME, COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)"); run("SELECT TBNAME, COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)");
} }

View File

@ -55,7 +55,7 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) {
run("SELECT c1 FROM t1 ORDER BY ts DESC"); run("SELECT c1 FROM t1 ORDER BY ts DESC");
run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTARTTS DESC"); run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTART DESC");
} }
TEST_F(PlanOptimizeTest, PartitionTags) { TEST_F(PlanOptimizeTest, PartitionTags) {

View File

@ -49,7 +49,7 @@ TEST_F(PlanOtherTest, createSmaIndex) {
run("SELECT SUM(c4) FROM t1 INTERVAL(10s)"); run("SELECT SUM(c4) FROM t1 INTERVAL(10s)");
run("SELECT _WSTARTTS, MIN(c3 + 10) FROM t1 " run("SELECT _WSTART, MIN(c3 + 10) FROM t1 "
"WHERE ts BETWEEN TIMESTAMP '2022-04-01 00:00:00' AND TIMESTAMP '2022-04-30 23:59:59.999' INTERVAL(10s)"); "WHERE ts BETWEEN TIMESTAMP '2022-04-01 00:00:00' AND TIMESTAMP '2022-04-30 23:59:59.999' INTERVAL(10s)");
run("SELECT SUM(c4), MAX(c3) FROM t1 INTERVAL(10s)"); run("SELECT SUM(c4), MAX(c3) FROM t1 INTERVAL(10s)");

View File

@ -223,6 +223,7 @@ typedef struct SSchJobAttr {
typedef struct { typedef struct {
int32_t op; int32_t op;
SRWLatch lock;
bool syncReq; bool syncReq;
} SSchOpStatus; } SSchOpStatus;
@ -473,6 +474,7 @@ int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTas
int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel, int32_t levelNum); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel, int32_t levelNum);
int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask); int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask);
void schDirectPostJobRes(SSchedulerReq* pReq, int32_t errCode); void schDirectPostJobRes(SSchedulerReq* pReq, int32_t errCode);
bool schChkCurrentOp(SSchJob *pJob, int32_t op, bool sync);
extern SSchDebug gSCHDebug; extern SSchDebug gSCHDebug;

View File

@ -443,25 +443,37 @@ int32_t schNotifyUserFetchRes(SSchJob* pJob) {
} }
void schPostJobRes(SSchJob *pJob, SCH_OP_TYPE op) { void schPostJobRes(SSchJob *pJob, SCH_OP_TYPE op) {
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
if (SCH_OP_NULL == pJob->opStatus.op) { if (SCH_OP_NULL == pJob->opStatus.op) {
SCH_JOB_DLOG("job not in any operation, no need to post job res, status:%s", jobTaskStatusStr(pJob->status)); SCH_JOB_DLOG("job not in any operation, no need to post job res, status:%s", jobTaskStatusStr(pJob->status));
return; goto _return;
} }
if (op && pJob->opStatus.op != op) { if (op && pJob->opStatus.op != op) {
SCH_JOB_ELOG("job in operation %s mis-match with expected %s", schGetOpStr(pJob->opStatus.op), schGetOpStr(op)); SCH_JOB_ELOG("job in operation %s mis-match with expected %s", schGetOpStr(pJob->opStatus.op), schGetOpStr(op));
return; goto _return;
} }
if (SCH_JOB_IN_SYNC_OP(pJob)) { if (SCH_JOB_IN_SYNC_OP(pJob)) {
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
tsem_post(&pJob->rspSem); tsem_post(&pJob->rspSem);
} else if (SCH_JOB_IN_ASYNC_EXEC_OP(pJob)) { } else if (SCH_JOB_IN_ASYNC_EXEC_OP(pJob)) {
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
schNotifyUserExecRes(pJob); schNotifyUserExecRes(pJob);
} else if (SCH_JOB_IN_ASYNC_FETCH_OP(pJob)) { } else if (SCH_JOB_IN_ASYNC_FETCH_OP(pJob)) {
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
schNotifyUserFetchRes(pJob); schNotifyUserFetchRes(pJob);
} else { } else {
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
SCH_JOB_ELOG("job not in any operation, status:%s", jobTaskStatusStr(pJob->status)); SCH_JOB_ELOG("job not in any operation, status:%s", jobTaskStatusStr(pJob->status));
} }
return;
_return:
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
} }
int32_t schProcessOnJobFailureImpl(SSchJob *pJob, int32_t status, int32_t errCode) { int32_t schProcessOnJobFailureImpl(SSchJob *pJob, int32_t status, int32_t errCode) {
@ -658,13 +670,13 @@ int32_t schJobFetchRows(SSchJob *pJob) {
if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) {
SCH_ERR_RET(schLaunchFetchTask(pJob)); SCH_ERR_RET(schLaunchFetchTask(pJob));
if (pJob->opStatus.syncReq) { if (schChkCurrentOp(pJob, SCH_OP_FETCH, true)) {
SCH_JOB_DLOG("sync wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); SCH_JOB_DLOG("sync wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob));
tsem_wait(&pJob->rspSem); tsem_wait(&pJob->rspSem);
SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes)); SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes));
} }
} else { } else {
if (pJob->opStatus.syncReq) { if (schChkCurrentOp(pJob, SCH_OP_FETCH, true)) {
SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes)); SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes));
} else { } else {
schPostJobRes(pJob, SCH_OP_FETCH); schPostJobRes(pJob, SCH_OP_FETCH);
@ -775,25 +787,37 @@ void schDirectPostJobRes(SSchedulerReq* pReq, int32_t errCode) {
} }
} }
bool schChkCurrentOp(SSchJob *pJob, int32_t op, bool sync) {
SCH_LOCK(SCH_READ, &pJob->opStatus.lock);
bool r = (pJob->opStatus.op == op) && (pJob->opStatus.syncReq == sync);
SCH_UNLOCK(SCH_READ, &pJob->opStatus.lock);
return r;
}
void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq* pReq, int32_t errCode) { void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq* pReq, int32_t errCode) {
int32_t op = 0; int32_t op = 0;
switch (type) { switch (type) {
case SCH_OP_EXEC: case SCH_OP_EXEC:
if (pReq && pReq->syncReq) { if (pReq && pReq->syncReq) {
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL); op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL);
if (SCH_OP_NULL == op || op != type) { if (SCH_OP_NULL == op || op != type) {
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status)); SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status));
} }
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
schDumpJobExecRes(pJob, pReq->pExecRes); schDumpJobExecRes(pJob, pReq->pExecRes);
} }
break; break;
case SCH_OP_FETCH: case SCH_OP_FETCH:
if (pReq && pReq->syncReq) { if (pReq && pReq->syncReq) {
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL); op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL);
if (SCH_OP_NULL == op || op != type) { if (SCH_OP_NULL == op || op != type) {
SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status)); SCH_JOB_ELOG("job not in %s operation, op:%s, status:%s", schGetOpStr(type), schGetOpStr(op), jobTaskStatusStr(pJob->status));
} }
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
} }
break; break;
case SCH_OP_GET_STATUS: case SCH_OP_GET_STATUS:
@ -816,8 +840,10 @@ int32_t schProcessOnOpBegin(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq
switch (type) { switch (type) {
case SCH_OP_EXEC: case SCH_OP_EXEC:
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
if (SCH_OP_NULL != atomic_val_compare_exchange_32(&pJob->opStatus.op, SCH_OP_NULL, type)) { if (SCH_OP_NULL != atomic_val_compare_exchange_32(&pJob->opStatus.op, SCH_OP_NULL, type)) {
SCH_JOB_ELOG("job already in %s operation", schGetOpStr(pJob->opStatus.op)); SCH_JOB_ELOG("job already in %s operation", schGetOpStr(pJob->opStatus.op));
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
schDirectPostJobRes(pReq, TSDB_CODE_TSC_APP_ERROR); schDirectPostJobRes(pReq, TSDB_CODE_TSC_APP_ERROR);
SCH_ERR_RET(TSDB_CODE_TSC_APP_ERROR); SCH_ERR_RET(TSDB_CODE_TSC_APP_ERROR);
} }
@ -825,10 +851,13 @@ int32_t schProcessOnOpBegin(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq
SCH_JOB_DLOG("job start %s operation", schGetOpStr(pJob->opStatus.op)); SCH_JOB_DLOG("job start %s operation", schGetOpStr(pJob->opStatus.op));
pJob->opStatus.syncReq = pReq->syncReq; pJob->opStatus.syncReq = pReq->syncReq;
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
break; break;
case SCH_OP_FETCH: case SCH_OP_FETCH:
SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock);
if (SCH_OP_NULL != atomic_val_compare_exchange_32(&pJob->opStatus.op, SCH_OP_NULL, type)) { if (SCH_OP_NULL != atomic_val_compare_exchange_32(&pJob->opStatus.op, SCH_OP_NULL, type)) {
SCH_JOB_ELOG("job already in %s operation", schGetOpStr(pJob->opStatus.op)); SCH_JOB_ELOG("job already in %s operation", schGetOpStr(pJob->opStatus.op));
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
schDirectPostJobRes(pReq, TSDB_CODE_TSC_APP_ERROR); schDirectPostJobRes(pReq, TSDB_CODE_TSC_APP_ERROR);
SCH_ERR_RET(TSDB_CODE_TSC_APP_ERROR); SCH_ERR_RET(TSDB_CODE_TSC_APP_ERROR);
} }
@ -840,6 +869,7 @@ int32_t schProcessOnOpBegin(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq
pJob->userRes.cbParam = pReq->cbParam; pJob->userRes.cbParam = pReq->cbParam;
pJob->opStatus.syncReq = pReq->syncReq; pJob->opStatus.syncReq = pReq->syncReq;
SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock);
if (!SCH_JOB_NEED_FETCH(pJob)) { if (!SCH_JOB_NEED_FETCH(pJob)) {
SCH_JOB_ELOG("no need to fetch data, status:%s", SCH_GET_JOB_STATUS_STR(pJob)); SCH_JOB_ELOG("no need to fetch data, status:%s", SCH_GET_JOB_STATUS_STR(pJob));

View File

@ -505,6 +505,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
/*
if (SCH_IS_DATA_BIND_TASK(pTask)) { if (SCH_IS_DATA_BIND_TASK(pTask)) {
if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) {
*needRetry = false; *needRetry = false;
@ -522,6 +523,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
} }
*/
*needRetry = true; *needRetry = true;
SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode)); SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode));

View File

@ -431,7 +431,7 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove) {
} }
released = 1; released = 1;
} else { } else {
uTrace("rsetId:%d p:%p rid:%" PRId64 " is released", rsetId, pNode->p, rid); uTrace("rsetId:%d p:%p rid:%" PRId64 " is released, remain count %d", rsetId, pNode->p, rid, pNode->count);
} }
} else { } else {
uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid); uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid);

View File

@ -129,7 +129,7 @@ void *taosProcessSchedQueue(void *scheduler) {
while (1) { while (1) {
if ((ret = tsem_wait(&pSched->fullSem)) != 0) { if ((ret = tsem_wait(&pSched->fullSem)) != 0) {
uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno)); uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
if (pSched->stop) { if (pSched->stop) {
break; break;
@ -137,7 +137,7 @@ void *taosProcessSchedQueue(void *scheduler) {
if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) {
uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
msg = pSched->queue[pSched->fullSlot]; msg = pSched->queue[pSched->fullSlot];
@ -146,12 +146,12 @@ void *taosProcessSchedQueue(void *scheduler) {
if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) {
uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
if ((ret = tsem_post(&pSched->emptySem)) != 0) { if ((ret = tsem_post(&pSched->emptySem)) != 0) {
uFatal("post %s emptySem failed(%s)", pSched->label, strerror(errno)); uFatal("post %s emptySem failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
if (msg.fp) if (msg.fp)
@ -174,12 +174,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) {
if ((ret = tsem_wait(&pSched->emptySem)) != 0) { if ((ret = tsem_wait(&pSched->emptySem)) != 0) {
uFatal("wait %s emptySem failed(%s)", pSched->label, strerror(errno)); uFatal("wait %s emptySem failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) {
uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
pSched->queue[pSched->emptySlot] = *pMsg; pSched->queue[pSched->emptySlot] = *pMsg;
@ -187,12 +187,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) {
if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) {
uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
if ((ret = tsem_post(&pSched->fullSem)) != 0) { if ((ret = tsem_post(&pSched->fullSem)) != 0) {
uFatal("post %s fullSem failed(%s)", pSched->label, strerror(errno)); uFatal("post %s fullSem failed(%s)", pSched->label, strerror(errno));
exit(ret); ASSERT(0);
} }
} }
@ -200,6 +200,8 @@ void taosCleanUpScheduler(void *param) {
SSchedQueue *pSched = (SSchedQueue *)param; SSchedQueue *pSched = (SSchedQueue *)param;
if (pSched == NULL) return; if (pSched == NULL) return;
uDebug("start to cleanup %s schedQsueue", pSched->label);
pSched->stop = true; pSched->stop = true;
for (int32_t i = 0; i < pSched->numOfThreads; ++i) { for (int32_t i = 0; i < pSched->numOfThreads; ++i) {
if (taosCheckPthreadValid(pSched->qthread[i])) { if (taosCheckPthreadValid(pSched->qthread[i])) {

View File

@ -65,6 +65,7 @@ ulimit -c unlimited
$TIMEOUT_CMD $cmd $TIMEOUT_CMD $cmd
RET=$? RET=$?
echo "cmd exit code: $RET"
if [ $RET -ne 0 ]; then if [ $RET -ne 0 ]; then
pwd pwd

View File

@ -18,7 +18,7 @@ class TDTestCase:
tdSql.execute('create table ownsampling_ct1 using downsampling_stb tags(10, 10.1, "beijing", True);') tdSql.execute('create table ownsampling_ct1 using downsampling_stb tags(10, 10.1, "beijing", True);')
tdSql.execute('create table if not exists scalar_stb (ts timestamp, c1 int, c2 double, c3 binary(20)) tags (t1 int);') tdSql.execute('create table if not exists scalar_stb (ts timestamp, c1 int, c2 double, c3 binary(20)) tags (t1 int);')
tdSql.execute('create table scalar_ct1 using scalar_stb tags(10);') tdSql.execute('create table scalar_ct1 using scalar_stb tags(10);')
tdSql.execute('create stream downsampling_stream into output_downsampling_stb as select _wstartts AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);') tdSql.execute('create stream downsampling_stream into output_downsampling_stb as select _wstart AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);')
tdSql.execute('create stream scalar_stream into output_scalar_stb as select ts, abs(c1) a1 , abs(c2) a2 from scalar_stb;') tdSql.execute('create stream scalar_stream into output_scalar_stb as select ts, abs(c1) a1 , abs(c2) a2 from scalar_stb;')
tdSql.execute('insert into scalar_ct1 values (1653471881952, 100, 100.1, "beijing");') tdSql.execute('insert into scalar_ct1 values (1653471881952, 100, 100.1, "beijing");')
tdSql.execute('insert into scalar_ct1 values (1653471881952+1s, -50, -50.1, "tianjin");') tdSql.execute('insert into scalar_ct1 values (1653471881952+1s, -50, -50.1, "tianjin");')

View File

@ -22,23 +22,23 @@ class TDTestCase:
tdSql.execute('create table downsampling_ct1 using downsampling_stb tags(10, 10.1, "Beijing", True);') tdSql.execute('create table downsampling_ct1 using downsampling_stb tags(10, 10.1, "Beijing", True);')
tdSql.execute('create table if not exists scalar_stb (ts timestamp, c1 int, c2 double, c3 binary(20), c4 nchar(20), c5 nchar(20)) tags (t1 int);') tdSql.execute('create table if not exists scalar_stb (ts timestamp, c1 int, c2 double, c3 binary(20), c4 nchar(20), c5 nchar(20)) tags (t1 int);')
tdSql.execute('create table scalar_ct1 using scalar_stb tags(10);') tdSql.execute('create table scalar_ct1 using scalar_stb tags(10);')
tdSql.execute('create stream downsampling_stream into output_downsampling_stb as select _wstartts AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);') tdSql.execute('create stream downsampling_stream into output_downsampling_stb as select _wstart AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591, 100, 100.1, "Beijing", True);') tdSql.execute('insert into downsampling_ct1 values (1653547828591, 100, 100.1, "Beijing", True);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591+1s, -100, -100.1, "Tianjin", False);') tdSql.execute('insert into downsampling_ct1 values (1653547828591+1s, -100, -100.1, "Tianjin", False);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591+2s, 50, 50.3, "HeBei", False);') tdSql.execute('insert into downsampling_ct1 values (1653547828591+2s, 50, 50.3, "HeBei", False);')
tdSql.execute('select * from output_downsampling_stb;') tdSql.execute('select * from output_downsampling_stb;')
tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;') tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;')
tdSql.execute('select _wstartts AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);') tdSql.execute('select _wstart AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591+10m, 60, 60.3, "heilongjiang", True);') tdSql.execute('insert into downsampling_ct1 values (1653547828591+10m, 60, 60.3, "heilongjiang", True);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591+11m, 70, 70.3, "JiLin", True);') tdSql.execute('insert into downsampling_ct1 values (1653547828591+11m, 70, 70.3, "JiLin", True);')
tdSql.execute('select * from output_downsampling_stb;') tdSql.execute('select * from output_downsampling_stb;')
tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;') tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;')
tdSql.execute('select _wstartts AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);') tdSql.execute('select _wstart AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);')
tdSql.execute('insert into downsampling_ct1 values (1653547828591+21m, 70, 70.3, "JiLin", True);') tdSql.execute('insert into downsampling_ct1 values (1653547828591+21m, 70, 70.3, "JiLin", True);')
tdSql.execute('select * from output_downsampling_stb;') tdSql.execute('select * from output_downsampling_stb;')
tdSql.execute('select * from output_downsampling_stb;') tdSql.execute('select * from output_downsampling_stb;')
tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;') tdSql.execute('select start, `min(c1)`, `max(c2)`, `sum(c1)` from output_downsampling_stb;')
tdSql.execute('select _wstartts AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);') tdSql.execute('select _wstart AS start, min(c1), max(c2), sum(c1) from downsampling_stb interval(10m);')
tdSql.execute('create stream abs_stream into output_abs_stb as select ts, abs(c1), abs(c2), c3 from scalar_stb;') tdSql.execute('create stream abs_stream into output_abs_stb as select ts, abs(c1), abs(c2), c3 from scalar_stb;')
tdSql.query('describe output_abs_stb') tdSql.query('describe output_abs_stb')
tdSql.execute('create stream acos_stream into output_acos_stb as select ts, acos(c1), acos(c2), c3 from scalar_stb;') tdSql.execute('create stream acos_stream into output_acos_stb as select ts, acos(c1), acos(c2), c3 from scalar_stb;')

View File

@ -36,7 +36,7 @@ int64_t st, et;
char hostName[128]; char hostName[128];
char dbName[128]; char dbName[128];
char tbName[128]; char tbName[128];
int32_t runTimes = 10000; int32_t runTimes = 1000;
typedef struct { typedef struct {
int id; int id;
@ -85,9 +85,12 @@ static void sqExecSQLE(TAOS *taos, char *command) {
taos_free_result(pSql); taos_free_result(pSql);
} }
void sqError(char* prefix, const char* errMsg) {
fprintf(stderr, "%s error: %s\n", prefix, errMsg);
}
void sqExit(char* prefix, const char* errMsg) { void sqExit(char* prefix, const char* errMsg) {
fprintf(stderr, "%s error: %s\n", prefix, errMsg); sqError(prefix, errMsg);
exit(1); exit(1);
} }
@ -141,16 +144,20 @@ void sqCloseFetchCb(void *param, TAOS_RES *pRes, int numOfRows) {
taos_close(qParam->taos); taos_close(qParam->taos);
*qParam->end = 1; *qParam->end = 1;
taos_free_result(pRes);
} }
void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) { void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) {
SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param;
if (code == 0 && pRes) { if (code == 0 && pRes) {
if (qParam->fetch) { if (qParam->fetch) {
taos_fetch_rows_a(pRes, sqFreeFetchCb, param); taos_fetch_rows_a(pRes, sqCloseFetchCb, param);
} else { } else {
taos_close(qParam->taos); taos_close(qParam->taos);
*qParam->end = 1; *qParam->end = 1;
taos_free_result(pRes);
} }
} else { } else {
sqExit("select", taos_errstr(pRes)); sqExit("select", taos_errstr(pRes));
@ -203,7 +210,9 @@ void sqAsyncQueryCb(void *param, TAOS_RES *pRes, int code) {
*qParam->end = 1; *qParam->end = 1;
} }
} else { } else {
sqExit("select", taos_errstr(pRes)); sqError("select", taos_errstr(pRes));
*qParam->end = 1;
taos_free_result(pRes);
} }
} }
@ -358,6 +367,7 @@ int sqCloseSyncQuery(bool fetch) {
} }
taos_close(taos); taos_close(taos);
taos_free_result(pRes);
} }
CASE_LEAVE(); CASE_LEAVE();
} }
@ -382,7 +392,7 @@ int sqCloseAsyncQuery(bool fetch) {
SSP_CB_PARAM param = {0}; SSP_CB_PARAM param = {0};
param.fetch = fetch; param.fetch = fetch;
param.end = &qEnd; param.end = &qEnd;
taos_query_a(taos, sql, sqFreeQueryCb, &param); taos_query_a(taos, sql, sqCloseQueryCb, &param);
while (0 == qEnd) { while (0 == qEnd) {
usleep(5000); usleep(5000);
} }
@ -457,8 +467,6 @@ void *closeThreadFp(void *arg) {
} }
} }
void *killThreadFp(void *arg) { void *killThreadFp(void *arg) {
SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg;
while (true) { while (true) {
@ -471,6 +479,19 @@ void *killThreadFp(void *arg) {
} }
} }
void *cleanupThreadFp(void *arg) {
SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg;
while (true) {
if (qParam->taos) {
usleep(rand() % 10000);
taos_cleanup();
break;
}
usleep(1);
}
}
int sqConCloseSyncQuery(bool fetch) { int sqConCloseSyncQuery(bool fetch) {
@ -578,6 +599,8 @@ int sqConKillSyncQuery(bool fetch) {
pthread_join(qid, NULL); pthread_join(qid, NULL);
pthread_join(cid, NULL); pthread_join(cid, NULL);
taos_close(param.taos);
} }
CASE_LEAVE(); CASE_LEAVE();
} }
@ -593,6 +616,40 @@ int sqConKillAsyncQuery(bool fetch) {
pthread_join(qid, NULL); pthread_join(qid, NULL);
pthread_join(cid, NULL); pthread_join(cid, NULL);
taos_close(param.taos);
}
CASE_LEAVE();
}
int sqConCleanupSyncQuery(bool fetch) {
CASE_ENTER();
pthread_t qid, cid;
for (int32_t i = 0; i < runTimes; ++i) {
SSP_CB_PARAM param = {0};
param.fetch = fetch;
pthread_create(&qid, NULL, syncQueryThreadFp, (void*)&param);
pthread_create(&cid, NULL, cleanupThreadFp, (void*)&param);
pthread_join(qid, NULL);
pthread_join(cid, NULL);
break;
}
CASE_LEAVE();
}
int sqConCleanupAsyncQuery(bool fetch) {
CASE_ENTER();
pthread_t qid, cid;
for (int32_t i = 0; i < runTimes; ++i) {
SSP_CB_PARAM param = {0};
param.fetch = fetch;
pthread_create(&qid, NULL, asyncQueryThreadFp, (void*)&param);
pthread_create(&cid, NULL, cleanupThreadFp, (void*)&param);
pthread_join(qid, NULL);
pthread_join(cid, NULL);
break;
} }
CASE_LEAVE(); CASE_LEAVE();
} }
@ -600,7 +657,7 @@ int sqConKillAsyncQuery(bool fetch) {
void sqRunAllCase(void) { void sqRunAllCase(void) {
/* #if 1
sqStopSyncQuery(false); sqStopSyncQuery(false);
sqStopSyncQuery(true); sqStopSyncQuery(true);
sqStopAsyncQuery(false); sqStopAsyncQuery(false);
@ -620,23 +677,26 @@ void sqRunAllCase(void) {
sqConCloseSyncQuery(true); sqConCloseSyncQuery(true);
sqConCloseAsyncQuery(false); sqConCloseAsyncQuery(false);
sqConCloseAsyncQuery(true); sqConCloseAsyncQuery(true);
*/
#if 0
sqKillSyncQuery(false); sqKillSyncQuery(false);
sqKillSyncQuery(true); sqKillSyncQuery(true);
sqKillAsyncQuery(false); sqKillAsyncQuery(false);
sqKillAsyncQuery(true); sqKillAsyncQuery(true);
#endif
//sqConKillSyncQuery(false); sqConKillSyncQuery(false);
sqConKillSyncQuery(true); sqConKillSyncQuery(true);
#if 0
sqConKillAsyncQuery(false); sqConKillAsyncQuery(false);
sqConKillAsyncQuery(true); sqConKillAsyncQuery(true);
#endif #endif
/*
sqConCleanupSyncQuery(false);
sqConCleanupSyncQuery(true);
sqConCleanupAsyncQuery(false);
sqConCleanupAsyncQuery(true);
*/
int32_t l = 5; int32_t l = 5;
while (l) { while (l) {
printf("%d\n", l--); printf("%d\n", l--);

View File

@ -1,17 +0,0 @@
run general/compute/avg.sim
run general/compute/bottom.sim
run general/compute/count.sim
run general/compute/diff.sim
run general/compute/diff2.sim
run general/compute/first.sim
run general/compute/interval.sim
run general/compute/last.sim
run general/compute/leastsquare.sim
run general/compute/max.sim
run general/compute/min.sim
run general/compute/null.sim
run general/compute/percentile.sim
run general/compute/stddev.sim
run general/compute/sum.sim
run general/compute/top.sim
run general/compute/block_dist.sim

View File

@ -1,14 +0,0 @@
# run general/field/single.sim
run general/field/bool.sim
run general/field/smallint.sim
run general/field/tinyint.sim
run general/field/int.sim
run general/field/bigint.sim
run general/field/float.sim
run general/field/double.sim
# run general/field/binary.sim
# run general/field/2.sim
# run general/field/3.sim
# run general/field/4.sim
# run general/field/5.sim
# run general/field/6.sim

View File

@ -1,316 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
print ========== step1
system sh/cfg.sh -n dnode1 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 30000
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print =============== step2
sql create database d4 precision 'us'
sql use d4
sql create table t1 (ts timestamp, i int)
sql insert into d4.t1 values(1626739200000, 1)
sql create table d4.s001 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s002 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s003 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s004 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s005 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s006 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s007 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s008 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s009 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s000 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s011 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s012 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s013 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s014 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s015 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s016 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s017 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s018 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s019 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s010 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s021 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s022 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s023 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s024 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s025 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s026 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s027 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s028 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s029 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s020 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s031 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s032 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s033 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s034 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s035 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s036 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s037 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s038 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s039 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s030 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s041 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s042 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s043 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s044 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s045 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s046 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s047 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s048 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s049 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s040 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s051 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s052 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s053 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s054 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s055 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s056 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s057 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s058 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s059 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s050 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s061 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s062 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s063 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s064 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s065 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s066 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s067 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s068 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s069 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s060 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s071 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s072 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s073 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s074 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s075 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s076 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s077 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s078 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s079 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s070 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s081 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s082 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s083 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s084 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s085 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s086 as select count(req_http), count(req_insert), avg(req_select), sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s087 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s088 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s089 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s080 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s091 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s092 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s093 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s094 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s095 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s096 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s097 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s098 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s099 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s090 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
print =============== step21
sql create table d4.s101 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s102 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s103 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s104 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s105 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s106 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s107 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s108 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s109 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s100 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s111 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s112 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s113 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s114 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s115 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s116 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s117 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s118 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s119 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s110 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s121 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s122 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s123 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s124 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s125 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s126 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s127 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s128 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s129 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s120 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s131 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s132 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s133 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s134 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s135 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s136 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s137 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s138 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s139 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s130 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s141 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s142 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s143 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s144 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s145 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s146 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s147 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s148 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s149 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s140 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s151 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s152 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s153 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s154 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s155 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s156 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s157 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s158 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s159 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s150 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s161 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s162 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s163 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s164 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s165 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s166 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s167 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s168 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s169 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s160 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s171 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s172 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s173 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s174 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s175 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s176 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s177 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s178 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s179 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s170 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s181 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s182 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s183 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s184 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s185 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s186 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s187 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s188 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s189 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s180 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
sql create table d4.s191 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s192 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s193 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s194 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s195 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s196 as select count(req_http), count(req_insert) , sum(req_insert), max(req_select), min(req_insert) from log.dn_192_168_0_1 interval(5s)
sql create table d4.s197 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn interval(5s)
sql create table d4.s198 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn interval(5s)
sql create table d4.s199 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used) from log.dn interval(5s)
sql create table d4.s190 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read) from log.dn interval(5s)
print =============== step3
print sleep 22 seconds
sleep 50000
sql select * from d4.s001
$s1 = $rows
print select * from d4.s001 ==> $s1
if $rows <= 0 then
return -1
endi
sql select * from d4.s002
if $rows <= 0 then
return -1
endi
sql select * from d4.s003
if $rows <= 0 then
return -1
endi
sql select * from d4.s004
if $rows <= 0 then
return -1
endi
sql select * from d4.s005
$s5 = $rows
print select * from d4.s005 ==> $s5
if $rows <= 0 then
return -1
endi
sql select * from d4.s006
if $rows <= 0 then
return -1
endi
sql select * from d4.s007
if $rows <= 0 then
return -1
endi
sql select * from d4.s008
if $rows <= 0 then
return -1
endi
sql select * from d4.s009
if $rows <= 0 then
return -1
endi
sql select * from d4.s010
if $rows <= 0 then
return -1
endi
sql select * from d4.s101
if $rows <= 0 then
return -1
endi
sql select * from d4.s102
$s12 = $rows
print select * from d4.s102 ==> $s12
if $rows <= 0 then
return -1
endi

View File

@ -1,200 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
print ========== step1
system sh/cfg.sh -n dnode1 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print =============== step1
sleep 2000
sql select * from log.dn
if $rows == 0 then
return -1
endi
print =============== step2
sql create database d4 precision 'us'
sql use d4
sql create table t1 (ts timestamp, i int)
sql insert into d4.t1 values(1626739200000, 1)
sql create table d4.s1 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd), stddev(cpu_taosd), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s2 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd), stddev(cpu_taosd), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s3 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used), stddev(disk_used), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s4 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read), stddev(io_write), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s5 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed), stddev(band_speed), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s6 as select count(req_http), count(req_insert), avg(req_http), avg(req_select), sum(req_insert), max(req_select), min(req_insert), stddev(req_select), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s)
sql create table d4.s7 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
sql create table d4.s8 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
sql create table d4.s9 as select count(disk_used), count(disk_total), avg(disk_used), avg(disk_total), sum(disk_used), max(disk_used), min(disk_used), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
sql create table d4.s10 as select count(io_read), count(io_write), avg(io_read), avg(io_write), sum(io_read), max(io_write), min(io_read), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
sql create table d4.s11 as select count(band_speed), avg(band_speed), sum(band_speed), max(band_speed), min(band_speed), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
sql create table d4.s12 as select count(req_http), count(req_insert), avg(req_select), avg(req_insert), sum(req_insert), max(req_select), min(req_insert), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn interval(5s)
print =============== step3
print sleep 22 seconds
sleep 22000
sql select * from d4.s1
$s1 = $rows
print select * from d4.s1 ==> $s1
if $rows <= 0 then
return -1
endi
sql select * from d4.s2
if $rows <= 0 then
return -1
endi
sql select * from d4.s3
if $rows <= 0 then
return -1
endi
sql select * from d4.s4
if $rows <= 0 then
return -1
endi
sql select * from d4.s5
$s5 = $rows
print select * from d4.s5 ==> $s5
if $rows <= 0 then
return -1
endi
sql select * from d4.s6
if $rows <= 0 then
return -1
endi
sql select * from d4.s7
if $rows <= 0 then
return -1
endi
sql select * from d4.s8
if $rows <= 0 then
return -1
endi
sql select * from d4.s9
if $rows <= 0 then
return -1
endi
sql select * from d4.s10
if $rows <= 0 then
return -1
endi
sql select * from d4.s11
if $rows <= 0 then
return -1
endi
sql select * from d4.s12
$s12 = $rows
print select * from d4.s12 ==> $s12
if $rows <= 0 then
return -1
endi
print =============== step4
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start
print sleep 22 seconds
sleep 22000
sql select * from d4.s1
print select * from d4.s1 ==> $rows $s1
if $rows <= 0 then
return -1
endi
if $rows <= $s1 then
return -1
endi
sql select * from d4.s2
if $rows <= 0 then
return -1
endi
sql select * from d4.s3
if $rows <= 0 then
return -1
endi
sql select * from d4.s4
if $rows <= 0 then
return -1
endi
sql select * from d4.s5
print select * from d4.s5 ==> $rows $s5
if $rows <= 0 then
return -1
endi
if $rows <= $s5 then
return -1
endi
sql select * from d4.s6
if $rows <= 0 then
return -1
endi
sql select * from d4.s7
if $rows <= 0 then
return -1
endi
sql select * from d4.s8
if $rows <= 0 then
return -1
endi
sql select * from d4.s9
if $rows <= 0 then
return -1
endi
sql select * from d4.s10
if $rows <= 0 then
return -1
endi
sql select * from d4.s11
if $rows <= 0 then
return -1
endi
sql select * from d4.s12
print select * from d4.s12 ==> $rows $s12
if $rows <= 0 then
return -1
endi
if $rows <= $s12 then
return -1
endi

View File

@ -1,95 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = md_db
$tbPrefix = md_tb
$mtPrefix = md_mt
$stPrefix = md_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
$y = 0
while $y < $rowNum
$ts = 1626710400000 + $x
sql insert into $tb values ($ts , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2 c3
sql select count(*), count(tbcol), count(tbcol2) from $mt interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $mt interval(1d) ===> $data00 $data01 $data02, $data03
if $data01 != 200 then
return -1
endi
if $data02 != 200 then
return -1
endi
if $data03 != 200 then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $mt interval(1d)
print =============== step3
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql drop table $tb
$i = $i + 1
endw
sql drop table $mt
print =============== step4
print sleep 120 seconds
sleep 120000
print =============== step5
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st
print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $data01 != null then
return -1
endi
if $data02 != null then
return -1
endi
if $data03 != null then
return -1
endi

View File

@ -1,245 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = m1v_db
$tbPrefix = m1v_tb
$mtPrefix = m1v_mt
$stPrefix = m1v_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2 c1
sql select count(*) from $mt interval(1d)
print select count(*) from $mt interval(1d) ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . c1
sql create table $st as select count(*) from $mt interval(1d)
print =============== step3 c2
sql select count(tbcol) from $mt interval(1d)
print select count(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . c2
sql create table $st as select count(tbcol) from $mt interval(1d)
print =============== step4 c3
sql select count(tbcol2) from $mt interval(1d)
print select count(tbcol2) from $mt interval(1d) ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(tbcol2) from $mt interval(1d)
print =============== step5 avg
sql select avg(tbcol) from $mt interval(1d)
print select avg(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 9.500000000 then
return -1
endi
$st = $stPrefix . av
sql create table $st as select avg(tbcol) from $mt interval(1d)
print =============== step6 su
sql select sum(tbcol) from $mt interval(1d)
print select sum(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 1900 then
return -1
endi
$st = $stPrefix . su
sql create table $st as select sum(tbcol) from $mt interval(1d)
print =============== step7 mi
sql select min(tbcol) from $mt interval(1d)
print select min(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . mi
sql create table $st as select min(tbcol) from $mt interval(1d)
print =============== step8 ma
sql select max(tbcol) from $mt interval(1d)
print select max(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . ma
sql create table $st as select max(tbcol) from $mt interval(1d)
print =============== step9 fi
sql select first(tbcol) from $mt interval(1d)
print select first(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . fi
sql create table $st as select first(tbcol) from $mt interval(1d)
print =============== step10 la
sql select last(tbcol) from $mt interval(1d)
print select last(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . la
sql create table $st as select last(tbcol) from $mt interval(1d)
print =============== step11 wh
sql select count(tbcol) from $mt where ts < 1626739440001 interval(1d)
print select count(tbcol) from $mt where ts < 1626739440000 interval(1d) ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . wh
#sql create table $st as select count(tbcol) from $mt where ts < 1626739200000 + 4m interval(1d)
print =============== step12 as
sql select count(tbcol) from $mt interval(1d)
print select count(tbcol) from $mt interval(1d) ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . as
sql create table $st as select count(tbcol) as c from $mt interval(1d)
print =============== step13
print sleep 120 seconds
sleep 120000
print =============== step14
$st = $stPrefix . c1
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . c2
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 200 then
return -1
endi
$st = $stPrefix . av
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 9.500000000 then
return -1
endi
$st = $stPrefix . su
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 1900 then
return -1
endi
$st = $stPrefix . mi
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . ma
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . fi
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . la
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . wh
#sql select * from $st
#print ===> select * from $st ===> $data00 $data01
#if $data01 != 200 then
# return -1
#endi
$st = $stPrefix . as
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 200 then
return -1
endi

View File

@ -1,176 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$i = 0
$dbPrefix = rs_db
$tbPrefix = rs_tb
$mtPrefix = rs_mt
$stPrefix = rs_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
$db = $dbPrefix
$tb = $tbPrefix . $i
$mt = $mtPrefix
$stm = $stPrefix . m
$stt = $stPrefix . t
print =============== step1
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 int ) TAGS(tgcol bool)
$i = 0
while $i < 10
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( 0 )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
print =============== step2
$i = 0
$tb = $tbPrefix . $i
sql select count(*) from $tb interval(1d)
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 20 then
return -1
endi
sql select count(*) from $mt interval(1d)
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 200 then
return -1
endi
print =============== step3
sql create table $stt as select count(*) from $tb interval(1d)
sql create table $stm as select count(*) from $mt interval(1d)
print sleep 120 seconds
sleep 120000
sql select * from $stt
print select count(*) from $stt ===> $data00 $data01
if $rows != 1 then
return -1
endi
if $data01 != 20 then
return -1
endi
sql select * from $stm
print select * from $stm ===> $data00 $data01
if $rows != 1 then
return -1
endi
if $data01 != 200 then
return -1
endi
print =============== step4
system sh/exec.sh -n dnode1 -s stop
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
print =============== step5
print ==> renew cache
sql reset query cache
sleep 1000
print =============== step6
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol bigint, tbcol2 bigint ) TAGS(tgcol int)
$i = 0
while $i < 5
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( 0 )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
print =============== step7
sql select count(*) from $tb interval(1d)
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 20 then
return -1
endi
sql select count(*) from $mt interval(1d)
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 100 then
return -1
endi
print =============== step8
sql create table $stt as select count(*) from $tb interval(1d)
sql create table $stm as select count(*) from $mt interval(1d)
print sleep 120 seconds
sleep 120000
sql select * from $stt
sleep 1000
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 20 then
return -1
endi
sql select * from $stm
print ===>rows $rows, data $data01
if $rows != 1 then
return -1
endi
if $data01 != 100 then
return -1
endi

View File

@ -1,73 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = s3_db
$tbPrefix = s3_tb
$mtPrefix = s3_mt
$stPrefix = s3_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db keep 36500
sql use $db
sql create stable $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
sql create table cq1 as select count(*) from $mt interval(10s);
sleep 1000
sql create table $st using $mt tags(1);
sql insert into $st values (-50000, 1, 1.0);
sql insert into $st values (-10000, 1, 1.0);
sql insert into $st values (10000, 1, 1.0);
$i = 0
while $i < 12
sql select * from cq1;
if $rows != 3 then
sleep 10000
else
if $data00 != @70-01-01 07:59:10.000@ then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != @70-01-01 07:59:50.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data20 != @70-01-01 08:00:10.000@ then
return -1
endi
if $data21 != 1 then
return -1
endi
$i = 12
endi
$i = $i + 1
endw

View File

@ -1,201 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = s3_db
$tbPrefix = s3_tb
$mtPrefix = s3_mt
$stPrefix = s3_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2 c1
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb interval(1d)
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c1
sql create table $st as select count(*) from $tb interval(1d)
print =============== step3 c2
sql select count(tbcol) from $tb interval(1d)
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c2
sql create table $st as select count(tbcol) from $tb interval(1d)
print =============== step4 c3
sql select count(tbcol2) from $tb interval(1d)
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(tbcol2) from $tb interval(1d)
print =============== step5
print sleep 120 seconds
sleep 120000
print =============== step6
$st = $stPrefix . c1
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c2
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
print =============== step7
system sh/exec.sh -n dnode1 -s stop
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 4000
print ======================== dnode1 start
$dbPrefix = stst3db
$tbPrefix = stst3tb
$mtPrefix = stst3mt
$stPrefix = stst3st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step8
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step8
step8:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step9 c3
$i = 1
$tb = $tbPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) ===> $data00 $data01 $data02, $data03
if $data01 != $rowNum then
return -1
endi
if $data02 != $rowNum then
return -1
endi
if $data03 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print =============== step10
print sleep 120 seconds
sleep 120000
print =============== step11
#$st = $stPrefix . c3
#sql select * from $st -x step11
# print ===> select * from $st first time should be error
# return -1
#step11:
print =============== step12
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st
print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $data01 != $rowNum then
return -1
endi
if $data02 != $rowNum then
return -1
endi
if $data03 != $rowNum then
return -1
endi

View File

@ -1,142 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = sr_db
$tbPrefix = sr_tb
$mtPrefix = sr_mt
$stPrefix = sr_st
$tbNum = 10
$rowNum = 200
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
$y = 0
while $y < $rowNum
$ms = $x . s
sql insert into $tb values (1626739200000 + $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(10s)
$i = 5
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(10s)
$i = 8
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(10s)
sql show tables
if $rows != 13 then
return -1
endi
print =============== step3
sleep 2000
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 1000
system sh/exec.sh -n dnode1 -s start
print =============== step4
print sleep 120 seconds
sleep 120000
print =============== step5
$i = 1
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $tb
print $tb ==> $rows $data00 $data01
if $rows != $rowNum then
return -1
endi
$i = 5
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $tb
print $tb ==> $rows $data00 $data01
if $rows != $rowNum then
return -1
endi
$i = 8
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $tb
print $tb ==> $rows $data00 $data01
if $rows != $rowNum then
return -1
endi
print =============== step6
$i = 1
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st ==> $rows $data00 $data01
if $rows <= 1 then
return -1
endi
$i = 5
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st ==> $rows $data00 $data01
if $rows <= 1 then
return -1
endi
$i = 8
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st ==> $rows $data00 $data01
if $rows <= 1 then
return -1
endi

View File

@ -1,90 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = td_db
$tbPrefix = td_tb
$mtPrefix = td_mt
$stPrefix = td_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2 c3
$i = 1
$tb = $tbPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) ===> $data00 $data01 $data02, $data03
if $data01 != $rowNum then
return -1
endi
if $data02 != $rowNum then
return -1
endi
if $data03 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print =============== step3
sql drop table $tb
print =============== step4
print sleep 120 seconds
sleep 120000
print =============== step5
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st
print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $data01 != null then
return -1
endi
if $data02 != null then
return -1
endi
if $data03 != null then
return -1
endi

View File

@ -1,299 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ======================== dnode1 start
$dbPrefix = t1v_db
$tbPrefix = t1v_tb
$mtPrefix = t1v_mt
$stPrefix = t1v_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -400
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (1626739200000 $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2 c1
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb interval(1d)
print select count(*) from $tb interval(1d) ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c1
sql create table $st as select count(*) from $tb interval(1d)
print =============== step3 c2
sql select count(tbcol) from $tb interval(1d)
print select count(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c2
sql create table $st as select count(tbcol) from $tb interval(1d)
print =============== step4 c3
sql select count(tbcol2) from $tb interval(1d)
print select count(tbcol2) from $tb interval(1d) ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql create table $st as select count(tbcol2) from $tb interval(1d)
print =============== step5 avg
sql select avg(tbcol) from $tb interval(1d)
print select avg(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 9.500000000 then
return -1
endi
$st = $stPrefix . av
sql create table $st as select avg(tbcol) from $tb interval(1d)
print =============== step6 su
sql select sum(tbcol) from $tb interval(1d)
print select sum(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 190 then
return -1
endi
$st = $stPrefix . su
sql create table $st as select sum(tbcol) from $tb interval(1d)
print =============== step7 mi
sql select min(tbcol) from $tb interval(1d)
print select min(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . mi
sql create table $st as select min(tbcol) from $tb interval(1d)
print =============== step8 ma
sql select max(tbcol) from $tb interval(1d)
print select max(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . ma
sql create table $st as select max(tbcol) from $tb interval(1d)
print =============== step9 fi
sql select first(tbcol) from $tb interval(1d)
print select first(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . fi
sql create table $st as select first(tbcol) from $tb interval(1d)
print =============== step10 la
sql select last(tbcol) from $tb interval(1d)
print select last(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . la
sql create table $st as select last(tbcol) from $tb interval(1d)
print =============== step11 st
sql select stddev(tbcol) from $tb interval(1d)
print select stddev(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != 5.766281297 then
return -1
endi
$st = $stPrefix . st
sql create table $st as select stddev(tbcol) from $tb interval(1d)
print =============== step12 le
sql select leastsquares(tbcol, 1, 1) from $tb interval(1d)
print select leastsquares(tbcol, 1, 1) from $tb interval(1d) ===> $data00 $data01
#if $data01 != @(0.000017, -25362055.126740)@ then
# return -1
#endi
$st = $stPrefix . le
sql create table $st as select leastsquares(tbcol, 1, 1) from $tb interval(1d)
print =============== step13 pe
sql select percentile(tbcol, 1) from $tb interval(1d)
print select percentile(tbcol, 1) from $tb interval(1d) ===> $data00 $data01
if $data01 != 0.190000000 then
return -1
endi
$st = $stPrefix . pe
sql create table $st as select percentile(tbcol, 1) from $tb interval(1d)
print =============== step14 wh
sql select count(tbcol) from $tb where ts < 1626739440001 interval(1d)
print select count(tbcol) from $tb where ts < 1626739440001 interval(1d) ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . wh
#sql create table $st as select count(tbcol) from $tb where ts < 1626739200000 + 4m interval(1d)
print =============== step15 as
sql select count(tbcol) from $tb interval(1d)
print select count(tbcol) from $tb interval(1d) ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . as
sql create table $st as select count(tbcol) as c from $tb interval(1d)
print =============== step16
print sleep 120 seconds
sleep 120000
print =============== step17
$st = $stPrefix . c1
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c2
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . c3
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi
$st = $stPrefix . av
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 9.500000000 then
return -1
endi
$st = $stPrefix . su
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 190 then
return -1
endi
$st = $stPrefix . mi
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . ma
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . fi
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 0 then
return -1
endi
$st = $stPrefix . la
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 19 then
return -1
endi
$st = $stPrefix . st
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 5.766281297 then
return -1
endi
$st = $stPrefix . le
sql select * from $st
#print ===> select * from $st ===> $data00 $data01
#if $data01 != @(0.000017, -25270086.331047)@ then
# return -1
#endi
$st = $stPrefix . pe
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != 0.190000000 then
return -1
endi
$st = $stPrefix . wh
#sql select * from $st
#print ===> select * from $st ===> $data00 $data01
#if $data01 != $rowNum then
# return -1
#endi
$st = $stPrefix . as
sql select * from $st
print ===> select * from $st ===> $data00 $data01
if $data01 != $rowNum then
return -1
endi

View File

@ -1,6 +0,0 @@
run general/stream/stream_3.sim
run general/stream/stream_restart.sim
run general/stream/table_del.sim
run general/stream/metrics_del.sim
run general/stream/table_replica1_vnoden.sim
run general/stream/metrics_replica1_vnoden.sim

View File

@ -1,11 +0,0 @@
run general/vector/metrics_field.sim
run general/vector/metrics_mix.sim
run general/vector/metrics_query.sim
run general/vector/metrics_tag.sim
run general/vector/metrics_time.sim
run general/vector/multi.sim
run general/vector/single.sim
run general/vector/table_field.sim
run general/vector/table_mix.sim
run general/vector/table_query.sim
run general/vector/table_time.sim

View File

@ -1,46 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
system sh/cfg.sh -n dnode1 -c tableIncStepPerVnode -v 2
print ============== deploy
system sh/exec.sh -n dnode1 -s start
sleep 3001
sql connect
sql create database d1
sql use d1
sql create table st (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < 100
$tb = t . $i
sql create table $tb using st tags( $i )
sql insert into $tb values (now , $i )
$i = $i + 1
endw
sql_error sql create table tt (ts timestamp, i int)
print =============== step3
sql select * from st;
if $rows != 100 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
sleep 2000
print =============== step4
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql select * from st;
if $rows != 100 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -1,146 +0,0 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c http -v 1
system sh/cfg.sh -n dnode2 -c http -v 1
system sh/cfg.sh -n dnode3 -c http -v 1
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode1 -c replica -v 3
system sh/cfg.sh -n dnode2 -c replica -v 3
system sh/cfg.sh -n dnode3 -c replica -v 3
system sh/cfg.sh -n dnode1 -c maxSQLLength -v 940032
system sh/cfg.sh -n dnode2 -c maxSQLLength -v 940032
system sh/cfg.sh -n dnode3 -c maxSQLLength -v 940032
print ============== deploy
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
print =============== step1
$x = 0
show1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql show mnodes -x show1
$mnode1Role = $data2_1
print mnode1Role $mnode1Role
$mnode2Role = $data2_2
print mnode2Role $mnode2Role
$mnode3Role = $data2_3
print mnode3Role $mnode3Role
if $mnode1Role != master then
goto show1
endi
if $mnode2Role != slave then
goto show1
endi
if $mnode3Role != slave then
goto show1
endi
print =============== step2
sql create database d1 replica 3
sql use d1
sql create table table_rest (ts timestamp, i int)
print sql length is 870KB
restful d1 table_rest 1591072800 30000
restful d1 table_rest 1591172800 30000
restful d1 table_rest 1591272800 30000
restful d1 table_rest 1591372800 30000
restful d1 table_rest 1591472800 30000
restful d1 table_rest 1591572800 30000
restful d1 table_rest 1591672800 30000
restful d1 table_rest 1591772800 30000
restful d1 table_rest 1591872800 30000
restful d1 table_rest 1591972800 30000
sleep 100
sql select * from table_rest;
print rows: $rows
if $rows != 300000 then
return -1
endi
print =============== step3
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sql select * from table_rest;
print rows: $rows
if $rows != 300000 then
return -1
endi
system sh/exec.sh -n dnode1 -s start -x SIGINT
$x = 0
a1:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show vgroups
print online vnodes $data03
if $data03 != 3 then
goto a1
endi
print =============== step4
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql select * from table_rest;
print rows: $rows
if $rows != 300000 then
return -1
endi
system sh/exec.sh -n dnode2 -s start -x SIGINT
$x = 0
a2:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show vgroups
print online vnodes $data03
if $data03 != 3 then
goto a2
endi
print =============== step5
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sql select * from table_rest;
print rows: $rows
if $rows != 300000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT

View File

@ -1,33 +1,12 @@
#======================b1-start=============== #======================b1-start===============
# ---- alter
./test.sh -f tsim/alter/cached_schema_after_alter.sim
./test.sh -f tsim/alter/dnode.sim
#./test.sh -f tsim/alter/table.sim
# ---- user # ---- user
./test.sh -f tsim/user/basic.sim ./test.sh -f tsim/user/basic.sim
./test.sh -f tsim/user/password.sim ./test.sh -f tsim/user/password.sim
./test.sh -f tsim/user/privilege_db.sim ./test.sh -f tsim/user/privilege_db.sim
./test.sh -f tsim/user/privilege_sysinfo.sim ./test.sh -f tsim/user/privilege_sysinfo.sim
# ---- cache
./test.sh -f tsim/cache/new_metrics.sim
./test.sh -f tsim/cache/restart_table.sim
./test.sh -f tsim/cache/restart_metrics.sim
# ---- column
./test.sh -f tsim/column/commit.sim
./test.sh -f tsim/column/metrics.sim
./test.sh -f tsim/column/table.sim
# ---- compress
./test.sh -f tsim/compress/commitlog.sim
./test.sh -f tsim/compress/compress2.sim
./test.sh -f tsim/compress/compress.sim
./test.sh -f tsim/compress/uncompress.sim
# ---- db # ---- db
./test.sh -f tsim/db/alter_option.sim ./test.sh -f tsim/db/alter_option.sim
# ./test.sh -f tsim/db/alter_replica_13.sim # ./test.sh -f tsim/db/alter_replica_13.sim
@ -108,7 +87,7 @@
./test.sh -f tsim/mnode/basic1.sim ./test.sh -f tsim/mnode/basic1.sim
./test.sh -f tsim/mnode/basic2.sim ./test.sh -f tsim/mnode/basic2.sim
./test.sh -f tsim/mnode/basic3.sim ./test.sh -f tsim/mnode/basic3.sim
#./test.sh -f tsim/mnode/basic4.sim ./test.sh -f tsim/mnode/basic4.sim
./test.sh -f tsim/mnode/basic5.sim ./test.sh -f tsim/mnode/basic5.sim
# ---- show # ---- show
@ -226,4 +205,78 @@
./test.sh -f tsim/scalar/in.sim ./test.sh -f tsim/scalar/in.sim
./test.sh -f tsim/scalar/scalar.sim ./test.sh -f tsim/scalar/scalar.sim
# ---- alter
./test.sh -f tsim/alter/cached_schema_after_alter.sim
./test.sh -f tsim/alter/dnode.sim
#./test.sh -f tsim/alter/table.sim
# ---- cache
./test.sh -f tsim/cache/new_metrics.sim
./test.sh -f tsim/cache/restart_table.sim
./test.sh -f tsim/cache/restart_metrics.sim
# ---- column
./test.sh -f tsim/column/commit.sim
./test.sh -f tsim/column/metrics.sim
./test.sh -f tsim/column/table.sim
# ---- compress
./test.sh -f tsim/compress/commitlog.sim
./test.sh -f tsim/compress/compress2.sim
./test.sh -f tsim/compress/compress.sim
./test.sh -f tsim/compress/uncompress.sim
# ---- compute
#./test.sh -f tsim/compute/avg.sim
#./test.sh -f tsim/compute/block_dist.sim
#./test.sh -f tsim/compute/bottom.sim
#./test.sh -f tsim/compute/count.sim
#./test.sh -f tsim/compute/diff.sim
#./test.sh -f tsim/compute/diff2.sim
#./test.sh -f tsim/compute/first.sim
#./test.sh -f tsim/compute/interval.sim
#./test.sh -f tsim/compute/last_row.sim
#./test.sh -f tsim/compute/last.sim
#./test.sh -f tsim/compute/leastsquare.sim
#./test.sh -f tsim/compute/max.sim
#./test.sh -f tsim/compute/min.sim
#./test.sh -f tsim/compute/null.sim
./test.sh -f tsim/compute/percentile.sim
./test.sh -f tsim/compute/stddev.sim
#./test.sh -f tsim/compute/sum.sim
./test.sh -f tsim/compute/top.sim
# ---- field
./test.sh -f tsim/field/2.sim
./test.sh -f tsim/field/3.sim
./test.sh -f tsim/field/4.sim
./test.sh -f tsim/field/5.sim
./test.sh -f tsim/field/6.sim
./test.sh -f tsim/field/binary.sim
./test.sh -f tsim/field/bigint.sim
./test.sh -f tsim/field/bool.sim
./test.sh -f tsim/field/double.sim
./test.sh -f tsim/field/float.sim
./test.sh -f tsim/field/int.sim
./test.sh -f tsim/field/single.sim
./test.sh -f tsim/field/smallint.sim
./test.sh -f tsim/field/tinyint.sim
./test.sh -f tsim/field/unsigined_bigint.sim
# ---- vector
./test.sh -f tsim/vector/metrics_field.sim
./test.sh -f tsim/vector/metrics_mix.sim
./test.sh -f tsim/vector/metrics_query.sim
./test.sh -f tsim/vector/metrics_tag.sim
./test.sh -f tsim/vector/metrics_time.sim
./test.sh -f tsim/vector/multi.sim
./test.sh -f tsim/vector/single.sim
./test.sh -f tsim/vector/table_field.sim
./test.sh -f tsim/vector/table_mix.sim
./test.sh -f tsim/vector/table_query.sim
./test.sh -f tsim/vector/table_time.sim
# ---- wal
./test.sh -f tsim/wal/kill.sim
#======================b1-end=============== #======================b1-end===============

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_av_db $dbPrefix = m_av_db
@ -163,7 +160,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_di_db $dbPrefix = m_di_db
@ -91,7 +88,7 @@ sql_error select _block_dist() from (select * from $mt)
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_bo_db $dbPrefix = m_bo_db
@ -98,7 +95,7 @@ step6:
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_co_db $dbPrefix = m_co_db
@ -192,7 +189,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_di_db $dbPrefix = m_di_db
@ -91,7 +88,7 @@ step6:
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_di_db $dbPrefix = m_di_db
@ -152,7 +149,7 @@ step6:
print =============== clear print =============== clear
#sql drop database $db #sql drop database $db
#sql show databases #sql show databases
#if $rows != 0 then #if $rows != 2 then
# return -1 # return -1
#endi #endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_fi_db $dbPrefix = m_fi_db
@ -165,7 +162,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_in_db $dbPrefix = m_in_db
@ -199,7 +196,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_la_db $dbPrefix = m_la_db
@ -169,7 +166,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_la_db $dbPrefix = m_la_db
@ -217,7 +214,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_le_db $dbPrefix = m_le_db
@ -93,7 +90,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_ma_db $dbPrefix = m_ma_db
@ -169,7 +166,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_mi_db $dbPrefix = m_mi_db
@ -73,14 +69,14 @@ endi
print =============== step5 print =============== step5
sql select min(tbcol) as b from $tb interval(1m) sql select min(tbcol) as b from $tb interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
sql select min(tbcol) as b from $tb interval(1d) sql select min(tbcol) as b from $tb interval(1d)
print ===> $data01 print ===> $data00
if $data01 != 0 then if $data00 != 0 then
return -1 return -1
endi endi
@ -90,8 +86,8 @@ $ms = 1601481600000 + $cc
sql select min(tbcol) as b from $tb where ts <= $ms interval(1m) sql select min(tbcol) as b from $tb where ts <= $ms interval(1m)
print select min(tbcol) as b from $tb where ts <= $ms interval(1m) print select min(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
if $rows != 5 then if $rows != 5 then
@ -130,14 +126,14 @@ endi
print =============== step9 print =============== step9
sql select min(tbcol) as b from $mt interval(1m) sql select min(tbcol) as b from $mt interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
sql select min(tbcol) as b from $mt interval(1d) sql select min(tbcol) as b from $mt interval(1d)
print ===> $data01 print ===> $data00
if $data01 != 0 then if $data00 != 0 then
return -1 return -1
endi endi
@ -155,9 +151,9 @@ endi
print =============== step11 print =============== step11
$cc = 4 * 60000 $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select min(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol sql select min(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
print ===> $rows print ===> $rows
@ -168,7 +164,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = db $dbPrefix = db
@ -98,22 +95,26 @@ if $data02 != 19 then
return -1 return -1
endi endi
sql select * from $tb where tbcol = NULL -x step3 sql select * from $tb where tbcol is NULL
if $rows != 1 then
return -1 return -1
step3: endi
sql_error select * from $tb where tbcol = NULL
return
print =============== step5 print =============== step5
sql create table $tb using $mt tags( NULL ) sql create table tt using $mt tags( NULL )
# return -1
#step51:
#sql alter table $tb set tgcol=NULL -x step52 #sql alter table $tb set tgcol=NULL -x step52
# return -1 # return -1
#step52: #step52:
sql select * from $mt where tgcol = NULL -x step5 sql select * from $mt where tgcol is NULL
if $rows != 1 then
return -1 return -1
step5: endi
print =============== step6 print =============== step6
sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $mt sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $mt
@ -222,7 +223,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_pe_db $dbPrefix = m_pe_db
@ -125,11 +122,10 @@ if $data00 != 5.000000000 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_st_db $dbPrefix = m_st_db
@ -72,14 +69,14 @@ endi
print =============== step5 print =============== step5
sql select stddev(tbcol) as b from $tb interval(1m) sql select stddev(tbcol) as b from $tb interval(1m)
print ===> $data01 print ===> $data00
if $data01 != 0.000000000 then if $data00 != 0.000000000 then
return -1 return -1
endi endi
sql select stddev(tbcol) as b from $tb interval(1d) sql select stddev(tbcol) as b from $tb interval(1d)
print ===> $data01 print ===> $data00
if $data01 != 5.766281297 then if $data00 != 5.766281297 then
return -1 return -1
endi endi
@ -88,8 +85,8 @@ $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m) sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data01 print ===> $data00
if $data01 != 0.000000000 then if $data00 != 0.000000000 then
return -1 return -1
endi endi
if $rows != 5 then if $rows != 5 then
@ -99,7 +96,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_su_db $dbPrefix = m_su_db
@ -72,14 +69,14 @@ endi
print =============== step5 print =============== step5
sql select sum(tbcol) as b from $tb interval(1m) sql select sum(tbcol) as b from $tb interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
sql select sum(tbcol) as b from $tb interval(1d) sql select sum(tbcol) as b from $tb interval(1d)
print ===> $data01 print ===> $data00
if $data01 != 190 then if $data00 != 190 then
return -1 return -1
endi endi
@ -88,8 +85,8 @@ $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m) sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m)
print ===> $data11 print ===> $data10
if $data11 != 1 then if $data10 != 1 then
return -1 return -1
endi endi
if $rows != 5 then if $rows != 5 then
@ -130,14 +127,14 @@ endi
print =============== step9 print =============== step9
sql select sum(tbcol) as b from $mt interval(1m) sql select sum(tbcol) as b from $mt interval(1m)
print ===> $data11 print ===> $data10
if $data11 < 5 then if $data10 < 5 then
return -1 return -1
endi endi
sql select sum(tbcol) as b from $mt interval(1d) sql select sum(tbcol) as b from $mt interval(1d)
print ===> $data01 print ===> $data00
if $data01 != 1900 then if $data00 != 1900 then
return -1 return -1
endi endi
@ -156,10 +153,10 @@ print =============== step11
$cc = 4 * 60000 $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol sql select sum(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1d)
print select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol print select sum(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1d)
print ===> $data01 print ===> $data00 $rows
if $data01 != 10 then if $data00 != 10 then
return -1 return -1
endi endi
if $rows != 10 then if $rows != 10 then
@ -169,7 +166,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
$dbPrefix = m_to_db $dbPrefix = m_to_db
@ -48,8 +45,8 @@ $i = 1
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql select top(tbcol, 1) from $tb sql select top(tbcol, 1) from $tb
print ===> $data01 print ===> $data00
if $data01 != 19 then if $data00 != 19 then
return -1 return -1
endi endi
@ -58,25 +55,25 @@ $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select top(tbcol, 1) from $tb where ts <= $ms sql select top(tbcol, 1) from $tb where ts <= $ms
print ===> $data01 print ===> $data00
if $data01 != 4 then if $data00 != 4 then
return -1 return -1
endi endi
print =============== step4 print =============== step4
sql select top(tbcol, 1) as b from $tb sql select top(tbcol, 1) as b from $tb
print ===> $data01 print ===> $data00
if $data01 != 19 then if $data00 != 19 then
return -1 return -1
endi endi
print =============== step5 print =============== step5
sql select top(tbcol, 2) as b from $tb sql select top(tbcol, 2) as b from $tb
print ===> $data01 $data11 print ===> $data00 $data10
if $data01 != 18 then if $data00 != 18 then
return -1 return -1
endi endi
if $data11 != 19 then if $data10 != 19 then
return -1 return -1
endi endi
@ -85,11 +82,11 @@ $cc = 4 * 60000
$ms = 1601481600000 + $cc $ms = 1601481600000 + $cc
sql select top(tbcol, 2) as b from $tb where ts <= $ms sql select top(tbcol, 2) as b from $tb where ts <= $ms
print ===> $data01 $data11 print ===> $data00 $data10
if $data01 != 3 then if $data00 != 3 then
return -1 return -1
endi endi
if $data11 != 4 then if $data10 != 4 then
return -1 return -1
endi endi
@ -100,7 +97,7 @@ step6:
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -280,18 +278,18 @@ if $data00 != 25 then
endi endi
print =============== step12 print =============== step12
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 partition by tgcol interval(1d) order by tgcol desc
print $db print $db
print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 partition by tgcol interval(1d)
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -493,28 +491,28 @@ if $data00 != 25 then
endi endi
print =============== step19 print =============== step19
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol1 interval(1d) order by tgcol1 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol2 interval(1d) order by tgcol2 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol3 interval(1d) order by tgcol3 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -677,34 +675,34 @@ if $data00 != 25 then
endi endi
print =============== step24 print =============== step24
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol1 interval(1d) order by tgcol1 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol2 interval(1d) order by tgcol2 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol3 interval(1d) order by tgcol3 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 partition by tgcol4 interval(1d) order by tgcol4 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -794,40 +792,40 @@ endi
print =============== step27 print =============== step27
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol1 interval(1d) order by tgcol1 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol2 interval(1d) order by tgcol2 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol3 interval(1d) order by tgcol3 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 partition by tgcol4 interval(1d) order by tgcol4 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 partition by tgcol5 interval(1d) order by tgcol5 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -943,46 +941,46 @@ if $data00 != 25 then
endi endi
print =============== step31 print =============== step31
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol1 interval(1d) order by tgcol1 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol2 interval(1d) order by tgcol2 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol3 interval(1d) order by tgcol3 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 partition by tgcol4 interval(1d) order by tgcol4 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 partition by tgcol5 interval(1d) order by tgcol5 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 interval(1d) group by tgcol6 order by tgcol6 desc sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 partition by tgcol6 interval(1d) order by tgcol6 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -146,16 +143,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -47,7 +44,6 @@ while $i < 10
$i = $i + 1 $i = $i + 1
endw endw
print =============== step2 print =============== step2
sql select * from $mt where tbcol = '0' sql select * from $mt where tbcol = '0'
@ -70,7 +66,7 @@ sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), f
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -144,17 +141,17 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true partition by tgcol interval(1d) order by tgcol desc
print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -144,16 +141,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -144,16 +142,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -144,16 +142,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -211,7 +209,7 @@ endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,10 +1,8 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
@ -144,16 +142,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -145,16 +142,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -1,12 +1,9 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect sql connect
print ======================== dnode1 start
print ======================== dnode1 start
$dbPrefix = db $dbPrefix = db
$tbPrefix = tb $tbPrefix = tb
$mtPrefix = st $mtPrefix = st
@ -27,7 +24,7 @@ $i = 0
while $i < 5 while $i < 5
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql create table $tb using $mt tags( 0 ) sql create table $tb using $mt tags( 0 )
sql create table $tb using $mt tags( -111 ) sql_error create table $tb using $mt tags( -111 )
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
@ -150,16 +147,16 @@ if $data00 != 25 then
endi endi
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 partition by tgcol interval(1d) order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then if $data00 != 100 then
return -1 return -1
endi endi
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -68,8 +68,8 @@ sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8 )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9 ) sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9 )
print ================ start query ====================== print ================ start query ======================
sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sql select _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s)
print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) print ===> select _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s)
print ===> rows: $rows print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data05 print ===> rows0: $data00 $data01 $data02 $data05
print ===> rows1: $data10 $data11 $data12 $data15 print ===> rows1: $data10 $data11 $data12 $data15
@ -89,8 +89,8 @@ if $data45 != 1 then
return -1 return -1
endi endi
sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sliding(10s) sql select _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s) sliding(10s)
print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sliding(10s) print ===> select _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s) sliding(10s)
print ===> rows: $rows print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data05 print ===> rows0: $data00 $data01 $data02 $data05
print ===> rows1: $data10 $data11 $data12 $data15 print ===> rows1: $data10 $data11 $data12 $data15
@ -177,7 +177,7 @@ if $data70 != 1 then
return -1 return -1
endi endi
sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sql select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct3 interval(1n, 1w)
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w)
print ===> rows: $rows print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows0: $data00 $data01 $data02 $data03 $data04
@ -200,11 +200,11 @@ if $data02 != 2678400000 then
return -1 return -1
endi endi
sql_error select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sliding(2w) sql_error select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct3 interval(1n, 1w) sliding(2w)
sql_error select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sliding(4w) sql_error select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct3 interval(1n, 1w) sliding(4w)
sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) sql select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct4 interval(1y, 6n)
print ===> select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) print ===> select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct4 interval(1y, 6n)
print ===> rows: $rows print ===> rows: $rows
print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows0: $data00 $data01 $data02 $data03 $data04
print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows1: $data10 $data11 $data12 $data13 $data14
@ -220,7 +220,7 @@ if $data04 != 2 then
endi endi
sql_error select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n) sql_error select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n)
sql_error select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) sliding(12n) sql_error select _wstart, count(tbcol), _wduration, _wstart, count(*) from ct4 interval(1y, 6n) sliding(12n)
#================================================= #=================================================
print =============== stop and restart taosd print =============== stop and restart taosd

View File

@ -82,8 +82,8 @@ print =============== step4
#$cc = 1 * 60000 #$cc = 1 * 60000
#$ms2 = 1601481600000 - $cc #$ms2 = 1601481600000 - $cc
sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb interval(1m) sql select _wstart, _wend, _wduration, _qstart, _qend, count(tbcol) from $tb interval(1m)
print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb interval(1m) print ===> select _wstart, _wend, _wduration, _qstart, _qend, count(tbcol) from $tb interval(1m)
print ===> $rows $data01 $data05 print ===> $rows $data01 $data05
if $rows != $rowNum then if $rows != $rowNum then
return -1 return -1

View File

@ -81,7 +81,7 @@ sql use $dbNamme
# session(ts,5a) # session(ts,5a)
print ====> select count(*) from dev_001 session(ts,5a) print ====> select count(*) from dev_001 session(ts,5a)
sql select _wstartts, count(*) from dev_001 session(ts,5a) sql select _wstart, count(*) from dev_001 session(ts,5a)
print ====> rows: $rows print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05 print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15 print ====> $data10 $data11 $data12 $data13 $data14 $data15
@ -102,7 +102,7 @@ endi
# #
#print ====> select count(*) from (select * from dev_001) session(ts,5a) #print ====> select count(*) from (select * from dev_001) session(ts,5a)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,5a) #sql select _wstart, count(*) from (select * from dev_001) session(ts,5a)
#if $rows != 15 then #if $rows != 15 then
# return -1 # return -1
#endi #endi
@ -111,7 +111,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1s) print ====> select count(*) from dev_001 session(ts,1s)
sql select _wstartts, count(*) from dev_001 session(ts,1s) sql select _wstart, count(*) from dev_001 session(ts,1s)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -120,7 +120,7 @@ if $data01 != 5 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1s) #print ====> select count(*) from (select * from dev_001) session(ts,1s)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1s) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1s)
#if $rows != 12 then #if $rows != 12 then
# return -1 # return -1
#endi #endi
@ -129,7 +129,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1000a) print ====> select count(*) from dev_001 session(ts,1000a)
sql select _wstartts, count(*) from dev_001 session(ts,1000a) sql select _wstart, count(*) from dev_001 session(ts,1000a)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -138,7 +138,7 @@ if $data01 != 5 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1000a) #print ====> select count(*) from (select * from dev_001) session(ts,1000a)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1000a) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1000a)
#if $rows != 12 then #if $rows != 12 then
# return -1 # return -1
#endi #endi
@ -147,7 +147,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1m) print ====> select count(*) from dev_001 session(ts,1m)
sql select _wstartts, count(*) from dev_001 session(ts,1m) sql select _wstart, count(*) from dev_001 session(ts,1m)
if $rows != 9 then if $rows != 9 then
return -1 return -1
endi endi
@ -156,7 +156,7 @@ if $data01 != 8 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1m) #print ====> select count(*) from (select * from dev_001) session(ts,1m)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1m) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1m)
#if $rows != 9 then #if $rows != 9 then
# return -1 # return -1
#endi #endi
@ -165,7 +165,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1h) print ====> select count(*) from dev_001 session(ts,1h)
sql select _wstartts, count(*) from dev_001 session(ts,1h) sql select _wstart, count(*) from dev_001 session(ts,1h)
if $rows != 6 then if $rows != 6 then
return -1 return -1
endi endi
@ -174,7 +174,7 @@ if $data01 != 11 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1h) #print ====> select count(*) from (select * from dev_001) session(ts,1h)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1h) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1h)
#if $rows != 6 then #if $rows != 6 then
# return -1 # return -1
#endi #endi
@ -183,7 +183,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1d) print ====> select count(*) from dev_001 session(ts,1d)
sql select _wstartts, count(*) from dev_001 session(ts,1d) sql select _wstart, count(*) from dev_001 session(ts,1d)
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
@ -192,7 +192,7 @@ if $data01 != 13 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1d) #print ====> select count(*) from (select * from dev_001) session(ts,1d)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1d) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1d)
#if $rows != 4 then #if $rows != 4 then
# return -1 # return -1
#endi #endi
@ -201,7 +201,7 @@ endi
#endi #endi
print ====> select count(*) from dev_001 session(ts,1w) print ====> select count(*) from dev_001 session(ts,1w)
sql select _wstartts, count(*) from dev_001 session(ts,1w) sql select _wstart, count(*) from dev_001 session(ts,1w)
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -210,7 +210,7 @@ if $data01 != 15 then
endi endi
#print ====> select count(*) from (select * from dev_001) session(ts,1w) #print ====> select count(*) from (select * from dev_001) session(ts,1w)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1w) #sql select _wstart, count(*) from (select * from dev_001) session(ts,1w)
#if $rows != 2 then #if $rows != 2 then
# return -1 # return -1
#endi #endi
@ -298,7 +298,7 @@ sql_error select count(*) from dev_001 session(i,1y)
sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0' sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'
#print ====> select count(*) from dev_001 session(ts,1u) #print ====> select count(*) from dev_001 session(ts,1u)
#sql select _wstartts, count(*) from dev_001 session(ts,1u) #sql select _wstart, count(*) from dev_001 session(ts,1u)
#print rows: $rows #print rows: $rows
#print $data00 $data01 $data02 $data03 #print $data00 $data01 $data02 $data03
#print $data10 $data11 $data12 $data13 #print $data10 $data11 $data12 $data13

Some files were not shown because too many files have changed in this diff Show More