From 607f8163d3da22c1587d207a76146a06a8376abb Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 10 Jul 2022 18:54:58 +0800 Subject: [PATCH 01/92] feat:add logic for get_tmq_meta_json --- include/client/taos.h | 4 +- include/common/tdataformat.h | 3 +- include/common/tmsg.h | 6 + include/libs/parser/parser.h | 6 +- source/client/src/clientSml.c | 2 +- source/client/src/clientStmt.c | 11 +- source/client/src/tmq.c | 233 ++++++++++++++---- source/common/src/tmsg.c | 16 ++ source/dnode/mnode/impl/src/mndStb.c | 12 +- source/libs/parser/src/parInsert.c | 38 +-- source/libs/parser/src/parTranslater.c | 18 +- source/libs/parser/src/parUtil.c | 3 +- source/libs/scalar/src/sclfunc.c | 2 +- .../libs/scalar/test/scalar/scalarTests.cpp | 4 +- 14 files changed, 261 insertions(+), 97 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 362782b420..690c473986 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -265,7 +265,9 @@ typedef struct tmq_raw_data tmq_raw_data; DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res); DLL_EXPORT tmq_raw_data *tmq_get_raw_meta(TAOS_RES *res); DLL_EXPORT int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta); -DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed. +DLL_EXPORT void tmq_free_raw_meta(tmq_raw_data *rawMeta); +DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed by tmq_free_json_meta +DLL_EXPORT void tmq_free_json_meta(char* jsonMeta); DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res); DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res); DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res); diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index e70008e4ef..95ab12b94e 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -78,7 +78,7 @@ int32_t tEncodeTag(SEncoder *pEncoder, const STag *pTag); int32_t tDecodeTag(SDecoder *pDecoder, STag **ppTag); int32_t tTagToValArray(const STag *pTag, SArray **ppArray); void debugPrintSTag(STag *pTag, const char *tag, int32_t ln); // TODO: remove -int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf); +int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf, const char* colName); // STRUCT ================= struct STColumn { @@ -147,6 +147,7 @@ struct SColVal { #pragma pack(push, 1) struct STagVal { + char colName[TSDB_COL_NAME_LEN]; // only used for tmq_get_meta union { int16_t cid; char *pKey; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 896ea27598..6140d30771 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1915,6 +1915,8 @@ typedef struct SVCreateStbReq { SSchemaWrapper schemaRow; SSchemaWrapper schemaTag; SRSmaParam rsmaParam; + int32_t alterOriDataLen; + void* alterOriData; } SVCreateStbReq; int tEncodeSVCreateStbReq(SEncoder* pCoder, const SVCreateStbReq* pReq); @@ -1942,6 +1944,7 @@ typedef struct SVCreateTbReq { int8_t type; union { struct { + char* name; tb_uid_t suid; uint8_t* pTag; } ctb; @@ -1959,6 +1962,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) { taosMemoryFreeClear(req->comment); if (req->type == TSDB_CHILD_TABLE) { taosMemoryFreeClear(req->ctb.pTag); + taosMemoryFreeClear(req->ctb.name); } else if (req->type == TSDB_NORMAL_TABLE) { taosMemoryFreeClear(req->ntb.schemaRow.pSchema); } @@ -2042,12 +2046,14 @@ typedef struct { int32_t bytes; // TSDB_ALTER_TABLE_DROP_COLUMN // TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES + int8_t colModType; int32_t colModBytes; // TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME char* colNewName; // TSDB_ALTER_TABLE_UPDATE_TAG_VAL char* tagName; int8_t isNull; + int8_t tagType; uint32_t nTagVal; uint8_t* pTagVal; // TSDB_ALTER_TABLE_UPDATE_OPTIONS diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index a4aec72d4f..a3de9164a2 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -29,7 +29,7 @@ struct SMetaData; typedef struct SStmtCallback { TAOS_STMT* pStmt; int32_t (*getTbNameFn)(TAOS_STMT*, char**); - int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, char*, bool, SHashObj*, SHashObj*); + int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, char*, bool, SHashObj*, SHashObj*, const char*); int32_t (*getExecInfoFn)(TAOS_STMT*, SHashObj**, SHashObj**); } SStmtCallback; @@ -84,7 +84,7 @@ int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBu int32_t rowNum); int32_t qBuildStmtColFields(void* pDataBlock, int32_t* fieldNum, TAOS_FIELD_E** fields); int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields); -int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, char* tName, TAOS_MULTI_BIND* bind, +int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen); void destroyBoundColumnInfo(void* pBoundInfo); int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf, @@ -93,7 +93,7 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* void* smlInitHandle(SQuery* pQuery); void smlDestroyHandle(void* pHandle); int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta, - char* tableName, char* msgBuf, int16_t msgBufLen); + char* tableName, const char* sTableName, int32_t sTableNameLen, char* msgBuf, int16_t msgBufLen); int32_t smlBuildOutput(void* handle, SHashObj* pVgHash); int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index b6972e4670..df62f25168 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -2256,7 +2256,7 @@ static int32_t smlInsertData(SSmlHandle *info) { (*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid code = smlBindData(info->exec, tableData->tags, (*pMeta)->cols, tableData->cols, info->dataFormat, - (*pMeta)->tableMeta, tableData->childTableName, info->msgBuf.buf, info->msgBuf.len); + (*pMeta)->tableMeta, tableData->childTableName, tableData->sTableName, tableData->sTableNameLen, info->msgBuf.buf, info->msgBuf.len); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBindData failed", info->id); return code; diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 1e0f30695d..7287c46796 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -128,7 +128,7 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } -int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName) { +int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, const char* sTableName) { STscStmt* pStmt = (STscStmt*)stmt; strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1); @@ -139,6 +139,7 @@ int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, pStmt->bInfo.tbType = pTableMeta->tableType; pStmt->bInfo.boundTags = tags; pStmt->bInfo.tagsCached = false; + strcpy(pStmt->bInfo.stbFName, sTableName); return TSDB_CODE_SUCCESS; } @@ -154,10 +155,10 @@ int32_t stmtUpdateExecInfo(TAOS_STMT* stmt, SHashObj* pVgHash, SHashObj* pBlockH } int32_t stmtUpdateInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, bool autoCreateTbl, - SHashObj* pVgHash, SHashObj* pBlockHash) { + SHashObj* pVgHash, SHashObj* pBlockHash, const char* sTableName) { STscStmt* pStmt = (STscStmt*)stmt; - STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbFName)); + STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbFName, sTableName)); STMT_ERR_RET(stmtUpdateExecInfo(stmt, pVgHash, pBlockHash, autoCreateTbl)); pStmt->sql.autoCreateTbl = autoCreateTbl; @@ -247,7 +248,7 @@ int32_t stmtCleanBindInfo(STscStmt* pStmt) { destroyBoundColumnInfo(pStmt->bInfo.boundTags); taosMemoryFreeClear(pStmt->bInfo.boundTags); } - + memset(pStmt->bInfo.stbFName, 0, TSDB_TABLE_FNAME_LEN); return TSDB_CODE_SUCCESS; } @@ -568,7 +569,7 @@ int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) { STMT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } - STMT_ERR_RET(qBindStmtTagsValue(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.tbSuid, pStmt->bInfo.sname.tname, + STMT_ERR_RET(qBindStmtTagsValue(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.tbSuid, pStmt->bInfo.stbFName, pStmt->bInfo.sname.tname, tags, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen)); return TSDB_CODE_SUCCESS; diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 907691698c..fa9f715be3 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -1867,10 +1867,10 @@ static char *buildCreateTableJson(SSchemaWrapper *schemaRow, SSchemaWrapper* sch cJSON* type = cJSON_CreateString("create"); cJSON_AddItemToObject(json, "type", type); - char uid[32] = {0}; - sprintf(uid, "%"PRIi64, id); - cJSON* id_ = cJSON_CreateString(uid); - cJSON_AddItemToObject(json, "id", id_); +// char uid[32] = {0}; +// sprintf(uid, "%"PRIi64, id); +// cJSON* id_ = cJSON_CreateString(uid); +// cJSON_AddItemToObject(json, "id", id_); cJSON* tableName = cJSON_CreateString(name); cJSON_AddItemToObject(json, "tableName", tableName); cJSON* tableType = cJSON_CreateString(t == TSDB_NORMAL_TABLE ? "normal" : "super"); @@ -1925,6 +1925,98 @@ static char *buildCreateTableJson(SSchemaWrapper *schemaRow, SSchemaWrapper* sch return string; } +static char *buildAlterSTableJson(void* alterData, int32_t alterDataLen){ + SMAlterStbReq req = {0}; + cJSON* json = NULL; + char* string = NULL; + + if (tDeserializeSMAlterStbReq(alterData, alterDataLen, &req) != 0) { + goto end; + } + + json = cJSON_CreateObject(); + if (json == NULL) { + goto end; + } + cJSON* type = cJSON_CreateString("alter"); + cJSON_AddItemToObject(json, "type", type); +// cJSON* uid = cJSON_CreateNumber(id); +// cJSON_AddItemToObject(json, "uid", uid); + SName name = {0}; + tNameFromString(&name, req.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + cJSON* tableName = cJSON_CreateString(name.tname); + cJSON_AddItemToObject(json, "tableName", tableName); + cJSON* tableType = cJSON_CreateString("super"); + cJSON_AddItemToObject(json, "tableType", tableType); + + cJSON* alterType = cJSON_CreateNumber(req.alterType); + cJSON_AddItemToObject(json, "alterType", alterType); + switch (req.alterType) { + case TSDB_ALTER_TABLE_ADD_TAG: + case TSDB_ALTER_TABLE_ADD_COLUMN: { + TAOS_FIELD *field = taosArrayGet(req.pFields, 0); + cJSON* colName = cJSON_CreateString(field->name); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(field->type); + cJSON_AddItemToObject(json, "colType", colType); + + if(field->type == TSDB_DATA_TYPE_BINARY){ + int32_t length = field->bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + }else if (field->type == TSDB_DATA_TYPE_NCHAR){ + int32_t length = (field->bytes - VARSTR_HEADER_SIZE)/TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + break; + } + case TSDB_ALTER_TABLE_DROP_TAG: + case TSDB_ALTER_TABLE_DROP_COLUMN:{ + TAOS_FIELD *field = taosArrayGet(req.pFields, 0); + cJSON* colName = cJSON_CreateString(field->name); + cJSON_AddItemToObject(json, "colName", colName); + break; + } + case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES: + case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:{ + TAOS_FIELD *field = taosArrayGet(req.pFields, 0); + cJSON* colName = cJSON_CreateString(field->name); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(field->type); + cJSON_AddItemToObject(json, "colType", colType); + if(field->type == TSDB_DATA_TYPE_BINARY){ + int32_t length = field->bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + }else if (field->type == TSDB_DATA_TYPE_NCHAR){ + int32_t length = (field->bytes - VARSTR_HEADER_SIZE)/TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + break; + } + case TSDB_ALTER_TABLE_UPDATE_TAG_NAME: + case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:{ + TAOS_FIELD *oldField = taosArrayGet(req.pFields, 0); + TAOS_FIELD *newField = taosArrayGet(req.pFields, 1); + cJSON* colName = cJSON_CreateString(oldField->name); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colNewName = cJSON_CreateString(newField->name); + cJSON_AddItemToObject(json, "colNewName", colNewName); + break; + } + default: + break; + } + string = cJSON_PrintUnformatted(json); + +end: + cJSON_Delete(json); + tFreeSMAltertbReq(&req); + return string; +} + static char *processCreateStb(SMqMetaRsp *metaRsp){ SVCreateStbReq req = {0}; SDecoder coder; @@ -1947,53 +2039,74 @@ _err: return string; } -static char *buildCreateCTableJson(STag* pTag, int64_t sid, char* name, int64_t id){ +static char *processAlterStb(SMqMetaRsp *metaRsp){ + SVCreateStbReq req = {0}; + SDecoder coder; char* string = NULL; + + // decode and process req + void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead)); + int32_t len = metaRsp->metaRspLen - sizeof(SMsgHead); + tDecoderInit(&coder, data, len); + + if (tDecodeSVCreateStbReq(&coder, &req) < 0) { + goto _err; + } + string = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); + tDecoderClear(&coder); + return string; + + _err: + tDecoderClear(&coder); + return string; +} + +static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t id){ + char* string = NULL; + SArray* pTagVals = NULL; cJSON* json = cJSON_CreateObject(); if (json == NULL) { return string; } cJSON* type = cJSON_CreateString("create"); cJSON_AddItemToObject(json, "type", type); - char cid[32] = {0}; - sprintf(cid, "%"PRIi64, id); - cJSON* cid_ = cJSON_CreateString(cid); - cJSON_AddItemToObject(json, "id", cid_); +// char cid[32] = {0}; +// sprintf(cid, "%"PRIi64, id); +// cJSON* cid_ = cJSON_CreateString(cid); +// cJSON_AddItemToObject(json, "id", cid_); cJSON* tableName = cJSON_CreateString(name); cJSON_AddItemToObject(json, "tableName", tableName); cJSON* tableType = cJSON_CreateString("child"); cJSON_AddItemToObject(json, "tableType", tableType); - - char sid_[32] = {0}; - sprintf(sid_, "%"PRIi64, sid); - cJSON* using = cJSON_CreateString(sid_); + cJSON* using = cJSON_CreateString(sname); cJSON_AddItemToObject(json, "using", using); // cJSON* version = cJSON_CreateNumber(1); // cJSON_AddItemToObject(json, "version", version); cJSON* tags = cJSON_CreateArray(); + int32_t code = tTagToValArray(pTag, &pTagVals); + if (code) { + goto end; + } - if (tTagIsJson(pTag)) { // todo + if (tTagIsJson(pTag)) { + STag* p = (STag*)pTag; + if(p->nTag == 0){ + goto end; + } char* pJson = parseTagDatatoJson(pTag); - cJSON* tag = cJSON_CreateObject(); - cJSON* tname = cJSON_CreateString("unknown"); // todo + STagVal* pTagVal = taosArrayGet(pTagVals, 0); + + cJSON* tname = cJSON_CreateString(pTagVal->colName); cJSON_AddItemToObject(tag, "name", tname); cJSON* ttype = cJSON_CreateNumber(TSDB_DATA_TYPE_JSON); cJSON_AddItemToObject(tag, "type", ttype); cJSON* tvalue = cJSON_CreateString(pJson); cJSON_AddItemToObject(tag, "value", tvalue); cJSON_AddItemToArray(tags, tag); - cJSON_AddItemToObject(json, "tags", tags); - - string = cJSON_PrintUnformatted(json); - goto end; - } - - SArray* pTagVals = NULL; - int32_t code = tTagToValArray(pTag, &pTagVals); - if (code) { + taosMemoryFree(pJson); goto end; } @@ -2001,8 +2114,7 @@ static char *buildCreateCTableJson(STag* pTag, int64_t sid, char* name, int64_t STagVal* pTagVal = (STagVal*)taosArrayGet(pTagVals, i); cJSON* tag = cJSON_CreateObject(); -// cJSON* tname = cJSON_CreateNumber(pTagVal->cid); - cJSON* tname = cJSON_CreateString("unkonwn"); // todo + cJSON* tname = cJSON_CreateString(pTagVal->colName); cJSON_AddItemToObject(tag, "name", tname); cJSON* ttype = cJSON_CreateNumber(pTagVal->type); cJSON_AddItemToObject(tag, "type", ttype); @@ -2021,12 +2133,12 @@ static char *buildCreateCTableJson(STag* pTag, int64_t sid, char* name, int64_t cJSON_AddItemToObject(tag, "value", tvalue); cJSON_AddItemToArray(tags, tag); } + + end: cJSON_AddItemToObject(json, "tags", tags); string = cJSON_PrintUnformatted(json); - -end: - cJSON_Delete(json); + taosArrayDestroy(pTagVals); return string; } @@ -2047,7 +2159,7 @@ static char *processCreateTable(SMqMetaRsp *metaRsp){ for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; if(pCreateReq->type == TSDB_CHILD_TABLE){ - string = buildCreateCTableJson((STag*)pCreateReq->ctb.pTag, pCreateReq->ctb.suid, pCreateReq->name, pCreateReq->uid); + string = buildCreateCTableJson((STag*)pCreateReq->ctb.pTag, pCreateReq->ctb.name, pCreateReq->name, pCreateReq->uid); }else if(pCreateReq->type == TSDB_NORMAL_TABLE){ string = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE); } @@ -2085,11 +2197,11 @@ static char *processAlterTable(SMqMetaRsp *metaRsp){ cJSON_AddItemToObject(json, "tableName", tableName); cJSON* tableType = cJSON_CreateString(vAlterTbReq.action == TSDB_ALTER_TABLE_UPDATE_TAG_VAL ? "child" : "normal"); cJSON_AddItemToObject(json, "tableType", tableType); + cJSON* alterType = cJSON_CreateNumber(vAlterTbReq.action); + cJSON_AddItemToObject(json, "alterType", alterType); switch (vAlterTbReq.action) { case TSDB_ALTER_TABLE_ADD_COLUMN: { - cJSON* alterType = cJSON_CreateNumber(TSDB_ALTER_TABLE_ADD_COLUMN); - cJSON_AddItemToObject(json, "alterType", alterType); cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); @@ -2107,33 +2219,27 @@ static char *processAlterTable(SMqMetaRsp *metaRsp){ break; } case TSDB_ALTER_TABLE_DROP_COLUMN:{ - cJSON* alterType = cJSON_CreateNumber(TSDB_ALTER_TABLE_DROP_COLUMN); - cJSON_AddItemToObject(json, "alterType", alterType); cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); break; } case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:{ - cJSON* alterType = cJSON_CreateNumber(TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES); - cJSON_AddItemToObject(json, "alterType", alterType); cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); - cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); + cJSON* colType = cJSON_CreateNumber(vAlterTbReq.colModType); cJSON_AddItemToObject(json, "colType", colType); - if(vAlterTbReq.type == TSDB_DATA_TYPE_BINARY){ - int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE; + if(vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY){ + int32_t length = vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); - }else if (vAlterTbReq.type == TSDB_DATA_TYPE_NCHAR){ - int32_t length = (vAlterTbReq.bytes - VARSTR_HEADER_SIZE)/TSDB_NCHAR_SIZE; + }else if (vAlterTbReq.colModType == TSDB_DATA_TYPE_NCHAR){ + int32_t length = (vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE)/TSDB_NCHAR_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); } break; } case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:{ - cJSON* alterType = cJSON_CreateNumber(TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME); - cJSON_AddItemToObject(json, "alterType", alterType); cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); cJSON* colNewName = cJSON_CreateString(vAlterTbReq.colNewName); @@ -2141,12 +2247,25 @@ static char *processAlterTable(SMqMetaRsp *metaRsp){ break; } case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:{ - cJSON* alterType = cJSON_CreateNumber(TSDB_ALTER_TABLE_UPDATE_TAG_VAL); - cJSON_AddItemToObject(json, "alterType", alterType); cJSON* tagName = cJSON_CreateString(vAlterTbReq.tagName); cJSON_AddItemToObject(json, "colName", tagName); - cJSON* colValue = cJSON_CreateString("invalid, todo"); // todo - cJSON_AddItemToObject(json, "colValue", colValue); + + if (!vAlterTbReq.isNull){ + char* buf = NULL; + + if (vAlterTbReq.tagType == TSDB_DATA_TYPE_JSON) { + ASSERT(tTagIsJson(vAlterTbReq.pTagVal) == true); + buf = parseTagDatatoJson(vAlterTbReq.pTagVal); + } else { + buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL); + } + + cJSON* colValue = cJSON_CreateString(buf); + cJSON_AddItemToObject(json, "colValue", colValue); + taosMemoryFree(buf); + } + cJSON* isNull = cJSON_CreateBool(vAlterTbReq.isNull); cJSON_AddItemToObject(json, "colValueNull", isNull); break; @@ -2180,10 +2299,6 @@ static char *processDropSTable(SMqMetaRsp *metaRsp){ } cJSON* type = cJSON_CreateString("drop"); cJSON_AddItemToObject(json, "type", type); - char uid[32] = {0}; - sprintf(uid, "%"PRIi64, req.suid); - cJSON* id = cJSON_CreateString(uid); - cJSON_AddItemToObject(json, "id", id); cJSON* tableName = cJSON_CreateString(req.name); cJSON_AddItemToObject(json, "tableName", tableName); cJSON* tableType = cJSON_CreateString("super"); @@ -2224,7 +2339,7 @@ static char *processDropTable(SMqMetaRsp *metaRsp){ for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { SVDropTbReq* pDropTbReq = req.pReqs + iReq; - cJSON* tableName = cJSON_CreateString(pDropTbReq->name); // todo + cJSON* tableName = cJSON_CreateString(pDropTbReq->name); cJSON_AddItemToArray(tableNameList, tableName); } cJSON_AddItemToObject(json, "tableNameList", tableNameList); @@ -2245,7 +2360,7 @@ char *tmq_get_json_meta(TAOS_RES *res){ if(pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_STB){ return processCreateStb(&pMetaRspObj->metaRsp); }else if(pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_STB){ - return processCreateStb(&pMetaRspObj->metaRsp); + return processAlterStb(&pMetaRspObj->metaRsp); }else if(pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_STB){ return processDropSTable(&pMetaRspObj->metaRsp); }else if(pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_TABLE){ @@ -2258,6 +2373,10 @@ char *tmq_get_json_meta(TAOS_RES *res){ return NULL; } +void tmq_free_json_meta(char* jsonMeta){ + taosMemoryFreeClear(jsonMeta); +} + static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ SVCreateStbReq req = {0}; SDecoder coder; @@ -2310,6 +2429,7 @@ static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ pReq.commentLen = -1; pReq.suid = req.suid; pReq.source = 1; + pReq.igExists = true; SName tableName; tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name); @@ -2747,6 +2867,7 @@ end: } int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta){ + return 0; if (!taos || !raw_meta) { return TSDB_CODE_INVALID_PARA; } @@ -2767,6 +2888,10 @@ int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta){ return TSDB_CODE_INVALID_PARA; } +void tmq_free_raw_meta(tmq_raw_data *rawMeta){ + taosMemoryFreeClear(rawMeta); +} + void tmq_commit_async(tmq_t* tmq, const TAOS_RES* msg, tmq_commit_cb* cb, void* param) { tmqCommitInner2(tmq, msg, 0, 1, cb, param); } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 165e8631c4..0ffb4f6d2a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4803,6 +4803,11 @@ int tEncodeSVCreateStbReq(SEncoder *pCoder, const SVCreateStbReq *pReq) { if (tEncodeSRSmaParam(pCoder, &pReq->rsmaParam) < 0) return -1; } + if (tEncodeI32(pCoder, pReq->alterOriDataLen) < 0) return -1; + if (pReq->alterOriDataLen > 0) { + if (tEncodeBinary(pCoder, pReq->alterOriData, pReq->alterOriDataLen) < 0) return -1; + } + tEndEncode(pCoder); return 0; } @@ -4819,6 +4824,11 @@ int tDecodeSVCreateStbReq(SDecoder *pCoder, SVCreateStbReq *pReq) { if (tDecodeSRSmaParam(pCoder, &pReq->rsmaParam) < 0) return -1; } + if (tDecodeI32(pCoder, &pReq->alterOriDataLen) < 0) return -1; + if (pReq->alterOriDataLen > 0) { + if (tDecodeBinary(pCoder, (uint8_t **)&pReq->alterOriData, NULL) < 0) return -1; + } + tEndDecode(pCoder); return 0; } @@ -4862,6 +4872,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) { } if (pReq->type == TSDB_CHILD_TABLE) { + if (tEncodeCStr(pCoder, pReq->ctb.name) < 0) return -1; if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1; if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1; } else if (pReq->type == TSDB_NORMAL_TABLE) { @@ -4891,6 +4902,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { } if (pReq->type == TSDB_CHILD_TABLE) { + if (tDecodeCStr(pCoder, &pReq->ctb.name) < 0) return -1; if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1; if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1; } else if (pReq->type == TSDB_NORMAL_TABLE) { @@ -5224,6 +5236,7 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) { break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->colModType) < 0) return -1; if (tEncodeI32v(pEncoder, pReq->colModBytes) < 0) return -1; break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: @@ -5233,6 +5246,7 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) { case TSDB_ALTER_TABLE_UPDATE_TAG_VAL: if (tEncodeCStr(pEncoder, pReq->tagName) < 0) return -1; if (tEncodeI8(pEncoder, pReq->isNull) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->tagType) < 0) return -1; if (!pReq->isNull) { if (tEncodeBinary(pEncoder, pReq->pTagVal, pReq->nTagVal) < 0) return -1; } @@ -5272,6 +5286,7 @@ int32_t tDecodeSVAlterTbReq(SDecoder *pDecoder, SVAlterTbReq *pReq) { break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->colModType) < 0) return -1; if (tDecodeI32v(pDecoder, &pReq->colModBytes) < 0) return -1; break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: @@ -5281,6 +5296,7 @@ int32_t tDecodeSVAlterTbReq(SDecoder *pDecoder, SVAlterTbReq *pReq) { case TSDB_ALTER_TABLE_UPDATE_TAG_VAL: if (tDecodeCStr(pDecoder, &pReq->tagName) < 0) return -1; if (tDecodeI8(pDecoder, &pReq->isNull) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->tagType) < 0) return -1; if (!pReq->isNull) { if (tDecodeBinary(pDecoder, &pReq->pTagVal, &pReq->nTagVal) < 0) return -1; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 6d1cc05ace..17885de60b 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -409,7 +409,7 @@ static FORCE_INLINE int32_t schemaExColIdCompare(const void *colId, const void * return 0; } -static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen) { +static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen, void* alterOriData, int32_t alterOriDataLen) { SEncoder encoder = {0}; int32_t contLen; SName name = {0}; @@ -422,6 +422,8 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt req.name = (char *)tNameGetTableName(&name); req.suid = pStb->uid; req.rollup = pStb->ast1Len > 0 ? 1 : 0; + req.alterOriData = alterOriData; + req.alterOriDataLen = alterOriDataLen; // todo req.schemaRow.nCols = pStb->numOfColumns; req.schemaRow.version = pStb->colVer; @@ -626,7 +628,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj continue; } - void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); + void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen, NULL, 0); if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); sdbRelease(pSdb, pVgroup); @@ -1278,7 +1280,7 @@ static int32_t mndSetAlterStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj * return 0; } -static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { +static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, void* alterOriData, int32_t alterOriDataLen) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; void *pIter = NULL; @@ -1292,7 +1294,7 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj continue; } - void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); + void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen, alterOriData, alterOriDataLen); if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); sdbRelease(pSdb, pVgroup); @@ -1575,7 +1577,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto _OVER; if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto _OVER; - if (mndSetAlterStbRedoActions(pMnode, pTrans, pDb, &stbObj) != 0) goto _OVER; + if (mndSetAlterStbRedoActions(pMnode, pTrans, pDb, &stbObj, pReq->pCont, pReq->contLen) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; code = 0; diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index a5cf755a74..576dc6d8d3 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -71,6 +71,7 @@ typedef struct SInsertParseContext { SVnodeModifOpStmt* pOutput; SStmtCallback* pStmtCb; SParseMetaCache* pMetaCache; + char sTableName[TSDB_TABLE_NAME_LEN]; } SInsertParseContext; typedef struct SInsertParseSyntaxCxt { @@ -811,10 +812,11 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* return TSDB_CODE_SUCCESS; } -static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid) { +static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname) { pTbReq->type = TD_CHILD_TABLE; pTbReq->name = strdup(tname); pTbReq->ctb.suid = suid; + if(sname) pTbReq->ctb.name = strdup(sname); pTbReq->ctb.pTag = (uint8_t*)pTag; pTbReq->commentLen = -1; @@ -835,6 +837,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16 return TSDB_CODE_SUCCESS; } + strcpy(val->colName, pSchema->name); val->cid = pSchema->colId; val->type = pSchema->type; @@ -1051,7 +1054,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint if (isNullStr(&sToken)) { code = tTagNew(pTagVals, 1, true, &pTag); } else { - code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg); + code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg, pTagSchema->name); } taosMemoryFree(tmpTokenBuf); if (code != TSDB_CODE_SUCCESS) { @@ -1081,7 +1084,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint goto end; } - buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid); + buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName); end: for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) { @@ -1166,6 +1169,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SName* name, char* tb createSName(&sname, &sToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg); char dbFName[TSDB_DB_FNAME_LEN]; tNameGetFullDbName(&sname, dbFName); + strcpy(pCxt->sTableName, sname.tname); CHECK_CODE(getSTableMeta(pCxt, &sname, dbFName)); if (TSDB_SUPER_TABLE != pCxt->pTableMeta->tableType) { @@ -1402,15 +1406,10 @@ static int32_t parseDataFromFile(SInsertParseContext* pCxt, SToken filePath, STa return TSDB_CODE_SUCCESS; } -void destroyCreateSubTbReq(SVCreateTbReq* pReq) { - taosMemoryFreeClear(pReq->name); - taosMemoryFreeClear(pReq->ctb.pTag); -} - static void destroyInsertParseContextForTable(SInsertParseContext* pCxt) { taosMemoryFreeClear(pCxt->pTableMeta); destroyBoundColumnInfo(&pCxt->tags); - destroyCreateSubTbReq(&pCxt->createTblReq); + tdDestroySVCreateTbReq(&pCxt->createTblReq); } static void destroySubTableHashElem(void* p) { taosMemoryFree(*(STableMeta**)p); } @@ -1556,7 +1555,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { } memcpy(tags, &pCxt->tags, sizeof(pCxt->tags)); (*pCxt->pStmtCb->setInfoFn)(pCxt->pStmtCb->pStmt, pCxt->pTableMeta, tags, tbFName, autoCreateTbl, - pCxt->pVgroupsHashObj, pCxt->pTableBlockHashObj); + pCxt->pVgroupsHashObj, pCxt->pTableBlockHashObj, pCxt->sTableName); memset(&pCxt->tags, 0, sizeof(pCxt->tags)); pCxt->pVgroupsHashObj = NULL; @@ -1865,7 +1864,7 @@ int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash return TSDB_CODE_SUCCESS; } -int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, char* tName, TAOS_MULTI_BIND* bind, +int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen) { STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; @@ -1904,13 +1903,14 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, char* tN isJson = true; char* tmp = taosMemoryCalloc(1, colLen + 1); memcpy(tmp, bind[c].buffer, colLen); - code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf); + code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf, pTagSchema->name); taosMemoryFree(tmp); if (code != TSDB_CODE_SUCCESS) { goto end; } } else { STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { val.pData = (uint8_t*)bind[c].buffer; val.nData = colLen; @@ -1947,9 +1947,9 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, char* tN } SVCreateTbReq tbReq = {0}; - buildCreateTbReq(&tbReq, tName, pTag, suid); + buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName); code = buildCreateTbMsg(pDataBlock, &tbReq); - destroyCreateSubTbReq(&tbReq); + tdDestroySVCreateTbReq(&tbReq); end: for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { @@ -2213,7 +2213,7 @@ typedef struct SmlExecHandle { static void smlDestroyTableHandle(void* pHandle) { SmlExecTableHandle* handle = (SmlExecTableHandle*)pHandle; destroyBoundColumnInfo(&handle->tags); - destroyCreateSubTbReq(&handle->createTblReq); + tdDestroySVCreateTbReq(&handle->createTblReq); } static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SSchema* pSchema) { @@ -2311,6 +2311,7 @@ static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* p SSmlKv* kv = taosArrayGetP(cols, i); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { val.pData = (uint8_t*)kv->value; val.nData = kv->length; @@ -2354,7 +2355,7 @@ end: } int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta, - char* tableName, char* msgBuf, int16_t msgBufLen) { + char* tableName, const char* sTableName, int32_t sTableNameLen, char* msgBuf, int16_t msgBufLen) { SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; SSmlExecHandle* smlHandle = (SSmlExecHandle*)handle; @@ -2372,7 +2373,10 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols return ret; } - buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid); + buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL); + smlHandle->tableExecHandle.createTblReq.ctb.name = taosMemoryMalloc(sTableNameLen + 1); + memcpy(smlHandle->tableExecHandle.createTblReq.ctb.name, sTableName, sTableNameLen); + smlHandle->tableExecHandle.createTblReq.ctb.name[sTableNameLen] = 0; STableDataBlocks* pDataBlock = NULL; ret = getDataBlockFromList(smlHandle->pBlockHash, &pTableMeta->uid, sizeof(pTableMeta->uid), diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ed6d3c1c93..5ea06ca892 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5369,7 +5369,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { } static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt, - const STag* pTag, uint64_t suid, SVgroupInfo* pVgInfo) { + const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo) { // char dbFName[TSDB_DB_FNAME_LEN] = {0}; // SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId}; // strcpy(name.dbname, pStmt->dbName); @@ -5386,6 +5386,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S req.commentLen = -1; } req.ctb.suid = suid; + req.ctb.name = strdup(sTableNmae); req.ctb.pTag = (uint8_t*)pTag; if (pStmt->ignoreExists) { req.flags |= TD_CREATE_IF_NOT_EXISTS; @@ -5471,13 +5472,14 @@ static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SVa return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pVal->literal); } - return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf); + return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf, pTagSchema->name); } static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray) { if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { void* nodeVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + strcpy(val.colName, pTagSchema->name); if (IS_VAR_DATA_TYPE(pTagSchema->type)) { val.pData = varDataVal(nodeVal); val.nData = varDataLen(nodeVal); @@ -5571,6 +5573,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { char* tmpVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + strcpy(val.colName, pTagSchema->name); if (IS_VAR_DATA_TYPE(pTagSchema->type)) { val.pData = varDataVal(tmpVal); val.nData = varDataLen(tmpVal); @@ -5627,7 +5630,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla code = getTableHashVgroup(pCxt, pStmt->dbName, pStmt->tableName, &info); } if (TSDB_CODE_SUCCESS == code) { - addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, &info); + addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, pStmt->useTableName, &info); } taosMemoryFreeClear(pSuperTableMeta); @@ -5845,8 +5848,8 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS } pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type); + pReq->tagType = targetDt.type; if (targetDt.type == TSDB_DATA_TYPE_JSON) { - pReq->isNull = 0; if (pStmt->pVal->literal && strlen(pStmt->pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pStmt->pVal->literal); @@ -5855,7 +5858,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS int32_t code = TSDB_CODE_SUCCESS; STag* pTag = NULL; do { - code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf); + code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf, pReq->tagName); if (TSDB_CODE_SUCCESS != code) { break; } @@ -5870,6 +5873,9 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS if (code != TSDB_CODE_SUCCESS) { return code; } + if(pTag->nTag == 0){ + pReq->isNull = true; + } pReq->nTagVal = pTag->len; pReq->pTagVal = (uint8_t*)pTag; pStmt->pVal->datum.p = (char*)pTag; // for free @@ -5927,7 +5933,7 @@ static int32_t buildDropColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, SVAlterTbReq* pReq) { pReq->colModBytes = calcTypeBytes(pStmt->dataType); - + pReq->colModType = pStmt->dataType.type; SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); if (NULL == pSchema) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 7a23338035..2f12c9adf6 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -341,7 +341,7 @@ static bool isValidateTag(char* input) { return true; } -int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf) { +int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf, const char* colName) { int32_t retCode = TSDB_CODE_SUCCESS; cJSON* root = NULL; SHashObj* keyHash = NULL; @@ -389,6 +389,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi continue; } STagVal val = {0}; + strcpy(val.colName, colName); val.pKey = jsonKey; taosHashPut(keyHash, jsonKey, keyLen, &keyLen, CHAR_BYTES); // add key to hash to remove dumplicate, value is useless diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index df5df127f0..dd0a60dced 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1150,7 +1150,7 @@ int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu } memcpy(tmp, varDataVal(input), varDataLen(input)); tmp[varDataLen(input)] = 0; - if(parseJsontoTagData(tmp, pTagVals, &pTag, NULL)){ + if(parseJsontoTagData(tmp, pTagVals, &pTag, NULL, "")){ tTagNew(pTagVals, 1, true, &pTag); } } diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index 07440e7435..8fcc76f51f 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -1114,7 +1114,7 @@ TEST(columnTest, json_column_arith_op) { memcpy(rightv, rightvTmp, strlen(rightvTmp)); SArray *tags = taosArrayInit(1, sizeof(STagVal)); STag* row = NULL; - parseJsontoTagData(rightv, tags, &row, NULL); + parseJsontoTagData(rightv, tags, &row, NULL, ""); const int32_t len = 8; EOperatorType op[len] = {OP_TYPE_ADD, OP_TYPE_SUB, OP_TYPE_MULTI, OP_TYPE_DIV, @@ -1262,7 +1262,7 @@ TEST(columnTest, json_column_logic_op) { memcpy(rightv, rightvTmp, strlen(rightvTmp)); SArray *tags = taosArrayInit(1, sizeof(STagVal)); STag* row = NULL; - parseJsontoTagData(rightv, tags, &row, NULL); + parseJsontoTagData(rightv, tags, &row, NULL, ""); const int32_t len0 = 6; const int32_t len = 9; From 2411a1416a849fa761149040476a27daf434c8b0 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 10 Jul 2022 19:01:56 +0800 Subject: [PATCH 02/92] fix:conflicts --- source/dnode/mnode/impl/src/mndStb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c60058e496..2117ef24d9 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -45,7 +45,7 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq); static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextStb(SMnode *pMnode, void *pIter); static int32_t mndProcessTableCfgReq(SRpcMsg *pReq); -static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp); +static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen); int32_t mndInitStb(SMnode *pMnode) { SSdbTable table = { @@ -936,7 +936,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { if (isAlter) { bool needRsp = false; - code = mndAlterStbImp(pMnode, pReq, pDb, pStb, needRsp); + code = mndAlterStbImp(pMnode, pReq, pDb, pStb, needRsp, NULL, 0); } else { code = mndCreateStb(pMnode, pReq, &createReq, pDb); } @@ -1544,7 +1544,7 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i return 0; } -static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp) { +static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen) { int32_t code = -1; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; @@ -1561,7 +1561,7 @@ static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbOb if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER; if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER; - if (mndSetAlterStbRedoActions(pMnode, pTrans, pDb, pStb) != 0) goto _OVER; + if (mndSetAlterStbRedoActions(pMnode, pTrans, pDb, pStb, alterOriData, alterOriDataLen) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; code = 0; @@ -1622,7 +1622,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p } if (code != 0) goto _OVER; - code = mndAlterStbImp(pMnode, pReq, pDb, &stbObj, needRsp); + code = mndAlterStbImp(pMnode, pReq, pDb, &stbObj, needRsp, pReq->pCont, pReq->contLen); _OVER: taosMemoryFreeClear(stbObj.pTags); From 3d2e129dd634ef4064cb71b025dcb8f20d1ac104 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 10:18:01 +0800 Subject: [PATCH 03/92] feat:add tmq get meta --- source/client/src/tmq.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 90cb43c676..6d24d8d9ff 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2869,7 +2869,6 @@ end: } int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta){ - return 0; if (!taos || !raw_meta) { return TSDB_CODE_INVALID_PARA; } From 0a193cf811df5443aa7231d08f3b2b56a2d239d3 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 16:12:07 +0800 Subject: [PATCH 04/92] feat:get meta ok --- examples/c/tmq.c | 67 +++++++++++++++++----------- include/common/tmsg.h | 7 ++- include/util/tlog.h | 2 +- source/dnode/mnode/impl/src/mndStb.c | 50 ++++++++++++++++++--- source/dnode/vnode/src/tq/tq.c | 2 +- 5 files changed, 91 insertions(+), 37 deletions(-) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 5d7f1bbe70..c6248a62c1 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -30,10 +30,25 @@ static void msg_process(TAOS_RES* msg) { if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) { tmq_raw_data *raw = tmq_get_raw_meta(msg); if(raw){ - TAOS* pConn = taos_connect("192.168.1.86", "root", "taosdata", "abc1", 0); + TAOS* pConn = taos_connect("192.168.1.86", "root", "taosdata", NULL, 0); if (pConn == NULL) { return; } + + TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1"); + if (taos_errno(pRes) != 0) { + printf("error in create db, reason:%s\n", taos_errstr(pRes)); + return; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + return; + } + taos_free_result(pRes); + int32_t ret = taos_write_raw_meta(pConn, raw); printf("write raw data: %s\n", tmq_err2str(ret)); free(raw); @@ -132,12 +147,12 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "alter table st1 add column c4 bigint"); - if (taos_errno(pRes) != 0) { - printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); +// pRes = taos_query(pConn, "alter table st1 add column c4 bigint"); +// if (taos_errno(pRes) != 0) { +// printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); +// return -1; +// } +// taos_free_result(pRes); pRes = taos_query(pConn, "alter table st1 modify column c3 binary(64)"); if (taos_errno(pRes) != 0) { @@ -160,19 +175,19 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "drop table ct3 ct1"); - if (taos_errno(pRes) != 0) { - printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "drop table st1"); - if (taos_errno(pRes) != 0) { - printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); +// pRes = taos_query(pConn, "drop table ct3 ct1"); +// if (taos_errno(pRes) != 0) { +// printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); +// return -1; +// } +// taos_free_result(pRes); +// +// pRes = taos_query(pConn, "drop table st1"); +// if (taos_errno(pRes) != 0) { +// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); +// return -1; +// } +// taos_free_result(pRes); pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))"); if (taos_errno(pRes) != 0) { @@ -209,12 +224,12 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "drop table n1"); - if (taos_errno(pRes) != 0) { - printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); +// pRes = taos_query(pConn, "drop table n1"); +// if (taos_errno(pRes) != 0) { +// printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); +// return -1; +// } +// taos_free_result(pRes); pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)"); if (taos_errno(pRes) != 0) { diff --git a/include/common/tmsg.h b/include/common/tmsg.h index b67f220e1c..01f8ad99fd 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2843,8 +2843,8 @@ typedef struct { static FORCE_INLINE int32_t tEncodeSMqMetaRsp(void** buf, const SMqMetaRsp* pRsp) { int32_t tlen = 0; - // tlen += taosEncodeFixedI64(buf, pRsp->reqOffset); - // tlen += taosEncodeFixedI64(buf, pRsp->rspOffset); + tlen += taosEncodeFixedI64(buf, pRsp->reqOffset); + tlen += taosEncodeFixedI64(buf, pRsp->rspOffset); tlen += taosEncodeFixedI16(buf, pRsp->resMsgType); tlen += taosEncodeFixedI32(buf, pRsp->metaRspLen); tlen += taosEncodeBinary(buf, pRsp->metaRsp, pRsp->metaRspLen); @@ -2852,8 +2852,7 @@ static FORCE_INLINE int32_t tEncodeSMqMetaRsp(void** buf, const SMqMetaRsp* pRsp } static FORCE_INLINE void* tDecodeSMqMetaRsp(const void* buf, SMqMetaRsp* pRsp) { - // buf = taosDecodeFixedI64(buf, &pRsp->reqOffset); - // buf = taosDecodeFixedI64(buf, &pRsp->rspOffset); + buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);buf = taosDecodeFixedI64(buf, &pRsp->rspOffset); buf = taosDecodeFixedI16(buf, &pRsp->resMsgType); buf = taosDecodeFixedI32(buf, &pRsp->metaRspLen); buf = taosDecodeBinary(buf, &pRsp->metaRsp, pRsp->metaRspLen); diff --git a/include/util/tlog.h b/include/util/tlog.h index a8c9eeabde..d186c32841 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -94,7 +94,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); } #define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); } // clang-format on -#define BUF_PAGE_DEBUG +//#define BUF_PAGE_DEBUG #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 2117ef24d9..3a7b137f9f 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -708,7 +708,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat memcpy(pDst->db, pDb->name, TSDB_DB_FNAME_LEN); pDst->createdTime = taosGetTimestampMs(); pDst->updateTime = pDst->createdTime; - pDst->uid = (pCreate->source == 1) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); + pDst->uid = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); pDst->dbUid = pDb->uid; pDst->tagVer = (pCreate->source != TD_REQ_FROM_APP) ? pCreate->tagVer : 1; pDst->colVer = (pCreate->source != TD_REQ_FROM_APP) ? pCreate->colVer : 1; @@ -883,9 +883,9 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { terrno = TSDB_CODE_MND_STABLE_UID_NOT_MATCH; goto _OVER; } else if (createReq.tagVer > 0 || createReq.colVer > 0) { - int32_t tagDelta = pStb->tagVer - createReq.tagVer; - int32_t colDelta = pStb->colVer - createReq.colVer; - int32_t verDelta = tagDelta + verDelta; + int32_t tagDelta = createReq.tagVer - pStb->tagVer; + int32_t colDelta = createReq.colVer - pStb->colVer; + int32_t verDelta = tagDelta + colDelta; mInfo("stb:%s, already exist while create, input tagVer:%d colVer:%d, exist tagVer:%d colVer:%d", createReq.name, createReq.tagVer, createReq.colVer, pStb->tagVer, pStb->colVer); if (tagDelta <= 0 && colDelta <= 0) { @@ -936,7 +936,47 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { if (isAlter) { bool needRsp = false; - code = mndAlterStbImp(pMnode, pReq, pDb, pStb, needRsp, NULL, 0); + SStbObj pDst = {0}; + taosRLockLatch(&pStb->lock); + memcpy(&pDst, pStb, sizeof(SStbObj)); + taosRUnLockLatch(&pStb->lock); + + pDst.updateTime = taosGetTimestampMs(); + pDst.nextColId = 1; + pDst.numOfColumns = createReq.numOfColumns; + pDst.numOfTags = createReq.numOfTags; + pDst.pColumns = taosMemoryCalloc(1, pDst.numOfColumns * sizeof(SSchema)); + pDst.pTags = taosMemoryCalloc(1, pDst.numOfTags * sizeof(SSchema)); + if (pDst.pColumns == NULL || pDst.pTags == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + for (int32_t i = 0; i < pDst.numOfColumns; ++i) { + SField *pField = taosArrayGet(createReq.pColumns, i); + SSchema *pSchema = &pDst.pColumns[i]; + pSchema->type = pField->type; + pSchema->bytes = pField->bytes; + pSchema->flags = pField->flags; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pDst.nextColId; + pDst.nextColId++; + } + + for (int32_t i = 0; i < pDst.numOfTags; ++i) { + SField *pField = taosArrayGet(createReq.pTags, i); + SSchema *pSchema = &pDst.pTags[i]; + pSchema->type = pField->type; + pSchema->bytes = pField->bytes; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pDst.nextColId; + pDst.nextColId++; + } + pDst.tagVer = createReq.tagVer; + pDst.colVer = createReq.colVer; + code = mndAlterStbImp(pMnode, pReq, pDb, &pDst, needRsp, NULL, 0); + taosMemoryFreeClear(pDst.pTags); + taosMemoryFreeClear(pDst.pColumns); } else { code = mndCreateStb(pMnode, pReq, &createReq, pDb); } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 52949838b9..d97a958888 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -406,7 +406,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { tqInfo("fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType); SMqMetaRsp metaRsp = {0}; /*metaRsp.reqOffset = pReq->reqOffset.version;*/ - /*metaRsp.rspOffset = fetchVer;*/ + metaRsp.rspOffset = fetchVer; /*metaRsp.rspOffsetNew.version = fetchVer;*/ tqOffsetResetToLog(&metaRsp.reqOffsetNew, pReq->reqOffset.version); tqOffsetResetToLog(&metaRsp.rspOffsetNew, fetchVer); From c54bc76925b01793bca4b0a81b03f1007a862b40 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 17:36:07 +0800 Subject: [PATCH 05/92] feat:get meta ok --- examples/c/tmq.c | 71 +++++++++------ source/client/src/tmq.c | 4 +- source/dnode/mnode/impl/src/mndStb.c | 126 +++++++++++++++------------ 3 files changed, 116 insertions(+), 85 deletions(-) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index c6248a62c1..c55cb2ca58 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -51,15 +51,14 @@ static void msg_process(TAOS_RES* msg) { int32_t ret = taos_write_raw_meta(pConn, raw); printf("write raw data: %s\n", tmq_err2str(ret)); - free(raw); taos_close(pConn); } + tmq_free_raw_meta(raw); char* result = tmq_get_json_meta(msg); if(result){ printf("meta result: %s\n", result); - free(result); } - printf("meta:%p\n", raw); + tmq_free_json_meta(result); return; } while (1) { @@ -83,7 +82,7 @@ int32_t init_env() { return -1; } - TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1"); + TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 3"); if (taos_errno(pRes) != 0) { printf("error in create db, reason:%s\n", taos_errstr(pRes)); return -1; @@ -126,6 +125,13 @@ int32_t init_env() { } taos_free_result(pRes); + pRes = taos_query(pConn, "create table if not exists ct2 using st1 tags(NULL)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table ct2, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "insert into ct1 values(now, 3, 4, 'b')"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes)); @@ -147,12 +153,12 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, "alter table st1 add column c4 bigint"); -// if (taos_errno(pRes) != 0) { -// printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, "alter table st1 add column c4 bigint"); + if (taos_errno(pRes) != 0) { + printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); pRes = taos_query(pConn, "alter table st1 modify column c3 binary(64)"); if (taos_errno(pRes) != 0) { @@ -175,19 +181,19 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, "drop table ct3 ct1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); -// -// pRes = taos_query(pConn, "drop table st1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, "drop table ct3 ct1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop table st1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))"); if (taos_errno(pRes) != 0) { @@ -224,12 +230,12 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, "drop table n1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, "drop table n1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)"); if (taos_errno(pRes) != 0) { @@ -245,6 +251,13 @@ int32_t init_env() { } taos_free_result(pRes); + pRes = taos_query(pConn, "create table jt2 using jt tags('')"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt2, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + return 0; } diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 6d24d8d9ff..4dc0dbfa64 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2430,7 +2430,7 @@ static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ pReq.numOfTags = req.schemaTag.nCols; pReq.commentLen = -1; pReq.suid = req.suid; - pReq.source = 1; + pReq.source = TD_REQ_FROM_TAOX; pReq.igExists = true; SName tableName; @@ -2497,7 +2497,7 @@ static int32_t taosDropStb(TAOS *taos, void *meta, int32_t metaLen){ // build drop stable pReq.igNotExists = true; - pReq.source = 1; + pReq.source = TD_REQ_FROM_TAOX; pReq.suid = req.suid; SName tableName; tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 3a7b137f9f..5040b556e7 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -851,6 +851,75 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { return 0; } +static int32_t mndFindSuperTableTagIndex(const SStbObj *pStb, const char *tagName) { + for (int32_t tag = 0; tag < pStb->numOfTags; tag++) { + if (strcasecmp(pStb->pTags[tag].name, tagName) == 0) { + return tag; + } + } + + return -1; +} + +static int32_t mndFindSuperTableColumnIndex(const SStbObj *pStb, const char *colName) { + for (int32_t col = 0; col < pStb->numOfColumns; col++) { + if (strcasecmp(pStb->pColumns[col].name, colName) == 0) { + return col; + } + } + + return -1; +} + +static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq *createReq) { + taosRLockLatch(&pStb->lock); + memcpy(pDst, pStb, sizeof(SStbObj)); + taosRUnLockLatch(&pStb->lock); + + pDst->updateTime = taosGetTimestampMs(); + pDst->numOfColumns = createReq->numOfColumns; + pDst->numOfTags = createReq->numOfTags; + pDst->pColumns = taosMemoryCalloc(1, pDst->numOfColumns * sizeof(SSchema)); + pDst->pTags = taosMemoryCalloc(1, pDst->numOfTags * sizeof(SSchema)); + if (pDst->pColumns == NULL || pDst->pTags == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int32_t i = 0; i < pDst->numOfColumns; ++i) { + SField *pField = taosArrayGet(createReq->pColumns, i); + SSchema *pSchema = &pDst->pColumns[i]; + pSchema->type = pField->type; + pSchema->bytes = pField->bytes; + pSchema->flags = pField->flags; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + int32_t cIndex = mndFindSuperTableColumnIndex(pStb, pField->name); + if (cIndex >= 0){ + pSchema->colId = pStb->pColumns[cIndex].colId; + }else{ + pSchema->colId = pDst->nextColId++; + } + } + + for (int32_t i = 0; i < pDst->numOfTags; ++i) { + SField *pField = taosArrayGet(createReq->pTags, i); + SSchema *pSchema = &pDst->pTags[i]; + pSchema->type = pField->type; + pSchema->bytes = pField->bytes; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + int32_t cIndex = mndFindSuperTableTagIndex(pStb, pField->name); + if (cIndex >= 0){ + pSchema->colId = pStb->pTags[cIndex].colId; + }else{ + pSchema->colId = pDst->nextColId++; + } + + } + pDst->tagVer = createReq->tagVer; + pDst->colVer = createReq->colVer; + return TSDB_CODE_SUCCESS; +} + static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; @@ -937,43 +1006,12 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { if (isAlter) { bool needRsp = false; SStbObj pDst = {0}; - taosRLockLatch(&pStb->lock); - memcpy(&pDst, pStb, sizeof(SStbObj)); - taosRUnLockLatch(&pStb->lock); - - pDst.updateTime = taosGetTimestampMs(); - pDst.nextColId = 1; - pDst.numOfColumns = createReq.numOfColumns; - pDst.numOfTags = createReq.numOfTags; - pDst.pColumns = taosMemoryCalloc(1, pDst.numOfColumns * sizeof(SSchema)); - pDst.pTags = taosMemoryCalloc(1, pDst.numOfTags * sizeof(SSchema)); - if (pDst.pColumns == NULL || pDst.pTags == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + if (mndBuildStbFromAlter(pStb, &pDst, &createReq) != 0) { + taosMemoryFreeClear(pDst.pTags); + taosMemoryFreeClear(pDst.pColumns); goto _OVER; } - for (int32_t i = 0; i < pDst.numOfColumns; ++i) { - SField *pField = taosArrayGet(createReq.pColumns, i); - SSchema *pSchema = &pDst.pColumns[i]; - pSchema->type = pField->type; - pSchema->bytes = pField->bytes; - pSchema->flags = pField->flags; - memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - pSchema->colId = pDst.nextColId; - pDst.nextColId++; - } - - for (int32_t i = 0; i < pDst.numOfTags; ++i) { - SField *pField = taosArrayGet(createReq.pTags, i); - SSchema *pSchema = &pDst.pTags[i]; - pSchema->type = pField->type; - pSchema->bytes = pField->bytes; - memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - pSchema->colId = pDst.nextColId; - pDst.nextColId++; - } - pDst.tagVer = createReq.tagVer; - pDst.colVer = createReq.colVer; code = mndAlterStbImp(pMnode, pReq, pDb, &pDst, needRsp, NULL, 0); taosMemoryFreeClear(pDst.pTags); taosMemoryFreeClear(pDst.pColumns); @@ -1014,26 +1052,6 @@ static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) { return 0; } -static int32_t mndFindSuperTableTagIndex(const SStbObj *pStb, const char *tagName) { - for (int32_t tag = 0; tag < pStb->numOfTags; tag++) { - if (strcasecmp(pStb->pTags[tag].name, tagName) == 0) { - return tag; - } - } - - return -1; -} - -static int32_t mndFindSuperTableColumnIndex(const SStbObj *pStb, const char *colName) { - for (int32_t col = 0; col < pStb->numOfColumns; col++) { - if (strcasecmp(pStb->pColumns[col].name, colName) == 0) { - return col; - } - } - - return -1; -} - static int32_t mndAllocStbSchemas(const SStbObj *pOld, SStbObj *pNew) { pNew->pTags = taosMemoryCalloc(pNew->numOfTags, sizeof(SSchema)); pNew->pColumns = taosMemoryCalloc(pNew->numOfColumns, sizeof(SSchema)); From a196298640d91d04fd8f7737412d1ed081355b2e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 18:07:46 +0800 Subject: [PATCH 06/92] fix:disable colName in tag --- source/client/src/tmq.c | 13 +++++++++---- source/libs/parser/src/parInsert.c | 6 +++--- source/libs/parser/src/parTranslater.c | 4 ++-- source/libs/parser/src/parUtil.c | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 4dc0dbfa64..5f0fcf1d78 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2101,8 +2101,10 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t cJSON* tag = cJSON_CreateObject(); STagVal* pTagVal = taosArrayGet(pTagVals, 0); - cJSON* tname = cJSON_CreateString(pTagVal->colName); - cJSON_AddItemToObject(tag, "name", tname); +// cJSON* tname = cJSON_CreateString(pTagVal->colName); +// cJSON_AddItemToObject(tag, "name", tname); + cJSON* cid_ = cJSON_CreateString(""); + cJSON_AddItemToObject(tag, "cid", cid_); cJSON* ttype = cJSON_CreateNumber(TSDB_DATA_TYPE_JSON); cJSON_AddItemToObject(tag, "type", ttype); cJSON* tvalue = cJSON_CreateString(pJson); @@ -2116,8 +2118,11 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t STagVal* pTagVal = (STagVal*)taosArrayGet(pTagVals, i); cJSON* tag = cJSON_CreateObject(); - cJSON* tname = cJSON_CreateString(pTagVal->colName); - cJSON_AddItemToObject(tag, "name", tname); + + char cid[32] = {0}; + sprintf(cid, "%d", pTagVal->cid); + cJSON* cid_ = cJSON_CreateString(cid); + cJSON_AddItemToObject(tag, "cid", cid_); cJSON* ttype = cJSON_CreateNumber(pTagVal->type); cJSON_AddItemToObject(tag, "type", ttype); diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 576dc6d8d3..ad0877476d 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -837,7 +837,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16 return TSDB_CODE_SUCCESS; } - strcpy(val->colName, pSchema->name); +// strcpy(val->colName, pSchema->name); val->cid = pSchema->colId; val->type = pSchema->type; @@ -1910,7 +1910,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } } else { STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - strcpy(val.colName, pTagSchema->name); +// strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { val.pData = (uint8_t*)bind[c].buffer; val.nData = colLen; @@ -2311,7 +2311,7 @@ static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* p SSmlKv* kv = taosArrayGetP(cols, i); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - strcpy(val.colName, pTagSchema->name); +// strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { val.pData = (uint8_t*)kv->value; val.nData = kv->length; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a03cdb6485..75fc2b71dc 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5555,7 +5555,7 @@ static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, S if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { void* nodeVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - strcpy(val.colName, pTagSchema->name); +// strcpy(val.colName, pTagSchema->name); if (IS_VAR_DATA_TYPE(pTagSchema->type)) { val.pData = varDataVal(nodeVal); val.nData = varDataLen(nodeVal); @@ -5649,7 +5649,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { char* tmpVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - strcpy(val.colName, pTagSchema->name); +// strcpy(val.colName, pTagSchema->name); if (IS_VAR_DATA_TYPE(pTagSchema->type)) { val.pData = varDataVal(tmpVal); val.nData = varDataLen(tmpVal); diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 2f12c9adf6..b6ebb0de22 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -389,7 +389,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi continue; } STagVal val = {0}; - strcpy(val.colName, colName); +// strcpy(val.colName, colName); val.pKey = jsonKey; taosHashPut(keyHash, jsonKey, keyLen, &keyLen, CHAR_BYTES); // add key to hash to remove dumplicate, value is useless From 4862f032d6b3691ff903ffe7a784b445bdad63eb Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 18:07:54 +0800 Subject: [PATCH 07/92] fix:disable colName in tag --- include/common/tdataformat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index e768f89372..d37b8ce1ca 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -167,7 +167,7 @@ struct SColVal { #pragma pack(push, 1) struct STagVal { - char colName[TSDB_COL_NAME_LEN]; // only used for tmq_get_meta +// char colName[TSDB_COL_NAME_LEN]; // only used for tmq_get_meta union { int16_t cid; char *pKey; From 5d3e07c0220ec84e7db53431166edde50f678990 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 19:10:41 +0800 Subject: [PATCH 08/92] fix:conflict from 3.0 --- source/client/src/tmq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index e3dfdc68a8..649584a9a1 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2114,8 +2114,8 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t // cJSON* tname = cJSON_CreateString(pTagVal->colName); // cJSON_AddItemToObject(tag, "name", tname); - cJSON* cid_ = cJSON_CreateString(""); - cJSON_AddItemToObject(tag, "cid", cid_); +// cJSON* cid_ = cJSON_CreateString(""); +// cJSON_AddItemToObject(tag, "cid", cid_); cJSON* ttype = cJSON_CreateNumber(TSDB_DATA_TYPE_JSON); cJSON_AddItemToObject(tag, "type", ttype); cJSON* tvalue = cJSON_CreateString(pJson); @@ -2130,10 +2130,8 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t cJSON* tag = cJSON_CreateObject(); - char cid[32] = {0}; - sprintf(cid, "%d", pTagVal->cid); - cJSON* cid_ = cJSON_CreateString(cid); - cJSON_AddItemToObject(tag, "cid", cid_); + cJSON* cid = cJSON_CreateNumber(pTagVal->cid); + cJSON_AddItemToObject(tag, "cid", cid); cJSON* ttype = cJSON_CreateNumber(pTagVal->type); cJSON_AddItemToObject(tag, "type", ttype); From 1f5663f03ef8c6bb6635f1686383caa182145bd0 Mon Sep 17 00:00:00 2001 From: tomchon Date: Mon, 11 Jul 2022 19:52:18 +0800 Subject: [PATCH 09/92] test:add test case of tsbs query --- tests/system-test/2-query/tsbsQuery.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index d24e5ea283..819380d7fd 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -58,11 +58,18 @@ class TDTestCase: tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ") tdSql.checkRows(1) + # test insert into + tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;") + tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") + tdSql.checkRows(1) + + tdSql.query("insert into testsnode(c1,c2,c3,c4) SELECT avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m);") + tdSql.checkRows(1) def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdLog.printNoPrefix("==========step1:create database and table,insert data ==============") - self.tsbsIotQuery() + self.prepareData() self.tsbsIotQuery() From 8684f75dcdeafbe05a5b566efd5d1f42907195ba Mon Sep 17 00:00:00 2001 From: tomchon Date: Mon, 11 Jul 2022 20:00:11 +0800 Subject: [PATCH 10/92] test:add test case of tsbs query --- tests/system-test/2-query/tsbsQuery.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index 819380d7fd..bc7095f627 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -8,7 +8,12 @@ from util.sql import * from util.cases import * class TDTestCase: - + + clientCfgDict = {'queryproxy': '1','debugFlag': 135} + clientCfgDict["debugFlag"] = 143 + updatecfgDict = {'clientCfg': {}} + updatecfgDict["clientCfg"] = clientCfgDict + def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor(), True) @@ -61,10 +66,8 @@ class TDTestCase: # test insert into tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;") tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") - tdSql.checkRows(1) - + tdSql.query("insert into testsnode(c1,c2,c3,c4) SELECT avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m);") - tdSql.checkRows(1) def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring From 218c71df6a8bdc02dea0af36d2f1eadd09ec15c7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 11 Jul 2022 20:03:57 +0800 Subject: [PATCH 11/92] feat:add tmq alter table option --- examples/c/tmq.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index c55cb2ca58..f421f344a2 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -223,6 +223,13 @@ int32_t init_env() { } taos_free_result(pRes); + pRes = taos_query(pConn, "alter table n1 comment 'hello'"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "alter table n1 drop column c1"); if (taos_errno(pRes) != 0) { printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); From 835ddbacf414e20faaba36a55a4b9e1add89c8b4 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 11 Jul 2022 21:14:37 +0800 Subject: [PATCH 12/92] fix: fix retry issue --- source/libs/scheduler/inc/schInt.h | 2 ++ source/libs/scheduler/src/schJob.c | 38 ++++++++++++++++++++++++--- source/libs/scheduler/src/schRemote.c | 2 +- source/libs/scheduler/src/schTask.c | 3 ++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index e5c7e37479..4cae547077 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -223,6 +223,7 @@ typedef struct SSchJobAttr { typedef struct { int32_t op; + SRWLatch lock; bool syncReq; } 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 schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask); void schDirectPostJobRes(SSchedulerReq* pReq, int32_t errCode); +bool schChkCurrentOp(SSchJob *pJob, int32_t op, bool sync); extern SSchDebug gSCHDebug; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index e482814ee7..19bb93249f 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -443,25 +443,37 @@ int32_t schNotifyUserFetchRes(SSchJob* pJob) { } void schPostJobRes(SSchJob *pJob, SCH_OP_TYPE op) { + SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock); + 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)); - return; + goto _return; } if (op && pJob->opStatus.op != 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)) { + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); tsem_post(&pJob->rspSem); } else if (SCH_JOB_IN_ASYNC_EXEC_OP(pJob)) { + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); schNotifyUserExecRes(pJob); } else if (SCH_JOB_IN_ASYNC_FETCH_OP(pJob)) { + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); schNotifyUserFetchRes(pJob); } else { + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); 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) { @@ -658,13 +670,13 @@ int32_t schJobFetchRows(SSchJob *pJob) { if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { 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)); tsem_wait(&pJob->rspSem); SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes)); } } else { - if (pJob->opStatus.syncReq) { + if (schChkCurrentOp(pJob, SCH_OP_FETCH, true)) { SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes)); } else { 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) { int32_t op = 0; switch (type) { case SCH_OP_EXEC: if (pReq && pReq->syncReq) { + SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock); op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL); 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_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); schDumpJobExecRes(pJob, pReq->pExecRes); } break; case SCH_OP_FETCH: if (pReq && pReq->syncReq) { + SCH_LOCK(SCH_WRITE, &pJob->opStatus.lock); op = atomic_val_compare_exchange_32(&pJob->opStatus.op, type, SCH_OP_NULL); 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_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); } break; case SCH_OP_GET_STATUS: @@ -816,8 +840,10 @@ int32_t schProcessOnOpBegin(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq switch (type) { 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)) { 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); 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)); pJob->opStatus.syncReq = pReq->syncReq; + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); break; 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)) { 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); 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->opStatus.syncReq = pReq->syncReq; + SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); if (!SCH_JOB_NEED_FETCH(pJob)) { SCH_JOB_ELOG("no need to fetch data, status:%s", SCH_GET_JOB_STATUS_STR(pJob)); diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 2257ba8328..3db1ba7be8 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -940,7 +940,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, if (NULL == addr) { addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx); isCandidateAddr = true; - SCH_TASK_DLOG("target candidateIdx %d", pTask->candidateIdx); + SCH_TASK_DLOG("target candidateIdx %d, epInUse %d/%d", pTask->candidateIdx, addr->epSet.inUse, addr->epSet.numOfEps); } switch (msgType) { diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index a6621d279d..d77fbc33fd 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -545,7 +545,8 @@ int32_t schHandleTaskRetry(SSchJob *pJob, SSchTask *pTask) { schDeregisterTaskHb(pJob, pTask); if (SCH_IS_DATA_BIND_TASK(pTask)) { - SCH_SWITCH_EPSET(&pTask->plan->execNode); + SQueryNodeAddr *addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx); + SCH_SWITCH_EPSET(addr); } else { SCH_ERR_RET(schSwitchTaskCandidateAddr(pJob, pTask)); } From 7fcf80a8f92515f9981290943434558225748f9c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 12 Jul 2022 09:24:01 +0800 Subject: [PATCH 13/92] enh: add more retry times for data src task --- source/libs/scheduler/src/schTask.c | 2 ++ tests/script/api/stopquery.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index d77fbc33fd..b83e24d6df 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -508,6 +508,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo return TSDB_CODE_SUCCESS; } +/* if (SCH_IS_DATA_BIND_TASK(pTask)) { if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { *needRetry = false; @@ -525,6 +526,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo return TSDB_CODE_SUCCESS; } } +*/ *needRetry = true; SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode)); diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index 0f27fdf9f9..eeaf9295d9 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -578,6 +578,8 @@ int sqConKillSyncQuery(bool fetch) { pthread_join(qid, NULL); pthread_join(cid, NULL); + + taos_close(param.taos); } CASE_LEAVE(); } @@ -593,6 +595,8 @@ int sqConKillAsyncQuery(bool fetch) { pthread_join(qid, NULL); pthread_join(cid, NULL); + + taos_close(param.taos); } CASE_LEAVE(); } @@ -600,7 +604,6 @@ int sqConKillAsyncQuery(bool fetch) { void sqRunAllCase(void) { -/* sqStopSyncQuery(false); sqStopSyncQuery(true); sqStopAsyncQuery(false); @@ -620,17 +623,14 @@ void sqRunAllCase(void) { sqConCloseSyncQuery(true); sqConCloseAsyncQuery(false); sqConCloseAsyncQuery(true); -*/ -#if 0 sqKillSyncQuery(false); sqKillSyncQuery(true); sqKillAsyncQuery(false); sqKillAsyncQuery(true); -#endif - //sqConKillSyncQuery(false); + sqConKillSyncQuery(false); sqConKillSyncQuery(true); #if 0 sqConKillAsyncQuery(false); From e3a48b01ecf1109a9fd8f86069c687c9b8dc7c8d Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 12 Jul 2022 14:25:02 +0800 Subject: [PATCH 14/92] test:add testcase of qnode --- tests/system-test/fulltest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 3b0dd76a30..1884420ccd 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -120,7 +120,7 @@ python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/and_or_for_byte.py python3 ./test.py -f 2-query/function_null.py -#python3 ./test.py -f 2-query/queryQnode.py +python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py #BUG python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 From 9f0152239d9bacda1168e1de5568ef1af5362a9d Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 12 Jul 2022 14:56:12 +0800 Subject: [PATCH 15/92] fix: fix stop query --- source/libs/catalog/src/catalog.c | 1 + source/util/src/tref.c | 2 +- tests/script/api/stopquery.c | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 3a7ad4a2d6..1b7f53ae67 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -1293,6 +1293,7 @@ void catalogDestroy(void) { if (!taosCheckCurrentInDll()) { ctgClearCacheEnqueue(NULL, true, true, true); + taosThreadJoin(gCtgMgmt.updateThread, NULL); } taosHashCleanup(gCtgMgmt.pCluster); diff --git a/source/util/src/tref.c b/source/util/src/tref.c index 2e4c33bc87..9cd849b9be 100644 --- a/source/util/src/tref.c +++ b/source/util/src/tref.c @@ -431,7 +431,7 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove) { } released = 1; } 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 { uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid); diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index eeaf9295d9..a42e9e2d44 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -36,7 +36,7 @@ int64_t st, et; char hostName[128]; char dbName[128]; char tbName[128]; -int32_t runTimes = 10000; +int32_t runTimes = 1000; typedef struct { int id; @@ -88,6 +88,7 @@ static void sqExecSQLE(TAOS *taos, char *command) { void sqExit(char* prefix, const char* errMsg) { fprintf(stderr, "%s error: %s\n", prefix, errMsg); + sleep(10000); exit(1); } @@ -141,16 +142,20 @@ void sqCloseFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { taos_close(qParam->taos); *qParam->end = 1; + + taos_free_result(pRes); } void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) { SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; if (code == 0 && pRes) { if (qParam->fetch) { - taos_fetch_rows_a(pRes, sqFreeFetchCb, param); + taos_fetch_rows_a(pRes, sqCloseFetchCb, param); } else { taos_close(qParam->taos); *qParam->end = 1; + + taos_free_result(pRes); } } else { sqExit("select", taos_errstr(pRes)); @@ -358,6 +363,7 @@ int sqCloseSyncQuery(bool fetch) { } taos_close(taos); + taos_free_result(pRes); } CASE_LEAVE(); } @@ -382,7 +388,7 @@ int sqCloseAsyncQuery(bool fetch) { SSP_CB_PARAM param = {0}; param.fetch = fetch; param.end = &qEnd; - taos_query_a(taos, sql, sqFreeQueryCb, ¶m); + taos_query_a(taos, sql, sqCloseQueryCb, ¶m); while (0 == qEnd) { usleep(5000); } @@ -640,7 +646,7 @@ void sqRunAllCase(void) { int32_t l = 5; while (l) { printf("%d\n", l--); - sleep(1); + sleep(1000); } } From 2641714e87808cfe3c40b4b1cd81803b8d33f26a Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 12 Jul 2022 15:20:05 +0800 Subject: [PATCH 16/92] test:add test case of tsbs query --- tests/system-test/2-query/tsbsQuery.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index bc7095f627..be3a788006 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -10,8 +10,9 @@ from util.cases import * class TDTestCase: clientCfgDict = {'queryproxy': '1','debugFlag': 135} - clientCfgDict["debugFlag"] = 143 + clientCfgDict["debugFlag"] = 131 updatecfgDict = {'clientCfg': {}} + updatecfgDict = {'debugFlag': 131} updatecfgDict["clientCfg"] = clientCfgDict def init(self, conn, logSql): @@ -60,9 +61,14 @@ class TDTestCase: def tsbsIotQuery(self): tdSql.execute("use db_tsbs") + + # test interval and partition + tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ") + parRows=tdSql.queryRows tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ") - tdSql.checkRows(1) - + tdSql.checkRows(parRows) + + # test insert into tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;") tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") From 473e134f310c699249f319ff773eb4830f32eb2a Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 12 Jul 2022 16:57:19 +0800 Subject: [PATCH 17/92] refactor(sync): add resp ttl clean --- include/libs/sync/sync.h | 2 + source/dnode/vnode/src/vnd/vnodeSync.c | 23 ++++++++---- source/libs/sync/src/syncMain.c | 9 +---- source/libs/sync/src/syncRespMgr.c | 51 ++++++++++---------------- source/libs/sync/src/syncTimeout.c | 2 + 5 files changed, 41 insertions(+), 46 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index bef26cb310..c226d7c8cc 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -26,6 +26,8 @@ extern "C" { extern bool gRaftDetailLog; +#define SYNC_RESP_TTL_MS 5000 + #define SYNC_MAX_BATCH_SIZE 500 #define SYNC_INDEX_BEGIN 0 #define SYNC_INDEX_INVALID -1 diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index bdcfe208d6..87148a8450 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -427,13 +427,22 @@ static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta c syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType)); - SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen}; - rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); - memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen); - syncGetAndDelRespRpc(pVnode->sync, cbMeta.seqNum, &rpcMsg.info); - rpcMsg.info.conn.applyIndex = cbMeta.index; - rpcMsg.info.conn.applyTerm = cbMeta.term; - tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg); + if (cbMeta.code == 0) { + SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen}; + rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); + memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen); + syncGetAndDelRespRpc(pVnode->sync, cbMeta.seqNum, &rpcMsg.info); + rpcMsg.info.conn.applyIndex = cbMeta.index; + rpcMsg.info.conn.applyTerm = cbMeta.term; + tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg); + } else { + SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info}; + vError("vgId:%d, sync commit error, msgtype:%d,%s, error:0x%X, errmsg:%s", syncGetVgId(pVnode->sync), pMsg->msgType, + TMSG_INFO(pMsg->msgType), cbMeta.code, tstrerror(cbMeta.code)); + if (rsp.info.handle != NULL) { + tmsgSendRsp(&rsp); + } + } } static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index abc0f53611..918496c894 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1055,19 +1055,12 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { } // tools - pSyncNode->pSyncRespMgr = syncRespMgrCreate(pSyncNode, 0); + pSyncNode->pSyncRespMgr = syncRespMgrCreate(pSyncNode, SYNC_RESP_TTL_MS); ASSERT(pSyncNode->pSyncRespMgr != NULL); // restore state pSyncNode->restoreFinish = false; - // pSyncNode->pSnapshot = NULL; - // if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { - // pSyncNode->pSnapshot = taosMemoryMalloc(sizeof(SSnapshot)); - // pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, pSyncNode->pSnapshot); - // } - // tsem_init(&(pSyncNode->restoreSem), 0, 0); - // snapshot senders for (int i = 0; i < TSDB_MAX_REPLICA; ++i) { SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i); diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index eaeadd3991..2aaa98b299 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -122,54 +122,43 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl) { int cnt = 0; SSyncNode *pSyncNode = pObj->data; - SArray *delIndexArray = taosArrayInit(0, sizeof(SyncIndex)); + SArray *delIndexArray = taosArrayInit(0, sizeof(uint64_t)); ASSERT(delIndexArray != NULL); while (pStub) { - size_t len; - void * key = taosHashGetKey(pStub, &len); - SyncIndex *pIndex = (SyncIndex *)key; + size_t len; + void *key = taosHashGetKey(pStub, &len); + uint64_t *pSeqNum = (uint64_t *)key; int64_t nowMS = taosGetTimestampMs(); if (nowMS - pStub->createTime > ttl) { - taosArrayPush(delIndexArray, pIndex); + taosArrayPush(delIndexArray, pSeqNum); cnt++; - SSyncRaftEntry *pEntry = NULL; - int32_t code = 0; - if (pSyncNode->pLogStore != NULL) { - code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, *pIndex, &pEntry); - if (code == 0 && pEntry != NULL) { - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pEntry->index; - cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(pSyncNode, cbMeta.index); - cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = TSDB_CODE_SYN_TIMEOUT; - cbMeta.state = pSyncNode->state; - cbMeta.seqNum = pEntry->seqNum; - cbMeta.term = pEntry->term; - cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm; - cbMeta.flag = 0; + SFsmCbMeta cbMeta = {0}; + cbMeta.index = SYNC_INDEX_INVALID; + cbMeta.lastConfigIndex = SYNC_INDEX_INVALID; + cbMeta.isWeak = false; + cbMeta.code = TSDB_CODE_SYN_TIMEOUT; + cbMeta.state = pSyncNode->state; + cbMeta.seqNum = *pSeqNum; + cbMeta.term = SYNC_TERM_INVALID; + cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm; + cbMeta.flag = 0; - SRpcMsg rpcMsg = pStub->rpcMsg; - rpcMsg.pCont = rpcMallocCont(pEntry->dataLen); - memcpy(rpcMsg.pCont, pEntry->data, pEntry->dataLen); - pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &rpcMsg, cbMeta); - - syncEntryDestory(pEntry); - } - } + pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &(pStub->rpcMsg), cbMeta); } pStub = (SRespStub *)taosHashIterate(pObj->pRespHash, pStub); } int32_t arraySize = taosArrayGetSize(delIndexArray); - sDebug("vgId:%d, resp clean by ttl, cnt:%d, array-size:%d", pSyncNode->vgId, cnt, arraySize); + sDebug("vgId:%d, resp mgr clean by ttl, cnt:%d, array-size:%d", pSyncNode->vgId, cnt, arraySize); for (int32_t i = 0; i < arraySize; ++i) { - SyncIndex *pIndex = taosArrayGet(delIndexArray, i); - taosHashRemove(pObj->pRespHash, pIndex, sizeof(SyncIndex)); + uint64_t *pSeqNum = taosArrayGet(delIndexArray, i); + taosHashRemove(pObj->pRespHash, pSeqNum, sizeof(uint64_t)); + sDebug("vgId:%d, resp mgr clean by ttl, seq:%d", pSyncNode->vgId, *pSeqNum); } taosArrayDestroy(delIndexArray); } diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c index 52181a3da8..97de75c108 100644 --- a/source/libs/sync/src/syncTimeout.c +++ b/source/libs/sync/src/syncTimeout.c @@ -16,9 +16,11 @@ #include "syncTimeout.h" #include "syncElection.h" #include "syncReplication.h" +#include "syncRespMgr.h" int32_t syncNodeTimerRoutine(SSyncNode* ths) { syncNodeEventLog(ths, "timer routines ... "); + syncRespClean(ths->pSyncRespMgr); return 0; } From 2b442621e85fc31e6d17b2bd95f7108ab7d8d38a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 12 Jul 2022 18:58:33 +0800 Subject: [PATCH 18/92] feat:get child table name in tmq meta --- examples/c/tmq.c | 10 ++--- include/common/tdataformat.h | 2 +- include/common/tmsg.h | 4 +- source/client/src/tmq.c | 16 +++++--- source/common/src/tmsg.c | 15 +++++++ source/dnode/mnode/sdb/inc/sdb.h | 1 + source/libs/parser/src/parInsert.c | 39 +++++++++++++++---- source/libs/parser/src/parTranslater.c | 25 ++++++++---- source/libs/parser/src/parUtil.c | 2 +- source/libs/scalar/src/sclfunc.c | 2 +- .../libs/scalar/test/scalar/scalarTests.cpp | 4 +- 11 files changed, 87 insertions(+), 33 deletions(-) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index f421f344a2..c114237353 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -97,14 +97,14 @@ int32_t init_env() { taos_free_result(pRes); pRes = - taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int)"); + taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 nchar(8), t4 bool)"); if (taos_errno(pRes) != 0) { printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000)"); + pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000, \"ttt\", true)"); if (taos_errno(pRes) != 0) { printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes)); return -1; @@ -118,14 +118,14 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists ct1 using st1 tags(2000)"); + pRes = taos_query(pConn, "create table if not exists ct1 using st1(t1) tags(2000)"); if (taos_errno(pRes) != 0) { printf("failed to create child table ct1, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists ct2 using st1 tags(NULL)"); + pRes = taos_query(pConn, "create table if not exists ct2 using st1(t1) tags(NULL)"); if (taos_errno(pRes) != 0) { printf("failed to create child table ct2, reason:%s\n", taos_errstr(pRes)); return -1; @@ -139,7 +139,7 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists ct3 using st1 tags(3000)"); + pRes = taos_query(pConn, "create table if not exists ct3 using st1(t1) tags(3000)"); if (taos_errno(pRes) != 0) { printf("failed to create child table ct3, reason:%s\n", taos_errstr(pRes)); return -1; diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index d37b8ce1ca..6f54472dbb 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -97,7 +97,7 @@ int32_t tEncodeTag(SEncoder *pEncoder, const STag *pTag); int32_t tDecodeTag(SDecoder *pDecoder, STag **ppTag); int32_t tTagToValArray(const STag *pTag, SArray **ppArray); void debugPrintSTag(STag *pTag, const char *tag, int32_t ln); // TODO: remove -int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf, const char* colName); +int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf); // STRUCT ================= struct STColumn { diff --git a/include/common/tmsg.h b/include/common/tmsg.h index e157c4cc1b..5e7e045b78 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1968,8 +1968,9 @@ typedef struct SVCreateTbReq { int8_t type; union { struct { - char* name; + char* name; // super table name tb_uid_t suid; + SArray* tagName; uint8_t* pTag; } ctb; struct { @@ -1987,6 +1988,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) { if (req->type == TSDB_CHILD_TABLE) { taosMemoryFreeClear(req->ctb.pTag); taosMemoryFreeClear(req->ctb.name); + taosArrayDestroy(req->ctb.tagName); } else if (req->type == TSDB_NORMAL_TABLE) { taosMemoryFreeClear(req->ntb.schemaRow.pSchema); } diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 649584a9a1..c5cf6eecdf 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2074,7 +2074,7 @@ static char *processAlterStb(SMqMetaRsp *metaRsp){ return string; } -static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t id){ +static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray* tagName, int64_t id){ char* string = NULL; SArray* pTagVals = NULL; cJSON* json = cJSON_CreateObject(); @@ -2112,8 +2112,9 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t cJSON* tag = cJSON_CreateObject(); STagVal* pTagVal = taosArrayGet(pTagVals, 0); -// cJSON* tname = cJSON_CreateString(pTagVal->colName); -// cJSON_AddItemToObject(tag, "name", tname); + char* ptname = taosArrayGet(tagName, 0); + cJSON* tname = cJSON_CreateString(ptname); + cJSON_AddItemToObject(tag, "name", tname); // cJSON* cid_ = cJSON_CreateString(""); // cJSON_AddItemToObject(tag, "cid", cid_); cJSON* ttype = cJSON_CreateNumber(TSDB_DATA_TYPE_JSON); @@ -2130,8 +2131,11 @@ static char *buildCreateCTableJson(STag* pTag, char* sname, char* name, int64_t cJSON* tag = cJSON_CreateObject(); - cJSON* cid = cJSON_CreateNumber(pTagVal->cid); - cJSON_AddItemToObject(tag, "cid", cid); + char* ptname = taosArrayGet(tagName, i); + cJSON* tname = cJSON_CreateString(ptname); + cJSON_AddItemToObject(tag, "name", tname); +// cJSON* cid = cJSON_CreateNumber(pTagVal->cid); +// cJSON_AddItemToObject(tag, "cid", cid); cJSON* ttype = cJSON_CreateNumber(pTagVal->type); cJSON_AddItemToObject(tag, "type", ttype); @@ -2175,7 +2179,7 @@ static char *processCreateTable(SMqMetaRsp *metaRsp){ for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; if(pCreateReq->type == TSDB_CHILD_TABLE){ - string = buildCreateCTableJson((STag*)pCreateReq->ctb.pTag, pCreateReq->ctb.name, pCreateReq->name, pCreateReq->uid); + string = buildCreateCTableJson((STag*)pCreateReq->ctb.pTag, pCreateReq->ctb.name, pCreateReq->name, pCreateReq->ctb.tagName, pCreateReq->uid); }else if(pCreateReq->type == TSDB_NORMAL_TABLE){ string = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE); } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7245a62eb2..8901014600 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4943,6 +4943,12 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) { if (tEncodeCStr(pCoder, pReq->ctb.name) < 0) return -1; if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1; if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1; + int32_t len = taosArrayGetSize(pReq->ctb.tagName); + if (tEncodeI32(pCoder, len) < 0) return -1; + for (int32_t i = 0; i < len; i++){ + char* name = taosArrayGet(pReq->ctb.tagName, i); + if (tEncodeCStr(pCoder, name) < 0) return -1; + } } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { @@ -4973,6 +4979,15 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { if (tDecodeCStr(pCoder, &pReq->ctb.name) < 0) return -1; if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1; if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1; + int32_t len = 0; + if (tDecodeI32(pCoder, &len) < 0) return -1; + pReq->ctb.tagName = taosArrayInit(len, TSDB_COL_NAME_LEN); + if(pReq->ctb.tagName == NULL) return -1; + for (int32_t i = 0; i < len; i++){ + char *name = NULL; + if (tDecodeCStr(pCoder, &name) < 0) return -1; + taosArrayPush(pReq->ctb.tagName, name); + } } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tDecodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 1294f0cff3..be56d901de 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -163,6 +163,7 @@ typedef struct SSdbRow { ESdbType type; ESdbStatus status; int32_t refCount; + int64_t forAlign; char pObj[]; } SSdbRow; diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 9bb55cf663..46a8ffcc6c 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -732,12 +732,13 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* return TSDB_CODE_SUCCESS; } -static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname) { +static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, SArray* tagName) { pTbReq->type = TD_CHILD_TABLE; pTbReq->name = strdup(tname); pTbReq->ctb.suid = suid; if(sname) pTbReq->ctb.name = strdup(sname); pTbReq->ctb.pTag = (uint8_t*)pTag; + pTbReq->ctb.tagName = taosArrayDup(tagName); pTbReq->commentLen = -1; return; @@ -936,6 +937,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16 static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint8_t precision, const char* tName) { int32_t code = TSDB_CODE_SUCCESS; SArray* pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal)); + SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); SToken sToken; bool isParseBindParam = false; bool isJson = false; @@ -965,6 +967,10 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint taosMemoryFree(tmpTokenBuf); goto end; } + + if (!isNullStr(&sToken)) { + taosArrayPush(tagName, pTagSchema->name); + } if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { if (sToken.n > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { code = buildSyntaxErrMsg(&pCxt->msg, "json string too long than 4095", sToken.z); @@ -974,7 +980,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint if (isNullStr(&sToken)) { code = tTagNew(pTagVals, 1, true, &pTag); } else { - code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg, pTagSchema->name); + code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg); } taosMemoryFree(tmpTokenBuf); if (code != TSDB_CODE_SUCCESS) { @@ -1004,7 +1010,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint goto end; } - buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName); + buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName); end: for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) { @@ -1014,6 +1020,7 @@ end: } } taosArrayDestroy(pTagVals); + taosArrayDestroy(tagName); return code; } @@ -1798,6 +1805,11 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch return buildInvalidOperationMsg(&pBuf, "out of memory"); } + SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); + if (!tagName) { + return buildInvalidOperationMsg(&pBuf, "out of memory"); + } + int32_t code = TSDB_CODE_SUCCESS; SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); @@ -1814,6 +1826,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch if (IS_VAR_DATA_TYPE(pTagSchema->type)) { colLen = bind[c].length[0]; } + taosArrayPush(tagName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { if (colLen > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { code = buildSyntaxErrMsg(&pBuf, "json string too long than 4095", bind[c].buffer); @@ -1823,7 +1836,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch isJson = true; char* tmp = taosMemoryCalloc(1, colLen + 1); memcpy(tmp, bind[c].buffer, colLen); - code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf, pTagSchema->name); + code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf); taosMemoryFree(tmp); if (code != TSDB_CODE_SUCCESS) { goto end; @@ -1867,7 +1880,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } SVCreateTbReq tbReq = {0}; - buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName); + buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName, tagName); code = buildCreateTbMsg(pDataBlock, &tbReq); tdDestroySVCreateTbReq(&tbReq); @@ -1879,6 +1892,7 @@ end: } } taosArrayDestroy(pTagArray); + taosArrayDestroy(tagName); return code; } @@ -2219,17 +2233,22 @@ static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SS * @param msg * @return int32_t */ -static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* pSchema, STag** ppTag, SMsgBuf* msg) { +static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* pSchema, STag** ppTag, SArray** tagName, SMsgBuf* msg) { SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal)); if (!pTagArray) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } + *tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); + if (!*tagName) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } int32_t code = TSDB_CODE_SUCCESS; for (int i = 0; i < tags->numOfBound; ++i) { SSchema* pTagSchema = &pSchema[tags->boundColumns[i]]; SSmlKv* kv = taosArrayGetP(cols, i); + taosArrayPush(*tagName, pTagSchema->name); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { @@ -2288,12 +2307,16 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols return ret; } STag* pTag = NULL; - ret = smlBuildTagRow(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, &pTag, &pBuf); + SArray* tagName = NULL; + ret = smlBuildTagRow(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, &pTag, &tagName, &pBuf); if (ret != TSDB_CODE_SUCCESS) { + taosArrayDestroy(tagName); return ret; } - buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL); + buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName); + taosArrayDestroy(tagName); + smlHandle->tableExecHandle.createTblReq.ctb.name = taosMemoryMalloc(sTableNameLen + 1); memcpy(smlHandle->tableExecHandle.createTblReq.ctb.name, sTableName, sTableNameLen); smlHandle->tableExecHandle.createTblReq.ctb.name[sTableNameLen] = 0; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f822945ef5..ffacafb504 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5263,6 +5263,8 @@ static void destroyCreateTbReqBatch(void* data) { taosMemoryFreeClear(pTableReq->ntb.schemaRow.pSchema); } else if (pTableReq->type == TSDB_CHILD_TABLE) { taosMemoryFreeClear(pTableReq->ctb.pTag); + taosMemoryFreeClear(pTableReq->ctb.name); + taosArrayDestroy(pTableReq->ctb.tagName); } } @@ -5334,7 +5336,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { } static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt, - const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo) { + const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo, SArray* tagName) { // char dbFName[TSDB_DB_FNAME_LEN] = {0}; // SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId}; // strcpy(name.dbname, pStmt->dbName); @@ -5353,6 +5355,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S req.ctb.suid = suid; req.ctb.name = strdup(sTableNmae); req.ctb.pTag = (uint8_t*)pTag; + req.ctb.tagName = taosArrayDup(tagName); if (pStmt->ignoreExists) { req.flags |= TD_CREATE_IF_NOT_EXISTS; } @@ -5437,7 +5440,7 @@ static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SVa return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pVal->literal); } - return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf, pTagSchema->name); + return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf); } static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray) { @@ -5457,7 +5460,7 @@ static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, S } static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, - STag** ppTag) { + STag** ppTag, SArray* tagName) { int32_t numOfTags = getNumOfTags(pSuperTableMeta); if (LIST_LENGTH(pStmt->pValsOfTags) != LIST_LENGTH(pStmt->pSpecificTags) || numOfTags < LIST_LENGTH(pStmt->pValsOfTags)) { @@ -5488,8 +5491,10 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla if (pSchema->type == TSDB_DATA_TYPE_JSON) { isJson = true; code = buildJsonTagVal(pCxt, pSchema, pVal, pTagArray, ppTag); + taosArrayPush(tagName, pCol->colName); } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { code = buildNormalTagVal(pCxt, pSchema, pVal, pTagArray); + taosArrayPush(tagName, pCol->colName); } } if (TSDB_CODE_SUCCESS == code) { @@ -5510,7 +5515,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla } static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, - STag** ppTag) { + STag** ppTag, SArray* tagName) { if (getNumOfTags(pSuperTableMeta) != LIST_LENGTH(pStmt->pValsOfTags)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TAGS_NOT_MATCHED); } @@ -5535,6 +5540,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { isJson = true; code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag); + taosArrayPush(tagName, pTagSchema->name); } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { char* tmpVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; @@ -5546,6 +5552,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau memcpy(&val.i64, tmpVal, pTagSchema->bytes); } taosArrayPush(pTagArray, &val); + taosArrayPush(tagName, pTagSchema->name); } } if (TSDB_CODE_SUCCESS == code) { @@ -5581,12 +5588,13 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla } STag* pTag = NULL; + SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); if (TSDB_CODE_SUCCESS == code) { if (NULL != pStmt->pSpecificTags) { - code = buildKVRowForBindTags(pCxt, pStmt, pSuperTableMeta, &pTag); + code = buildKVRowForBindTags(pCxt, pStmt, pSuperTableMeta, &pTag, tagName); } else { - code = buildKVRowForAllTags(pCxt, pStmt, pSuperTableMeta, &pTag); + code = buildKVRowForAllTags(pCxt, pStmt, pSuperTableMeta, &pTag, tagName); } } @@ -5595,9 +5603,10 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla code = getTableHashVgroup(pCxt, pStmt->dbName, pStmt->tableName, &info); } if (TSDB_CODE_SUCCESS == code) { - addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, pStmt->useTableName, &info); + addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, pStmt->useTableName, &info, tagName); } + taosArrayDestroy(tagName); taosMemoryFreeClear(pSuperTableMeta); return code; } @@ -5823,7 +5832,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS int32_t code = TSDB_CODE_SUCCESS; STag* pTag = NULL; do { - code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf, pReq->tagName); + code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf); if (TSDB_CODE_SUCCESS != code) { break; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index b6ebb0de22..69cc95a726 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -341,7 +341,7 @@ static bool isValidateTag(char* input) { return true; } -int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf, const char* colName) { +int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, void* pMsgBuf) { int32_t retCode = TSDB_CODE_SUCCESS; cJSON* root = NULL; SHashObj* keyHash = NULL; diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index dd0a60dced..df5df127f0 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1150,7 +1150,7 @@ int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu } memcpy(tmp, varDataVal(input), varDataLen(input)); tmp[varDataLen(input)] = 0; - if(parseJsontoTagData(tmp, pTagVals, &pTag, NULL, "")){ + if(parseJsontoTagData(tmp, pTagVals, &pTag, NULL)){ tTagNew(pTagVals, 1, true, &pTag); } } diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index 6663fc3cc4..9b40f0a465 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -1114,7 +1114,7 @@ TEST(columnTest, json_column_arith_op) { memcpy(rightv, rightvTmp, strlen(rightvTmp)); SArray *tags = taosArrayInit(1, sizeof(STagVal)); STag* row = NULL; - parseJsontoTagData(rightv, tags, &row, NULL, ""); + parseJsontoTagData(rightv, tags, &row, NULL); const int32_t len = 8; EOperatorType op[len] = {OP_TYPE_ADD, OP_TYPE_SUB, OP_TYPE_MULTI, OP_TYPE_DIV, @@ -1262,7 +1262,7 @@ TEST(columnTest, json_column_logic_op) { memcpy(rightv, rightvTmp, strlen(rightvTmp)); SArray *tags = taosArrayInit(1, sizeof(STagVal)); STag* row = NULL; - parseJsontoTagData(rightv, tags, &row, NULL, ""); + parseJsontoTagData(rightv, tags, &row, NULL); const int32_t len0 = 6; const int32_t len = 9; From e91ca30b19a21589cc78393350c957623fa56c91 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 12 Jul 2022 20:23:31 +0800 Subject: [PATCH 19/92] refactor(sync): add resp ttl clean --- source/libs/sync/src/syncRespMgr.c | 2 ++ source/libs/sync/src/syncTimeout.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index 2aaa98b299..8e477a5159 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -146,6 +146,8 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl) { cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm; cbMeta.flag = 0; + pStub->rpcMsg.pCont = NULL; + pStub->rpcMsg.contLen = 0; pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &(pStub->rpcMsg), cbMeta); } diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c index 97de75c108..ad5f82900c 100644 --- a/source/libs/sync/src/syncTimeout.c +++ b/source/libs/sync/src/syncTimeout.c @@ -20,7 +20,10 @@ int32_t syncNodeTimerRoutine(SSyncNode* ths) { syncNodeEventLog(ths, "timer routines ... "); - syncRespClean(ths->pSyncRespMgr); + + if (ths->vgId != 1) { + syncRespClean(ths->pSyncRespMgr); + } return 0; } From 8aa09ffee84bd4223c25f278fb7c228312991dcf Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Wed, 13 Jul 2022 08:42:10 +0800 Subject: [PATCH 20/92] add sysinfo test case --- tests/system-test/0-others/sysinfo.py | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/system-test/0-others/sysinfo.py diff --git a/tests/system-test/0-others/sysinfo.py b/tests/system-test/0-others/sysinfo.py new file mode 100644 index 0000000000..d74c4f6db9 --- /dev/null +++ b/tests/system-test/0-others/sysinfo.py @@ -0,0 +1,59 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + + +from util.log import * +from util.cases import * +from util.sql import * +import subprocess +from util.common import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.dbname = 'db' + def get_database_info(self): + tdSql.query('select database()') + tdSql.checkData(0,0,None) + tdSql.execute(f'create database if not exists {self.dbname}') + tdSql.execute(f'use {self.dbname}') + tdSql.query('select database()') + tdSql.checkData(0,0,self.dbname) + tdSql.execute(f'drop database {self.dbname}') + + def check_version(self): + taos_list = ['server','client'] + for i in taos_list: + tdSql.query(f'select {i}_version()') + version_info = str(subprocess.run('cat ../../source/util/src/version.c |grep "char version"', shell=True,capture_output=True).stdout.decode('utf8')).split('"')[1] + tdSql.checkData(0,0,version_info) + + def get_server_status(self): + tdSql.query('select server_status()') + tdSql.checkData(0,0,1) + tdDnodes.stoptaosd(1) + + tdSql.query('select server_status()') + print(tdSql.queryResult) + def run(self): + self.get_database_info() + self.check_version() + # self.get_server_status() + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file From 589d5b5999dde9ac0aeb1499c8b098fb8a5850b0 Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Wed, 13 Jul 2022 09:50:38 +0800 Subject: [PATCH 21/92] update count.py --- tests/system-test/2-query/count.py | 376 ++++++++++++++++------------- 1 file changed, 213 insertions(+), 163 deletions(-) diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index c4c1d19898..70966e387a 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -1,188 +1,238 @@ from util.log import * from util.sql import * from util.cases import * - +from util.sqlset import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - + tdSql.init(conn.cursor(),logSql) + self.setsql = TDSetSql() self.rowNum = 10 self.ts = 1537146000000 - def run(self): + self.ntbname = 'ntb' + self.stbname = 'stb' + self.column_dict = { + 'ts':'timestamp', + 'c1':'int', + 'c2':'float', + 'c3':'double', + 'c4':'timestamp' + } + self.tag_dict = { + 't0':'int' + } + # The number of tag_values should be same as tbnum + self.tbnum = 2 + self.tag_values = [ + f'10', + f'100' + ] + self.values_list = [ + f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' + ] + # def count_query_stb(self,stbname,tbnum): + # tdSql.query(f'select count(tbname) from {stbname}') + # print(tdSql.queryResult) + # tdSql.checkEqual(tdSql.queryResult[0],tbnum) + + def check_ntb(self): tdSql.prepare() + tdSql.execute(self.setsql.set_create_normaltable_sql(self.ntbname,self.column_dict)) - tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, - col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') - tdSql.execute("create table stb_1 using stb tags('beijing')") - tdSql.execute("create table stb_2 using stb tags('shanghai')") + def check_stb(self): + tdSql.prepare() + tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) + for i in range(self.tbnum): + tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[i]})') + tdSql.query(f'select count(tbname) from {self.stbname}') + tdSql.checkRows(0) + tdSql.execute('flush database db') + tdSql.query(f'select count(tbname) from {self.stbname}') + tdSql.checkRows(0) + for i in range(self.tbnum): + for j in self.values_list: + tdSql.execute(f'insert into {self.stbname}_{i} values({j})') + tdSql.query(f'select count(tbname) from {self.stbname}') + tdSql.checkRows(0) + tdSql.execute('flush database db') + tdSql.query(f'select count(tbname) from {self.stbname}') + tdSql.checkRows(0) + + def run(self): + self.check_stb() + # tdSql.prepare() - tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, - col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') + # tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + # tdSql.execute("create table stb_1 using stb tags('beijing')") + # tdSql.execute("create table stb_2 using stb tags('shanghai')") - for i in range(self.rowNum): - tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + # tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') - for i in range(self.rowNum): - tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + # for i in range(self.rowNum): + # tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + # tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - tdSql.query("select count(*) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(*) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(ts) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(ts) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col1) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col1) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col2) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col2) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col3) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col3) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col4) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col4) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col5) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col5) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col6) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col6) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col7) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col7) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col8) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col8) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col9) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col9) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col11) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col11) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col12) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col12) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col13) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col13) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col14) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col14) from db.stb") - tdSql.checkData(0,0,20) + # for i in range(self.rowNum): + # tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + # tdSql.query("select count(*) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(*) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(ts) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(ts) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col1) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col1) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col2) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col2) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col3) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col3) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col4) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col4) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col5) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col5) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col6) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col6) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col7) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col7) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col8) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col8) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col9) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col9) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col11) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col11) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col12) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col12) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col13) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col13) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col14) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col14) from db.stb") + # tdSql.checkData(0,0,20) - tdSql.query("select count(ts) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(ts) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col1) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col1) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col2) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col2) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col3) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col3) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col4) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col4) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col5) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col5) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col6) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col6) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col7) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col7) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col8) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col8) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col9) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col9) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col11) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col11) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col12) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col12) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col13) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col13) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col14) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col14) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col1) from stb_1 group by col7") - tdSql.checkRows(2) + # tdSql.query("select count(ts) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(ts) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col1) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col1) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col2) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col2) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col3) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col3) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col4) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col4) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col5) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col5) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col6) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col6) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col7) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col7) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col8) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col8) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col9) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col9) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col11) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col11) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col12) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col12) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col13) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col13) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col14) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col14) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col1) from stb_1 group by col7") + # tdSql.checkRows(2) - tdSql.execute("insert into stb_1 values(now,null,null,null,null,null,null,null,null,null,null,null,null,null)") - tdSql.query("select count(col1) from stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col1),count(ts) from stb_1") - tdSql.checkData(0,0,10) - tdSql.checkData(0,1,11) + # tdSql.execute("insert into stb_1 values(now,null,null,null,null,null,null,null,null,null,null,null,null,null)") + # tdSql.query("select count(col1) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col1),count(ts) from stb_1") + # tdSql.checkData(0,0,10) + # tdSql.checkData(0,1,11) - tdSql.query("select count(col1) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.query("select count(col1),count(ts) from db.stb_1") - tdSql.checkData(0,0,10) - tdSql.checkData(0,1,11) + # tdSql.query("select count(col1) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.query("select count(col1),count(ts) from db.stb_1") + # tdSql.checkData(0,0,10) + # tdSql.checkData(0,1,11) - tdSql.query("select count(col1) from stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col1),count(ts) from stb") - tdSql.checkData(0,0,20) - tdSql.checkData(0,1,21) + # tdSql.query("select count(col1) from stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col1),count(ts) from stb") + # tdSql.checkData(0,0,20) + # tdSql.checkData(0,1,21) - tdSql.query("select count(col1) from db.stb") - tdSql.checkData(0,0,20) - tdSql.query("select count(col1),count(ts) from db.stb") - tdSql.checkData(0,0,20) - tdSql.checkData(0,1,21) - tdSql.query("select count(col1) from stb_1 group by col7") - tdSql.checkRows(3) - tdSql.query("select count(col1) from stb_2 group by col7") - tdSql.checkRows(2) - tdSql.query("select count(col1) from stb group by col7") - tdSql.checkRows(3) + # tdSql.query("select count(col1) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.query("select count(col1),count(ts) from db.stb") + # tdSql.checkData(0,0,20) + # tdSql.checkData(0,1,21) + # tdSql.query("select count(col1) from stb_1 group by col7") + # tdSql.checkRows(3) + # tdSql.query("select count(col1) from stb_2 group by col7") + # tdSql.checkRows(2) + # tdSql.query("select count(col1) from stb group by col7") + # tdSql.checkRows(3) From ebb2f34de14db5800e643e75a23f603d812a18c7 Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 13 Jul 2022 10:43:59 +0800 Subject: [PATCH 22/92] test:add test case of tsbs query --- tests/system-test/2-query/tsbsQuery.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index be3a788006..63f243baa0 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -66,16 +66,19 @@ class TDTestCase: tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ") parRows=tdSql.queryRows tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ") - tdSql.checkRows(parRows) + # tdSql.checkRows(parRows) # test insert into tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;") tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") - tdSql.query("insert into testsnode(c1,c2,c3,c4) SELECT avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m);") + tdSql.query("insert into testsnode(ts,c1,c2,c3,c4) SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") + # test interval fill + tdSql.query("SELECT name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0) ;") + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdLog.printNoPrefix("==========step1:create database and table,insert data ==============") self.prepareData() From 15ea5e84ed195af0094f04ce1be06fa603bdd0f1 Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Wed, 13 Jul 2022 11:17:35 +0800 Subject: [PATCH 23/92] update --- tests/pytest/util/sqlset.py | 2 +- tests/system-test/2-query/count.py | 262 ++++++++--------------------- 2 files changed, 71 insertions(+), 193 deletions(-) diff --git a/tests/pytest/util/sqlset.py b/tests/pytest/util/sqlset.py index bccd49a209..3c1b6cd7f7 100644 --- a/tests/pytest/util/sqlset.py +++ b/tests/pytest/util/sqlset.py @@ -41,7 +41,7 @@ class TDSetSql: create_stb_sql = f'create table {stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})' return create_stb_sql - def set_insertsql(self,column_dict,tbname,binary_str,nchar_str): + def set_insertsql(self,column_dict,tbname,binary_str=None,nchar_str=None): sql = '' for k, v in column_dict.items(): if v.lower() == 'timestamp' or v.lower() == 'tinyint' or v.lower() == 'smallint' or v.lower() == 'int' or v.lower() == 'bigint' or \ diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index 70966e387a..fef5a38e8f 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -28,215 +28,93 @@ class TDTestCase: f'10', f'100' ] - self.values_list = [ - f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' - ] - # def count_query_stb(self,stbname,tbnum): - # tdSql.query(f'select count(tbname) from {stbname}') - # print(tdSql.queryResult) - # tdSql.checkEqual(tdSql.queryResult[0],tbnum) - + def query_stb(self,k,stbname,tbnum,rownum): + tdSql.query(f'select count({k}) from {stbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum) + tdSql.query(f'select count({k}) from {stbname} where ts <={self.ts+self.rowNum-1}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum) + tdSql.query(f'select count({k}) from {stbname} where ts <={self.ts+self.rowNum-2}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*(rownum-1)) + def query_ctb(self,k,i,stbname,rownum): + tdSql.query(f'select count({k}) from {stbname}_{i}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + tdSql.query(f'select count({k}) from {stbname}_{i} where ts <={self.ts+self.rowNum-1}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + tdSql.query(f'select count({k}) from {stbname}_{i} where ts <={self.ts+self.rowNum-2}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum-1) + def query_ntb(self,k,ntbname,rownum): + tdSql.query(f'select count({k}) from {ntbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + tdSql.query(f'select count({k}) from {ntbname} where ts <={self.ts+self.rowNum-1}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + tdSql.query(f'select count({k}) from {ntbname} where ts <={self.ts+self.rowNum-2}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum-1) + def count_query_stb(self,column_dict,tag_dict,stbname,tbnum,rownum): + tdSql.query(f'select count(tbname) from {stbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum) + tdSql.query(f'SELECT count(*) from (select distinct tbname from {stbname})') + tdSql.checkEqual(tdSql.queryResult[0][0],tbnum) + for k in column_dict.keys(): + self.query_stb(k,stbname,tbnum,rownum) + for k in tag_dict.keys(): + self.query_stb(k,stbname,tbnum,rownum) + def count_query_ctb(self,column_dict,tag_dict,stbname,tbnum,rownum): + for i in range(tbnum): + tdSql.query(f'select count(tbname) from {stbname}_{i}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + for k in column_dict.keys(): + self.query_ctb(k,i,stbname,rownum) + for k in tag_dict.keys(): + self.query_ctb(k,i,stbname,rownum) + def count_query_ntb(self,column_dict,ntbname,rownum): + tdSql.query(f'select count(tbname) from {ntbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],rownum) + for k in column_dict.keys(): + self.query_ntb(k,ntbname,rownum) + def insert_data(self,column_dict,tbname,row_num): + insert_sql = self.setsql.set_insertsql(column_dict,tbname) + for i in range(row_num): + insert_list = [] + self.setsql.insert_values(column_dict,i,insert_sql,insert_list,self.ts) def check_ntb(self): tdSql.prepare() tdSql.execute(self.setsql.set_create_normaltable_sql(self.ntbname,self.column_dict)) - + tdSql.query(f'select count(tbname) from {self.ntbname}') + tdSql.checkRows(0) + tdSql.execute('flush database db') + tdSql.query(f'select count(tbname) from {self.ntbname}') + tdSql.checkRows(0) + self.insert_data(self.column_dict,self.ntbname,self.rowNum) + self.count_query_ntb(self.column_dict,self.ntbname,self.rowNum) + tdSql.execute('flush database db') + self.count_query_ntb(self.column_dict,self.ntbname,self.rowNum) + tdSql.execute('drop database db') def check_stb(self): tdSql.prepare() tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) for i in range(self.tbnum): tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[i]})') + #!TODO + # tdSql.query(f'SELECT count(*) from (select distinct tbname from {self.stbname})') + # tdSql.checkEqual(tdSql.queryResult[0][0],self.tbnum) tdSql.query(f'select count(tbname) from {self.stbname}') tdSql.checkRows(0) tdSql.execute('flush database db') tdSql.query(f'select count(tbname) from {self.stbname}') tdSql.checkRows(0) + #!TODO + # tdSql.query(f'SELECT count(*) from (select distinct tbname from {self.stbname})') + # tdSql.checkEqual(tdSql.queryResult[0][0],self.tbnum) for i in range(self.tbnum): - for j in self.values_list: - tdSql.execute(f'insert into {self.stbname}_{i} values({j})') - tdSql.query(f'select count(tbname) from {self.stbname}') - tdSql.checkRows(0) + self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum) + self.count_query_stb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) tdSql.execute('flush database db') - tdSql.query(f'select count(tbname) from {self.stbname}') - tdSql.checkRows(0) - + self.count_query_stb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) + self.count_query_ctb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) + tdSql.execute('drop database db') def run(self): self.check_stb() - # tdSql.prepare() - - # tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, - # col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') - # tdSql.execute("create table stb_1 using stb tags('beijing')") - # tdSql.execute("create table stb_2 using stb tags('shanghai')") - - # tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, - # col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') - - # for i in range(self.rowNum): - # tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - # tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - - # for i in range(self.rowNum): - # tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" - # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - - # tdSql.query("select count(*) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(*) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(ts) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(ts) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col1) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col1) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col2) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col2) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col3) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col3) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col4) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col4) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col5) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col5) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col6) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col6) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col7) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col7) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col8) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col8) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col9) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col9) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col11) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col11) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col12) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col12) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col13) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col13) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col14) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col14) from db.stb") - # tdSql.checkData(0,0,20) - - - - # tdSql.query("select count(ts) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(ts) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col1) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col1) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col2) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col2) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col3) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col3) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col4) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col4) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col5) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col5) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col6) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col6) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col7) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col7) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col8) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col8) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col9) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col9) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col11) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col11) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col12) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col12) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col13) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col13) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col14) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col14) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col1) from stb_1 group by col7") - # tdSql.checkRows(2) - - # tdSql.execute("insert into stb_1 values(now,null,null,null,null,null,null,null,null,null,null,null,null,null)") - # tdSql.query("select count(col1) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col1),count(ts) from stb_1") - # tdSql.checkData(0,0,10) - # tdSql.checkData(0,1,11) - - # tdSql.query("select count(col1) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.query("select count(col1),count(ts) from db.stb_1") - # tdSql.checkData(0,0,10) - # tdSql.checkData(0,1,11) - - # tdSql.query("select count(col1) from stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col1),count(ts) from stb") - # tdSql.checkData(0,0,20) - # tdSql.checkData(0,1,21) - - # tdSql.query("select count(col1) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.query("select count(col1),count(ts) from db.stb") - # tdSql.checkData(0,0,20) - # tdSql.checkData(0,1,21) - # tdSql.query("select count(col1) from stb_1 group by col7") - # tdSql.checkRows(3) - # tdSql.query("select count(col1) from stb_2 group by col7") - # tdSql.checkRows(2) - # tdSql.query("select count(col1) from stb group by col7") - # tdSql.checkRows(3) - - - - + self.check_ntb() def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) From 62041beb97221a21dd8d3578ab40bf90634608e0 Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Wed, 13 Jul 2022 11:20:15 +0800 Subject: [PATCH 24/92] add test case info ci --- tests/system-test/fulltest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 269f83a139..9d153caa14 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -11,7 +11,7 @@ python3 ./test.py -f 0-others/udfTest.py python3 ./test.py -f 0-others/udf_create.py python3 ./test.py -f 0-others/udf_restart_taosd.py python3 ./test.py -f 0-others/cachelast.py - +python3 ./test.py -f 0-others/sysinfo.py python3 ./test.py -f 0-others/user_control.py python3 ./test.py -f 0-others/fsync.py From 2ddd1ba7d3685095e6c15390823b19c4b953451c Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Wed, 13 Jul 2022 11:31:20 +0800 Subject: [PATCH 25/92] update --- tests/system-test/2-query/count.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index fef5a38e8f..c83ff43c51 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -108,6 +108,7 @@ class TDTestCase: for i in range(self.tbnum): self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum) self.count_query_stb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) + self.count_query_ctb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) tdSql.execute('flush database db') self.count_query_stb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) self.count_query_ctb(self.column_dict,self.tag_dict,self.stbname,self.tbnum,self.rowNum) From 7891ff0f03e2e7cecd9d1615e53676d844853866 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Jul 2022 11:31:28 +0800 Subject: [PATCH 26/92] fix: fix stop query issue --- source/client/src/clientEnv.c | 2 +- source/client/src/clientImpl.c | 2 +- source/util/src/tlockfree.c | 2 +- source/util/src/tsched.c | 18 +++++----- tests/script/api/stopquery.c | 63 ++++++++++++++++++++++++++++++---- 5 files changed, 70 insertions(+), 17 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 6805e4d501..2173df5ead 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -42,7 +42,7 @@ volatile int32_t tscInitRes = 0; void initTscQhandle() { // init handle - tscQhandle = taosInitScheduler(4096, 5, "tsc"); + tscQhandle = taosInitScheduler(4096, 5, "tscQ"); } void cleanupTscQhandle() { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 25ba63fd34..df1268858a 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -153,7 +153,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, *pRequest = createRequest(connId, TSDB_SQL_SELECT); if (*pRequest == NULL) { tscError("failed to malloc sqlObj, %s", sql); - return TSDB_CODE_TSC_OUT_OF_MEMORY; + return terrno; } (*pRequest)->sqlstr = taosMemoryMalloc(sqlLen + 1); diff --git a/source/util/src/tlockfree.c b/source/util/src/tlockfree.c index 69ab6c1a52..6f7b6f6901 100644 --- a/source/util/src/tlockfree.c +++ b/source/util/src/tlockfree.c @@ -44,7 +44,7 @@ void taosWLockLatch(SRWLatch *pLatch) { nLoops = 0; while (1) { oLatch = atomic_load_32(pLatch); - if (0 == oLatch) break; + if (oLatch == TD_RWLATCH_WRITE_FLAG) break; nLoops++; if (nLoops > 1000) { sched_yield(); diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 691a0d34d4..9abce966f5 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -129,7 +129,7 @@ void *taosProcessSchedQueue(void *scheduler) { while (1) { if ((ret = tsem_wait(&pSched->fullSem)) != 0) { uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } if (pSched->stop) { break; @@ -137,7 +137,7 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } msg = pSched->queue[pSched->fullSlot]; @@ -146,12 +146,12 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } if ((ret = tsem_post(&pSched->emptySem)) != 0) { uFatal("post %s emptySem failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } if (msg.fp) @@ -174,12 +174,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = tsem_wait(&pSched->emptySem)) != 0) { uFatal("wait %s emptySem failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } pSched->queue[pSched->emptySlot] = *pMsg; @@ -187,12 +187,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - exit(ret); + ASSERT(0); } if ((ret = tsem_post(&pSched->fullSem)) != 0) { 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; if (pSched == NULL) return; + uDebug("start to cleanup %s schedQsueue", pSched->label); + pSched->stop = true; for (int32_t i = 0; i < pSched->numOfThreads; ++i) { if (taosCheckPthreadValid(pSched->qthread[i])) { diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index a42e9e2d44..92baf43d85 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -85,10 +85,12 @@ static void sqExecSQLE(TAOS *taos, char *command) { 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) { - fprintf(stderr, "%s error: %s\n", prefix, errMsg); - sleep(10000); + sqError(prefix, errMsg); exit(1); } @@ -208,7 +210,9 @@ void sqAsyncQueryCb(void *param, TAOS_RES *pRes, int code) { *qParam->end = 1; } } else { - sqExit("select", taos_errstr(pRes)); + sqError("select", taos_errstr(pRes)); + *qParam->end = 1; + taos_free_result(pRes); } } @@ -463,8 +467,6 @@ void *closeThreadFp(void *arg) { } } - - void *killThreadFp(void *arg) { SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; while (true) { @@ -477,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) { @@ -607,9 +622,40 @@ int sqConKillAsyncQuery(bool fetch) { 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*)¶m); + pthread_create(&cid, NULL, cleanupThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + 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*)¶m); + pthread_create(&cid, NULL, cleanupThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + CASE_LEAVE(); +} + void sqRunAllCase(void) { +#if 0 sqStopSyncQuery(false); sqStopSyncQuery(true); sqStopAsyncQuery(false); @@ -638,11 +684,16 @@ void sqRunAllCase(void) { sqConKillSyncQuery(false); sqConKillSyncQuery(true); -#if 0 sqConKillAsyncQuery(false); sqConKillAsyncQuery(true); #endif + sqConCleanupSyncQuery(false); + sqConCleanupSyncQuery(true); + sqConCleanupAsyncQuery(false); + sqConCleanupAsyncQuery(true); + + int32_t l = 5; while (l) { printf("%d\n", l--); From 0857ab35319c5aa7e53338be2be58fdf4123afd6 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 11:39:32 +0800 Subject: [PATCH 27/92] fix:core dump if consumer multi vgroup message with sequence:create/alter/delete/create or create/delete/create --- source/client/src/tmq.c | 15 ++++++++++----- source/dnode/mnode/impl/src/mndStb.c | 12 ++++++++++-- source/libs/parser/src/parTranslater.c | 3 +++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index c5cf6eecdf..9d4eeb3233 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2397,7 +2397,7 @@ void tmq_free_json_meta(char* jsonMeta){ taosMemoryFreeClear(jsonMeta); } -static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ +static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen, bool isCreate){ SVCreateStbReq req = {0}; SDecoder coder; SMCreateStbReq pReq = {0}; @@ -2436,8 +2436,13 @@ static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ strcpy(field.name, pSchema->name); taosArrayPush(pReq.pTags, &field); } - pReq.colVer = req.schemaRow.version; - pReq.tagVer = req.schemaTag.version; + if(isCreate){ + pReq.colVer = 1; + pReq.tagVer = 1; + }else{ + pReq.colVer = req.schemaRow.version; + pReq.tagVer = req.schemaTag.version; + } pReq.numOfColumns = req.schemaRow.nCols; pReq.numOfTags = req.schemaTag.nCols; pReq.commentLen = -1; @@ -2871,9 +2876,9 @@ int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta){ } if(raw_meta->raw_meta_type == TDMT_VND_CREATE_STB) { - return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); + return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len, true); }else if(raw_meta->raw_meta_type == TDMT_VND_ALTER_STB){ - return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); + return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len, false); }else if(raw_meta->raw_meta_type == TDMT_VND_DROP_STB){ return taosDropStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); }else if(raw_meta->raw_meta_type == TDMT_VND_CREATE_TABLE){ diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 16143619c1..e170a2916f 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -710,8 +710,8 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pDst->updateTime = pDst->createdTime; pDst->uid = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); pDst->dbUid = pDb->uid; - pDst->tagVer = (pCreate->source != TD_REQ_FROM_APP) ? pCreate->tagVer : 1; - pDst->colVer = (pCreate->source != TD_REQ_FROM_APP) ? pCreate->colVer : 1; + pDst->tagVer = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->tagVer : 1; + pDst->colVer = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->colVer : 1; pDst->smaVer = 1; pDst->nextColId = 1; pDst->maxdelay[0] = pCreate->delay1; @@ -981,6 +981,14 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } } else if (terrno != TSDB_CODE_MND_STB_NOT_EXIST) { goto _OVER; + } else if (createReq.source == TD_REQ_FROM_TAOX && (createReq.tagVer != 1 || createReq.colVer != 1)){ + mInfo("stb:%s, alter table does not need to be done, because table is deleted", createReq.name); + code = 0; + goto _OVER; + } else if (createReq.source == TD_REQ_FROM_TAOX && (createReq.tagVer == 1 || createReq.colVer == 1)){ //metaSaveToSkmDb does not delete pMeta->pSkmDb, if receivet tmq message is: create stable1 then delete stable1 then create stable1 + mInfo("stb:%s, create table from taosx", createReq.name); + createReq.tagVer++; + createReq.colVer++; } pDb = mndAcquireDbByStb(pMnode, createReq.name); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ffacafb504..d78e7d1ba2 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3685,6 +3685,9 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->delay2 = pStmt->pOptions->maxDelay2; pReq->watermark1 = pStmt->pOptions->watermark1; pReq->watermark2 = pStmt->pOptions->watermark2; + pReq->colVer = 1; + pReq->tagVer = 1; + pReq->source = TD_REQ_FROM_APP; columnDefNodeToField(pStmt->pCols, &pReq->pColumns); columnDefNodeToField(pStmt->pTags, &pReq->pTags); pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); From 65e653835209dd7e0cbaeb8ada6590586d5e1c57 Mon Sep 17 00:00:00 2001 From: "slzhou@taodata.com" Date: Wed, 13 Jul 2022 13:07:10 +0800 Subject: [PATCH 28/92] fix: optimize the scan only when interval window --- source/libs/planner/src/planOptimizer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 1548ab0ee3..45f947e128 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -107,12 +107,15 @@ static bool scanPathOptMayBeOptimized(SLogicNode* pNode) { QUERY_NODE_LOGIC_PLAN_PARTITION != nodeType(pNode->pParent))) { return false; } - if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent) || + if ((QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent) && WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType) || (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode->pParent) && pNode->pParent->pParent && - QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent->pParent))) { + QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent->pParent) && WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType)) { return true; } - return !scanPathOptHaveNormalCol(((SAggLogicNode*)pNode->pParent)->pGroupKeys); + if (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode->pParent)) { + return !scanPathOptHaveNormalCol(((SAggLogicNode*)pNode->pParent)->pGroupKeys); + } + return false; } static SNodeList* scanPathOptGetAllFuncs(SLogicNode* pNode) { From 037ea1519c3e1fe14b32ab9ba55cd760a70ba631 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 13:42:55 +0800 Subject: [PATCH 29/92] fix:core dump if consumer multi vgroup message with sequence:create/alter/delete/create or create/delete/create --- examples/c/tmq.c | 17 +++++++++++++++-- source/client/src/tmq.c | 16 ++++++---------- source/dnode/mnode/impl/src/mndStb.c | 8 ++------ source/dnode/vnode/src/meta/metaTable.c | 5 +++++ 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index c114237353..24c415b2fc 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -96,8 +96,7 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = - taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 nchar(8), t4 bool)"); + pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 nchar(8), t4 bool)"); if (taos_errno(pRes) != 0) { printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); return -1; @@ -265,6 +264,20 @@ int32_t init_env() { } taos_free_result(pRes); + pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 nchar(8), t4 bool)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop table st1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + return 0; } diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 9d4eeb3233..ed9efdf3da 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2397,7 +2397,7 @@ void tmq_free_json_meta(char* jsonMeta){ taosMemoryFreeClear(jsonMeta); } -static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen, bool isCreate){ +static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen){ SVCreateStbReq req = {0}; SDecoder coder; SMCreateStbReq pReq = {0}; @@ -2436,13 +2436,9 @@ static int32_t taosCreateStb(TAOS *taos, void *meta, int32_t metaLen, bool isCre strcpy(field.name, pSchema->name); taosArrayPush(pReq.pTags, &field); } - if(isCreate){ - pReq.colVer = 1; - pReq.tagVer = 1; - }else{ - pReq.colVer = req.schemaRow.version; - pReq.tagVer = req.schemaTag.version; - } + + pReq.colVer = req.schemaRow.version; + pReq.tagVer = req.schemaTag.version; pReq.numOfColumns = req.schemaRow.nCols; pReq.numOfTags = req.schemaTag.nCols; pReq.commentLen = -1; @@ -2876,9 +2872,9 @@ int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta){ } if(raw_meta->raw_meta_type == TDMT_VND_CREATE_STB) { - return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len, true); + return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); }else if(raw_meta->raw_meta_type == TDMT_VND_ALTER_STB){ - return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len, false); + return taosCreateStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); }else if(raw_meta->raw_meta_type == TDMT_VND_DROP_STB){ return taosDropStb(taos, raw_meta->raw_meta, raw_meta->raw_meta_len); }else if(raw_meta->raw_meta_type == TDMT_VND_CREATE_TABLE){ diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index e170a2916f..51f550ad92 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -710,8 +710,8 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pDst->updateTime = pDst->createdTime; pDst->uid = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); pDst->dbUid = pDb->uid; - pDst->tagVer = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->tagVer : 1; - pDst->colVer = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->colVer : 1; + pDst->tagVer = 1; + pDst->colVer = 1; pDst->smaVer = 1; pDst->nextColId = 1; pDst->maxdelay[0] = pCreate->delay1; @@ -985,10 +985,6 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { mInfo("stb:%s, alter table does not need to be done, because table is deleted", createReq.name); code = 0; goto _OVER; - } else if (createReq.source == TD_REQ_FROM_TAOX && (createReq.tagVer == 1 || createReq.colVer == 1)){ //metaSaveToSkmDb does not delete pMeta->pSkmDb, if receivet tmq message is: create stable1 then delete stable1 then create stable1 - mInfo("stb:%s, create table from taosx", createReq.name); - createReq.tagVer++; - createReq.colVer++; } pDb = mndAcquireDbByStb(pMnode, createReq.name); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index daf7ccb26a..29c10c40c2 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -1125,6 +1125,11 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) { skmDbKey.uid = pME->uid; skmDbKey.sver = pSW->version; + // if receive tmq meta message is: create stable1 then delete stable1 then create stable1 with multi vgroups + if (tdbTbGet(pMeta->pSkmDb, &skmDbKey, sizeof(skmDbKey), NULL, NULL) == 0) { + return rcode; + } + // encode schema int32_t ret = 0; tEncodeSize(tEncodeSSchemaWrapper, pSW, vLen, ret); From 480de34a0ed41f002fa7efee95c94ab6a6f4c055 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 14:13:12 +0800 Subject: [PATCH 30/92] enh: support alter debugflag in dnode --- source/common/src/tglobal.c | 34 +++++++++++++++ source/dnode/mnode/impl/src/mndDnode.c | 58 ++++++++++++++++++++------ source/libs/sync/src/syncMain.c | 4 +- 3 files changed, 81 insertions(+), 15 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 24bf4e5c2d..974146302c 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1117,10 +1117,44 @@ void taosCfgDynamicOptions(const char *option, const char *value) { if (strncasecmp(option, "debugFlag", 9) == 0) { int32_t flag = atoi(value); taosSetAllDebugFlag(flag); + return; } if (strcasecmp(option, "resetlog") == 0) { taosResetLog(); cfgDumpCfg(tsCfg, 0, false); + return; } + + if (strcasecmp(option, "monitor") == 0) { + int32_t monitor = atoi(value); + uInfo("monitor set from %d to %d", tsEnableMonitor, monitor); + tsEnableMonitor = monitor; + return; + } + + const char *options[] = { + "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", + "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tmrDebugFlag", + "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", + }; + int32_t *optionVars[] = { + &dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag, + &tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tmrDebugFlag, + &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, + }; + + int32_t optionSize = tListLen(options); + for (int32_t d = 0; d < optionSize; ++d) { + const char *optName = options[d]; + int32_t optLen = strlen(optName); + if (strncasecmp(option, optName, optLen) != 0) continue; + + int32_t flag = atoi(value); + uInfo("%s set from %d to %d", optName, *optionVars[d], flag); + *optionVars[d] = flag; + return; + } + + uError("failed to cfg dynamic option:%s value:%s", option, value); } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 9ce108b789..3e5d378bb1 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -781,7 +781,13 @@ _OVER: } static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; + SMnode *pMnode = pReq->info.node; + const char *options[] = { + "debugFlag", "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", + "tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", + "tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", + }; + int32_t optionSize = tListLen(options); SMCfgDnodeReq cfgReq = {0}; if (tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) { @@ -802,27 +808,52 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { SEpSet epSet = mndGetDnodeEpset(pDnode); mndReleaseDnode(pMnode, pDnode); + SDCfgDnodeReq dcfgReq = {0}; - if (strncasecmp(cfgReq.config, "debugFlag", 9) == 0) { + if (strcasecmp(cfgReq.config, "resetlog") == 0) { + strcpy(dcfgReq.config, "resetlog"); + } else if (strncasecmp(cfgReq.config, "monitor", 7) == 0) { const char *value = cfgReq.value; int32_t flag = atoi(value); if (flag <= 0) { - flag = atoi(cfgReq.config + 10); + flag = atoi(cfgReq.config + 8); } - if (flag <= 0 || flag > 255) { - mError("dnode:%d, failed to config debugFlag since value:%d", cfgReq.dnodeId, flag); + if (flag < 0 || flag > 2) { + mError("dnode:%d, failed to config monitor since value:%d", cfgReq.dnodeId, flag); terrno = TSDB_CODE_INVALID_CFG; return -1; } - strcpy(dcfgReq.config, "debugFlag"); + strcpy(dcfgReq.config, "monitor"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); - } else if (strcasecmp(cfgReq.config, "resetlog") == 0) { - strcpy(dcfgReq.config, "resetlog"); } else { - terrno = TSDB_CODE_INVALID_CFG; - mError("dnode:%d, failed to config since %s", cfgReq.dnodeId, terrstr()); - return -1; + bool findOpt = false; + for (int32_t d = 0; d < optionSize; ++d) { + const char *optName = options[d]; + int32_t optLen = strlen(optName); + if (strncasecmp(cfgReq.config, optName, optLen) != 0) continue; + + const char *value = cfgReq.value; + int32_t flag = atoi(value); + if (flag <= 0) { + flag = atoi(cfgReq.config + optLen + 1); + } + if (flag <= 0 || flag > 255) { + mError("dnode:%d, failed to config %s since value:%d", cfgReq.dnodeId, optName, flag); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + + tstrncpy(dcfgReq.config, optName, optLen + 1); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); + findOpt = true; + } + + if (!findOpt) { + terrno = TSDB_CODE_INVALID_CFG; + mError("dnode:%d, failed to config since %s", cfgReq.dnodeId, terrstr()); + return -1; + } } int32_t bufLen = tSerializeSDCfgDnodeReq(NULL, 0, &dcfgReq); @@ -831,13 +862,14 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { if (pBuf == NULL) return -1; tSerializeSDCfgDnodeReq(pBuf, bufLen, &dcfgReq); - mDebug("dnode:%d, send config req to dnode, app:%p", cfgReq.dnodeId, pReq->info.ahandle); + mInfo("dnode:%d, send config req to dnode, app:%p config:%s value:%s", cfgReq.dnodeId, pReq->info.ahandle, + dcfgReq.config, dcfgReq.value); SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE, .pCont = pBuf, .contLen = bufLen}; return tmsgSendReq(&epSet, &rpcMsg); } static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp) { - mDebug("config rsp from dnode, app:%p", pRsp->info.ahandle); + mInfo("config rsp from dnode, app:%p", pRsp->info.ahandle); return 0; } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index abc0f53611..bab64b6f11 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -293,7 +293,7 @@ int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader) { int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) { if (pSyncNode->peersNum == 0) { - sError("only one replica, cannot leader transfer"); + sDebug("only one replica, cannot leader transfer"); terrno = TSDB_CODE_SYN_ONE_REPLICA; return -1; } @@ -307,7 +307,7 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) { int32_t ret = 0; if (pSyncNode->replicaNum == 1) { - sError("only one replica, cannot leader transfer"); + sDebug("only one replica, cannot leader transfer"); terrno = TSDB_CODE_SYN_ONE_REPLICA; return -1; } From 649cf7e55dbe7182e914d377c6889f3ef49e7e81 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 14:21:44 +0800 Subject: [PATCH 31/92] fix(query): support last_row(tags) for super table query. --- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 6 ++-- source/libs/executor/inc/executorimpl.h | 3 ++ source/libs/executor/src/cachescanoperator.c | 31 ++++++++++++++------ source/libs/executor/src/scanoperator.c | 4 --- source/libs/function/src/builtinsimpl.c | 13 ++++---- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 9f32964fa9..f0a6b6505d 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -138,7 +138,7 @@ void *tsdbGetIdx(SMeta *pMeta); void *tsdbGetIvtIdx(SMeta *pMeta); 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 tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 5c09c7663f..5855468f31 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -104,7 +104,7 @@ int32_t tsdbLastrowReaderClose(void* pReader) { 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) { return TSDB_CODE_INVALID_PARA; } @@ -141,14 +141,15 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t // appended or not. if (internalResult) { pResBlock->info.rows -= 1; + taosArrayClear(pTableUidList); } saveOneRow(pRow, pResBlock, pr, slotIds); + taosArrayPush(pTableUidList, &pKeyInfo->uid); internalResult = true; lastKey = pRow->ts; } - // taosMemoryFree(pRow); tsdbCacheRelease(lruCache, h); } } else if (pr->type == LASTROW_RETRIEVE_TYPE_ALL) { @@ -171,6 +172,7 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t // tsdbCacheLastArray2Row(pLast, &pRow, pr->pSchema); saveOneRow(pRow, pResBlock, pr, slotIds); + taosArrayPush(pTableUidList, &pKeyInfo->uid); // taosMemoryFree(pRow); tsdbCacheRelease(lruCache, h); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index aab2f51421..3da8e298a6 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -319,6 +319,7 @@ typedef struct SLastrowScanInfo { void *pLastrowReader; SArray *pColMatchInfo; int32_t *pSlotIds; + SExprSupp pseudoExprSup; } SLastrowScanInfo; typedef enum EStreamScanMode { @@ -787,6 +788,8 @@ int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaul void doSetOperatorCompleted(SOperatorInfo* pOperator); 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 destroyBasicOperatorInfo(void* param, int32_t numOfOutput); diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 7b1351a024..0f6817cd6b 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -45,20 +45,20 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead int32_t numOfCols = 0; pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->pScanCols, pScanNode->node.pOutputDataBlockDesc, &numOfCols, 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); if (code != TSDB_CODE_SUCCESS) { 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); - 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->operatorType = QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN; @@ -100,7 +100,20 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) { // check if it is a group by tbname if (size == taosArrayGetSize(pInfo->pTableList)) { 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; } else { // todo fetch the result for each group diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 64c740decf..66703502eb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -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, 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); bool processBlockWithProbability(const SSampleExecInfo* pInfo) { @@ -320,8 +318,6 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int int32_t dstSlotId = pExpr->base.resSchema.slotId; SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId); - - colInfoDataEnsureCapacity(pColInfoData, pBlock->info.rows); colInfoDataCleanup(pColInfoData, pBlock->info.rows); int32_t functionId = pExpr->pExpr->_function.functionId; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index ccf28bfd78..c1143020f0 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -80,11 +80,12 @@ typedef struct STopBotRes { } STopBotRes; typedef struct SFirstLastRes { - bool hasResult; + bool hasResult; // used for last_row function only, isNullRes in SResultRowEntry can not be passed to downstream.So, // this attribute is required - bool isNull; + bool isNull; int32_t bytes; + int64_t ts; char buf[]; } SFirstLastRes; @@ -2951,6 +2952,7 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); colDataAppend(pCol, pBlock->info.rows, pRes->buf, pRes->isNull||pResInfo->isNullRes); + // handle selectivity STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); @@ -5988,7 +5990,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; - int32_t type = pInputCol->info.type; + int32_t type = pInputCol->info.type; int32_t bytes = pInputCol->info.bytes; pInfo->bytes = bytes; @@ -5999,7 +6001,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { char* data = colDataGetData(pInputCol, 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)) { pInfo->isNull = true; @@ -6012,8 +6014,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { memcpy(pInfo->buf, data, bytes); } - *(TSKEY*)(pInfo->buf + bytes) = cts; - + pInfo->ts = cts; pInfo->hasResult = true; pResInfo->numOfRes = 1; From 5ba8dbfba45f279fe843e6dd47029b8e6482731e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 14:32:52 +0800 Subject: [PATCH 32/92] enh: support alter debugflag in dnode --- tests/script/general/alter/dnode.sim | 67 ------------------- tests/script/jenkins/basic.txt | 5 ++ .../alter/cached_schema_after_alter.sim | 0 tests/script/tsim/alter/dnode.sim | 62 +++++++++++++++++ .../script/{general => tsim}/alter/table.sim | 2 - 5 files changed, 67 insertions(+), 69 deletions(-) delete mode 100644 tests/script/general/alter/dnode.sim rename tests/script/{general => tsim}/alter/cached_schema_after_alter.sim (100%) create mode 100644 tests/script/tsim/alter/dnode.sim rename tests/script/{general => tsim}/alter/table.sim (99%) diff --git a/tests/script/general/alter/dnode.sim b/tests/script/general/alter/dnode.sim deleted file mode 100644 index 64e8a17de0..0000000000 --- a/tests/script/general/alter/dnode.sim +++ /dev/null @@ -1,67 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start -sql connect - -print ======== step1 -sql alter dnode 1 resetlog -sql alter dnode 1 monitor 1 - -sleep 3000 -sql select * from log.dn -if $rows <= 0 then - return -1 -endi - -print ======== step2 - -sql alter dnode 1 resetquerycache -sql alter dnode 1 debugFlag 135 -sql alter dnode 1 debugFlag 131 -sql alter dnode 1 monitor 0 -sql alter dnode 1 debugFlag 135 -sql alter dnode 1 monDebugFlag 135 -sql alter dnode 1 vDebugFlag 135 -sql alter dnode 1 mDebugFlag 135 -sql alter dnode 1 cDebugFlag 135 -sql alter dnode 1 httpDebugFlag 135 -sql alter dnode 1 qDebugflag 135 -sql alter dnode 1 sdbDebugFlag 135 -sql alter dnode 1 uDebugFlag 135 -sql alter dnode 1 tsdbDebugFlag 135 -sql alter dnode 1 sDebugflag 135 -sql alter dnode 1 rpcDebugFlag 135 -sql alter dnode 1 dDebugFlag 135 -sql alter dnode 1 mqttDebugFlag 135 -sql alter dnode 1 wDebugFlag 135 -sql alter dnode 1 tmrDebugFlag 135 -sql_error alter dnode 2 wDebugFlag 135 -sql_error alter dnode 2 tmrDebugFlag 135 - -print ======== step3 -sql_error alter $hostname1 debugFlag 135 -sql_error alter $hostname1 monDebugFlag 135 -sql_error alter $hostname1 vDebugFlag 135 -sql_error alter $hostname1 mDebugFlag 135 -sql_error alter dnode $hostname2 debugFlag 135 -sql_error alter dnode $hostname2 monDebugFlag 135 -sql_error alter dnode $hostname2 vDebugFlag 135 -sql_error alter dnode $hostname2 mDebugFlag 135 -sql alter dnode $hostname1 debugFlag 135 -sql alter dnode $hostname1 monDebugFlag 135 -sql alter dnode $hostname1 vDebugFlag 135 -sql alter dnode $hostname1 tmrDebugFlag 131 - -print ======== step4 -sql_error sql alter dnode 1 balance 0 -sql_error sql alter dnode 1 balance vnode:1-dnode:1 -sql_error sql alter dnode 1 balance "vnode:1" -sql_error sql alter dnode 1 balance "vnode:1-dnode:1" -sql_error sql alter dnode 1 balance "dnode:1-vnode:1" -sql_error sql alter dnode 1 balance "dnode:1-" -sql_error sql alter dnode 1 balance "vnode:2-dnod" -sql alter dnode 1 balance "vnode:2-dnode:1" -x step4 -step4: - -print ======= over -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 50d4c04a93..13a28aa527 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,6 +1,11 @@ #======================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 ./test.sh -f tsim/user/basic.sim ./test.sh -f tsim/user/password.sim diff --git a/tests/script/general/alter/cached_schema_after_alter.sim b/tests/script/tsim/alter/cached_schema_after_alter.sim similarity index 100% rename from tests/script/general/alter/cached_schema_after_alter.sim rename to tests/script/tsim/alter/cached_schema_after_alter.sim diff --git a/tests/script/tsim/alter/dnode.sim b/tests/script/tsim/alter/dnode.sim new file mode 100644 index 0000000000..35620f17aa --- /dev/null +++ b/tests/script/tsim/alter/dnode.sim @@ -0,0 +1,62 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step1 +sql alter dnode 1 'resetlog' +sql alter dnode 1 'monitor' '1' +sql alter dnode 1 'monitor' '0' +sql alter dnode 1 'monitor 1' +sql alter dnode 1 'monitor 0' + +print ======== step2 +sql_error alter dnode 1 'resetquerycache' +sql alter dnode 1 'debugFlag 135' +sql alter dnode 1 'dDebugFlag 131' +sql alter dnode 1 'vDebugFlag 131' +sql alter dnode 1 'mDebugFlag 131' +sql alter dnode 1 'wDebugFlag 131' +sql alter dnode 1 'sDebugFlag 131' +sql alter dnode 1 'tsdbDebugFlag 131' +sql alter dnode 1 'tqDebugFlag 131' +sql alter dnode 1 'fsDebugFlag 131' +sql alter dnode 1 'udfDebugFlag 131' +sql alter dnode 1 'smaDebugFlag 131' +sql alter dnode 1 'idxDebugFlag 131' +sql alter dnode 1 'tmrDebugFlag 131' +sql alter dnode 1 'uDebugFlag 131' +sql alter dnode 1 'smaDebugFlag 131' +sql alter dnode 1 'rpcDebugFlag 131' +sql alter dnode 1 'qDebugFlag 131' + +sql_error alter dnode 2 'wDebugFlag 135' +sql_error alter dnode 2 'tmrDebugFlag 135' + +print ======== step3 +sql_error alter $hostname1 debugFlag 135 +sql_error alter $hostname1 monDebugFlag 135 +sql_error alter $hostname1 vDebugFlag 135 +sql_error alter $hostname1 mDebugFlag 135 +sql_error alter dnode $hostname2 debugFlag 135 +sql_error alter dnode $hostname2 monDebugFlag 135 +sql_error alter dnode $hostname2 vDebugFlag 135 +sql_error alter dnode $hostname2 mDebugFlag 135 +sql_error alter dnode $hostname1 debugFlag 135 +sql_error alter dnode $hostname1 monDebugFlag 135 +sql_error alter dnode $hostname1 vDebugFlag 135 +sql_error alter dnode $hostname1 tmrDebugFlag 131 + +print ======== step4 +sql_error sql alter dnode 1 balance 0 +sql_error sql alter dnode 1 balance vnode:1-dnode:1 +sql_error sql alter dnode 1 balance "vnode:1" +sql_error sql alter dnode 1 balance "vnode:1-dnode:1" +sql_error sql alter dnode 1 balance "dnode:1-vnode:1" +sql_error sql alter dnode 1 balance "dnode:1-" +sql_error sql alter dnode 1 balance "vnode:2-dnod" +sql alter dnode 1 balance "vnode:2-dnode:1" -x step4 +step4: + +print ======= over +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/alter/table.sim b/tests/script/tsim/alter/table.sim similarity index 99% rename from tests/script/general/alter/table.sim rename to tests/script/tsim/alter/table.sim index 9ca2f60bdc..cc995d171f 100644 --- a/tests/script/general/alter/table.sim +++ b/tests/script/tsim/alter/table.sim @@ -315,9 +315,7 @@ endi print ======== step9 print ======== step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql use d1 sql describe tb From 79bbda564ef6e6a26a35457c75fde5c80aa54627 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 14:55:02 +0800 Subject: [PATCH 33/92] test: comment out unstable case --- tests/system-test/fulltest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 269f83a139..ca4850e433 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -148,7 +148,7 @@ python3 ./test.py -f 7-tmq/subscribeDb2.py python3 ./test.py -f 7-tmq/subscribeDb3.py #python3 ./test.py -f 7-tmq/subscribeDb4.py python3 ./test.py -f 7-tmq/subscribeStb.py -python3 ./test.py -f 7-tmq/subscribeStb0.py +#python3 ./test.py -f 7-tmq/subscribeStb0.py python3 ./test.py -f 7-tmq/subscribeStb1.py python3 ./test.py -f 7-tmq/subscribeStb2.py python3 ./test.py -f 7-tmq/subscribeStb3.py From 85d2e6f1be2ee64c48c21078dad0df9bf9f2326b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 15:02:44 +0800 Subject: [PATCH 34/92] test: restore some 2.0 case --- tests/script/general/cache/testSuite.sim | 3 --- tests/script/jenkins/basic.txt | 5 +++++ .../{general => tsim}/cache/new_metrics.sim | 16 ---------------- .../{general => tsim}/cache/restart_metrics.sim | 9 +-------- .../{general => tsim}/cache/restart_table.sim | 9 +-------- 5 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 tests/script/general/cache/testSuite.sim rename tests/script/{general => tsim}/cache/new_metrics.sim (94%) rename tests/script/{general => tsim}/cache/restart_metrics.sim (93%) rename tests/script/{general => tsim}/cache/restart_table.sim (90%) diff --git a/tests/script/general/cache/testSuite.sim b/tests/script/general/cache/testSuite.sim deleted file mode 100644 index f09ece89b6..0000000000 --- a/tests/script/general/cache/testSuite.sim +++ /dev/null @@ -1,3 +0,0 @@ -run general/cache/new_metrics.sim -run general/cache/restart_table.sim -run general/cache/restart_metrics.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 13a28aa527..34e1ef3bdc 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -12,6 +12,11 @@ ./test.sh -f tsim/user/privilege_db.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 + ## ---- db ./test.sh -f tsim/db/alter_option.sim # ./test.sh -f tsim/db/alter_replica_13.sim diff --git a/tests/script/general/cache/new_metrics.sim b/tests/script/tsim/cache/new_metrics.sim similarity index 94% rename from tests/script/general/cache/new_metrics.sim rename to tests/script/tsim/cache/new_metrics.sim index eb9b042483..af7db90070 100644 --- a/tests/script/general/cache/new_metrics.sim +++ b/tests/script/tsim/cache/new_metrics.sim @@ -1,11 +1,6 @@ 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 $i = 0 @@ -38,7 +33,6 @@ while $i < 5 endw print =============== step2 - sql select * from $tb order by ts desc print ===>rows $rows, data $data01 if $rows != 20 then @@ -67,7 +61,6 @@ if $data00 != 100 then endi print =============== step3 - sql show stables if $rows != 1 then return -1 @@ -75,12 +68,8 @@ endi if $data00 != $mt then return -1 endi -if $data04 != 5 then - return -1 -endi print =============== step4 - while $i < 10 $tb = $tbPrefix . $i sql create table $tb using $mt tags( 1 ) @@ -99,7 +88,6 @@ sql reset query cache sleep 1000 print =============== step5 - sql select * from $tb order by ts desc print ===>rows $rows, data $data01 if $rows != 20 then @@ -128,7 +116,6 @@ if $data00 != 200 then endi print =============== step6 - sql show stables if $rows != 1 then return -1 @@ -136,8 +123,5 @@ endi if $data00 != $mt then return -1 endi -if $data04 != 10 then - return -1 -endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/cache/restart_metrics.sim b/tests/script/tsim/cache/restart_metrics.sim similarity index 93% rename from tests/script/general/cache/restart_metrics.sim rename to tests/script/tsim/cache/restart_metrics.sim index a1b2365b2a..e144a49bf7 100644 --- a/tests/script/general/cache/restart_metrics.sim +++ b/tests/script/tsim/cache/restart_metrics.sim @@ -1,14 +1,9 @@ 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 +print ======================== dnode1 start $i = 0 $dbPrefix = ca_rm_db $tbPrefix = ca_rm_tb @@ -49,9 +44,7 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop -sleep 3000 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 =============== step3 diff --git a/tests/script/general/cache/restart_table.sim b/tests/script/tsim/cache/restart_table.sim similarity index 90% rename from tests/script/general/cache/restart_table.sim rename to tests/script/tsim/cache/restart_table.sim index 1f7d982a28..b450f6c654 100644 --- a/tests/script/general/cache/restart_table.sim +++ b/tests/script/tsim/cache/restart_table.sim @@ -1,14 +1,9 @@ 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 +print ======================== dnode1 start $i = 0 $dbPrefix = ca_rt_db $tbPrefix = ca_rt_tb @@ -33,9 +28,7 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop -sleep 3000 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 =============== step3 From 56b1d11beb1f36188681af3c2ea92b07388102fa Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 15:06:27 +0800 Subject: [PATCH 35/92] fix(query): prepare the output buffer before assign daata. --- source/libs/executor/src/executorimpl.c | 2 +- source/libs/executor/src/scanoperator.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 6f4a6b805d..760d7e55c8 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -4334,6 +4334,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo pTaskInfo->code = code; return NULL; } + code = extractTableSchemaInfo(pHandle, pTableScanNode->scan.uid, pTaskInfo); if (code) { pTaskInfo->code = terrno; @@ -4349,7 +4350,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) { return createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo); - } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) { STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode; STimeWindowAggSupp twSup = { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 66703502eb..c7112ab8a6 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1153,10 +1153,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock SOperatorInfo* pOperator = pInfo->pStreamScanOp; SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; + blockDataEnsureCapacity(pInfo->pRes, pBlock->info.rows); + pInfo->pRes->info.rows = pBlock->info.rows; pInfo->pRes->info.uid = pBlock->info.uid; 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)); if (groupIdPre) { @@ -2415,6 +2416,7 @@ int32_t createScanTableListInfo(STableScanPhysiNode* pTableScanNode, SReadHandle qDebug("no table qualified for query, TID:0x%" PRIx64 ", QID:0x%" PRIx64, taskId, queryId); return TSDB_CODE_SUCCESS; } + pTableListInfo->needSortTableByGroupId = pTableScanNode->groupSort; code = generateGroupIdMap(pTableListInfo, pHandle, pTableScanNode->pGroupTags); if (code != TSDB_CODE_SUCCESS) { From 161880224847ba0c71fc043243a0680e1419e833 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 15:07:26 +0800 Subject: [PATCH 36/92] test: restore some 2.0 case --- tests/script/general/column/testSuite.sim | 3 --- tests/script/jenkins/basic.txt | 7 ++++++- tests/script/{general => tsim}/column/commit.sim | 10 ---------- tests/script/{general => tsim}/column/metrics.sim | 10 ---------- tests/script/{general => tsim}/column/table.sim | 9 --------- 5 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 tests/script/general/column/testSuite.sim rename tests/script/{general => tsim}/column/commit.sim (99%) rename tests/script/{general => tsim}/column/metrics.sim (99%) rename tests/script/{general => tsim}/column/table.sim (99%) diff --git a/tests/script/general/column/testSuite.sim b/tests/script/general/column/testSuite.sim deleted file mode 100644 index f60d197e95..0000000000 --- a/tests/script/general/column/testSuite.sim +++ /dev/null @@ -1,3 +0,0 @@ -run general/column/commit.sim -run general/column/metrics.sim -run general/column/table.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 34e1ef3bdc..afe5527380 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -17,7 +17,12 @@ ./test.sh -f tsim/cache/restart_table.sim ./test.sh -f tsim/cache/restart_metrics.sim -## ---- db +# ---- column +./test.sh -f tsim/column/commit.sim +./test.sh -f tsim/column/metrics.sim +./test.sh -f tsim/column/table.sim + +# ---- db ./test.sh -f tsim/db/alter_option.sim # ./test.sh -f tsim/db/alter_replica_13.sim # ./test.sh -f tsim/db/alter_replica_31.sim diff --git a/tests/script/general/column/commit.sim b/tests/script/tsim/column/commit.sim similarity index 99% rename from tests/script/general/column/commit.sim rename to tests/script/tsim/column/commit.sim index 008bec3bf9..43aebb4902 100644 --- a/tests/script/general/column/commit.sim +++ b/tests/script/tsim/column/commit.sim @@ -1,11 +1,6 @@ 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 =============== step1 @@ -25,7 +20,6 @@ if $rows != 1 then endi print =============== step2 - sql insert into d3.t1 values (now -300d,0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ); sql insert into d3.t1 values (now-200d,1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ); sql insert into d3.t1 values (now-150d,2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ); @@ -38,7 +32,6 @@ sql insert into d3.t1 values (now,8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 sql insert into d3.t1 values (now+1d,9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 ); print =============== step3 - sql select * from d3.mt if $rows != 10 then return -1 @@ -89,12 +82,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print =============== step5 - sql select * from d3.mt if $rows != 10 then return -1 diff --git a/tests/script/general/column/metrics.sim b/tests/script/tsim/column/metrics.sim similarity index 99% rename from tests/script/general/column/metrics.sim rename to tests/script/tsim/column/metrics.sim index 580e2320cd..a492f5a2f9 100644 --- a/tests/script/general/column/metrics.sim +++ b/tests/script/tsim/column/metrics.sim @@ -1,11 +1,6 @@ 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 =============== step1 @@ -26,7 +21,6 @@ if $rows != 1 then endi print =============== step2 - sql insert into d2.t1 values (now,0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) sql insert into d2.t1 values (now+1m,1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ) sql insert into d2.t1 values (now+2m,2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ) @@ -58,7 +52,6 @@ sql insert into d2.t2 values (now+8m,8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , sql insert into d2.t2 values (now+9m,9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 ) print =============== step3 - sql select * from d2.mt if $rows != 20 then return -1 @@ -157,12 +150,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print =============== step5 - sql select * from d2.mt if $rows != 20 then return -1 diff --git a/tests/script/general/column/table.sim b/tests/script/tsim/column/table.sim similarity index 99% rename from tests/script/general/column/table.sim rename to tests/script/tsim/column/table.sim index 46d5de1e82..07948ebce3 100644 --- a/tests/script/general/column/table.sim +++ b/tests/script/tsim/column/table.sim @@ -1,11 +1,6 @@ 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 =============== step1 @@ -19,7 +14,6 @@ if $rows != 1 then endi print =============== step2 - sql insert into d1.t1 values (now,0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) sql insert into d1.t1 values (now+1m,1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ) sql insert into d1.t1 values (now+2m,2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ) @@ -36,7 +30,6 @@ sql insert into d1.t1 values (now+8m,8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , sql insert into d1.t1 values (now+9m,9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 ) print ======= step3 - sql select * from d1.t1 print select * from d1.t1 => rows $rows if $rows != 10 then @@ -129,9 +122,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print ============== step5 From 43b5ca1efe1d4c12ee63b203a96a01246eb9ade5 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 13 Jul 2022 15:13:01 +0800 Subject: [PATCH 37/92] feat: support pseudo columns such as _qstart, _qend and _qduration --- examples/c/stream_demo.c | 8 +- include/common/ttokendef.h | 115 +- include/libs/function/functionMgt.h | 11 +- include/libs/nodes/querynodes.h | 2 +- source/libs/executor/src/executorimpl.c | 8 +- source/libs/executor/src/timewindowoperator.c | 6 +- source/libs/function/src/builtins.c | 34 +- source/libs/function/src/functionMgt.c | 4 +- source/libs/nodes/src/nodesUtilFuncs.c | 21 +- source/libs/parser/inc/sql.y | 13 +- source/libs/parser/src/parAstCreater.c | 2 +- source/libs/parser/src/parTokenizer.c | 9 +- source/libs/parser/src/parTranslater.c | 8 +- source/libs/parser/src/parUtil.c | 2 +- source/libs/parser/src/sql.c | 4752 +++++++++-------- source/libs/parser/test/parSelectTest.cpp | 8 +- source/libs/planner/src/planLogicCreater.c | 2 +- source/libs/planner/src/planOptimizer.c | 17 +- source/libs/planner/src/planSpliter.c | 8 +- source/libs/planner/test/planBasicTest.cpp | 6 + source/libs/planner/test/planIntervalTest.cpp | 6 +- source/libs/planner/test/planOptimizeTest.cpp | 2 +- source/libs/planner/test/planOtherTest.cpp | 2 +- tests/pytest/stream/test1.py | 2 +- tests/pytest/stream/test2.py | 8 +- tests/script/tsim/query/interval-offset.sim | 20 +- tests/script/tsim/query/interval.sim | 4 +- tests/script/tsim/query/session.sim | 30 +- tests/script/tsim/query/stddev.sim | 32 +- .../script/tsim/sma/tsmaCreateInsertQuery.sim | 8 +- tests/script/tsim/stream/basic0.sim | 8 +- tests/script/tsim/stream/basic1.sim | 16 +- tests/script/tsim/stream/basic2.sim | 6 +- .../tsim/stream/distributeInterval0.sim | 6 +- .../stream/distributeIntervalRetrive0.sim | 2 +- .../script/tsim/stream/distributeSession0.sim | 2 +- .../script/tsim/stream/ignoreExpiredData.sim | 10 +- tests/script/tsim/stream/partitionby.sim | 6 +- tests/script/tsim/stream/partitionby1.sim | 6 +- tests/script/tsim/stream/schedSnode.sim | 4 +- tests/script/tsim/stream/session0.sim | 18 +- tests/script/tsim/stream/session1.sim | 2 +- tests/script/tsim/stream/state0.sim | 14 +- tests/script/tsim/stream/triggerInterval0.sim | 2 +- tests/script/tsim/stream/triggerSession0.sim | 2 +- tests/script/tsim/stream/windowClose.sim | 2 +- tests/script/tsim/vnode/stable_dnode2.sim | 10 +- .../script/tsim/vnode/stable_dnode2_stop.sim | 4 +- tests/script/tsim/vnode/stable_dnode3.sim | 10 +- .../tsim/vnode/stable_replica3_dnode6.sim | 10 +- .../tsim/vnode/stable_replica3_vnode3.sim | 10 +- 51 files changed, 2681 insertions(+), 2619 deletions(-) diff --git a/examples/c/stream_demo.c b/examples/c/stream_demo.c index 1e9058d628..dd4fbc8d2d 100644 --- a/examples/c/stream_demo.c +++ b/examples/c/stream_demo.c @@ -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 sum(k) from tu1 interval(10m)";*/ /*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/ - pRes = taos_query( - pConn, - "create stream stream1 trigger max_delay 10s into outstb as select _wstartts, sum(k) from st1 partition " - "by tbname session(ts, 10s) "); + pRes = + taos_query(pConn, + "create stream stream1 trigger max_delay 10s into outstb as select _wstart, sum(k) from st1 partition " + "by tbname session(ts, 10s) "); if (taos_errno(pRes) != 0) { printf("failed to create stream stream1, reason:%s\n", taos_errstr(pRes)); return -1; diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 29dd4daa25..e2089f3023 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -213,63 +213,64 @@ #define TK_NK_ARROW 195 #define TK_ROWTS 196 #define TK_TBNAME 197 -#define TK_QSTARTTS 198 -#define TK_QENDTS 199 -#define TK_WSTARTTS 200 -#define TK_WENDTS 201 -#define TK_WDURATION 202 -#define TK_CAST 203 -#define TK_NOW 204 -#define TK_TODAY 205 -#define TK_TIMEZONE 206 -#define TK_CLIENT_VERSION 207 -#define TK_SERVER_VERSION 208 -#define TK_SERVER_STATUS 209 -#define TK_CURRENT_USER 210 -#define TK_COUNT 211 -#define TK_LAST_ROW 212 -#define TK_BETWEEN 213 -#define TK_IS 214 -#define TK_NK_LT 215 -#define TK_NK_GT 216 -#define TK_NK_LE 217 -#define TK_NK_GE 218 -#define TK_NK_NE 219 -#define TK_MATCH 220 -#define TK_NMATCH 221 -#define TK_CONTAINS 222 -#define TK_JOIN 223 -#define TK_INNER 224 -#define TK_SELECT 225 -#define TK_DISTINCT 226 -#define TK_WHERE 227 -#define TK_PARTITION 228 -#define TK_BY 229 -#define TK_SESSION 230 -#define TK_STATE_WINDOW 231 -#define TK_SLIDING 232 -#define TK_FILL 233 -#define TK_VALUE 234 -#define TK_NONE 235 -#define TK_PREV 236 -#define TK_LINEAR 237 -#define TK_NEXT 238 -#define TK_HAVING 239 -#define TK_RANGE 240 -#define TK_EVERY 241 -#define TK_ORDER 242 -#define TK_SLIMIT 243 -#define TK_SOFFSET 244 -#define TK_LIMIT 245 -#define TK_OFFSET 246 -#define TK_ASC 247 -#define TK_NULLS 248 -#define TK_ID 249 -#define TK_NK_BITNOT 250 -#define TK_VALUES 251 -#define TK_IMPORT 252 -#define TK_NK_SEMI 253 -#define TK_FILE 254 +#define TK_QSTART 198 +#define TK_QEND 199 +#define TK_QDURATION 200 +#define TK_WSTART 201 +#define TK_WEND 202 +#define TK_WDURATION 203 +#define TK_CAST 204 +#define TK_NOW 205 +#define TK_TODAY 206 +#define TK_TIMEZONE 207 +#define TK_CLIENT_VERSION 208 +#define TK_SERVER_VERSION 209 +#define TK_SERVER_STATUS 210 +#define TK_CURRENT_USER 211 +#define TK_COUNT 212 +#define TK_LAST_ROW 213 +#define TK_BETWEEN 214 +#define TK_IS 215 +#define TK_NK_LT 216 +#define TK_NK_GT 217 +#define TK_NK_LE 218 +#define TK_NK_GE 219 +#define TK_NK_NE 220 +#define TK_MATCH 221 +#define TK_NMATCH 222 +#define TK_CONTAINS 223 +#define TK_JOIN 224 +#define TK_INNER 225 +#define TK_SELECT 226 +#define TK_DISTINCT 227 +#define TK_WHERE 228 +#define TK_PARTITION 229 +#define TK_BY 230 +#define TK_SESSION 231 +#define TK_STATE_WINDOW 232 +#define TK_SLIDING 233 +#define TK_FILL 234 +#define TK_VALUE 235 +#define TK_NONE 236 +#define TK_PREV 237 +#define TK_LINEAR 238 +#define TK_NEXT 239 +#define TK_HAVING 240 +#define TK_RANGE 241 +#define TK_EVERY 242 +#define TK_ORDER 243 +#define TK_SLIMIT 244 +#define TK_SOFFSET 245 +#define TK_LIMIT 246 +#define TK_OFFSET 247 +#define TK_ASC 248 +#define TK_NULLS 249 +#define TK_ID 250 +#define TK_NK_BITNOT 251 +#define TK_VALUES 252 +#define TK_IMPORT 253 +#define TK_NK_SEMI 254 +#define TK_FILE 255 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 1012161d0e..6af7fca10f 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -34,7 +34,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_ELAPSED, FUNCTION_TYPE_IRATE, FUNCTION_TYPE_LAST_ROW, - FUNCTION_TYPE_LAST_ROWT, //TODO: removed + FUNCTION_TYPE_LAST_ROWT, // TODO: removed FUNCTION_TYPE_MAX, FUNCTION_TYPE_MIN, FUNCTION_TYPE_MODE, @@ -114,10 +114,11 @@ typedef enum EFunctionType { // pseudo column function FUNCTION_TYPE_ROWTS = 3500, FUNCTION_TYPE_TBNAME, - FUNCTION_TYPE_QSTARTTS, - FUNCTION_TYPE_QENDTS, - FUNCTION_TYPE_WSTARTTS, - FUNCTION_TYPE_WENDTS, + FUNCTION_TYPE_QSTART, + FUNCTION_TYPE_QEND, + FUNCTION_TYPE_QDURATION, + FUNCTION_TYPE_WSTART, + FUNCTION_TYPE_WEND, FUNCTION_TYPE_WDURATION, // internal function diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index bbff34c66f..49db69c7c7 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -228,7 +228,7 @@ typedef struct SFillNode { ENodeType type; // QUERY_NODE_FILL EFillMode mode; SNode* pValues; // SNodeListNode - SNode* pWStartTs; // _wstartts pseudo column + SNode* pWStartTs; // _wstart pseudo column STimeWindow timeRange; } SFillNode; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index ac80432052..1ba47db356 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1479,8 +1479,8 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi } else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) { // do nothing, todo refactor } else { - // expand the result into multiple rows. E.g., _wstartts, top(k, 20) - // the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows. + // expand the result into multiple rows. E.g., _wstart, top(k, 20) + // 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); char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo); for (int32_t k = 0; k < pRow->numOfRows; ++k) { @@ -1551,8 +1551,8 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI } else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) { // do nothing, todo refactor } else { - // expand the result into multiple rows. E.g., _wstartts, top(k, 20) - // the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows. + // expand the result into multiple rows. E.g., _wstart, top(k, 20) + // 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); char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo); if (pCtx[j].increase) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 78775073a4..5161d26e4b 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1579,7 +1579,7 @@ static bool timeWindowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols, SInt } 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; } } @@ -2491,8 +2491,8 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc if (IS_FINAL_OP(pInfo)) { forwardRows = 1; } else { - forwardRows = getNumOfRowsInTimeWindow(&pSDataBlock->info, tsCols, startPos, nextWin.ekey, binarySearchForKey, NULL, - TSDB_ORDER_ASC); + forwardRows = getNumOfRowsInTimeWindow(&pSDataBlock->info, tsCols, startPos, nextWin.ekey, binarySearchForKey, + NULL, TSDB_ORDER_ASC); } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pUpdated) { saveResultRow(pResult, tableGroupId, pUpdated); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f4dadbf5d0..2b617be55b 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2784,28 +2784,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .finalizeFunc = NULL }, { - .name = "_qstartts", - .type = FUNCTION_TYPE_QSTARTTS, - .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, + .name = "_qstart", + .type = FUNCTION_TYPE_QSTART, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, - .sprocessFunc = qStartTsFunction, + .sprocessFunc = qStartTsFunction, // todo .finalizeFunc = NULL }, { - .name = "_qendts", - .type = FUNCTION_TYPE_QENDTS, - .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, + .name = "_qend", + .type = FUNCTION_TYPE_QEND, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, - .sprocessFunc = qEndTsFunction, + .sprocessFunc = qEndTsFunction, // todo .finalizeFunc = NULL }, { - .name = "_wstartts", - .type = FUNCTION_TYPE_WSTARTTS, + .name = "_qduration", + .type = FUNCTION_TYPE_QDURATION, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, + .translateFunc = translateWduration, + .getEnvFunc = getTimePseudoFuncEnv, + .initFunc = NULL, + .sprocessFunc = winDurFunction, // todo + .finalizeFunc = NULL + }, + { + .name = "_wstart", + .type = FUNCTION_TYPE_WSTART, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, @@ -2814,8 +2824,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .finalizeFunc = NULL }, { - .name = "_wendts", - .type = FUNCTION_TYPE_WENDTS, + .name = "_wend", + .type = FUNCTION_TYPE_WEND, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index ed82654f77..c003f917b5 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -227,8 +227,8 @@ bool fmIsInvertible(int32_t funcId) { case FUNCTION_TYPE_SUM: case FUNCTION_TYPE_STDDEV: case FUNCTION_TYPE_AVG: - case FUNCTION_TYPE_WSTARTTS: - case FUNCTION_TYPE_WENDTS: + case FUNCTION_TYPE_WSTART: + case FUNCTION_TYPE_WEND: case FUNCTION_TYPE_WDURATION: res = true; break; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 4abb8f5c2c..9b754c92d0 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -956,7 +956,6 @@ void nodesDestroyNode(SNode* pNode) { } case QUERY_NODE_PHYSICAL_SUBPLAN: { SSubplan* pSubplan = (SSubplan*)pNode; - // nodesDestroyList(pSubplan->pChildren); nodesClearList(pSubplan->pChildren); nodesDestroyNode((SNode*)pSubplan->pNode); nodesDestroyNode((SNode*)pSubplan->pDataSink); @@ -965,25 +964,9 @@ void nodesDestroyNode(SNode* pNode) { nodesClearList(pSubplan->pParents); break; } - case QUERY_NODE_PHYSICAL_PLAN: { - SQueryPlan* pPlan = (SQueryPlan*)pNode; - 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); - } + case QUERY_NODE_PHYSICAL_PLAN: + nodesDestroyList(((SQueryPlan*)pNode)->pSubplans); break; - } default: break; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 606d35a65b..ddde20e8e9 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -520,7 +520,9 @@ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B). cmd ::= query_expression(A). { pCxt->pRootNode = A; } /************************************************ 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(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) ::= 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) ::= QSTARTTS(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) ::= WSTARTTS(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) ::= QSTART(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) ::= QDURATION(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)); } function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index c60e5541e0..ca0ab7f42e 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -598,7 +598,7 @@ SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) { nodesDestroyNode((SNode*)fill); CHECK_OUT_OF_MEM(fill->pWStartTs); } - strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstartts"); + strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstart"); return (SNode*)fill; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 58f6354402..0d176cef09 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -240,12 +240,13 @@ static SKeyword keywordTable[] = { {"WITH", TK_WITH}, {"WRITE", TK_WRITE}, {"_C0", TK_ROWTS}, - {"_QENDTS", TK_QENDTS}, - {"_QSTARTTS", TK_QSTARTTS}, + {"_QDURATION", TK_QDURATION}, + {"_QEND", TK_QEND}, + {"_QSTART", TK_QSTART}, {"_ROWTS", TK_ROWTS}, {"_WDURATION", TK_WDURATION}, - {"_WENDTS", TK_WENDTS}, - {"_WSTARTTS", TK_WSTARTTS}, + {"_WEND", TK_WEND}, + {"_WSTART", TK_WSTART}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, // {"EQ", TK_EQ}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ca000fcf2d..6b7bf3af26 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -496,7 +496,7 @@ static bool isPrimaryKeyImpl(SNode* pExpr) { SFunctionNode* pFunc = (SFunctionNode*)pExpr; if (FUNCTION_TYPE_SELECT_VALUE == pFunc->funcType) { 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; } } @@ -3508,7 +3508,7 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } - strcpy(pFunc->functionName, "_wstartts"); + strcpy(pFunc->functionName, "_wstart"); nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); SNode* pProject = NULL; FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } @@ -4334,14 +4334,14 @@ static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); 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; } SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return TSDB_CODE_OUT_OF_MEMORY; } - strcpy(pFunc->functionName, "_wstartts"); + strcpy(pFunc->functionName, "_wstart"); strcpy(pFunc->node.aliasName, pFunc->functionName); int32_t code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); if (TSDB_CODE_SUCCESS != code) { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index dedd9cabfc..3484fa61c7 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -187,7 +187,7 @@ static char* getSyntaxErrFormat(int32_t errCode) { case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC: return "%s function is not supported in fill query"; 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: return "%s function is not supported in time window query"; case TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index d01050ceeb..2200b43db1 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 378 +#define YYNOCODE 379 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy18; - EJoinType yy36; - ENullOrder yy109; - EOperatorType yy128; - bool yy173; - SDataType yy196; - EOrder yy218; - SAlterOption yy389; - int32_t yy424; - SToken yy533; - SNode* yy560; - int64_t yy585; - SNodeList* yy712; - int8_t yy719; + EOrder yy58; + bool yy151; + int8_t yy285; + SNodeList* yy356; + SToken yy361; + SAlterOption yy409; + int64_t yy457; + EFillMode yy494; + EJoinType yy504; + EOperatorType yy526; + SDataType yy600; + ENullOrder yy613; + SNode* yy616; + int32_t yy734; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 666 -#define YYNRULE 489 -#define YYNTOKEN 255 -#define YY_MAX_SHIFT 665 -#define YY_MIN_SHIFTREDUCE 970 -#define YY_MAX_SHIFTREDUCE 1458 -#define YY_ERROR_ACTION 1459 -#define YY_ACCEPT_ACTION 1460 -#define YY_NO_ACTION 1461 -#define YY_MIN_REDUCE 1462 -#define YY_MAX_REDUCE 1950 +#define YYNSTATE 669 +#define YYNRULE 491 +#define YYNTOKEN 256 +#define YY_MAX_SHIFT 668 +#define YY_MIN_SHIFTREDUCE 974 +#define YY_MAX_SHIFTREDUCE 1464 +#define YY_ERROR_ACTION 1465 +#define YY_ACCEPT_ACTION 1466 +#define YY_NO_ACTION 1467 +#define YY_MIN_REDUCE 1468 +#define YY_MAX_REDUCE 1958 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,648 +216,694 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2318) +#define YY_ACTTAB_COUNT (2547) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 529, 1700, 433, 552, 434, 1497, 441, 1589, 434, 1497, - /* 10 */ 1772, 113, 39, 37, 386, 62, 517, 1585, 471, 380, - /* 20 */ 338, 1768, 1259, 1003, 324, 79, 1785, 1697, 1600, 30, - /* 30 */ 260, 122, 143, 1335, 103, 1257, 1556, 102, 101, 100, - /* 40 */ 99, 98, 97, 96, 95, 94, 1593, 1764, 1770, 327, - /* 50 */ 71, 302, 557, 1928, 1803, 555, 1330, 1514, 1285, 574, - /* 60 */ 1928, 14, 581, 1007, 1008, 500, 1927, 1754, 1265, 580, - /* 70 */ 1925, 120, 1596, 159, 39, 37, 1398, 1925, 498, 487, - /* 80 */ 496, 529, 338, 557, 1259, 1, 250, 1870, 551, 1020, - /* 90 */ 550, 1019, 164, 1928, 1816, 1335, 61, 1257, 89, 1786, - /* 100 */ 583, 1788, 1789, 579, 469, 574, 161, 662, 1862, 1600, - /* 110 */ 1925, 343, 305, 1858, 1645, 1647, 71, 61, 1330, 1021, - /* 120 */ 43, 1337, 1338, 14, 1928, 1463, 1928, 33, 32, 117, - /* 130 */ 1265, 40, 38, 36, 35, 34, 475, 161, 1595, 160, - /* 140 */ 142, 1925, 1474, 1925, 1485, 1785, 103, 2, 214, 102, - /* 150 */ 101, 100, 99, 98, 97, 96, 95, 94, 474, 1156, - /* 160 */ 1157, 486, 485, 484, 170, 1928, 1260, 483, 1258, 662, - /* 170 */ 118, 480, 325, 1803, 479, 478, 477, 1460, 1926, 74, - /* 180 */ 140, 556, 1925, 1337, 1338, 1754, 1754, 555, 580, 1602, - /* 190 */ 1646, 1647, 69, 1263, 1264, 68, 1313, 1314, 1316, 1317, - /* 200 */ 1318, 1319, 1320, 576, 572, 1328, 1329, 1331, 1332, 1333, - /* 210 */ 1334, 1336, 1339, 1816, 36, 35, 34, 90, 1786, 583, - /* 220 */ 1788, 1789, 579, 529, 574, 162, 371, 1862, 1260, 555, - /* 230 */ 1258, 329, 1858, 154, 113, 419, 162, 350, 1484, 33, - /* 240 */ 32, 476, 450, 40, 38, 36, 35, 34, 373, 369, - /* 250 */ 1285, 1600, 552, 1889, 1395, 1263, 1264, 162, 1313, 1314, - /* 260 */ 1316, 1317, 1318, 1319, 1320, 576, 572, 1328, 1329, 1331, - /* 270 */ 1332, 1333, 1334, 1336, 1339, 39, 37, 1455, 1928, 1754, - /* 280 */ 122, 174, 173, 338, 220, 1259, 40, 38, 36, 35, - /* 290 */ 34, 159, 306, 61, 42, 1925, 1335, 1741, 1257, 1114, - /* 300 */ 605, 604, 603, 1118, 602, 1120, 1121, 601, 1123, 598, - /* 310 */ 1803, 1129, 595, 1131, 1132, 592, 589, 1298, 545, 1330, - /* 320 */ 120, 1785, 33, 32, 14, 1357, 40, 38, 36, 35, - /* 330 */ 34, 1265, 39, 37, 554, 155, 1870, 1871, 86, 1875, - /* 340 */ 338, 552, 1259, 1772, 359, 1652, 1239, 1240, 2, 1803, - /* 350 */ 341, 119, 326, 1335, 1768, 1257, 544, 581, 140, 1592, - /* 360 */ 344, 1650, 1754, 529, 580, 1402, 1454, 1602, 140, 122, - /* 370 */ 662, 1284, 1284, 379, 165, 378, 1330, 1602, 557, 1358, - /* 380 */ 1764, 1770, 333, 1578, 1337, 1338, 1462, 432, 1265, 1816, - /* 390 */ 436, 1600, 574, 89, 1786, 583, 1788, 1789, 579, 1483, - /* 400 */ 574, 440, 1363, 1862, 436, 8, 215, 305, 1858, 120, - /* 410 */ 112, 111, 110, 109, 108, 107, 106, 105, 104, 1928, - /* 420 */ 482, 481, 632, 630, 156, 1870, 1871, 662, 1875, 1260, - /* 430 */ 208, 1258, 159, 162, 162, 61, 1925, 75, 516, 1482, - /* 440 */ 1754, 1337, 1338, 450, 29, 336, 1352, 1353, 1354, 1355, - /* 450 */ 1356, 1360, 1361, 1362, 1481, 315, 1263, 1264, 546, 1313, - /* 460 */ 1314, 1316, 1317, 1318, 1319, 1320, 576, 572, 1328, 1329, - /* 470 */ 1331, 1332, 1333, 1334, 1336, 1339, 1394, 33, 32, 1928, - /* 480 */ 1754, 40, 38, 36, 35, 34, 1260, 1359, 1258, 73, - /* 490 */ 304, 1652, 159, 519, 541, 1754, 1925, 33, 32, 348, - /* 500 */ 1286, 40, 38, 36, 35, 34, 316, 1651, 314, 313, - /* 510 */ 1364, 473, 616, 1263, 1264, 475, 1313, 1314, 1316, 1317, - /* 520 */ 1318, 1319, 1320, 576, 572, 1328, 1329, 1331, 1332, 1333, - /* 530 */ 1334, 1336, 1339, 39, 37, 1340, 438, 474, 1007, 1008, - /* 540 */ 1928, 338, 1282, 1259, 1785, 162, 1877, 1480, 1315, 1020, - /* 550 */ 306, 1019, 27, 159, 1335, 1429, 1257, 1925, 1591, 33, - /* 560 */ 32, 221, 222, 40, 38, 36, 35, 34, 1287, 1768, - /* 570 */ 1874, 552, 1803, 547, 542, 162, 1576, 1330, 1283, 1021, - /* 580 */ 556, 529, 529, 1357, 153, 1754, 1479, 580, 1754, 1265, - /* 590 */ 39, 37, 384, 385, 22, 1764, 1770, 1639, 338, 122, - /* 600 */ 1259, 1524, 1076, 11, 10, 140, 9, 574, 1652, 1600, - /* 610 */ 1600, 1335, 1816, 1257, 1603, 342, 90, 1786, 583, 1788, - /* 620 */ 1789, 579, 304, 574, 1650, 519, 1862, 1754, 662, 529, - /* 630 */ 329, 1858, 154, 252, 1330, 1078, 616, 1358, 1877, 120, - /* 640 */ 389, 1557, 1337, 1338, 158, 1345, 1265, 1696, 1690, 299, - /* 650 */ 517, 1284, 1888, 1265, 157, 1870, 1871, 1600, 1875, 172, - /* 660 */ 1363, 1698, 1873, 9, 639, 638, 637, 636, 346, 1587, - /* 670 */ 635, 634, 633, 123, 628, 627, 626, 625, 624, 623, - /* 680 */ 622, 621, 133, 617, 1527, 662, 1284, 1260, 1371, 1258, - /* 690 */ 33, 32, 1877, 1478, 40, 38, 36, 35, 34, 1337, - /* 700 */ 1338, 232, 29, 336, 1352, 1353, 1354, 1355, 1356, 1360, - /* 710 */ 1361, 1362, 7, 1477, 1263, 1264, 1872, 1313, 1314, 1316, - /* 720 */ 1317, 1318, 1319, 1320, 576, 572, 1328, 1329, 1331, 1332, - /* 730 */ 1333, 1334, 1336, 1339, 1754, 33, 32, 1882, 1391, 40, - /* 740 */ 38, 36, 35, 34, 1260, 561, 1258, 486, 485, 484, - /* 750 */ 44, 4, 1259, 483, 1754, 272, 118, 480, 1630, 608, - /* 760 */ 479, 478, 477, 1476, 619, 1257, 1419, 1695, 1409, 299, - /* 770 */ 612, 1263, 1264, 1643, 1313, 1314, 1316, 1317, 1318, 1319, - /* 780 */ 1320, 576, 572, 1328, 1329, 1331, 1332, 1333, 1334, 1336, - /* 790 */ 1339, 39, 37, 301, 613, 1282, 614, 1643, 1265, 338, - /* 800 */ 1583, 1259, 412, 1785, 1754, 424, 1268, 538, 1417, 1418, - /* 810 */ 1420, 1421, 1335, 1298, 1257, 131, 130, 611, 610, 609, - /* 820 */ 11, 10, 397, 529, 425, 211, 399, 631, 1315, 529, - /* 830 */ 529, 1803, 529, 1473, 404, 1330, 620, 662, 1572, 581, - /* 840 */ 405, 449, 26, 1597, 1754, 59, 580, 1265, 33, 32, - /* 850 */ 1509, 1600, 40, 38, 36, 35, 34, 1600, 1600, 390, - /* 860 */ 1600, 33, 32, 1315, 2, 40, 38, 36, 35, 34, - /* 870 */ 374, 1816, 489, 570, 1754, 91, 1786, 583, 1788, 1789, - /* 880 */ 579, 28, 574, 1457, 1458, 1862, 662, 33, 32, 1861, - /* 890 */ 1858, 40, 38, 36, 35, 34, 1260, 1391, 1258, 423, - /* 900 */ 1337, 1338, 418, 417, 416, 415, 414, 411, 410, 409, - /* 910 */ 408, 407, 403, 402, 401, 400, 394, 393, 392, 391, - /* 920 */ 575, 388, 387, 1263, 1264, 529, 564, 529, 1507, 141, - /* 930 */ 1472, 529, 199, 529, 278, 197, 1729, 201, 510, 1271, - /* 940 */ 200, 1047, 514, 194, 527, 1260, 562, 1258, 276, 58, - /* 950 */ 492, 203, 57, 1600, 202, 1600, 607, 146, 502, 1600, - /* 960 */ 509, 1600, 467, 463, 459, 455, 193, 1785, 177, 429, - /* 970 */ 427, 1754, 1263, 1264, 1048, 1313, 1314, 1316, 1317, 1318, - /* 980 */ 1319, 1320, 576, 572, 1328, 1329, 1331, 1332, 1333, 1334, - /* 990 */ 1336, 1339, 335, 334, 72, 1803, 61, 191, 529, 1928, - /* 1000 */ 529, 205, 1273, 581, 204, 1349, 139, 1475, 1754, 528, - /* 1010 */ 580, 261, 159, 1335, 1773, 1266, 1925, 52, 513, 529, - /* 1020 */ 255, 539, 85, 468, 1471, 1768, 1600, 1470, 1600, 1267, - /* 1030 */ 345, 1469, 82, 41, 88, 1816, 1330, 1577, 1468, 90, - /* 1040 */ 1786, 583, 1788, 1789, 579, 1785, 574, 1600, 1265, 1862, - /* 1050 */ 1467, 1764, 1770, 329, 1858, 1941, 1503, 503, 244, 190, - /* 1060 */ 183, 1575, 188, 574, 1896, 1754, 446, 1466, 1754, 66, - /* 1070 */ 65, 383, 1754, 1803, 169, 1465, 1207, 1804, 347, 1754, - /* 1080 */ 377, 581, 219, 125, 559, 181, 1754, 569, 580, 1775, - /* 1090 */ 1498, 1754, 1640, 300, 128, 129, 367, 50, 365, 361, - /* 1100 */ 357, 166, 352, 349, 657, 1892, 236, 50, 1754, 41, - /* 1110 */ 249, 553, 254, 1816, 257, 259, 1754, 90, 1786, 583, - /* 1120 */ 1788, 1789, 579, 1785, 574, 223, 522, 1862, 1777, 565, - /* 1130 */ 80, 329, 1858, 1941, 614, 3, 162, 229, 1107, 41, - /* 1140 */ 1416, 53, 1919, 5, 351, 1282, 1274, 354, 1269, 239, - /* 1150 */ 1365, 1803, 1321, 131, 130, 611, 610, 609, 614, 581, - /* 1160 */ 587, 128, 1270, 358, 1754, 1785, 580, 311, 1076, 129, - /* 1170 */ 114, 128, 312, 1277, 1279, 1223, 268, 131, 130, 611, - /* 1180 */ 610, 609, 271, 406, 572, 1328, 1329, 1331, 1332, 1333, - /* 1190 */ 1334, 1816, 1692, 1803, 171, 90, 1786, 583, 1788, 1789, - /* 1200 */ 579, 581, 574, 1135, 1139, 1862, 1754, 413, 580, 329, - /* 1210 */ 1858, 1941, 1146, 1144, 132, 421, 426, 420, 422, 428, - /* 1220 */ 1881, 430, 557, 1288, 431, 439, 1785, 180, 1291, 442, - /* 1230 */ 443, 182, 1290, 1816, 444, 1292, 1785, 285, 1786, 583, - /* 1240 */ 1788, 1789, 579, 445, 574, 491, 185, 447, 1289, 187, - /* 1250 */ 448, 189, 70, 451, 1803, 192, 470, 472, 1590, 196, - /* 1260 */ 501, 1586, 581, 1928, 1803, 303, 1734, 1754, 93, 580, - /* 1270 */ 198, 209, 581, 269, 207, 134, 161, 1754, 135, 580, - /* 1280 */ 1925, 1588, 504, 557, 1584, 136, 137, 508, 494, 505, - /* 1290 */ 212, 511, 488, 1785, 1816, 515, 216, 206, 285, 1786, - /* 1300 */ 583, 1788, 1789, 579, 1816, 574, 537, 1785, 91, 1786, - /* 1310 */ 583, 1788, 1789, 579, 126, 574, 518, 1733, 1862, 1702, - /* 1320 */ 321, 1803, 568, 1858, 1928, 56, 520, 523, 55, 578, - /* 1330 */ 323, 127, 524, 525, 1754, 1803, 580, 159, 225, 227, - /* 1340 */ 270, 1925, 1601, 581, 78, 1287, 533, 540, 1754, 535, - /* 1350 */ 580, 234, 1893, 1903, 536, 1902, 238, 1785, 328, 543, - /* 1360 */ 6, 1816, 1884, 549, 534, 293, 1786, 583, 1788, 1789, - /* 1370 */ 579, 577, 574, 571, 1834, 1816, 243, 1785, 148, 144, - /* 1380 */ 1786, 583, 1788, 1789, 579, 1803, 574, 532, 531, 248, - /* 1390 */ 1391, 245, 246, 581, 121, 247, 1286, 1878, 1754, 566, - /* 1400 */ 580, 563, 48, 330, 253, 1803, 1924, 1573, 1644, 273, - /* 1410 */ 322, 658, 585, 581, 560, 1944, 1843, 264, 1754, 661, - /* 1420 */ 580, 51, 659, 558, 1942, 1816, 147, 277, 256, 91, - /* 1430 */ 1786, 583, 1788, 1789, 579, 1748, 574, 286, 275, 1862, - /* 1440 */ 567, 258, 296, 1785, 1859, 1816, 63, 295, 1747, 294, - /* 1450 */ 1786, 583, 1788, 1789, 579, 1785, 574, 1746, 64, 1745, - /* 1460 */ 353, 1742, 355, 1251, 356, 1785, 1252, 167, 360, 1740, - /* 1470 */ 364, 1803, 362, 363, 1739, 366, 530, 1738, 368, 581, - /* 1480 */ 1737, 1736, 370, 1803, 1754, 1719, 580, 372, 168, 375, - /* 1490 */ 376, 581, 1226, 1803, 1225, 1713, 1754, 1712, 580, 381, - /* 1500 */ 382, 581, 1711, 1710, 1195, 1685, 1754, 1684, 580, 1683, - /* 1510 */ 67, 1816, 1682, 1681, 1680, 294, 1786, 583, 1788, 1789, - /* 1520 */ 579, 1785, 574, 1816, 1679, 1678, 396, 289, 1786, 583, - /* 1530 */ 1788, 1789, 579, 1816, 574, 1785, 395, 144, 1786, 583, - /* 1540 */ 1788, 1789, 579, 1677, 574, 398, 1676, 1675, 1674, 1803, - /* 1550 */ 124, 1662, 1661, 1660, 1659, 1658, 1657, 578, 1673, 1672, - /* 1560 */ 1671, 1670, 1754, 1803, 580, 548, 1669, 1668, 337, 1667, - /* 1570 */ 1666, 581, 1665, 1664, 1663, 1656, 1754, 1655, 580, 1197, - /* 1580 */ 1654, 1653, 1943, 1529, 175, 1528, 176, 1526, 1785, 1816, - /* 1590 */ 1494, 178, 1010, 293, 1786, 583, 1788, 1789, 579, 1493, - /* 1600 */ 574, 115, 1835, 1816, 179, 1009, 152, 294, 1786, 583, - /* 1610 */ 1788, 1789, 579, 665, 574, 453, 1803, 435, 116, 1727, - /* 1620 */ 1721, 339, 437, 1709, 581, 184, 1708, 267, 186, 1754, - /* 1630 */ 1785, 580, 1694, 1579, 1525, 1523, 452, 454, 1521, 456, - /* 1640 */ 457, 151, 1519, 460, 1785, 458, 655, 651, 647, 643, - /* 1650 */ 265, 1040, 461, 462, 1517, 466, 1816, 464, 1803, 465, - /* 1660 */ 294, 1786, 583, 1788, 1789, 579, 581, 574, 1506, 1505, - /* 1670 */ 1490, 1754, 1803, 580, 1581, 1150, 49, 1149, 87, 1580, - /* 1680 */ 581, 230, 1075, 1074, 195, 1754, 1073, 580, 1072, 629, - /* 1690 */ 1515, 1069, 631, 1068, 1067, 1066, 1510, 317, 1816, 318, - /* 1700 */ 1508, 490, 279, 1786, 583, 1788, 1789, 579, 1785, 574, - /* 1710 */ 319, 493, 1816, 1489, 526, 495, 280, 1786, 583, 1788, - /* 1720 */ 1789, 579, 1488, 574, 497, 1487, 499, 92, 1726, 1233, - /* 1730 */ 1785, 1720, 506, 1707, 1705, 1706, 1803, 54, 1704, 1703, - /* 1740 */ 1701, 1693, 226, 231, 581, 82, 217, 213, 507, 1754, - /* 1750 */ 1785, 580, 218, 320, 41, 16, 15, 512, 1803, 1431, - /* 1760 */ 138, 521, 228, 224, 47, 242, 581, 1231, 76, 210, - /* 1770 */ 77, 1754, 23, 580, 17, 241, 1816, 1243, 1803, 235, - /* 1780 */ 281, 1786, 583, 1788, 1789, 579, 581, 574, 1413, 1775, - /* 1790 */ 233, 1754, 1785, 580, 237, 25, 251, 145, 1816, 46, - /* 1800 */ 1415, 240, 288, 1786, 583, 1788, 1789, 579, 1785, 574, - /* 1810 */ 1408, 24, 81, 1774, 149, 1388, 1387, 18, 1816, 1443, - /* 1820 */ 1803, 1442, 290, 1786, 583, 1788, 1789, 579, 581, 574, - /* 1830 */ 45, 1448, 1437, 1754, 331, 580, 1803, 1447, 13, 1446, - /* 1840 */ 332, 10, 1275, 19, 581, 1819, 1306, 1325, 573, 1754, - /* 1850 */ 1323, 580, 1322, 150, 1350, 31, 12, 20, 163, 582, - /* 1860 */ 1816, 1785, 21, 586, 282, 1786, 583, 1788, 1789, 579, - /* 1870 */ 340, 574, 584, 1785, 1136, 588, 1816, 1133, 590, 591, - /* 1880 */ 291, 1786, 583, 1788, 1789, 579, 593, 574, 594, 1803, - /* 1890 */ 596, 599, 1130, 1113, 1124, 597, 600, 581, 1128, 1122, - /* 1900 */ 83, 1803, 1754, 84, 580, 1127, 1126, 1125, 1145, 581, - /* 1910 */ 262, 606, 60, 1141, 1754, 1785, 580, 1063, 1082, 1038, - /* 1920 */ 615, 618, 263, 1061, 1060, 1785, 1056, 1059, 1058, 1816, - /* 1930 */ 1057, 1055, 1054, 283, 1786, 583, 1788, 1789, 579, 1785, - /* 1940 */ 574, 1816, 1079, 1803, 1077, 292, 1786, 583, 1788, 1789, - /* 1950 */ 579, 581, 574, 1803, 1051, 1050, 1754, 1049, 580, 1046, - /* 1960 */ 1045, 581, 1044, 1043, 1522, 640, 1754, 1803, 580, 1520, - /* 1970 */ 641, 642, 644, 645, 646, 581, 1518, 648, 649, 1516, - /* 1980 */ 1754, 652, 580, 1816, 650, 653, 654, 284, 1786, 583, - /* 1990 */ 1788, 1789, 579, 1816, 574, 1785, 1504, 297, 1786, 583, - /* 2000 */ 1788, 1789, 579, 656, 574, 1785, 1000, 1816, 1486, 266, - /* 2010 */ 660, 298, 1786, 583, 1788, 1789, 579, 1785, 574, 1261, - /* 2020 */ 274, 663, 664, 1803, 1461, 1461, 1461, 1461, 1461, 1461, - /* 2030 */ 1461, 581, 1461, 1803, 1461, 1461, 1754, 1461, 580, 1461, - /* 2040 */ 1461, 581, 1461, 1461, 1461, 1803, 1754, 1461, 580, 1461, - /* 2050 */ 1461, 1461, 1461, 581, 1461, 1461, 1461, 1461, 1754, 1461, - /* 2060 */ 580, 1461, 1461, 1816, 1461, 1461, 1461, 1797, 1786, 583, - /* 2070 */ 1788, 1789, 579, 1816, 574, 1461, 1461, 1796, 1786, 583, - /* 2080 */ 1788, 1789, 579, 1785, 574, 1816, 1461, 1461, 1461, 1795, - /* 2090 */ 1786, 583, 1788, 1789, 579, 1785, 574, 1461, 1461, 1461, - /* 2100 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, - /* 2110 */ 1461, 1803, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 581, - /* 2120 */ 1461, 1461, 1461, 1803, 1754, 1461, 580, 1461, 1461, 1461, - /* 2130 */ 1461, 581, 1461, 1461, 1461, 1461, 1754, 1461, 580, 1461, - /* 2140 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1785, 1461, - /* 2150 */ 1461, 1816, 1461, 1461, 1461, 309, 1786, 583, 1788, 1789, - /* 2160 */ 579, 1461, 574, 1816, 1461, 1461, 1461, 308, 1786, 583, - /* 2170 */ 1788, 1789, 579, 1461, 574, 1461, 1803, 1461, 1461, 1461, - /* 2180 */ 1461, 1461, 1461, 1461, 581, 1461, 1461, 1461, 1461, 1754, - /* 2190 */ 1461, 580, 1461, 1461, 1461, 1461, 1461, 1461, 1785, 1461, - /* 2200 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1785, 1461, - /* 2210 */ 552, 1461, 1461, 1461, 1461, 1461, 1816, 1461, 1461, 1461, - /* 2220 */ 310, 1786, 583, 1788, 1789, 579, 1803, 574, 1461, 1461, - /* 2230 */ 1461, 1461, 1461, 1461, 581, 1461, 1803, 1461, 122, 1754, - /* 2240 */ 1461, 580, 1461, 1461, 581, 1461, 1461, 1461, 1461, 1754, - /* 2250 */ 1461, 580, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 557, - /* 2260 */ 1461, 1461, 1461, 1461, 1461, 1461, 1816, 1461, 1461, 1461, - /* 2270 */ 307, 1786, 583, 1788, 1789, 579, 1816, 574, 120, 1461, - /* 2280 */ 287, 1786, 583, 1788, 1789, 579, 1461, 574, 1461, 1461, - /* 2290 */ 1461, 1461, 1461, 250, 1870, 551, 1461, 550, 1461, 1461, - /* 2300 */ 1928, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, - /* 2310 */ 1461, 1461, 1461, 159, 1461, 1461, 1461, 1925, + /* 0 */ 532, 73, 1466, 436, 555, 437, 1503, 327, 520, 73, + /* 10 */ 1658, 115, 39, 37, 119, 142, 326, 312, 474, 1703, + /* 20 */ 340, 1469, 1264, 1601, 1608, 145, 1656, 555, 1606, 1562, + /* 30 */ 1810, 1602, 124, 1341, 444, 1262, 437, 1503, 548, 558, + /* 40 */ 345, 389, 105, 1651, 1653, 104, 103, 102, 101, 100, + /* 50 */ 99, 98, 97, 96, 81, 124, 1336, 1491, 1792, 33, + /* 60 */ 32, 14, 353, 40, 38, 36, 35, 34, 1270, 39, + /* 70 */ 37, 1404, 122, 558, 558, 1599, 547, 340, 303, 1264, + /* 80 */ 1936, 1290, 144, 1936, 1480, 1, 1810, 158, 1878, 1879, + /* 90 */ 1341, 1883, 1262, 162, 584, 122, 1935, 1933, 1761, 1761, + /* 100 */ 1933, 583, 435, 1936, 64, 439, 1289, 665, 532, 557, + /* 110 */ 157, 1878, 1879, 1336, 1883, 560, 161, 1290, 14, 55, + /* 120 */ 1933, 1343, 1344, 30, 261, 1270, 1824, 131, 155, 221, + /* 130 */ 91, 1793, 586, 1795, 1796, 582, 1606, 577, 43, 42, + /* 140 */ 1870, 1645, 2, 105, 306, 1866, 104, 103, 102, 101, + /* 150 */ 100, 99, 98, 97, 96, 343, 1936, 40, 38, 36, + /* 160 */ 35, 34, 1080, 142, 665, 63, 1265, 195, 1263, 163, + /* 170 */ 54, 63, 1608, 1933, 383, 519, 351, 443, 1343, 1344, + /* 180 */ 439, 148, 1160, 1161, 1401, 63, 470, 466, 462, 458, + /* 190 */ 194, 1243, 1244, 1268, 1269, 1082, 1318, 1319, 1321, 1322, + /* 200 */ 1323, 1324, 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, + /* 210 */ 1339, 1340, 1342, 1345, 1936, 1936, 1936, 1936, 74, 1652, + /* 220 */ 1653, 192, 1024, 1265, 1023, 1263, 164, 162, 161, 161, + /* 230 */ 161, 1933, 1933, 1933, 1933, 33, 32, 350, 63, 40, + /* 240 */ 38, 36, 35, 34, 1490, 382, 171, 381, 555, 564, + /* 250 */ 1268, 1269, 1025, 1318, 1319, 1321, 1322, 1323, 1324, 1325, + /* 260 */ 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, + /* 270 */ 1345, 39, 37, 1468, 71, 1289, 124, 70, 1936, 340, + /* 280 */ 164, 1264, 1792, 191, 184, 1761, 189, 1584, 307, 49, + /* 290 */ 449, 161, 1341, 453, 1262, 1933, 532, 114, 113, 112, + /* 300 */ 111, 110, 109, 108, 107, 106, 164, 115, 1289, 182, + /* 310 */ 1810, 1489, 164, 1303, 479, 1336, 122, 1936, 559, 505, + /* 320 */ 14, 1363, 1488, 1761, 1606, 583, 164, 1270, 39, 37, + /* 330 */ 1934, 159, 1878, 1879, 1933, 1883, 340, 532, 1264, 1530, + /* 340 */ 317, 485, 484, 1425, 2, 478, 1658, 453, 166, 1341, + /* 350 */ 1824, 1262, 1761, 328, 92, 1793, 586, 1795, 1796, 582, + /* 360 */ 1936, 577, 1656, 1761, 1870, 1606, 665, 477, 331, 1866, + /* 370 */ 156, 1582, 1336, 161, 549, 1364, 1658, 1933, 1291, 164, + /* 380 */ 1343, 1344, 160, 344, 1270, 541, 1423, 1424, 1426, 1427, + /* 390 */ 1896, 318, 1656, 316, 315, 1702, 476, 300, 1369, 1706, + /* 400 */ 478, 8, 642, 641, 640, 639, 348, 1400, 638, 637, + /* 410 */ 636, 125, 631, 630, 629, 628, 627, 626, 625, 624, + /* 420 */ 135, 620, 477, 665, 1024, 1265, 1023, 1263, 33, 32, + /* 430 */ 164, 619, 40, 38, 36, 35, 34, 1343, 1344, 472, + /* 440 */ 1007, 29, 338, 1358, 1359, 1360, 1361, 1362, 1366, 1367, + /* 450 */ 1368, 565, 1268, 1269, 1025, 1318, 1319, 1321, 1322, 1323, + /* 460 */ 1324, 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, + /* 470 */ 1340, 1342, 1345, 1583, 216, 222, 223, 489, 488, 487, + /* 480 */ 1011, 1012, 1265, 486, 1263, 1320, 120, 483, 635, 633, + /* 490 */ 482, 481, 480, 33, 32, 1533, 1779, 40, 38, 36, + /* 500 */ 35, 34, 209, 63, 619, 77, 1487, 1775, 422, 1268, + /* 510 */ 1269, 253, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, + /* 520 */ 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, + /* 530 */ 39, 37, 1346, 1771, 1777, 329, 305, 441, 340, 522, + /* 540 */ 1264, 1792, 164, 1287, 215, 577, 307, 1761, 1701, 346, + /* 550 */ 300, 1341, 532, 1262, 175, 174, 1509, 142, 489, 488, + /* 560 */ 487, 75, 305, 387, 486, 522, 1608, 120, 483, 1810, + /* 570 */ 617, 482, 481, 480, 1336, 76, 1365, 559, 1461, 1363, + /* 580 */ 1606, 544, 1761, 494, 583, 1658, 1270, 39, 37, 133, + /* 590 */ 132, 614, 613, 612, 532, 340, 532, 1264, 504, 1370, + /* 600 */ 1696, 1657, 567, 9, 660, 388, 503, 392, 1341, 1824, + /* 610 */ 1262, 173, 208, 92, 1793, 586, 1795, 1796, 582, 501, + /* 620 */ 577, 499, 1606, 1870, 1606, 665, 497, 331, 1866, 156, + /* 630 */ 491, 1336, 374, 1364, 1597, 207, 532, 532, 1288, 1343, + /* 640 */ 1344, 1779, 27, 1270, 164, 1775, 88, 407, 408, 1897, + /* 650 */ 1595, 1408, 1775, 1486, 376, 372, 1369, 1289, 1270, 121, + /* 660 */ 9, 550, 545, 58, 1606, 1606, 57, 1598, 1460, 33, + /* 670 */ 32, 1771, 1777, 40, 38, 36, 35, 34, 1771, 1777, + /* 680 */ 335, 520, 665, 577, 1265, 1351, 1263, 36, 35, 34, + /* 690 */ 577, 1289, 1704, 1485, 1761, 611, 1343, 1344, 1581, 29, + /* 700 */ 338, 1358, 1359, 1360, 1361, 1362, 1366, 1367, 1368, 11, + /* 710 */ 10, 1268, 1269, 61, 1318, 1319, 1321, 1322, 1323, 1324, + /* 720 */ 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, + /* 730 */ 1342, 1345, 33, 32, 1761, 1885, 40, 38, 36, 35, + /* 740 */ 34, 1265, 615, 1263, 623, 1649, 1578, 1435, 1118, 608, + /* 750 */ 607, 606, 1122, 605, 1124, 1125, 604, 1127, 601, 1882, + /* 760 */ 1133, 598, 1135, 1136, 595, 592, 1484, 22, 1268, 1269, + /* 770 */ 1483, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 579, + /* 780 */ 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 39, + /* 790 */ 37, 302, 1051, 1287, 1377, 617, 142, 340, 532, 1264, + /* 800 */ 415, 1792, 532, 427, 622, 1609, 568, 1761, 532, 452, + /* 810 */ 1341, 1761, 1262, 1603, 133, 132, 614, 613, 612, 1735, + /* 820 */ 400, 532, 428, 1747, 402, 1052, 1606, 532, 532, 1810, + /* 830 */ 1606, 1292, 513, 1336, 1320, 7, 1606, 584, 517, 530, + /* 840 */ 1482, 1479, 1761, 634, 583, 1270, 33, 32, 87, 1606, + /* 850 */ 40, 38, 36, 35, 34, 1606, 1606, 393, 84, 33, + /* 860 */ 32, 532, 2, 40, 38, 36, 35, 34, 1320, 1824, + /* 870 */ 362, 617, 531, 93, 1793, 586, 1795, 1796, 582, 1591, + /* 880 */ 577, 1761, 1761, 1870, 665, 1478, 377, 1869, 1866, 1606, + /* 890 */ 133, 132, 614, 613, 612, 44, 4, 426, 1343, 1344, + /* 900 */ 421, 420, 419, 418, 417, 414, 413, 412, 411, 410, + /* 910 */ 406, 405, 404, 403, 397, 396, 395, 394, 1885, 391, + /* 920 */ 390, 1593, 1477, 26, 1415, 1885, 1761, 143, 1589, 33, + /* 930 */ 32, 1476, 279, 40, 38, 36, 35, 34, 1011, 1012, + /* 940 */ 1273, 532, 1881, 1265, 212, 1263, 277, 60, 28, 1880, + /* 950 */ 59, 512, 262, 562, 33, 32, 1475, 41, 40, 38, + /* 960 */ 36, 35, 34, 1761, 233, 1792, 178, 432, 430, 1606, + /* 970 */ 1268, 1269, 1761, 1318, 1319, 1321, 1322, 1323, 1324, 1325, + /* 980 */ 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, + /* 990 */ 1345, 668, 532, 1810, 63, 273, 616, 1761, 1636, 1649, + /* 1000 */ 1211, 584, 578, 347, 141, 268, 1761, 1474, 583, 1473, + /* 1010 */ 33, 32, 1472, 1471, 40, 38, 36, 35, 34, 153, + /* 1020 */ 1606, 1397, 560, 1520, 658, 654, 650, 646, 266, 1272, + /* 1030 */ 1890, 1397, 90, 1824, 53, 516, 1782, 91, 1793, 586, + /* 1040 */ 1795, 1796, 582, 220, 577, 490, 1792, 1870, 1761, 1515, + /* 1050 */ 1761, 306, 1866, 1761, 1761, 200, 89, 1513, 198, 231, + /* 1060 */ 337, 336, 202, 1936, 127, 201, 573, 68, 67, 386, + /* 1070 */ 1278, 492, 170, 1276, 1810, 1784, 161, 610, 380, 495, + /* 1080 */ 1933, 1341, 584, 1271, 130, 1481, 224, 1761, 1303, 583, + /* 1090 */ 1563, 301, 529, 256, 370, 131, 368, 364, 360, 167, + /* 1100 */ 355, 352, 1780, 204, 1336, 206, 203, 525, 205, 51, + /* 1110 */ 41, 237, 542, 1775, 1824, 51, 1270, 41, 92, 1793, + /* 1120 */ 586, 1795, 1796, 582, 218, 577, 590, 230, 1870, 11, + /* 1130 */ 10, 471, 331, 1866, 1949, 164, 1792, 1811, 1111, 1771, + /* 1140 */ 1777, 1463, 1464, 1904, 130, 1235, 131, 211, 116, 506, + /* 1150 */ 130, 577, 1422, 1327, 240, 572, 245, 349, 1371, 1504, + /* 1160 */ 272, 1646, 1275, 1900, 1810, 556, 250, 3, 255, 1139, + /* 1170 */ 258, 5, 584, 260, 354, 1287, 361, 1761, 357, 583, + /* 1180 */ 313, 1080, 1227, 314, 269, 409, 1698, 1143, 424, 1150, + /* 1190 */ 172, 1148, 1792, 134, 416, 423, 425, 429, 1355, 431, + /* 1200 */ 434, 433, 1293, 442, 1824, 1296, 445, 181, 93, 1793, + /* 1210 */ 586, 1795, 1796, 582, 1279, 577, 1274, 446, 1870, 183, + /* 1220 */ 1810, 1295, 571, 1866, 1297, 448, 186, 447, 584, 188, + /* 1230 */ 1294, 450, 451, 1761, 1792, 583, 190, 454, 72, 193, + /* 1240 */ 473, 1282, 1284, 475, 1596, 95, 197, 1592, 199, 136, + /* 1250 */ 137, 1594, 304, 575, 1334, 1335, 1337, 1338, 1339, 1340, + /* 1260 */ 1824, 1590, 1810, 138, 92, 1793, 586, 1795, 1796, 582, + /* 1270 */ 584, 577, 139, 270, 1870, 1761, 210, 583, 331, 1866, + /* 1280 */ 1949, 1740, 507, 540, 511, 526, 213, 1792, 217, 1927, + /* 1290 */ 508, 514, 518, 521, 128, 323, 1739, 1792, 1708, 523, + /* 1300 */ 129, 325, 1824, 226, 527, 528, 92, 1793, 586, 1795, + /* 1310 */ 1796, 582, 228, 577, 271, 1810, 1870, 1607, 1292, 543, + /* 1320 */ 331, 1866, 1949, 584, 80, 1810, 536, 538, 1761, 539, + /* 1330 */ 583, 1889, 1264, 584, 1901, 330, 546, 6, 1761, 534, + /* 1340 */ 583, 235, 244, 239, 552, 1262, 537, 1792, 1397, 1911, + /* 1350 */ 1910, 150, 535, 123, 560, 1824, 1291, 1792, 1892, 280, + /* 1360 */ 1793, 586, 1795, 1796, 582, 1824, 577, 249, 246, 286, + /* 1370 */ 1793, 586, 1795, 1796, 582, 1810, 577, 569, 1270, 332, + /* 1380 */ 1886, 566, 1932, 584, 254, 1810, 563, 257, 1761, 1952, + /* 1390 */ 583, 48, 82, 581, 247, 1936, 1650, 248, 1761, 1579, + /* 1400 */ 583, 274, 265, 1851, 560, 588, 661, 570, 163, 662, + /* 1410 */ 664, 259, 1933, 52, 149, 1824, 278, 665, 1755, 286, + /* 1420 */ 1793, 586, 1795, 1796, 582, 1824, 577, 276, 1754, 294, + /* 1430 */ 1793, 586, 1795, 1796, 582, 580, 577, 574, 1842, 1792, + /* 1440 */ 555, 287, 297, 296, 65, 1936, 1753, 1752, 66, 1751, + /* 1450 */ 356, 1748, 358, 359, 1255, 1256, 168, 363, 161, 1746, + /* 1460 */ 365, 366, 1933, 367, 1745, 369, 1744, 1810, 124, 1743, + /* 1470 */ 371, 1742, 373, 375, 1725, 584, 1265, 169, 1263, 378, + /* 1480 */ 1761, 379, 583, 1230, 1229, 1719, 1718, 384, 385, 560, + /* 1490 */ 1717, 1716, 1691, 1792, 1199, 1690, 1689, 69, 1688, 1687, + /* 1500 */ 1686, 1685, 1684, 1268, 1269, 398, 1683, 1824, 122, 401, + /* 1510 */ 399, 146, 1793, 586, 1795, 1796, 582, 1792, 577, 1682, + /* 1520 */ 1681, 1810, 126, 251, 1878, 554, 1680, 553, 1679, 584, + /* 1530 */ 1936, 1678, 1677, 1676, 1761, 1675, 583, 1674, 1673, 1672, + /* 1540 */ 1671, 1670, 1669, 163, 1668, 1810, 1667, 1933, 1666, 1665, + /* 1550 */ 324, 1664, 1663, 584, 117, 561, 1950, 1662, 1761, 1661, + /* 1560 */ 583, 1824, 1660, 1659, 1535, 93, 1793, 586, 1795, 1796, + /* 1570 */ 582, 1792, 577, 176, 1534, 1870, 1201, 177, 1532, 1500, + /* 1580 */ 1867, 1792, 1014, 1013, 1499, 1824, 154, 179, 1733, 295, + /* 1590 */ 1793, 586, 1795, 1796, 582, 1727, 577, 1715, 180, 1810, + /* 1600 */ 118, 438, 440, 1714, 533, 185, 1700, 584, 1585, 1810, + /* 1610 */ 187, 1531, 1761, 1529, 583, 1044, 455, 584, 456, 457, + /* 1620 */ 1527, 459, 1761, 460, 583, 1525, 461, 1523, 463, 465, + /* 1630 */ 464, 1792, 468, 467, 1512, 469, 1511, 1496, 1587, 1824, + /* 1640 */ 1154, 50, 196, 295, 1793, 586, 1795, 1796, 582, 1824, + /* 1650 */ 577, 1153, 1586, 290, 1793, 586, 1795, 1796, 582, 1810, + /* 1660 */ 577, 1079, 632, 1078, 634, 1077, 1076, 584, 1073, 1521, + /* 1670 */ 1072, 319, 1761, 320, 583, 1071, 1070, 1516, 1514, 321, + /* 1680 */ 496, 1792, 1495, 498, 1494, 500, 1493, 502, 493, 1732, + /* 1690 */ 94, 551, 15, 1792, 1237, 1726, 140, 509, 1713, 1824, + /* 1700 */ 1711, 1712, 1710, 146, 1793, 586, 1795, 1796, 582, 1810, + /* 1710 */ 577, 1709, 1707, 56, 1699, 1247, 229, 581, 510, 227, + /* 1720 */ 214, 1810, 1761, 16, 583, 232, 339, 225, 322, 584, + /* 1730 */ 219, 78, 515, 41, 1761, 17, 583, 47, 79, 23, + /* 1740 */ 524, 1437, 84, 234, 13, 243, 236, 1419, 1951, 1824, + /* 1750 */ 1421, 238, 147, 294, 1793, 586, 1795, 1796, 582, 241, + /* 1760 */ 577, 1824, 1843, 242, 1782, 295, 1793, 586, 1795, 1796, + /* 1770 */ 582, 1792, 577, 24, 25, 252, 46, 1414, 83, 18, + /* 1780 */ 1781, 1792, 1394, 1393, 151, 1449, 1448, 333, 1453, 1454, + /* 1790 */ 1443, 1452, 334, 10, 1280, 1356, 1331, 45, 19, 1810, + /* 1800 */ 1827, 576, 1311, 1329, 341, 1328, 31, 584, 152, 1810, + /* 1810 */ 12, 20, 1761, 165, 583, 21, 589, 584, 585, 587, + /* 1820 */ 342, 1140, 1761, 1137, 583, 591, 594, 593, 1134, 596, + /* 1830 */ 597, 1792, 1128, 599, 600, 602, 1132, 1131, 1117, 1824, + /* 1840 */ 609, 1792, 1149, 295, 1793, 586, 1795, 1796, 582, 1824, + /* 1850 */ 577, 1792, 1126, 281, 1793, 586, 1795, 1796, 582, 1810, + /* 1860 */ 577, 603, 85, 86, 62, 263, 1145, 584, 1130, 1810, + /* 1870 */ 1129, 1042, 1761, 618, 583, 264, 1067, 584, 1086, 1810, + /* 1880 */ 621, 1065, 1761, 1064, 583, 1063, 1062, 584, 1061, 1060, + /* 1890 */ 1059, 1058, 1761, 1083, 583, 1081, 1055, 1054, 1053, 1824, + /* 1900 */ 1050, 1049, 1528, 282, 1793, 586, 1795, 1796, 582, 1824, + /* 1910 */ 577, 1048, 1047, 289, 1793, 586, 1795, 1796, 582, 1824, + /* 1920 */ 577, 643, 644, 291, 1793, 586, 1795, 1796, 582, 645, + /* 1930 */ 577, 1526, 1792, 647, 648, 649, 1524, 1522, 651, 652, + /* 1940 */ 653, 655, 656, 657, 1510, 659, 1004, 1492, 267, 663, + /* 1950 */ 666, 1792, 1266, 667, 275, 1467, 1467, 1467, 1467, 1467, + /* 1960 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, + /* 1970 */ 1467, 1467, 1467, 1761, 1467, 583, 1467, 1467, 1467, 1810, + /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, + /* 1990 */ 1467, 1467, 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, + /* 2000 */ 1824, 1467, 1467, 1467, 283, 1793, 586, 1795, 1796, 582, + /* 2010 */ 1467, 577, 1467, 1792, 1467, 1467, 1467, 1467, 1467, 1824, + /* 2020 */ 1467, 1467, 1467, 292, 1793, 586, 1795, 1796, 582, 1792, + /* 2030 */ 577, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2040 */ 1467, 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, + /* 2050 */ 1467, 1467, 1467, 1467, 1761, 1467, 583, 1810, 1467, 1467, + /* 2060 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, + /* 2070 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2080 */ 1467, 1824, 1792, 1467, 1467, 284, 1793, 586, 1795, 1796, + /* 2090 */ 582, 1467, 577, 1467, 1467, 1467, 1467, 1824, 1467, 1792, + /* 2100 */ 1467, 293, 1793, 586, 1795, 1796, 582, 1467, 577, 1467, + /* 2110 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, + /* 2120 */ 1467, 1467, 1467, 1761, 1467, 583, 1467, 1810, 1467, 1467, + /* 2130 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, + /* 2140 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2150 */ 1824, 1467, 1792, 1467, 285, 1793, 586, 1795, 1796, 582, + /* 2160 */ 1467, 577, 1467, 1467, 1792, 1467, 1467, 1824, 1467, 1467, + /* 2170 */ 1467, 298, 1793, 586, 1795, 1796, 582, 1467, 577, 1467, + /* 2180 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, + /* 2190 */ 1467, 1467, 1810, 1761, 1467, 583, 1467, 1467, 1467, 1467, + /* 2200 */ 584, 1467, 1467, 1467, 1467, 1761, 1467, 583, 1467, 1467, + /* 2210 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2220 */ 1824, 1467, 1467, 1467, 299, 1793, 586, 1795, 1796, 582, + /* 2230 */ 1467, 577, 1824, 1792, 1467, 1467, 1804, 1793, 586, 1795, + /* 2240 */ 1796, 582, 1467, 577, 1467, 1467, 1467, 1792, 1467, 1467, + /* 2250 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2260 */ 1467, 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, + /* 2270 */ 1467, 1467, 1467, 1467, 1761, 1810, 583, 1467, 1467, 1467, + /* 2280 */ 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, 1761, 1792, + /* 2290 */ 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2300 */ 1467, 1824, 1467, 1467, 1467, 1803, 1793, 586, 1795, 1796, + /* 2310 */ 582, 1467, 577, 1467, 1467, 1824, 1467, 1810, 1467, 1802, + /* 2320 */ 1793, 586, 1795, 1796, 582, 584, 577, 1467, 1467, 1467, + /* 2330 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2340 */ 1467, 1792, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2350 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1824, 1467, 1792, + /* 2360 */ 1467, 310, 1793, 586, 1795, 1796, 582, 1467, 577, 1810, + /* 2370 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, + /* 2380 */ 1467, 1467, 1761, 1792, 583, 1467, 1467, 1810, 1467, 1467, + /* 2390 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, + /* 2400 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1824, + /* 2410 */ 1467, 1810, 1467, 309, 1793, 586, 1795, 1796, 582, 584, + /* 2420 */ 577, 1467, 1467, 1467, 1761, 1467, 583, 1824, 1467, 1467, + /* 2430 */ 1467, 311, 1793, 586, 1795, 1796, 582, 1467, 577, 555, + /* 2440 */ 1792, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2450 */ 1467, 1824, 1467, 1467, 1467, 308, 1793, 586, 1795, 1796, + /* 2460 */ 582, 1467, 577, 1467, 1467, 1467, 1467, 124, 1810, 1467, + /* 2470 */ 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, + /* 2480 */ 1467, 1761, 1467, 583, 1467, 1467, 1467, 1467, 560, 1467, + /* 2490 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2500 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 122, 1824, 1467, + /* 2510 */ 1467, 1467, 288, 1793, 586, 1795, 1796, 582, 1467, 577, + /* 2520 */ 1467, 1467, 251, 1878, 554, 1467, 553, 1467, 1467, 1936, + /* 2530 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2540 */ 1467, 1467, 161, 1467, 1467, 1467, 1933, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 266, 0, 262, 266, 264, 265, 262, 287, 264, 265, - /* 10 */ 288, 277, 12, 13, 266, 4, 301, 287, 284, 315, - /* 20 */ 20, 299, 22, 4, 309, 268, 258, 312, 294, 341, - /* 30 */ 342, 294, 271, 33, 21, 35, 275, 24, 25, 26, - /* 40 */ 27, 28, 29, 30, 31, 32, 289, 325, 326, 327, - /* 50 */ 270, 303, 315, 356, 286, 20, 56, 0, 20, 337, - /* 60 */ 356, 61, 294, 44, 45, 21, 369, 299, 68, 301, - /* 70 */ 373, 334, 292, 369, 12, 13, 14, 373, 34, 22, - /* 80 */ 36, 266, 20, 315, 22, 85, 349, 350, 351, 20, - /* 90 */ 353, 22, 277, 356, 326, 33, 85, 35, 330, 331, - /* 100 */ 332, 333, 334, 335, 35, 337, 369, 107, 340, 294, - /* 110 */ 373, 297, 344, 345, 300, 301, 270, 85, 56, 50, - /* 120 */ 85, 121, 122, 61, 356, 0, 356, 8, 9, 283, - /* 130 */ 68, 12, 13, 14, 15, 16, 97, 369, 292, 369, - /* 140 */ 257, 373, 259, 373, 258, 258, 21, 85, 56, 24, - /* 150 */ 25, 26, 27, 28, 29, 30, 31, 32, 119, 121, - /* 160 */ 122, 63, 64, 65, 56, 356, 166, 69, 168, 107, - /* 170 */ 72, 73, 278, 286, 76, 77, 78, 255, 369, 87, - /* 180 */ 286, 294, 373, 121, 122, 299, 299, 20, 301, 295, - /* 190 */ 300, 301, 84, 193, 194, 87, 196, 197, 198, 199, + /* 0 */ 267, 271, 256, 263, 267, 265, 266, 279, 302, 271, + /* 10 */ 287, 278, 12, 13, 284, 287, 310, 294, 285, 313, + /* 20 */ 20, 0, 22, 293, 296, 272, 303, 267, 295, 276, + /* 30 */ 287, 293, 295, 33, 263, 35, 265, 266, 295, 20, + /* 40 */ 298, 267, 21, 301, 302, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 269, 295, 56, 259, 259, 8, + /* 60 */ 9, 61, 316, 12, 13, 14, 15, 16, 68, 12, + /* 70 */ 13, 14, 335, 20, 20, 290, 333, 20, 304, 22, + /* 80 */ 357, 20, 258, 357, 260, 85, 287, 350, 351, 352, + /* 90 */ 33, 354, 35, 370, 295, 335, 370, 374, 300, 300, + /* 100 */ 374, 302, 264, 357, 4, 267, 20, 107, 267, 349, + /* 110 */ 350, 351, 352, 56, 354, 316, 370, 20, 61, 278, + /* 120 */ 374, 121, 122, 342, 343, 68, 327, 43, 286, 116, + /* 130 */ 331, 332, 333, 334, 335, 336, 295, 338, 85, 85, + /* 140 */ 341, 299, 85, 21, 345, 346, 24, 25, 26, 27, + /* 150 */ 28, 29, 30, 31, 32, 279, 357, 12, 13, 14, + /* 160 */ 15, 16, 35, 287, 107, 85, 166, 33, 168, 370, + /* 170 */ 86, 85, 296, 374, 316, 316, 316, 264, 121, 122, + /* 180 */ 267, 47, 121, 122, 4, 85, 52, 53, 54, 55, + /* 190 */ 56, 178, 179, 193, 194, 68, 196, 197, 198, 199, /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 210 */ 210, 211, 212, 326, 14, 15, 16, 330, 331, 332, - /* 220 */ 333, 334, 335, 266, 337, 225, 161, 340, 166, 20, - /* 230 */ 168, 344, 345, 346, 277, 79, 225, 315, 258, 8, - /* 240 */ 9, 284, 60, 12, 13, 14, 15, 16, 183, 184, - /* 250 */ 20, 294, 266, 366, 4, 193, 194, 225, 196, 197, - /* 260 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - /* 270 */ 208, 209, 210, 211, 212, 12, 13, 158, 356, 299, - /* 280 */ 294, 125, 126, 20, 116, 22, 12, 13, 14, 15, - /* 290 */ 16, 369, 61, 85, 85, 373, 33, 0, 35, 98, - /* 300 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 310 */ 286, 110, 111, 112, 113, 114, 115, 86, 294, 56, - /* 320 */ 334, 258, 8, 9, 61, 94, 12, 13, 14, 15, - /* 330 */ 16, 68, 12, 13, 348, 349, 350, 351, 268, 353, - /* 340 */ 20, 266, 22, 288, 47, 286, 178, 179, 85, 286, - /* 350 */ 278, 281, 293, 33, 299, 35, 332, 294, 286, 289, - /* 360 */ 278, 302, 299, 266, 301, 14, 247, 295, 286, 294, - /* 370 */ 107, 20, 20, 165, 277, 167, 56, 295, 315, 148, - /* 380 */ 325, 326, 327, 0, 121, 122, 0, 263, 68, 326, - /* 390 */ 266, 294, 337, 330, 331, 332, 333, 334, 335, 258, - /* 400 */ 337, 263, 171, 340, 266, 85, 56, 344, 345, 334, - /* 410 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 356, - /* 420 */ 272, 273, 272, 273, 349, 350, 351, 107, 353, 166, - /* 430 */ 117, 168, 369, 225, 225, 85, 373, 87, 315, 258, - /* 440 */ 299, 121, 122, 60, 213, 214, 215, 216, 217, 218, - /* 450 */ 219, 220, 221, 222, 258, 37, 193, 194, 20, 196, - /* 460 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - /* 470 */ 207, 208, 209, 210, 211, 212, 226, 8, 9, 356, - /* 480 */ 299, 12, 13, 14, 15, 16, 166, 148, 168, 176, - /* 490 */ 177, 286, 369, 180, 151, 299, 373, 8, 9, 315, - /* 500 */ 20, 12, 13, 14, 15, 16, 88, 302, 90, 91, - /* 510 */ 171, 93, 60, 193, 194, 97, 196, 197, 198, 199, - /* 520 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 530 */ 210, 211, 212, 12, 13, 14, 14, 119, 44, 45, - /* 540 */ 356, 20, 20, 22, 258, 225, 328, 258, 197, 20, - /* 550 */ 61, 22, 213, 369, 33, 86, 35, 373, 288, 8, - /* 560 */ 9, 116, 117, 12, 13, 14, 15, 16, 20, 299, - /* 570 */ 352, 266, 286, 230, 231, 225, 0, 56, 20, 50, - /* 580 */ 294, 266, 266, 94, 285, 299, 258, 301, 299, 68, - /* 590 */ 12, 13, 277, 277, 43, 325, 326, 298, 20, 294, - /* 600 */ 22, 0, 35, 1, 2, 286, 85, 337, 286, 294, - /* 610 */ 294, 33, 326, 35, 295, 293, 330, 331, 332, 333, - /* 620 */ 334, 335, 177, 337, 302, 180, 340, 299, 107, 266, - /* 630 */ 344, 345, 346, 153, 56, 68, 60, 148, 328, 334, - /* 640 */ 277, 275, 121, 122, 358, 14, 68, 311, 294, 313, - /* 650 */ 301, 20, 366, 68, 349, 350, 351, 294, 353, 305, - /* 660 */ 171, 312, 352, 85, 63, 64, 65, 66, 67, 287, - /* 670 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - /* 680 */ 79, 80, 81, 82, 0, 107, 20, 166, 86, 168, - /* 690 */ 8, 9, 328, 258, 12, 13, 14, 15, 16, 121, - /* 700 */ 122, 153, 213, 214, 215, 216, 217, 218, 219, 220, - /* 710 */ 221, 222, 39, 258, 193, 194, 352, 196, 197, 198, - /* 720 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - /* 730 */ 209, 210, 211, 212, 299, 8, 9, 223, 224, 12, - /* 740 */ 13, 14, 15, 16, 166, 43, 168, 63, 64, 65, - /* 750 */ 42, 43, 22, 69, 299, 279, 72, 73, 282, 96, - /* 760 */ 76, 77, 78, 258, 68, 35, 193, 311, 86, 313, - /* 770 */ 296, 193, 194, 299, 196, 197, 198, 199, 200, 201, - /* 780 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 790 */ 212, 12, 13, 18, 296, 20, 97, 299, 68, 20, - /* 800 */ 287, 22, 27, 258, 299, 30, 35, 234, 235, 236, - /* 810 */ 237, 238, 33, 86, 35, 116, 117, 118, 119, 120, - /* 820 */ 1, 2, 47, 266, 49, 287, 51, 43, 197, 266, - /* 830 */ 266, 286, 266, 258, 277, 56, 274, 107, 276, 294, - /* 840 */ 277, 277, 2, 277, 299, 3, 301, 68, 8, 9, - /* 850 */ 0, 294, 12, 13, 14, 15, 16, 294, 294, 84, - /* 860 */ 294, 8, 9, 197, 85, 12, 13, 14, 15, 16, - /* 870 */ 86, 326, 22, 61, 299, 330, 331, 332, 333, 334, - /* 880 */ 335, 2, 337, 121, 122, 340, 107, 8, 9, 344, - /* 890 */ 345, 12, 13, 14, 15, 16, 166, 224, 168, 124, - /* 900 */ 121, 122, 127, 128, 129, 130, 131, 132, 133, 134, - /* 910 */ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - /* 920 */ 287, 146, 147, 193, 194, 266, 43, 266, 0, 18, - /* 930 */ 258, 266, 89, 266, 23, 92, 277, 89, 277, 168, - /* 940 */ 92, 35, 277, 33, 277, 166, 244, 168, 37, 38, - /* 950 */ 22, 89, 41, 294, 92, 294, 287, 47, 315, 294, - /* 960 */ 319, 294, 52, 53, 54, 55, 56, 258, 57, 58, - /* 970 */ 59, 299, 193, 194, 68, 196, 197, 198, 199, 200, - /* 980 */ 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - /* 990 */ 211, 212, 12, 13, 84, 286, 85, 87, 266, 356, - /* 1000 */ 266, 89, 22, 294, 92, 193, 153, 259, 299, 277, - /* 1010 */ 301, 277, 369, 33, 288, 35, 373, 153, 154, 266, - /* 1020 */ 376, 367, 85, 267, 258, 299, 294, 258, 294, 35, - /* 1030 */ 277, 258, 95, 43, 123, 326, 56, 0, 258, 330, - /* 1040 */ 331, 332, 333, 334, 335, 258, 337, 294, 68, 340, - /* 1050 */ 258, 325, 326, 344, 345, 346, 0, 322, 363, 149, - /* 1060 */ 150, 0, 152, 337, 355, 299, 156, 258, 299, 158, - /* 1070 */ 159, 160, 299, 286, 163, 258, 86, 286, 267, 299, - /* 1080 */ 169, 294, 43, 43, 242, 175, 299, 107, 301, 46, - /* 1090 */ 265, 299, 298, 182, 43, 43, 185, 43, 187, 188, - /* 1100 */ 189, 190, 191, 192, 48, 329, 43, 43, 299, 43, - /* 1110 */ 347, 354, 370, 326, 370, 370, 299, 330, 331, 332, - /* 1120 */ 333, 334, 335, 258, 337, 86, 86, 340, 85, 246, - /* 1130 */ 85, 344, 345, 346, 97, 357, 225, 86, 86, 43, - /* 1140 */ 86, 290, 355, 227, 324, 20, 166, 266, 168, 86, - /* 1150 */ 86, 286, 86, 116, 117, 118, 119, 120, 97, 294, - /* 1160 */ 43, 43, 168, 47, 299, 258, 301, 323, 35, 43, - /* 1170 */ 43, 43, 272, 193, 194, 164, 317, 116, 117, 118, - /* 1180 */ 119, 120, 86, 266, 204, 205, 206, 207, 208, 209, - /* 1190 */ 210, 326, 266, 286, 42, 330, 331, 332, 333, 334, - /* 1200 */ 335, 294, 337, 86, 86, 340, 299, 306, 301, 344, - /* 1210 */ 345, 346, 86, 86, 86, 148, 266, 304, 304, 266, - /* 1220 */ 355, 266, 315, 20, 260, 260, 258, 270, 20, 321, - /* 1230 */ 301, 270, 20, 326, 314, 20, 258, 330, 331, 332, - /* 1240 */ 333, 334, 335, 316, 337, 4, 270, 314, 20, 270, - /* 1250 */ 307, 270, 270, 266, 286, 270, 260, 286, 286, 286, - /* 1260 */ 19, 286, 294, 356, 286, 260, 299, 299, 266, 301, - /* 1270 */ 286, 268, 294, 321, 33, 286, 369, 299, 286, 301, - /* 1280 */ 373, 286, 174, 315, 286, 286, 286, 301, 47, 320, - /* 1290 */ 268, 266, 51, 258, 326, 266, 268, 56, 330, 331, - /* 1300 */ 332, 333, 334, 335, 326, 337, 232, 258, 330, 331, - /* 1310 */ 332, 333, 334, 335, 310, 337, 299, 299, 340, 299, - /* 1320 */ 314, 286, 344, 345, 356, 84, 299, 150, 87, 294, - /* 1330 */ 299, 310, 308, 307, 299, 286, 301, 369, 294, 268, - /* 1340 */ 282, 373, 294, 294, 268, 20, 299, 233, 299, 299, - /* 1350 */ 301, 310, 329, 362, 299, 362, 310, 258, 299, 299, - /* 1360 */ 239, 326, 365, 157, 241, 330, 331, 332, 333, 334, - /* 1370 */ 335, 336, 337, 338, 339, 326, 364, 258, 362, 330, - /* 1380 */ 331, 332, 333, 334, 335, 286, 337, 240, 228, 324, - /* 1390 */ 224, 361, 360, 294, 294, 359, 20, 328, 299, 245, - /* 1400 */ 301, 243, 85, 248, 371, 286, 372, 276, 299, 266, - /* 1410 */ 291, 36, 290, 294, 372, 377, 343, 268, 299, 260, - /* 1420 */ 301, 318, 261, 374, 375, 326, 313, 256, 371, 330, - /* 1430 */ 331, 332, 333, 334, 335, 0, 337, 280, 269, 340, - /* 1440 */ 372, 371, 280, 258, 345, 326, 176, 280, 0, 330, - /* 1450 */ 331, 332, 333, 334, 335, 258, 337, 0, 42, 0, - /* 1460 */ 76, 0, 35, 35, 186, 258, 35, 35, 186, 0, - /* 1470 */ 186, 286, 35, 35, 0, 186, 291, 0, 35, 294, - /* 1480 */ 0, 0, 22, 286, 299, 0, 301, 35, 85, 171, - /* 1490 */ 170, 294, 168, 286, 166, 0, 299, 0, 301, 162, - /* 1500 */ 161, 294, 0, 0, 46, 0, 299, 0, 301, 0, - /* 1510 */ 145, 326, 0, 0, 0, 330, 331, 332, 333, 334, - /* 1520 */ 335, 258, 337, 326, 0, 0, 35, 330, 331, 332, - /* 1530 */ 333, 334, 335, 326, 337, 258, 140, 330, 331, 332, - /* 1540 */ 333, 334, 335, 0, 337, 140, 0, 0, 0, 286, - /* 1550 */ 42, 0, 0, 0, 0, 0, 0, 294, 0, 0, - /* 1560 */ 0, 0, 299, 286, 301, 368, 0, 0, 291, 0, - /* 1570 */ 0, 294, 0, 0, 0, 0, 299, 0, 301, 22, - /* 1580 */ 0, 0, 375, 0, 56, 0, 56, 0, 258, 326, - /* 1590 */ 0, 42, 14, 330, 331, 332, 333, 334, 335, 0, - /* 1600 */ 337, 39, 339, 326, 40, 14, 43, 330, 331, 332, - /* 1610 */ 333, 334, 335, 19, 337, 47, 286, 46, 39, 0, - /* 1620 */ 0, 291, 46, 0, 294, 39, 0, 33, 157, 299, - /* 1630 */ 258, 301, 0, 0, 0, 0, 35, 39, 0, 35, - /* 1640 */ 47, 47, 0, 35, 258, 39, 52, 53, 54, 55, - /* 1650 */ 56, 62, 47, 39, 0, 39, 326, 35, 286, 47, - /* 1660 */ 330, 331, 332, 333, 334, 335, 294, 337, 0, 0, - /* 1670 */ 0, 299, 286, 301, 0, 35, 94, 22, 84, 0, - /* 1680 */ 294, 87, 35, 35, 92, 299, 35, 301, 35, 43, - /* 1690 */ 0, 35, 43, 35, 35, 35, 0, 22, 326, 22, - /* 1700 */ 0, 49, 330, 331, 332, 333, 334, 335, 258, 337, - /* 1710 */ 22, 35, 326, 0, 120, 35, 330, 331, 332, 333, - /* 1720 */ 334, 335, 0, 337, 35, 0, 22, 20, 0, 35, - /* 1730 */ 258, 0, 22, 0, 0, 0, 286, 153, 0, 0, - /* 1740 */ 0, 0, 39, 46, 294, 95, 152, 150, 153, 299, - /* 1750 */ 258, 301, 86, 153, 43, 229, 85, 155, 286, 86, - /* 1760 */ 172, 151, 149, 85, 43, 46, 294, 173, 85, 175, - /* 1770 */ 85, 299, 85, 301, 229, 43, 326, 181, 286, 86, - /* 1780 */ 330, 331, 332, 333, 334, 335, 294, 337, 86, 46, - /* 1790 */ 85, 299, 258, 301, 85, 43, 46, 85, 326, 43, - /* 1800 */ 86, 85, 330, 331, 332, 333, 334, 335, 258, 337, - /* 1810 */ 86, 85, 85, 46, 46, 86, 86, 43, 326, 35, - /* 1820 */ 286, 35, 330, 331, 332, 333, 334, 335, 294, 337, - /* 1830 */ 223, 86, 86, 299, 35, 301, 286, 35, 229, 35, - /* 1840 */ 35, 2, 22, 43, 294, 85, 22, 86, 85, 299, - /* 1850 */ 86, 301, 86, 46, 193, 85, 85, 85, 46, 195, - /* 1860 */ 326, 258, 85, 35, 330, 331, 332, 333, 334, 335, - /* 1870 */ 35, 337, 96, 258, 86, 85, 326, 86, 35, 85, - /* 1880 */ 330, 331, 332, 333, 334, 335, 35, 337, 85, 286, - /* 1890 */ 35, 35, 86, 22, 86, 85, 85, 294, 109, 86, - /* 1900 */ 85, 286, 299, 85, 301, 109, 109, 109, 35, 294, - /* 1910 */ 43, 97, 85, 22, 299, 258, 301, 35, 68, 62, - /* 1920 */ 61, 83, 43, 35, 35, 258, 22, 35, 35, 326, - /* 1930 */ 35, 35, 35, 330, 331, 332, 333, 334, 335, 258, - /* 1940 */ 337, 326, 68, 286, 35, 330, 331, 332, 333, 334, - /* 1950 */ 335, 294, 337, 286, 35, 35, 299, 35, 301, 35, - /* 1960 */ 35, 294, 35, 35, 0, 35, 299, 286, 301, 0, - /* 1970 */ 47, 39, 35, 47, 39, 294, 0, 35, 47, 0, - /* 1980 */ 299, 35, 301, 326, 39, 47, 39, 330, 331, 332, - /* 1990 */ 333, 334, 335, 326, 337, 258, 0, 330, 331, 332, - /* 2000 */ 333, 334, 335, 35, 337, 258, 35, 326, 0, 22, - /* 2010 */ 21, 330, 331, 332, 333, 334, 335, 258, 337, 22, - /* 2020 */ 22, 21, 20, 286, 378, 378, 378, 378, 378, 378, - /* 2030 */ 378, 294, 378, 286, 378, 378, 299, 378, 301, 378, - /* 2040 */ 378, 294, 378, 378, 378, 286, 299, 378, 301, 378, - /* 2050 */ 378, 378, 378, 294, 378, 378, 378, 378, 299, 378, - /* 2060 */ 301, 378, 378, 326, 378, 378, 378, 330, 331, 332, - /* 2070 */ 333, 334, 335, 326, 337, 378, 378, 330, 331, 332, - /* 2080 */ 333, 334, 335, 258, 337, 326, 378, 378, 378, 330, - /* 2090 */ 331, 332, 333, 334, 335, 258, 337, 378, 378, 378, - /* 2100 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 2110 */ 378, 286, 378, 378, 378, 378, 378, 378, 378, 294, - /* 2120 */ 378, 378, 378, 286, 299, 378, 301, 378, 378, 378, - /* 2130 */ 378, 294, 378, 378, 378, 378, 299, 378, 301, 378, - /* 2140 */ 378, 378, 378, 378, 378, 378, 378, 378, 258, 378, - /* 2150 */ 378, 326, 378, 378, 378, 330, 331, 332, 333, 334, - /* 2160 */ 335, 378, 337, 326, 378, 378, 378, 330, 331, 332, - /* 2170 */ 333, 334, 335, 378, 337, 378, 286, 378, 378, 378, - /* 2180 */ 378, 378, 378, 378, 294, 378, 378, 378, 378, 299, - /* 2190 */ 378, 301, 378, 378, 378, 378, 378, 378, 258, 378, - /* 2200 */ 378, 378, 378, 378, 378, 378, 378, 378, 258, 378, - /* 2210 */ 266, 378, 378, 378, 378, 378, 326, 378, 378, 378, - /* 2220 */ 330, 331, 332, 333, 334, 335, 286, 337, 378, 378, - /* 2230 */ 378, 378, 378, 378, 294, 378, 286, 378, 294, 299, - /* 2240 */ 378, 301, 378, 378, 294, 378, 378, 378, 378, 299, - /* 2250 */ 378, 301, 378, 378, 378, 378, 378, 378, 378, 315, - /* 2260 */ 378, 378, 378, 378, 378, 378, 326, 378, 378, 378, - /* 2270 */ 330, 331, 332, 333, 334, 335, 326, 337, 334, 378, - /* 2280 */ 330, 331, 332, 333, 334, 335, 378, 337, 378, 378, - /* 2290 */ 378, 378, 378, 349, 350, 351, 378, 353, 378, 378, - /* 2300 */ 356, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 2310 */ 378, 378, 378, 369, 378, 378, 378, 373, + /* 210 */ 210, 211, 212, 213, 357, 357, 357, 357, 84, 301, + /* 220 */ 302, 87, 20, 166, 22, 168, 226, 370, 370, 370, + /* 230 */ 370, 374, 374, 374, 374, 8, 9, 316, 85, 12, + /* 240 */ 13, 14, 15, 16, 259, 165, 56, 167, 267, 43, + /* 250 */ 193, 194, 50, 196, 197, 198, 199, 200, 201, 202, + /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 270 */ 213, 12, 13, 0, 84, 20, 295, 87, 357, 20, + /* 280 */ 226, 22, 259, 149, 150, 300, 152, 0, 61, 85, + /* 290 */ 156, 370, 33, 60, 35, 374, 267, 24, 25, 26, + /* 300 */ 27, 28, 29, 30, 31, 32, 226, 278, 20, 175, + /* 310 */ 287, 259, 226, 86, 285, 56, 335, 357, 295, 316, + /* 320 */ 61, 94, 259, 300, 295, 302, 226, 68, 12, 13, + /* 330 */ 370, 350, 351, 352, 374, 354, 20, 267, 22, 0, + /* 340 */ 37, 273, 274, 193, 85, 97, 287, 60, 278, 33, + /* 350 */ 327, 35, 300, 294, 331, 332, 333, 334, 335, 336, + /* 360 */ 357, 338, 303, 300, 341, 295, 107, 119, 345, 346, + /* 370 */ 347, 0, 56, 370, 20, 148, 287, 374, 20, 226, + /* 380 */ 121, 122, 359, 294, 68, 235, 236, 237, 238, 239, + /* 390 */ 367, 88, 303, 90, 91, 312, 93, 314, 171, 0, + /* 400 */ 97, 85, 63, 64, 65, 66, 67, 227, 69, 70, + /* 410 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + /* 420 */ 81, 82, 119, 107, 20, 166, 22, 168, 8, 9, + /* 430 */ 226, 60, 12, 13, 14, 15, 16, 121, 122, 35, + /* 440 */ 4, 214, 215, 216, 217, 218, 219, 220, 221, 222, + /* 450 */ 223, 245, 193, 194, 50, 196, 197, 198, 199, 200, + /* 460 */ 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + /* 470 */ 211, 212, 213, 0, 56, 116, 117, 63, 64, 65, + /* 480 */ 44, 45, 166, 69, 168, 197, 72, 73, 273, 274, + /* 490 */ 76, 77, 78, 8, 9, 0, 289, 12, 13, 14, + /* 500 */ 15, 16, 117, 85, 60, 87, 259, 300, 79, 193, + /* 510 */ 194, 153, 196, 197, 198, 199, 200, 201, 202, 203, + /* 520 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + /* 530 */ 12, 13, 14, 326, 327, 328, 177, 14, 20, 180, + /* 540 */ 22, 259, 226, 20, 56, 338, 61, 300, 312, 279, + /* 550 */ 314, 33, 267, 35, 125, 126, 0, 287, 63, 64, + /* 560 */ 65, 176, 177, 278, 69, 180, 296, 72, 73, 287, + /* 570 */ 97, 76, 77, 78, 56, 87, 148, 295, 158, 94, + /* 580 */ 295, 151, 300, 4, 302, 287, 68, 12, 13, 116, + /* 590 */ 117, 118, 119, 120, 267, 20, 267, 22, 19, 171, + /* 600 */ 295, 303, 43, 85, 48, 278, 21, 278, 33, 327, + /* 610 */ 35, 306, 33, 331, 332, 333, 334, 335, 336, 34, + /* 620 */ 338, 36, 295, 341, 295, 107, 47, 345, 346, 347, + /* 630 */ 51, 56, 161, 148, 289, 56, 267, 267, 20, 121, + /* 640 */ 122, 289, 214, 68, 226, 300, 269, 278, 278, 367, + /* 650 */ 288, 14, 300, 259, 183, 184, 171, 20, 68, 282, + /* 660 */ 85, 231, 232, 84, 295, 295, 87, 290, 248, 8, + /* 670 */ 9, 326, 327, 12, 13, 14, 15, 16, 326, 327, + /* 680 */ 328, 302, 107, 338, 166, 14, 168, 14, 15, 16, + /* 690 */ 338, 20, 313, 259, 300, 96, 121, 122, 0, 214, + /* 700 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 1, + /* 710 */ 2, 193, 194, 3, 196, 197, 198, 199, 200, 201, + /* 720 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + /* 730 */ 212, 213, 8, 9, 300, 329, 12, 13, 14, 15, + /* 740 */ 16, 166, 297, 168, 275, 300, 277, 86, 98, 99, + /* 750 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 353, + /* 760 */ 110, 111, 112, 113, 114, 115, 259, 43, 193, 194, + /* 770 */ 259, 196, 197, 198, 199, 200, 201, 202, 203, 204, + /* 780 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 12, + /* 790 */ 13, 18, 35, 20, 86, 97, 287, 20, 267, 22, + /* 800 */ 27, 259, 267, 30, 68, 296, 247, 300, 267, 278, + /* 810 */ 33, 300, 35, 278, 116, 117, 118, 119, 120, 278, + /* 820 */ 47, 267, 49, 0, 51, 68, 295, 267, 267, 287, + /* 830 */ 295, 20, 278, 56, 197, 39, 295, 295, 278, 278, + /* 840 */ 259, 259, 300, 43, 302, 68, 8, 9, 85, 295, + /* 850 */ 12, 13, 14, 15, 16, 295, 295, 84, 95, 8, + /* 860 */ 9, 267, 85, 12, 13, 14, 15, 16, 197, 327, + /* 870 */ 47, 97, 278, 331, 332, 333, 334, 335, 336, 288, + /* 880 */ 338, 300, 300, 341, 107, 259, 86, 345, 346, 295, + /* 890 */ 116, 117, 118, 119, 120, 42, 43, 124, 121, 122, + /* 900 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + /* 910 */ 137, 138, 139, 140, 141, 142, 143, 144, 329, 146, + /* 920 */ 147, 288, 259, 2, 86, 329, 300, 18, 288, 8, + /* 930 */ 9, 259, 23, 12, 13, 14, 15, 16, 44, 45, + /* 940 */ 35, 267, 353, 166, 288, 168, 37, 38, 2, 353, + /* 950 */ 41, 320, 278, 243, 8, 9, 259, 43, 12, 13, + /* 960 */ 14, 15, 16, 300, 153, 259, 57, 58, 59, 295, + /* 970 */ 193, 194, 300, 196, 197, 198, 199, 200, 201, 202, + /* 980 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 990 */ 213, 19, 267, 287, 85, 280, 297, 300, 283, 300, + /* 1000 */ 86, 295, 288, 278, 153, 33, 300, 259, 302, 259, + /* 1010 */ 8, 9, 259, 259, 12, 13, 14, 15, 16, 47, + /* 1020 */ 295, 225, 316, 0, 52, 53, 54, 55, 56, 35, + /* 1030 */ 224, 225, 123, 327, 153, 154, 46, 331, 332, 333, + /* 1040 */ 334, 335, 336, 43, 338, 22, 259, 341, 300, 0, + /* 1050 */ 300, 345, 346, 300, 300, 89, 84, 0, 92, 87, + /* 1060 */ 12, 13, 89, 357, 43, 92, 61, 158, 159, 160, + /* 1070 */ 22, 22, 163, 168, 287, 85, 370, 288, 169, 22, + /* 1080 */ 374, 33, 295, 35, 43, 260, 86, 300, 86, 302, + /* 1090 */ 276, 182, 120, 377, 185, 43, 187, 188, 189, 190, + /* 1100 */ 191, 192, 289, 89, 56, 89, 92, 86, 92, 43, + /* 1110 */ 43, 43, 368, 300, 327, 43, 68, 43, 331, 332, + /* 1120 */ 333, 334, 335, 336, 152, 338, 43, 86, 341, 1, + /* 1130 */ 2, 268, 345, 346, 347, 226, 259, 287, 86, 326, + /* 1140 */ 327, 121, 122, 356, 43, 173, 43, 175, 43, 323, + /* 1150 */ 43, 338, 86, 86, 86, 107, 364, 268, 86, 266, + /* 1160 */ 86, 299, 168, 330, 287, 355, 348, 358, 371, 86, + /* 1170 */ 371, 228, 295, 371, 325, 20, 47, 300, 267, 302, + /* 1180 */ 324, 35, 164, 273, 318, 267, 267, 86, 148, 86, + /* 1190 */ 42, 86, 259, 86, 307, 305, 305, 267, 193, 267, + /* 1200 */ 261, 267, 20, 261, 327, 20, 322, 271, 331, 332, + /* 1210 */ 333, 334, 335, 336, 166, 338, 168, 302, 341, 271, + /* 1220 */ 287, 20, 345, 346, 20, 317, 271, 315, 295, 271, + /* 1230 */ 20, 315, 308, 300, 259, 302, 271, 267, 271, 271, + /* 1240 */ 261, 193, 194, 287, 287, 267, 287, 287, 287, 287, + /* 1250 */ 287, 287, 261, 205, 206, 207, 208, 209, 210, 211, + /* 1260 */ 327, 287, 287, 287, 331, 332, 333, 334, 335, 336, + /* 1270 */ 295, 338, 287, 322, 341, 300, 269, 302, 345, 346, + /* 1280 */ 347, 300, 174, 233, 302, 150, 269, 259, 269, 356, + /* 1290 */ 321, 267, 267, 300, 311, 315, 300, 259, 300, 300, + /* 1300 */ 311, 300, 327, 295, 309, 308, 331, 332, 333, 334, + /* 1310 */ 335, 336, 269, 338, 283, 287, 341, 295, 20, 234, + /* 1320 */ 345, 346, 347, 295, 269, 287, 300, 300, 300, 300, + /* 1330 */ 302, 356, 22, 295, 330, 300, 300, 240, 300, 229, + /* 1340 */ 302, 311, 365, 311, 157, 35, 242, 259, 225, 363, + /* 1350 */ 363, 363, 241, 295, 316, 327, 20, 259, 366, 331, + /* 1360 */ 332, 333, 334, 335, 336, 327, 338, 325, 362, 331, + /* 1370 */ 332, 333, 334, 335, 336, 287, 338, 246, 68, 249, + /* 1380 */ 329, 244, 373, 295, 372, 287, 373, 372, 300, 378, + /* 1390 */ 302, 85, 85, 295, 361, 357, 300, 360, 300, 277, + /* 1400 */ 302, 267, 269, 344, 316, 291, 36, 373, 370, 262, + /* 1410 */ 261, 372, 374, 319, 314, 327, 257, 107, 0, 331, + /* 1420 */ 332, 333, 334, 335, 336, 327, 338, 270, 0, 331, + /* 1430 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 259, + /* 1440 */ 267, 281, 281, 281, 176, 357, 0, 0, 42, 0, + /* 1450 */ 76, 0, 35, 186, 35, 35, 35, 186, 370, 0, + /* 1460 */ 35, 35, 374, 186, 0, 186, 0, 287, 295, 0, + /* 1470 */ 35, 0, 22, 35, 0, 295, 166, 85, 168, 171, + /* 1480 */ 300, 170, 302, 168, 166, 0, 0, 162, 161, 316, + /* 1490 */ 0, 0, 0, 259, 46, 0, 0, 145, 0, 0, + /* 1500 */ 0, 0, 0, 193, 194, 140, 0, 327, 335, 140, + /* 1510 */ 35, 331, 332, 333, 334, 335, 336, 259, 338, 0, + /* 1520 */ 0, 287, 42, 350, 351, 352, 0, 354, 0, 295, + /* 1530 */ 357, 0, 0, 0, 300, 0, 302, 0, 0, 0, + /* 1540 */ 0, 0, 0, 370, 0, 287, 0, 374, 0, 0, + /* 1550 */ 292, 0, 0, 295, 39, 375, 376, 0, 300, 0, + /* 1560 */ 302, 327, 0, 0, 0, 331, 332, 333, 334, 335, + /* 1570 */ 336, 259, 338, 56, 0, 341, 22, 56, 0, 0, + /* 1580 */ 346, 259, 14, 14, 0, 327, 43, 42, 0, 331, + /* 1590 */ 332, 333, 334, 335, 336, 0, 338, 0, 40, 287, + /* 1600 */ 39, 46, 46, 0, 292, 39, 0, 295, 0, 287, + /* 1610 */ 157, 0, 300, 0, 302, 62, 35, 295, 47, 39, + /* 1620 */ 0, 35, 300, 47, 302, 0, 39, 0, 35, 39, + /* 1630 */ 47, 259, 47, 35, 0, 39, 0, 0, 0, 327, + /* 1640 */ 35, 94, 92, 331, 332, 333, 334, 335, 336, 327, + /* 1650 */ 338, 22, 0, 331, 332, 333, 334, 335, 336, 287, + /* 1660 */ 338, 35, 43, 35, 43, 35, 35, 295, 35, 0, + /* 1670 */ 35, 22, 300, 22, 302, 35, 35, 0, 0, 22, + /* 1680 */ 35, 259, 0, 35, 0, 35, 0, 22, 49, 0, + /* 1690 */ 20, 369, 85, 259, 35, 0, 172, 22, 0, 327, + /* 1700 */ 0, 0, 0, 331, 332, 333, 334, 335, 336, 287, + /* 1710 */ 338, 0, 0, 153, 0, 181, 149, 295, 153, 39, + /* 1720 */ 150, 287, 300, 230, 302, 46, 292, 85, 153, 295, + /* 1730 */ 86, 85, 155, 43, 300, 230, 302, 43, 85, 85, + /* 1740 */ 151, 86, 95, 85, 230, 46, 86, 86, 376, 327, + /* 1750 */ 86, 85, 85, 331, 332, 333, 334, 335, 336, 85, + /* 1760 */ 338, 327, 340, 43, 46, 331, 332, 333, 334, 335, + /* 1770 */ 336, 259, 338, 85, 43, 46, 43, 86, 85, 43, + /* 1780 */ 46, 259, 86, 86, 46, 35, 35, 35, 35, 86, + /* 1790 */ 86, 35, 35, 2, 22, 193, 86, 224, 43, 287, + /* 1800 */ 85, 85, 22, 86, 292, 86, 85, 295, 46, 287, + /* 1810 */ 85, 85, 300, 46, 302, 85, 35, 295, 195, 96, + /* 1820 */ 35, 86, 300, 86, 302, 85, 85, 35, 86, 35, + /* 1830 */ 85, 259, 86, 35, 85, 35, 109, 109, 22, 327, + /* 1840 */ 97, 259, 35, 331, 332, 333, 334, 335, 336, 327, + /* 1850 */ 338, 259, 86, 331, 332, 333, 334, 335, 336, 287, + /* 1860 */ 338, 85, 85, 85, 85, 43, 22, 295, 109, 287, + /* 1870 */ 109, 62, 300, 61, 302, 43, 35, 295, 68, 287, + /* 1880 */ 83, 35, 300, 35, 302, 35, 35, 295, 35, 22, + /* 1890 */ 35, 35, 300, 68, 302, 35, 35, 35, 35, 327, + /* 1900 */ 35, 35, 0, 331, 332, 333, 334, 335, 336, 327, + /* 1910 */ 338, 35, 35, 331, 332, 333, 334, 335, 336, 327, + /* 1920 */ 338, 35, 47, 331, 332, 333, 334, 335, 336, 39, + /* 1930 */ 338, 0, 259, 35, 47, 39, 0, 0, 35, 47, + /* 1940 */ 39, 35, 47, 39, 0, 35, 35, 0, 22, 21, + /* 1950 */ 21, 259, 22, 20, 22, 379, 379, 379, 379, 379, + /* 1960 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, + /* 1970 */ 379, 379, 379, 300, 379, 302, 379, 379, 379, 287, + /* 1980 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 1990 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, + /* 2000 */ 327, 379, 379, 379, 331, 332, 333, 334, 335, 336, + /* 2010 */ 379, 338, 379, 259, 379, 379, 379, 379, 379, 327, + /* 2020 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, + /* 2030 */ 338, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2040 */ 379, 287, 379, 379, 379, 379, 379, 379, 379, 295, + /* 2050 */ 379, 379, 379, 379, 300, 379, 302, 287, 379, 379, + /* 2060 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, + /* 2070 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, + /* 2080 */ 379, 327, 259, 379, 379, 331, 332, 333, 334, 335, + /* 2090 */ 336, 379, 338, 379, 379, 379, 379, 327, 379, 259, + /* 2100 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 379, + /* 2110 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, + /* 2120 */ 379, 379, 379, 300, 379, 302, 379, 287, 379, 379, + /* 2130 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, + /* 2140 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, + /* 2150 */ 327, 379, 259, 379, 331, 332, 333, 334, 335, 336, + /* 2160 */ 379, 338, 379, 379, 259, 379, 379, 327, 379, 379, + /* 2170 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 379, + /* 2180 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, + /* 2190 */ 379, 379, 287, 300, 379, 302, 379, 379, 379, 379, + /* 2200 */ 295, 379, 379, 379, 379, 300, 379, 302, 379, 379, + /* 2210 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2220 */ 327, 379, 379, 379, 331, 332, 333, 334, 335, 336, + /* 2230 */ 379, 338, 327, 259, 379, 379, 331, 332, 333, 334, + /* 2240 */ 335, 336, 379, 338, 379, 379, 379, 259, 379, 379, + /* 2250 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2260 */ 379, 287, 379, 379, 379, 379, 379, 379, 379, 295, + /* 2270 */ 379, 379, 379, 379, 300, 287, 302, 379, 379, 379, + /* 2280 */ 379, 379, 379, 295, 379, 379, 379, 379, 300, 259, + /* 2290 */ 302, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2300 */ 379, 327, 379, 379, 379, 331, 332, 333, 334, 335, + /* 2310 */ 336, 379, 338, 379, 379, 327, 379, 287, 379, 331, + /* 2320 */ 332, 333, 334, 335, 336, 295, 338, 379, 379, 379, + /* 2330 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, + /* 2340 */ 379, 259, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2350 */ 379, 379, 379, 379, 379, 379, 379, 327, 379, 259, + /* 2360 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, + /* 2370 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 2380 */ 379, 379, 300, 259, 302, 379, 379, 287, 379, 379, + /* 2390 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, + /* 2400 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 327, + /* 2410 */ 379, 287, 379, 331, 332, 333, 334, 335, 336, 295, + /* 2420 */ 338, 379, 379, 379, 300, 379, 302, 327, 379, 379, + /* 2430 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 267, + /* 2440 */ 259, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2450 */ 379, 327, 379, 379, 379, 331, 332, 333, 334, 335, + /* 2460 */ 336, 379, 338, 379, 379, 379, 379, 295, 287, 379, + /* 2470 */ 379, 379, 379, 379, 379, 379, 295, 379, 379, 379, + /* 2480 */ 379, 300, 379, 302, 379, 379, 379, 379, 316, 379, + /* 2490 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2500 */ 379, 379, 379, 379, 379, 379, 379, 335, 327, 379, + /* 2510 */ 379, 379, 331, 332, 333, 334, 335, 336, 379, 338, + /* 2520 */ 379, 379, 350, 351, 352, 379, 354, 379, 379, 357, + /* 2530 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2540 */ 379, 379, 370, 379, 379, 379, 374, }; -#define YY_SHIFT_COUNT (665) +#define YY_SHIFT_COUNT (668) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2008) +#define YY_SHIFT_MAX (1947) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 911, 0, 0, 62, 62, 263, 263, 263, 320, 320, - /* 10 */ 263, 263, 521, 578, 779, 578, 578, 578, 578, 578, - /* 20 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - /* 30 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - /* 40 */ 578, 578, 209, 209, 35, 35, 35, 980, 980, 980, - /* 50 */ 980, 208, 350, 32, 32, 167, 167, 19, 19, 11, - /* 60 */ 38, 32, 32, 167, 167, 167, 167, 167, 167, 167, - /* 70 */ 167, 167, 182, 167, 167, 167, 230, 352, 167, 167, - /* 80 */ 352, 438, 167, 352, 352, 352, 167, 452, 775, 231, - /* 90 */ 489, 489, 13, 98, 730, 730, 730, 730, 730, 730, - /* 100 */ 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, - /* 110 */ 730, 730, 730, 418, 38, 522, 522, 383, 567, 576, - /* 120 */ 480, 480, 480, 567, 558, 230, 1, 1, 352, 352, - /* 130 */ 585, 585, 663, 696, 201, 201, 201, 201, 201, 201, - /* 140 */ 201, 1594, 125, 684, 119, 573, 69, 313, 343, 351, - /* 150 */ 631, 529, 494, 39, 548, 514, 673, 514, 708, 842, - /* 160 */ 842, 842, 250, 666, 1045, 916, 1125, 1116, 1133, 1011, - /* 170 */ 1125, 1125, 1152, 1067, 1067, 1125, 1125, 1125, 1203, 1203, - /* 180 */ 1208, 182, 230, 182, 1212, 1215, 182, 1212, 182, 1228, - /* 190 */ 182, 182, 1125, 182, 1203, 352, 352, 352, 352, 352, - /* 200 */ 352, 352, 352, 352, 352, 352, 1125, 1203, 585, 1208, - /* 210 */ 452, 1108, 230, 452, 1125, 1125, 1212, 452, 1074, 585, - /* 220 */ 585, 585, 585, 1074, 585, 1177, 558, 1228, 452, 663, - /* 230 */ 452, 558, 1325, 585, 1114, 1074, 585, 585, 1114, 1074, - /* 240 */ 585, 585, 352, 1121, 1206, 1114, 1123, 1147, 1160, 916, - /* 250 */ 1166, 558, 1376, 1154, 1158, 1155, 1154, 1158, 1154, 1158, - /* 260 */ 1317, 1045, 585, 696, 1125, 452, 1375, 1203, 2318, 2318, - /* 270 */ 2318, 2318, 2318, 2318, 2318, 601, 910, 386, 1241, 469, - /* 280 */ 551, 682, 840, 879, 853, 727, 1037, 314, 314, 314, - /* 290 */ 314, 314, 314, 314, 314, 1061, 699, 274, 274, 445, - /* 300 */ 65, 108, 156, 44, 168, 602, 339, 200, 200, 200, - /* 310 */ 200, 297, 784, 843, 848, 862, 912, 57, 850, 928, - /* 320 */ 92, 864, 990, 1039, 1040, 1051, 1052, 1054, 1063, 819, - /* 330 */ 762, 702, 883, 1064, 771, 994, 812, 1066, 1043, 1096, - /* 340 */ 1117, 1118, 1126, 1127, 1128, 937, 906, 1056, 1435, 1270, - /* 350 */ 1448, 1457, 1416, 1459, 1384, 1461, 1427, 1278, 1428, 1431, - /* 360 */ 1432, 1282, 1469, 1437, 1438, 1284, 1474, 1289, 1477, 1443, - /* 370 */ 1480, 1460, 1481, 1452, 1485, 1403, 1318, 1320, 1324, 1328, - /* 380 */ 1495, 1497, 1337, 1339, 1502, 1503, 1458, 1505, 1507, 1509, - /* 390 */ 1365, 1512, 1513, 1514, 1524, 1525, 1396, 1491, 1543, 1405, - /* 400 */ 1546, 1547, 1548, 1558, 1559, 1560, 1561, 1566, 1567, 1569, - /* 410 */ 1570, 1572, 1573, 1574, 1508, 1551, 1552, 1553, 1554, 1555, - /* 420 */ 1556, 1557, 1575, 1577, 1580, 1581, 1583, 1528, 1585, 1530, - /* 430 */ 1587, 1590, 1549, 1562, 1563, 1578, 1571, 1591, 1576, 1599, - /* 440 */ 1564, 1579, 1619, 1620, 1623, 1586, 1471, 1626, 1632, 1633, - /* 450 */ 1589, 1634, 1635, 1601, 1568, 1598, 1638, 1604, 1593, 1606, - /* 460 */ 1642, 1608, 1605, 1614, 1654, 1622, 1612, 1616, 1668, 1669, - /* 470 */ 1670, 1674, 1582, 1592, 1640, 1655, 1679, 1647, 1648, 1651, - /* 480 */ 1653, 1646, 1649, 1656, 1658, 1659, 1660, 1690, 1675, 1696, - /* 490 */ 1677, 1652, 1700, 1688, 1676, 1713, 1680, 1722, 1689, 1725, - /* 500 */ 1704, 1707, 1728, 1584, 1694, 1731, 1588, 1710, 1595, 1597, - /* 510 */ 1733, 1734, 1600, 1602, 1735, 1738, 1739, 1671, 1666, 1596, - /* 520 */ 1740, 1678, 1610, 1683, 1741, 1703, 1613, 1685, 1650, 1697, - /* 530 */ 1711, 1526, 1687, 1673, 1705, 1693, 1702, 1709, 1721, 1714, - /* 540 */ 1712, 1716, 1726, 1724, 1732, 1719, 1743, 1727, 1752, 1545, - /* 550 */ 1729, 1730, 1750, 1607, 1756, 1767, 1768, 1745, 1774, 1609, - /* 560 */ 1746, 1784, 1786, 1799, 1802, 1804, 1805, 1746, 1839, 1820, - /* 570 */ 1661, 1800, 1760, 1761, 1763, 1764, 1770, 1766, 1807, 1771, - /* 580 */ 1772, 1812, 1824, 1664, 1777, 1776, 1788, 1828, 1835, 1790, - /* 590 */ 1791, 1843, 1794, 1806, 1851, 1803, 1808, 1855, 1810, 1813, - /* 600 */ 1856, 1811, 1789, 1796, 1797, 1798, 1871, 1814, 1815, 1818, - /* 610 */ 1873, 1827, 1867, 1867, 1891, 1857, 1859, 1882, 1850, 1838, - /* 620 */ 1879, 1888, 1889, 1892, 1893, 1895, 1904, 1896, 1897, 1874, - /* 630 */ 1646, 1909, 1649, 1919, 1920, 1922, 1924, 1925, 1927, 1928, - /* 640 */ 1964, 1930, 1923, 1932, 1969, 1937, 1926, 1935, 1976, 1942, - /* 650 */ 1931, 1945, 1979, 1946, 1938, 1947, 1996, 1968, 1971, 2008, - /* 660 */ 1987, 1989, 1997, 1998, 2000, 2002, + /* 0 */ 909, 0, 0, 57, 57, 259, 259, 259, 316, 316, + /* 10 */ 259, 259, 518, 575, 777, 575, 575, 575, 575, 575, + /* 20 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, + /* 30 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, + /* 40 */ 575, 575, 54, 54, 53, 53, 53, 1048, 1048, 86, + /* 50 */ 1048, 1048, 80, 418, 153, 204, 153, 19, 19, 436, + /* 60 */ 436, 100, 61, 153, 153, 19, 19, 19, 19, 19, + /* 70 */ 19, 19, 19, 19, 233, 19, 19, 19, 97, 255, + /* 80 */ 19, 19, 255, 354, 19, 255, 255, 255, 19, 444, + /* 90 */ 773, 227, 485, 485, 122, 414, 1310, 1310, 1310, 1310, + /* 100 */ 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, + /* 110 */ 1310, 1310, 1310, 1310, 1310, 303, 61, 523, 523, 287, + /* 120 */ 127, 371, 358, 358, 358, 127, 618, 97, 399, 399, + /* 130 */ 255, 255, 590, 590, 599, 736, 650, 650, 650, 650, + /* 140 */ 650, 650, 650, 972, 21, 495, 420, 150, 404, 385, + /* 150 */ 430, 637, 671, 202, 894, 248, 811, 806, 796, 806, + /* 160 */ 853, 710, 710, 710, 180, 288, 943, 1155, 1129, 1146, + /* 170 */ 1018, 1155, 1155, 1148, 1040, 1040, 1155, 1155, 1155, 1182, + /* 180 */ 1182, 1185, 233, 97, 233, 1201, 1204, 233, 1201, 233, + /* 190 */ 1210, 233, 233, 1155, 233, 1182, 255, 255, 255, 255, + /* 200 */ 255, 255, 255, 255, 255, 255, 255, 1155, 1182, 590, + /* 210 */ 1185, 444, 1108, 97, 444, 1155, 1155, 1201, 444, 1050, + /* 220 */ 590, 590, 590, 590, 1050, 590, 1135, 618, 1210, 444, + /* 230 */ 599, 444, 618, 1298, 590, 1085, 1050, 590, 590, 1085, + /* 240 */ 1050, 590, 590, 255, 1097, 1187, 1085, 1104, 1111, 1110, + /* 250 */ 943, 1123, 618, 1336, 1131, 1137, 1130, 1131, 1137, 1131, + /* 260 */ 1137, 1306, 1307, 590, 736, 1155, 444, 1370, 1182, 2547, + /* 270 */ 2547, 2547, 2547, 2547, 2547, 2547, 339, 134, 273, 579, + /* 280 */ 661, 724, 838, 921, 946, 851, 1002, 473, 51, 51, + /* 290 */ 51, 51, 51, 51, 51, 51, 698, 774, 145, 145, + /* 300 */ 359, 471, 190, 429, 585, 13, 708, 428, 673, 673, + /* 310 */ 673, 673, 84, 823, 800, 966, 973, 1014, 1016, 1023, + /* 320 */ 1049, 1057, 488, 881, 914, 1000, 1021, 1041, 1052, 1066, + /* 330 */ 1068, 1128, 1020, 206, 559, 1072, 905, 994, 1005, 1067, + /* 340 */ 990, 1074, 1083, 1101, 1103, 1105, 1107, 763, 757, 556, + /* 350 */ 1418, 1428, 1268, 1446, 1447, 1406, 1449, 1374, 1451, 1417, + /* 360 */ 1267, 1419, 1420, 1421, 1271, 1459, 1425, 1426, 1277, 1464, + /* 370 */ 1279, 1466, 1435, 1469, 1450, 1471, 1438, 1474, 1392, 1308, + /* 380 */ 1311, 1315, 1318, 1485, 1486, 1325, 1327, 1490, 1491, 1448, + /* 390 */ 1492, 1495, 1496, 1352, 1498, 1499, 1500, 1501, 1502, 1365, + /* 400 */ 1475, 1506, 1369, 1519, 1520, 1526, 1528, 1531, 1532, 1533, + /* 410 */ 1535, 1537, 1538, 1539, 1540, 1541, 1542, 1480, 1544, 1546, + /* 420 */ 1548, 1549, 1551, 1552, 1554, 1557, 1559, 1562, 1563, 1564, + /* 430 */ 1517, 1574, 1521, 1578, 1579, 1545, 1515, 1543, 1568, 1555, + /* 440 */ 1569, 1556, 1584, 1558, 1561, 1588, 1595, 1597, 1566, 1453, + /* 450 */ 1603, 1606, 1608, 1553, 1611, 1613, 1581, 1571, 1580, 1620, + /* 460 */ 1586, 1576, 1587, 1625, 1593, 1583, 1590, 1627, 1598, 1585, + /* 470 */ 1596, 1634, 1636, 1637, 1638, 1547, 1550, 1605, 1629, 1652, + /* 480 */ 1626, 1628, 1630, 1631, 1619, 1621, 1633, 1635, 1640, 1641, + /* 490 */ 1669, 1649, 1677, 1651, 1639, 1678, 1657, 1645, 1682, 1648, + /* 500 */ 1684, 1650, 1686, 1665, 1670, 1689, 1560, 1659, 1695, 1524, + /* 510 */ 1675, 1565, 1570, 1698, 1700, 1575, 1577, 1701, 1702, 1711, + /* 520 */ 1607, 1644, 1534, 1712, 1642, 1589, 1646, 1714, 1680, 1567, + /* 530 */ 1653, 1647, 1679, 1690, 1493, 1654, 1655, 1658, 1660, 1661, + /* 540 */ 1666, 1694, 1664, 1667, 1674, 1688, 1691, 1720, 1699, 1718, + /* 550 */ 1693, 1731, 1505, 1696, 1697, 1729, 1573, 1733, 1734, 1738, + /* 560 */ 1703, 1736, 1514, 1704, 1750, 1751, 1752, 1753, 1756, 1757, + /* 570 */ 1704, 1791, 1772, 1602, 1755, 1715, 1710, 1716, 1717, 1721, + /* 580 */ 1719, 1762, 1725, 1726, 1767, 1780, 1623, 1730, 1723, 1735, + /* 590 */ 1781, 1785, 1740, 1737, 1792, 1741, 1742, 1794, 1745, 1746, + /* 600 */ 1798, 1749, 1766, 1800, 1776, 1727, 1728, 1759, 1761, 1816, + /* 610 */ 1743, 1777, 1778, 1807, 1779, 1822, 1822, 1844, 1809, 1812, + /* 620 */ 1841, 1810, 1797, 1832, 1846, 1848, 1850, 1851, 1853, 1867, + /* 630 */ 1855, 1856, 1825, 1619, 1860, 1621, 1861, 1862, 1863, 1865, + /* 640 */ 1866, 1876, 1877, 1902, 1886, 1875, 1890, 1931, 1898, 1887, + /* 650 */ 1896, 1936, 1903, 1892, 1901, 1937, 1906, 1895, 1904, 1944, + /* 660 */ 1910, 1911, 1947, 1926, 1928, 1930, 1932, 1929, 1933, }; -#define YY_REDUCE_COUNT (274) -#define YY_REDUCE_MIN (-312) -#define YY_REDUCE_MAX (1950) +#define YY_REDUCE_COUNT (275) +#define YY_REDUCE_MIN (-294) +#define YY_REDUCE_MAX (2181) static const short yy_reduce_ofst[] = { - /* 0 */ -78, -232, 63, 286, -113, 709, 787, 865, 907, 968, - /* 10 */ 545, 978, 1035, 1049, 1099, 1119, 1185, 1197, 1207, 1263, - /* 20 */ 1277, 1330, 1372, 1386, 1450, 1472, 1492, 1534, 1550, 1603, - /* 30 */ 1615, 1657, 1667, 1681, 1737, 1747, 1759, 1825, 1837, 1890, - /* 40 */ 1940, 1950, -263, 1944, -14, 75, 305, -278, 55, 270, - /* 50 */ 726, -296, 123, 184, 643, -266, -43, -260, -256, -303, - /* 60 */ -186, -230, -191, -185, 97, 315, 316, 363, 557, 563, - /* 70 */ 564, 566, -154, 659, 661, 665, -285, -106, 667, 732, - /* 80 */ 59, 24, 734, 72, 322, 82, 753, 70, -252, -312, - /* 90 */ -312, -312, -117, -239, -114, -20, 141, 181, 196, 289, - /* 100 */ 328, 435, 455, 505, 575, 672, 766, 769, 773, 780, - /* 110 */ 792, 809, 817, 299, -110, 124, 138, -220, 148, -243, - /* 120 */ 218, 310, 364, 150, 354, 349, 336, 456, 319, 205, - /* 130 */ 474, 498, 476, 562, -280, -270, 382, 513, 538, 633, - /* 140 */ 669, 641, 748, 366, 644, 654, 756, 735, 695, 791, - /* 150 */ 791, 811, 825, 794, 776, 757, 757, 757, 763, 742, - /* 160 */ 744, 745, 778, 791, 851, 820, 881, 844, 900, 859, - /* 170 */ 917, 926, 901, 913, 914, 950, 953, 955, 964, 965, - /* 180 */ 908, 957, 929, 961, 920, 927, 976, 933, 979, 943, - /* 190 */ 981, 982, 987, 985, 996, 971, 972, 973, 975, 984, - /* 200 */ 989, 992, 995, 998, 999, 1000, 1002, 1005, 967, 952, - /* 210 */ 1003, 969, 986, 1022, 1025, 1029, 1006, 1028, 1004, 1017, - /* 220 */ 1018, 1020, 1027, 1021, 1031, 1024, 1044, 1026, 1071, 1058, - /* 230 */ 1076, 1048, 1023, 1047, 991, 1041, 1050, 1055, 993, 1046, - /* 240 */ 1059, 1060, 791, 997, 1012, 1016, 1030, 1032, 1036, 1065, - /* 250 */ 757, 1100, 1069, 1034, 1033, 1038, 1042, 1057, 1068, 1070, - /* 260 */ 1073, 1122, 1109, 1131, 1143, 1149, 1161, 1159, 1103, 1113, - /* 270 */ 1157, 1162, 1167, 1169, 1171, + /* 0 */ -254, -201, 706, 23, 282, 787, 933, 975, 1038, 1088, + /* 10 */ 542, 877, 1098, 1180, 1234, 1258, 1312, 1322, 1372, 1422, + /* 20 */ 1434, 1512, 1028, 1522, 1572, 1582, 1592, 1673, 1692, 1754, + /* 30 */ 1770, 1823, 1840, 1893, 1905, 1974, 1988, 2030, 2082, 2100, + /* 40 */ 2124, 2181, 1173, 2172, -240, -263, -19, 207, 352, -277, + /* 50 */ 345, 813, -142, -141, -140, -79, 3, -267, 29, -260, + /* 60 */ -229, -274, -258, -143, -40, -159, 70, 285, 327, 329, + /* 70 */ 369, 370, 531, 535, -270, 541, 554, 560, -294, -272, + /* 80 */ 561, 594, 59, -257, 674, -124, 89, 270, 725, 377, + /* 90 */ -226, -219, -219, -219, -176, -247, -202, -15, 52, 63, + /* 100 */ 247, 394, 434, 507, 511, 581, 582, 626, 663, 672, + /* 110 */ 697, 748, 750, 753, 754, -158, -82, -162, -87, -262, + /* 120 */ 68, -215, 406, 589, 596, 215, 305, 379, 83, 236, + /* 130 */ 509, 298, 445, 699, 715, 469, 362, 591, 633, 640, + /* 140 */ 656, 714, 789, 631, 825, 814, 716, 744, 863, 826, + /* 150 */ 792, 850, 850, 889, 893, 862, 833, 810, 810, 810, + /* 160 */ 818, 797, 799, 802, 809, 850, 849, 911, 856, 910, + /* 170 */ 866, 918, 919, 887, 890, 891, 930, 932, 934, 939, + /* 180 */ 942, 884, 936, 915, 948, 912, 908, 955, 916, 958, + /* 190 */ 924, 965, 967, 970, 968, 979, 956, 957, 959, 960, + /* 200 */ 961, 962, 963, 964, 974, 976, 985, 978, 991, 981, + /* 210 */ 951, 1007, 969, 982, 1017, 1024, 1025, 980, 1019, 983, + /* 220 */ 993, 996, 998, 999, 989, 1001, 995, 1008, 997, 1043, + /* 230 */ 1031, 1055, 1022, 1004, 1026, 986, 1030, 1027, 1029, 987, + /* 240 */ 1032, 1035, 1036, 850, 992, 977, 988, 1006, 1033, 1037, + /* 250 */ 1042, 810, 1058, 1051, 1009, 1012, 1011, 1013, 1015, 1034, + /* 260 */ 1039, 1059, 1114, 1096, 1122, 1134, 1133, 1147, 1149, 1094, + /* 270 */ 1100, 1160, 1161, 1162, 1157, 1159, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 10 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 20 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 30 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 40 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 50 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 60 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 70 */ 1459, 1459, 1533, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 80 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1531, 1686, 1459, - /* 90 */ 1864, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 100 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 110 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1533, 1459, 1531, - /* 120 */ 1876, 1876, 1876, 1459, 1459, 1459, 1730, 1730, 1459, 1459, - /* 130 */ 1459, 1459, 1629, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 140 */ 1459, 1722, 1459, 1459, 1945, 1459, 1459, 1728, 1899, 1459, - /* 150 */ 1459, 1459, 1459, 1582, 1891, 1868, 1882, 1869, 1866, 1930, - /* 160 */ 1930, 1930, 1885, 1459, 1598, 1895, 1459, 1459, 1459, 1714, - /* 170 */ 1459, 1459, 1691, 1688, 1688, 1459, 1459, 1459, 1459, 1459, - /* 180 */ 1459, 1533, 1459, 1533, 1459, 1459, 1533, 1459, 1533, 1459, - /* 190 */ 1533, 1533, 1459, 1533, 1459, 1459, 1459, 1459, 1459, 1459, - /* 200 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 210 */ 1531, 1724, 1459, 1531, 1459, 1459, 1459, 1531, 1904, 1459, - /* 220 */ 1459, 1459, 1459, 1904, 1459, 1459, 1459, 1459, 1531, 1459, - /* 230 */ 1531, 1459, 1459, 1459, 1906, 1904, 1459, 1459, 1906, 1904, - /* 240 */ 1459, 1459, 1459, 1918, 1914, 1906, 1922, 1920, 1897, 1895, - /* 250 */ 1882, 1459, 1459, 1936, 1932, 1948, 1936, 1932, 1936, 1932, - /* 260 */ 1459, 1598, 1459, 1459, 1459, 1531, 1491, 1459, 1716, 1730, - /* 270 */ 1632, 1632, 1632, 1534, 1464, 1459, 1459, 1459, 1459, 1459, - /* 280 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1802, 1917, 1916, - /* 290 */ 1840, 1839, 1838, 1836, 1801, 1459, 1594, 1800, 1799, 1459, - /* 300 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1793, 1794, 1792, - /* 310 */ 1791, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 320 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1865, - /* 330 */ 1459, 1933, 1937, 1459, 1459, 1459, 1459, 1459, 1776, 1459, - /* 340 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 350 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 360 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 370 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 380 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 390 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 400 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 410 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 420 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 430 */ 1459, 1459, 1459, 1459, 1496, 1459, 1459, 1459, 1459, 1459, - /* 440 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 450 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 460 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 470 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 480 */ 1459, 1563, 1562, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 490 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 500 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 510 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 520 */ 1734, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 530 */ 1898, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 540 */ 1459, 1459, 1459, 1459, 1459, 1459, 1776, 1459, 1915, 1459, - /* 550 */ 1875, 1871, 1459, 1459, 1867, 1775, 1459, 1459, 1931, 1459, - /* 560 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1860, 1459, - /* 570 */ 1459, 1833, 1818, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 580 */ 1459, 1459, 1459, 1787, 1459, 1459, 1459, 1459, 1459, 1626, - /* 590 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 600 */ 1459, 1459, 1611, 1609, 1608, 1607, 1459, 1604, 1459, 1459, - /* 610 */ 1459, 1459, 1635, 1634, 1459, 1459, 1459, 1459, 1459, 1459, - /* 620 */ 1554, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 630 */ 1545, 1459, 1544, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 640 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 650 */ 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, 1459, - /* 660 */ 1459, 1459, 1459, 1459, 1459, 1459, + /* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 10 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 20 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 30 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 40 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465, + /* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1537, + /* 90 */ 1692, 1465, 1872, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1539, + /* 120 */ 1465, 1537, 1884, 1884, 1884, 1465, 1465, 1465, 1736, 1736, + /* 130 */ 1465, 1465, 1465, 1465, 1635, 1465, 1465, 1465, 1465, 1465, + /* 140 */ 1465, 1465, 1465, 1728, 1465, 1465, 1953, 1465, 1465, 1734, + /* 150 */ 1907, 1465, 1465, 1465, 1465, 1588, 1899, 1876, 1890, 1877, + /* 160 */ 1874, 1938, 1938, 1938, 1893, 1465, 1903, 1465, 1465, 1465, + /* 170 */ 1720, 1465, 1465, 1697, 1694, 1694, 1465, 1465, 1465, 1465, + /* 180 */ 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, 1539, + /* 190 */ 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465, 1465, + /* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 210 */ 1465, 1537, 1730, 1465, 1537, 1465, 1465, 1465, 1537, 1912, + /* 220 */ 1465, 1465, 1465, 1465, 1912, 1465, 1465, 1465, 1465, 1537, + /* 230 */ 1465, 1537, 1465, 1465, 1465, 1914, 1912, 1465, 1465, 1914, + /* 240 */ 1912, 1465, 1465, 1465, 1926, 1922, 1914, 1930, 1928, 1905, + /* 250 */ 1903, 1890, 1465, 1465, 1944, 1940, 1956, 1944, 1940, 1944, + /* 260 */ 1940, 1465, 1604, 1465, 1465, 1465, 1537, 1497, 1465, 1722, + /* 270 */ 1736, 1638, 1638, 1638, 1540, 1470, 1465, 1465, 1465, 1465, + /* 280 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1809, 1925, + /* 290 */ 1924, 1848, 1847, 1846, 1844, 1808, 1465, 1600, 1807, 1806, + /* 300 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1800, 1801, + /* 310 */ 1799, 1798, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 320 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 330 */ 1465, 1873, 1465, 1941, 1945, 1465, 1465, 1465, 1465, 1465, + /* 340 */ 1783, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 350 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 360 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 370 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 380 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 390 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 400 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 410 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 420 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 430 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1502, 1465, 1465, + /* 440 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 450 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 460 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 470 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 480 */ 1465, 1465, 1465, 1465, 1569, 1568, 1465, 1465, 1465, 1465, + /* 490 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 500 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 510 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 520 */ 1465, 1465, 1465, 1740, 1465, 1465, 1465, 1465, 1465, 1465, + /* 530 */ 1465, 1465, 1465, 1906, 1465, 1465, 1465, 1465, 1465, 1465, + /* 540 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1783, + /* 550 */ 1465, 1923, 1465, 1883, 1879, 1465, 1465, 1875, 1782, 1465, + /* 560 */ 1465, 1939, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 570 */ 1465, 1868, 1465, 1465, 1841, 1826, 1465, 1465, 1465, 1465, + /* 580 */ 1465, 1465, 1465, 1465, 1465, 1465, 1794, 1465, 1465, 1465, + /* 590 */ 1465, 1465, 1632, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 600 */ 1465, 1465, 1465, 1465, 1465, 1617, 1615, 1614, 1613, 1465, + /* 610 */ 1610, 1465, 1465, 1465, 1465, 1641, 1640, 1465, 1465, 1465, + /* 620 */ 1465, 1465, 1465, 1560, 1465, 1465, 1465, 1465, 1465, 1465, + /* 630 */ 1465, 1465, 1465, 1551, 1465, 1550, 1465, 1465, 1465, 1465, + /* 640 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 650 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 660 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1075,10 +1121,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_ARROW => nothing */ 0, /* ROWTS => nothing */ 0, /* TBNAME => nothing */ - 0, /* QSTARTTS => nothing */ - 0, /* QENDTS => nothing */ - 0, /* WSTARTTS => nothing */ - 0, /* WENDTS => nothing */ + 0, /* QSTART => nothing */ + 0, /* QEND => nothing */ + 0, /* QDURATION => nothing */ + 0, /* WSTART => nothing */ + 0, /* WEND => nothing */ 0, /* WDURATION => nothing */ 0, /* CAST => nothing */ 0, /* NOW => nothing */ @@ -1127,11 +1174,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 249, /* NK_BITNOT => ID */ - 249, /* VALUES => ID */ - 249, /* IMPORT => ID */ - 249, /* NK_SEMI => ID */ - 249, /* FILE => ID */ + 250, /* NK_BITNOT => ID */ + 250, /* VALUES => ID */ + 250, /* IMPORT => ID */ + 250, /* NK_SEMI => ID */ + 250, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1417,186 +1464,187 @@ static const char *const yyTokenName[] = { /* 195 */ "NK_ARROW", /* 196 */ "ROWTS", /* 197 */ "TBNAME", - /* 198 */ "QSTARTTS", - /* 199 */ "QENDTS", - /* 200 */ "WSTARTTS", - /* 201 */ "WENDTS", - /* 202 */ "WDURATION", - /* 203 */ "CAST", - /* 204 */ "NOW", - /* 205 */ "TODAY", - /* 206 */ "TIMEZONE", - /* 207 */ "CLIENT_VERSION", - /* 208 */ "SERVER_VERSION", - /* 209 */ "SERVER_STATUS", - /* 210 */ "CURRENT_USER", - /* 211 */ "COUNT", - /* 212 */ "LAST_ROW", - /* 213 */ "BETWEEN", - /* 214 */ "IS", - /* 215 */ "NK_LT", - /* 216 */ "NK_GT", - /* 217 */ "NK_LE", - /* 218 */ "NK_GE", - /* 219 */ "NK_NE", - /* 220 */ "MATCH", - /* 221 */ "NMATCH", - /* 222 */ "CONTAINS", - /* 223 */ "JOIN", - /* 224 */ "INNER", - /* 225 */ "SELECT", - /* 226 */ "DISTINCT", - /* 227 */ "WHERE", - /* 228 */ "PARTITION", - /* 229 */ "BY", - /* 230 */ "SESSION", - /* 231 */ "STATE_WINDOW", - /* 232 */ "SLIDING", - /* 233 */ "FILL", - /* 234 */ "VALUE", - /* 235 */ "NONE", - /* 236 */ "PREV", - /* 237 */ "LINEAR", - /* 238 */ "NEXT", - /* 239 */ "HAVING", - /* 240 */ "RANGE", - /* 241 */ "EVERY", - /* 242 */ "ORDER", - /* 243 */ "SLIMIT", - /* 244 */ "SOFFSET", - /* 245 */ "LIMIT", - /* 246 */ "OFFSET", - /* 247 */ "ASC", - /* 248 */ "NULLS", - /* 249 */ "ID", - /* 250 */ "NK_BITNOT", - /* 251 */ "VALUES", - /* 252 */ "IMPORT", - /* 253 */ "NK_SEMI", - /* 254 */ "FILE", - /* 255 */ "cmd", - /* 256 */ "account_options", - /* 257 */ "alter_account_options", - /* 258 */ "literal", - /* 259 */ "alter_account_option", - /* 260 */ "user_name", - /* 261 */ "sysinfo_opt", - /* 262 */ "privileges", - /* 263 */ "priv_level", - /* 264 */ "priv_type_list", - /* 265 */ "priv_type", - /* 266 */ "db_name", - /* 267 */ "dnode_endpoint", - /* 268 */ "not_exists_opt", - /* 269 */ "db_options", - /* 270 */ "exists_opt", - /* 271 */ "alter_db_options", - /* 272 */ "integer_list", - /* 273 */ "variable_list", - /* 274 */ "retention_list", - /* 275 */ "alter_db_option", - /* 276 */ "retention", - /* 277 */ "full_table_name", - /* 278 */ "column_def_list", - /* 279 */ "tags_def_opt", - /* 280 */ "table_options", - /* 281 */ "multi_create_clause", - /* 282 */ "tags_def", - /* 283 */ "multi_drop_clause", - /* 284 */ "alter_table_clause", - /* 285 */ "alter_table_options", - /* 286 */ "column_name", - /* 287 */ "type_name", - /* 288 */ "signed_literal", - /* 289 */ "create_subtable_clause", - /* 290 */ "specific_cols_opt", - /* 291 */ "expression_list", - /* 292 */ "drop_table_clause", - /* 293 */ "col_name_list", - /* 294 */ "table_name", - /* 295 */ "column_def", - /* 296 */ "duration_list", - /* 297 */ "rollup_func_list", - /* 298 */ "alter_table_option", - /* 299 */ "duration_literal", - /* 300 */ "rollup_func_name", - /* 301 */ "function_name", - /* 302 */ "col_name", - /* 303 */ "db_name_cond_opt", - /* 304 */ "like_pattern_opt", - /* 305 */ "table_name_cond", - /* 306 */ "from_db_opt", - /* 307 */ "index_name", - /* 308 */ "index_options", - /* 309 */ "func_list", - /* 310 */ "sliding_opt", - /* 311 */ "sma_stream_opt", - /* 312 */ "func", - /* 313 */ "stream_options", - /* 314 */ "topic_name", - /* 315 */ "query_expression", - /* 316 */ "cgroup_name", - /* 317 */ "analyze_opt", - /* 318 */ "explain_options", - /* 319 */ "agg_func_opt", - /* 320 */ "bufsize_opt", - /* 321 */ "stream_name", - /* 322 */ "into_opt", - /* 323 */ "dnode_list", - /* 324 */ "where_clause_opt", - /* 325 */ "signed", - /* 326 */ "literal_func", - /* 327 */ "literal_list", - /* 328 */ "table_alias", - /* 329 */ "column_alias", - /* 330 */ "expression", - /* 331 */ "pseudo_column", - /* 332 */ "column_reference", - /* 333 */ "function_expression", - /* 334 */ "subquery", - /* 335 */ "star_func", - /* 336 */ "star_func_para_list", - /* 337 */ "noarg_func", - /* 338 */ "other_para_list", - /* 339 */ "star_func_para", - /* 340 */ "predicate", - /* 341 */ "compare_op", - /* 342 */ "in_op", - /* 343 */ "in_predicate_value", - /* 344 */ "boolean_value_expression", - /* 345 */ "boolean_primary", - /* 346 */ "common_expression", - /* 347 */ "from_clause_opt", - /* 348 */ "table_reference_list", - /* 349 */ "table_reference", - /* 350 */ "table_primary", - /* 351 */ "joined_table", - /* 352 */ "alias_opt", - /* 353 */ "parenthesized_joined_table", - /* 354 */ "join_type", - /* 355 */ "search_condition", - /* 356 */ "query_specification", - /* 357 */ "set_quantifier_opt", - /* 358 */ "select_list", - /* 359 */ "partition_by_clause_opt", - /* 360 */ "range_opt", - /* 361 */ "every_opt", - /* 362 */ "fill_opt", - /* 363 */ "twindow_clause_opt", - /* 364 */ "group_by_clause_opt", - /* 365 */ "having_clause_opt", - /* 366 */ "select_item", - /* 367 */ "fill_mode", - /* 368 */ "group_by_list", - /* 369 */ "query_expression_body", - /* 370 */ "order_by_clause_opt", - /* 371 */ "slimit_clause_opt", - /* 372 */ "limit_clause_opt", - /* 373 */ "query_primary", - /* 374 */ "sort_specification_list", - /* 375 */ "sort_specification", - /* 376 */ "ordering_specification_opt", - /* 377 */ "null_ordering_opt", + /* 198 */ "QSTART", + /* 199 */ "QEND", + /* 200 */ "QDURATION", + /* 201 */ "WSTART", + /* 202 */ "WEND", + /* 203 */ "WDURATION", + /* 204 */ "CAST", + /* 205 */ "NOW", + /* 206 */ "TODAY", + /* 207 */ "TIMEZONE", + /* 208 */ "CLIENT_VERSION", + /* 209 */ "SERVER_VERSION", + /* 210 */ "SERVER_STATUS", + /* 211 */ "CURRENT_USER", + /* 212 */ "COUNT", + /* 213 */ "LAST_ROW", + /* 214 */ "BETWEEN", + /* 215 */ "IS", + /* 216 */ "NK_LT", + /* 217 */ "NK_GT", + /* 218 */ "NK_LE", + /* 219 */ "NK_GE", + /* 220 */ "NK_NE", + /* 221 */ "MATCH", + /* 222 */ "NMATCH", + /* 223 */ "CONTAINS", + /* 224 */ "JOIN", + /* 225 */ "INNER", + /* 226 */ "SELECT", + /* 227 */ "DISTINCT", + /* 228 */ "WHERE", + /* 229 */ "PARTITION", + /* 230 */ "BY", + /* 231 */ "SESSION", + /* 232 */ "STATE_WINDOW", + /* 233 */ "SLIDING", + /* 234 */ "FILL", + /* 235 */ "VALUE", + /* 236 */ "NONE", + /* 237 */ "PREV", + /* 238 */ "LINEAR", + /* 239 */ "NEXT", + /* 240 */ "HAVING", + /* 241 */ "RANGE", + /* 242 */ "EVERY", + /* 243 */ "ORDER", + /* 244 */ "SLIMIT", + /* 245 */ "SOFFSET", + /* 246 */ "LIMIT", + /* 247 */ "OFFSET", + /* 248 */ "ASC", + /* 249 */ "NULLS", + /* 250 */ "ID", + /* 251 */ "NK_BITNOT", + /* 252 */ "VALUES", + /* 253 */ "IMPORT", + /* 254 */ "NK_SEMI", + /* 255 */ "FILE", + /* 256 */ "cmd", + /* 257 */ "account_options", + /* 258 */ "alter_account_options", + /* 259 */ "literal", + /* 260 */ "alter_account_option", + /* 261 */ "user_name", + /* 262 */ "sysinfo_opt", + /* 263 */ "privileges", + /* 264 */ "priv_level", + /* 265 */ "priv_type_list", + /* 266 */ "priv_type", + /* 267 */ "db_name", + /* 268 */ "dnode_endpoint", + /* 269 */ "not_exists_opt", + /* 270 */ "db_options", + /* 271 */ "exists_opt", + /* 272 */ "alter_db_options", + /* 273 */ "integer_list", + /* 274 */ "variable_list", + /* 275 */ "retention_list", + /* 276 */ "alter_db_option", + /* 277 */ "retention", + /* 278 */ "full_table_name", + /* 279 */ "column_def_list", + /* 280 */ "tags_def_opt", + /* 281 */ "table_options", + /* 282 */ "multi_create_clause", + /* 283 */ "tags_def", + /* 284 */ "multi_drop_clause", + /* 285 */ "alter_table_clause", + /* 286 */ "alter_table_options", + /* 287 */ "column_name", + /* 288 */ "type_name", + /* 289 */ "signed_literal", + /* 290 */ "create_subtable_clause", + /* 291 */ "specific_cols_opt", + /* 292 */ "expression_list", + /* 293 */ "drop_table_clause", + /* 294 */ "col_name_list", + /* 295 */ "table_name", + /* 296 */ "column_def", + /* 297 */ "duration_list", + /* 298 */ "rollup_func_list", + /* 299 */ "alter_table_option", + /* 300 */ "duration_literal", + /* 301 */ "rollup_func_name", + /* 302 */ "function_name", + /* 303 */ "col_name", + /* 304 */ "db_name_cond_opt", + /* 305 */ "like_pattern_opt", + /* 306 */ "table_name_cond", + /* 307 */ "from_db_opt", + /* 308 */ "index_name", + /* 309 */ "index_options", + /* 310 */ "func_list", + /* 311 */ "sliding_opt", + /* 312 */ "sma_stream_opt", + /* 313 */ "func", + /* 314 */ "stream_options", + /* 315 */ "topic_name", + /* 316 */ "query_expression", + /* 317 */ "cgroup_name", + /* 318 */ "analyze_opt", + /* 319 */ "explain_options", + /* 320 */ "agg_func_opt", + /* 321 */ "bufsize_opt", + /* 322 */ "stream_name", + /* 323 */ "into_opt", + /* 324 */ "dnode_list", + /* 325 */ "where_clause_opt", + /* 326 */ "signed", + /* 327 */ "literal_func", + /* 328 */ "literal_list", + /* 329 */ "table_alias", + /* 330 */ "column_alias", + /* 331 */ "expression", + /* 332 */ "pseudo_column", + /* 333 */ "column_reference", + /* 334 */ "function_expression", + /* 335 */ "subquery", + /* 336 */ "star_func", + /* 337 */ "star_func_para_list", + /* 338 */ "noarg_func", + /* 339 */ "other_para_list", + /* 340 */ "star_func_para", + /* 341 */ "predicate", + /* 342 */ "compare_op", + /* 343 */ "in_op", + /* 344 */ "in_predicate_value", + /* 345 */ "boolean_value_expression", + /* 346 */ "boolean_primary", + /* 347 */ "common_expression", + /* 348 */ "from_clause_opt", + /* 349 */ "table_reference_list", + /* 350 */ "table_reference", + /* 351 */ "table_primary", + /* 352 */ "joined_table", + /* 353 */ "alias_opt", + /* 354 */ "parenthesized_joined_table", + /* 355 */ "join_type", + /* 356 */ "search_condition", + /* 357 */ "query_specification", + /* 358 */ "set_quantifier_opt", + /* 359 */ "select_list", + /* 360 */ "partition_by_clause_opt", + /* 361 */ "range_opt", + /* 362 */ "every_opt", + /* 363 */ "fill_opt", + /* 364 */ "twindow_clause_opt", + /* 365 */ "group_by_clause_opt", + /* 366 */ "having_clause_opt", + /* 367 */ "select_item", + /* 368 */ "fill_mode", + /* 369 */ "group_by_list", + /* 370 */ "query_expression_body", + /* 371 */ "order_by_clause_opt", + /* 372 */ "slimit_clause_opt", + /* 373 */ "limit_clause_opt", + /* 374 */ "query_primary", + /* 375 */ "sort_specification_list", + /* 376 */ "sort_specification", + /* 377 */ "ordering_specification_opt", + /* 378 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1890,209 +1938,211 @@ static const char *const yyRuleName[] = { /* 283 */ "cmd ::= SYNCDB db_name REPLICA", /* 284 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", /* 285 */ "cmd ::= query_expression", - /* 286 */ "cmd ::= INSERT INTO full_table_name specific_cols_opt query_expression", - /* 287 */ "literal ::= NK_INTEGER", - /* 288 */ "literal ::= NK_FLOAT", - /* 289 */ "literal ::= NK_STRING", - /* 290 */ "literal ::= NK_BOOL", - /* 291 */ "literal ::= TIMESTAMP NK_STRING", - /* 292 */ "literal ::= duration_literal", - /* 293 */ "literal ::= NULL", - /* 294 */ "literal ::= NK_QUESTION", - /* 295 */ "duration_literal ::= NK_VARIABLE", - /* 296 */ "signed ::= NK_INTEGER", - /* 297 */ "signed ::= NK_PLUS NK_INTEGER", - /* 298 */ "signed ::= NK_MINUS NK_INTEGER", - /* 299 */ "signed ::= NK_FLOAT", - /* 300 */ "signed ::= NK_PLUS NK_FLOAT", - /* 301 */ "signed ::= NK_MINUS NK_FLOAT", - /* 302 */ "signed_literal ::= signed", - /* 303 */ "signed_literal ::= NK_STRING", - /* 304 */ "signed_literal ::= NK_BOOL", - /* 305 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 306 */ "signed_literal ::= duration_literal", - /* 307 */ "signed_literal ::= NULL", - /* 308 */ "signed_literal ::= literal_func", - /* 309 */ "signed_literal ::= NK_QUESTION", - /* 310 */ "literal_list ::= signed_literal", - /* 311 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 312 */ "db_name ::= NK_ID", - /* 313 */ "table_name ::= NK_ID", - /* 314 */ "column_name ::= NK_ID", - /* 315 */ "function_name ::= NK_ID", - /* 316 */ "table_alias ::= NK_ID", - /* 317 */ "column_alias ::= NK_ID", - /* 318 */ "user_name ::= NK_ID", - /* 319 */ "index_name ::= NK_ID", - /* 320 */ "topic_name ::= NK_ID", - /* 321 */ "stream_name ::= NK_ID", - /* 322 */ "cgroup_name ::= NK_ID", - /* 323 */ "expression ::= literal", - /* 324 */ "expression ::= pseudo_column", - /* 325 */ "expression ::= column_reference", - /* 326 */ "expression ::= function_expression", - /* 327 */ "expression ::= subquery", - /* 328 */ "expression ::= NK_LP expression NK_RP", - /* 329 */ "expression ::= NK_PLUS expression", - /* 330 */ "expression ::= NK_MINUS expression", - /* 331 */ "expression ::= expression NK_PLUS expression", - /* 332 */ "expression ::= expression NK_MINUS expression", - /* 333 */ "expression ::= expression NK_STAR expression", - /* 334 */ "expression ::= expression NK_SLASH expression", - /* 335 */ "expression ::= expression NK_REM expression", - /* 336 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 337 */ "expression ::= expression NK_BITAND expression", - /* 338 */ "expression ::= expression NK_BITOR expression", - /* 339 */ "expression_list ::= expression", - /* 340 */ "expression_list ::= expression_list NK_COMMA expression", - /* 341 */ "column_reference ::= column_name", - /* 342 */ "column_reference ::= table_name NK_DOT column_name", - /* 343 */ "pseudo_column ::= ROWTS", - /* 344 */ "pseudo_column ::= TBNAME", - /* 345 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 346 */ "pseudo_column ::= QSTARTTS", - /* 347 */ "pseudo_column ::= QENDTS", - /* 348 */ "pseudo_column ::= WSTARTTS", - /* 349 */ "pseudo_column ::= WENDTS", - /* 350 */ "pseudo_column ::= WDURATION", - /* 351 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 352 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 353 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 354 */ "function_expression ::= literal_func", - /* 355 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 356 */ "literal_func ::= NOW", - /* 357 */ "noarg_func ::= NOW", - /* 358 */ "noarg_func ::= TODAY", - /* 359 */ "noarg_func ::= TIMEZONE", - /* 360 */ "noarg_func ::= DATABASE", - /* 361 */ "noarg_func ::= CLIENT_VERSION", - /* 362 */ "noarg_func ::= SERVER_VERSION", - /* 363 */ "noarg_func ::= SERVER_STATUS", - /* 364 */ "noarg_func ::= CURRENT_USER", - /* 365 */ "noarg_func ::= USER", - /* 366 */ "star_func ::= COUNT", - /* 367 */ "star_func ::= FIRST", - /* 368 */ "star_func ::= LAST", - /* 369 */ "star_func ::= LAST_ROW", - /* 370 */ "star_func_para_list ::= NK_STAR", - /* 371 */ "star_func_para_list ::= other_para_list", - /* 372 */ "other_para_list ::= star_func_para", - /* 373 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 374 */ "star_func_para ::= expression", - /* 375 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 376 */ "predicate ::= expression compare_op expression", - /* 377 */ "predicate ::= expression BETWEEN expression AND expression", - /* 378 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 379 */ "predicate ::= expression IS NULL", - /* 380 */ "predicate ::= expression IS NOT NULL", - /* 381 */ "predicate ::= expression in_op in_predicate_value", - /* 382 */ "compare_op ::= NK_LT", - /* 383 */ "compare_op ::= NK_GT", - /* 384 */ "compare_op ::= NK_LE", - /* 385 */ "compare_op ::= NK_GE", - /* 386 */ "compare_op ::= NK_NE", - /* 387 */ "compare_op ::= NK_EQ", - /* 388 */ "compare_op ::= LIKE", - /* 389 */ "compare_op ::= NOT LIKE", - /* 390 */ "compare_op ::= MATCH", - /* 391 */ "compare_op ::= NMATCH", - /* 392 */ "compare_op ::= CONTAINS", - /* 393 */ "in_op ::= IN", - /* 394 */ "in_op ::= NOT IN", - /* 395 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 396 */ "boolean_value_expression ::= boolean_primary", - /* 397 */ "boolean_value_expression ::= NOT boolean_primary", - /* 398 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 399 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 400 */ "boolean_primary ::= predicate", - /* 401 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 402 */ "common_expression ::= expression", - /* 403 */ "common_expression ::= boolean_value_expression", - /* 404 */ "from_clause_opt ::=", - /* 405 */ "from_clause_opt ::= FROM table_reference_list", - /* 406 */ "table_reference_list ::= table_reference", - /* 407 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 408 */ "table_reference ::= table_primary", - /* 409 */ "table_reference ::= joined_table", - /* 410 */ "table_primary ::= table_name alias_opt", - /* 411 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 412 */ "table_primary ::= subquery alias_opt", - /* 413 */ "table_primary ::= parenthesized_joined_table", - /* 414 */ "alias_opt ::=", - /* 415 */ "alias_opt ::= table_alias", - /* 416 */ "alias_opt ::= AS table_alias", - /* 417 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 418 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 419 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 420 */ "join_type ::=", - /* 421 */ "join_type ::= INNER", - /* 422 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 423 */ "set_quantifier_opt ::=", - /* 424 */ "set_quantifier_opt ::= DISTINCT", - /* 425 */ "set_quantifier_opt ::= ALL", - /* 426 */ "select_list ::= select_item", - /* 427 */ "select_list ::= select_list NK_COMMA select_item", - /* 428 */ "select_item ::= NK_STAR", - /* 429 */ "select_item ::= common_expression", - /* 430 */ "select_item ::= common_expression column_alias", - /* 431 */ "select_item ::= common_expression AS column_alias", - /* 432 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 433 */ "where_clause_opt ::=", - /* 434 */ "where_clause_opt ::= WHERE search_condition", - /* 435 */ "partition_by_clause_opt ::=", - /* 436 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 437 */ "twindow_clause_opt ::=", - /* 438 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 439 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 440 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 441 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 442 */ "sliding_opt ::=", - /* 443 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 444 */ "fill_opt ::=", - /* 445 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 446 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 447 */ "fill_mode ::= NONE", - /* 448 */ "fill_mode ::= PREV", - /* 449 */ "fill_mode ::= NULL", - /* 450 */ "fill_mode ::= LINEAR", - /* 451 */ "fill_mode ::= NEXT", - /* 452 */ "group_by_clause_opt ::=", - /* 453 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 454 */ "group_by_list ::= expression", - /* 455 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 456 */ "having_clause_opt ::=", - /* 457 */ "having_clause_opt ::= HAVING search_condition", - /* 458 */ "range_opt ::=", - /* 459 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 460 */ "every_opt ::=", - /* 461 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 462 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 463 */ "query_expression_body ::= query_primary", - /* 464 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 465 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 466 */ "query_primary ::= query_specification", - /* 467 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 468 */ "order_by_clause_opt ::=", - /* 469 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 470 */ "slimit_clause_opt ::=", - /* 471 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 472 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 474 */ "limit_clause_opt ::=", - /* 475 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 476 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 478 */ "subquery ::= NK_LP query_expression NK_RP", - /* 479 */ "search_condition ::= common_expression", - /* 480 */ "sort_specification_list ::= sort_specification", - /* 481 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 482 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 483 */ "ordering_specification_opt ::=", - /* 484 */ "ordering_specification_opt ::= ASC", - /* 485 */ "ordering_specification_opt ::= DESC", - /* 486 */ "null_ordering_opt ::=", - /* 487 */ "null_ordering_opt ::= NULLS FIRST", - /* 488 */ "null_ordering_opt ::= NULLS LAST", + /* 286 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", + /* 287 */ "cmd ::= INSERT INTO full_table_name query_expression", + /* 288 */ "literal ::= NK_INTEGER", + /* 289 */ "literal ::= NK_FLOAT", + /* 290 */ "literal ::= NK_STRING", + /* 291 */ "literal ::= NK_BOOL", + /* 292 */ "literal ::= TIMESTAMP NK_STRING", + /* 293 */ "literal ::= duration_literal", + /* 294 */ "literal ::= NULL", + /* 295 */ "literal ::= NK_QUESTION", + /* 296 */ "duration_literal ::= NK_VARIABLE", + /* 297 */ "signed ::= NK_INTEGER", + /* 298 */ "signed ::= NK_PLUS NK_INTEGER", + /* 299 */ "signed ::= NK_MINUS NK_INTEGER", + /* 300 */ "signed ::= NK_FLOAT", + /* 301 */ "signed ::= NK_PLUS NK_FLOAT", + /* 302 */ "signed ::= NK_MINUS NK_FLOAT", + /* 303 */ "signed_literal ::= signed", + /* 304 */ "signed_literal ::= NK_STRING", + /* 305 */ "signed_literal ::= NK_BOOL", + /* 306 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 307 */ "signed_literal ::= duration_literal", + /* 308 */ "signed_literal ::= NULL", + /* 309 */ "signed_literal ::= literal_func", + /* 310 */ "signed_literal ::= NK_QUESTION", + /* 311 */ "literal_list ::= signed_literal", + /* 312 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 313 */ "db_name ::= NK_ID", + /* 314 */ "table_name ::= NK_ID", + /* 315 */ "column_name ::= NK_ID", + /* 316 */ "function_name ::= NK_ID", + /* 317 */ "table_alias ::= NK_ID", + /* 318 */ "column_alias ::= NK_ID", + /* 319 */ "user_name ::= NK_ID", + /* 320 */ "index_name ::= NK_ID", + /* 321 */ "topic_name ::= NK_ID", + /* 322 */ "stream_name ::= NK_ID", + /* 323 */ "cgroup_name ::= NK_ID", + /* 324 */ "expression ::= literal", + /* 325 */ "expression ::= pseudo_column", + /* 326 */ "expression ::= column_reference", + /* 327 */ "expression ::= function_expression", + /* 328 */ "expression ::= subquery", + /* 329 */ "expression ::= NK_LP expression NK_RP", + /* 330 */ "expression ::= NK_PLUS expression", + /* 331 */ "expression ::= NK_MINUS expression", + /* 332 */ "expression ::= expression NK_PLUS expression", + /* 333 */ "expression ::= expression NK_MINUS expression", + /* 334 */ "expression ::= expression NK_STAR expression", + /* 335 */ "expression ::= expression NK_SLASH expression", + /* 336 */ "expression ::= expression NK_REM expression", + /* 337 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 338 */ "expression ::= expression NK_BITAND expression", + /* 339 */ "expression ::= expression NK_BITOR expression", + /* 340 */ "expression_list ::= expression", + /* 341 */ "expression_list ::= expression_list NK_COMMA expression", + /* 342 */ "column_reference ::= column_name", + /* 343 */ "column_reference ::= table_name NK_DOT column_name", + /* 344 */ "pseudo_column ::= ROWTS", + /* 345 */ "pseudo_column ::= TBNAME", + /* 346 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 347 */ "pseudo_column ::= QSTART", + /* 348 */ "pseudo_column ::= QEND", + /* 349 */ "pseudo_column ::= QDURATION", + /* 350 */ "pseudo_column ::= WSTART", + /* 351 */ "pseudo_column ::= WEND", + /* 352 */ "pseudo_column ::= WDURATION", + /* 353 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 354 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 355 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 356 */ "function_expression ::= literal_func", + /* 357 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 358 */ "literal_func ::= NOW", + /* 359 */ "noarg_func ::= NOW", + /* 360 */ "noarg_func ::= TODAY", + /* 361 */ "noarg_func ::= TIMEZONE", + /* 362 */ "noarg_func ::= DATABASE", + /* 363 */ "noarg_func ::= CLIENT_VERSION", + /* 364 */ "noarg_func ::= SERVER_VERSION", + /* 365 */ "noarg_func ::= SERVER_STATUS", + /* 366 */ "noarg_func ::= CURRENT_USER", + /* 367 */ "noarg_func ::= USER", + /* 368 */ "star_func ::= COUNT", + /* 369 */ "star_func ::= FIRST", + /* 370 */ "star_func ::= LAST", + /* 371 */ "star_func ::= LAST_ROW", + /* 372 */ "star_func_para_list ::= NK_STAR", + /* 373 */ "star_func_para_list ::= other_para_list", + /* 374 */ "other_para_list ::= star_func_para", + /* 375 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 376 */ "star_func_para ::= expression", + /* 377 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 378 */ "predicate ::= expression compare_op expression", + /* 379 */ "predicate ::= expression BETWEEN expression AND expression", + /* 380 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 381 */ "predicate ::= expression IS NULL", + /* 382 */ "predicate ::= expression IS NOT NULL", + /* 383 */ "predicate ::= expression in_op in_predicate_value", + /* 384 */ "compare_op ::= NK_LT", + /* 385 */ "compare_op ::= NK_GT", + /* 386 */ "compare_op ::= NK_LE", + /* 387 */ "compare_op ::= NK_GE", + /* 388 */ "compare_op ::= NK_NE", + /* 389 */ "compare_op ::= NK_EQ", + /* 390 */ "compare_op ::= LIKE", + /* 391 */ "compare_op ::= NOT LIKE", + /* 392 */ "compare_op ::= MATCH", + /* 393 */ "compare_op ::= NMATCH", + /* 394 */ "compare_op ::= CONTAINS", + /* 395 */ "in_op ::= IN", + /* 396 */ "in_op ::= NOT IN", + /* 397 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 398 */ "boolean_value_expression ::= boolean_primary", + /* 399 */ "boolean_value_expression ::= NOT boolean_primary", + /* 400 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 401 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 402 */ "boolean_primary ::= predicate", + /* 403 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 404 */ "common_expression ::= expression", + /* 405 */ "common_expression ::= boolean_value_expression", + /* 406 */ "from_clause_opt ::=", + /* 407 */ "from_clause_opt ::= FROM table_reference_list", + /* 408 */ "table_reference_list ::= table_reference", + /* 409 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 410 */ "table_reference ::= table_primary", + /* 411 */ "table_reference ::= joined_table", + /* 412 */ "table_primary ::= table_name alias_opt", + /* 413 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 414 */ "table_primary ::= subquery alias_opt", + /* 415 */ "table_primary ::= parenthesized_joined_table", + /* 416 */ "alias_opt ::=", + /* 417 */ "alias_opt ::= table_alias", + /* 418 */ "alias_opt ::= AS table_alias", + /* 419 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 420 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 421 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 422 */ "join_type ::=", + /* 423 */ "join_type ::= INNER", + /* 424 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 425 */ "set_quantifier_opt ::=", + /* 426 */ "set_quantifier_opt ::= DISTINCT", + /* 427 */ "set_quantifier_opt ::= ALL", + /* 428 */ "select_list ::= select_item", + /* 429 */ "select_list ::= select_list NK_COMMA select_item", + /* 430 */ "select_item ::= NK_STAR", + /* 431 */ "select_item ::= common_expression", + /* 432 */ "select_item ::= common_expression column_alias", + /* 433 */ "select_item ::= common_expression AS column_alias", + /* 434 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 435 */ "where_clause_opt ::=", + /* 436 */ "where_clause_opt ::= WHERE search_condition", + /* 437 */ "partition_by_clause_opt ::=", + /* 438 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 439 */ "twindow_clause_opt ::=", + /* 440 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 441 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 442 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 444 */ "sliding_opt ::=", + /* 445 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 446 */ "fill_opt ::=", + /* 447 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 448 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 449 */ "fill_mode ::= NONE", + /* 450 */ "fill_mode ::= PREV", + /* 451 */ "fill_mode ::= NULL", + /* 452 */ "fill_mode ::= LINEAR", + /* 453 */ "fill_mode ::= NEXT", + /* 454 */ "group_by_clause_opt ::=", + /* 455 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 456 */ "group_by_list ::= expression", + /* 457 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 458 */ "having_clause_opt ::=", + /* 459 */ "having_clause_opt ::= HAVING search_condition", + /* 460 */ "range_opt ::=", + /* 461 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 462 */ "every_opt ::=", + /* 463 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 464 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 465 */ "query_expression_body ::= query_primary", + /* 466 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 467 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 468 */ "query_primary ::= query_specification", + /* 469 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 470 */ "order_by_clause_opt ::=", + /* 471 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 472 */ "slimit_clause_opt ::=", + /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 476 */ "limit_clause_opt ::=", + /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 480 */ "subquery ::= NK_LP query_expression NK_RP", + /* 481 */ "search_condition ::= common_expression", + /* 482 */ "sort_specification_list ::= sort_specification", + /* 483 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 484 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 485 */ "ordering_specification_opt ::=", + /* 486 */ "ordering_specification_opt ::= ASC", + /* 487 */ "ordering_specification_opt ::= DESC", + /* 488 */ "null_ordering_opt ::=", + /* 489 */ "null_ordering_opt ::= NULLS FIRST", + /* 490 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2219,181 +2269,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 255: /* cmd */ - case 258: /* literal */ - case 269: /* db_options */ - case 271: /* alter_db_options */ - case 276: /* retention */ - case 277: /* full_table_name */ - case 280: /* table_options */ - case 284: /* alter_table_clause */ - case 285: /* alter_table_options */ - case 288: /* signed_literal */ - case 289: /* create_subtable_clause */ - case 292: /* drop_table_clause */ - case 295: /* column_def */ - case 299: /* duration_literal */ - case 300: /* rollup_func_name */ - case 302: /* col_name */ - case 303: /* db_name_cond_opt */ - case 304: /* like_pattern_opt */ - case 305: /* table_name_cond */ - case 306: /* from_db_opt */ - case 308: /* index_options */ - case 310: /* sliding_opt */ - case 311: /* sma_stream_opt */ - case 312: /* func */ - case 313: /* stream_options */ - case 315: /* query_expression */ - case 318: /* explain_options */ - case 322: /* into_opt */ - case 324: /* where_clause_opt */ - case 325: /* signed */ - case 326: /* literal_func */ - case 330: /* expression */ - case 331: /* pseudo_column */ - case 332: /* column_reference */ - case 333: /* function_expression */ - case 334: /* subquery */ - case 339: /* star_func_para */ - case 340: /* predicate */ - case 343: /* in_predicate_value */ - case 344: /* boolean_value_expression */ - case 345: /* boolean_primary */ - case 346: /* common_expression */ - case 347: /* from_clause_opt */ - case 348: /* table_reference_list */ - case 349: /* table_reference */ - case 350: /* table_primary */ - case 351: /* joined_table */ - case 353: /* parenthesized_joined_table */ - case 355: /* search_condition */ - case 356: /* query_specification */ - case 360: /* range_opt */ - case 361: /* every_opt */ - case 362: /* fill_opt */ - case 363: /* twindow_clause_opt */ - case 365: /* having_clause_opt */ - case 366: /* select_item */ - case 369: /* query_expression_body */ - case 371: /* slimit_clause_opt */ - case 372: /* limit_clause_opt */ - case 373: /* query_primary */ - case 375: /* sort_specification */ + case 256: /* cmd */ + case 259: /* literal */ + case 270: /* db_options */ + case 272: /* alter_db_options */ + case 277: /* retention */ + case 278: /* full_table_name */ + case 281: /* table_options */ + case 285: /* alter_table_clause */ + case 286: /* alter_table_options */ + case 289: /* signed_literal */ + case 290: /* create_subtable_clause */ + case 293: /* drop_table_clause */ + case 296: /* column_def */ + case 300: /* duration_literal */ + case 301: /* rollup_func_name */ + case 303: /* col_name */ + case 304: /* db_name_cond_opt */ + case 305: /* like_pattern_opt */ + case 306: /* table_name_cond */ + case 307: /* from_db_opt */ + case 309: /* index_options */ + case 311: /* sliding_opt */ + case 312: /* sma_stream_opt */ + case 313: /* func */ + case 314: /* stream_options */ + case 316: /* query_expression */ + case 319: /* explain_options */ + case 323: /* into_opt */ + case 325: /* where_clause_opt */ + case 326: /* signed */ + case 327: /* literal_func */ + case 331: /* expression */ + case 332: /* pseudo_column */ + case 333: /* column_reference */ + case 334: /* function_expression */ + case 335: /* subquery */ + case 340: /* star_func_para */ + case 341: /* predicate */ + case 344: /* in_predicate_value */ + case 345: /* boolean_value_expression */ + case 346: /* boolean_primary */ + case 347: /* common_expression */ + case 348: /* from_clause_opt */ + case 349: /* table_reference_list */ + case 350: /* table_reference */ + case 351: /* table_primary */ + case 352: /* joined_table */ + case 354: /* parenthesized_joined_table */ + case 356: /* search_condition */ + case 357: /* query_specification */ + case 361: /* range_opt */ + case 362: /* every_opt */ + case 363: /* fill_opt */ + case 364: /* twindow_clause_opt */ + case 366: /* having_clause_opt */ + case 367: /* select_item */ + case 370: /* query_expression_body */ + case 372: /* slimit_clause_opt */ + case 373: /* limit_clause_opt */ + case 374: /* query_primary */ + case 376: /* sort_specification */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy616)); } break; - case 256: /* account_options */ - case 257: /* alter_account_options */ - case 259: /* alter_account_option */ - case 320: /* bufsize_opt */ + case 257: /* account_options */ + case 258: /* alter_account_options */ + case 260: /* alter_account_option */ + case 321: /* bufsize_opt */ { } break; - case 260: /* user_name */ - case 263: /* priv_level */ - case 266: /* db_name */ - case 267: /* dnode_endpoint */ - case 286: /* column_name */ - case 294: /* table_name */ - case 301: /* function_name */ - case 307: /* index_name */ - case 314: /* topic_name */ - case 316: /* cgroup_name */ - case 321: /* stream_name */ - case 328: /* table_alias */ - case 329: /* column_alias */ - case 335: /* star_func */ - case 337: /* noarg_func */ - case 352: /* alias_opt */ + case 261: /* user_name */ + case 264: /* priv_level */ + case 267: /* db_name */ + case 268: /* dnode_endpoint */ + case 287: /* column_name */ + case 295: /* table_name */ + case 302: /* function_name */ + case 308: /* index_name */ + case 315: /* topic_name */ + case 317: /* cgroup_name */ + case 322: /* stream_name */ + case 329: /* table_alias */ + case 330: /* column_alias */ + case 336: /* star_func */ + case 338: /* noarg_func */ + case 353: /* alias_opt */ { } break; - case 261: /* sysinfo_opt */ + case 262: /* sysinfo_opt */ { } break; - case 262: /* privileges */ - case 264: /* priv_type_list */ - case 265: /* priv_type */ + case 263: /* privileges */ + case 265: /* priv_type_list */ + case 266: /* priv_type */ { } break; - case 268: /* not_exists_opt */ - case 270: /* exists_opt */ - case 317: /* analyze_opt */ - case 319: /* agg_func_opt */ - case 357: /* set_quantifier_opt */ + case 269: /* not_exists_opt */ + case 271: /* exists_opt */ + case 318: /* analyze_opt */ + case 320: /* agg_func_opt */ + case 358: /* set_quantifier_opt */ { } break; - case 272: /* integer_list */ - case 273: /* variable_list */ - case 274: /* retention_list */ - case 278: /* column_def_list */ - case 279: /* tags_def_opt */ - case 281: /* multi_create_clause */ - case 282: /* tags_def */ - case 283: /* multi_drop_clause */ - case 290: /* specific_cols_opt */ - case 291: /* expression_list */ - case 293: /* col_name_list */ - case 296: /* duration_list */ - case 297: /* rollup_func_list */ - case 309: /* func_list */ - case 323: /* dnode_list */ - case 327: /* literal_list */ - case 336: /* star_func_para_list */ - case 338: /* other_para_list */ - case 358: /* select_list */ - case 359: /* partition_by_clause_opt */ - case 364: /* group_by_clause_opt */ - case 368: /* group_by_list */ - case 370: /* order_by_clause_opt */ - case 374: /* sort_specification_list */ + case 273: /* integer_list */ + case 274: /* variable_list */ + case 275: /* retention_list */ + case 279: /* column_def_list */ + case 280: /* tags_def_opt */ + case 282: /* multi_create_clause */ + case 283: /* tags_def */ + case 284: /* multi_drop_clause */ + case 291: /* specific_cols_opt */ + case 292: /* expression_list */ + case 294: /* col_name_list */ + case 297: /* duration_list */ + case 298: /* rollup_func_list */ + case 310: /* func_list */ + case 324: /* dnode_list */ + case 328: /* literal_list */ + case 337: /* star_func_para_list */ + case 339: /* other_para_list */ + case 359: /* select_list */ + case 360: /* partition_by_clause_opt */ + case 365: /* group_by_clause_opt */ + case 369: /* group_by_list */ + case 371: /* order_by_clause_opt */ + case 375: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy712)); + nodesDestroyList((yypminor->yy356)); } break; - case 275: /* alter_db_option */ - case 298: /* alter_table_option */ + case 276: /* alter_db_option */ + case 299: /* alter_table_option */ { } break; - case 287: /* type_name */ + case 288: /* type_name */ { } break; - case 341: /* compare_op */ - case 342: /* in_op */ + case 342: /* compare_op */ + case 343: /* in_op */ { } break; - case 354: /* join_type */ + case 355: /* join_type */ { } break; - case 367: /* fill_mode */ + case 368: /* fill_mode */ { } break; - case 376: /* ordering_specification_opt */ + case 377: /* ordering_specification_opt */ { } break; - case 377: /* null_ordering_opt */ + case 378: /* null_ordering_opt */ { } @@ -2692,495 +2742,497 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 255, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 255, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 256, 0 }, /* (2) account_options ::= */ - { 256, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 256, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 256, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 256, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 256, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 256, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 256, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 256, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 256, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 257, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 257, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 259, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 259, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 259, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 259, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 259, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 259, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 259, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 259, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 259, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 259, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 255, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 255, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 255, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 255, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 255, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 261, 0 }, /* (29) sysinfo_opt ::= */ - { 261, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 255, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 255, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 262, -1 }, /* (33) privileges ::= ALL */ - { 262, -1 }, /* (34) privileges ::= priv_type_list */ - { 264, -1 }, /* (35) priv_type_list ::= priv_type */ - { 264, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 265, -1 }, /* (37) priv_type ::= READ */ - { 265, -1 }, /* (38) priv_type ::= WRITE */ - { 263, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 263, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 255, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 255, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 255, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 255, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 255, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 255, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 255, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 255, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 267, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 267, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 267, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 255, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 255, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 255, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 255, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 255, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 255, -2 }, /* (64) cmd ::= USE db_name */ - { 255, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 255, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ - { 255, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ - { 268, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ - { 268, 0 }, /* (69) not_exists_opt ::= */ - { 270, -2 }, /* (70) exists_opt ::= IF EXISTS */ - { 270, 0 }, /* (71) exists_opt ::= */ - { 269, 0 }, /* (72) db_options ::= */ - { 269, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ - { 269, -3 }, /* (74) db_options ::= db_options CACHELAST NK_INTEGER */ - { 269, -3 }, /* (75) db_options ::= db_options CACHELASTSIZE NK_INTEGER */ - { 269, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ - { 269, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ - { 269, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ - { 269, -3 }, /* (79) db_options ::= db_options FSYNC NK_INTEGER */ - { 269, -3 }, /* (80) db_options ::= db_options MAXROWS NK_INTEGER */ - { 269, -3 }, /* (81) db_options ::= db_options MINROWS NK_INTEGER */ - { 269, -3 }, /* (82) db_options ::= db_options KEEP integer_list */ - { 269, -3 }, /* (83) db_options ::= db_options KEEP variable_list */ - { 269, -3 }, /* (84) db_options ::= db_options PAGES NK_INTEGER */ - { 269, -3 }, /* (85) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 269, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ - { 269, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ - { 269, -3 }, /* (88) db_options ::= db_options STRICT NK_INTEGER */ - { 269, -3 }, /* (89) db_options ::= db_options WAL NK_INTEGER */ - { 269, -3 }, /* (90) db_options ::= db_options VGROUPS NK_INTEGER */ - { 269, -3 }, /* (91) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 269, -3 }, /* (92) db_options ::= db_options RETENTIONS retention_list */ - { 269, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 271, -1 }, /* (94) alter_db_options ::= alter_db_option */ - { 271, -2 }, /* (95) alter_db_options ::= alter_db_options alter_db_option */ - { 275, -2 }, /* (96) alter_db_option ::= BUFFER NK_INTEGER */ - { 275, -2 }, /* (97) alter_db_option ::= CACHELAST NK_INTEGER */ - { 275, -2 }, /* (98) alter_db_option ::= CACHELASTSIZE NK_INTEGER */ - { 275, -2 }, /* (99) alter_db_option ::= FSYNC NK_INTEGER */ - { 275, -2 }, /* (100) alter_db_option ::= KEEP integer_list */ - { 275, -2 }, /* (101) alter_db_option ::= KEEP variable_list */ - { 275, -2 }, /* (102) alter_db_option ::= PAGES NK_INTEGER */ - { 275, -2 }, /* (103) alter_db_option ::= REPLICA NK_INTEGER */ - { 275, -2 }, /* (104) alter_db_option ::= STRICT NK_INTEGER */ - { 275, -2 }, /* (105) alter_db_option ::= WAL NK_INTEGER */ - { 272, -1 }, /* (106) integer_list ::= NK_INTEGER */ - { 272, -3 }, /* (107) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 273, -1 }, /* (108) variable_list ::= NK_VARIABLE */ - { 273, -3 }, /* (109) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 274, -1 }, /* (110) retention_list ::= retention */ - { 274, -3 }, /* (111) retention_list ::= retention_list NK_COMMA retention */ - { 276, -3 }, /* (112) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 255, -9 }, /* (113) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 255, -3 }, /* (114) cmd ::= CREATE TABLE multi_create_clause */ - { 255, -9 }, /* (115) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 255, -3 }, /* (116) cmd ::= DROP TABLE multi_drop_clause */ - { 255, -4 }, /* (117) cmd ::= DROP STABLE exists_opt full_table_name */ - { 255, -3 }, /* (118) cmd ::= ALTER TABLE alter_table_clause */ - { 255, -3 }, /* (119) cmd ::= ALTER STABLE alter_table_clause */ - { 284, -2 }, /* (120) alter_table_clause ::= full_table_name alter_table_options */ - { 284, -5 }, /* (121) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 284, -4 }, /* (122) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 284, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 284, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 284, -5 }, /* (125) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 284, -4 }, /* (126) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 284, -5 }, /* (127) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 284, -5 }, /* (128) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 284, -6 }, /* (129) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 281, -1 }, /* (130) multi_create_clause ::= create_subtable_clause */ - { 281, -2 }, /* (131) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 289, -10 }, /* (132) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 283, -1 }, /* (133) multi_drop_clause ::= drop_table_clause */ - { 283, -2 }, /* (134) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 292, -2 }, /* (135) drop_table_clause ::= exists_opt full_table_name */ - { 290, 0 }, /* (136) specific_cols_opt ::= */ - { 290, -3 }, /* (137) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 277, -1 }, /* (138) full_table_name ::= table_name */ - { 277, -3 }, /* (139) full_table_name ::= db_name NK_DOT table_name */ - { 278, -1 }, /* (140) column_def_list ::= column_def */ - { 278, -3 }, /* (141) column_def_list ::= column_def_list NK_COMMA column_def */ - { 295, -2 }, /* (142) column_def ::= column_name type_name */ - { 295, -4 }, /* (143) column_def ::= column_name type_name COMMENT NK_STRING */ - { 287, -1 }, /* (144) type_name ::= BOOL */ - { 287, -1 }, /* (145) type_name ::= TINYINT */ - { 287, -1 }, /* (146) type_name ::= SMALLINT */ - { 287, -1 }, /* (147) type_name ::= INT */ - { 287, -1 }, /* (148) type_name ::= INTEGER */ - { 287, -1 }, /* (149) type_name ::= BIGINT */ - { 287, -1 }, /* (150) type_name ::= FLOAT */ - { 287, -1 }, /* (151) type_name ::= DOUBLE */ - { 287, -4 }, /* (152) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 287, -1 }, /* (153) type_name ::= TIMESTAMP */ - { 287, -4 }, /* (154) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 287, -2 }, /* (155) type_name ::= TINYINT UNSIGNED */ - { 287, -2 }, /* (156) type_name ::= SMALLINT UNSIGNED */ - { 287, -2 }, /* (157) type_name ::= INT UNSIGNED */ - { 287, -2 }, /* (158) type_name ::= BIGINT UNSIGNED */ - { 287, -1 }, /* (159) type_name ::= JSON */ - { 287, -4 }, /* (160) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 287, -1 }, /* (161) type_name ::= MEDIUMBLOB */ - { 287, -1 }, /* (162) type_name ::= BLOB */ - { 287, -4 }, /* (163) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 287, -1 }, /* (164) type_name ::= DECIMAL */ - { 287, -4 }, /* (165) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 287, -6 }, /* (166) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 279, 0 }, /* (167) tags_def_opt ::= */ - { 279, -1 }, /* (168) tags_def_opt ::= tags_def */ - { 282, -4 }, /* (169) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 280, 0 }, /* (170) table_options ::= */ - { 280, -3 }, /* (171) table_options ::= table_options COMMENT NK_STRING */ - { 280, -3 }, /* (172) table_options ::= table_options MAX_DELAY duration_list */ - { 280, -3 }, /* (173) table_options ::= table_options WATERMARK duration_list */ - { 280, -5 }, /* (174) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 280, -3 }, /* (175) table_options ::= table_options TTL NK_INTEGER */ - { 280, -5 }, /* (176) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 285, -1 }, /* (177) alter_table_options ::= alter_table_option */ - { 285, -2 }, /* (178) alter_table_options ::= alter_table_options alter_table_option */ - { 298, -2 }, /* (179) alter_table_option ::= COMMENT NK_STRING */ - { 298, -2 }, /* (180) alter_table_option ::= TTL NK_INTEGER */ - { 296, -1 }, /* (181) duration_list ::= duration_literal */ - { 296, -3 }, /* (182) duration_list ::= duration_list NK_COMMA duration_literal */ - { 297, -1 }, /* (183) rollup_func_list ::= rollup_func_name */ - { 297, -3 }, /* (184) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 300, -1 }, /* (185) rollup_func_name ::= function_name */ - { 300, -1 }, /* (186) rollup_func_name ::= FIRST */ - { 300, -1 }, /* (187) rollup_func_name ::= LAST */ - { 293, -1 }, /* (188) col_name_list ::= col_name */ - { 293, -3 }, /* (189) col_name_list ::= col_name_list NK_COMMA col_name */ - { 302, -1 }, /* (190) col_name ::= column_name */ - { 255, -2 }, /* (191) cmd ::= SHOW DNODES */ - { 255, -2 }, /* (192) cmd ::= SHOW USERS */ - { 255, -2 }, /* (193) cmd ::= SHOW DATABASES */ - { 255, -4 }, /* (194) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 255, -4 }, /* (195) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 255, -3 }, /* (196) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 255, -2 }, /* (197) cmd ::= SHOW MNODES */ - { 255, -2 }, /* (198) cmd ::= SHOW MODULES */ - { 255, -2 }, /* (199) cmd ::= SHOW QNODES */ - { 255, -2 }, /* (200) cmd ::= SHOW FUNCTIONS */ - { 255, -5 }, /* (201) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 255, -2 }, /* (202) cmd ::= SHOW STREAMS */ - { 255, -2 }, /* (203) cmd ::= SHOW ACCOUNTS */ - { 255, -2 }, /* (204) cmd ::= SHOW APPS */ - { 255, -2 }, /* (205) cmd ::= SHOW CONNECTIONS */ - { 255, -2 }, /* (206) cmd ::= SHOW LICENCE */ - { 255, -2 }, /* (207) cmd ::= SHOW GRANTS */ - { 255, -4 }, /* (208) cmd ::= SHOW CREATE DATABASE db_name */ - { 255, -4 }, /* (209) cmd ::= SHOW CREATE TABLE full_table_name */ - { 255, -4 }, /* (210) cmd ::= SHOW CREATE STABLE full_table_name */ - { 255, -2 }, /* (211) cmd ::= SHOW QUERIES */ - { 255, -2 }, /* (212) cmd ::= SHOW SCORES */ - { 255, -2 }, /* (213) cmd ::= SHOW TOPICS */ - { 255, -2 }, /* (214) cmd ::= SHOW VARIABLES */ - { 255, -3 }, /* (215) cmd ::= SHOW LOCAL VARIABLES */ - { 255, -4 }, /* (216) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 255, -2 }, /* (217) cmd ::= SHOW BNODES */ - { 255, -2 }, /* (218) cmd ::= SHOW SNODES */ - { 255, -2 }, /* (219) cmd ::= SHOW CLUSTER */ - { 255, -2 }, /* (220) cmd ::= SHOW TRANSACTIONS */ - { 255, -4 }, /* (221) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 255, -2 }, /* (222) cmd ::= SHOW CONSUMERS */ - { 255, -2 }, /* (223) cmd ::= SHOW SUBSCRIPTIONS */ - { 303, 0 }, /* (224) db_name_cond_opt ::= */ - { 303, -2 }, /* (225) db_name_cond_opt ::= db_name NK_DOT */ - { 304, 0 }, /* (226) like_pattern_opt ::= */ - { 304, -2 }, /* (227) like_pattern_opt ::= LIKE NK_STRING */ - { 305, -1 }, /* (228) table_name_cond ::= table_name */ - { 306, 0 }, /* (229) from_db_opt ::= */ - { 306, -2 }, /* (230) from_db_opt ::= FROM db_name */ - { 255, -8 }, /* (231) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 255, -4 }, /* (232) cmd ::= DROP INDEX exists_opt index_name */ - { 308, -10 }, /* (233) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 308, -12 }, /* (234) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 309, -1 }, /* (235) func_list ::= func */ - { 309, -3 }, /* (236) func_list ::= func_list NK_COMMA func */ - { 312, -4 }, /* (237) func ::= function_name NK_LP expression_list NK_RP */ - { 311, 0 }, /* (238) sma_stream_opt ::= */ - { 311, -3 }, /* (239) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 311, -3 }, /* (240) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 255, -6 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 255, -7 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 255, -9 }, /* (243) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 255, -7 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 255, -9 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 255, -4 }, /* (246) cmd ::= DROP TOPIC exists_opt topic_name */ - { 255, -7 }, /* (247) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 255, -2 }, /* (248) cmd ::= DESC full_table_name */ - { 255, -2 }, /* (249) cmd ::= DESCRIBE full_table_name */ - { 255, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ - { 255, -4 }, /* (251) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 317, 0 }, /* (252) analyze_opt ::= */ - { 317, -1 }, /* (253) analyze_opt ::= ANALYZE */ - { 318, 0 }, /* (254) explain_options ::= */ - { 318, -3 }, /* (255) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 318, -3 }, /* (256) explain_options ::= explain_options RATIO NK_FLOAT */ - { 255, -6 }, /* (257) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 255, -10 }, /* (258) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 255, -4 }, /* (259) cmd ::= DROP FUNCTION exists_opt function_name */ - { 319, 0 }, /* (260) agg_func_opt ::= */ - { 319, -1 }, /* (261) agg_func_opt ::= AGGREGATE */ - { 320, 0 }, /* (262) bufsize_opt ::= */ - { 320, -2 }, /* (263) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 255, -8 }, /* (264) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 255, -4 }, /* (265) cmd ::= DROP STREAM exists_opt stream_name */ - { 322, 0 }, /* (266) into_opt ::= */ - { 322, -2 }, /* (267) into_opt ::= INTO full_table_name */ - { 313, 0 }, /* (268) stream_options ::= */ - { 313, -3 }, /* (269) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 313, -3 }, /* (270) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 313, -4 }, /* (271) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 313, -3 }, /* (272) stream_options ::= stream_options WATERMARK duration_literal */ - { 313, -3 }, /* (273) stream_options ::= stream_options IGNORE EXPIRED */ - { 255, -3 }, /* (274) cmd ::= KILL CONNECTION NK_INTEGER */ - { 255, -3 }, /* (275) cmd ::= KILL QUERY NK_STRING */ - { 255, -3 }, /* (276) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 255, -2 }, /* (277) cmd ::= BALANCE VGROUP */ - { 255, -4 }, /* (278) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 255, -4 }, /* (279) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 255, -3 }, /* (280) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 323, -2 }, /* (281) dnode_list ::= DNODE NK_INTEGER */ - { 323, -3 }, /* (282) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 255, -3 }, /* (283) cmd ::= SYNCDB db_name REPLICA */ - { 255, -4 }, /* (284) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 255, -1 }, /* (285) cmd ::= query_expression */ - { 255, -5 }, /* (286) cmd ::= INSERT INTO full_table_name specific_cols_opt query_expression */ - { 258, -1 }, /* (287) literal ::= NK_INTEGER */ - { 258, -1 }, /* (288) literal ::= NK_FLOAT */ - { 258, -1 }, /* (289) literal ::= NK_STRING */ - { 258, -1 }, /* (290) literal ::= NK_BOOL */ - { 258, -2 }, /* (291) literal ::= TIMESTAMP NK_STRING */ - { 258, -1 }, /* (292) literal ::= duration_literal */ - { 258, -1 }, /* (293) literal ::= NULL */ - { 258, -1 }, /* (294) literal ::= NK_QUESTION */ - { 299, -1 }, /* (295) duration_literal ::= NK_VARIABLE */ - { 325, -1 }, /* (296) signed ::= NK_INTEGER */ - { 325, -2 }, /* (297) signed ::= NK_PLUS NK_INTEGER */ - { 325, -2 }, /* (298) signed ::= NK_MINUS NK_INTEGER */ - { 325, -1 }, /* (299) signed ::= NK_FLOAT */ - { 325, -2 }, /* (300) signed ::= NK_PLUS NK_FLOAT */ - { 325, -2 }, /* (301) signed ::= NK_MINUS NK_FLOAT */ - { 288, -1 }, /* (302) signed_literal ::= signed */ - { 288, -1 }, /* (303) signed_literal ::= NK_STRING */ - { 288, -1 }, /* (304) signed_literal ::= NK_BOOL */ - { 288, -2 }, /* (305) signed_literal ::= TIMESTAMP NK_STRING */ - { 288, -1 }, /* (306) signed_literal ::= duration_literal */ - { 288, -1 }, /* (307) signed_literal ::= NULL */ - { 288, -1 }, /* (308) signed_literal ::= literal_func */ - { 288, -1 }, /* (309) signed_literal ::= NK_QUESTION */ - { 327, -1 }, /* (310) literal_list ::= signed_literal */ - { 327, -3 }, /* (311) literal_list ::= literal_list NK_COMMA signed_literal */ - { 266, -1 }, /* (312) db_name ::= NK_ID */ - { 294, -1 }, /* (313) table_name ::= NK_ID */ - { 286, -1 }, /* (314) column_name ::= NK_ID */ - { 301, -1 }, /* (315) function_name ::= NK_ID */ - { 328, -1 }, /* (316) table_alias ::= NK_ID */ - { 329, -1 }, /* (317) column_alias ::= NK_ID */ - { 260, -1 }, /* (318) user_name ::= NK_ID */ - { 307, -1 }, /* (319) index_name ::= NK_ID */ - { 314, -1 }, /* (320) topic_name ::= NK_ID */ - { 321, -1 }, /* (321) stream_name ::= NK_ID */ - { 316, -1 }, /* (322) cgroup_name ::= NK_ID */ - { 330, -1 }, /* (323) expression ::= literal */ - { 330, -1 }, /* (324) expression ::= pseudo_column */ - { 330, -1 }, /* (325) expression ::= column_reference */ - { 330, -1 }, /* (326) expression ::= function_expression */ - { 330, -1 }, /* (327) expression ::= subquery */ - { 330, -3 }, /* (328) expression ::= NK_LP expression NK_RP */ - { 330, -2 }, /* (329) expression ::= NK_PLUS expression */ - { 330, -2 }, /* (330) expression ::= NK_MINUS expression */ - { 330, -3 }, /* (331) expression ::= expression NK_PLUS expression */ - { 330, -3 }, /* (332) expression ::= expression NK_MINUS expression */ - { 330, -3 }, /* (333) expression ::= expression NK_STAR expression */ - { 330, -3 }, /* (334) expression ::= expression NK_SLASH expression */ - { 330, -3 }, /* (335) expression ::= expression NK_REM expression */ - { 330, -3 }, /* (336) expression ::= column_reference NK_ARROW NK_STRING */ - { 330, -3 }, /* (337) expression ::= expression NK_BITAND expression */ - { 330, -3 }, /* (338) expression ::= expression NK_BITOR expression */ - { 291, -1 }, /* (339) expression_list ::= expression */ - { 291, -3 }, /* (340) expression_list ::= expression_list NK_COMMA expression */ - { 332, -1 }, /* (341) column_reference ::= column_name */ - { 332, -3 }, /* (342) column_reference ::= table_name NK_DOT column_name */ - { 331, -1 }, /* (343) pseudo_column ::= ROWTS */ - { 331, -1 }, /* (344) pseudo_column ::= TBNAME */ - { 331, -3 }, /* (345) pseudo_column ::= table_name NK_DOT TBNAME */ - { 331, -1 }, /* (346) pseudo_column ::= QSTARTTS */ - { 331, -1 }, /* (347) pseudo_column ::= QENDTS */ - { 331, -1 }, /* (348) pseudo_column ::= WSTARTTS */ - { 331, -1 }, /* (349) pseudo_column ::= WENDTS */ - { 331, -1 }, /* (350) pseudo_column ::= WDURATION */ - { 333, -4 }, /* (351) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 333, -4 }, /* (352) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 333, -6 }, /* (353) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 333, -1 }, /* (354) function_expression ::= literal_func */ - { 326, -3 }, /* (355) literal_func ::= noarg_func NK_LP NK_RP */ - { 326, -1 }, /* (356) literal_func ::= NOW */ - { 337, -1 }, /* (357) noarg_func ::= NOW */ - { 337, -1 }, /* (358) noarg_func ::= TODAY */ - { 337, -1 }, /* (359) noarg_func ::= TIMEZONE */ - { 337, -1 }, /* (360) noarg_func ::= DATABASE */ - { 337, -1 }, /* (361) noarg_func ::= CLIENT_VERSION */ - { 337, -1 }, /* (362) noarg_func ::= SERVER_VERSION */ - { 337, -1 }, /* (363) noarg_func ::= SERVER_STATUS */ - { 337, -1 }, /* (364) noarg_func ::= CURRENT_USER */ - { 337, -1 }, /* (365) noarg_func ::= USER */ - { 335, -1 }, /* (366) star_func ::= COUNT */ - { 335, -1 }, /* (367) star_func ::= FIRST */ - { 335, -1 }, /* (368) star_func ::= LAST */ - { 335, -1 }, /* (369) star_func ::= LAST_ROW */ - { 336, -1 }, /* (370) star_func_para_list ::= NK_STAR */ - { 336, -1 }, /* (371) star_func_para_list ::= other_para_list */ - { 338, -1 }, /* (372) other_para_list ::= star_func_para */ - { 338, -3 }, /* (373) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 339, -1 }, /* (374) star_func_para ::= expression */ - { 339, -3 }, /* (375) star_func_para ::= table_name NK_DOT NK_STAR */ - { 340, -3 }, /* (376) predicate ::= expression compare_op expression */ - { 340, -5 }, /* (377) predicate ::= expression BETWEEN expression AND expression */ - { 340, -6 }, /* (378) predicate ::= expression NOT BETWEEN expression AND expression */ - { 340, -3 }, /* (379) predicate ::= expression IS NULL */ - { 340, -4 }, /* (380) predicate ::= expression IS NOT NULL */ - { 340, -3 }, /* (381) predicate ::= expression in_op in_predicate_value */ - { 341, -1 }, /* (382) compare_op ::= NK_LT */ - { 341, -1 }, /* (383) compare_op ::= NK_GT */ - { 341, -1 }, /* (384) compare_op ::= NK_LE */ - { 341, -1 }, /* (385) compare_op ::= NK_GE */ - { 341, -1 }, /* (386) compare_op ::= NK_NE */ - { 341, -1 }, /* (387) compare_op ::= NK_EQ */ - { 341, -1 }, /* (388) compare_op ::= LIKE */ - { 341, -2 }, /* (389) compare_op ::= NOT LIKE */ - { 341, -1 }, /* (390) compare_op ::= MATCH */ - { 341, -1 }, /* (391) compare_op ::= NMATCH */ - { 341, -1 }, /* (392) compare_op ::= CONTAINS */ - { 342, -1 }, /* (393) in_op ::= IN */ - { 342, -2 }, /* (394) in_op ::= NOT IN */ - { 343, -3 }, /* (395) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 344, -1 }, /* (396) boolean_value_expression ::= boolean_primary */ - { 344, -2 }, /* (397) boolean_value_expression ::= NOT boolean_primary */ - { 344, -3 }, /* (398) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 344, -3 }, /* (399) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 345, -1 }, /* (400) boolean_primary ::= predicate */ - { 345, -3 }, /* (401) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 346, -1 }, /* (402) common_expression ::= expression */ - { 346, -1 }, /* (403) common_expression ::= boolean_value_expression */ - { 347, 0 }, /* (404) from_clause_opt ::= */ - { 347, -2 }, /* (405) from_clause_opt ::= FROM table_reference_list */ - { 348, -1 }, /* (406) table_reference_list ::= table_reference */ - { 348, -3 }, /* (407) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 349, -1 }, /* (408) table_reference ::= table_primary */ - { 349, -1 }, /* (409) table_reference ::= joined_table */ - { 350, -2 }, /* (410) table_primary ::= table_name alias_opt */ - { 350, -4 }, /* (411) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 350, -2 }, /* (412) table_primary ::= subquery alias_opt */ - { 350, -1 }, /* (413) table_primary ::= parenthesized_joined_table */ - { 352, 0 }, /* (414) alias_opt ::= */ - { 352, -1 }, /* (415) alias_opt ::= table_alias */ - { 352, -2 }, /* (416) alias_opt ::= AS table_alias */ - { 353, -3 }, /* (417) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 353, -3 }, /* (418) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 351, -6 }, /* (419) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 354, 0 }, /* (420) join_type ::= */ - { 354, -1 }, /* (421) join_type ::= INNER */ - { 356, -12 }, /* (422) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 357, 0 }, /* (423) set_quantifier_opt ::= */ - { 357, -1 }, /* (424) set_quantifier_opt ::= DISTINCT */ - { 357, -1 }, /* (425) set_quantifier_opt ::= ALL */ - { 358, -1 }, /* (426) select_list ::= select_item */ - { 358, -3 }, /* (427) select_list ::= select_list NK_COMMA select_item */ - { 366, -1 }, /* (428) select_item ::= NK_STAR */ - { 366, -1 }, /* (429) select_item ::= common_expression */ - { 366, -2 }, /* (430) select_item ::= common_expression column_alias */ - { 366, -3 }, /* (431) select_item ::= common_expression AS column_alias */ - { 366, -3 }, /* (432) select_item ::= table_name NK_DOT NK_STAR */ - { 324, 0 }, /* (433) where_clause_opt ::= */ - { 324, -2 }, /* (434) where_clause_opt ::= WHERE search_condition */ - { 359, 0 }, /* (435) partition_by_clause_opt ::= */ - { 359, -3 }, /* (436) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 363, 0 }, /* (437) twindow_clause_opt ::= */ - { 363, -6 }, /* (438) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 363, -4 }, /* (439) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 363, -6 }, /* (440) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 363, -8 }, /* (441) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 310, 0 }, /* (442) sliding_opt ::= */ - { 310, -4 }, /* (443) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 362, 0 }, /* (444) fill_opt ::= */ - { 362, -4 }, /* (445) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 362, -6 }, /* (446) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 367, -1 }, /* (447) fill_mode ::= NONE */ - { 367, -1 }, /* (448) fill_mode ::= PREV */ - { 367, -1 }, /* (449) fill_mode ::= NULL */ - { 367, -1 }, /* (450) fill_mode ::= LINEAR */ - { 367, -1 }, /* (451) fill_mode ::= NEXT */ - { 364, 0 }, /* (452) group_by_clause_opt ::= */ - { 364, -3 }, /* (453) group_by_clause_opt ::= GROUP BY group_by_list */ - { 368, -1 }, /* (454) group_by_list ::= expression */ - { 368, -3 }, /* (455) group_by_list ::= group_by_list NK_COMMA expression */ - { 365, 0 }, /* (456) having_clause_opt ::= */ - { 365, -2 }, /* (457) having_clause_opt ::= HAVING search_condition */ - { 360, 0 }, /* (458) range_opt ::= */ - { 360, -6 }, /* (459) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 361, 0 }, /* (460) every_opt ::= */ - { 361, -4 }, /* (461) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 315, -4 }, /* (462) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 369, -1 }, /* (463) query_expression_body ::= query_primary */ - { 369, -4 }, /* (464) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 369, -3 }, /* (465) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 373, -1 }, /* (466) query_primary ::= query_specification */ - { 373, -6 }, /* (467) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 370, 0 }, /* (468) order_by_clause_opt ::= */ - { 370, -3 }, /* (469) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 371, 0 }, /* (470) slimit_clause_opt ::= */ - { 371, -2 }, /* (471) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 371, -4 }, /* (472) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 371, -4 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 372, 0 }, /* (474) limit_clause_opt ::= */ - { 372, -2 }, /* (475) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 372, -4 }, /* (476) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 372, -4 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 334, -3 }, /* (478) subquery ::= NK_LP query_expression NK_RP */ - { 355, -1 }, /* (479) search_condition ::= common_expression */ - { 374, -1 }, /* (480) sort_specification_list ::= sort_specification */ - { 374, -3 }, /* (481) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 375, -3 }, /* (482) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 376, 0 }, /* (483) ordering_specification_opt ::= */ - { 376, -1 }, /* (484) ordering_specification_opt ::= ASC */ - { 376, -1 }, /* (485) ordering_specification_opt ::= DESC */ - { 377, 0 }, /* (486) null_ordering_opt ::= */ - { 377, -2 }, /* (487) null_ordering_opt ::= NULLS FIRST */ - { 377, -2 }, /* (488) null_ordering_opt ::= NULLS LAST */ + { 256, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 256, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 257, 0 }, /* (2) account_options ::= */ + { 257, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 257, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 257, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 257, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 257, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 257, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 257, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 257, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 257, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 258, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 258, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 260, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 260, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 260, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 260, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 260, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 260, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 260, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 260, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 260, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 260, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 256, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 256, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 256, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 256, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 256, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 262, 0 }, /* (29) sysinfo_opt ::= */ + { 262, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 256, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 256, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 263, -1 }, /* (33) privileges ::= ALL */ + { 263, -1 }, /* (34) privileges ::= priv_type_list */ + { 265, -1 }, /* (35) priv_type_list ::= priv_type */ + { 265, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 266, -1 }, /* (37) priv_type ::= READ */ + { 266, -1 }, /* (38) priv_type ::= WRITE */ + { 264, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 264, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 256, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 256, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 256, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 256, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 256, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 256, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 256, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 256, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 268, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 268, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 268, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 256, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 256, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 256, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 256, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 256, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 256, -2 }, /* (64) cmd ::= USE db_name */ + { 256, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 256, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 256, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ + { 269, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 269, 0 }, /* (69) not_exists_opt ::= */ + { 271, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 271, 0 }, /* (71) exists_opt ::= */ + { 270, 0 }, /* (72) db_options ::= */ + { 270, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 270, -3 }, /* (74) db_options ::= db_options CACHELAST NK_INTEGER */ + { 270, -3 }, /* (75) db_options ::= db_options CACHELASTSIZE NK_INTEGER */ + { 270, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 270, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 270, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 270, -3 }, /* (79) db_options ::= db_options FSYNC NK_INTEGER */ + { 270, -3 }, /* (80) db_options ::= db_options MAXROWS NK_INTEGER */ + { 270, -3 }, /* (81) db_options ::= db_options MINROWS NK_INTEGER */ + { 270, -3 }, /* (82) db_options ::= db_options KEEP integer_list */ + { 270, -3 }, /* (83) db_options ::= db_options KEEP variable_list */ + { 270, -3 }, /* (84) db_options ::= db_options PAGES NK_INTEGER */ + { 270, -3 }, /* (85) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 270, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ + { 270, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ + { 270, -3 }, /* (88) db_options ::= db_options STRICT NK_INTEGER */ + { 270, -3 }, /* (89) db_options ::= db_options WAL NK_INTEGER */ + { 270, -3 }, /* (90) db_options ::= db_options VGROUPS NK_INTEGER */ + { 270, -3 }, /* (91) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 270, -3 }, /* (92) db_options ::= db_options RETENTIONS retention_list */ + { 270, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 272, -1 }, /* (94) alter_db_options ::= alter_db_option */ + { 272, -2 }, /* (95) alter_db_options ::= alter_db_options alter_db_option */ + { 276, -2 }, /* (96) alter_db_option ::= BUFFER NK_INTEGER */ + { 276, -2 }, /* (97) alter_db_option ::= CACHELAST NK_INTEGER */ + { 276, -2 }, /* (98) alter_db_option ::= CACHELASTSIZE NK_INTEGER */ + { 276, -2 }, /* (99) alter_db_option ::= FSYNC NK_INTEGER */ + { 276, -2 }, /* (100) alter_db_option ::= KEEP integer_list */ + { 276, -2 }, /* (101) alter_db_option ::= KEEP variable_list */ + { 276, -2 }, /* (102) alter_db_option ::= PAGES NK_INTEGER */ + { 276, -2 }, /* (103) alter_db_option ::= REPLICA NK_INTEGER */ + { 276, -2 }, /* (104) alter_db_option ::= STRICT NK_INTEGER */ + { 276, -2 }, /* (105) alter_db_option ::= WAL NK_INTEGER */ + { 273, -1 }, /* (106) integer_list ::= NK_INTEGER */ + { 273, -3 }, /* (107) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 274, -1 }, /* (108) variable_list ::= NK_VARIABLE */ + { 274, -3 }, /* (109) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 275, -1 }, /* (110) retention_list ::= retention */ + { 275, -3 }, /* (111) retention_list ::= retention_list NK_COMMA retention */ + { 277, -3 }, /* (112) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 256, -9 }, /* (113) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 256, -3 }, /* (114) cmd ::= CREATE TABLE multi_create_clause */ + { 256, -9 }, /* (115) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 256, -3 }, /* (116) cmd ::= DROP TABLE multi_drop_clause */ + { 256, -4 }, /* (117) cmd ::= DROP STABLE exists_opt full_table_name */ + { 256, -3 }, /* (118) cmd ::= ALTER TABLE alter_table_clause */ + { 256, -3 }, /* (119) cmd ::= ALTER STABLE alter_table_clause */ + { 285, -2 }, /* (120) alter_table_clause ::= full_table_name alter_table_options */ + { 285, -5 }, /* (121) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 285, -4 }, /* (122) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 285, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 285, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 285, -5 }, /* (125) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 285, -4 }, /* (126) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 285, -5 }, /* (127) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 285, -5 }, /* (128) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 285, -6 }, /* (129) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 282, -1 }, /* (130) multi_create_clause ::= create_subtable_clause */ + { 282, -2 }, /* (131) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 290, -10 }, /* (132) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 284, -1 }, /* (133) multi_drop_clause ::= drop_table_clause */ + { 284, -2 }, /* (134) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 293, -2 }, /* (135) drop_table_clause ::= exists_opt full_table_name */ + { 291, 0 }, /* (136) specific_cols_opt ::= */ + { 291, -3 }, /* (137) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 278, -1 }, /* (138) full_table_name ::= table_name */ + { 278, -3 }, /* (139) full_table_name ::= db_name NK_DOT table_name */ + { 279, -1 }, /* (140) column_def_list ::= column_def */ + { 279, -3 }, /* (141) column_def_list ::= column_def_list NK_COMMA column_def */ + { 296, -2 }, /* (142) column_def ::= column_name type_name */ + { 296, -4 }, /* (143) column_def ::= column_name type_name COMMENT NK_STRING */ + { 288, -1 }, /* (144) type_name ::= BOOL */ + { 288, -1 }, /* (145) type_name ::= TINYINT */ + { 288, -1 }, /* (146) type_name ::= SMALLINT */ + { 288, -1 }, /* (147) type_name ::= INT */ + { 288, -1 }, /* (148) type_name ::= INTEGER */ + { 288, -1 }, /* (149) type_name ::= BIGINT */ + { 288, -1 }, /* (150) type_name ::= FLOAT */ + { 288, -1 }, /* (151) type_name ::= DOUBLE */ + { 288, -4 }, /* (152) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (153) type_name ::= TIMESTAMP */ + { 288, -4 }, /* (154) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 288, -2 }, /* (155) type_name ::= TINYINT UNSIGNED */ + { 288, -2 }, /* (156) type_name ::= SMALLINT UNSIGNED */ + { 288, -2 }, /* (157) type_name ::= INT UNSIGNED */ + { 288, -2 }, /* (158) type_name ::= BIGINT UNSIGNED */ + { 288, -1 }, /* (159) type_name ::= JSON */ + { 288, -4 }, /* (160) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (161) type_name ::= MEDIUMBLOB */ + { 288, -1 }, /* (162) type_name ::= BLOB */ + { 288, -4 }, /* (163) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (164) type_name ::= DECIMAL */ + { 288, -4 }, /* (165) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 288, -6 }, /* (166) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 280, 0 }, /* (167) tags_def_opt ::= */ + { 280, -1 }, /* (168) tags_def_opt ::= tags_def */ + { 283, -4 }, /* (169) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 281, 0 }, /* (170) table_options ::= */ + { 281, -3 }, /* (171) table_options ::= table_options COMMENT NK_STRING */ + { 281, -3 }, /* (172) table_options ::= table_options MAX_DELAY duration_list */ + { 281, -3 }, /* (173) table_options ::= table_options WATERMARK duration_list */ + { 281, -5 }, /* (174) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 281, -3 }, /* (175) table_options ::= table_options TTL NK_INTEGER */ + { 281, -5 }, /* (176) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 286, -1 }, /* (177) alter_table_options ::= alter_table_option */ + { 286, -2 }, /* (178) alter_table_options ::= alter_table_options alter_table_option */ + { 299, -2 }, /* (179) alter_table_option ::= COMMENT NK_STRING */ + { 299, -2 }, /* (180) alter_table_option ::= TTL NK_INTEGER */ + { 297, -1 }, /* (181) duration_list ::= duration_literal */ + { 297, -3 }, /* (182) duration_list ::= duration_list NK_COMMA duration_literal */ + { 298, -1 }, /* (183) rollup_func_list ::= rollup_func_name */ + { 298, -3 }, /* (184) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 301, -1 }, /* (185) rollup_func_name ::= function_name */ + { 301, -1 }, /* (186) rollup_func_name ::= FIRST */ + { 301, -1 }, /* (187) rollup_func_name ::= LAST */ + { 294, -1 }, /* (188) col_name_list ::= col_name */ + { 294, -3 }, /* (189) col_name_list ::= col_name_list NK_COMMA col_name */ + { 303, -1 }, /* (190) col_name ::= column_name */ + { 256, -2 }, /* (191) cmd ::= SHOW DNODES */ + { 256, -2 }, /* (192) cmd ::= SHOW USERS */ + { 256, -2 }, /* (193) cmd ::= SHOW DATABASES */ + { 256, -4 }, /* (194) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 256, -4 }, /* (195) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 256, -3 }, /* (196) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 256, -2 }, /* (197) cmd ::= SHOW MNODES */ + { 256, -2 }, /* (198) cmd ::= SHOW MODULES */ + { 256, -2 }, /* (199) cmd ::= SHOW QNODES */ + { 256, -2 }, /* (200) cmd ::= SHOW FUNCTIONS */ + { 256, -5 }, /* (201) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 256, -2 }, /* (202) cmd ::= SHOW STREAMS */ + { 256, -2 }, /* (203) cmd ::= SHOW ACCOUNTS */ + { 256, -2 }, /* (204) cmd ::= SHOW APPS */ + { 256, -2 }, /* (205) cmd ::= SHOW CONNECTIONS */ + { 256, -2 }, /* (206) cmd ::= SHOW LICENCE */ + { 256, -2 }, /* (207) cmd ::= SHOW GRANTS */ + { 256, -4 }, /* (208) cmd ::= SHOW CREATE DATABASE db_name */ + { 256, -4 }, /* (209) cmd ::= SHOW CREATE TABLE full_table_name */ + { 256, -4 }, /* (210) cmd ::= SHOW CREATE STABLE full_table_name */ + { 256, -2 }, /* (211) cmd ::= SHOW QUERIES */ + { 256, -2 }, /* (212) cmd ::= SHOW SCORES */ + { 256, -2 }, /* (213) cmd ::= SHOW TOPICS */ + { 256, -2 }, /* (214) cmd ::= SHOW VARIABLES */ + { 256, -3 }, /* (215) cmd ::= SHOW LOCAL VARIABLES */ + { 256, -4 }, /* (216) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 256, -2 }, /* (217) cmd ::= SHOW BNODES */ + { 256, -2 }, /* (218) cmd ::= SHOW SNODES */ + { 256, -2 }, /* (219) cmd ::= SHOW CLUSTER */ + { 256, -2 }, /* (220) cmd ::= SHOW TRANSACTIONS */ + { 256, -4 }, /* (221) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 256, -2 }, /* (222) cmd ::= SHOW CONSUMERS */ + { 256, -2 }, /* (223) cmd ::= SHOW SUBSCRIPTIONS */ + { 304, 0 }, /* (224) db_name_cond_opt ::= */ + { 304, -2 }, /* (225) db_name_cond_opt ::= db_name NK_DOT */ + { 305, 0 }, /* (226) like_pattern_opt ::= */ + { 305, -2 }, /* (227) like_pattern_opt ::= LIKE NK_STRING */ + { 306, -1 }, /* (228) table_name_cond ::= table_name */ + { 307, 0 }, /* (229) from_db_opt ::= */ + { 307, -2 }, /* (230) from_db_opt ::= FROM db_name */ + { 256, -8 }, /* (231) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 256, -4 }, /* (232) cmd ::= DROP INDEX exists_opt index_name */ + { 309, -10 }, /* (233) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 309, -12 }, /* (234) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 310, -1 }, /* (235) func_list ::= func */ + { 310, -3 }, /* (236) func_list ::= func_list NK_COMMA func */ + { 313, -4 }, /* (237) func ::= function_name NK_LP expression_list NK_RP */ + { 312, 0 }, /* (238) sma_stream_opt ::= */ + { 312, -3 }, /* (239) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 312, -3 }, /* (240) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 256, -6 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 256, -7 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 256, -9 }, /* (243) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 256, -7 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 256, -9 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 256, -4 }, /* (246) cmd ::= DROP TOPIC exists_opt topic_name */ + { 256, -7 }, /* (247) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 256, -2 }, /* (248) cmd ::= DESC full_table_name */ + { 256, -2 }, /* (249) cmd ::= DESCRIBE full_table_name */ + { 256, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ + { 256, -4 }, /* (251) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 318, 0 }, /* (252) analyze_opt ::= */ + { 318, -1 }, /* (253) analyze_opt ::= ANALYZE */ + { 319, 0 }, /* (254) explain_options ::= */ + { 319, -3 }, /* (255) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 319, -3 }, /* (256) explain_options ::= explain_options RATIO NK_FLOAT */ + { 256, -6 }, /* (257) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 256, -10 }, /* (258) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 256, -4 }, /* (259) cmd ::= DROP FUNCTION exists_opt function_name */ + { 320, 0 }, /* (260) agg_func_opt ::= */ + { 320, -1 }, /* (261) agg_func_opt ::= AGGREGATE */ + { 321, 0 }, /* (262) bufsize_opt ::= */ + { 321, -2 }, /* (263) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 256, -8 }, /* (264) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 256, -4 }, /* (265) cmd ::= DROP STREAM exists_opt stream_name */ + { 323, 0 }, /* (266) into_opt ::= */ + { 323, -2 }, /* (267) into_opt ::= INTO full_table_name */ + { 314, 0 }, /* (268) stream_options ::= */ + { 314, -3 }, /* (269) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 314, -3 }, /* (270) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 314, -4 }, /* (271) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 314, -3 }, /* (272) stream_options ::= stream_options WATERMARK duration_literal */ + { 314, -3 }, /* (273) stream_options ::= stream_options IGNORE EXPIRED */ + { 256, -3 }, /* (274) cmd ::= KILL CONNECTION NK_INTEGER */ + { 256, -3 }, /* (275) cmd ::= KILL QUERY NK_STRING */ + { 256, -3 }, /* (276) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 256, -2 }, /* (277) cmd ::= BALANCE VGROUP */ + { 256, -4 }, /* (278) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 256, -4 }, /* (279) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 256, -3 }, /* (280) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 324, -2 }, /* (281) dnode_list ::= DNODE NK_INTEGER */ + { 324, -3 }, /* (282) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 256, -3 }, /* (283) cmd ::= SYNCDB db_name REPLICA */ + { 256, -4 }, /* (284) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 256, -1 }, /* (285) cmd ::= query_expression */ + { 256, -7 }, /* (286) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ + { 256, -4 }, /* (287) cmd ::= INSERT INTO full_table_name query_expression */ + { 259, -1 }, /* (288) literal ::= NK_INTEGER */ + { 259, -1 }, /* (289) literal ::= NK_FLOAT */ + { 259, -1 }, /* (290) literal ::= NK_STRING */ + { 259, -1 }, /* (291) literal ::= NK_BOOL */ + { 259, -2 }, /* (292) literal ::= TIMESTAMP NK_STRING */ + { 259, -1 }, /* (293) literal ::= duration_literal */ + { 259, -1 }, /* (294) literal ::= NULL */ + { 259, -1 }, /* (295) literal ::= NK_QUESTION */ + { 300, -1 }, /* (296) duration_literal ::= NK_VARIABLE */ + { 326, -1 }, /* (297) signed ::= NK_INTEGER */ + { 326, -2 }, /* (298) signed ::= NK_PLUS NK_INTEGER */ + { 326, -2 }, /* (299) signed ::= NK_MINUS NK_INTEGER */ + { 326, -1 }, /* (300) signed ::= NK_FLOAT */ + { 326, -2 }, /* (301) signed ::= NK_PLUS NK_FLOAT */ + { 326, -2 }, /* (302) signed ::= NK_MINUS NK_FLOAT */ + { 289, -1 }, /* (303) signed_literal ::= signed */ + { 289, -1 }, /* (304) signed_literal ::= NK_STRING */ + { 289, -1 }, /* (305) signed_literal ::= NK_BOOL */ + { 289, -2 }, /* (306) signed_literal ::= TIMESTAMP NK_STRING */ + { 289, -1 }, /* (307) signed_literal ::= duration_literal */ + { 289, -1 }, /* (308) signed_literal ::= NULL */ + { 289, -1 }, /* (309) signed_literal ::= literal_func */ + { 289, -1 }, /* (310) signed_literal ::= NK_QUESTION */ + { 328, -1 }, /* (311) literal_list ::= signed_literal */ + { 328, -3 }, /* (312) literal_list ::= literal_list NK_COMMA signed_literal */ + { 267, -1 }, /* (313) db_name ::= NK_ID */ + { 295, -1 }, /* (314) table_name ::= NK_ID */ + { 287, -1 }, /* (315) column_name ::= NK_ID */ + { 302, -1 }, /* (316) function_name ::= NK_ID */ + { 329, -1 }, /* (317) table_alias ::= NK_ID */ + { 330, -1 }, /* (318) column_alias ::= NK_ID */ + { 261, -1 }, /* (319) user_name ::= NK_ID */ + { 308, -1 }, /* (320) index_name ::= NK_ID */ + { 315, -1 }, /* (321) topic_name ::= NK_ID */ + { 322, -1 }, /* (322) stream_name ::= NK_ID */ + { 317, -1 }, /* (323) cgroup_name ::= NK_ID */ + { 331, -1 }, /* (324) expression ::= literal */ + { 331, -1 }, /* (325) expression ::= pseudo_column */ + { 331, -1 }, /* (326) expression ::= column_reference */ + { 331, -1 }, /* (327) expression ::= function_expression */ + { 331, -1 }, /* (328) expression ::= subquery */ + { 331, -3 }, /* (329) expression ::= NK_LP expression NK_RP */ + { 331, -2 }, /* (330) expression ::= NK_PLUS expression */ + { 331, -2 }, /* (331) expression ::= NK_MINUS expression */ + { 331, -3 }, /* (332) expression ::= expression NK_PLUS expression */ + { 331, -3 }, /* (333) expression ::= expression NK_MINUS expression */ + { 331, -3 }, /* (334) expression ::= expression NK_STAR expression */ + { 331, -3 }, /* (335) expression ::= expression NK_SLASH expression */ + { 331, -3 }, /* (336) expression ::= expression NK_REM expression */ + { 331, -3 }, /* (337) expression ::= column_reference NK_ARROW NK_STRING */ + { 331, -3 }, /* (338) expression ::= expression NK_BITAND expression */ + { 331, -3 }, /* (339) expression ::= expression NK_BITOR expression */ + { 292, -1 }, /* (340) expression_list ::= expression */ + { 292, -3 }, /* (341) expression_list ::= expression_list NK_COMMA expression */ + { 333, -1 }, /* (342) column_reference ::= column_name */ + { 333, -3 }, /* (343) column_reference ::= table_name NK_DOT column_name */ + { 332, -1 }, /* (344) pseudo_column ::= ROWTS */ + { 332, -1 }, /* (345) pseudo_column ::= TBNAME */ + { 332, -3 }, /* (346) pseudo_column ::= table_name NK_DOT TBNAME */ + { 332, -1 }, /* (347) pseudo_column ::= QSTART */ + { 332, -1 }, /* (348) pseudo_column ::= QEND */ + { 332, -1 }, /* (349) pseudo_column ::= QDURATION */ + { 332, -1 }, /* (350) pseudo_column ::= WSTART */ + { 332, -1 }, /* (351) pseudo_column ::= WEND */ + { 332, -1 }, /* (352) pseudo_column ::= WDURATION */ + { 334, -4 }, /* (353) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 334, -4 }, /* (354) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 334, -6 }, /* (355) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 334, -1 }, /* (356) function_expression ::= literal_func */ + { 327, -3 }, /* (357) literal_func ::= noarg_func NK_LP NK_RP */ + { 327, -1 }, /* (358) literal_func ::= NOW */ + { 338, -1 }, /* (359) noarg_func ::= NOW */ + { 338, -1 }, /* (360) noarg_func ::= TODAY */ + { 338, -1 }, /* (361) noarg_func ::= TIMEZONE */ + { 338, -1 }, /* (362) noarg_func ::= DATABASE */ + { 338, -1 }, /* (363) noarg_func ::= CLIENT_VERSION */ + { 338, -1 }, /* (364) noarg_func ::= SERVER_VERSION */ + { 338, -1 }, /* (365) noarg_func ::= SERVER_STATUS */ + { 338, -1 }, /* (366) noarg_func ::= CURRENT_USER */ + { 338, -1 }, /* (367) noarg_func ::= USER */ + { 336, -1 }, /* (368) star_func ::= COUNT */ + { 336, -1 }, /* (369) star_func ::= FIRST */ + { 336, -1 }, /* (370) star_func ::= LAST */ + { 336, -1 }, /* (371) star_func ::= LAST_ROW */ + { 337, -1 }, /* (372) star_func_para_list ::= NK_STAR */ + { 337, -1 }, /* (373) star_func_para_list ::= other_para_list */ + { 339, -1 }, /* (374) other_para_list ::= star_func_para */ + { 339, -3 }, /* (375) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 340, -1 }, /* (376) star_func_para ::= expression */ + { 340, -3 }, /* (377) star_func_para ::= table_name NK_DOT NK_STAR */ + { 341, -3 }, /* (378) predicate ::= expression compare_op expression */ + { 341, -5 }, /* (379) predicate ::= expression BETWEEN expression AND expression */ + { 341, -6 }, /* (380) predicate ::= expression NOT BETWEEN expression AND expression */ + { 341, -3 }, /* (381) predicate ::= expression IS NULL */ + { 341, -4 }, /* (382) predicate ::= expression IS NOT NULL */ + { 341, -3 }, /* (383) predicate ::= expression in_op in_predicate_value */ + { 342, -1 }, /* (384) compare_op ::= NK_LT */ + { 342, -1 }, /* (385) compare_op ::= NK_GT */ + { 342, -1 }, /* (386) compare_op ::= NK_LE */ + { 342, -1 }, /* (387) compare_op ::= NK_GE */ + { 342, -1 }, /* (388) compare_op ::= NK_NE */ + { 342, -1 }, /* (389) compare_op ::= NK_EQ */ + { 342, -1 }, /* (390) compare_op ::= LIKE */ + { 342, -2 }, /* (391) compare_op ::= NOT LIKE */ + { 342, -1 }, /* (392) compare_op ::= MATCH */ + { 342, -1 }, /* (393) compare_op ::= NMATCH */ + { 342, -1 }, /* (394) compare_op ::= CONTAINS */ + { 343, -1 }, /* (395) in_op ::= IN */ + { 343, -2 }, /* (396) in_op ::= NOT IN */ + { 344, -3 }, /* (397) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 345, -1 }, /* (398) boolean_value_expression ::= boolean_primary */ + { 345, -2 }, /* (399) boolean_value_expression ::= NOT boolean_primary */ + { 345, -3 }, /* (400) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 345, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 346, -1 }, /* (402) boolean_primary ::= predicate */ + { 346, -3 }, /* (403) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 347, -1 }, /* (404) common_expression ::= expression */ + { 347, -1 }, /* (405) common_expression ::= boolean_value_expression */ + { 348, 0 }, /* (406) from_clause_opt ::= */ + { 348, -2 }, /* (407) from_clause_opt ::= FROM table_reference_list */ + { 349, -1 }, /* (408) table_reference_list ::= table_reference */ + { 349, -3 }, /* (409) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 350, -1 }, /* (410) table_reference ::= table_primary */ + { 350, -1 }, /* (411) table_reference ::= joined_table */ + { 351, -2 }, /* (412) table_primary ::= table_name alias_opt */ + { 351, -4 }, /* (413) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 351, -2 }, /* (414) table_primary ::= subquery alias_opt */ + { 351, -1 }, /* (415) table_primary ::= parenthesized_joined_table */ + { 353, 0 }, /* (416) alias_opt ::= */ + { 353, -1 }, /* (417) alias_opt ::= table_alias */ + { 353, -2 }, /* (418) alias_opt ::= AS table_alias */ + { 354, -3 }, /* (419) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 354, -3 }, /* (420) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 352, -6 }, /* (421) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 355, 0 }, /* (422) join_type ::= */ + { 355, -1 }, /* (423) join_type ::= INNER */ + { 357, -12 }, /* (424) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 358, 0 }, /* (425) set_quantifier_opt ::= */ + { 358, -1 }, /* (426) set_quantifier_opt ::= DISTINCT */ + { 358, -1 }, /* (427) set_quantifier_opt ::= ALL */ + { 359, -1 }, /* (428) select_list ::= select_item */ + { 359, -3 }, /* (429) select_list ::= select_list NK_COMMA select_item */ + { 367, -1 }, /* (430) select_item ::= NK_STAR */ + { 367, -1 }, /* (431) select_item ::= common_expression */ + { 367, -2 }, /* (432) select_item ::= common_expression column_alias */ + { 367, -3 }, /* (433) select_item ::= common_expression AS column_alias */ + { 367, -3 }, /* (434) select_item ::= table_name NK_DOT NK_STAR */ + { 325, 0 }, /* (435) where_clause_opt ::= */ + { 325, -2 }, /* (436) where_clause_opt ::= WHERE search_condition */ + { 360, 0 }, /* (437) partition_by_clause_opt ::= */ + { 360, -3 }, /* (438) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 364, 0 }, /* (439) twindow_clause_opt ::= */ + { 364, -6 }, /* (440) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 364, -4 }, /* (441) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 364, -6 }, /* (442) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 364, -8 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 311, 0 }, /* (444) sliding_opt ::= */ + { 311, -4 }, /* (445) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 363, 0 }, /* (446) fill_opt ::= */ + { 363, -4 }, /* (447) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 363, -6 }, /* (448) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 368, -1 }, /* (449) fill_mode ::= NONE */ + { 368, -1 }, /* (450) fill_mode ::= PREV */ + { 368, -1 }, /* (451) fill_mode ::= NULL */ + { 368, -1 }, /* (452) fill_mode ::= LINEAR */ + { 368, -1 }, /* (453) fill_mode ::= NEXT */ + { 365, 0 }, /* (454) group_by_clause_opt ::= */ + { 365, -3 }, /* (455) group_by_clause_opt ::= GROUP BY group_by_list */ + { 369, -1 }, /* (456) group_by_list ::= expression */ + { 369, -3 }, /* (457) group_by_list ::= group_by_list NK_COMMA expression */ + { 366, 0 }, /* (458) having_clause_opt ::= */ + { 366, -2 }, /* (459) having_clause_opt ::= HAVING search_condition */ + { 361, 0 }, /* (460) range_opt ::= */ + { 361, -6 }, /* (461) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 362, 0 }, /* (462) every_opt ::= */ + { 362, -4 }, /* (463) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 316, -4 }, /* (464) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 370, -1 }, /* (465) query_expression_body ::= query_primary */ + { 370, -4 }, /* (466) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 370, -3 }, /* (467) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 374, -1 }, /* (468) query_primary ::= query_specification */ + { 374, -6 }, /* (469) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 371, 0 }, /* (470) order_by_clause_opt ::= */ + { 371, -3 }, /* (471) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 372, 0 }, /* (472) slimit_clause_opt ::= */ + { 372, -2 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 372, -4 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 372, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 373, 0 }, /* (476) limit_clause_opt ::= */ + { 373, -2 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 373, -4 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 373, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 335, -3 }, /* (480) subquery ::= NK_LP query_expression NK_RP */ + { 356, -1 }, /* (481) search_condition ::= common_expression */ + { 375, -1 }, /* (482) sort_specification_list ::= sort_specification */ + { 375, -3 }, /* (483) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 376, -3 }, /* (484) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 377, 0 }, /* (485) ordering_specification_opt ::= */ + { 377, -1 }, /* (486) ordering_specification_opt ::= ASC */ + { 377, -1 }, /* (487) ordering_specification_opt ::= DESC */ + { 378, 0 }, /* (488) null_ordering_opt ::= */ + { 378, -2 }, /* (489) null_ordering_opt ::= NULLS FIRST */ + { 378, -2 }, /* (490) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3269,11 +3321,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,256,&yymsp[0].minor); + yy_destructor(yypParser,257,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,257,&yymsp[0].minor); + yy_destructor(yypParser,258,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3287,20 +3339,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,256,&yymsp[-2].minor); +{ yy_destructor(yypParser,257,&yymsp[-2].minor); { } - yy_destructor(yypParser,258,&yymsp[0].minor); + yy_destructor(yypParser,259,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,259,&yymsp[0].minor); +{ yy_destructor(yypParser,260,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,257,&yymsp[-1].minor); +{ yy_destructor(yypParser,258,&yymsp[-1].minor); { } - yy_destructor(yypParser,259,&yymsp[0].minor); + yy_destructor(yypParser,260,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3314,72 +3366,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,258,&yymsp[0].minor); + yy_destructor(yypParser,259,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy0, yymsp[0].minor.yy719); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy0, yymsp[0].minor.yy285); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy361); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy719 = 1; } +{ yymsp[1].minor.yy285 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy719 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy285 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy585, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy585, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy585 = yymsp[0].minor.yy585; } - yymsp[0].minor.yy585 = yylhsminor.yy585; +{ yylhsminor.yy457 = yymsp[0].minor.yy457; } + yymsp[0].minor.yy457 = yylhsminor.yy457; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy585 = yymsp[-2].minor.yy585 | yymsp[0].minor.yy585; } - yymsp[-2].minor.yy585 = yylhsminor.yy585; +{ yylhsminor.yy457 = yymsp[-2].minor.yy457 | yymsp[0].minor.yy457; } + yymsp[-2].minor.yy457 = yylhsminor.yy457; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy533 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy533 = yylhsminor.yy533; +{ yylhsminor.yy361 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy361 = yylhsminor.yy361; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy533 = yymsp[-2].minor.yy533; } - yymsp[-2].minor.yy533 = yylhsminor.yy533; +{ yylhsminor.yy361 = yymsp[-2].minor.yy361; } + yymsp[-2].minor.yy361 = yylhsminor.yy361; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy533, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy361, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy361); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3396,32 +3448,32 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 312: /* db_name ::= NK_ID */ yytestcase(yyruleno==312); - case 313: /* table_name ::= NK_ID */ yytestcase(yyruleno==313); - case 314: /* column_name ::= NK_ID */ yytestcase(yyruleno==314); - case 315: /* function_name ::= NK_ID */ yytestcase(yyruleno==315); - case 316: /* table_alias ::= NK_ID */ yytestcase(yyruleno==316); - case 317: /* column_alias ::= NK_ID */ yytestcase(yyruleno==317); - case 318: /* user_name ::= NK_ID */ yytestcase(yyruleno==318); - case 319: /* index_name ::= NK_ID */ yytestcase(yyruleno==319); - case 320: /* topic_name ::= NK_ID */ yytestcase(yyruleno==320); - case 321: /* stream_name ::= NK_ID */ yytestcase(yyruleno==321); - case 322: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==322); - case 357: /* noarg_func ::= NOW */ yytestcase(yyruleno==357); - case 358: /* noarg_func ::= TODAY */ yytestcase(yyruleno==358); - case 359: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==359); - case 360: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==360); - case 361: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==361); - case 362: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==362); - case 363: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==363); - case 364: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==364); - case 365: /* noarg_func ::= USER */ yytestcase(yyruleno==365); - case 366: /* star_func ::= COUNT */ yytestcase(yyruleno==366); - case 367: /* star_func ::= FIRST */ yytestcase(yyruleno==367); - case 368: /* star_func ::= LAST */ yytestcase(yyruleno==368); - case 369: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==369); -{ yylhsminor.yy533 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + case 313: /* db_name ::= NK_ID */ yytestcase(yyruleno==313); + case 314: /* table_name ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* column_name ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* function_name ::= NK_ID */ yytestcase(yyruleno==316); + case 317: /* table_alias ::= NK_ID */ yytestcase(yyruleno==317); + case 318: /* column_alias ::= NK_ID */ yytestcase(yyruleno==318); + case 319: /* user_name ::= NK_ID */ yytestcase(yyruleno==319); + case 320: /* index_name ::= NK_ID */ yytestcase(yyruleno==320); + case 321: /* topic_name ::= NK_ID */ yytestcase(yyruleno==321); + case 322: /* stream_name ::= NK_ID */ yytestcase(yyruleno==322); + case 323: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==323); + case 359: /* noarg_func ::= NOW */ yytestcase(yyruleno==359); + case 360: /* noarg_func ::= TODAY */ yytestcase(yyruleno==360); + case 361: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==361); + case 362: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==362); + case 363: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==363); + case 364: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==364); + case 365: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==365); + case 366: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==366); + case 367: /* noarg_func ::= USER */ yytestcase(yyruleno==367); + case 368: /* star_func ::= COUNT */ yytestcase(yyruleno==368); + case 369: /* star_func ::= FIRST */ yytestcase(yyruleno==369); + case 370: /* star_func ::= LAST */ yytestcase(yyruleno==370); + case 371: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==371); +{ yylhsminor.yy361 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy361 = yylhsminor.yy361; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3454,169 +3506,169 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy151, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } break; case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy173 = true; } +{ yymsp[-2].minor.yy151 = true; } break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); case 252: /* analyze_opt ::= */ yytestcase(yyruleno==252); case 260: /* agg_func_opt ::= */ yytestcase(yyruleno==260); - case 423: /* set_quantifier_opt ::= */ yytestcase(yyruleno==423); -{ yymsp[1].minor.yy173 = false; } + case 425: /* set_quantifier_opt ::= */ yytestcase(yyruleno==425); +{ yymsp[1].minor.yy151 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy173 = true; } +{ yymsp[-1].minor.yy151 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy616 = createDefaultDatabaseOptions(pCxt); } break; case 73: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 74: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 75: /* db_options ::= db_options CACHELASTSIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHELASTSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHELASTSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 76: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 77: /* db_options ::= db_options DURATION NK_INTEGER */ case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 79: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 80: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 81: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 82: /* db_options ::= db_options KEEP integer_list */ case 83: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==83); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy712); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_KEEP, yymsp[0].minor.yy356); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 84: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 85: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 86: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 87: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 88: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 89: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 90: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 91: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 92: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy712); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_RETENTIONS, yymsp[0].minor.yy356); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 93: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 94: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy389); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterDatabaseOptions(pCxt); yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yylhsminor.yy616, &yymsp[0].minor.yy409); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 95: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy389); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy616, &yymsp[0].minor.yy409); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 96: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 97: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 98: /* alter_db_option ::= CACHELASTSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHELASTSIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHELASTSIZE; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 99: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 100: /* alter_db_option ::= KEEP integer_list */ case 101: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==101); -{ yymsp[-1].minor.yy389.type = DB_OPTION_KEEP; yymsp[-1].minor.yy389.pList = yymsp[0].minor.yy712; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_KEEP; yymsp[-1].minor.yy409.pList = yymsp[0].minor.yy356; } break; case 102: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_PAGES; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_PAGES; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 103: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 104: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_STRICT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_STRICT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 105: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = DB_OPTION_WAL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 106: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy712 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy712 = yylhsminor.yy712; +{ yylhsminor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; case 107: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 282: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==282); -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy712 = yylhsminor.yy712; +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy356 = yylhsminor.yy356; break; case 108: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy712 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy712 = yylhsminor.yy712; +{ yylhsminor.yy356 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; case 109: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy712 = yylhsminor.yy712; +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy356 = yylhsminor.yy356; break; case 110: /* retention_list ::= retention */ case 130: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==130); @@ -3625,266 +3677,266 @@ static YYACTIONTYPE yy_reduce( case 183: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==183); case 188: /* col_name_list ::= col_name */ yytestcase(yyruleno==188); case 235: /* func_list ::= func */ yytestcase(yyruleno==235); - case 310: /* literal_list ::= signed_literal */ yytestcase(yyruleno==310); - case 372: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==372); - case 426: /* select_list ::= select_item */ yytestcase(yyruleno==426); - case 480: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==480); -{ yylhsminor.yy712 = createNodeList(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy712 = yylhsminor.yy712; + case 311: /* literal_list ::= signed_literal */ yytestcase(yyruleno==311); + case 374: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==374); + case 428: /* select_list ::= select_item */ yytestcase(yyruleno==428); + case 482: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==482); +{ yylhsminor.yy356 = createNodeList(pCxt, yymsp[0].minor.yy616); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; case 111: /* retention_list ::= retention_list NK_COMMA retention */ case 141: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==141); case 184: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==184); case 189: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==189); case 236: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==236); - case 311: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==311); - case 373: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==373); - case 427: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==427); - case 481: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==481); -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy712 = yylhsminor.yy712; + case 312: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==312); + case 375: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==375); + case 429: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==429); + case 483: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==483); +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } + yymsp[-2].minor.yy356 = yylhsminor.yy356; break; case 112: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 113: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 115: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==115); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy712, yymsp[-1].minor.yy712, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy616, yymsp[-3].minor.yy356, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } break; case 114: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy712); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy356); } break; case 116: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy712); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy356); } break; case 117: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } break; case 118: /* cmd ::= ALTER TABLE alter_table_clause */ case 285: /* cmd ::= query_expression */ yytestcase(yyruleno==285); -{ pCxt->pRootNode = yymsp[0].minor.yy560; } +{ pCxt->pRootNode = yymsp[0].minor.yy616; } break; case 119: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy616); } break; case 120: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 121: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy533, yymsp[0].minor.yy196); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 122: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy361); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 123: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy196); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 124: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 125: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy533, yymsp[0].minor.yy196); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 126: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy361); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 127: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy196); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 128: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 129: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy616, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; case 131: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 134: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==134); -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy712 = yylhsminor.yy712; +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy356 = yylhsminor.yy356; break; case 132: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy560); } - yymsp[-9].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy151, yymsp[-8].minor.yy616, yymsp[-6].minor.yy616, yymsp[-5].minor.yy356, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } + yymsp[-9].minor.yy616 = yylhsminor.yy616; break; case 135: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 136: /* specific_cols_opt ::= */ case 167: /* tags_def_opt ::= */ yytestcase(yyruleno==167); - case 435: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==435); - case 452: /* group_by_clause_opt ::= */ yytestcase(yyruleno==452); - case 468: /* order_by_clause_opt ::= */ yytestcase(yyruleno==468); -{ yymsp[1].minor.yy712 = NULL; } + case 437: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==437); + case 454: /* group_by_clause_opt ::= */ yytestcase(yyruleno==454); + case 470: /* order_by_clause_opt ::= */ yytestcase(yyruleno==470); +{ yymsp[1].minor.yy356 = NULL; } break; case 137: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; } +{ yymsp[-2].minor.yy356 = yymsp[-1].minor.yy356; } break; case 138: /* full_table_name ::= table_name */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy361, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 139: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, NULL); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 142: /* column_def ::= column_name type_name */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy196, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600, NULL); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 143: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-2].minor.yy196, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 144: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 145: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 146: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 147: /* type_name ::= INT */ case 148: /* type_name ::= INTEGER */ yytestcase(yyruleno==148); -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_INT); } break; case 149: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 150: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 151: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 152: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy196 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 153: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 154: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy196 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 155: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy196 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 156: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy196 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 157: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy196 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 158: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy196 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 159: /* type_name ::= JSON */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 160: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy196 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 161: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 162: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 163: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy196 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 164: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy196 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 165: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy196 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 166: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy196 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 168: /* tags_def_opt ::= tags_def */ - case 371: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==371); -{ yylhsminor.yy712 = yymsp[0].minor.yy712; } - yymsp[0].minor.yy712 = yylhsminor.yy712; + case 373: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==373); +{ yylhsminor.yy356 = yymsp[0].minor.yy356; } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; case 169: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy712 = yymsp[-1].minor.yy712; } +{ yymsp[-3].minor.yy356 = yymsp[-1].minor.yy356; } break; case 170: /* table_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy616 = createDefaultTableOptions(pCxt); } break; case 171: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 172: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy712); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy356); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 173: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy712); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy356); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 174: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy712); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy356); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 175: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 176: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy712); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_SMA, yymsp[-1].minor.yy356); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; case 177: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterTableOptions(pCxt); yylhsminor.yy616 = setTableOption(pCxt, yylhsminor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 178: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 179: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy389.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 180: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy409.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; case 181: /* duration_list ::= duration_literal */ - case 339: /* expression_list ::= expression */ yytestcase(yyruleno==339); -{ yylhsminor.yy712 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[0].minor.yy712 = yylhsminor.yy712; + case 340: /* expression_list ::= expression */ yytestcase(yyruleno==340); +{ yylhsminor.yy356 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; case 182: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 340: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==340); -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy712 = yylhsminor.yy712; + case 341: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==341); +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } + yymsp[-2].minor.yy356 = yylhsminor.yy356; break; case 185: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy361, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 186: /* rollup_func_name ::= FIRST */ case 187: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==187); -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 190: /* col_name ::= column_name */ -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 191: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3896,13 +3948,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 194: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } break; case 195: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } break; case 196: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy616, NULL, OP_TYPE_LIKE); } break; case 197: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -3917,7 +3969,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 201: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); } break; case 202: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -3936,13 +3988,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 208: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } break; case 209: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy616); } break; case 210: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy616); } break; case 211: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -3975,7 +4027,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 221: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy616); } break; case 222: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -3985,154 +4037,154 @@ static YYACTIONTYPE yy_reduce( break; case 224: /* db_name_cond_opt ::= */ case 229: /* from_db_opt ::= */ yytestcase(yyruleno==229); -{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy616 = createDefaultDatabaseCondValue(pCxt); } break; case 225: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy361); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 226: /* like_pattern_opt ::= */ case 266: /* into_opt ::= */ yytestcase(yyruleno==266); - case 404: /* from_clause_opt ::= */ yytestcase(yyruleno==404); - case 433: /* where_clause_opt ::= */ yytestcase(yyruleno==433); - case 437: /* twindow_clause_opt ::= */ yytestcase(yyruleno==437); - case 442: /* sliding_opt ::= */ yytestcase(yyruleno==442); - case 444: /* fill_opt ::= */ yytestcase(yyruleno==444); - case 456: /* having_clause_opt ::= */ yytestcase(yyruleno==456); - case 458: /* range_opt ::= */ yytestcase(yyruleno==458); - case 460: /* every_opt ::= */ yytestcase(yyruleno==460); - case 470: /* slimit_clause_opt ::= */ yytestcase(yyruleno==470); - case 474: /* limit_clause_opt ::= */ yytestcase(yyruleno==474); -{ yymsp[1].minor.yy560 = NULL; } + case 406: /* from_clause_opt ::= */ yytestcase(yyruleno==406); + case 435: /* where_clause_opt ::= */ yytestcase(yyruleno==435); + case 439: /* twindow_clause_opt ::= */ yytestcase(yyruleno==439); + case 444: /* sliding_opt ::= */ yytestcase(yyruleno==444); + case 446: /* fill_opt ::= */ yytestcase(yyruleno==446); + case 458: /* having_clause_opt ::= */ yytestcase(yyruleno==458); + case 460: /* range_opt ::= */ yytestcase(yyruleno==460); + case 462: /* every_opt ::= */ yytestcase(yyruleno==462); + case 472: /* slimit_clause_opt ::= */ yytestcase(yyruleno==472); + case 476: /* limit_clause_opt ::= */ yytestcase(yyruleno==476); +{ yymsp[1].minor.yy616 = NULL; } break; case 227: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 228: /* table_name_cond ::= table_name */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 230: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy533); } +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } break; case 231: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, NULL, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, NULL, yymsp[0].minor.yy616); } break; case 232: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; case 233: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy712, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } +{ yymsp[-9].minor.yy616 = createIndexOption(pCxt, yymsp[-7].minor.yy356, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; case 234: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy712, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } +{ yymsp[-11].minor.yy616 = createIndexOption(pCxt, yymsp[-9].minor.yy356, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; case 237: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy712); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 238: /* sma_stream_opt ::= */ case 268: /* stream_options ::= */ yytestcase(yyruleno==268); -{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy616 = createStreamOptions(pCxt); } break; case 239: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 272: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==272); -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 240: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } break; case 242: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy533, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy361, false); } break; case 243: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy533, &yymsp[0].minor.yy533, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[0].minor.yy361, true); } break; case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, yymsp[0].minor.yy560, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, yymsp[0].minor.yy616, false); } break; case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy533, yymsp[0].minor.yy560, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, yymsp[0].minor.yy616, true); } break; case 246: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; case 247: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } break; case 248: /* cmd ::= DESC full_table_name */ case 249: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==249); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy616); } break; case 250: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 251: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; case 253: /* analyze_opt ::= ANALYZE */ case 261: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==261); - case 424: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==424); -{ yymsp[0].minor.yy173 = true; } + case 426: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==426); +{ yymsp[0].minor.yy151 = true; } break; case 254: /* explain_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy616 = createDefaultExplainOptions(pCxt); } break; case 255: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setExplainVerbose(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 256: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setExplainRatio(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 257: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy712); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy356); } break; case 258: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-8].minor.yy173, &yymsp[-5].minor.yy533, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy196, yymsp[0].minor.yy424); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-8].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy600, yymsp[0].minor.yy734); } break; case 259: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; case 262: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy424 = 0; } +{ yymsp[1].minor.yy734 = 0; } break; case 263: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy424 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy734 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 264: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy173, &yymsp[-4].minor.yy533, yymsp[-2].minor.yy560, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy151, &yymsp[-4].minor.yy361, yymsp[-2].minor.yy616, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } break; case 265: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; case 267: /* into_opt ::= INTO full_table_name */ - case 405: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==405); - case 434: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==434); - case 457: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==457); -{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } + case 407: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==407); + case 436: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==436); + case 459: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==459); +{ yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; } break; case 269: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 270: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 271: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy560)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-3].minor.yy560; } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-3].minor.yy616)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-3].minor.yy616; } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 273: /* stream_options ::= stream_options IGNORE EXPIRED */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->ignoreExpired = true; yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->ignoreExpired = true; yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 274: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -4150,546 +4202,550 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 279: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy712); } +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy356); } break; case 280: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 281: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy712 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +{ yymsp[-1].minor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 283: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy533); } +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy361); } break; case 284: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 286: /* cmd ::= INSERT INTO full_table_name specific_cols_opt query_expression */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-2].minor.yy560, yymsp[-1].minor.yy712, yymsp[0].minor.yy560); } + case 286: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy616, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } break; - case 287: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 287: /* cmd ::= INSERT INTO full_table_name query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); } break; - case 288: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 288: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 289: /* literal ::= NK_STRING */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 289: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 290: /* literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 290: /* literal ::= NK_STRING */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 291: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 291: /* literal ::= NK_BOOL */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 292: /* literal ::= duration_literal */ - case 302: /* signed_literal ::= signed */ yytestcase(yyruleno==302); - case 323: /* expression ::= literal */ yytestcase(yyruleno==323); - case 324: /* expression ::= pseudo_column */ yytestcase(yyruleno==324); - case 325: /* expression ::= column_reference */ yytestcase(yyruleno==325); - case 326: /* expression ::= function_expression */ yytestcase(yyruleno==326); - case 327: /* expression ::= subquery */ yytestcase(yyruleno==327); - case 354: /* function_expression ::= literal_func */ yytestcase(yyruleno==354); - case 396: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==396); - case 400: /* boolean_primary ::= predicate */ yytestcase(yyruleno==400); - case 402: /* common_expression ::= expression */ yytestcase(yyruleno==402); - case 403: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==403); - case 406: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==406); - case 408: /* table_reference ::= table_primary */ yytestcase(yyruleno==408); - case 409: /* table_reference ::= joined_table */ yytestcase(yyruleno==409); - case 413: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==413); - case 463: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==463); - case 466: /* query_primary ::= query_specification */ yytestcase(yyruleno==466); -{ yylhsminor.yy560 = yymsp[0].minor.yy560; } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 292: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 293: /* literal ::= NULL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 293: /* literal ::= duration_literal */ + case 303: /* signed_literal ::= signed */ yytestcase(yyruleno==303); + case 324: /* expression ::= literal */ yytestcase(yyruleno==324); + case 325: /* expression ::= pseudo_column */ yytestcase(yyruleno==325); + case 326: /* expression ::= column_reference */ yytestcase(yyruleno==326); + case 327: /* expression ::= function_expression */ yytestcase(yyruleno==327); + case 328: /* expression ::= subquery */ yytestcase(yyruleno==328); + case 356: /* function_expression ::= literal_func */ yytestcase(yyruleno==356); + case 398: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==398); + case 402: /* boolean_primary ::= predicate */ yytestcase(yyruleno==402); + case 404: /* common_expression ::= expression */ yytestcase(yyruleno==404); + case 405: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==405); + case 408: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==408); + case 410: /* table_reference ::= table_primary */ yytestcase(yyruleno==410); + case 411: /* table_reference ::= joined_table */ yytestcase(yyruleno==411); + case 415: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==415); + case 465: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==465); + case 468: /* query_primary ::= query_specification */ yytestcase(yyruleno==468); +{ yylhsminor.yy616 = yymsp[0].minor.yy616; } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 294: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 294: /* literal ::= NULL */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 295: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 295: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 296: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 296: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 297: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 297: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 298: /* signed ::= NK_MINUS NK_INTEGER */ + case 298: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 299: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 299: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 300: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 300: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 301: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 301: /* signed ::= NK_MINUS NK_FLOAT */ + case 302: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 303: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 304: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 304: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 305: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 305: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 306: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 306: /* signed_literal ::= duration_literal */ - case 308: /* signed_literal ::= literal_func */ yytestcase(yyruleno==308); - case 374: /* star_func_para ::= expression */ yytestcase(yyruleno==374); - case 429: /* select_item ::= common_expression */ yytestcase(yyruleno==429); - case 479: /* search_condition ::= common_expression */ yytestcase(yyruleno==479); -{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 307: /* signed_literal ::= duration_literal */ + case 309: /* signed_literal ::= literal_func */ yytestcase(yyruleno==309); + case 376: /* star_func_para ::= expression */ yytestcase(yyruleno==376); + case 431: /* select_item ::= common_expression */ yytestcase(yyruleno==431); + case 481: /* search_condition ::= common_expression */ yytestcase(yyruleno==481); +{ yylhsminor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 307: /* signed_literal ::= NULL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 308: /* signed_literal ::= NULL */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 309: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 310: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy616 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 328: /* expression ::= NK_LP expression NK_RP */ - case 401: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==401); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 329: /* expression ::= NK_LP expression NK_RP */ + case 403: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==403); +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 329: /* expression ::= NK_PLUS expression */ + case 330: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 330: /* expression ::= NK_MINUS expression */ + case 331: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 331: /* expression ::= expression NK_PLUS expression */ + case 332: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 332: /* expression ::= expression NK_MINUS expression */ + case 333: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 333: /* expression ::= expression NK_STAR expression */ + case 334: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 334: /* expression ::= expression NK_SLASH expression */ + case 335: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 335: /* expression ::= expression NK_REM expression */ + case 336: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 336: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 337: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 337: /* expression ::= expression NK_BITAND expression */ + case 338: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 338: /* expression ::= expression NK_BITOR expression */ + case 339: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 341: /* column_reference ::= column_name */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy533, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 342: /* column_reference ::= column_name */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy361, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 342: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 343: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 343: /* pseudo_column ::= ROWTS */ - case 344: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==344); - case 346: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==346); - case 347: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==347); - case 348: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==348); - case 349: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==349); - case 350: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==350); - case 356: /* literal_func ::= NOW */ yytestcase(yyruleno==356); -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 344: /* pseudo_column ::= ROWTS */ + case 345: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==345); + case 347: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==347); + case 348: /* pseudo_column ::= QEND */ yytestcase(yyruleno==348); + case 349: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==349); + case 350: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==350); + case 351: /* pseudo_column ::= WEND */ yytestcase(yyruleno==351); + case 352: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==352); + case 358: /* literal_func ::= NOW */ yytestcase(yyruleno==358); +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 345: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy533)))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 346: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy361)))); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 351: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 352: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==352); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy712)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 353: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 354: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==354); +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356)); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 353: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy196)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 355: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy600)); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 355: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy533, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 357: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy361, NULL)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 370: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy712 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy712 = yylhsminor.yy712; + case 372: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy356 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 375: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 432: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==432); -{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 377: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 434: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==434); +{ yylhsminor.yy616 = createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 376: /* predicate ::= expression compare_op expression */ - case 381: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==381); + case 378: /* predicate ::= expression compare_op expression */ + case 383: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==383); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy128, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy526, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 377: /* predicate ::= expression BETWEEN expression AND expression */ + case 379: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 378: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 380: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 379: /* predicate ::= expression IS NULL */ + case 381: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 380: /* predicate ::= expression IS NOT NULL */ + case 382: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 382: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_THAN; } + case 384: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_THAN; } break; - case 383: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_THAN; } + case 385: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_THAN; } break; - case 384: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_EQUAL; } + case 386: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_EQUAL; } break; - case 385: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_EQUAL; } + case 387: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_EQUAL; } break; - case 386: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy128 = OP_TYPE_NOT_EQUAL; } + case 388: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy526 = OP_TYPE_NOT_EQUAL; } break; - case 387: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy128 = OP_TYPE_EQUAL; } + case 389: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy526 = OP_TYPE_EQUAL; } break; - case 388: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy128 = OP_TYPE_LIKE; } + case 390: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy526 = OP_TYPE_LIKE; } break; - case 389: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_LIKE; } + case 391: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_LIKE; } break; - case 390: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy128 = OP_TYPE_MATCH; } + case 392: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy526 = OP_TYPE_MATCH; } break; - case 391: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy128 = OP_TYPE_NMATCH; } + case 393: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy526 = OP_TYPE_NMATCH; } break; - case 392: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy128 = OP_TYPE_JSON_CONTAINS; } + case 394: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy526 = OP_TYPE_JSON_CONTAINS; } break; - case 393: /* in_op ::= IN */ -{ yymsp[0].minor.yy128 = OP_TYPE_IN; } + case 395: /* in_op ::= IN */ +{ yymsp[0].minor.yy526 = OP_TYPE_IN; } break; - case 394: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_IN; } + case 396: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_IN; } break; - case 395: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy712)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 397: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 397: /* boolean_value_expression ::= NOT boolean_primary */ + case 399: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 398: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 400: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 399: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 401: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 407: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 409: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy616 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, NULL); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 410: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 412: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 411: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 413: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 412: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 414: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy616 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 414: /* alias_opt ::= */ -{ yymsp[1].minor.yy533 = nil_token; } + case 416: /* alias_opt ::= */ +{ yymsp[1].minor.yy361 = nil_token; } break; - case 415: /* alias_opt ::= table_alias */ -{ yylhsminor.yy533 = yymsp[0].minor.yy533; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + case 417: /* alias_opt ::= table_alias */ +{ yylhsminor.yy361 = yymsp[0].minor.yy361; } + yymsp[0].minor.yy361 = yylhsminor.yy361; break; - case 416: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy533 = yymsp[0].minor.yy533; } + case 418: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy361 = yymsp[0].minor.yy361; } break; - case 417: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 418: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==418); -{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } + case 419: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 420: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==420); +{ yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; } break; - case 419: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-4].minor.yy36, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 421: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy616 = createJoinTableNode(pCxt, yymsp[-4].minor.yy504, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 420: /* join_type ::= */ -{ yymsp[1].minor.yy36 = JOIN_TYPE_INNER; } + case 422: /* join_type ::= */ +{ yymsp[1].minor.yy504 = JOIN_TYPE_INNER; } break; - case 421: /* join_type ::= INNER */ -{ yymsp[0].minor.yy36 = JOIN_TYPE_INNER; } + case 423: /* join_type ::= INNER */ +{ yymsp[0].minor.yy504 = JOIN_TYPE_INNER; } break; - case 422: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 424: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy560 = createSelectStmt(pCxt, yymsp[-10].minor.yy173, yymsp[-9].minor.yy712, yymsp[-8].minor.yy560); - yymsp[-11].minor.yy560 = addWhereClause(pCxt, yymsp[-11].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-11].minor.yy560 = addPartitionByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-6].minor.yy712); - yymsp[-11].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-11].minor.yy560 = addGroupByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-1].minor.yy712); - yymsp[-11].minor.yy560 = addHavingClause(pCxt, yymsp[-11].minor.yy560, yymsp[0].minor.yy560); - yymsp[-11].minor.yy560 = addRangeClause(pCxt, yymsp[-11].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-11].minor.yy560 = addEveryClause(pCxt, yymsp[-11].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-11].minor.yy560 = addFillClause(pCxt, yymsp[-11].minor.yy560, yymsp[-3].minor.yy560); + yymsp[-11].minor.yy616 = createSelectStmt(pCxt, yymsp[-10].minor.yy151, yymsp[-9].minor.yy356, yymsp[-8].minor.yy616); + yymsp[-11].minor.yy616 = addWhereClause(pCxt, yymsp[-11].minor.yy616, yymsp[-7].minor.yy616); + yymsp[-11].minor.yy616 = addPartitionByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-6].minor.yy356); + yymsp[-11].minor.yy616 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy616, yymsp[-2].minor.yy616); + yymsp[-11].minor.yy616 = addGroupByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-1].minor.yy356); + yymsp[-11].minor.yy616 = addHavingClause(pCxt, yymsp[-11].minor.yy616, yymsp[0].minor.yy616); + yymsp[-11].minor.yy616 = addRangeClause(pCxt, yymsp[-11].minor.yy616, yymsp[-5].minor.yy616); + yymsp[-11].minor.yy616 = addEveryClause(pCxt, yymsp[-11].minor.yy616, yymsp[-4].minor.yy616); + yymsp[-11].minor.yy616 = addFillClause(pCxt, yymsp[-11].minor.yy616, yymsp[-3].minor.yy616); } break; - case 425: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy173 = false; } + case 427: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy151 = false; } break; - case 428: /* select_item ::= NK_STAR */ -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 430: /* select_item ::= NK_STAR */ +{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 430: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 432: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 431: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 433: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), &yymsp[0].minor.yy361); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 436: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 453: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==453); - case 469: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==469); -{ yymsp[-2].minor.yy712 = yymsp[0].minor.yy712; } + case 438: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 455: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==455); + case 471: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==471); +{ yymsp[-2].minor.yy356 = yymsp[0].minor.yy356; } break; - case 438: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 440: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy616 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 439: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 441: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy616 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 440: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 442: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 441: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 443: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 461: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==461); -{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } + case 445: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 463: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==463); +{ yymsp[-3].minor.yy616 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy616); } break; - case 445: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } + case 447: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy616 = createFillNode(pCxt, yymsp[-1].minor.yy494, NULL); } break; - case 446: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy712)); } + case 448: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy616 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } break; - case 447: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy18 = FILL_MODE_NONE; } + case 449: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy494 = FILL_MODE_NONE; } break; - case 448: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy18 = FILL_MODE_PREV; } + case 450: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy494 = FILL_MODE_PREV; } break; - case 449: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy18 = FILL_MODE_NULL; } + case 451: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy494 = FILL_MODE_NULL; } break; - case 450: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } + case 452: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy494 = FILL_MODE_LINEAR; } break; - case 451: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; } + case 453: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy494 = FILL_MODE_NEXT; } break; - case 454: /* group_by_list ::= expression */ -{ yylhsminor.yy712 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[0].minor.yy712 = yylhsminor.yy712; + case 456: /* group_by_list ::= expression */ +{ yylhsminor.yy356 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } + yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 455: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy712 = yylhsminor.yy712; + case 457: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } + yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 459: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 461: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy616 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 462: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 464: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy712); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy616 = addOrderByClause(pCxt, yymsp[-3].minor.yy616, yymsp[-2].minor.yy356); + yylhsminor.yy616 = addSlimitClause(pCxt, yylhsminor.yy616, yymsp[-1].minor.yy616); + yylhsminor.yy616 = addLimitClause(pCxt, yylhsminor.yy616, yymsp[0].minor.yy616); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 464: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 466: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 465: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 467: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 467: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + case 469: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ { - yymsp[-5].minor.yy560 = addOrderByClause(pCxt, yymsp[-4].minor.yy560, yymsp[-3].minor.yy712); - yymsp[-5].minor.yy560 = addSlimitClause(pCxt, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-5].minor.yy560 = addLimitClause(pCxt, yymsp[-5].minor.yy560, yymsp[-1].minor.yy560); + yymsp[-5].minor.yy616 = addOrderByClause(pCxt, yymsp[-4].minor.yy616, yymsp[-3].minor.yy356); + yymsp[-5].minor.yy616 = addSlimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616); + yymsp[-5].minor.yy616 = addLimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-1].minor.yy616); } break; - case 471: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 475: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==475); -{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==477); +{ yymsp[-1].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 472: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 476: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==476); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==478); +{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==477); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==479); +{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 478: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 480: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy616); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 482: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy218, yymsp[0].minor.yy109); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 484: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy616 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), yymsp[-1].minor.yy58, yymsp[0].minor.yy613); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 483: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy218 = ORDER_ASC; } + case 485: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy58 = ORDER_ASC; } break; - case 484: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy218 = ORDER_ASC; } + case 486: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy58 = ORDER_ASC; } break; - case 485: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy218 = ORDER_DESC; } + case 487: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy58 = ORDER_DESC; } break; - case 486: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; } + case 488: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy613 = NULL_ORDER_DEFAULT; } break; - case 487: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; } + case 489: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy613 = NULL_ORDER_FIRST; } break; - case 488: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy109 = NULL_ORDER_LAST; } + case 490: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy613 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 0aa1773c28..e682059793 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -75,7 +75,7 @@ TEST_F(ParserSelectTest, condition) { TEST_F(ParserSelectTest, pseudoColumn) { 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) { @@ -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 " "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); - 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) { @@ -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, _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, _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)"); diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index e90be75743..7b5c5b7182 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -59,7 +59,7 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) { strcpy(pCol->node.aliasName, pToBeRewrittenExpr->aliasName); strcpy(pCol->colName, ((SExprNode*)pExpr)->aliasName); 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; } else if (FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pExpr)->funcType) { pCol->colType = COLUMN_TYPE_TBNAME; diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 855427f26e..ea1b3d3f81 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -792,15 +792,15 @@ static EDealRes rewriteAggGroupKeyCondForPushDownImpl(SNode** pNode, void* pCont if (0 == strcmp(((SExprNode*)pGroup)->aliasName, ((SColumnNode*)(*pNode))->colName)) { SNode* pExpr = nodesCloneNode(pGroup); if (pExpr == NULL) { - pCxt->errCode = terrno; + pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; return DEAL_RES_ERROR; } nodesDestroyNode(*pNode); *pNode = pExpr; + return DEAL_RES_IGNORE_CHILD; } } } - return DEAL_RES_IGNORE_CHILD; } return DEAL_RES_CONTINUE; } @@ -861,16 +861,16 @@ static EDealRes rewriteProjectCondForPushDownImpl(SNode** ppNode, void* pContext if (0 == strcmp(((SExprNode*)pProjection)->aliasName, ((SColumnNode*)(*ppNode))->colName)) { SNode* pExpr = nodesCloneNode(pProjection); if (pExpr == NULL) { - pCxt->errCode = terrno; + pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; return DEAL_RES_ERROR; } nodesDestroyNode(*ppNode); *ppNode = pExpr; + return DEAL_RES_IGNORE_CHILD; } // end if expr alias name equal column name } // end for each project } // end if target node equals cond column node } // end for each targets - return DEAL_RES_IGNORE_CHILD; } return DEAL_RES_CONTINUE; } @@ -1208,7 +1208,7 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo int32_t smaFuncIndex = -1; *pWStrartIndex = -1; FOREACH(pFunc, pFuncs) { - if (FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pFunc)->funcType) { + if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) { *pWStrartIndex = index; } smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs); @@ -1252,7 +1252,7 @@ static SNode* smaIndexOptCreateWStartTs() { if (NULL == pWStart) { return NULL; } - strcpy(pWStart->functionName, "_wstartts"); + strcpy(pWStart->functionName, "_wstart"); snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart); if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pWStart, NULL, 0)) { nodesDestroyNode((SNode*)pWStart); @@ -2100,11 +2100,12 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) { return false; } - SScanLogicNode *pScan = (SScanLogicNode*)pNode; + SScanLogicNode* pScan = (SScanLogicNode*)pNode; if (NULL != pScan->pScanCols) { 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; } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 987da0dd17..7b9d553501 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -308,7 +308,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) { int32_t index = 0; SNode* pFunc = NULL; FOREACH(pFunc, pFuncs) { - if (FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pFunc)->funcType) { + if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) { *pIndex = index; return TSDB_CODE_SUCCESS; } @@ -319,7 +319,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) { if (NULL == pWStart) { 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); int32_t code = fmGetFuncInfo(pWStart, NULL, 0); if (TSDB_CODE_SUCCESS == code) { @@ -333,7 +333,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) { int32_t index = 0; SNode* pFunc = NULL; FOREACH(pFunc, pWin->pFuncs) { - if (FUNCTION_TYPE_WENDTS == ((SFunctionNode*)pFunc)->funcType) { + if (FUNCTION_TYPE_WEND == ((SFunctionNode*)pFunc)->funcType) { *pIndex = index; return TSDB_CODE_SUCCESS; } @@ -344,7 +344,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) { if (NULL == pWEnd) { 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); int32_t code = fmGetFuncInfo(pWEnd, NULL, 0); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index c99e4ea866..2379ea262a 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -137,6 +137,12 @@ TEST_F(PlanBasicTest, sampleFunc) { run("SELECT SAMPLE(c1, 10) FROM st1 PARTITION BY TBNAME"); } +TEST_F(PlanBasicTest, pseudoColumn) { + useDb("root", "test"); + + run("SELECT _QSTART, _QEND, _QDURATION FROM t1"); +} + TEST_F(PlanBasicTest, withoutFrom) { useDb("root", "test"); diff --git a/source/libs/planner/test/planIntervalTest.cpp b/source/libs/planner/test/planIntervalTest.cpp index 73fa898bf8..9f34ead6ff 100644 --- a/source/libs/planner/test/planIntervalTest.cpp +++ b/source/libs/planner/test/planIntervalTest.cpp @@ -29,7 +29,7 @@ TEST_F(PlanIntervalTest, basic) { TEST_F(PlanIntervalTest, pseudoCol) { 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) { @@ -59,9 +59,9 @@ TEST_F(PlanIntervalTest, stable) { 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)"); } diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 316148df27..75b4aa0dc1 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -55,7 +55,7 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) { 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) { diff --git a/source/libs/planner/test/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp index 6add1cf630..7107f8b3c9 100644 --- a/source/libs/planner/test/planOtherTest.cpp +++ b/source/libs/planner/test/planOtherTest.cpp @@ -49,7 +49,7 @@ TEST_F(PlanOtherTest, createSmaIndex) { 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)"); run("SELECT SUM(c4), MAX(c3) FROM t1 INTERVAL(10s)"); diff --git a/tests/pytest/stream/test1.py b/tests/pytest/stream/test1.py index d3439a7bdb..31e70c21d2 100644 --- a/tests/pytest/stream/test1.py +++ b/tests/pytest/stream/test1.py @@ -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 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 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('insert into scalar_ct1 values (1653471881952, 100, 100.1, "beijing");') tdSql.execute('insert into scalar_ct1 values (1653471881952+1s, -50, -50.1, "tianjin");') diff --git a/tests/pytest/stream/test2.py b/tests/pytest/stream/test2.py index a441174722..e6044662e9 100644 --- a/tests/pytest/stream/test2.py +++ b/tests/pytest/stream/test2.py @@ -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 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 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+1s, -100, -100.1, "Tianjin", 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 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+11m, 70, 70.3, "JiLin", True);') tdSql.execute('select * 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('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 _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.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;') diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index ab6ee79d6e..b6dffb5fe3 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -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 ) print ================ start query ====================== -sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) -print ===> 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 _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data05 print ===> rows1: $data10 $data11 $data12 $data15 @@ -89,8 +89,8 @@ if $data45 != 1 then return -1 endi -sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sliding(10s) -print ===> 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 _wstart, _wend, _wduration, _qstart, _qend, count(*) from ct1 interval(10s, 2s) sliding(10s) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data05 print ===> rows1: $data10 $data11 $data12 $data15 @@ -177,7 +177,7 @@ if $data70 != 1 then return -1 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 ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 @@ -200,11 +200,11 @@ if $data02 != 2678400000 then return -1 endi -sql_error select _wstartts, count(tbcol), _wduration, _wstartts, 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(2w) +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) -print ===> 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 _wstart, count(tbcol), _wduration, _wstart, count(*) from ct4 interval(1y, 6n) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 @@ -220,7 +220,7 @@ if $data04 != 2 then endi 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 diff --git a/tests/script/tsim/query/interval.sim b/tests/script/tsim/query/interval.sim index 9d7104c3de..280a66de00 100644 --- a/tests/script/tsim/query/interval.sim +++ b/tests/script/tsim/query/interval.sim @@ -82,8 +82,8 @@ print =============== step4 #$cc = 1 * 60000 #$ms2 = 1601481600000 - $cc -sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb interval(1m) -print ===> 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 _wstart, _wend, _wduration, _qstart, _qend, count(tbcol) from $tb interval(1m) print ===> $rows $data01 $data05 if $rows != $rowNum then return -1 diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index c39956c0df..29559fdee5 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -81,7 +81,7 @@ sql use $dbNamme # 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 ====> $data00 $data01 $data02 $data03 $data04 $data05 print ====> $data10 $data11 $data12 $data13 $data14 $data15 @@ -102,7 +102,7 @@ endi # #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 # return -1 #endi @@ -111,7 +111,7 @@ endi #endi 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 return -1 endi @@ -120,7 +120,7 @@ if $data01 != 5 then endi #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 # return -1 #endi @@ -129,7 +129,7 @@ endi #endi 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 return -1 endi @@ -138,7 +138,7 @@ if $data01 != 5 then endi #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 # return -1 #endi @@ -147,7 +147,7 @@ endi #endi 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 return -1 endi @@ -156,7 +156,7 @@ if $data01 != 8 then endi #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 # return -1 #endi @@ -165,7 +165,7 @@ endi #endi 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 return -1 endi @@ -174,7 +174,7 @@ if $data01 != 11 then endi #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 # return -1 #endi @@ -183,7 +183,7 @@ endi #endi 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 return -1 endi @@ -192,7 +192,7 @@ if $data01 != 13 then endi #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 # return -1 #endi @@ -201,7 +201,7 @@ endi #endi 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 return -1 endi @@ -210,7 +210,7 @@ if $data01 != 15 then endi #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 # return -1 #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' #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 $data00 $data01 $data02 $data03 #print $data10 $data11 $data12 $data13 diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim index 74bc444da2..15041623bc 100644 --- a/tests/script/tsim/query/stddev.sim +++ b/tests/script/tsim/query/stddev.sim @@ -103,29 +103,29 @@ if $rows != 1 then return -1 endi -print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) -sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print =====sql : select _wstart, stddev(c1) as b from ct4 interval(1y) +sql select _wstart, stddev(c1) as b from ct4 interval(1y) print ===> $rows if $rows != 4 then return -1 endi -print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) -sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print =====sql : select _wstart, stddev(c1) as b from t1 interval(1y) +sql select _wstart, stddev(c1) as b from t1 interval(1y) print ===> $rows if $rows != 3 then return -1 endi -print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) -sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +print =====select _wstart, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstart, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) # print ===> $rows # if $rows != 3 then # return -1 # endi -print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) -sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +print =====select _wstart, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstart, stddev(c1) as b from t1 where c1 <= 6 interval(180d) # print ===> $rows # if $rows != 3 then # return -1 @@ -281,29 +281,29 @@ if $rows != 1 then return -1 endi -print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) -sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print =====sql : select _wstart, stddev(c1) as b from ct4 interval(1y) +sql select _wstart, stddev(c1) as b from ct4 interval(1y) print ===> $rows if $rows != 4 then return -1 endi -print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) -sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print =====sql : select _wstart, stddev(c1) as b from t1 interval(1y) +sql select _wstart, stddev(c1) as b from t1 interval(1y) print ===> $rows if $rows != 3 then return -1 endi -print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) -sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +print =====select _wstart, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstart, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) print ===> $rows if $rows != 3 then return -1 endi -print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) -sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +print =====select _wstart, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstart, stddev(c1) as b from t1 where c1 <= 6 interval(180d) print ===> $rows if $rows != 3 then return -1 diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim index 3a1ed62a72..6cca47423a 100644 --- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim @@ -58,7 +58,7 @@ if $rows != 5 then endi print =============== select * from stb from memory in designated vgroup -sql select _wstartts, _wendts, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); +sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 if $rows != 1 then print rows $rows != 1 @@ -81,7 +81,7 @@ if $data04 != 20 then endi print =============== select * from stb from memory in common vgroups -sql select _wstartts, _wendts, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); +sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 $data05 if $rows != 1 then print rows $rows != 1 @@ -128,7 +128,7 @@ if $rows != 5 then endi print =============== select * from stb from file in designated vgroup -sql select _wstartts, _wendts, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); +sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 if $rows != 1 then print rows $rows != 1 @@ -151,7 +151,7 @@ if $data04 != 20 then endi print =============== select * from stb from file in common vgroups -sql select _wstartts, _wendts, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); +sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 $data05 if $rows != 1 then print rows $rows != 1 diff --git a/tests/script/tsim/stream/basic0.sim b/tests/script/tsim/stream/basic0.sim index 29775a5ef1..61f7a57dcf 100644 --- a/tests/script/tsim/stream/basic0.sim +++ b/tests/script/tsim/stream/basic0.sim @@ -33,7 +33,7 @@ if $rows != 3 then return -1 endi -sql create stream s1 trigger at_once into outstb as select _wstartts, min(k), max(k), sum(k) as sum_alias from ct1 interval(10m) +sql create stream s1 trigger at_once into outstb as select _wstart, min(k), max(k), sum(k) as sum_alias from ct1 interval(10m) sql show stables if $rows != 2 then @@ -48,7 +48,7 @@ sleep 100 #=================================================================== print =============== query data from child table -sql select `_wstartts`,`min(k)`,`max(k)`,sum_alias from outstb +sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then @@ -77,7 +77,7 @@ sleep 100 #=================================================================== print =============== query data from child table -sql select `_wstartts`,`min(k)`,`max(k)`,sum_alias from outstb +sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then @@ -105,7 +105,7 @@ sleep 100 #=================================================================== print =============== query data from child table -sql select `_wstartts`,`min(k)`,`max(k)`,sum_alias from outstb +sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 print $data10 $data11 $data12 $data13 diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index 8e6391eb0b..2a6d64bcaf 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -17,14 +17,14 @@ sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791213004,4,2,3,4.1); sleep 1000 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; if $rows != 4 then print ======$rows @@ -254,7 +254,7 @@ endi sql insert into t1 values(1648791223002,12,14,13,11.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 1 if $data11 != 2 then @@ -284,7 +284,7 @@ endi sql insert into t1 values(1648791223003,12,14,13,11.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 1 if $data11 != 3 then @@ -316,7 +316,7 @@ sql insert into t1 values(1648791223001,1,1,1,1.1); sql insert into t1 values(1648791223002,2,2,2,2.1); sql insert into t1 values(1648791223003,3,3,3,3.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 1 if $data11 != 3 then @@ -348,7 +348,7 @@ sql insert into t1 values(1648791233003,3,2,3,2.1); sql insert into t1 values(1648791233002,5,6,7,8.1); sql insert into t1 values(1648791233002,3,2,3,2.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 2 if $data21 != 2 then @@ -378,7 +378,7 @@ endi sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 0 if $data01 != 4 then @@ -408,7 +408,7 @@ endi sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1); sleep 100 -sql select `_wstartts`, c1, c2 ,c3 ,c4, c5 from streamt; +sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; # row 1 if $data11 != 4 then diff --git a/tests/script/tsim/stream/basic2.sim b/tests/script/tsim/stream/basic2.sim index 247d8f62ee..1a6c7c5c25 100644 --- a/tests/script/tsim/stream/basic2.sim +++ b/tests/script/tsim/stream/basic2.sim @@ -33,7 +33,7 @@ if $rows != 3 then return -1 endi -sql create stream s1 trigger at_once into outstb as select _wstartts, min(k), max(k), sum(k) as sum_alias from ct1 interval(10m) +sql create stream s1 trigger at_once into outstb as select _wstart, min(k), max(k), sum(k) as sum_alias from ct1 interval(10m) sql show stables if $rows != 2 then @@ -48,7 +48,7 @@ sleep 100 #=================================================================== print =============== query data from child table -sql select `_wstartts`,`min(k)`,`max(k)`,sum_alias from outstb +sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then @@ -77,7 +77,7 @@ sleep 100 #=================================================================== print =============== query data from child table -sql select `_wstartts`,`min(k)`,`max(k)`,sum_alias from outstb +sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 print $data10 $data11 $data12 $data13 diff --git a/tests/script/tsim/stream/distributeInterval0.sim b/tests/script/tsim/stream/distributeInterval0.sim index ab2ca92c86..1ee72527e9 100644 --- a/tests/script/tsim/stream/distributeInterval0.sim +++ b/tests/script/tsim/stream/distributeInterval0.sim @@ -41,7 +41,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once watermark 1d into streamtST1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once watermark 1d into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -195,7 +195,7 @@ if $data35 != 3 then return -1 endi -sql select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s); +sql select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s); sql create database test1 vgroups 1; @@ -203,7 +203,7 @@ sql use test1; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once watermark 20s into streamtST1 as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; +sql create stream stream_t2 trigger at_once watermark 20s into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sql insert into ts1 values(1648791222001,2,2,3); diff --git a/tests/script/tsim/stream/distributeIntervalRetrive0.sim b/tests/script/tsim/stream/distributeIntervalRetrive0.sim index cde5c7058f..15d9e3b186 100644 --- a/tests/script/tsim/stream/distributeIntervalRetrive0.sim +++ b/tests/script/tsim/stream/distributeIntervalRetrive0.sim @@ -41,7 +41,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 diff --git a/tests/script/tsim/stream/distributeSession0.sim b/tests/script/tsim/stream/distributeSession0.sim index 30c3c641d4..190304ff19 100644 --- a/tests/script/tsim/stream/distributeSession0.sim +++ b/tests/script/tsim/stream/distributeSession0.sim @@ -39,7 +39,7 @@ sql use test; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t1 trigger at_once into streamtST as select _wstartts, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; +sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; sleep 1000 diff --git a/tests/script/tsim/stream/ignoreExpiredData.sim b/tests/script/tsim/stream/ignoreExpiredData.sim index c6b708d1e8..a3b14c4f7a 100644 --- a/tests/script/tsim/stream/ignoreExpiredData.sim +++ b/tests/script/tsim/stream/ignoreExpiredData.sim @@ -45,9 +45,9 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once IGNORE EXPIRED into streamt1 as select _wstartts, count(*) c1, sum(a) c3 from t1 interval(10s); -sql create stream streams2 trigger at_once IGNORE EXPIRED into streamt2 as select _wstartts, count(*) c1, sum(a) c3 from t1 session(ts,10s); -sql create stream streams3 trigger at_once IGNORE EXPIRED into streamt3 as select _wstartts, count(*) c1, sum(a) c3 from t1 state_window(a); +sql create stream streams1 trigger at_once IGNORE EXPIRED into streamt1 as select _wstart, count(*) c1, sum(a) c3 from t1 interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED into streamt2 as select _wstart, count(*) c1, sum(a) c3 from t1 session(ts,10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED into streamt3 as select _wstart, count(*) c1, sum(a) c3 from t1 state_window(a); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,1,2,3,1.1); sql insert into t1 values(1648791233002,2,2,3,2.1); @@ -111,8 +111,8 @@ sql use test1 sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t1 trigger at_once IGNORE EXPIRED into streamtST1 as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; -sql create stream stream_t2 trigger at_once IGNORE EXPIRED into streamtST2 as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st session(ts, 10s) ; +sql create stream stream_t1 trigger at_once IGNORE EXPIRED into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; +sql create stream stream_t2 trigger at_once IGNORE EXPIRED into streamtST2 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st session(ts, 10s) ; sql insert into ts1 values(1648791211000,1,2,3); sql insert into ts1 values(1648791222001,2,2,3); sql insert into ts2 values(1648791211000,1,2,3); diff --git a/tests/script/tsim/stream/partitionby.sim b/tests/script/tsim/stream/partitionby.sim index c634ad85ee..e5e02c3873 100644 --- a/tests/script/tsim/stream/partitionby.sim +++ b/tests/script/tsim/stream/partitionby.sim @@ -11,7 +11,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); +sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -43,7 +43,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); +sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -74,7 +74,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once watermark 20s into streamtST as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; +sql create stream stream_t2 trigger at_once watermark 20s into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionby1.sim b/tests/script/tsim/stream/partitionby1.sim index 3e823b05d6..b29666cad7 100644 --- a/tests/script/tsim/stream/partitionby1.sim +++ b/tests/script/tsim/stream/partitionby1.sim @@ -11,7 +11,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); +sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -43,7 +43,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, count(a) c2 from st partition by tbname interval(10s); +sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -74,7 +74,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once into streamtST as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; +sql create stream stream_t2 trigger at_once into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/schedSnode.sim b/tests/script/tsim/stream/schedSnode.sim index dbdaaf65d0..61f01baf39 100644 --- a/tests/script/tsim/stream/schedSnode.sim +++ b/tests/script/tsim/stream/schedSnode.sim @@ -16,7 +16,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into target.streamtST1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -170,4 +170,4 @@ if $data35 != 3 then return -1 endi -sql select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s); +sql select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s); diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim index eb440d78c4..16a53d49f3 100644 --- a/tests/script/tsim/stream/session0.sim +++ b/tests/script/tsim/stream/session0.sim @@ -17,7 +17,7 @@ sql use test sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); +sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1); sql insert into t1 values(1648791223001,10,2,3,1.1,2); sql insert into t1 values(1648791233002,3,2,3,2.1,3); @@ -179,7 +179,7 @@ endi sql create database test2 vgroups 1; sql use test2; sql create table t2(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstartts,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); +sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); sql insert into t2 values(1648791213001,1,1,3,1.0,1); sql insert into t2 values(1648791213002,2,2,6,3.4,2); sql insert into t2 values(1648791213003,4,9,3,4.8,3); @@ -229,13 +229,13 @@ endi sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstartts, min(b), a,c from t1 session(ts,10s); -sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstartts, max(b), a,c from t1 session(ts,10s); -# sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstartts, top(b,3), a,c from t1 session(ts,10s); -# sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstartts, bottom(b,3), a,c from t1 session(ts,10s); -# sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstartts, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); -sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstartts, spread(a), hyperloglog(a) from t1 session(ts,10s); -# sql create stream streams8 trigger at_once watermark 1d into streamt8 as select _wstartts, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); +sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); +sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); +# sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); +# sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); +# sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); +sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); +# sql create stream streams8 trigger at_once watermark 1d into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); sql insert into t1 values(1648791213001,1,1,1,1.0); sql insert into t1 values(1648791213002,2,3,2,3.4); sql insert into t1 values(1648791213003,4,9,3,4.8); diff --git a/tests/script/tsim/stream/session1.sim b/tests/script/tsim/stream/session1.sim index 347eda9bf6..12ff2a6199 100644 --- a/tests/script/tsim/stream/session1.sim +++ b/tests/script/tsim/stream/session1.sim @@ -17,7 +17,7 @@ sql use test sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams2 trigger at_once into streamt as select _wstartts, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); +sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791210000,1,1,1,1.1,1); sql insert into t1 values(1648791220000,2,2,2,2.1,2); sql insert into t1 values(1648791230000,3,3,3,3.1,3); diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index f98e356540..a0535cf93d 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -16,7 +16,7 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams1 trigger at_once into streamt1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791213000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,2); @@ -54,7 +54,7 @@ sql insert into t1 values(1648791213000,1,2,3,1.0,5); sql insert into t1 values(1648791214000,1,2,3,1.0,6); $loop_count = 0 loop1: -sql select * from streamt1 where c >=4 order by `_wstartts`; +sql select * from streamt1 where c >=4 order by `_wstart`; sleep 300 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -163,7 +163,7 @@ sql insert into t1 values(1648791213011,1,2,3,1.0,7); $loop_count = 0 loop2: -sql select * from streamt1 where c in (5,4,7) order by `_wstartts`; +sql select * from streamt1 where c in (5,4,7) order by `_wstart`; sleep 300 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -207,7 +207,7 @@ sql insert into t1 values(1648791213011,1,2,3,1.0,8); $loop_count = 0 loop21: -sql select * from streamt1 where c in (5,4,8) order by `_wstartts`; +sql select * from streamt1 where c in (5,4,8) order by `_wstart`; sleep 300 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -227,7 +227,7 @@ sql insert into t1 values(1648791213011,10,20,10,10.0,12); $loop_count = 0 loop3: -sql select * from streamt1 where c in (5,4,10,11,12) order by `_wstartts`; +sql select * from streamt1 where c in (5,4,10,11,12) order by `_wstart`; sleep 300 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -339,7 +339,7 @@ sql insert into t1 values(1648791213030,3,14,14,14.0,15) (1648791214020,15,15,15 $loop_count = 0 loop4: -sql select * from streamt1 where c in (14,15,16) order by `_wstartts`; +sql select * from streamt1 where c in (14,15,16) order by `_wstart`; sleep 300 $loop_count = $loop_count + 1 @@ -457,7 +457,7 @@ print $data00 $data01 $data02 sql use test1 sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams2 trigger at_once into streamt1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791212000,2,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,1); diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim index 756f591f3f..db6f27ed51 100644 --- a/tests/script/tsim/stream/triggerInterval0.sim +++ b/tests/script/tsim/stream/triggerInterval0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger window_close into streamt as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger window_close into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213001,1,2,3,1.0); sleep 300 diff --git a/tests/script/tsim/stream/triggerSession0.sim b/tests/script/tsim/stream/triggerSession0.sim index 48827a64a2..b15083ab1b 100644 --- a/tests/script/tsim/stream/triggerSession0.sim +++ b/tests/script/tsim/stream/triggerSession0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test sql create table t2(ts timestamp, a int, b int , c int, d double); -sql create stream streams2 trigger window_close into streamt2 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); +sql create stream streams2 trigger window_close into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); sql insert into t2 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791222999,1,2,3,1.0); diff --git a/tests/script/tsim/stream/windowClose.sim b/tests/script/tsim/stream/windowClose.sim index 695d5749fa..1f024b9836 100644 --- a/tests/script/tsim/stream/windowClose.sim +++ b/tests/script/tsim/stream/windowClose.sim @@ -18,7 +18,7 @@ sql create stable st(ts timestamp, a int) tags(t int); sql create table tu1 using st tags(1); sql create table tu2 using st tags(2); -sql create stream stream1 trigger window_close into streamt as select _wstartts, sum(a) from st interval(10s); +sql create stream stream1 trigger window_close into streamt as select _wstart, sum(a) from st interval(10s); sql insert into tu1 values(now, 1); diff --git a/tests/script/tsim/vnode/stable_dnode2.sim b/tests/script/tsim/vnode/stable_dnode2.sim index c29d960706..99047086c4 100644 --- a/tests/script/tsim/vnode/stable_dnode2.sim +++ b/tests/script/tsim/vnode/stable_dnode2.sim @@ -109,20 +109,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select _wstartts, count(tbcol) as b from $tb interval(1m) +sql select _wstart, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select _wstartts, count(tbcol) as b from $tb interval(1d) +sql select _wstart, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstart, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -164,13 +164,13 @@ if $data00 != 25 then endi print =============== step9 -sql select _wstartts, count(tbcol) as b from $mt interval(1m) +sql select _wstart, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select _wstartts, count(tbcol) as b from $mt interval(1d) +sql select _wstart, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 diff --git a/tests/script/tsim/vnode/stable_dnode2_stop.sim b/tests/script/tsim/vnode/stable_dnode2_stop.sim index 113cf27e17..87972a15f9 100644 --- a/tests/script/tsim/vnode/stable_dnode2_stop.sim +++ b/tests/script/tsim/vnode/stable_dnode2_stop.sim @@ -138,13 +138,13 @@ if $data00 != 25 then endi print =============== step4 -sql select _wstartts, count(tbcol) as b from $mt interval(1m) +sql select _wstart, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select _wstartts, count(tbcol) as b from $mt interval(1d) +sql select _wstart, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 diff --git a/tests/script/tsim/vnode/stable_dnode3.sim b/tests/script/tsim/vnode/stable_dnode3.sim index ae777b9942..279fb3b441 100644 --- a/tests/script/tsim/vnode/stable_dnode3.sim +++ b/tests/script/tsim/vnode/stable_dnode3.sim @@ -111,20 +111,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select _wstartts, count(tbcol) as b from $tb interval(1m) +sql select _wstart, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select _wstartts, count(tbcol) as b from $tb interval(1d) +sql select _wstart, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstart, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -166,13 +166,13 @@ if $data00 != 25 then endi print =============== step9 -sql select _wstartts, count(tbcol) as b from $mt interval(1m) +sql select _wstart, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select _wstartts, count(tbcol) as b from $mt interval(1d) +sql select _wstart, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 diff --git a/tests/script/tsim/vnode/stable_replica3_dnode6.sim b/tests/script/tsim/vnode/stable_replica3_dnode6.sim index aea5b88fed..e5c677ccbc 100644 --- a/tests/script/tsim/vnode/stable_replica3_dnode6.sim +++ b/tests/script/tsim/vnode/stable_replica3_dnode6.sim @@ -140,20 +140,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select _wstartts, count(tbcol) as b from $tb interval(1m) +sql select _wstart, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select _wstartts, count(tbcol) as b from $tb interval(1d) +sql select _wstart, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstart, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -195,13 +195,13 @@ if $data00 != 25 then endi print =============== step9 -#sql select _wstartts, count(tbcol) as b from $mt interval(1m) +#sql select _wstart, count(tbcol) as b from $mt interval(1m) #print ===> $data01 #if $data01 != 10 then # return -1 #endi -sql select _wstartts, count(tbcol) as b from $mt interval(1d) +sql select _wstart, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 diff --git a/tests/script/tsim/vnode/stable_replica3_vnode3.sim b/tests/script/tsim/vnode/stable_replica3_vnode3.sim index 8137b087f5..ca26b2fd10 100644 --- a/tests/script/tsim/vnode/stable_replica3_vnode3.sim +++ b/tests/script/tsim/vnode/stable_replica3_vnode3.sim @@ -124,20 +124,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select _wstartts, count(tbcol) as b from $tb interval(1m) +sql select _wstart, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select _wstartts, count(tbcol) as b from $tb interval(1d) +sql select _wstart, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstart, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -180,13 +180,13 @@ if $data00 != 25 then endi print =============== step9 -sql select _wstartts, count(tbcol) as b from $mt interval(1m) +sql select _wstart, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select _wstartts, count(tbcol) as b from $mt interval(1d) +sql select _wstart, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 From 0030888d1d9764e4224e0e4274bf0ab340d4e578 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 15:13:48 +0800 Subject: [PATCH 38/92] test: restore some 2.0 case --- tests/script/general/compress/testSuite.sim | 4 ---- tests/script/jenkins/basic.txt | 6 ++++++ tests/script/{general => tsim}/compress/commitlog.sim | 10 +--------- tests/script/{general => tsim}/compress/compress.sim | 9 --------- tests/script/{general => tsim}/compress/compress2.sim | 8 -------- tests/script/{general => tsim}/compress/uncompress.sim | 10 +--------- 6 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 tests/script/general/compress/testSuite.sim rename tests/script/{general => tsim}/compress/commitlog.sim (95%) rename tests/script/{general => tsim}/compress/compress.sim (94%) rename tests/script/{general => tsim}/compress/compress2.sim (94%) rename tests/script/{general => tsim}/compress/uncompress.sim (94%) diff --git a/tests/script/general/compress/testSuite.sim b/tests/script/general/compress/testSuite.sim deleted file mode 100644 index 3573985c8a..0000000000 --- a/tests/script/general/compress/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run general/compress/commitlog.sim -run general/compress/compress2.sim -run general/compress/compress.sim -run general/compress/uncompress.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index afe5527380..b24ca5f85e 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -22,6 +22,12 @@ ./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 ./test.sh -f tsim/db/alter_option.sim # ./test.sh -f tsim/db/alter_replica_13.sim diff --git a/tests/script/general/compress/commitlog.sim b/tests/script/tsim/compress/commitlog.sim similarity index 95% rename from tests/script/general/compress/commitlog.sim rename to tests/script/tsim/compress/commitlog.sim index e8eab6ed0c..d90780bd6c 100644 --- a/tests/script/general/compress/commitlog.sim +++ b/tests/script/tsim/compress/commitlog.sim @@ -1,14 +1,9 @@ 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 comp -v 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect -print ============================ dnode1 start +print ============================ dnode1 start $i = 0 $dbPrefix = db $tbPrefix = tb @@ -18,7 +13,6 @@ $tb = $tbPrefix . $i $N = 2000 print =============== step1 - sql create database $db sql use $db sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bigint, str binary(256)) @@ -87,9 +81,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/compress.sim b/tests/script/tsim/compress/compress.sim similarity index 94% rename from tests/script/general/compress/compress.sim rename to tests/script/tsim/compress/compress.sim index cecfe61229..766f97450c 100644 --- a/tests/script/general/compress/compress.sim +++ b/tests/script/tsim/compress/compress.sim @@ -1,15 +1,9 @@ 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 comp -v 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ============================ dnode1 start - $i = 0 $dbPrefix = db $tbPrefix = tb @@ -19,7 +13,6 @@ $tb = $tbPrefix . $i $N = 2000 print =============== step1 - sql create database $db sql use $db sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bigint, str binary(256)) @@ -82,9 +75,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/compress2.sim b/tests/script/tsim/compress/compress2.sim similarity index 94% rename from tests/script/general/compress/compress2.sim rename to tests/script/tsim/compress/compress2.sim index 1e6868eaa6..87e50cce5b 100644 --- a/tests/script/general/compress/compress2.sim +++ b/tests/script/tsim/compress/compress2.sim @@ -1,15 +1,9 @@ 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 comp -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ============================ dnode1 start - $i = 0 $dbPrefix = db $tbPrefix = tb @@ -82,9 +76,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/uncompress.sim b/tests/script/tsim/compress/uncompress.sim similarity index 94% rename from tests/script/general/compress/uncompress.sim rename to tests/script/tsim/compress/uncompress.sim index 49945dcb79..ccd5db4b0c 100644 --- a/tests/script/general/compress/uncompress.sim +++ b/tests/script/tsim/compress/uncompress.sim @@ -1,13 +1,9 @@ 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 comp -v 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect -print ============================ dnode1 start +print ============================ dnode1 start $i = 0 $dbPrefix = cp_cp_db $tbPrefix = cp_cp_tb @@ -17,7 +13,6 @@ $tb = $tbPrefix . $i $N = 2000 print =============== step1 - sql create database $db sql use $db @@ -81,12 +76,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 2000 print =============== step5 - $i = 0 $db = $dbPrefix . $i $tb = $tbPrefix . $i From db65b890c8b4a2baf44973b2b54a66b374e6a570 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 13 Jul 2022 15:14:13 +0800 Subject: [PATCH 39/92] feat: support pseudo columns such as _qstart, _qend and _qduration --- source/libs/planner/src/planOptimizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index ea1b3d3f81..7732669f84 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -2054,11 +2054,11 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { ((SExprNode*)*pNode)->aliasName); nodesDestroyNode(*pNode); *pNode = pExpr; + return DEAL_RES_IGNORE_CHILD; } } } } - return DEAL_RES_IGNORE_CHILD; } return DEAL_RES_CONTINUE; } From 0cd7d1fb13c48130f246767d25fc545be2a7e346 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 13 Jul 2022 15:28:21 +0800 Subject: [PATCH 40/92] fix: fix last row reader close memory issues --- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 5c09c7663f..127e9d2b02 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -22,11 +22,11 @@ typedef struct SLastrowReader { SVnode* pVnode; STSchema* pSchema; uint64_t uid; - char** transferBuf; // todo remove it soon - int32_t numOfCols; - int32_t type; - int32_t tableIndex; // currently returned result tables - SArray* pTableList; // table id list + char** transferBuf; // todo remove it soon + int32_t numOfCols; + int32_t type; + int32_t tableIndex; // currently returned result tables + SArray* pTableList; // table id list } SLastrowReader; static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SLastrowReader* pReader, const int32_t* slotIds) { @@ -94,12 +94,15 @@ int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList, int32_t tsdbLastrowReaderClose(void* pReader) { SLastrowReader* p = pReader; - for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) { - taosMemoryFreeClear(p->transferBuf[i]); + if (p->pSchema != NULL) { + for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) { + taosMemoryFreeClear(p->transferBuf[i]); + } + + taosMemoryFree(p->transferBuf); + taosMemoryFree(p->pSchema); } - taosMemoryFree(p->pSchema); - taosMemoryFree(p->transferBuf); taosMemoryFree(pReader); return TSDB_CODE_SUCCESS; } From 0237ccbbb693ecb2fbd2926bed884f65d0456db7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 15:33:31 +0800 Subject: [PATCH 41/92] fix:error in tmq meta --- include/common/tcommon.h | 1 - source/client/src/tmq.c | 1 + source/dnode/mnode/impl/src/mndStb.c | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 3d15e8b087..9440a3452b 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -40,7 +40,6 @@ enum { || x == TDMT_VND_CREATE_TABLE \ || x == TDMT_VND_ALTER_TABLE \ || x == TDMT_VND_DROP_TABLE \ - || x == TDMT_VND_DROP_TTL_TABLE \ ) // clang-format on diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index ed9efdf3da..7e01e5cd83 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2713,6 +2713,7 @@ static int32_t taosDropTable(TAOS *taos, void *meta, int32_t metaLen){ // loop to create table for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pDropReq = req.pReqs + iReq; + pDropReq->igNotExists = true; SVgroupInfo pInfo = {0}; SName pName; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 51f550ad92..bff33af5af 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1849,8 +1849,8 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) { } } - if (dropReq.source != TD_REQ_FROM_APP && pStb->uid != dropReq.suid) { - terrno = TSDB_CODE_MND_STB_NOT_EXIST; + if (dropReq.source == TD_REQ_FROM_TAOX && pStb->uid != dropReq.suid) { + code = 0; goto _OVER; } From 511c39a0cfa3c8bdca7581b981b19ba1ef4b0fb9 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 13 Jul 2022 15:55:38 +0800 Subject: [PATCH 42/92] refactor(sync): add skiplist entry cache --- source/libs/sync/inc/syncRaftEntry.h | 54 +++- source/libs/sync/src/syncRaftEntry.c | 274 ++++++++++++++++-- source/libs/sync/src/syncRespMgr.c | 2 +- source/libs/sync/test/CMakeLists.txt | 14 + source/libs/sync/test/syncEntryCacheTest.cpp | 233 +++------------- source/libs/sync/test/syncHashCacheTest.cpp | 277 +++++++++++++++++++ 6 files changed, 633 insertions(+), 221 deletions(-) create mode 100644 source/libs/sync/test/syncHashCacheTest.cpp diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index 82d5c0a6ea..fdfabf12a3 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -26,6 +26,7 @@ extern "C" { #include "syncInt.h" #include "syncMessage.h" #include "taosdef.h" +#include "tskiplist.h" typedef struct SSyncRaftEntry { uint32_t bytes; @@ -58,29 +59,52 @@ void syncEntryLog(const SSyncRaftEntry* pObj); void syncEntryLog2(char* s, const SSyncRaftEntry* pObj); //----------------------------------- -typedef struct SRaftEntryCache { +typedef struct SRaftEntryHashCache { SHashObj* pEntryHash; int32_t maxCount; int32_t currentCount; TdThreadMutex mutex; SSyncNode* pSyncNode; +} SRaftEntryHashCache; + +SRaftEntryHashCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount); +void raftCacheDestroy(SRaftEntryHashCache* pCache); +int32_t raftCachePutEntry(struct SRaftEntryHashCache* pCache, SSyncRaftEntry* pEntry); +int32_t raftCacheGetEntry(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); +int32_t raftCacheGetEntryP(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); +int32_t raftCacheDelEntry(struct SRaftEntryHashCache* pCache, SyncIndex index); +int32_t raftCacheGetAndDel(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); +int32_t raftCacheClear(struct SRaftEntryHashCache* pCache); + +cJSON* raftCache2Json(SRaftEntryHashCache* pObj); +char* raftCache2Str(SRaftEntryHashCache* pObj); +void raftCachePrint(SRaftEntryHashCache* pObj); +void raftCachePrint2(char* s, SRaftEntryHashCache* pObj); +void raftCacheLog(SRaftEntryHashCache* pObj); +void raftCacheLog2(char* s, SRaftEntryHashCache* pObj); + +//----------------------------------- +typedef struct SRaftEntryCache { + SSkipList* pSkipList; + int32_t maxCount; + int32_t currentCount; + TdThreadMutex mutex; + SSyncNode* pSyncNode; } SRaftEntryCache; -SRaftEntryCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount); -void raftCacheDestroy(SRaftEntryCache* pCache); -int32_t raftCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* pEntry); -int32_t raftCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); -int32_t raftCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); -int32_t raftCacheDelEntry(struct SRaftEntryCache* pCache, SyncIndex index); -int32_t raftCacheGetAndDel(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); -int32_t raftCacheClear(struct SRaftEntryCache* pCache); +SRaftEntryCache* raftEntryCacheCreate(SSyncNode* pSyncNode, int32_t maxCount); +void raftEntryCacheDestroy(SRaftEntryCache* pCache); +int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* pEntry); +int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); +int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); +int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count); -cJSON* raftCache2Json(SRaftEntryCache* pObj); -char* raftCache2Str(SRaftEntryCache* pObj); -void raftCachePrint(SRaftEntryCache* pObj); -void raftCachePrint2(char* s, SRaftEntryCache* pObj); -void raftCacheLog(SRaftEntryCache* pObj); -void raftCacheLog2(char* s, SRaftEntryCache* pObj); +cJSON* raftEntryCache2Json(SRaftEntryCache* pObj); +char* raftEntryCache2Str(SRaftEntryCache* pObj); +void raftEntryCachePrint(SRaftEntryCache* pObj); +void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj); +void raftEntryCacheLog(SRaftEntryCache* pObj); +void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj); #ifdef __cplusplus } diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 465584a40f..89e67fab28 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -198,8 +198,8 @@ void syncEntryLog2(char* s, const SSyncRaftEntry* pObj) { } //----------------------------------- -SRaftEntryCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { - SRaftEntryCache* pCache = taosMemoryMalloc(sizeof(SRaftEntryCache)); +SRaftEntryHashCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { + SRaftEntryHashCache* pCache = taosMemoryMalloc(sizeof(SRaftEntryHashCache)); if (pCache == NULL) { sError("vgId:%d raft cache create error", pSyncNode->vgId); return NULL; @@ -220,7 +220,7 @@ SRaftEntryCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { return pCache; } -void raftCacheDestroy(SRaftEntryCache* pCache) { +void raftCacheDestroy(SRaftEntryHashCache* pCache) { if (pCache != NULL) { taosThreadMutexLock(&(pCache->mutex)); taosHashCleanup(pCache->pEntryHash); @@ -233,7 +233,7 @@ void raftCacheDestroy(SRaftEntryCache* pCache) { // success, return 1 // max count, return 0 // error, return -1 -int32_t raftCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* pEntry) { +int32_t raftCachePutEntry(struct SRaftEntryHashCache* pCache, SSyncRaftEntry* pEntry) { taosThreadMutexLock(&(pCache->mutex)); if (pCache->currentCount >= pCache->maxCount) { @@ -259,7 +259,7 @@ int32_t raftCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* pEntry // success, return 0 // error, return -1 // not exist, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST -int32_t raftCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { +int32_t raftCacheGetEntry(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { if (ppEntry == NULL) { return -1; } @@ -292,7 +292,7 @@ int32_t raftCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSync // success, return 0 // error, return -1 // not exist, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST -int32_t raftCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { +int32_t raftCacheGetEntryP(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { if (ppEntry == NULL) { return -1; } @@ -321,7 +321,7 @@ int32_t raftCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyn return -1; } -int32_t raftCacheDelEntry(struct SRaftEntryCache* pCache, SyncIndex index) { +int32_t raftCacheDelEntry(struct SRaftEntryHashCache* pCache, SyncIndex index) { taosThreadMutexLock(&(pCache->mutex)); taosHashRemove(pCache->pEntryHash, &index, sizeof(index)); --(pCache->currentCount); @@ -329,7 +329,7 @@ int32_t raftCacheDelEntry(struct SRaftEntryCache* pCache, SyncIndex index) { return 0; } -int32_t raftCacheGetAndDel(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { +int32_t raftCacheGetAndDel(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { if (ppEntry == NULL) { return -1; } @@ -362,7 +362,7 @@ int32_t raftCacheGetAndDel(struct SRaftEntryCache* pCache, SyncIndex index, SSyn return -1; } -int32_t raftCacheClear(struct SRaftEntryCache* pCache) { +int32_t raftCacheClear(struct SRaftEntryHashCache* pCache) { taosThreadMutexLock(&(pCache->mutex)); taosHashClear(pCache->pEntryHash); pCache->currentCount = 0; @@ -371,7 +371,7 @@ int32_t raftCacheClear(struct SRaftEntryCache* pCache) { } //----------------------------------- -cJSON* raftCache2Json(SRaftEntryCache* pCache) { +cJSON* raftCache2Json(SRaftEntryHashCache* pCache) { char u64buf[128] = {0}; cJSON* pRoot = cJSON_CreateObject(); @@ -402,41 +402,283 @@ cJSON* raftCache2Json(SRaftEntryCache* pCache) { } cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SRaftEntryCache", pRoot); + cJSON_AddItemToObject(pJson, "SRaftEntryHashCache", pRoot); return pJson; } -char* raftCache2Str(SRaftEntryCache* pCache) { +char* raftCache2Str(SRaftEntryHashCache* pCache) { cJSON* pJson = raftCache2Json(pCache); char* serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } -void raftCachePrint(SRaftEntryCache* pCache) { +void raftCachePrint(SRaftEntryHashCache* pCache) { char* serialized = raftCache2Str(pCache); printf("raftCachePrint | len:%" PRIu64 " | %s \n", strlen(serialized), serialized); fflush(NULL); taosMemoryFree(serialized); } -void raftCachePrint2(char* s, SRaftEntryCache* pCache) { +void raftCachePrint2(char* s, SRaftEntryHashCache* pCache) { char* serialized = raftCache2Str(pCache); printf("raftCachePrint2 | len:%" PRIu64 " | %s | %s \n", strlen(serialized), s, serialized); fflush(NULL); taosMemoryFree(serialized); } -void raftCacheLog(SRaftEntryCache* pCache) { +void raftCacheLog(SRaftEntryHashCache* pCache) { char* serialized = raftCache2Str(pCache); sTrace("raftCacheLog | len:%" PRIu64 " | %s", strlen(serialized), serialized); taosMemoryFree(serialized); } -void raftCacheLog2(char* s, SRaftEntryCache* pCache) { +void raftCacheLog2(char* s, SRaftEntryHashCache* pCache) { if (gRaftDetailLog) { char* serialized = raftCache2Str(pCache); sTraceLong("raftCacheLog2 | len:%" PRIu64 " | %s | %s", strlen(serialized), s, serialized); taosMemoryFree(serialized); } +} + +//----------------------------------- +static char* keyFn(const void* pData) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pData; + return (char*)(&(pEntry->index)); +} + +static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } + +SRaftEntryCache* raftEntryCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { + SRaftEntryCache* pCache = taosMemoryMalloc(sizeof(SRaftEntryCache)); + if (pCache == NULL) { + sError("vgId:%d raft cache create error", pSyncNode->vgId); + return NULL; + } + + pCache->pSkipList = + tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); + if (pCache->pSkipList == NULL) { + sError("vgId:%d raft cache create hash error", pSyncNode->vgId); + return NULL; + } + + taosThreadMutexInit(&(pCache->mutex), NULL); + pCache->maxCount = maxCount; + pCache->currentCount = 0; + pCache->pSyncNode = pSyncNode; + + return pCache; +} + +void raftEntryCacheDestroy(SRaftEntryCache* pCache) { + if (pCache != NULL) { + taosThreadMutexLock(&(pCache->mutex)); + tSkipListDestroy(pCache->pSkipList); + taosThreadMutexUnlock(&(pCache->mutex)); + taosThreadMutexDestroy(&(pCache->mutex)); + taosMemoryFree(pCache); + } +} + +// success, return 1 +// max count, return 0 +// error, return -1 +int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* pEntry) { + taosThreadMutexLock(&(pCache->mutex)); + + if (pCache->currentCount >= pCache->maxCount) { + taosThreadMutexUnlock(&(pCache->mutex)); + return 0; + } + + SSkipListNode* pSkipListNode = tSkipListPut(pCache->pSkipList, pEntry); + ASSERT(pSkipListNode != NULL); + ++(pCache->currentCount); + + do { + char eventLog[128]; + snprintf(eventLog, sizeof(eventLog), "raft cache add, type:%s,%d, type2:%s,%d, index:%" PRId64 ", bytes:%d", + TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType, + pEntry->index, pEntry->bytes); + syncNodeEventLog(pCache->pSyncNode, eventLog); + } while (0); + + taosThreadMutexUnlock(&(pCache->mutex)); + return 1; +} + +// find one, return 1 +// not found, return 0 +// error, return -1 +int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { + ASSERT(ppEntry != NULL); + SSyncRaftEntry* pEntry = NULL; + int32_t code = raftEntryCacheGetEntryP(pCache, index, &pEntry); + if (code == 1) { + *ppEntry = taosMemoryMalloc(pEntry->bytes); + memcpy(*ppEntry, pEntry, pEntry->bytes); + } else { + *ppEntry = NULL; + } + return code; +} + +// find one, return 1 +// not found, return 0 +// error, return -1 +int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { + taosThreadMutexLock(&(pCache->mutex)); + + SyncIndex index2 = index; + int32_t code = 0; + + SArray* entryPArray = tSkipListGet(pCache->pSkipList, (char*)(&index2)); + int32_t arraySize = taosArrayGetSize(entryPArray); + if (arraySize == 1) { + SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); + ASSERT(*ppNode != NULL); + *ppEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); + code = 1; + + } else if (arraySize == 0) { + code = 0; + + } else { + ASSERT(0); + + code = -1; + } + taosArrayDestroy(entryPArray); + + taosThreadMutexUnlock(&(pCache->mutex)); + return code; +} + +// count = -1, clear all +// count >= 0, clear count +// return -1, error +// return delete count +int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { + taosThreadMutexLock(&(pCache->mutex)); + int32_t returnCnt = 0; + + if (count == -1) { + // clear all + SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); + while (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + syncEntryDestory(pEntry); + ++returnCnt; + } + tSkipListDestroyIter(pIter); + + tSkipListDestroy(pCache->pSkipList); + pCache->pSkipList = + tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); + ASSERT(pCache->pSkipList != NULL); + + } else { + // clear count + int i = 0; + SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); + SArray* delNodeArray = taosArrayInit(0, sizeof(SSkipListNode*)); + + // free entry + while (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + if (i++ >= count) { + break; + } + + // sDebug("push pNode:%p", pNode); + taosArrayPush(delNodeArray, &pNode); + ++returnCnt; + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + syncEntryDestory(pEntry); + } + tSkipListDestroyIter(pIter); + + // delete skiplist node + int32_t arraySize = taosArrayGetSize(delNodeArray); + for (int32_t i = 0; i < arraySize; ++i) { + SSkipListNode** ppNode = taosArrayGet(delNodeArray, i); + // sDebug("get pNode:%p", *ppNode); + tSkipListRemoveNode(pCache->pSkipList, *ppNode); + } + taosArrayDestroy(delNodeArray); + } + + pCache->currentCount -= returnCnt; + taosThreadMutexUnlock(&(pCache->mutex)); + return returnCnt; +} + +cJSON* raftEntryCache2Json(SRaftEntryCache* pCache) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pCache != NULL) { + taosThreadMutexLock(&(pCache->mutex)); + + snprintf(u64buf, sizeof(u64buf), "%p", pCache->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + cJSON_AddNumberToObject(pRoot, "currentCount", pCache->currentCount); + cJSON_AddNumberToObject(pRoot, "maxCount", pCache->maxCount); + cJSON* pEntries = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "entries", pEntries); + + SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); + while (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); + } + tSkipListDestroyIter(pIter); + + taosThreadMutexUnlock(&(pCache->mutex)); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SRaftEntryCache", pRoot); + return pJson; +} + +char* raftEntryCache2Str(SRaftEntryCache* pObj) { + cJSON* pJson = raftEntryCache2Json(pObj); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +void raftEntryCachePrint(SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + printf("raftEntryCachePrint | len:%" PRIu64 " | %s \n", strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + printf("raftEntryCachePrint2 | len:%" PRIu64 " | %s | %s \n", strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftEntryCacheLog(SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + sTrace("raftEntryCacheLog | len:%" PRIu64 " | %s", strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj) { + if (gRaftDetailLog) { + char* serialized = raftEntryCache2Str(pObj); + sTraceLong("raftEntryCacheLog2 | len:%" PRIu64 " | %s | %s", strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } } \ No newline at end of file diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index 8e477a5159..97e5816038 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -127,7 +127,7 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl) { while (pStub) { size_t len; - void *key = taosHashGetKey(pStub, &len); + void * key = taosHashGetKey(pStub, &len); uint64_t *pSeqNum = (uint64_t *)key; int64_t nowMS = taosGetTimestampMs(); diff --git a/source/libs/sync/test/CMakeLists.txt b/source/libs/sync/test/CMakeLists.txt index e1f3a2b2fc..e787080795 100644 --- a/source/libs/sync/test/CMakeLists.txt +++ b/source/libs/sync/test/CMakeLists.txt @@ -18,6 +18,7 @@ add_executable(syncIndexMgrTest "") add_executable(syncLogStoreTest "") add_executable(syncEntryTest "") add_executable(syncEntryCacheTest "") +add_executable(syncHashCacheTest "") add_executable(syncRequestVoteTest "") add_executable(syncRequestVoteReplyTest "") add_executable(syncAppendEntriesTest "") @@ -137,6 +138,10 @@ target_sources(syncEntryCacheTest PRIVATE "syncEntryCacheTest.cpp" ) +target_sources(syncHashCacheTest + PRIVATE + "syncHashCacheTest.cpp" +) target_sources(syncRequestVoteTest PRIVATE "syncRequestVoteTest.cpp" @@ -387,6 +392,11 @@ target_include_directories(syncEntryCacheTest "${TD_SOURCE_DIR}/include/libs/sync" "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) +target_include_directories(syncHashCacheTest + PUBLIC + "${TD_SOURCE_DIR}/include/libs/sync" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" +) target_include_directories(syncRequestVoteTest PUBLIC "${TD_SOURCE_DIR}/include/libs/sync" @@ -654,6 +664,10 @@ target_link_libraries(syncEntryCacheTest sync gtest_main ) +target_link_libraries(syncHashCacheTest + sync + gtest_main +) target_link_libraries(syncRequestVoteTest sync gtest_main diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index 6250181b25..66b93563e7 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -43,222 +43,82 @@ SRaftEntryCache* createCache(int maxCount) { SSyncNode* pSyncNode = createFakeNode(); ASSERT(pSyncNode != NULL); - SRaftEntryCache* pCache = raftCacheCreate(pSyncNode, maxCount); + SRaftEntryCache* pCache = raftEntryCacheCreate(pSyncNode, maxCount); ASSERT(pCache != NULL); return pCache; } void test1() { - int32_t code = 0; + int32_t code = 0; SRaftEntryCache* pCache = createCache(5); - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); - code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); - syncEntryDestory(pEntry); + code = raftEntryCachePutEntry(pCache, pEntry); + sTrace("put entry code:%d, pEntry:%p", code, pEntry); } - raftCacheLog2((char*)"==test1 write 5 entries==", pCache); + raftEntryCacheLog2((char*)"==test1 write 5 entries==", pCache); - SyncIndex index; - index = 1; - code = raftCacheDelEntry(pCache, index); - ASSERT(code == 0); - index = 3; - code = raftCacheDelEntry(pCache, index); - ASSERT(code == 0); - raftCacheLog2((char*)"==test1 delete 1,3==", pCache); + raftEntryCacheClear(pCache, 3); + raftEntryCacheLog2((char*)"==test1 evict 3 entries==", pCache); - code = raftCacheClear(pCache); - ASSERT(code == 0); - raftCacheLog2((char*)"==clear all==", pCache); + raftEntryCacheClear(pCache, -1); + raftEntryCacheLog2((char*)"==test1 evict -1(all) entries==", pCache); } void test2() { - int32_t code = 0; + int32_t code = 0; SRaftEntryCache* pCache = createCache(5); - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); - code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); - syncEntryDestory(pEntry); + code = raftEntryCachePutEntry(pCache, pEntry); + sTrace("put entry code:%d, pEntry:%p", code, pEntry); } - raftCacheLog2((char*)"==test2 write 5 entries==", pCache); + raftEntryCacheLog2((char*)"==test1 write 5 entries==", pCache); - SyncIndex index; - index = 1; - SSyncRaftEntry* pEntry; - code = raftCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == 0); - syncEntryDestory(pEntry); - syncEntryLog2((char*)"==test2 get entry 1==", pEntry); + SyncIndex index = 2; + SSyncRaftEntry* pEntry = NULL; - index = 2; - code = raftCacheGetEntryP(pCache, index, &pEntry); - ASSERT(code == 0); + code = raftEntryCacheGetEntryP(pCache, index, &pEntry); + ASSERT(code == 1 && index == pEntry->index); + sTrace("get entry:%p for %ld", pEntry, index); syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); + code = raftEntryCacheGetEntry(pCache, index, &pEntry); + ASSERT(code == 1 && index == pEntry->index); + sTrace("get entry:%p for %ld", pEntry, index); + syncEntryLog2((char*)"==test2 get entry 2==", pEntry); + syncEntryDestory(pEntry); + // not found index = 8; - code = raftCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + code = raftEntryCacheGetEntry(pCache, index, &pEntry); + ASSERT(code == 0); + sTrace("get entry:%p for %ld", pEntry, index); sTrace("==test2 get entry 8 not found=="); // not found index = 9; - code = raftCacheGetEntryP(pCache, index, &pEntry); - ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); - sTrace("==test2 get entry pointer 9 not found=="); + code = raftEntryCacheGetEntry(pCache, index, &pEntry); + ASSERT(code == 0); + sTrace("get entry:%p for %ld", pEntry, index); + sTrace("==test2 get entry 9 not found=="); } void test3() { - int32_t code = 0; - SRaftEntryCache* pCache = createCache(5); - for (int i = 0; i < 5; ++i) { + int32_t code = 0; + SRaftEntryCache* pCache = createCache(20); + for (int i = 0; i <= 4; ++i) { SSyncRaftEntry* pEntry = createEntry(i); - code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); - syncEntryDestory(pEntry); + code = raftEntryCachePutEntry(pCache, pEntry); + sTrace("put entry code:%d, pEntry:%p", code, pEntry); } - for (int i = 6; i < 10; ++i) { - SSyncRaftEntry* pEntry = createEntry(i); - code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 0); - syncEntryDestory(pEntry); - } - raftCacheLog2((char*)"==test3 write 10 entries, max count is 5==", pCache); -} - -void test4() { - int32_t code = 0; - SRaftEntryCache* pCache = createCache(5); - for (int i = 0; i < 5; ++i) { - SSyncRaftEntry* pEntry = createEntry(i); - code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); - syncEntryDestory(pEntry); - } - raftCacheLog2((char*)"==test4 write 5 entries==", pCache); - - SyncIndex index; - index = 3; - SSyncRaftEntry* pEntry; - code = raftCacheGetAndDel(pCache, index, &pEntry); - ASSERT(code == 0); - syncEntryLog2((char*)"==test4 get-and-del entry 3==", pEntry); - raftCacheLog2((char*)"==test4 after get-and-del entry 3==", pCache); -} - -static char* keyFn(const void* pData) { - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pData; - return (char*)(&(pEntry->index)); -} - -static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } - -void printSkipList(SSkipList* pSkipList) { - ASSERT(pSkipList != NULL); - - SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); - while (tSkipListIterNext(pIter)) { - SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); - syncEntryPrint2((char*)"", pEntry); - } -} - -void delSkipListFirst(SSkipList* pSkipList, int n) { - ASSERT(pSkipList != NULL); - - sTrace("delete first %d -------------", n); - SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); - for (int i = 0; i < n; ++i) { - tSkipListIterNext(pIter); - SSkipListNode* pNode = tSkipListIterGet(pIter); - tSkipListRemoveNode(pSkipList, pNode); - } -} - - -SSyncRaftEntry* getLogEntry2(SSkipList* pSkipList, SyncIndex index) { - SyncIndex index2 = index; - SSyncRaftEntry *pEntry = NULL; - int arraySize = 0; - - SArray* entryPArray = tSkipListGet(pSkipList, (char*)(&index2)); - arraySize = taosArrayGetSize(entryPArray); - if (arraySize > 0) { - SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); - ASSERT(*ppNode != NULL); - pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); - } - taosArrayDestroy(entryPArray); - - sTrace("get index2: %ld, arraySize:%d -------------", index, arraySize); - syncEntryLog2((char*)"getLogEntry2", pEntry); - return pEntry; -} - - -SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { - sTrace("get index: %ld -------------", index); - SyncIndex index2 = index; - SSyncRaftEntry *pEntry = NULL; - SSkipListIterator* pIter = tSkipListCreateIterFromVal(pSkipList, (const char *)&index2, TSDB_DATA_TYPE_BINARY, TSDB_ORDER_ASC); - if (tSkipListIterNext(pIter)) { - SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); - pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); - } - - syncEntryLog2((char*)"getLogEntry", pEntry); - return pEntry; -} - -void test5() { - SSkipList* pSkipList = - tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); - ASSERT(pSkipList != NULL); - - sTrace("insert 9 - 5"); for (int i = 9; i >= 5; --i) { SSyncRaftEntry* pEntry = createEntry(i); - SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); + code = raftEntryCachePutEntry(pCache, pEntry); + sTrace("put entry code:%d, pEntry:%p", code, pEntry); } - - sTrace("insert 0 - 4"); - for (int i = 0; i <= 4; ++i) { - SSyncRaftEntry* pEntry = createEntry(i); - SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); - } - - sTrace("insert 7 7 7 7 7"); - for (int i = 0; i <= 4; ++i) { - SSyncRaftEntry* pEntry = createEntry(7); - SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); - } - - sTrace("print: -------------"); - printSkipList(pSkipList); - - delSkipListFirst(pSkipList, 3); - - sTrace("print: -------------"); - printSkipList(pSkipList); - - getLogEntry(pSkipList, 2); - getLogEntry(pSkipList, 5); - getLogEntry(pSkipList, 7); - getLogEntry(pSkipList, 7); - - getLogEntry2(pSkipList, 2); - getLogEntry2(pSkipList, 5); - getLogEntry2(pSkipList, 7); - getLogEntry2(pSkipList, 7); - - - tSkipListDestroy(pSkipList); + raftEntryCacheLog2((char*)"==test3 write 10 entries==", pCache); } int main(int argc, char** argv) { @@ -266,14 +126,9 @@ int main(int argc, char** argv) { tsAsyncLog = 0; sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE + DEBUG_DEBUG; - /* - test1(); - test2(); - test3(); - test4(); - */ - - test5(); + test1(); + test2(); + test3(); return 0; } diff --git a/source/libs/sync/test/syncHashCacheTest.cpp b/source/libs/sync/test/syncHashCacheTest.cpp new file mode 100644 index 0000000000..f155bd834f --- /dev/null +++ b/source/libs/sync/test/syncHashCacheTest.cpp @@ -0,0 +1,277 @@ +#include +#include "syncEnv.h" +#include "syncIO.h" +#include "syncInt.h" +#include "syncRaftLog.h" +#include "syncRaftStore.h" +#include "syncUtil.h" +#include "tskiplist.h" + +void logTest() { + sTrace("--- sync log test: trace"); + sDebug("--- sync log test: debug"); + sInfo("--- sync log test: info"); + sWarn("--- sync log test: warn"); + sError("--- sync log test: error"); + sFatal("--- sync log test: fatal"); +} + +SSyncRaftEntry* createEntry(int i) { + int32_t dataLen = 20; + SSyncRaftEntry* pEntry = syncEntryBuild(dataLen); + assert(pEntry != NULL); + pEntry->msgType = 88; + pEntry->originalRpcType = 99; + pEntry->seqNum = 3; + pEntry->isWeak = true; + pEntry->term = 100 + i; + pEntry->index = i; + snprintf(pEntry->data, dataLen, "value%d", i); + + return pEntry; +} + +SSyncNode* createFakeNode() { + SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(SSyncNode)); + ASSERT(pSyncNode != NULL); + memset(pSyncNode, 0, sizeof(SSyncNode)); + + return pSyncNode; +} + +SRaftEntryHashCache* createCache(int maxCount) { + SSyncNode* pSyncNode = createFakeNode(); + ASSERT(pSyncNode != NULL); + + SRaftEntryHashCache* pCache = raftCacheCreate(pSyncNode, maxCount); + ASSERT(pCache != NULL); + + return pCache; +} + +void test1() { + int32_t code = 0; + SRaftEntryHashCache* pCache = createCache(5); + for (int i = 0; i < 5; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + code = raftCachePutEntry(pCache, pEntry); + ASSERT(code == 1); + syncEntryDestory(pEntry); + } + raftCacheLog2((char*)"==test1 write 5 entries==", pCache); + + SyncIndex index; + index = 1; + code = raftCacheDelEntry(pCache, index); + ASSERT(code == 0); + index = 3; + code = raftCacheDelEntry(pCache, index); + ASSERT(code == 0); + raftCacheLog2((char*)"==test1 delete 1,3==", pCache); + + code = raftCacheClear(pCache); + ASSERT(code == 0); + raftCacheLog2((char*)"==clear all==", pCache); +} + +void test2() { + int32_t code = 0; + SRaftEntryHashCache* pCache = createCache(5); + for (int i = 0; i < 5; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + code = raftCachePutEntry(pCache, pEntry); + ASSERT(code == 1); + syncEntryDestory(pEntry); + } + raftCacheLog2((char*)"==test2 write 5 entries==", pCache); + + SyncIndex index; + index = 1; + SSyncRaftEntry* pEntry; + code = raftCacheGetEntry(pCache, index, &pEntry); + ASSERT(code == 0); + syncEntryDestory(pEntry); + syncEntryLog2((char*)"==test2 get entry 1==", pEntry); + + index = 2; + code = raftCacheGetEntryP(pCache, index, &pEntry); + ASSERT(code == 0); + syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); + + // not found + index = 8; + code = raftCacheGetEntry(pCache, index, &pEntry); + ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + sTrace("==test2 get entry 8 not found=="); + + // not found + index = 9; + code = raftCacheGetEntryP(pCache, index, &pEntry); + ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + sTrace("==test2 get entry pointer 9 not found=="); +} + +void test3() { + int32_t code = 0; + SRaftEntryHashCache* pCache = createCache(5); + for (int i = 0; i < 5; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + code = raftCachePutEntry(pCache, pEntry); + ASSERT(code == 1); + syncEntryDestory(pEntry); + } + for (int i = 6; i < 10; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + code = raftCachePutEntry(pCache, pEntry); + ASSERT(code == 0); + syncEntryDestory(pEntry); + } + raftCacheLog2((char*)"==test3 write 10 entries, max count is 5==", pCache); +} + +void test4() { + int32_t code = 0; + SRaftEntryHashCache* pCache = createCache(5); + for (int i = 0; i < 5; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + code = raftCachePutEntry(pCache, pEntry); + ASSERT(code == 1); + syncEntryDestory(pEntry); + } + raftCacheLog2((char*)"==test4 write 5 entries==", pCache); + + SyncIndex index; + index = 3; + SSyncRaftEntry* pEntry; + code = raftCacheGetAndDel(pCache, index, &pEntry); + ASSERT(code == 0); + syncEntryLog2((char*)"==test4 get-and-del entry 3==", pEntry); + raftCacheLog2((char*)"==test4 after get-and-del entry 3==", pCache); +} + +static char* keyFn(const void* pData) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pData; + return (char*)(&(pEntry->index)); +} + +static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } + +void printSkipList(SSkipList* pSkipList) { + ASSERT(pSkipList != NULL); + + SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); + while (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + syncEntryPrint2((char*)"", pEntry); + } +} + +void delSkipListFirst(SSkipList* pSkipList, int n) { + ASSERT(pSkipList != NULL); + + sTrace("delete first %d -------------", n); + SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); + for (int i = 0; i < n; ++i) { + tSkipListIterNext(pIter); + SSkipListNode* pNode = tSkipListIterGet(pIter); + tSkipListRemoveNode(pSkipList, pNode); + } +} + +SSyncRaftEntry* getLogEntry2(SSkipList* pSkipList, SyncIndex index) { + SyncIndex index2 = index; + SSyncRaftEntry* pEntry = NULL; + int arraySize = 0; + + SArray* entryPArray = tSkipListGet(pSkipList, (char*)(&index2)); + arraySize = taosArrayGetSize(entryPArray); + if (arraySize > 0) { + SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); + ASSERT(*ppNode != NULL); + pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); + } + taosArrayDestroy(entryPArray); + + sTrace("get index2: %ld, arraySize:%d -------------", index, arraySize); + syncEntryLog2((char*)"getLogEntry2", pEntry); + return pEntry; +} + +SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { + sTrace("get index: %ld -------------", index); + SyncIndex index2 = index; + SSyncRaftEntry* pEntry = NULL; + SSkipListIterator* pIter = + tSkipListCreateIterFromVal(pSkipList, (const char*)&index2, TSDB_DATA_TYPE_BINARY, TSDB_ORDER_ASC); + if (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + } + + syncEntryLog2((char*)"getLogEntry", pEntry); + return pEntry; +} + +void test5() { + SSkipList* pSkipList = + tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); + ASSERT(pSkipList != NULL); + + sTrace("insert 9 - 5"); + for (int i = 9; i >= 5; --i) { + SSyncRaftEntry* pEntry = createEntry(i); + SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); + } + + sTrace("insert 0 - 4"); + for (int i = 0; i <= 4; ++i) { + SSyncRaftEntry* pEntry = createEntry(i); + SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); + } + + sTrace("insert 7 7 7 7 7"); + for (int i = 0; i <= 4; ++i) { + SSyncRaftEntry* pEntry = createEntry(7); + SSkipListNode* pSkipListNode = tSkipListPut(pSkipList, pEntry); + } + + sTrace("print: -------------"); + printSkipList(pSkipList); + + delSkipListFirst(pSkipList, 3); + + sTrace("print: -------------"); + printSkipList(pSkipList); + + getLogEntry(pSkipList, 2); + getLogEntry(pSkipList, 5); + getLogEntry(pSkipList, 7); + getLogEntry(pSkipList, 7); + + getLogEntry2(pSkipList, 2); + getLogEntry2(pSkipList, 5); + getLogEntry2(pSkipList, 7); + getLogEntry2(pSkipList, 7); + + tSkipListDestroy(pSkipList); +} + +int main(int argc, char** argv) { + gRaftDetailLog = true; + tsAsyncLog = 0; + sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE + DEBUG_DEBUG; + + /* + test1(); + test2(); + test3(); + test4(); + */ + + test5(); + + return 0; +} From 531dfd4452e75f924584908a93eb2bdc52ff97dd Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 16:00:06 +0800 Subject: [PATCH 43/92] fix:error in tmq meta --- examples/c/tmq.c | 4 ++-- source/client/src/tmq.c | 3 +++ source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 24c415b2fc..94e0b86821 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -35,7 +35,7 @@ static void msg_process(TAOS_RES* msg) { return; } - TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1"); + TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 5"); if (taos_errno(pRes) != 0) { printf("error in create db, reason:%s\n", taos_errstr(pRes)); return; @@ -82,7 +82,7 @@ int32_t init_env() { return -1; } - TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 3"); + TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 5"); if (taos_errno(pRes) != 0) { printf("error in create db, reason:%s\n", taos_errstr(pRes)); return -1; diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 7e01e5cd83..d4d7c05b56 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2856,6 +2856,9 @@ static int32_t taosAlterTable(TAOS *taos, void *meta, int32_t metaLen){ pVgData = NULL; pArray = NULL; code = pRequest->code; + if (code == TSDB_CODE_VND_TABLE_NOT_EXIST){ + code = 0; + } end: taosArrayDestroy(pArray); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d25ae817c7..d369475437 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -611,7 +611,7 @@ static int32_t vnodeProcessAlterTbReq(SVnode *pVnode, int64_t version, void *pRe // process if (metaAlterTable(pVnode->pMeta, version, &vAlterTbReq, &vMetaRsp) < 0) { - vAlterTbRsp.code = TSDB_CODE_INVALID_MSG; + vAlterTbRsp.code = terrno; tDecoderClear(&dc); rcode = -1; goto _exit; From ff20bae06bd3e26c7707e3219c20316742515c67 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 16:36:03 +0800 Subject: [PATCH 44/92] test: restore some 2.0 case --- tests/script/general/import/testSuite.sim | 4 --- tests/script/jenkins/basic.txt | 6 ++++ .../script/{general => tsim}/import/basic.sim | 26 ---------------- .../{general => tsim}/import/commit.sim | 28 ----------------- .../script/{general => tsim}/import/large.sim | 26 ---------------- .../{general => tsim}/import/replica1.sim | 31 ------------------- 6 files changed, 6 insertions(+), 115 deletions(-) delete mode 100644 tests/script/general/import/testSuite.sim rename tests/script/{general => tsim}/import/basic.sim (75%) rename tests/script/{general => tsim}/import/commit.sim (66%) rename tests/script/{general => tsim}/import/large.sim (63%) rename tests/script/{general => tsim}/import/replica1.sim (84%) diff --git a/tests/script/general/import/testSuite.sim b/tests/script/general/import/testSuite.sim deleted file mode 100644 index 9157410ea5..0000000000 --- a/tests/script/general/import/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run general/import/basic.sim -run general/import/commit.sim -run general/import/large.sim -run general/import/replica1.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index b24ca5f85e..32279b3a4a 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -66,6 +66,12 @@ # ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim # ./test.sh -f tsim/dnode/vnode_clean.sim +# ---- import +./test.sh -f tsim/import/basic.sim +./test.sh -f tsim/import/commit.sim +./test.sh -f tsim/import/large.sim +./test.sh -f tsim/import/replica1.sim + # ---- insert ./test.sh -f tsim/insert/basic0.sim ./test.sh -f tsim/insert/basic1.sim diff --git a/tests/script/general/import/basic.sim b/tests/script/tsim/import/basic.sim similarity index 75% rename from tests/script/general/import/basic.sim rename to tests/script/tsim/import/basic.sim index f72d132ca3..cb1b525120 100644 --- a/tests/script/general/import/basic.sim +++ b/tests/script/tsim/import/basic.sim @@ -1,32 +1,6 @@ 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/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect sql create database ibadb diff --git a/tests/script/general/import/commit.sim b/tests/script/tsim/import/commit.sim similarity index 66% rename from tests/script/general/import/commit.sim rename to tests/script/tsim/import/commit.sim index aefc724fdb..e7f0440f5e 100644 --- a/tests/script/general/import/commit.sim +++ b/tests/script/tsim/import/commit.sim @@ -1,32 +1,6 @@ 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/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print ========= step1 @@ -72,9 +46,7 @@ endi print ========= step3 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 print ========= step4 sql select * from ic2db.tb; diff --git a/tests/script/general/import/large.sim b/tests/script/tsim/import/large.sim similarity index 63% rename from tests/script/general/import/large.sim rename to tests/script/tsim/import/large.sim index 23fbcc75ea..f694502e2a 100644 --- a/tests/script/general/import/large.sim +++ b/tests/script/tsim/import/large.sim @@ -1,32 +1,6 @@ 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/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect sql create database db diff --git a/tests/script/general/import/replica1.sim b/tests/script/tsim/import/replica1.sim similarity index 84% rename from tests/script/general/import/replica1.sim rename to tests/script/tsim/import/replica1.sim index 1e8eabb798..3a4b4a2876 100644 --- a/tests/script/general/import/replica1.sim +++ b/tests/script/tsim/import/replica1.sim @@ -1,33 +1,6 @@ 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/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect sql create database ir1db duration 7 @@ -93,9 +66,7 @@ endi print ================== dnode restart system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql use ir1db sql select * from tb; @@ -162,9 +133,7 @@ endi print ================= step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql use ir1db sql select * from tb; From 8c83f07fe436369deb193347b6ea5a83407f641f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Jul 2022 16:43:50 +0800 Subject: [PATCH 45/92] fix: fix natural timestamp issue --- include/common/ttime.h | 2 + include/libs/scalar/scalar.h | 1 + source/common/src/ttime.c | 26 ++++ source/libs/parser/src/parCalcConst.c | 11 +- source/libs/parser/src/parTranslater.c | 3 +- source/libs/scalar/inc/sclInt.h | 1 + source/libs/scalar/src/scalar.c | 161 +++++++++++++------------ source/libs/scalar/src/sclvector.c | 41 ++++--- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/scalar/scalar.sim | 67 ++++++++++ 10 files changed, 219 insertions(+), 95 deletions(-) create mode 100644 tests/script/tsim/scalar/scalar.sim diff --git a/include/common/ttime.h b/include/common/ttime.h index cd704bb1f7..de55b016cd 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -72,6 +72,8 @@ static FORCE_INLINE int64_t taosGetTimestampToday(int32_t precision) { } int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision); +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision); + int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision); int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision); diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index c81c474366..517c5ff0e6 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -32,6 +32,7 @@ pNode will be freed in API; *pRes need to freed in caller */ int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes); +int32_t scalarCalculateConstantsFromDual(SNode *pNode, SNode **pRes); /* pDst need to freed in caller diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index befb0abac8..d728bbe49e 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -710,6 +710,32 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { return (int64_t)(taosMktime(&tm) * TSDB_TICK_PER_SECOND(precision)); } +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision) { + if (duration == 0) { + return t; + } + + if (unit != 'n' && unit != 'y') { + return t - duration; + } + + // The following code handles the y/n time duration + int64_t numOfMonth = duration; + if (unit == 'y') { + numOfMonth *= 12; + } + + struct tm tm; + time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision)); + taosLocalTime(&tt, &tm); + int32_t mon = tm.tm_year * 12 + tm.tm_mon - (int32_t)numOfMonth; + tm.tm_year = mon / 12; + tm.tm_mon = mon % 12; + + return (int64_t)(taosMktime(&tm) * TSDB_TICK_PER_SECOND(precision)); +} + + int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) { if (ekey < skey) { int64_t tmp = ekey; diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index 4dff42592a..cd10cd50f6 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -166,7 +166,7 @@ static int32_t calcConstStmtCondition(SCalcConstContext* pCxt, SNode** pCond, bo return code; } -static int32_t calcConstProject(SNode* pProject, SNode** pNew) { +static int32_t calcConstProject(SNode* pProject, bool dual, SNode** pNew) { SArray* pAssociation = NULL; if (NULL != ((SExprNode*)pProject)->pAssociation) { pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation); @@ -177,7 +177,12 @@ static int32_t calcConstProject(SNode* pProject, SNode** pNew) { char aliasName[TSDB_COL_NAME_LEN] = {0}; strcpy(aliasName, ((SExprNode*)pProject)->aliasName); - int32_t code = scalarCalculateConstants(pProject, pNew); + int32_t code = TSDB_CODE_SUCCESS; + if (dual) { + code = scalarCalculateConstantsFromDual(pProject, pNew); + } else { + code = scalarCalculateConstants(pProject, pNew); + } if (TSDB_CODE_SUCCESS == code && QUERY_NODE_VALUE == nodeType(*pNew) && NULL != pAssociation) { strcpy(((SExprNode*)*pNew)->aliasName, aliasName); int32_t size = taosArrayGetSize(pAssociation); @@ -223,7 +228,7 @@ static int32_t calcConstProjections(SCalcConstContext* pCxt, SSelectStmt* pSelec continue; } SNode* pNew = NULL; - int32_t code = calcConstProject(pProj, &pNew); + int32_t code = calcConstProject(pProj, (NULL == pSelect->pFromTable), &pNew); if (TSDB_CODE_SUCCESS == code) { REPLACE_NODE(pNew); } else { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index da393bb883..f90c7ee23c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -916,8 +916,6 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { - // TODO - // pVal->node.resType = targetDt; pVal->translate = true; pVal->isNull = true; return DEAL_RES_CONTINUE; @@ -932,6 +930,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD res = translateNormalValue(pCxt, pVal, targetDt, strict); } pVal->node.resType = targetDt; + pVal->node.resType.scale = pVal->unit; pVal->translate = true; return res; } diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h index 4422da1b81..d423b92da7 100644 --- a/source/libs/scalar/inc/sclInt.h +++ b/source/libs/scalar/inc/sclInt.h @@ -30,6 +30,7 @@ typedef struct SOperatorValueType { typedef struct SScalarCtx { int32_t code; + bool dual; SArray *pBlockList; /* element is SSDataBlock* */ SHashObj *pRes; /* element is SScalarParam */ void *param; // additional parameter (meta actually) for acquire value such as tbname/tags values diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index e610fcb62e..a2e9f7a1cd 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -700,7 +700,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) { SFunctionNode *node = (SFunctionNode *)*pNode; SNode* tnode = NULL; - if (!fmIsScalarFunc(node->funcId)) { + if ((!fmIsScalarFunc(node->funcId)) && (!ctx->dual)) { return DEAL_RES_CONTINUE; } @@ -1010,13 +1010,14 @@ int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockL return TSDB_CODE_SUCCESS; } -int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) { +int32_t sclCalcConstants(SNode *pNode, bool dual, SNode **pRes) { if (NULL == pNode) { SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } int32_t code = 0; SScalarCtx ctx = {0}; + ctx.dual = dual; ctx.pRes = taosHashInit(SCL_DEFAULT_OP_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); if (NULL == ctx.pRes) { sclError("taosHashInit failed, num:%d", SCL_DEFAULT_OP_NUM); @@ -1028,10 +1029,88 @@ int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) { *pRes = pNode; _return: + sclFreeRes(ctx.pRes); return code; } +static int32_t sclGetMinusOperatorResType(SOperatorNode* pOp) { + if (!IS_MATHABLE_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; + return TSDB_CODE_SUCCESS; +} + +static int32_t sclGetMathOperatorResType(SOperatorNode* pOp) { + SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; + SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; + if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) || + (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) || + (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + + if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && IS_INTEGER_TYPE(rdt.type)) || + (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && IS_INTEGER_TYPE(ldt.type)) || + (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_BOOL == rdt.type) || + (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && TSDB_DATA_TYPE_BOOL == ldt.type)) { + pOp->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes; + } else { + pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; + } + return TSDB_CODE_SUCCESS; +} + +static int32_t sclGetCompOperatorResType(SOperatorNode* pOp) { + SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; + if (OP_TYPE_IN == pOp->opType || OP_TYPE_NOT_IN == pOp->opType) { + ((SExprNode*)(pOp->pRight))->resType = ldt; + } else if (nodesIsRegularOp(pOp)) { + SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; + if (!IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || + (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + } + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + return TSDB_CODE_SUCCESS; +} + +static int32_t sclGetJsonOperatorResType(SOperatorNode* pOp) { + SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; + SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; + if (TSDB_DATA_TYPE_JSON != ldt.type || !IS_STR_DATA_TYPE(rdt.type)) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + if (pOp->opType == OP_TYPE_JSON_GET_VALUE) { + pOp->node.resType.type = TSDB_DATA_TYPE_JSON; + } else if (pOp->opType == OP_TYPE_JSON_CONTAINS) { + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + } + pOp->node.resType.bytes = tDataTypes[pOp->node.resType.type].bytes; + return TSDB_CODE_SUCCESS; +} + +static int32_t sclGetBitwiseOperatorResType(SOperatorNode* pOp) { + pOp->node.resType.type = TSDB_DATA_TYPE_BIGINT; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; + return TSDB_CODE_SUCCESS; +} + + +int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) { + return sclCalcConstants(pNode, false, pRes); +} + +int32_t scalarCalculateConstantsFromDual(SNode *pNode, SNode **pRes) { + return sclCalcConstants(pNode, true, pRes); +} + int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { if (NULL == pNode || NULL == pBlockList) { SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); @@ -1075,74 +1154,6 @@ _return: return code; } -static int32_t getMinusOperatorResultType(SOperatorNode* pOp) { - if (!IS_MATHABLE_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) { - return TSDB_CODE_TSC_INVALID_OPERATION; - } - pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; - return TSDB_CODE_SUCCESS; -} - -static int32_t getArithmeticOperatorResultType(SOperatorNode* pOp) { - SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; - SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; - if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) || - (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) || - (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) { - return TSDB_CODE_TSC_INVALID_OPERATION; - } - - if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && IS_INTEGER_TYPE(rdt.type)) || - (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && IS_INTEGER_TYPE(ldt.type)) || - (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_BOOL == rdt.type) || - (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && TSDB_DATA_TYPE_BOOL == ldt.type)) { - pOp->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes; - } else { - pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; - } - return TSDB_CODE_SUCCESS; -} - -static int32_t getComparisonOperatorResultType(SOperatorNode* pOp) { - SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; - if (OP_TYPE_IN == pOp->opType || OP_TYPE_NOT_IN == pOp->opType) { - ((SExprNode*)(pOp->pRight))->resType = ldt; - } else if (nodesIsRegularOp(pOp)) { - SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; - if (!IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || - (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { - return TSDB_CODE_TSC_INVALID_OPERATION; - } - } - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - return TSDB_CODE_SUCCESS; -} - -static int32_t getJsonOperatorResultType(SOperatorNode* pOp) { - SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; - SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; - if (TSDB_DATA_TYPE_JSON != ldt.type || !IS_STR_DATA_TYPE(rdt.type)) { - return TSDB_CODE_TSC_INVALID_OPERATION; - } - if (pOp->opType == OP_TYPE_JSON_GET_VALUE) { - pOp->node.resType.type = TSDB_DATA_TYPE_JSON; - } else if (pOp->opType == OP_TYPE_JSON_CONTAINS) { - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - } - pOp->node.resType.bytes = tDataTypes[pOp->node.resType.type].bytes; - return TSDB_CODE_SUCCESS; -} - -static int32_t getBitwiseOperatorResultType(SOperatorNode* pOp) { - pOp->node.resType.type = TSDB_DATA_TYPE_BIGINT; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; - return TSDB_CODE_SUCCESS; -} - int32_t scalarGetOperatorResultType(SOperatorNode* pOp) { if (TSDB_DATA_TYPE_BLOB == ((SExprNode*)(pOp->pLeft))->resType.type || (NULL != pOp->pRight && TSDB_DATA_TYPE_BLOB == ((SExprNode*)(pOp->pRight))->resType.type)) { @@ -1155,15 +1166,15 @@ int32_t scalarGetOperatorResultType(SOperatorNode* pOp) { case OP_TYPE_MULTI: case OP_TYPE_DIV: case OP_TYPE_REM: - return getArithmeticOperatorResultType(pOp); + return sclGetMathOperatorResType(pOp); case OP_TYPE_MINUS: - return getMinusOperatorResultType(pOp); + return sclGetMinusOperatorResType(pOp); case OP_TYPE_ASSIGN: pOp->node.resType = ((SExprNode*)(pOp->pLeft))->resType; break; case OP_TYPE_BIT_AND: case OP_TYPE_BIT_OR: - return getBitwiseOperatorResultType(pOp); + return sclGetBitwiseOperatorResType(pOp); case OP_TYPE_GREATER_THAN: case OP_TYPE_GREATER_EQUAL: case OP_TYPE_LOWER_THAN: @@ -1184,10 +1195,10 @@ int32_t scalarGetOperatorResultType(SOperatorNode* pOp) { case OP_TYPE_NMATCH: case OP_TYPE_IN: case OP_TYPE_NOT_IN: - return getComparisonOperatorResultType(pOp); + return sclGetCompOperatorResType(pOp); case OP_TYPE_JSON_GET_VALUE: case OP_TYPE_JSON_CONTAINS: - return getJsonOperatorResultType(pOp); + return sclGetJsonOperatorResType(pOp); default: break; } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index bf457d07eb..39b2f04f3e 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1055,7 +1055,7 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig } } -static void vectorMathBigintAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRightCol, SColumnInfoData* pOutputCol, int32_t numOfRows, int32_t step, int32_t i) { +static void vectorMathTsAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRightCol, SColumnInfoData* pOutputCol, int32_t numOfRows, int32_t step, int32_t i) { _getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type); _getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type); @@ -1069,7 +1069,8 @@ static void vectorMathBigintAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData colDataAppendNULL(pOutputCol, i); continue; // TODO set null or ignore } - *output = getVectorBigintValueFnLeft(pLeftCol->pData, i) + getVectorBigintValueFnRight(pRightCol->pData, 0); + *output = taosTimeAdd(getVectorBigintValueFnLeft(pLeftCol->pData, i), getVectorBigintValueFnRight(pRightCol->pData, 0), + pRightCol->info.scale, pRightCol->info.precision); } } } @@ -1116,7 +1117,17 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut _getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type); _getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type); - if (pLeft->numOfRows == pRight->numOfRows) { + if (pLeft->numOfRows == 1 && pRight->numOfRows == 1) { + if (GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_TIMESTAMP) { + vectorMathTsAddHelper(pLeftCol, pRightCol, pOutputCol, pRight->numOfRows, step, i); + } else { + vectorMathTsAddHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, i); + } + } else if (pLeft->numOfRows == 1) { + vectorMathTsAddHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, i); + } else if (pRight->numOfRows == 1) { + vectorMathTsAddHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, i); + } else if (pLeft->numOfRows == pRight->numOfRows) { for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) { if (IS_NULL) { colDataAppendNULL(pOutputCol, i); @@ -1124,11 +1135,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut } *output = getVectorBigintValueFnLeft(pLeftCol->pData, i) + getVectorBigintValueFnRight(pRightCol->pData, i); } - } else if (pLeft->numOfRows == 1) { - vectorMathBigintAddHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, i); - } else if (pRight->numOfRows == 1) { - vectorMathBigintAddHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, i); - } + } } else { double *output = (double *)pOutputCol->pData; _getDoubleValue_fn_t getVectorDoubleValueFnLeft = getVectorDoubleValueFn(pLeftCol->info.type); @@ -1174,7 +1181,7 @@ static void vectorMathSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig } } -static void vectorMathBigintSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRightCol, SColumnInfoData* pOutputCol, int32_t numOfRows, int32_t step, int32_t factor, int32_t i) { +static void vectorMathTsSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRightCol, SColumnInfoData* pOutputCol, int32_t numOfRows, int32_t step, int32_t factor, int32_t i) { _getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type); _getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type); @@ -1188,7 +1195,9 @@ static void vectorMathBigintSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData colDataAppendNULL(pOutputCol, i); continue; // TODO set null or ignore } - *output = (getVectorBigintValueFnLeft(pLeftCol->pData, i) - getVectorBigintValueFnRight(pRightCol->pData, 0)) * factor; + *output = taosTimeSub(getVectorBigintValueFnLeft(pLeftCol->pData, i), getVectorBigintValueFnRight(pRightCol->pData, 0), + pRightCol->info.scale, pRightCol->info.precision); + } } } @@ -1211,7 +1220,13 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut _getBigintValue_fn_t getVectorBigintValueFnLeft = getVectorBigintValueFn(pLeftCol->info.type); _getBigintValue_fn_t getVectorBigintValueFnRight = getVectorBigintValueFn(pRightCol->info.type); - if (pLeft->numOfRows == pRight->numOfRows) { + if (pLeft->numOfRows == 1 && pRight->numOfRows == 1) { + vectorMathTsSubHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, 1, i); + } else if (pLeft->numOfRows == 1) { + vectorMathTsSubHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, -1, i); + } else if (pRight->numOfRows == 1) { + vectorMathTsSubHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, 1, i); + } else if (pLeft->numOfRows == pRight->numOfRows) { for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) { if (IS_NULL) { colDataAppendNULL(pOutputCol, i); @@ -1219,10 +1234,6 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut } *output = getVectorBigintValueFnLeft(pLeftCol->pData, i) - getVectorBigintValueFnRight(pRightCol->pData, i); } - } else if (pLeft->numOfRows == 1) { - vectorMathBigintSubHelper(pRightCol, pLeftCol, pOutputCol, pRight->numOfRows, step, -1, i); - } else if (pRight->numOfRows == 1) { - vectorMathBigintSubHelper(pLeftCol, pRightCol, pOutputCol, pLeft->numOfRows, step, 1, i); } } else { double *output = (double *)pOutputCol->pData; diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 50d4c04a93..b4f9df8e5f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -197,5 +197,6 @@ # --- scalar ./test.sh -f tsim/scalar/in.sim +./test.sh -f tsim/scalar/scalar.sim #======================b1-end=============== diff --git a/tests/script/tsim/scalar/scalar.sim b/tests/script/tsim/scalar/scalar.sim new file mode 100644 index 0000000000..32224e33ba --- /dev/null +++ b/tests/script/tsim/scalar/scalar.sim @@ -0,0 +1,67 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step1 +sql drop database if exists db1; +sql create database db1 vgroups 3; +sql use db1; +sql create stable st1 (fts timestamp, fbool bool, ftiny tinyint, fsmall smallint, fint int, fbig bigint, futiny tinyint unsigned, fusmall smallint unsigned, fuint int unsigned, fubig bigint unsigned, ffloat float, fdouble double, fbin binary(10), fnchar nchar(10)) tags(tts timestamp, tbool bool, ttiny tinyint, tsmall smallint, tint int, tbig bigint, tutiny tinyint unsigned, tusmall smallint unsigned, tuint int unsigned, tubig bigint unsigned, tfloat float, tdouble double, tbin binary(10), tnchar nchar(10)); +sql create table tb1 using st1 tags('2022-07-10 16:31:00', true, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a'); +sql create table tb2 using st1 tags('2022-07-10 16:32:00', false, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b'); +sql create table tb3 using st1 tags('2022-07-10 16:33:00', true, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c'); + +sql insert into tb1 values ('2022-07-10 16:31:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a'); +sql insert into tb1 values ('2022-07-10 16:31:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b'); +sql insert into tb1 values ('2022-07-10 16:31:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c'); +sql insert into tb1 values ('2022-07-10 16:31:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd'); +sql insert into tb1 values ('2022-07-10 16:31:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e'); + +sql insert into tb2 values ('2022-07-10 16:32:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a'); +sql insert into tb2 values ('2022-07-10 16:32:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b'); +sql insert into tb2 values ('2022-07-10 16:32:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c'); +sql insert into tb2 values ('2022-07-10 16:32:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd'); +sql insert into tb2 values ('2022-07-10 16:32:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e'); + +sql insert into tb3 values ('2022-07-10 16:33:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a'); +sql insert into tb3 values ('2022-07-10 16:33:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b'); +sql insert into tb3 values ('2022-07-10 16:33:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c'); +sql insert into tb3 values ('2022-07-10 16:33:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd'); +sql insert into tb3 values ('2022-07-10 16:33:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e'); + +sql select 1+1n; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + + +sql select cast(1 as timestamp)+1n; +if $rows != 1 then + return -1 +endi +if $data00 != @70-02-01 08:00:00.000@ then + return -1 +endi + +sql select 1-1n; +if $rows != 1 then + return -1 +endi + +sql select cast(1 as timestamp)-1y; +if $rows != 1 then + return -1 +endi +if $data00 != @69-01-01 08:00:00.000@ then + return -1 +endi + +sql select 1n-now(); +sql select 1n+now(); +#sql select avg(4n); + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From c2e2e73cc59a56fd1521879d45c21fbadb8e70da Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 17:03:26 +0800 Subject: [PATCH 46/92] fix: get mnode epset from sync module --- source/dnode/mnode/impl/src/mndMnode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index c03951b1d8..d7eaa72202 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -218,6 +218,7 @@ bool mndIsMnode(SMnode *pMnode, int32_t dnodeId) { } void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) { +#if 0 SSdb *pSdb = pMnode->pSdb; int32_t totalMnodes = sdbGetSize(pSdb, SDB_MNODE); void *pIter = NULL; @@ -237,6 +238,9 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) { addEpIntoEpSet(pEpSet, pObj->pDnode->fqdn, pObj->pDnode->port); sdbRelease(pSdb, pObj); } +#else + syncGetRetryEpSet(pMnode->syncMgmt.sync, pEpSet); +#endif } static int32_t mndSetCreateMnodeRedoLogs(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) { From 32cb6755a2768d27740fa9c964e2678a36dfb06b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 13 Jul 2022 17:08:27 +0800 Subject: [PATCH 47/92] feat(stream): optimize close window --- source/libs/executor/src/timewindowoperator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 943763dadb..2d64e6bd1c 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1338,9 +1338,9 @@ static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, uint64_t groupId = *(uint64_t*)key; ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); - SResultRowInfo dumyInfo; - dumyInfo.cur.pageId = -1; - STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, ts, pInterval, TSDB_ORDER_ASC); + STimeWindow win; + win.skey = ts; + win.ekey = taosTimeAdd(win.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; SWinRes winRe = { .ts = win.skey, .groupId = groupId, From ca754adaa6ee13c2553a696574f2dd1b686931a5 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Jul 2022 17:14:04 +0800 Subject: [PATCH 48/92] fix: add agg processing --- include/util/taoserror.h | 3 ++- source/libs/command/src/command.c | 10 +++++++--- source/libs/scalar/src/scalar.c | 2 +- source/util/src/terror.c | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index ce434612c3..c057d48875 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -584,7 +584,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D) #define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E) #define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F) -#define TSDB_CODE_PAR_INVALID_SMA_INDEX TAOS_DEF_ERROR_CODE(0, 0x265C) +#define TSDB_CODE_PAR_INVALID_SMA_INDEX TAOS_DEF_ERROR_CODE(0, 0x2660) +#define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661) //planner #define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700) diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index a2816209a9..034778e5bf 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -570,10 +570,14 @@ int32_t buildSelectResultDataBlock(SNodeList* pProjects, SSDataBlock* pBlock) { int32_t index = 0; SNode* pProj = NULL; FOREACH(pProj, pProjects) { - if (((SValueNode*)pProj)->isNull) { - colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, NULL, true); + if (QUERY_NODE_VALUE != nodeType(pProj)) { + return TSDB_CODE_PAR_INVALID_SELECTED_EXPR; } else { - colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, nodesGetValueFromNode((SValueNode*)pProj), false); + if (((SValueNode*)pProj)->isNull) { + colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, NULL, true); + } else { + colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, nodesGetValueFromNode((SValueNode*)pProj), false); + } } } diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index a2e9f7a1cd..bdfc411fa6 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -700,7 +700,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) { SFunctionNode *node = (SFunctionNode *)*pNode; SNode* tnode = NULL; - if ((!fmIsScalarFunc(node->funcId)) && (!ctx->dual)) { + if (!fmIsScalarFunc(node->funcId)) { return DEAL_RES_CONTINUE; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index ef6697b3b5..2364c53a9a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -561,6 +561,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be jso TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SELECTED_EXPR, "Invalid SELECTed expression") //planner TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_INTERNAL_ERROR, "Planner internal error") From a015aca162066abe644db333b4ccd4499324c012 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 17:16:34 +0800 Subject: [PATCH 49/92] fix:core dump if stable name is null in SVCreateTbReq --- source/dnode/vnode/src/tq/tqSink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index dbbb2b2661..25615f8d5c 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -50,6 +50,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo SVCreateTbReq createTbReq = {0}; createTbReq.name = buildCtbNameByGroupId(stbFullName, pDataBlock->info.groupId); + createTbReq.ctb.name = strdup(stbFullName); createTbReq.flags = 0; createTbReq.type = TSDB_CHILD_TABLE; createTbReq.ctb.suid = suid; From 2ea11ba9c1773936c396e0a1943e3ed0321b128b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 16:54:49 +0800 Subject: [PATCH 50/92] test: restore some 2.0 case --- tests/script/general/field/testSuite.sim | 14 ----- tests/script/jenkins/basic.txt | 61 ++++++++++++------- tests/script/{general => tsim}/field/2.sim | 12 ++-- tests/script/{general => tsim}/field/3.sim | 18 +++--- tests/script/{general => tsim}/field/4.sim | 22 +++---- tests/script/{general => tsim}/field/5.sim | 26 ++++---- tests/script/{general => tsim}/field/6.sim | 30 +++++---- .../script/{general => tsim}/field/bigint.sim | 9 +-- .../script/{general => tsim}/field/binary.sim | 6 +- tests/script/{general => tsim}/field/bool.sim | 9 +-- .../script/{general => tsim}/field/double.sim | 9 +-- .../script/{general => tsim}/field/float.sim | 10 ++- tests/script/{general => tsim}/field/int.sim | 10 ++- .../script/{general => tsim}/field/single.sim | 6 +- .../{general => tsim}/field/smallint.sim | 10 ++- .../{general => tsim}/field/tinyint.sim | 9 +-- .../field/unsigined_bigint.sim | 13 ++-- 17 files changed, 120 insertions(+), 154 deletions(-) delete mode 100644 tests/script/general/field/testSuite.sim rename tests/script/{general => tsim}/field/2.sim (96%) rename tests/script/{general => tsim}/field/3.sim (97%) rename tests/script/{general => tsim}/field/4.sim (97%) rename tests/script/{general => tsim}/field/5.sim (97%) rename tests/script/{general => tsim}/field/6.sim (97%) rename tests/script/{general => tsim}/field/bigint.sim (94%) rename tests/script/{general => tsim}/field/binary.sim (96%) rename tests/script/{general => tsim}/field/bool.sim (94%) rename tests/script/{general => tsim}/field/double.sim (94%) rename tests/script/{general => tsim}/field/float.sim (94%) rename tests/script/{general => tsim}/field/int.sim (94%) rename tests/script/{general => tsim}/field/single.sim (98%) rename tests/script/{general => tsim}/field/smallint.sim (94%) rename tests/script/{general => tsim}/field/tinyint.sim (94%) rename tests/script/{general => tsim}/field/unsigined_bigint.sim (94%) diff --git a/tests/script/general/field/testSuite.sim b/tests/script/general/field/testSuite.sim deleted file mode 100644 index d12f0ebbd4..0000000000 --- a/tests/script/general/field/testSuite.sim +++ /dev/null @@ -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 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 32279b3a4a..0c3126bac7 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,33 +1,12 @@ #======================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 ./test.sh -f tsim/user/basic.sim ./test.sh -f tsim/user/password.sim ./test.sh -f tsim/user/privilege_db.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 ./test.sh -f tsim/db/alter_option.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/basic2.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 # ---- show @@ -225,4 +204,42 @@ # --- scalar ./test.sh -f tsim/scalar/in.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 + +# ---- 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 + #======================b1-end=============== diff --git a/tests/script/general/field/2.sim b/tests/script/tsim/field/2.sim similarity index 96% rename from tests/script/general/field/2.sim rename to tests/script/tsim/field/2.sim index cc6889fd75..b5c501ceed 100644 --- a/tests/script/general/field/2.sim +++ b/tests/script/tsim/field/2.sim @@ -1,10 +1,8 @@ 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 = db @@ -280,18 +278,18 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc 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 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/3.sim b/tests/script/tsim/field/3.sim similarity index 97% rename from tests/script/general/field/3.sim rename to tests/script/tsim/field/3.sim index cb3c6621ac..661bc6a85a 100644 --- a/tests/script/general/field/3.sim +++ b/tests/script/tsim/field/3.sim @@ -1,10 +1,8 @@ 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 = db @@ -493,28 +491,28 @@ if $data00 != 25 then endi 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 group by tgcol1 order by tgcol1 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol2 order by tgcol2 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol3 order by tgcol3 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/4.sim b/tests/script/tsim/field/4.sim similarity index 97% rename from tests/script/general/field/4.sim rename to tests/script/tsim/field/4.sim index 2d893da777..734179c5bb 100644 --- a/tests/script/general/field/4.sim +++ b/tests/script/tsim/field/4.sim @@ -1,10 +1,8 @@ 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 = db @@ -677,34 +675,34 @@ if $data00 != 25 then endi 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 group by tgcol1 order by tgcol1 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol2 order by tgcol2 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol3 order by tgcol3 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol4 order by tgcol4 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/5.sim b/tests/script/tsim/field/5.sim similarity index 97% rename from tests/script/general/field/5.sim rename to tests/script/tsim/field/5.sim index e1421bdb4f..5185d8556e 100644 --- a/tests/script/general/field/5.sim +++ b/tests/script/tsim/field/5.sim @@ -1,10 +1,8 @@ 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 = db @@ -794,40 +792,40 @@ endi 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 group by tgcol1 order by tgcol1 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol2 order by tgcol2 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol3 order by tgcol3 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol4 order by tgcol4 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol5 order by tgcol5 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/6.sim b/tests/script/tsim/field/6.sim similarity index 97% rename from tests/script/general/field/6.sim rename to tests/script/tsim/field/6.sim index 27475d591f..8ceefae228 100644 --- a/tests/script/general/field/6.sim +++ b/tests/script/tsim/field/6.sim @@ -1,10 +1,8 @@ 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 = db @@ -943,46 +941,46 @@ if $data00 != 25 then endi 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 group by tgcol1 order by tgcol1 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol2 order by tgcol2 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol3 order by tgcol3 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol4 order by tgcol4 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol5 order by tgcol5 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 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 group by tgcol6 order by tgcol6 desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/bigint.sim b/tests/script/tsim/field/bigint.sim similarity index 94% rename from tests/script/general/field/bigint.sim rename to tests/script/tsim/field/bigint.sim index cfe8c561f0..c580a4df1c 100644 --- a/tests/script/general/field/bigint.sim +++ b/tests/script/tsim/field/bigint.sim @@ -1,9 +1,6 @@ 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 @@ -146,16 +143,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/binary.sim b/tests/script/tsim/field/binary.sim similarity index 96% rename from tests/script/general/field/binary.sim rename to tests/script/tsim/field/binary.sim index 821dbc9a82..59005e1ef1 100644 --- a/tests/script/general/field/binary.sim +++ b/tests/script/tsim/field/binary.sim @@ -1,9 +1,6 @@ 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 @@ -47,7 +44,6 @@ while $i < 10 $i = $i + 1 endw - print =============== step2 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 sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/bool.sim b/tests/script/tsim/field/bool.sim similarity index 94% rename from tests/script/general/field/bool.sim rename to tests/script/tsim/field/bool.sim index d94071b328..37292e9758 100644 --- a/tests/script/general/field/bool.sim +++ b/tests/script/tsim/field/bool.sim @@ -1,9 +1,6 @@ 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 @@ -144,8 +141,8 @@ if $data00 != 25 then endi print =============== step8 -sql 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 interval(1d) group by tgcol order by tgcol desc +sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol order by tgcol desc +print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data01 != 100 then return -1 @@ -154,7 +151,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/double.sim b/tests/script/tsim/field/double.sim similarity index 94% rename from tests/script/general/field/double.sim rename to tests/script/tsim/field/double.sim index 0c9c23e304..e7b1c8e8af 100644 --- a/tests/script/general/field/double.sim +++ b/tests/script/tsim/field/double.sim @@ -1,9 +1,6 @@ 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 @@ -144,16 +141,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/float.sim b/tests/script/tsim/field/float.sim similarity index 94% rename from tests/script/general/field/float.sim rename to tests/script/tsim/field/float.sim index 00423c00b8..159a4b60ab 100644 --- a/tests/script/general/field/float.sim +++ b/tests/script/tsim/field/float.sim @@ -1,10 +1,8 @@ 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 = db @@ -144,16 +142,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/int.sim b/tests/script/tsim/field/int.sim similarity index 94% rename from tests/script/general/field/int.sim rename to tests/script/tsim/field/int.sim index 0e322e4f12..2b5b70141a 100644 --- a/tests/script/general/field/int.sim +++ b/tests/script/tsim/field/int.sim @@ -1,10 +1,8 @@ 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 = db @@ -144,16 +142,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/single.sim b/tests/script/tsim/field/single.sim similarity index 98% rename from tests/script/general/field/single.sim rename to tests/script/tsim/field/single.sim index 3f6bf4309f..115e76ffeb 100644 --- a/tests/script/general/field/single.sim +++ b/tests/script/tsim/field/single.sim @@ -1,10 +1,8 @@ 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 = db @@ -211,7 +209,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/smallint.sim b/tests/script/tsim/field/smallint.sim similarity index 94% rename from tests/script/general/field/smallint.sim rename to tests/script/tsim/field/smallint.sim index 78b2b998cf..975f02bf9b 100644 --- a/tests/script/general/field/smallint.sim +++ b/tests/script/tsim/field/smallint.sim @@ -1,10 +1,8 @@ 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 = db @@ -144,16 +142,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/tinyint.sim b/tests/script/tsim/field/tinyint.sim similarity index 94% rename from tests/script/general/field/tinyint.sim rename to tests/script/tsim/field/tinyint.sim index 7e1a0c6e80..ff24e484a7 100644 --- a/tests/script/general/field/tinyint.sim +++ b/tests/script/tsim/field/tinyint.sim @@ -1,9 +1,6 @@ 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 @@ -145,16 +142,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/field/unsigined_bigint.sim b/tests/script/tsim/field/unsigined_bigint.sim similarity index 94% rename from tests/script/general/field/unsigined_bigint.sim rename to tests/script/tsim/field/unsigined_bigint.sim index 260128b5c2..d8421e7626 100644 --- a/tests/script/general/field/unsigined_bigint.sim +++ b/tests/script/tsim/field/unsigined_bigint.sim @@ -1,12 +1,9 @@ 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 +print ======================== dnode1 start $dbPrefix = db $tbPrefix = tb $mtPrefix = st @@ -27,7 +24,7 @@ $i = 0 while $i < 5 $tb = $tbPrefix . $i 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 while $x < $rowNum $ms = $x . m @@ -150,16 +147,16 @@ if $data00 != 25 then endi 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 group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi From efeae69890c586d3e269e07348d9cafa21442e96 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Wed, 13 Jul 2022 17:29:59 +0800 Subject: [PATCH 51/92] ci: explicitly exit 0 --- tests/system-test/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 0a891759d0..fd0979745e 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -370,3 +370,4 @@ if __name__ == "__main__": tdLog.info("not need to query") if conn is not None: conn.close() + sys.exit(0) From 78abf57f1ad13cfd219bdfb5d78ee15bb83b7bf2 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Wed, 13 Jul 2022 17:35:34 +0800 Subject: [PATCH 52/92] test:modify case --- tests/system-test/7-tmq/tmqUpdate-1ctb.py | 2 +- tests/system-test/fulltest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system-test/7-tmq/tmqUpdate-1ctb.py b/tests/system-test/7-tmq/tmqUpdate-1ctb.py index 3cb364f91d..8513092be9 100644 --- a/tests/system-test/7-tmq/tmqUpdate-1ctb.py +++ b/tests/system-test/7-tmq/tmqUpdate-1ctb.py @@ -19,7 +19,7 @@ class TDTestCase: self.snapshot = 0 self.vgroups = 4 self.ctbNum = 1 - self.rowsPerTbl = 100000 + self.rowsPerTbl = 10000 def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index becb5db501..2c116113bc 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -148,7 +148,7 @@ python3 ./test.py -f 7-tmq/subscribeDb2.py python3 ./test.py -f 7-tmq/subscribeDb3.py #python3 ./test.py -f 7-tmq/subscribeDb4.py python3 ./test.py -f 7-tmq/subscribeStb.py -#python3 ./test.py -f 7-tmq/subscribeStb0.py +python3 ./test.py -f 7-tmq/subscribeStb0.py python3 ./test.py -f 7-tmq/subscribeStb1.py python3 ./test.py -f 7-tmq/subscribeStb2.py python3 ./test.py -f 7-tmq/subscribeStb3.py From 43738ca3854b28e94376a42347353b14fad169db Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Wed, 13 Jul 2022 17:36:21 +0800 Subject: [PATCH 53/92] enh: print command exit code in log --- tests/parallel_test/run_case.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/run_case.sh b/tests/parallel_test/run_case.sh index 9705c024b8..52a5627e34 100755 --- a/tests/parallel_test/run_case.sh +++ b/tests/parallel_test/run_case.sh @@ -65,6 +65,7 @@ ulimit -c unlimited $TIMEOUT_CMD $cmd RET=$? +echo "cmd exit code: $RET" if [ $RET -ne 0 ]; then pwd From 312dce4e212a96c1f73eace01a7ebc8fbdd38883 Mon Sep 17 00:00:00 2001 From: "slzhou@taodata.com" Date: Wed, 13 Jul 2022 17:57:59 +0800 Subject: [PATCH 54/92] fix: reset hasGroupId after outputing the previous group results --- source/libs/executor/src/sortoperator.c | 4 +++- source/libs/executor/src/timewindowoperator.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 8d9cac3614..9795907404 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -621,7 +621,9 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData break; } } - + if (pInfo->groupSort) { + pInfo->hasGroupId = false; + } if (p->info.rows > 0) { // todo extract method blockDataEnsureCapacity(pDataBlock, p->info.rows); int32_t numOfCols = taosArrayGetSize(pColMatchInfo); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 773484a9b3..1be1488d11 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -4507,13 +4507,14 @@ static SSDataBlock* doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->order, scanFlag, true); doMergeAlignedIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); doFilter(miaInfo->pCondition, pRes); - if (pRes->info.rows > 0) { + if (pRes->info.rows >= pOperator->resultInfo.capacity) { break; } } pRes->info.groupId = miaInfo->groupId; } + miaInfo->hasGroupId = false; if (miaInfo->inputBlocksFinished) { doSetOperatorCompleted(pOperator); From 0ba9d225938e32eabfe6105f6700bc7bddd0ad59 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 17:59:25 +0800 Subject: [PATCH 55/92] test: restore some 2.0 case --- tests/script/general/compute/testSuite.sim | 17 ---------- tests/script/jenkins/basic.txt | 20 +++++++++++ .../script/{general => tsim}/compute/avg.sim | 5 +-- .../{general => tsim}/compute/block_dist.sim | 5 +-- .../{general => tsim}/compute/bottom.sim | 5 +-- .../{general => tsim}/compute/count.sim | 5 +-- .../script/{general => tsim}/compute/diff.sim | 5 +-- .../{general => tsim}/compute/diff2.sim | 5 +-- .../{general => tsim}/compute/first.sim | 5 +-- .../{general => tsim}/compute/interval.sim | 5 +-- .../script/{general => tsim}/compute/last.sim | 5 +-- .../{general => tsim}/compute/last_row.sim | 5 +-- .../{general => tsim}/compute/leastsquare.sim | 5 +-- .../script/{general => tsim}/compute/max.sim | 5 +-- .../script/{general => tsim}/compute/min.sim | 32 ++++++++---------- .../script/{general => tsim}/compute/null.sim | 23 ++++++------- .../{general => tsim}/compute/percentile.sim | 6 +--- .../{general => tsim}/compute/stddev.sim | 17 ++++------ .../script/{general => tsim}/compute/sum.sim | 33 +++++++++---------- .../script/{general => tsim}/compute/top.sim | 29 ++++++++-------- 20 files changed, 94 insertions(+), 143 deletions(-) delete mode 100644 tests/script/general/compute/testSuite.sim rename tests/script/{general => tsim}/compute/avg.sim (97%) rename tests/script/{general => tsim}/compute/block_dist.sim (95%) rename tests/script/{general => tsim}/compute/bottom.sim (95%) rename tests/script/{general => tsim}/compute/count.sim (97%) rename tests/script/{general => tsim}/compute/diff.sim (95%) rename tests/script/{general => tsim}/compute/diff2.sim (97%) rename tests/script/{general => tsim}/compute/first.sim (97%) rename tests/script/{general => tsim}/compute/interval.sim (98%) rename tests/script/{general => tsim}/compute/last.sim (97%) rename tests/script/{general => tsim}/compute/last_row.sim (98%) rename tests/script/{general => tsim}/compute/leastsquare.sim (96%) rename tests/script/{general => tsim}/compute/max.sim (97%) rename tests/script/{general => tsim}/compute/min.sim (87%) rename tests/script/{general => tsim}/compute/null.sim (93%) rename tests/script/{general => tsim}/compute/percentile.sim (96%) rename tests/script/{general => tsim}/compute/stddev.sim (88%) rename tests/script/{general => tsim}/compute/sum.sim (84%) rename tests/script/{general => tsim}/compute/top.sim (81%) diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim deleted file mode 100644 index 91bf4bf0cd..0000000000 --- a/tests/script/general/compute/testSuite.sim +++ /dev/null @@ -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 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 0c3126bac7..ba94743df8 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -225,6 +225,26 @@ ./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 diff --git a/tests/script/general/compute/avg.sim b/tests/script/tsim/compute/avg.sim similarity index 97% rename from tests/script/general/compute/avg.sim rename to tests/script/tsim/compute/avg.sim index db452b0344..2805b65fff 100644 --- a/tests/script/general/compute/avg.sim +++ b/tests/script/tsim/compute/avg.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_av_db @@ -163,7 +160,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/block_dist.sim b/tests/script/tsim/compute/block_dist.sim similarity index 95% rename from tests/script/general/compute/block_dist.sim rename to tests/script/tsim/compute/block_dist.sim index 5343c1db28..201d222af7 100644 --- a/tests/script/general/compute/block_dist.sim +++ b/tests/script/tsim/compute/block_dist.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_di_db @@ -91,7 +88,7 @@ sql_error select _block_dist() from (select * from $mt) print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/bottom.sim b/tests/script/tsim/compute/bottom.sim similarity index 95% rename from tests/script/general/compute/bottom.sim rename to tests/script/tsim/compute/bottom.sim index 7af67ecbf0..cfac02d6d5 100644 --- a/tests/script/general/compute/bottom.sim +++ b/tests/script/tsim/compute/bottom.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_bo_db @@ -98,7 +95,7 @@ step6: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/count.sim b/tests/script/tsim/compute/count.sim similarity index 97% rename from tests/script/general/compute/count.sim rename to tests/script/tsim/compute/count.sim index cf84918f5b..0a6ce93077 100644 --- a/tests/script/general/compute/count.sim +++ b/tests/script/tsim/compute/count.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_co_db @@ -192,7 +189,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/diff.sim b/tests/script/tsim/compute/diff.sim similarity index 95% rename from tests/script/general/compute/diff.sim rename to tests/script/tsim/compute/diff.sim index bc303a9ca5..ba4b32ddbb 100644 --- a/tests/script/general/compute/diff.sim +++ b/tests/script/tsim/compute/diff.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_di_db @@ -91,7 +88,7 @@ step6: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/diff2.sim b/tests/script/tsim/compute/diff2.sim similarity index 97% rename from tests/script/general/compute/diff2.sim rename to tests/script/tsim/compute/diff2.sim index 55fa1daa95..08b52cb37b 100644 --- a/tests/script/general/compute/diff2.sim +++ b/tests/script/tsim/compute/diff2.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_di_db @@ -152,7 +149,7 @@ step6: print =============== clear #sql drop database $db #sql show databases -#if $rows != 0 then +#if $rows != 2 then # return -1 #endi diff --git a/tests/script/general/compute/first.sim b/tests/script/tsim/compute/first.sim similarity index 97% rename from tests/script/general/compute/first.sim rename to tests/script/tsim/compute/first.sim index fce334167b..cf1160dbdb 100644 --- a/tests/script/general/compute/first.sim +++ b/tests/script/tsim/compute/first.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_fi_db @@ -165,7 +162,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/interval.sim b/tests/script/tsim/compute/interval.sim similarity index 98% rename from tests/script/general/compute/interval.sim rename to tests/script/tsim/compute/interval.sim index c21003a646..a8539701c7 100644 --- a/tests/script/general/compute/interval.sim +++ b/tests/script/tsim/compute/interval.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_in_db @@ -199,7 +196,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/last.sim b/tests/script/tsim/compute/last.sim similarity index 97% rename from tests/script/general/compute/last.sim rename to tests/script/tsim/compute/last.sim index 9f20f8c5aa..aa9b041ca9 100644 --- a/tests/script/general/compute/last.sim +++ b/tests/script/tsim/compute/last.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_la_db @@ -169,7 +166,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/last_row.sim b/tests/script/tsim/compute/last_row.sim similarity index 98% rename from tests/script/general/compute/last_row.sim rename to tests/script/tsim/compute/last_row.sim index 3b28b0baa5..867f64fa2e 100644 --- a/tests/script/general/compute/last_row.sim +++ b/tests/script/tsim/compute/last_row.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_la_db @@ -217,7 +214,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/leastsquare.sim b/tests/script/tsim/compute/leastsquare.sim similarity index 96% rename from tests/script/general/compute/leastsquare.sim rename to tests/script/tsim/compute/leastsquare.sim index 1c8af7fe7f..aa83a4e14e 100644 --- a/tests/script/general/compute/leastsquare.sim +++ b/tests/script/tsim/compute/leastsquare.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_le_db @@ -93,7 +90,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/max.sim b/tests/script/tsim/compute/max.sim similarity index 97% rename from tests/script/general/compute/max.sim rename to tests/script/tsim/compute/max.sim index f9665a823d..1b3fac5820 100644 --- a/tests/script/general/compute/max.sim +++ b/tests/script/tsim/compute/max.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_ma_db @@ -169,7 +166,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/min.sim b/tests/script/tsim/compute/min.sim similarity index 87% rename from tests/script/general/compute/min.sim rename to tests/script/tsim/compute/min.sim index 4a9904e065..33e9eb0f3e 100644 --- a/tests/script/general/compute/min.sim +++ b/tests/script/tsim/compute/min.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mi_db @@ -73,14 +69,14 @@ endi print =============== step5 sql select min(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select min(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi @@ -90,8 +86,8 @@ $ms = 1601481600000 + $cc 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 ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi if $rows != 5 then @@ -130,14 +126,14 @@ endi print =============== step9 sql select min(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select min(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi @@ -155,9 +151,9 @@ endi print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select min(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then +sql select min(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) +print ===> $data10 +if $data10 != 1 then return -1 endi print ===> $rows @@ -168,7 +164,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/null.sim b/tests/script/tsim/compute/null.sim similarity index 93% rename from tests/script/general/compute/null.sim rename to tests/script/tsim/compute/null.sim index cd00b7a69d..30860da48b 100644 --- a/tests/script/general/compute/null.sim +++ b/tests/script/tsim/compute/null.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = db @@ -98,22 +95,26 @@ if $data02 != 19 then return -1 endi -sql select * from $tb where tbcol = NULL -x step3 +sql select * from $tb where tbcol is NULL +if $rows != 1 then return -1 -step3: +endi + +sql_error select * from $tb where tbcol = NULL + +return print =============== step5 -sql create table $tb using $mt tags( NULL ) -# return -1 -#step51: +sql create table tt using $mt tags( NULL ) #sql alter table $tb set tgcol=NULL -x step52 # return -1 #step52: -sql select * from $mt where tgcol = NULL -x step5 +sql select * from $mt where tgcol is NULL +if $rows != 1 then return -1 -step5: +endi print =============== step6 sql select count(tbcol), count(tbcol2), avg(tbcol), avg(tbcol2), sum(tbcol), sum(tbcol2) from $mt @@ -222,7 +223,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/percentile.sim b/tests/script/tsim/compute/percentile.sim similarity index 96% rename from tests/script/general/compute/percentile.sim rename to tests/script/tsim/compute/percentile.sim index b0f4fff8d7..5cba3ad856 100644 --- a/tests/script/general/compute/percentile.sim +++ b/tests/script/tsim/compute/percentile.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_pe_db @@ -125,11 +122,10 @@ if $data00 != 5.000000000 then return -1 endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/stddev.sim b/tests/script/tsim/compute/stddev.sim similarity index 88% rename from tests/script/general/compute/stddev.sim rename to tests/script/tsim/compute/stddev.sim index 772ec8386a..7048399112 100644 --- a/tests/script/general/compute/stddev.sim +++ b/tests/script/tsim/compute/stddev.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_st_db @@ -72,14 +69,14 @@ endi print =============== step5 sql select stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then +print ===> $data00 +if $data00 != 0.000000000 then return -1 endi sql select stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then +print ===> $data00 +if $data00 != 5.766281297 then return -1 endi @@ -88,8 +85,8 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then +print ===> $data00 +if $data00 != 0.000000000 then return -1 endi if $rows != 5 then @@ -99,7 +96,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/sum.sim b/tests/script/tsim/compute/sum.sim similarity index 84% rename from tests/script/general/compute/sum.sim rename to tests/script/tsim/compute/sum.sim index 8fad992750..d4185f3204 100644 --- a/tests/script/general/compute/sum.sim +++ b/tests/script/tsim/compute/sum.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_su_db @@ -72,14 +69,14 @@ endi print =============== step5 sql select sum(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select sum(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 190 then +print ===> $data00 +if $data00 != 190 then return -1 endi @@ -88,8 +85,8 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi if $rows != 5 then @@ -130,14 +127,14 @@ endi print =============== step9 sql select sum(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 < 5 then +print ===> $data10 +if $data10 < 5 then return -1 endi sql select sum(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 1900 then +print ===> $data00 +if $data00 != 1900 then return -1 endi @@ -156,10 +153,10 @@ print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql 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 interval(1d) group by tgcol -print ===> $data01 -if $data01 != 10 then +sql select sum(tbcol) as b from $mt where ts <= $ms group by tgcol +print select sum(tbcol) as b from $mt where ts <= $ms group by tgcol +print ===> $data00 +if $data00 != 10 then return -1 endi if $rows != 10 then @@ -169,7 +166,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/compute/top.sim b/tests/script/tsim/compute/top.sim similarity index 81% rename from tests/script/general/compute/top.sim rename to tests/script/tsim/compute/top.sim index 1e9d302b7c..9899a8a9ea 100644 --- a/tests/script/general/compute/top.sim +++ b/tests/script/tsim/compute/top.sim @@ -1,9 +1,6 @@ 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 $dbPrefix = m_to_db @@ -48,8 +45,8 @@ $i = 1 $tb = $tbPrefix . $i sql select top(tbcol, 1) from $tb -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi @@ -58,25 +55,25 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select top(tbcol, 1) from $tb where ts <= $ms -print ===> $data01 -if $data01 != 4 then +print ===> $data00 +if $data00 != 4 then return -1 endi print =============== step4 sql select top(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi print =============== step5 sql select top(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 18 then +print ===> $data00 $data10 +if $data00 != 18 then return -1 endi -if $data11 != 19 then +if $data10 != 19 then return -1 endi @@ -85,11 +82,11 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select top(tbcol, 2) as b from $tb where ts <= $ms -print ===> $data01 $data11 -if $data01 != 3 then +print ===> $data00 $data10 +if $data00 != 3 then return -1 endi -if $data11 != 4 then +if $data10 != 4 then return -1 endi @@ -100,7 +97,7 @@ step6: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi From caa06f938ab36be29dd727dcfec245691f74e45e Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 13 Jul 2022 18:09:14 +0800 Subject: [PATCH 56/92] ci(stream): stream sliding --- tests/script/tsim/stream/sliding.sim | 243 +++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 tests/script/tsim/stream/sliding.sim diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim new file mode 100644 index 0000000000..750be7cb49 --- /dev/null +++ b/tests/script/tsim/stream/sliding.sim @@ -0,0 +1,243 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print =============== create database +sql create database test vgroups 1 +sql show databases +if $rows != 3 then + return -1 +endi + +print $data00 $data01 $data02 + +sql use test +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream stream_t1 trigger at_once into streamtST as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791216000,2,2,3,1.1); +sql insert into t1 values(1648791220000,3,2,3,2.1); + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791216000,2,2,3,1.1); +sql insert into t1 values(1648791220000,3,2,3,2.1); + +sql insert into t2 values(1648791210000,1,2,3,1.0); +sql insert into t2 values(1648791216000,2,2,3,1.1); +sql insert into t2 values(1648791220000,3,2,3,2.1); + +sql insert into t2 values(1648791210000,1,2,3,1.0); +sql insert into t2 values(1648791216000,2,2,3,1.1); +sql insert into t2 values(1648791220000,3,2,3,2.1); + +$loop_count = 0 + +loop0: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +sql select * from streamt + +# row 0 +if $data01 != 1 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop0 +endi + +# row 1 +if $data11 != 2 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 3 then + print =====data12=$data12 + goto loop0 +endi + +# row 2 +if $data21 != 2 then + print =====data21=$data21 + goto loop0 +endi + +if $data22 != 5 then + print =====data22=$data22 + goto loop0 +endi + +# row 3 +if $data31 != 1 then + print =====data31=$data31 + goto loop0 +endi + +if $data32 != 3 then + print =====data32=$data32 + goto loop0 +endi + +print step 1 + +sql select * from streamt2 + +# row 0 +if $data01 != 1 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop0 +endi + +# row 1 +if $data11 != 2 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 3 then + print =====data12=$data12 + goto loop0 +endi + +# row 2 +if $data21 != 2 then + print =====data21=$data21 + goto loop0 +endi + +if $data22 != 5 then + print =====data22=$data22 + goto loop0 +endi + +# row 3 +if $data31 != 1 then + print =====data31=$data31 + goto loop0 +endi + +if $data32 != 3 then + print =====data32=$data32 + goto loop0 +endi + +print step 2 + +sql select * from streamtST + +# row 0 +if $data01 != 2 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop0 +endi + +# row 1 +if $data11 != 4 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 6 then + print =====data12=$data12 + goto loop0 +endi + +# row 2 +if $data21 != 4 then + print =====data21=$data21 + goto loop0 +endi + +if $data22 != 10 then + print =====data22=$data22 + goto loop0 +endi + +# row 3 +if $data31 != 2 then + print =====data31=$data31 + goto loop0 +endi + +if $data32 != 6 then + print =====data32=$data32 + goto loop0 +endi + +print step 3 + +sql select * from streamtST2 + +# row 0 +if $data01 != 2 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop0 +endi + +# row 1 +if $data11 != 4 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 6 then + print =====data12=$data12 + goto loop0 +endi + +# row 2 +if $data21 != 4 then + print =====data21=$data21 + goto loop0 +endi + +if $data22 != 10 then + print =====data22=$data22 + goto loop0 +endi + +# row 3 +if $data31 != 2 then + print =====data31=$data31 + goto loop0 +endi + +if $data32 != 6 then + print =====data32=$data32 + goto loop0 +endi + + +system sh/stop_dnodes.sh \ No newline at end of file From 4830b7d9d3c5b7ceec3d4f8e8270889f9b74b87d Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 13 Jul 2022 18:12:02 +0800 Subject: [PATCH 57/92] feat: support pseudo columns such as _qstart, _qend and _qduration --- include/libs/function/functionMgt.h | 1 + include/libs/nodes/querynodes.h | 1 + source/libs/function/inc/functionMgtInt.h | 1 + source/libs/function/src/builtins.c | 18 ++-- source/libs/function/src/functionMgt.c | 2 + source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesCodeFuncs.c | 7 ++ source/libs/nodes/src/nodesUtilFuncs.c | 5 + source/libs/parser/src/parAstCreater.c | 1 + source/libs/parser/src/parTranslater.c | 101 +++++++++++++++++---- source/libs/planner/test/planBasicTest.cpp | 5 + 11 files changed, 115 insertions(+), 28 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 6af7fca10f..04825f376f 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -198,6 +198,7 @@ bool fmIsInterpFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId); bool fmIsSystemInfoFunc(int32_t funcId); bool fmIsImplicitTsFunc(int32_t funcId); +bool fmIsClientPseudoColumnFunc(int32_t funcId); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 49db69c7c7..234b554526 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -248,6 +248,7 @@ typedef struct SSelectStmt { SNodeList* pOrderByList; // SOrderByExprNode SLimitNode* pLimit; SLimitNode* pSlimit; + STimeWindow timeRange; char stmtName[TSDB_TABLE_NAME_LEN]; uint8_t precision; int32_t selectFuncNum; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 2fcddce5eb..da5dd0433d 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -47,6 +47,7 @@ extern "C" { #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_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) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 972ce2396b..5feb142757 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2786,31 +2786,31 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_qstart", .type = FUNCTION_TYPE_QSTART, - .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, .translateFunc = translateTimePseudoColumn, - .getEnvFunc = getTimePseudoFuncEnv, + .getEnvFunc = NULL, .initFunc = NULL, - .sprocessFunc = qStartTsFunction, // todo + .sprocessFunc = NULL, .finalizeFunc = NULL }, { .name = "_qend", .type = FUNCTION_TYPE_QEND, - .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, .translateFunc = translateTimePseudoColumn, - .getEnvFunc = getTimePseudoFuncEnv, + .getEnvFunc = NULL, .initFunc = NULL, - .sprocessFunc = qEndTsFunction, // todo + .sprocessFunc = NULL, .finalizeFunc = NULL }, { .name = "_qduration", .type = FUNCTION_TYPE_QDURATION, - .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, .translateFunc = translateWduration, - .getEnvFunc = getTimePseudoFuncEnv, + .getEnvFunc = NULL, .initFunc = NULL, - .sprocessFunc = winDurFunction, // todo + .sprocessFunc = NULL, .finalizeFunc = NULL }, { diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index c003f917b5..f73a61fa60 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -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 fmIsClientPseudoColumnFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_CLIENT_PC_FUNC); } + bool fmIsInterpFunc(int32_t funcId) { if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { return false; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 6c0717e845..e7109b5a87 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -127,6 +127,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { COPY_SCALAR_FIELD(isDuration); COPY_SCALAR_FIELD(translate); COPY_SCALAR_FIELD(notReserved); + COPY_SCALAR_FIELD(isNull); COPY_SCALAR_FIELD(placeholderNo); COPY_SCALAR_FIELD(typeData); COPY_SCALAR_FIELD(unit); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 3c285cc7f1..75f9cd7b48 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -2712,6 +2712,7 @@ static const char* jkValueLiteral = "Literal"; static const char* jkValueDuration = "Duration"; static const char* jkValueTranslate = "Translate"; static const char* jkValueNotReserved = "NotReserved"; +static const char* jkValueIsNull = "IsNull"; static const char* jkValueDatum = "Datum"; static int32_t datumToJson(const void* pObj, SJson* pJson) { @@ -2798,6 +2799,9 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkValueNotReserved, pNode->notReserved); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkValueIsNull, pNode->isNull); + } if (TSDB_CODE_SUCCESS == code && pNode->translate) { code = datumToJson(pNode, pJson); } @@ -2945,6 +2949,9 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkValueNotReserved, &pNode->notReserved); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkValueIsNull, &pNode->isNull); + } if (TSDB_CODE_SUCCESS == code && pNode->translate) { code = jsonToDatum(pJson, pNode); } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 9b754c92d0..051cdf9a94 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1692,6 +1692,11 @@ int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots) { } 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->nLen = pNode->node.resType.bytes; switch (pNode->node.resType.type) { diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index ca0ab7f42e..a7806f5e34 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -740,6 +740,7 @@ SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pPr select->pFromTable = pTable; sprintf(select->stmtName, "%p", select); select->isTimeLineResult = true; + select->timeRange = TSWINDOW_INITIALIZER; return (SNode*)select; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6b7bf3af26..ec8aadf827 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1198,7 +1198,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); if (NULL == pVal) { return TSDB_CODE_OUT_OF_MEMORY; @@ -1229,7 +1229,7 @@ static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) { return TSDB_CODE_OUT_OF_MEMORY; } } - return rewriteSystemInfoFuncImpl(pCxt, pCurrDb, pNode); + return rewriteFuncToValue(pCxt, pCurrDb, pNode); } static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) { @@ -1237,7 +1237,7 @@ static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) { if (NULL == pVer) { return TSDB_CODE_OUT_OF_MEMORY; } - return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); + return rewriteFuncToValue(pCxt, pVer, pNode); } static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) { @@ -1245,7 +1245,7 @@ static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) if (NULL == pVer) { return TSDB_CODE_OUT_OF_MEMORY; } - return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); + return rewriteFuncToValue(pCxt, pVer, pNode); } static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) { @@ -1253,7 +1253,7 @@ static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) { return TSDB_CODE_RPC_NETWORK_UNAVAIL; } char* pStatus = taosMemoryStrDup((void*)"1"); - return rewriteSystemInfoFuncImpl(pCxt, pStatus, pNode); + return rewriteFuncToValue(pCxt, pStatus, pNode); } static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) { @@ -1264,7 +1264,7 @@ static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) { if (NULL == pUserConn) { return TSDB_CODE_OUT_OF_MEMORY; } - return rewriteSystemInfoFuncImpl(pCxt, pUserConn, pNode); + return rewriteFuncToValue(pCxt, pUserConn, pNode); } static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { @@ -1318,10 +1318,60 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p 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) { if (fmIsSystemInfoFunc((*pFunc)->funcId)) { return rewriteSystemInfoFunc(pCxt, (SNode**)pFunc); } + if (fmIsClientPseudoColumnFunc((*pFunc)->funcId)) { + return rewriteClientPseudoColumnFunc(pCxt, (SNode**)pFunc); + } return translateNoramlFunction(pCxt, *pFunc); } @@ -2078,7 +2128,7 @@ static int32_t getTimeRange(SNode** pPrimaryKeyCond, STimeWindow* pTimeRange, bo 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) { *pTimeRange = TSWINDOW_INITIALIZER; return TSDB_CODE_SUCCESS; @@ -2139,16 +2189,13 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode* 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) { return TSDB_CODE_SUCCESS; } - int32_t code = getFillTimeRange(pCxt, pWhere, &(((SFillNode*)pInterval->pFill)->timeRange)); - if (TSDB_CODE_SUCCESS == code) { - code = checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval); - } - return code; + ((SFillNode*)pInterval->pFill)->timeRange = pSelect->timeRange; + return checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval); } static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char unit) { @@ -2235,7 +2282,7 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* static int32_t translateIntervalWindow(STranslateContext* pCxt, SSelectStmt* pSelect, SIntervalWindowNode* pInterval) { int32_t code = checkIntervalWindow(pCxt, pInterval); if (TSDB_CODE_SUCCESS == code) { - code = translateFill(pCxt, pSelect->pWhere, pInterval); + code = translateFill(pCxt, pSelect, pInterval); } return code; } @@ -2330,7 +2377,7 @@ static int32_t translateInterpFill(STranslateContext* pCxt, SSelectStmt* pSelect code = translateExpr(pCxt, &pSelect->pFill); } 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) { code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery); @@ -2362,9 +2409,24 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartiti return translateExprList(pCxt, pPartitionByList); } -static int32_t translateWhere(STranslateContext* pCxt, SNode** pWhere) { +static bool isDataTable(int8_t tableType) { + return TSDB_SUPER_TABLE == tableType || TSDB_CHILD_TABLE == tableType || TSDB_NORMAL_TABLE == tableType; +} + +static bool needCalcTimeRange(SSelectStmt* pSelect) { + if (QUERY_NODE_REAL_TABLE != nodeType(pSelect->pFromTable)) { + return false; + } + return isDataTable(((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType); +} + +static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) { pCxt->currClause = SQL_CLAUSE_WHERE; - return translateExpr(pCxt, pWhere); + int32_t code = translateExpr(pCxt, &pSelect->pWhere); + if (TSDB_CODE_SUCCESS == code && needCalcTimeRange(pSelect)) { + code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange); + } + return code; } static int32_t translateFrom(STranslateContext* pCxt, SNode* pTable) { @@ -2495,7 +2557,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect int32_t code = translateFrom(pCxt, pSelect->pFromTable); if (TSDB_CODE_SUCCESS == code) { pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision; - code = translateWhere(pCxt, &pSelect->pWhere); + code = translateWhere(pCxt, pSelect); } if (TSDB_CODE_SUCCESS == code) { code = translatePartitionBy(pCxt, pSelect->pPartitionByList); @@ -2681,7 +2743,8 @@ static int32_t partitionDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelet } 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) { code = partitionDeleteWhere(pCxt, pDelete); } diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 2379ea262a..0d6bab145a 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -141,6 +141,11 @@ 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) { From f488b0dd003050d68da3b157d5249e085a3f5d87 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 18:48:35 +0800 Subject: [PATCH 58/92] test: restore some 2.0 case --- tests/script/tsim/field/bool.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/field/bool.sim b/tests/script/tsim/field/bool.sim index 37292e9758..90bb4e7c3d 100644 --- a/tests/script/tsim/field/bool.sim +++ b/tests/script/tsim/field/bool.sim @@ -144,7 +144,7 @@ print =============== step8 sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol order by tgcol desc print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi From 8aa04f8e5549c8c46ba0890675731f3964e70b18 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 18:49:57 +0800 Subject: [PATCH 59/92] fix:error in tmq meta --- include/util/tencode.h | 4 ++-- source/common/src/tmsg.c | 6 ++++-- source/dnode/vnode/src/vnd/vnodeSvr.c | 10 +++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/util/tencode.h b/include/util/tencode.h index e318d4f240..ad642cd612 100644 --- a/include/util/tencode.h +++ b/include/util/tencode.h @@ -440,7 +440,7 @@ static FORCE_INLINE bool tDecodeIsEnd(SDecoder* pCoder) { return (pCoder->size = static FORCE_INLINE void* tEncoderMalloc(SEncoder* pCoder, int32_t size) { void* p = NULL; - SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + size); + SCoderMem* pMem = (SCoderMem*)taosMemoryCalloc(1, sizeof(*pMem) + size); if (pMem) { pMem->next = pCoder->mList; pCoder->mList = pMem; @@ -451,7 +451,7 @@ static FORCE_INLINE void* tEncoderMalloc(SEncoder* pCoder, int32_t size) { static FORCE_INLINE void* tDecoderMalloc(SDecoder* pCoder, int32_t size) { void* p = NULL; - SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + size); + SCoderMem* pMem = (SCoderMem*)taosMemoryCalloc(1, sizeof(*pMem) + size); if (pMem) { pMem->next = pCoder->mList; pCoder->mList = pMem; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 714a17df0d..9ebfa78b80 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4984,8 +4984,10 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { pReq->ctb.tagName = taosArrayInit(len, TSDB_COL_NAME_LEN); if(pReq->ctb.tagName == NULL) return -1; for (int32_t i = 0; i < len; i++){ - char *name = NULL; - if (tDecodeCStr(pCoder, &name) < 0) return -1; + char name[TSDB_COL_NAME_LEN] = {0}; + char *tmp = NULL; + if (tDecodeCStr(pCoder, &tmp) < 0) return -1; + strcpy(name, tmp); taosArrayPush(pReq->ctb.tagName, name); } } else if (pReq->type == TSDB_NORMAL_TABLE) { diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d369475437..cca212a4e4 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -494,8 +494,6 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR taosArrayPush(rsp.pArray, &cRsp); } - tDecoderClear(&decoder); - tqUpdateTbUidList(pVnode->pTq, tbUids, true); tdUpdateTbUidList(pVnode->pSma, pStore); tdUidStoreFree(pStore); @@ -512,9 +510,12 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR } tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen); tEncodeSVCreateTbBatchRsp(&encoder, &rsp); - tEncoderClear(&encoder); _exit: + for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { + pCreateReq = req.pReqs + iReq; + taosArrayDestroy(pCreateReq->ctb.tagName); + } taosArrayDestroy(rsp.pArray); taosArrayDestroy(tbUids); tDecoderClear(&decoder); @@ -795,6 +796,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq if (tDecodeSVCreateTbReq(&decoder, &createTbReq) < 0) { pRsp->code = TSDB_CODE_INVALID_MSG; tDecoderClear(&decoder); + taosArrayDestroy(createTbReq.ctb.tagName); goto _exit; } @@ -802,6 +804,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) { submitBlkRsp.code = terrno; tDecoderClear(&decoder); + taosArrayDestroy(createTbReq.ctb.tagName); goto _exit; } } @@ -822,6 +825,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq vnodeDebugPrintSingleSubmitMsg(pVnode->pMeta, pBlock, &msgIter, "real uid"); #endif tDecoderClear(&decoder); + taosArrayDestroy(createTbReq.ctb.tagName); } else { submitBlkRsp.tblFName = taosMemoryMalloc(TSDB_TABLE_FNAME_LEN); sprintf(submitBlkRsp.tblFName, "%s.", pVnode->config.dbname); From 9887c63c5de481cac3bbf0a52069742806b17837 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 13 Jul 2022 19:03:40 +0800 Subject: [PATCH 60/92] feat: support pseudo columns such as _qstart, _qend and _qduration --- source/libs/nodes/src/nodesUtilFuncs.c | 2 +- source/libs/parser/src/parTranslater.c | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 051cdf9a94..b00b08a66d 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1777,7 +1777,7 @@ static EDealRes classifyConditionImpl(SNode* pNode, void* pContext) { SClassifyConditionCxt* pCxt = (SClassifyConditionCxt*)pContext; if (QUERY_NODE_COLUMN == nodeType(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; } else if (pCol->hasIndex) { pCxt->hasTagIndexCol = true; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ec8aadf827..653451a7a6 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -916,8 +916,6 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { - // TODO - // pVal->node.resType = targetDt; pVal->translate = true; pVal->isNull = true; return DEAL_RES_CONTINUE; @@ -2409,21 +2407,10 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartiti return translateExprList(pCxt, pPartitionByList); } -static bool isDataTable(int8_t tableType) { - return TSDB_SUPER_TABLE == tableType || TSDB_CHILD_TABLE == tableType || TSDB_NORMAL_TABLE == tableType; -} - -static bool needCalcTimeRange(SSelectStmt* pSelect) { - if (QUERY_NODE_REAL_TABLE != nodeType(pSelect->pFromTable)) { - return false; - } - return isDataTable(((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType); -} - static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) { pCxt->currClause = SQL_CLAUSE_WHERE; int32_t code = translateExpr(pCxt, &pSelect->pWhere); - if (TSDB_CODE_SUCCESS == code && needCalcTimeRange(pSelect)) { + if (TSDB_CODE_SUCCESS == code) { code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange); } return code; From afb20f79c71c97a9d6b95905bb89e0161fa5689b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 19:58:07 +0800 Subject: [PATCH 61/92] fix(query): copy the value instead of assign data. --- source/libs/executor/src/scanoperator.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c7112ab8a6..8786d30007 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1183,7 +1183,10 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock for (int32_t j = 0; j < blockDataGetNumOfCols(pBlock); ++j) { SColumnInfoData* pResCol = bdGetColumnInfoData(pBlock, j); 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; break; } @@ -2590,9 +2593,11 @@ static SSDataBlock* getTableDataBlock(void* param) { SDataBlockInfo binfo = pBlock->info; tsdbRetrieveDataBlockInfo(reader, &binfo); - binfo.capacity = binfo.rows; blockDataEnsureCapacity(pBlock, binfo.capacity); - pBlock->info = binfo; + pBlock->info.type = binfo.type; + pBlock->info.uid = binfo.uid; + pBlock->info.window = binfo.window; + pBlock->info.rows = binfo.rows; uint32_t status = 0; int32_t code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, readerIdx, pBlock, &status); From 2f7d6828073358a12380413063ae262fa0756b32 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 20:00:07 +0800 Subject: [PATCH 62/92] test: restore some 2.0 case --- tests/script/jenkins/basic.txt | 2 +- tests/script/tsim/compute/sum.sim | 6 +++--- tests/script/tsim/field/2.sim | 4 ++-- tests/script/tsim/field/3.sim | 6 +++--- tests/script/tsim/field/4.sim | 8 ++++---- tests/script/tsim/field/5.sim | 10 +++++----- tests/script/tsim/field/6.sim | 12 ++++++------ tests/script/tsim/field/bigint.sim | 2 +- tests/script/tsim/field/bool.sim | 4 ++-- tests/script/tsim/field/double.sim | 2 +- tests/script/tsim/field/float.sim | 2 +- tests/script/tsim/field/int.sim | 2 +- tests/script/tsim/field/smallint.sim | 2 +- tests/script/tsim/field/tinyint.sim | 2 +- tests/script/tsim/field/unsigined_bigint.sim | 2 +- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index ba94743df8..59536f2ef6 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -242,7 +242,7 @@ #./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/sum.sim ./test.sh -f tsim/compute/top.sim # ---- field diff --git a/tests/script/tsim/compute/sum.sim b/tests/script/tsim/compute/sum.sim index d4185f3204..c53568f98f 100644 --- a/tests/script/tsim/compute/sum.sim +++ b/tests/script/tsim/compute/sum.sim @@ -153,9 +153,9 @@ print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select sum(tbcol) as b from $mt where ts <= $ms group by tgcol -print select sum(tbcol) as b from $mt where ts <= $ms group by tgcol -print ===> $data00 +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 partition by tgcol interval(1d) +print ===> $data00 $rows if $data00 != 10 then return -1 endi diff --git a/tests/script/tsim/field/2.sim b/tests/script/tsim/field/2.sim index b5c501ceed..3161f02097 100644 --- a/tests/script/tsim/field/2.sim +++ b/tests/script/tsim/field/2.sim @@ -278,9 +278,9 @@ if $data00 != 25 then endi print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 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 select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/3.sim b/tests/script/tsim/field/3.sim index 661bc6a85a..72b65c7406 100644 --- a/tests/script/tsim/field/3.sim +++ b/tests/script/tsim/field/3.sim @@ -491,19 +491,19 @@ if $data00 != 25 then endi 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/4.sim b/tests/script/tsim/field/4.sim index 734179c5bb..d37c05173c 100644 --- a/tests/script/tsim/field/4.sim +++ b/tests/script/tsim/field/4.sim @@ -675,25 +675,25 @@ if $data00 != 25 then endi 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/5.sim b/tests/script/tsim/field/5.sim index 5185d8556e..127dcd2683 100644 --- a/tests/script/tsim/field/5.sim +++ b/tests/script/tsim/field/5.sim @@ -792,31 +792,31 @@ endi 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/6.sim b/tests/script/tsim/field/6.sim index 8ceefae228..474582fcae 100644 --- a/tests/script/tsim/field/6.sim +++ b/tests/script/tsim/field/6.sim @@ -941,37 +941,37 @@ if $data00 != 25 then endi 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 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 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/bigint.sim b/tests/script/tsim/field/bigint.sim index c580a4df1c..d9401ed88f 100644 --- a/tests/script/tsim/field/bigint.sim +++ b/tests/script/tsim/field/bigint.sim @@ -143,7 +143,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/bool.sim b/tests/script/tsim/field/bool.sim index 90bb4e7c3d..04cd48ab2d 100644 --- a/tests/script/tsim/field/bool.sim +++ b/tests/script/tsim/field/bool.sim @@ -141,8 +141,8 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol order by tgcol desc -print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true 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 partition by tgcol interval(1d) order by tgcol desc print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/double.sim b/tests/script/tsim/field/double.sim index e7b1c8e8af..c7b26add65 100644 --- a/tests/script/tsim/field/double.sim +++ b/tests/script/tsim/field/double.sim @@ -141,7 +141,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/float.sim b/tests/script/tsim/field/float.sim index 159a4b60ab..1e11eed3be 100644 --- a/tests/script/tsim/field/float.sim +++ b/tests/script/tsim/field/float.sim @@ -142,7 +142,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/int.sim b/tests/script/tsim/field/int.sim index 2b5b70141a..484272631b 100644 --- a/tests/script/tsim/field/int.sim +++ b/tests/script/tsim/field/int.sim @@ -142,7 +142,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/smallint.sim b/tests/script/tsim/field/smallint.sim index 975f02bf9b..326186f6c2 100644 --- a/tests/script/tsim/field/smallint.sim +++ b/tests/script/tsim/field/smallint.sim @@ -142,7 +142,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/tinyint.sim b/tests/script/tsim/field/tinyint.sim index ff24e484a7..cba4ac504d 100644 --- a/tests/script/tsim/field/tinyint.sim +++ b/tests/script/tsim/field/tinyint.sim @@ -142,7 +142,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 diff --git a/tests/script/tsim/field/unsigined_bigint.sim b/tests/script/tsim/field/unsigined_bigint.sim index d8421e7626..0a492ae44c 100644 --- a/tests/script/tsim/field/unsigined_bigint.sim +++ b/tests/script/tsim/field/unsigined_bigint.sim @@ -147,7 +147,7 @@ if $data00 != 25 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 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 if $data00 != 100 then return -1 From a8569fc44ba0283b6514ffbd77460d9f847d1be3 Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Wed, 13 Jul 2022 20:04:11 +0800 Subject: [PATCH 63/92] Delete tmqUpdate1.py test: del nouse script --- tests/system-test/7-tmq/tmqUpdate1.py | 175 -------------------------- 1 file changed, 175 deletions(-) delete mode 100644 tests/system-test/7-tmq/tmqUpdate1.py diff --git a/tests/system-test/7-tmq/tmqUpdate1.py b/tests/system-test/7-tmq/tmqUpdate1.py deleted file mode 100644 index 5f11090385..0000000000 --- a/tests/system-test/7-tmq/tmqUpdate1.py +++ /dev/null @@ -1,175 +0,0 @@ - -import taos -import sys -import time -import socket -import os -import threading -from enum import Enum - -from util.log import * -from util.sql import * -from util.cases import * -from util.dnodes import * -sys.path.append("./7-tmq") -from tmqCommon import * - -class TDTestCase: - def __init__(self): - self.vgroups = 4 - self.ctbNum = 1000 - self.rowsPerTbl = 1000 - - def init(self, conn, logSql): - tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor(), False) - - def prepareTestEnv(self): - tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") - paraDict = {'dbName': 'dbt', - 'dropFlag': 1, - 'event': '', - 'vgroups': 4, - 'stbName': 'stb', - 'colPrefix': 'c', - 'tagPrefix': 't', - 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], - 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], - 'ctbPrefix': 'ctb', - 'ctbStartIdx': 0, - 'ctbNum': 1000, - 'rowsPerTbl': 1000, - 'batchNum': 400, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 3, - 'showMsg': 1, - 'showRow': 1, - 'snapshot': 0} - - paraDict['vgroups'] = self.vgroups - paraDict['ctbNum'] = self.ctbNum - paraDict['rowsPerTbl'] = self.rowsPerTbl - - tmqCom.initConsumerTable() - tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) - tdLog.info("create stb") - tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) - tdLog.info("create ctb") - tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], - ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) - tdLog.info("insert data") - paraDict['ctbNum'] = int(self.ctbNum / 2) - tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - - # tdLog.info("restart taosd to ensure that the data falls into the disk") - # tdSql.query("flush database %s"%(paraDict['dbName'])) - return - - def tmqCase1(self): - tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'dbt', - 'dropFlag': 1, - 'event': '', - 'vgroups': 4, - 'stbName': 'stb', - 'colPrefix': 'c', - 'tagPrefix': 't', - 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], - 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], - 'ctbPrefix': 'ctb', - 'ctbStartIdx': 0, - 'ctbNum': 1000, - 'rowsPerTbl': 1000, - 'batchNum': 1000, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, - 'showMsg': 1, - 'showRow': 1, - 'snapshot': 1} - - paraDict['vgroups'] = self.vgroups - paraDict['ctbNum'] = self.ctbNum - paraDict['rowsPerTbl'] = self.rowsPerTbl - - tdLog.info("restart taosd to ensure that the data falls into the disk") - tdSql.query("flush database %s"%(paraDict['dbName'])) - - # update to half tables - paraDict['ctbNum'] = int(self.ctbNum / 4) - tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+paraDict['ctbNum']) - tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+paraDict['ctbNum']) - - tmqCom.initConsumerTable() - tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' - queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) - sqlString = "create topic %s as %s" %(topicFromStb1, queryString) - tdLog.info("create topic sql: %s"%sqlString) - tdSql.execute(sqlString) - - paraDict['ctbNum'] = self.ctbNum - consumerId = 0 - expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1) - topicList = topicFromStb1 - ifcheckdata = 0 - ifManualCommit = 0 - keyList = 'group.id:cgrp1,\ - enable.auto.commit:true,\ - auto.commit.interval.ms:1000,\ - auto.offset.reset:earliest' - tmqCom.insertConsumerInfo(consumerId, expectrowcnt + paraDict["rowsPerTbl"] * paraDict["ctbNum"],topicList,keyList,ifcheckdata,ifManualCommit) - - tdLog.info("start consume processor") - tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) - - paraDict['ctbNum'] = int(self.ctbNum / 2) - paraDict['ctbStartIdx'] += paraDict['ctbNum'] - _ = tmqCom.asyncInsertDataByInterlace(paraDict) - time.sleep(3) - pthread = tmqCom.asyncInsertDataByInterlace(paraDict) - pthread.join() - - tdLog.info("insert process end, and start to check consume result") - expectRows = 1 - resultList = tmqCom.selectConsumeResult(expectRows) - totalConsumeRows = 0 - for i in range(expectRows): - totalConsumeRows += resultList[i] - - tdSql.query(queryString) - totalRowsInserted = tdSql.getRows() - - tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) - - if totalConsumeRows <= totalRowsInserted or totalConsumeRows != expectrowcnt: - tdLog.exit("tmq consume rows error!") - - tdSql.query("drop topic %s"%topicFromStb1) - - tdLog.printNoPrefix("======== test case 1 end ...... ") - - - def run(self): - tdSql.prepare() - self.prepareTestEnv() - self.tmqCase1() - # self.tmqCase2() - - - def stop(self): - tdSql.close() - tdLog.success(f"{__file__} successfully executed") - -event = threading.Event() - -tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) From 88d1d8fad21771ace5f654d2979e0f248bc2a3cd Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 13 Jul 2022 20:21:13 +0800 Subject: [PATCH 64/92] test:add test case of tsbs query --- tests/system-test/2-query/tsbsQuery.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index 63f243baa0..8180f511e2 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -76,9 +76,19 @@ class TDTestCase: tdSql.query("insert into testsnode(ts,c1,c2,c3,c4) SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") - # test interval fill - tdSql.query("SELECT name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0) ;") + # test paitition interval fill + # tdSql.query("SELECT name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0) ;") + + # # test partition interval limit + # tdSql.query("SELECT ts,model,floor(2*(sum(nzs)/count(nzs)))/floor(2*(sum(nzs)/count(nzs))) AS broken_down FROM (SELECT ts,model, status/status AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model,ts interval(10m) limit 10;") + # tdSql.checkRows(10) + + # test partition interval Pseudo time-column + tdSql.query("SELECT count(ms1)/144 FROM (SELECT _wstartts as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;") + + + # test def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdLog.printNoPrefix("==========step1:create database and table,insert data ==============") self.prepareData() From 26c5ac3e844090d30ad32f5eb7860fbf019d560d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 20:23:33 +0800 Subject: [PATCH 65/92] test: restore some 2.0 case --- tests/script/general/vector/testSuite.sim | 11 -------- tests/script/jenkins/basic.txt | 13 ++++++++++ .../vector/metrics_field.sim | 20 +++----------- .../{general => tsim}/vector/metrics_mix.sim | 18 +++---------- .../vector/metrics_query.sim | 20 +++----------- .../{general => tsim}/vector/metrics_tag.sim | 18 +++---------- .../{general => tsim}/vector/metrics_time.sim | 18 +++---------- .../script/{general => tsim}/vector/multi.sim | 26 +++++-------------- .../{general => tsim}/vector/single.sim | 14 +++------- .../{general => tsim}/vector/table_field.sim | 18 +++---------- .../{general => tsim}/vector/table_mix.sim | 18 +++---------- .../{general => tsim}/vector/table_query.sim | 18 +++---------- .../{general => tsim}/vector/table_time.sim | 18 +++---------- 13 files changed, 58 insertions(+), 172 deletions(-) delete mode 100644 tests/script/general/vector/testSuite.sim rename tests/script/{general => tsim}/vector/metrics_field.sim (97%) rename tests/script/{general => tsim}/vector/metrics_mix.sim (98%) rename tests/script/{general => tsim}/vector/metrics_query.sim (97%) rename tests/script/{general => tsim}/vector/metrics_tag.sim (97%) rename tests/script/{general => tsim}/vector/metrics_time.sim (98%) rename tests/script/{general => tsim}/vector/multi.sim (90%) rename tests/script/{general => tsim}/vector/single.sim (96%) rename tests/script/{general => tsim}/vector/table_field.sim (97%) rename tests/script/{general => tsim}/vector/table_mix.sim (98%) rename tests/script/{general => tsim}/vector/table_query.sim (97%) rename tests/script/{general => tsim}/vector/table_time.sim (97%) diff --git a/tests/script/general/vector/testSuite.sim b/tests/script/general/vector/testSuite.sim deleted file mode 100644 index f0b9fef991..0000000000 --- a/tests/script/general/vector/testSuite.sim +++ /dev/null @@ -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 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 59536f2ef6..5f87b8a55f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -262,4 +262,17 @@ ./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 + #======================b1-end=============== diff --git a/tests/script/general/vector/metrics_field.sim b/tests/script/tsim/vector/metrics_field.sim similarity index 97% rename from tests/script/general/vector/metrics_field.sim rename to tests/script/tsim/vector/metrics_field.sim index 2719805c63..4d0f9e19fc 100644 --- a/tests/script/general/vector/metrics_field.sim +++ b/tests/script/tsim/vector/metrics_field.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mf_db @@ -99,17 +95,9 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $mt where a = 5 -x step21 - return -1 -step21: - -sql select h - f from $mt where a = 5 -x step22 - return -1 -step22: - -sql select ts - f from $mt where a = 5 -x step23 - return -1 -step23: +sql select g - f from $mt where a = 5 +sql select h - f from $mt where a = 5 +sql select ts - f from $mt where a = 5 sql select a - e from $mt where a = 5 print ===> $data00 @@ -616,7 +604,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/metrics_mix.sim b/tests/script/tsim/vector/metrics_mix.sim similarity index 98% rename from tests/script/general/vector/metrics_mix.sim rename to tests/script/tsim/vector/metrics_mix.sim index 7c9bb3b668..fd36a62332 100644 --- a/tests/script/general/vector/metrics_mix.sim +++ b/tests/script/tsim/vector/metrics_mix.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mx_db @@ -99,17 +95,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: +sql select g - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -sql select h - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: +sql select h - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -sql select ts - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: +sql select ts - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m sql select a - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m print ===> $data00 @@ -616,7 +606,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/metrics_query.sim b/tests/script/tsim/vector/metrics_query.sim similarity index 97% rename from tests/script/general/vector/metrics_query.sim rename to tests/script/tsim/vector/metrics_query.sim index fd635a3104..8a334acef2 100644 --- a/tests/script/general/vector/metrics_query.sim +++ b/tests/script/tsim/vector/metrics_query.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mq_db @@ -95,17 +91,9 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $mt -x step21 - return -1 -step21: - -sql select h - f from $mt -x step22 - return -1 -step22: - -sql select ts - f from $mt -x step23 - return -1 -step23: +sql select g - f from $mt +sql select h - f from $mt +sql select ts - f from $mt sql select a - e from $mt print ===> $data00 @@ -612,7 +600,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/metrics_tag.sim b/tests/script/tsim/vector/metrics_tag.sim similarity index 97% rename from tests/script/general/vector/metrics_tag.sim rename to tests/script/tsim/vector/metrics_tag.sim index 1d412d35d3..0b275336f9 100644 --- a/tests/script/general/vector/metrics_tag.sim +++ b/tests/script/tsim/vector/metrics_tag.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mtg_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $mt where tgcol = 5 -x step21 - return -1 -step21: +sql select g - f from $mt where tgcol = 5 -sql select h - f from $mt where tgcol = 5 -x step22 - return -1 -step22: +sql select h - f from $mt where tgcol = 5 -sql select ts - f from $mt where tgcol = 5 -x step23 - return -1 -step23: +sql select ts - f from $mt where tgcol = 5 sql select a - e from $mt where tgcol = 5 print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/metrics_time.sim b/tests/script/tsim/vector/metrics_time.sim similarity index 98% rename from tests/script/general/vector/metrics_time.sim rename to tests/script/tsim/vector/metrics_time.sim index d0152439bf..bcd93cb582 100644 --- a/tests/script/general/vector/metrics_time.sim +++ b/tests/script/tsim/vector/metrics_time.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mt_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: +sql select g - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -sql select h - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: +sql select h - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -sql select ts - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: +sql select ts - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m sql select a - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/multi.sim b/tests/script/tsim/vector/multi.sim similarity index 90% rename from tests/script/general/vector/multi.sim rename to tests/script/tsim/vector/multi.sim index 1101b0b0db..dcedbe73c9 100644 --- a/tests/script/general/vector/multi.sim +++ b/tests/script/tsim/vector/multi.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_mu_db @@ -71,9 +67,7 @@ sql select a + a from $tb where ts > now + 4m order by ts desc sql select a + c from $tb where ts < now + 4m order by ts asc -sql select a + f from $tb where ts > now + 4m order by ts asc -x step24 - return -1 -step24: +sql select a + f from $tb where ts > now + 4m order by ts asc print =============== step3 $i = 1 @@ -150,17 +144,11 @@ endi print =============== step6 $i = 1 $tb = $tbPrefix . $i -sql select a + ts from $tb -x step61 - return -1 -step61: +sql select a + ts from $tb -sql select a + f from $tb -x step62 - return -1 -step62: +sql select a + f from $tb -sql select a + g from $tb -x step63 - return -1 -step63: +sql select a + g from $tb print =============== step7 $i = 1 @@ -202,14 +190,12 @@ sql select a + a from $tb where e = 2 and ts > now + 4m order by ts desc sql select a + c from $tb where f = 2 and ts < now + 4m order by ts asc -sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step74 - return -1 -step74: +sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/single.sim b/tests/script/tsim/vector/single.sim similarity index 96% rename from tests/script/general/vector/single.sim rename to tests/script/tsim/vector/single.sim index e979a0ffb7..c9d794456c 100644 --- a/tests/script/general/vector/single.sim +++ b/tests/script/tsim/vector/single.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_si_db @@ -150,9 +146,7 @@ $i = 11 $tb = $tbPrefix . $i sql create table $tb (ts timestamp, tbcol bool) sql insert into $tb values(now, 0) -sql select tbcol + 2 from $tb -x step6 - return -1 -step6: +sql select tbcol + 2 from $tb print =============== step7 $i = $i + 1 @@ -289,14 +283,12 @@ $i = $i + 1 $tb = $tbPrefix . $i sql create table $tb (ts timestamp, tbcol binary(100)) sql insert into $tb values(now, '0'); -sql select tbcol + 2 from $tb -x step12 - return -1 -step12: +sql select tbcol + 2 from $tb print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/table_field.sim b/tests/script/tsim/vector/table_field.sim similarity index 97% rename from tests/script/general/vector/table_field.sim rename to tests/script/tsim/vector/table_field.sim index d86eb99331..5ad60b2a35 100644 --- a/tests/script/general/vector/table_field.sim +++ b/tests/script/tsim/vector/table_field.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_tf_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $tb where a = 5 -x step21 - return -1 -step21: +sql select g - f from $tb where a = 5 -sql select h - f from $tb where a = 5 -x step22 - return -1 -step22: +sql select h - f from $tb where a = 5 -sql select ts - f from $tb where a = 5 -x step23 - return -1 -step23: +sql select ts - f from $tb where a = 5 sql select a - e from $tb where a = 5 print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/table_mix.sim b/tests/script/tsim/vector/table_mix.sim similarity index 98% rename from tests/script/general/vector/table_mix.sim rename to tests/script/tsim/vector/table_mix.sim index 5c4fb52888..358d6cf87f 100644 --- a/tests/script/general/vector/table_mix.sim +++ b/tests/script/tsim/vector/table_mix.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_tm_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: +sql select g - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -sql select h - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: +sql select h - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -sql select ts - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: +sql select ts - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m sql select a - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/table_query.sim b/tests/script/tsim/vector/table_query.sim similarity index 97% rename from tests/script/general/vector/table_query.sim rename to tests/script/tsim/vector/table_query.sim index 9ef18255a9..0e4562716e 100644 --- a/tests/script/general/vector/table_query.sim +++ b/tests/script/tsim/vector/table_query.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_tq_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $tb -x step21 - return -1 -step21: +sql select g - f from $tb -sql select h - f from $tb -x step22 - return -1 -step22: +sql select h - f from $tb -sql select ts - f from $tb -x step23 - return -1 -step23: +sql select ts - f from $tb sql select a - e from $tb print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/vector/table_time.sim b/tests/script/tsim/vector/table_time.sim similarity index 97% rename from tests/script/general/vector/table_time.sim rename to tests/script/tsim/vector/table_time.sim index c38546b117..1e6bdb2cde 100644 --- a/tests/script/general/vector/table_time.sim +++ b/tests/script/tsim/vector/table_time.sim @@ -1,10 +1,6 @@ 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 $dbPrefix = m_tt_db @@ -95,17 +91,11 @@ if $data00 != 0.000000000 then return -1 endi -sql select g - f from $tb where ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: +sql select g - f from $tb where ts > now + 4m and ts < now + 6m -sql select h - f from $tb where ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: +sql select h - f from $tb where ts > now + 4m and ts < now + 6m -sql select ts - f from $tb where ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: +sql select ts - f from $tb where ts > now + 4m and ts < now + 6m sql select a - e from $tb where ts > now + 4m and ts < now + 6m print ===> $data00 @@ -612,7 +602,7 @@ step63: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi From ad051d4e65962ac1bb670210d0c0a9b99bbae88f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Jul 2022 20:25:16 +0800 Subject: [PATCH 66/92] fix: fix stop query issue --- source/client/inc/clientInt.h | 1 + source/client/src/clientImpl.c | 3 ++- source/client/src/clientMain.c | 47 +++++++++++++++++----------------- tests/script/api/stopquery.c | 9 ++++--- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 700a4d9daf..367e656f06 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -181,6 +181,7 @@ typedef struct SRequestSendRecvBody { tsem_t rspSem; // not used now __taos_async_fn_t queryFp; __taos_async_fn_t fetchFp; + EQueryExecMode execMode; void* param; SDataBuf requestMsg; int64_t queryJob; // query job, created according to sql query DAG. diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d923929c95..d846cb93af 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -933,6 +933,8 @@ SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool vali void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta) { int32_t code = 0; + pRequest->body.execMode = pQuery->execMode; + switch (pQuery->execMode) { case QUERY_EXEC_MODE_LOCAL: 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); if (pRequest == NULL) { destroyTscObj(pTscObj); - terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; return NULL; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 73def5b9b1..14a431feab 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -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. 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) { return; } @@ -58,7 +58,10 @@ void taos_cleanup(void) { clientReqRefPool = -1; taosCloseRef(id); - cleanupTaskQueue(); + hbMgrCleanUp(); + + catalogDestroy(); + schedulerDestroy(); fmFuncMgtDestroy(); qCleanupKeywordsTable(); @@ -67,12 +70,11 @@ void taos_cleanup(void) { clientConnRefPool = -1; taosCloseRef(id); - hbMgrCleanUp(); - - catalogDestroy(); - schedulerDestroy(); - rpcCleanup(); + tscDebug("rpc cleanup"); + + cleanupTaskQueue(); + tscInfo("all local resources released"); taosCleanupCfg(); 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 - if (pResultInfo->completed && (pRequest->body.queryJob != 0)) { - pResultInfo->numOfRows = 0; + if (pResultInfo->completed) { + // 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); 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 = { .syncReq = false, .fetchFp = fetchCallback, diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index 92baf43d85..082d987a22 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -633,6 +633,7 @@ int sqConCleanupSyncQuery(bool fetch) { pthread_join(qid, NULL); pthread_join(cid, NULL); + break; } CASE_LEAVE(); } @@ -648,6 +649,7 @@ int sqConCleanupAsyncQuery(bool fetch) { pthread_join(qid, NULL); pthread_join(cid, NULL); + break; } CASE_LEAVE(); } @@ -655,7 +657,7 @@ int sqConCleanupAsyncQuery(bool fetch) { void sqRunAllCase(void) { -#if 0 +#if 1 sqStopSyncQuery(false); sqStopSyncQuery(true); sqStopAsyncQuery(false); @@ -688,16 +690,17 @@ void sqRunAllCase(void) { sqConKillAsyncQuery(true); #endif + /* sqConCleanupSyncQuery(false); sqConCleanupSyncQuery(true); sqConCleanupAsyncQuery(false); sqConCleanupAsyncQuery(true); - + */ int32_t l = 5; while (l) { printf("%d\n", l--); - sleep(1000); + sleep(1); } } From 56ec0a3920dc66f005d381e7dabc90f347747ac2 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 20:42:49 +0800 Subject: [PATCH 67/92] fix: json null --- source/client/src/tmq.c | 11 ++++++++--- source/libs/parser/src/parTranslater.c | 3 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 2741ea0670..ad47348c22 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -2269,7 +2269,12 @@ static char *processAlterTable(SMqMetaRsp *metaRsp){ cJSON* tagName = cJSON_CreateString(vAlterTbReq.tagName); cJSON_AddItemToObject(json, "colName", tagName); - if (!vAlterTbReq.isNull){ + bool isNull = vAlterTbReq.isNull; + if(vAlterTbReq.tagType == TSDB_DATA_TYPE_JSON){ + STag *jsonTag = (STag *)vAlterTbReq.pTagVal; + if(jsonTag->nTag == 0) isNull = true; + } + if (!isNull){ char* buf = NULL; if (vAlterTbReq.tagType == TSDB_DATA_TYPE_JSON) { @@ -2285,8 +2290,8 @@ static char *processAlterTable(SMqMetaRsp *metaRsp){ taosMemoryFree(buf); } - cJSON* isNull = cJSON_CreateBool(vAlterTbReq.isNull); - cJSON_AddItemToObject(json, "colValueNull", isNull); + cJSON* isNullCJson = cJSON_CreateBool(isNull); + cJSON_AddItemToObject(json, "colValueNull", isNullCJson); break; } default: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6654bc26cd..a8fbc8d7ab 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5872,9 +5872,6 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS if (code != TSDB_CODE_SUCCESS) { return code; } - if(pTag->nTag == 0){ - pReq->isNull = true; - } pReq->nTagVal = pTag->len; pReq->pTagVal = (uint8_t*)pTag; pStmt->pVal->datum.p = (char*)pTag; // for free From 176379dfab513a920451f54beab4af6a002425d4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 20:44:32 +0800 Subject: [PATCH 68/92] test: restore some 2.0 case --- tests/script/general/wal/maxtables.sim | 46 ------ tests/script/general/wal/sync.sim | 146 -------------------- tests/script/jenkins/basic.txt | 3 + tests/script/{general => tsim}/wal/kill.sim | 25 +--- 4 files changed, 10 insertions(+), 210 deletions(-) delete mode 100644 tests/script/general/wal/maxtables.sim delete mode 100644 tests/script/general/wal/sync.sim rename tests/script/{general => tsim}/wal/kill.sim (73%) diff --git a/tests/script/general/wal/maxtables.sim b/tests/script/general/wal/maxtables.sim deleted file mode 100644 index acd6af1d1a..0000000000 --- a/tests/script/general/wal/maxtables.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/wal/sync.sim b/tests/script/general/wal/sync.sim deleted file mode 100644 index 3a89523918..0000000000 --- a/tests/script/general/wal/sync.sim +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 5f87b8a55f..c88b5e2b78 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -275,4 +275,7 @@ ./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=============== diff --git a/tests/script/general/wal/kill.sim b/tests/script/tsim/wal/kill.sim similarity index 73% rename from tests/script/general/wal/kill.sim rename to tests/script/tsim/wal/kill.sim index 94a35b636e..f8a732f59f 100644 --- a/tests/script/general/wal/kill.sim +++ b/tests/script/tsim/wal/kill.sim @@ -2,8 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 print ============== deploy -system sh/exec.sh -n dnode1 -s start -sleep 3001 +system sh/exec.sh -n dnode1 -s start ] sql connect sql create database d1 @@ -13,65 +12,55 @@ sql create table t1 (ts timestamp, i int) sql insert into t1 values(now, 1); print =============== step3 -sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 2000 print =============== step4 -system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 2000 +system sh/exec.sh -n dnode1 -s start sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 2000 print =============== step5 -system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 2000 +system sh/exec.sh -n dnode1 -s start sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 2000 print =============== step6 -system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 2000 +system sh/exec.sh -n dnode1 -s start sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 2000 print =============== step7 -system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 2000 +system sh/exec.sh -n dnode1 -s start sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 2000 print =============== step8 -system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 2000 +system sh/exec.sh -n dnode1 -s start sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi + system sh/exec.sh -n dnode1 -s stop -x SIGKILL From f7ea72b0a633d34bab06e56137ecff4fcc8ec7cd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 20:47:31 +0800 Subject: [PATCH 69/92] test: restore some 2.0 case --- tests/script/general/stream/agg_stream.sim | 316 ------------------ tests/script/general/stream/column_stream.sim | 200 ----------- tests/script/general/stream/metrics_del.sim | 95 ------ .../stream/metrics_replica1_vnoden.sim | 245 -------------- .../script/general/stream/restart_stream.sim | 176 ---------- tests/script/general/stream/stream_1970.sim | 73 ---- tests/script/general/stream/stream_3.sim | 201 ----------- .../script/general/stream/stream_restart.sim | 142 -------- tests/script/general/stream/table_del.sim | 90 ----- .../general/stream/table_replica1_vnoden.sim | 299 ----------------- tests/script/general/stream/testSuite.sim | 6 - 11 files changed, 1843 deletions(-) delete mode 100644 tests/script/general/stream/agg_stream.sim delete mode 100644 tests/script/general/stream/column_stream.sim delete mode 100644 tests/script/general/stream/metrics_del.sim delete mode 100644 tests/script/general/stream/metrics_replica1_vnoden.sim delete mode 100644 tests/script/general/stream/restart_stream.sim delete mode 100644 tests/script/general/stream/stream_1970.sim delete mode 100644 tests/script/general/stream/stream_3.sim delete mode 100644 tests/script/general/stream/stream_restart.sim delete mode 100644 tests/script/general/stream/table_del.sim delete mode 100644 tests/script/general/stream/table_replica1_vnoden.sim delete mode 100644 tests/script/general/stream/testSuite.sim diff --git a/tests/script/general/stream/agg_stream.sim b/tests/script/general/stream/agg_stream.sim deleted file mode 100644 index 548f59cab7..0000000000 --- a/tests/script/general/stream/agg_stream.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/stream/column_stream.sim b/tests/script/general/stream/column_stream.sim deleted file mode 100644 index 59a65f0969..0000000000 --- a/tests/script/general/stream/column_stream.sim +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tests/script/general/stream/metrics_del.sim b/tests/script/general/stream/metrics_del.sim deleted file mode 100644 index 6cc3da71e9..0000000000 --- a/tests/script/general/stream/metrics_del.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/stream/metrics_replica1_vnoden.sim b/tests/script/general/stream/metrics_replica1_vnoden.sim deleted file mode 100644 index db1044a597..0000000000 --- a/tests/script/general/stream/metrics_replica1_vnoden.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/stream/restart_stream.sim b/tests/script/general/stream/restart_stream.sim deleted file mode 100644 index 62e47f9b3a..0000000000 --- a/tests/script/general/stream/restart_stream.sim +++ /dev/null @@ -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 - - diff --git a/tests/script/general/stream/stream_1970.sim b/tests/script/general/stream/stream_1970.sim deleted file mode 100644 index 30a733c08f..0000000000 --- a/tests/script/general/stream/stream_1970.sim +++ /dev/null @@ -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 - diff --git a/tests/script/general/stream/stream_3.sim b/tests/script/general/stream/stream_3.sim deleted file mode 100644 index b043993814..0000000000 --- a/tests/script/general/stream/stream_3.sim +++ /dev/null @@ -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 - - diff --git a/tests/script/general/stream/stream_restart.sim b/tests/script/general/stream/stream_restart.sim deleted file mode 100644 index 54a60a0081..0000000000 --- a/tests/script/general/stream/stream_restart.sim +++ /dev/null @@ -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 - - diff --git a/tests/script/general/stream/table_del.sim b/tests/script/general/stream/table_del.sim deleted file mode 100644 index 34673605d6..0000000000 --- a/tests/script/general/stream/table_del.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim deleted file mode 100644 index 4a6c4fe046..0000000000 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ /dev/null @@ -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 diff --git a/tests/script/general/stream/testSuite.sim b/tests/script/general/stream/testSuite.sim deleted file mode 100644 index 4a9912b848..0000000000 --- a/tests/script/general/stream/testSuite.sim +++ /dev/null @@ -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 \ No newline at end of file From d40191b62c9daaefc6e98d1b8c1a11ffdec66b23 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 20:58:14 +0800 Subject: [PATCH 70/92] fix(query): prepare the buffer before loading data. --- source/libs/executor/src/scanoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8786d30007..ba89592189 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2593,7 +2593,7 @@ static SSDataBlock* getTableDataBlock(void* param) { SDataBlockInfo binfo = pBlock->info; tsdbRetrieveDataBlockInfo(reader, &binfo); - blockDataEnsureCapacity(pBlock, binfo.capacity); + blockDataEnsureCapacity(pBlock, binfo.rows); pBlock->info.type = binfo.type; pBlock->info.uid = binfo.uid; pBlock->info.window = binfo.window; From 2647a3d9eeb3a12dcb10ca3d3fb2043c94d21047 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 13 Jul 2022 21:00:54 +0800 Subject: [PATCH 71/92] fix: json null --- source/libs/parser/src/parTranslater.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a8fbc8d7ab..87a5258774 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5846,7 +5846,6 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS return pCxt->errCode; } - pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type); pReq->tagType = targetDt.type; if (targetDt.type == TSDB_DATA_TYPE_JSON) { if (pStmt->pVal->literal && @@ -5876,6 +5875,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS pReq->pTagVal = (uint8_t*)pTag; pStmt->pVal->datum.p = (char*)pTag; // for free } else { + pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type); pReq->nTagVal = pStmt->pVal->node.resType.bytes; pReq->pTagVal = nodesGetValueFromNode(pStmt->pVal); From 083de75afcd1fd0a35ee16218374d65f97b53254 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 23:15:58 +0800 Subject: [PATCH 72/92] fix(query):fix memory leak. --- source/common/src/tdatablock.c | 2 -- source/dnode/vnode/src/tsdb/tsdbRead.c | 25 ++++++++++++++++++------- source/libs/executor/src/executorimpl.c | 19 ++++++++++++++++--- source/libs/executor/src/scanoperator.c | 6 ------ source/libs/function/src/builtinsimpl.c | 12 ++++++++++-- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 9b65e08d29..f51023189d 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1174,8 +1174,6 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows) int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) { int32_t code = 0; - // ASSERT(numOfRows > 0); - if (numOfRows == 0) { return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index e86a14a30f..4aaa80d3ae 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -234,6 +234,7 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) { } taosArrayDestroy(p->delSkyline); + taosArrayDestroy(p->pBlockList); p->delSkyline = NULL; } @@ -302,9 +303,9 @@ static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) { STimeWindow win = {0}; while (1) { -// if (pReader->pFileReader != NULL) { -// tsdbDataFReaderClose(&pReader->pFileReader); -// } + if (pReader->pFileReader != NULL) { + tsdbDataFReaderClose(&pReader->pFileReader); + } 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); if (p == NULL) { + tMapDataClear(&mapData); return TSDB_CODE_OUT_OF_MEMORY; } (*numOfBlocks) += 1; } + tMapDataClear(&mapData); if (pScanInfo->pBlockList != NULL && taosArrayGetSize(pScanInfo->pBlockList) > 0) { (*numOfValidTables) += 1; } @@ -1308,6 +1311,8 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte pReader->idStr); pBlockIter->index = asc ? 0 : (numOfBlocks - 1); + + cleanupBlockOrderSupporter(&sup); return TSDB_CODE_SUCCESS; } @@ -1990,6 +1995,7 @@ static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pRead static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) { SReaderStatus* pStatus = &pReader->status; + SArray* pIndexList = taosArrayInit(4, sizeof(SBlockIdx)); while (1) { bool hasNext = filesetIteratorNext(&pStatus->fileIter, pReader); @@ -1997,9 +2003,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) { break; } - SArray* pIndexList = taosArrayInit(4, sizeof(SBlockIdx)); + taosArrayClear(pIndexList); int32_t code = doLoadBlockIndex(pReader, pReader->pFileReader, pIndexList); if (code != TSDB_CODE_SUCCESS) { + taosArrayDestroy(pIndexList); return code; } @@ -2007,6 +2014,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) { uint32_t numOfValidTable = 0; code = doLoadFileBlock(pReader, pIndexList, &numOfValidTable, numOfBlocks); if (code != TSDB_CODE_SUCCESS) { + taosArrayDestroy(pIndexList); return code; } @@ -2014,10 +2022,10 @@ static int32_t moveToNextFile(STsdbReader* pReader, int32_t* numOfBlocks) { break; } } - // no blocks in current file, try next files } + taosArrayDestroy(pIndexList); return TSDB_CODE_SUCCESS; } @@ -3081,10 +3089,13 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa SDataBlockIter* pBlockIter = &pStatus->blockIter; pTableBlockInfo->numOfFiles += pStatus->fileIter.numOfFiles; - pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks; + + if (pBlockIter->numOfBlocks > 0) { + pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks; + } pTableBlockInfo->numOfTables = numOfTables; - bool hasNext = true; + bool hasNext = (pBlockIter->numOfBlocks > 0); while (true) { if (hasNext) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 760d7e55c8..4e69caae0c 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3475,10 +3475,13 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) { static void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) { for (int32_t i = 0; i < numOfExprs; ++i) { SExprInfo* pExprInfo = &pExpr[i]; - if (pExprInfo->pExpr->nodeType == QUERY_NODE_COLUMN) { - taosMemoryFree(pExprInfo->base.pParam[0].pCol); + for(int32_t j = 0; j < pExprInfo->base.numOfParams; ++j) { + 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); } } @@ -3685,10 +3688,20 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput) { taosMemoryFreeClear(param); } + +static void freeItem(void* pItem) { + void** p = pItem; + if (*p != NULL) { + taosMemoryFreeClear(*p); + } +} + void destroyAggOperatorInfo(void* param, int32_t numOfOutput) { SAggOperatorInfo* pInfo = (SAggOperatorInfo*)param; cleanupBasicInfo(&pInfo->binfo); + cleanupAggSup(&pInfo->aggSup); + taosArrayDestroyEx(pInfo->groupResInfo.pRows, freeItem); taosMemoryFreeClear(param); } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c7112ab8a6..2098e515df 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -196,12 +196,6 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); 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; } else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) { pCost->loadBlockStatis += 1; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index c1143020f0..e622c0c1af 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -5559,6 +5559,10 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0); + if (pData->totalRows == 0) { + pData->minRows = 0; + } + int32_t row = 0; char st[256] = {0}; double totalRawSize = pData->totalRows * pData->rowSize; @@ -5570,10 +5574,14 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); + int64_t avgRows = 0; + if (pData->numOfBlocks > 0) { + avgRows = pData->totalRows / pData->numOfBlocks; + } + len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Rows=[%" PRId64 "] Inmem_Rows=[%d] MinRows=[%d] MaxRows=[%d] Average_Rows=[%" PRId64 "]", - pData->totalRows, pData->numOfInmemRows, pData->minRows, pData->maxRows, - pData->totalRows / pData->numOfBlocks); + pData->totalRows, pData->numOfInmemRows, pData->minRows, pData->maxRows, avgRows); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); From b2b69f18689ca8c86b1e4ad1ed65647d781eeb42 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 13 Jul 2022 23:42:59 +0800 Subject: [PATCH 73/92] fix(query):fix invalid write. --- source/libs/executor/src/executorimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 4e69caae0c..16f5e47efc 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3479,9 +3479,9 @@ static void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) { 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); } } From 414b27fb6a8901fce080c0e2c615c67f2602ea47 Mon Sep 17 00:00:00 2001 From: "slzhou@taodata.com" Date: Thu, 14 Jul 2022 09:19:36 +0800 Subject: [PATCH 74/92] fix: set primary key target slot id through searching scan cols and find colId that equals primary key id --- source/libs/executor/src/scanoperator.c | 14 +++++++++++--- source/libs/nodes/src/nodesCodeFuncs.c | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 64c740decf..5bdee36e7a 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2621,11 +2621,19 @@ static SSDataBlock* getTableDataBlock(void* param) { 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)); SBlockOrderInfo bi = {0}; bi.order = order; - bi.slotId = 0; + bi.slotId = tsTargetSlotId; bi.nullFirst = NULL_ORDER_FIRST; taosArrayPush(pList, &bi); @@ -2874,7 +2882,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN 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); int32_t rowSize = pInfo->pResBlock->info.rowSize; diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 3c285cc7f1..b6ebebd761 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -225,6 +225,8 @@ const char* nodesNodeName(ENodeType type) { return "PhysiBlockDistScan"; case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: return "PhysiLastRowScan"; + case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: + return "PhysiTableMergeScan"; case QUERY_NODE_PHYSICAL_PLAN_PROJECT: return "PhysiProject"; case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: From 9d13ee914841aefc8829893af33a518ac14aebb5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 10:20:30 +0800 Subject: [PATCH 75/92] test: restore some 2.0 case --- tests/script/general/rm_bak/tag/testSuite.sim | 25 ----------------- tests/script/jenkins/basic.txt | 28 +++++++++++++++++++ .../script/{general/rm_bak => tsim}/tag/3.sim | 17 +++++------ .../script/{general/rm_bak => tsim}/tag/4.sim | 8 +----- .../script/{general/rm_bak => tsim}/tag/5.sim | 8 +----- .../script/{general/rm_bak => tsim}/tag/6.sim | 8 +----- .../{general/rm_bak => tsim}/tag/add.sim | 6 +--- .../{general/rm_bak => tsim}/tag/bigint.sim | 7 +---- .../{general/rm_bak => tsim}/tag/binary.sim | 7 +---- .../rm_bak => tsim}/tag/binary_binary.sim | 7 +---- .../{general/rm_bak => tsim}/tag/bool.sim | 7 +---- .../rm_bak => tsim}/tag/bool_binary.sim | 7 +---- .../{general/rm_bak => tsim}/tag/bool_int.sim | 7 +---- .../{general/rm_bak => tsim}/tag/change.sim | 6 +--- .../{general/rm_bak => tsim}/tag/column.sim | 7 +---- .../{general/rm_bak => tsim}/tag/commit.sim | 6 +--- .../{general/rm_bak => tsim}/tag/create.sim | 5 ---- .../{general/rm_bak => tsim}/tag/delete.sim | 6 +--- .../{general/rm_bak => tsim}/tag/double.sim | 7 +---- .../{general/rm_bak => tsim}/tag/filter.sim | 4 +-- .../{general/rm_bak => tsim}/tag/float.sim | 7 +---- .../{general/rm_bak => tsim}/tag/int.sim | 7 +---- .../rm_bak => tsim}/tag/int_binary.sim | 7 +---- .../rm_bak => tsim}/tag/int_float.sim | 7 +---- .../{general/rm_bak => tsim}/tag/set.sim | 6 +--- .../{general/rm_bak => tsim}/tag/smallint.sim | 7 +---- .../{general/rm_bak => tsim}/tag/tinyint.sim | 7 +---- 27 files changed, 58 insertions(+), 173 deletions(-) delete mode 100644 tests/script/general/rm_bak/tag/testSuite.sim rename tests/script/{general/rm_bak => tsim}/tag/3.sim (97%) rename tests/script/{general/rm_bak => tsim}/tag/4.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/5.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/6.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/add.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/bigint.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/binary.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/binary_binary.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/bool.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/bool_binary.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/bool_int.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/change.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/column.sim (95%) rename tests/script/{general/rm_bak => tsim}/tag/commit.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/create.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/delete.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/double.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/filter.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/float.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/int.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/int_binary.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/int_float.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/set.sim (99%) rename tests/script/{general/rm_bak => tsim}/tag/smallint.sim (98%) rename tests/script/{general/rm_bak => tsim}/tag/tinyint.sim (98%) diff --git a/tests/script/general/rm_bak/tag/testSuite.sim b/tests/script/general/rm_bak/tag/testSuite.sim deleted file mode 100644 index 45356efac1..0000000000 --- a/tests/script/general/rm_bak/tag/testSuite.sim +++ /dev/null @@ -1,25 +0,0 @@ -run general/tag/3.sim -run general/tag/4.sim -run general/tag/5.sim -run general/tag/6.sim -run general/tag/add.sim -run general/tag/bigint.sim -run general/tag/binary_binary.sim -run general/tag/binary.sim -run general/tag/bool_binary.sim -run general/tag/bool_int.sim -run general/tag/bool.sim -run general/tag/change.sim -run general/tag/column.sim -run general/tag/commit.sim -run general/tag/create.sim -run general/tag/delete.sim -run general/tag/double.sim -run general/tag/filter.sim -run general/tag/float.sim -run general/tag/int_binary.sim -run general/tag/int_float.sim -run general/tag/int.sim -run general/tag/set.sim -run general/tag/smallint.sim -run general/tag/tinyint.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index dad4dbbe29..af0e338c9b 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -279,4 +279,32 @@ # ---- wal ./test.sh -f tsim/wal/kill.sim +# ---- tag +./test.sh -f tsim/tag/3.sim +./test.sh -f tsim/tag/4.sim +./test.sh -f tsim/tag/5.sim +./test.sh -f tsim/tag/6.sim +./test.sh -f tsim/tag/add.sim +./test.sh -f tsim/tag/bigint.sim +./test.sh -f tsim/tag/binary_binary.sim +./test.sh -f tsim/tag/binary.sim +./test.sh -f tsim/tag/bool_binary.sim +./test.sh -f tsim/tag/bool_int.sim +./test.sh -f tsim/tag/bool.sim +./test.sh -f tsim/tag/change.sim +./test.sh -f tsim/tag/column.sim +./test.sh -f tsim/tag/commit.sim +./test.sh -f tsim/tag/create.sim +./test.sh -f tsim/tag/delete.sim +./test.sh -f tsim/tag/double.sim +./test.sh -f tsim/tag/filter.sim +./test.sh -f tsim/tag/float.sim +./test.sh -f tsim/tag/int_binary.sim +./test.sh -f tsim/tag/int_float.sim +./test.sh -f tsim/tag/int.sim +./test.sh -f tsim/tag/set.sim +./test.sh -f tsim/tag/smallint.sim +./test.sh -f tsim/tag/tinyint.sim + + #======================b1-end=============== diff --git a/tests/script/general/rm_bak/tag/3.sim b/tests/script/tsim/tag/3.sim similarity index 97% rename from tests/script/general/rm_bak/tag/3.sim rename to tests/script/tsim/tag/3.sim index 20185f5f01..d816aec3e3 100644 --- a/tests/script/general/rm_bak/tag/3.sim +++ b/tests/script/tsim/tag/3.sim @@ -1,9 +1,6 @@ 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 @@ -494,28 +491,28 @@ if $data00 != 25 then endi print =============== step19 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/4.sim b/tests/script/tsim/tag/4.sim similarity index 99% rename from tests/script/general/rm_bak/tag/4.sim rename to tests/script/tsim/tag/4.sim index ee3c8efa6c..0bb1cde75d 100644 --- a/tests/script/general/rm_bak/tag/4.sim +++ b/tests/script/tsim/tag/4.sim @@ -1,13 +1,7 @@ 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 -sql reset query cache print ======================== dnode1 start @@ -708,7 +702,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/5.sim b/tests/script/tsim/tag/5.sim similarity index 99% rename from tests/script/general/rm_bak/tag/5.sim rename to tests/script/tsim/tag/5.sim index 895b1a9492..e3edbcaa5d 100644 --- a/tests/script/general/rm_bak/tag/5.sim +++ b/tests/script/tsim/tag/5.sim @@ -1,13 +1,7 @@ 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 -sql reset query cache print ======================== dnode1 start @@ -831,7 +825,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/6.sim b/tests/script/tsim/tag/6.sim similarity index 99% rename from tests/script/general/rm_bak/tag/6.sim rename to tests/script/tsim/tag/6.sim index 9190998bb3..d4e1d52c3c 100644 --- a/tests/script/general/rm_bak/tag/6.sim +++ b/tests/script/tsim/tag/6.sim @@ -1,13 +1,7 @@ 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 -sql reset query cache print ======================== dnode1 start @@ -986,7 +980,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/add.sim b/tests/script/tsim/tag/add.sim similarity index 99% rename from tests/script/general/rm_bak/tag/add.sim rename to tests/script/tsim/tag/add.sim index 4a3871235e..2901614889 100644 --- a/tests/script/general/rm_bak/tag/add.sim +++ b/tests/script/tsim/tag/add.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -849,7 +845,7 @@ step142: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bigint.sim b/tests/script/tsim/tag/bigint.sim similarity index 98% rename from tests/script/general/rm_bak/tag/bigint.sim rename to tests/script/tsim/tag/bigint.sim index 3e5d528980..2e1af227c0 100644 --- a/tests/script/general/rm_bak/tag/bigint.sim +++ b/tests/script/tsim/tag/bigint.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/binary.sim b/tests/script/tsim/tag/binary.sim similarity index 98% rename from tests/script/general/rm_bak/tag/binary.sim rename to tests/script/tsim/tag/binary.sim index 960f45675d..2cabf30bb1 100644 --- a/tests/script/general/rm_bak/tag/binary.sim +++ b/tests/script/tsim/tag/binary.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/binary_binary.sim b/tests/script/tsim/tag/binary_binary.sim similarity index 99% rename from tests/script/general/rm_bak/tag/binary_binary.sim rename to tests/script/tsim/tag/binary_binary.sim index 3a0fb56848..8a77de5226 100644 --- a/tests/script/general/rm_bak/tag/binary_binary.sim +++ b/tests/script/tsim/tag/binary_binary.sim @@ -1,11 +1,6 @@ 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 @@ -304,7 +299,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool.sim b/tests/script/tsim/tag/bool.sim similarity index 98% rename from tests/script/general/rm_bak/tag/bool.sim rename to tests/script/tsim/tag/bool.sim index e37cba669b..26e320c41e 100644 --- a/tests/script/general/rm_bak/tag/bool.sim +++ b/tests/script/tsim/tag/bool.sim @@ -1,11 +1,6 @@ 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 @@ -235,7 +230,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool_binary.sim b/tests/script/tsim/tag/bool_binary.sim similarity index 99% rename from tests/script/general/rm_bak/tag/bool_binary.sim rename to tests/script/tsim/tag/bool_binary.sim index 9f6e4f7344..d776127757 100644 --- a/tests/script/general/rm_bak/tag/bool_binary.sim +++ b/tests/script/tsim/tag/bool_binary.sim @@ -1,11 +1,6 @@ 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 @@ -304,7 +299,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool_int.sim b/tests/script/tsim/tag/bool_int.sim similarity index 99% rename from tests/script/general/rm_bak/tag/bool_int.sim rename to tests/script/tsim/tag/bool_int.sim index 60345c2d68..daeb0c711f 100644 --- a/tests/script/general/rm_bak/tag/bool_int.sim +++ b/tests/script/tsim/tag/bool_int.sim @@ -1,11 +1,6 @@ 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 @@ -320,7 +315,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/change.sim b/tests/script/tsim/tag/change.sim similarity index 99% rename from tests/script/general/rm_bak/tag/change.sim rename to tests/script/tsim/tag/change.sim index 6f294c0f48..f58e387217 100644 --- a/tests/script/general/rm_bak/tag/change.sim +++ b/tests/script/tsim/tag/change.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -508,7 +504,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/column.sim b/tests/script/tsim/tag/column.sim similarity index 95% rename from tests/script/general/rm_bak/tag/column.sim rename to tests/script/tsim/tag/column.sim index 5a0cd169c5..c73999230f 100644 --- a/tests/script/general/rm_bak/tag/column.sim +++ b/tests/script/tsim/tag/column.sim @@ -1,11 +1,6 @@ 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 @@ -89,7 +84,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/commit.sim b/tests/script/tsim/tag/commit.sim similarity index 99% rename from tests/script/general/rm_bak/tag/commit.sim rename to tests/script/tsim/tag/commit.sim index bcd9d7c618..18128fc464 100644 --- a/tests/script/general/rm_bak/tag/commit.sim +++ b/tests/script/tsim/tag/commit.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -1177,7 +1173,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/create.sim b/tests/script/tsim/tag/create.sim similarity index 99% rename from tests/script/general/rm_bak/tag/create.sim rename to tests/script/tsim/tag/create.sim index 95b4166543..e25f1eb71f 100644 --- a/tests/script/general/rm_bak/tag/create.sim +++ b/tests/script/tsim/tag/create.sim @@ -1,11 +1,6 @@ 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 diff --git a/tests/script/general/rm_bak/tag/delete.sim b/tests/script/tsim/tag/delete.sim similarity index 99% rename from tests/script/general/rm_bak/tag/delete.sim rename to tests/script/tsim/tag/delete.sim index 2a0aa27bde..bcfd822dbd 100644 --- a/tests/script/general/rm_bak/tag/delete.sim +++ b/tests/script/tsim/tag/delete.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -820,7 +816,7 @@ step145: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/double.sim b/tests/script/tsim/tag/double.sim similarity index 98% rename from tests/script/general/rm_bak/tag/double.sim rename to tests/script/tsim/tag/double.sim index f17043393f..3f936318fb 100644 --- a/tests/script/general/rm_bak/tag/double.sim +++ b/tests/script/tsim/tag/double.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/filter.sim b/tests/script/tsim/tag/filter.sim similarity index 99% rename from tests/script/general/rm_bak/tag/filter.sim rename to tests/script/tsim/tag/filter.sim index 7a899a7e67..b9f2df0cc6 100644 --- a/tests/script/general/rm_bak/tag/filter.sim +++ b/tests/script/tsim/tag/filter.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -142,7 +140,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/float.sim b/tests/script/tsim/tag/float.sim similarity index 98% rename from tests/script/general/rm_bak/tag/float.sim rename to tests/script/tsim/tag/float.sim index 35bf7d6090..215869e003 100644 --- a/tests/script/general/rm_bak/tag/float.sim +++ b/tests/script/tsim/tag/float.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int.sim b/tests/script/tsim/tag/int.sim similarity index 98% rename from tests/script/general/rm_bak/tag/int.sim rename to tests/script/tsim/tag/int.sim index 4eea02c9cd..d97079de91 100644 --- a/tests/script/general/rm_bak/tag/int.sim +++ b/tests/script/tsim/tag/int.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int_binary.sim b/tests/script/tsim/tag/int_binary.sim similarity index 99% rename from tests/script/general/rm_bak/tag/int_binary.sim rename to tests/script/tsim/tag/int_binary.sim index 9a75697676..fef77a16d9 100644 --- a/tests/script/general/rm_bak/tag/int_binary.sim +++ b/tests/script/tsim/tag/int_binary.sim @@ -1,11 +1,6 @@ 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 @@ -304,7 +299,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int_float.sim b/tests/script/tsim/tag/int_float.sim similarity index 99% rename from tests/script/general/rm_bak/tag/int_float.sim rename to tests/script/tsim/tag/int_float.sim index a03c4b7148..f184fdce0c 100644 --- a/tests/script/general/rm_bak/tag/int_float.sim +++ b/tests/script/tsim/tag/int_float.sim @@ -1,11 +1,6 @@ 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 @@ -320,7 +315,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/set.sim b/tests/script/tsim/tag/set.sim similarity index 99% rename from tests/script/general/rm_bak/tag/set.sim rename to tests/script/tsim/tag/set.sim index cbc964fad7..2c14313a07 100644 --- a/tests/script/general/rm_bak/tag/set.sim +++ b/tests/script/tsim/tag/set.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -452,7 +448,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/smallint.sim b/tests/script/tsim/tag/smallint.sim similarity index 98% rename from tests/script/general/rm_bak/tag/smallint.sim rename to tests/script/tsim/tag/smallint.sim index e69eef05f2..cb65a93d5f 100644 --- a/tests/script/general/rm_bak/tag/smallint.sim +++ b/tests/script/tsim/tag/smallint.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/tinyint.sim b/tests/script/tsim/tag/tinyint.sim similarity index 98% rename from tests/script/general/rm_bak/tag/tinyint.sim rename to tests/script/tsim/tag/tinyint.sim index 2d70dc7d48..c6d9df2597 100644 --- a/tests/script/general/rm_bak/tag/tinyint.sim +++ b/tests/script/tsim/tag/tinyint.sim @@ -1,11 +1,6 @@ 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 @@ -237,7 +232,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi From e9accd26dffcfef19af87d9545b8f701781ee4c1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 14 Jul 2022 10:40:46 +0800 Subject: [PATCH 76/92] fix:double free error for parserTest --- include/common/tmsg.h | 1 + source/libs/parser/src/parInsert.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5e7e045b78..c8e13fce3d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1989,6 +1989,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) { taosMemoryFreeClear(req->ctb.pTag); taosMemoryFreeClear(req->ctb.name); taosArrayDestroy(req->ctb.tagName); + req->ctb.tagName = NULL; } else if (req->type == TSDB_NORMAL_TABLE) { taosMemoryFreeClear(req->ntb.schemaRow.pSchema); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 935cadc484..005a7f919a 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1514,6 +1514,7 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache .pSql = (char*)pContext->pSql, .msg = {.buf = pContext->pMsg, .len = pContext->msgLen}, .pTableMeta = NULL, + .createTblReq = {0}, .pSubTableHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK), .pTableNameHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK), .pDbFNameHashObj = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK), From 59062a9bae55fca614ba6eb8feaae956f5985bb0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 10:41:22 +0800 Subject: [PATCH 77/92] fix: memory leak while dnode exiting --- source/dnode/mgmt/mgmt_mnode/src/mmWorker.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c index a171d2e1e4..d2b071ec61 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c @@ -168,7 +168,12 @@ int32_t mmPutMsgToQueue(SMnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { memcpy(pMsg, pRpc, sizeof(SRpcMsg)); dTrace("msg:%p, is created and will put into %s queue, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType)); - return mmPutMsgToWorker(pMgmt, pWorker, pMsg); + int32_t code = mmPutMsgToWorker(pMgmt, pWorker, pMsg); + if (code != 0) { + dTrace("msg:%p, is freed", pMsg); + taosFreeQitem(pMsg); + } + return code; } int32_t mmStartWorker(SMnodeMgmt *pMgmt) { From c7e64933d0832a346d4475fb7652301563373475 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 14 Jul 2022 10:43:54 +0800 Subject: [PATCH 78/92] fix: use calcTypeBytes for table altering --- source/libs/parser/src/parTranslater.c | 3 ++- tests/script/tsim/alter/table.sim | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d12f1cfe7c..837d0f5773 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5939,7 +5939,8 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->type = pStmt->dataType.type; pReq->flags = COL_SMA_ON; - pReq->bytes = pStmt->dataType.bytes; + // pReq->bytes = pStmt->dataType.bytes; + pReq->bytes = calcTypeBytes(pStmt->dataType); return TSDB_CODE_SUCCESS; } diff --git a/tests/script/tsim/alter/table.sim b/tests/script/tsim/alter/table.sim index cc995d171f..348bef21fe 100644 --- a/tests/script/tsim/alter/table.sim +++ b/tests/script/tsim/alter/table.sim @@ -660,8 +660,8 @@ endi print ======= over sql drop database d1 sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT From fb49fd40cddccccf4a3a3933a173ffcf9302d028 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 14 Jul 2022 10:44:35 +0800 Subject: [PATCH 79/92] fix(query):fix invalid write in sample query processing. --- source/libs/function/src/builtinsimpl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index e622c0c1af..97cb1f0ee1 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3461,9 +3461,16 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData } } +/* + * +------------------------------------+--------------+--------------+ + * | null bitmap | | | + * |(n columns, one bit for each column)| src column #1| src column #2| + * +------------------------------------+--------------+--------------+ + */ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos) { SFilePage* pPage = NULL; + // todo refactor: move away int32_t completeRowSize = pCtx->subsidiaries.num * sizeof(bool); for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) { SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j]; @@ -3476,12 +3483,15 @@ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS } else { pPage = getBufPage(pCtx->pBuf, pCtx->curBufPage); if (pPage->num + completeRowSize > getBufPageSize(pCtx->pBuf)) { + // current page is all used, let's prepare a new buffer page + releaseBufPage(pCtx->pBuf, pPage); pPage = getNewBufPage(pCtx->pBuf, 0, &pCtx->curBufPage); pPage->num = sizeof(SFilePage); } } pPos->pageId = pCtx->curBufPage; + pPos->offset = pPage->num; // keep the current row data, extract method int32_t offset = 0; @@ -3509,7 +3519,6 @@ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS offset += pCol->info.bytes; } - pPos->offset = pPage->num; pPage->num += completeRowSize; setBufPageDirty(pPage, true); @@ -4839,7 +4848,7 @@ static void doReservoirSample(SqlFunctionCtx* pCtx, SSampleInfo* pInfo, char* da if (pInfo->numSampled < pInfo->samples) { sampleAssignResult(pInfo, data, pInfo->numSampled); if (pCtx->subsidiaries.num > 0) { - saveTupleData(pCtx, index, pCtx->pSrcBlock, pInfo->tuplePos + pInfo->numSampled * sizeof(STuplePos)); + saveTupleData(pCtx, index, pCtx->pSrcBlock, &pInfo->tuplePos[pInfo->numSampled]); } pInfo->numSampled++; } else { @@ -4847,7 +4856,7 @@ static void doReservoirSample(SqlFunctionCtx* pCtx, SSampleInfo* pInfo, char* da if (j < pInfo->samples) { sampleAssignResult(pInfo, data, j); if (pCtx->subsidiaries.num > 0) { - copyTupleData(pCtx, index, pCtx->pSrcBlock, pInfo->tuplePos + j * sizeof(STuplePos)); + copyTupleData(pCtx, index, pCtx->pSrcBlock, &pInfo->tuplePos[j]); } } } @@ -4885,7 +4894,7 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t currentRow = pBlock->info.rows; for (int32_t i = 0; i < pInfo->numSampled; ++i) { colDataAppend(pCol, currentRow + i, pInfo->data + i * pInfo->colBytes, false); - setSelectivityValue(pCtx, pBlock, pInfo->tuplePos + i * sizeof(STuplePos), currentRow + i); + setSelectivityValue(pCtx, pBlock, &pInfo->tuplePos[i], currentRow + i); } return pInfo->numSampled; From e8c041f09856e5845be679718c9a52868d1ce0f7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 14 Jul 2022 10:49:09 +0800 Subject: [PATCH 80/92] fix:filter child table with tag --- source/libs/executor/src/executil.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 2469062d09..6b2bea273d 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -347,25 +347,25 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, terrno = code; return code; } - - if (pTagCond) { - int32_t i = 0; - while (i < taosArrayGetSize(pListInfo->pTableList)) { - STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i); - bool isOk = isTableOk(info, pTagCond, metaHandle); - if (terrno) return terrno; - if (!isOk) { - taosArrayRemove(pListInfo->pTableList, i); - continue; - } - i++; - } - } } else { // Create one table group. STableKeyInfo info = {.lastKey = 0, .uid = tableUid, .groupId = 0}; taosArrayPush(pListInfo->pTableList, &info); } + if (pTagCond) { + int32_t i = 0; + while (i < taosArrayGetSize(pListInfo->pTableList)) { + STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i); + bool isOk = isTableOk(info, pTagCond, metaHandle); + if (terrno) return terrno; + if (!isOk) { + taosArrayRemove(pListInfo->pTableList, i); + continue; + } + i++; + } + } + pListInfo->pGroupList = taosArrayInit(4, POINTER_BYTES); if (pListInfo->pGroupList == NULL) { return TSDB_CODE_OUT_OF_MEMORY; From 724d2e0f5fdf6c43fc23a2ae9b2d111d4a3fe1fd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 10:51:09 +0800 Subject: [PATCH 81/92] test: valgrind case --- tests/script/sh/deploy.sh | 4 ++-- tests/script/tsim/valgrind/checkError2.sim | 24 +++++++++++++++++++--- tests/script/tsim/valgrind/checkError3.sim | 16 +++++++-------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index de7b8ecfbf..5f497a248f 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -127,8 +127,8 @@ echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "uDebugFlag 131" >> $TAOS_CFG -echo "rpcDebugFlag 131" >> $TAOS_CFG +echo "uDebugFlag 143" >> $TAOS_CFG +echo "rpcDebugFlag 143" >> $TAOS_CFG echo "jniDebugFlag 143" >> $TAOS_CFG echo "qDebugFlag 143" >> $TAOS_CFG echo "cDebugFlag 143" >> $TAOS_CFG diff --git a/tests/script/tsim/valgrind/checkError2.sim b/tests/script/tsim/valgrind/checkError2.sim index 3939b7c854..3a82218015 100644 --- a/tests/script/tsim/valgrind/checkError2.sim +++ b/tests/script/tsim/valgrind/checkError2.sim @@ -37,22 +37,40 @@ endi print =============== step4: create show table sql create table ct1 using stb tags(1000) +sql create table ct2 using stb tags(2000) +sql create table ct3 using stb tags(3000) sql show tables -if $rows != 1 then +if $rows != 3 then return -1 endi print =============== step5: insert data sql insert into ct1 values(now+0s, 10, 2.0, 3.0) sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct2 values(now+0s, 10, 2.0, 3.0) +sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) -print =============== step6: select data +print =============== step6: query data sql select * from ct1 sql select * from stb +sql select c1, c2, c3 from ct1 +sql select ts, c1, c2, c3 from stb + +print =============== step7: count +sql select count(*) from ct1; +sql select count(*) from stb; +sql select count(ts), count(c1), count(c2), count(c3) from ct1 +sql select count(ts), count(c1), count(c2), count(c3) from stb + +print =============== step8: func +sql select first(ts), first(c1), first(c2), first(c3) from ct1 +sql select min(c1), min(c2), min(c3) from ct1 +sql select max(c1), max(c2), max(c3) from ct1 +sql select sum(c1), sum(c2), sum(c3) from ct1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT - print =============== check $null= diff --git a/tests/script/tsim/valgrind/checkError3.sim b/tests/script/tsim/valgrind/checkError3.sim index d5a407f6f8..10a8f01fb3 100644 --- a/tests/script/tsim/valgrind/checkError3.sim +++ b/tests/script/tsim/valgrind/checkError3.sim @@ -68,16 +68,16 @@ sql select ts, c1, t1 from stb sql select ts, c1, t1 from stb_2 print =============== stepb: count -#sql select count(*) from c1; -#sql select count(*) from stb; -#sql select count(ts), count(c1), count(c2), count(c3) from c1 -#sql select count(ts), count(c1), count(c2), count(c3) from stb +sql select count(*) from c1; +sql select count(*) from stb; +sql select count(ts), count(c1), count(c2), count(c3) from c1 +sql select count(ts), count(c1), count(c2), count(c3) from stb print =============== stepc: func -#sql select first(ts), first(c1), first(c2), first(c3) from c1 -#sql select min(c1), min(c2), min(c3) from c1 -#sql select max(c1), max(c2), max(c3) from c1 -#sql select sum(c1), sum(c2), sum(c3) from c1 +sql select first(ts), first(c1), first(c2), first(c3) from c1 +sql select min(c2), min(c3), min(c4) from c1 +sql select max(c2), max(c3), max(c4) from c1 +sql select sum(c2), sum(c3), sum(c4) from c1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT From 638353ef67e9d582abc572af2e428db7a896650e Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 14 Jul 2022 11:00:02 +0800 Subject: [PATCH 82/92] feat: update taostools for3.0 (#14885) * feat: update taos-tools for 3.0 [TD-14141] * feat: update taos-tools for 3.0 --- tools/taos-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/taos-tools b/tools/taos-tools index 3f42d428eb..bd496f76b6 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit 3f42d428eb6b90dea2651f4ccea66e44705c831b +Subproject commit bd496f76b64931c66da2f8b0f24143a98a881cde From 6fd4684a26c1f13a51e90db6b144bb368a0a598a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 14 Jul 2022 11:16:15 +0800 Subject: [PATCH 83/92] fix(query): ensure buffer before load data. --- source/common/src/tdatablock.c | 5 ++++- source/libs/executor/src/tfill.c | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index f51023189d..9f5a247d76 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -542,8 +542,10 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) { } int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) { - pBlock->info.rows = *(int32_t*)buf; + int32_t numOfRows = *(int32_t*) buf; + blockDataEnsureCapacity(pBlock, numOfRows); + pBlock->info.rows = numOfRows; size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); const char* pStart = buf + sizeof(uint32_t); @@ -589,6 +591,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) { return TSDB_CODE_SUCCESS; } +// todo remove this int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) { pBlock->info.rows = *(int32_t*)buf; pBlock->info.groupId = *(uint64_t*)(buf + sizeof(int32_t)); diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index c008c7c4a9..959c03a3b1 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -53,8 +53,8 @@ static void setNullRow(SSDataBlock* pBlock, int64_t ts, int32_t rowIndex) { // the first are always the timestamp column, so start from the second column. for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); ++i) { SColumnInfoData* p = taosArrayGet(pBlock->pDataBlock, i); - if (p->info.type == TSDB_DATA_TYPE_TIMESTAMP) { - colDataAppend(p, rowIndex, (const char*)&ts, false); + if (p->info.type == TSDB_DATA_TYPE_TIMESTAMP) { // handle timestamp + colDataAppend(p, rowIndex, (const char*)&ts, false); } else { colDataAppendNULL(p, rowIndex); } @@ -83,15 +83,20 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* if (pFillInfo->type == TSDB_FILL_PREV) { SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev : pFillInfo->next; - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag)) { continue; } - SGroupKeys* pKey = taosArrayGet(p, i); SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); - doSetVal(pDstColInfoData, index, pKey); + + if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { + colDataAppend(pDstColInfoData, index, (const char*)&ts, false); + } else { + SGroupKeys* pKey = taosArrayGet(p, i); + doSetVal(pDstColInfoData, index, pKey); + } } } else if (pFillInfo->type == TSDB_FILL_NEXT) { SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next : pFillInfo->prev; @@ -264,9 +269,8 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t assert(pFillInfo->currentKey == ts); if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) { - ++pFillInfo->index; - copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, pFillInfo->next); - --pFillInfo->index; + int32_t nextRowIndex = pFillInfo->index + 1; + copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, pFillInfo->next); } // assign rows to dst buffer From f02d8c2596f8386deecbc59ec9f5b4cb0c11c47a Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Thu, 14 Jul 2022 11:19:31 +0800 Subject: [PATCH 84/92] enh(taosAdapter): update taosAdapter (#14858) --- tools/taosadapter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/taosadapter b/tools/taosadapter index c885e967e4..df8678f070 160000 --- a/tools/taosadapter +++ b/tools/taosadapter @@ -1 +1 @@ -Subproject commit c885e967e490105999b84d009a15168728dfafaf +Subproject commit df8678f070e3f707faf59baebec90065f6e1268b From 13519f8fd925a6fd3615ffcd49bc88fce605184c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 14 Jul 2022 10:15:20 +0800 Subject: [PATCH 85/92] feat(stream): interval offset --- source/libs/executor/src/executil.c | 3 +++ source/libs/stream/src/streamUpdate.c | 2 +- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/stream/sliding.sim | 8 ++++---- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 2469062d09..4b8eed57d7 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -853,6 +853,9 @@ static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) { w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; } else { int64_t st = w.skey; + if (pInterval->offset > 0) { + st = taosTimeAdd(st, pInterval->offset, pInterval->offsetUnit, pInterval->precision); + } if (st > ts) { st -= ((st - ts + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding; diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 3d64cec8d8..d0fb9c22e1 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -17,7 +17,7 @@ #include "ttime.h" #define DEFAULT_FALSE_POSITIVE 0.01 -#define DEFAULT_BUCKET_SIZE 1024 +#define DEFAULT_BUCKET_SIZE 131072 #define ROWS_PER_MILLISECOND 1 #define MAX_NUM_SCALABLE_BF 100000 #define MIN_NUM_SCALABLE_BF 10 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index dad4dbbe29..3fa0df5a7d 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -114,6 +114,7 @@ # ./test.sh -f tsim/stream/schedSnode.sim ./test.sh -f tsim/stream/windowClose.sim ./test.sh -f tsim/stream/ignoreExpiredData.sim +./test.sh -f tsim/stream/sliding.sim # ---- transaction ./test.sh -f tsim/trans/lossdata1.sim diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 750be7cb49..44f96cbefa 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -17,10 +17,10 @@ sql use test sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream stream_t1 trigger at_once into streamtST as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); -sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); sql insert into t1 values(1648791210000,1,2,3,1.0); sql insert into t1 values(1648791216000,2,2,3,1.1); From 3c755c483464c825a0afb19e6d135cbb15739ada Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 14 Jul 2022 11:41:34 +0800 Subject: [PATCH 86/92] opt:remove useless code --- source/libs/executor/src/executil.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 6b2bea273d..744dac85b9 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -307,7 +307,6 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagIndexCond = (SNode*)pListInfo->pTagIndexCond; if (pScanNode->tableType == TSDB_SUPER_TABLE) { if (pTagIndexCond) { - ///<<<<<<< HEAD SIndexMetaArg metaArg = { .metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid}; @@ -315,20 +314,9 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, SIdxFltStatus status = SFLT_NOT_INDEX; code = doFilterTag(pTagIndexCond, &metaArg, res, &status); if (code != 0 || status == SFLT_NOT_INDEX) { - code = TSDB_CODE_INDEX_REBUILDING; - } - //======= - // SArray* res = taosArrayInit(8, sizeof(uint64_t)); - // // code = doFilterTag(pTagIndexCond, &metaArg, res); - // code = TSDB_CODE_INDEX_REBUILDING; - //>>>>>>> dvv - if (code == TSDB_CODE_INDEX_REBUILDING) { + qError("failed to get tableIds from index, reason:%s, suid:%" PRIu64, tstrerror(code), tableUid); +// code = TSDB_CODE_INDEX_REBUILDING; code = vnodeGetAllTableList(pVnode, tableUid, pListInfo->pTableList); - } else if (code != TSDB_CODE_SUCCESS) { - qError("failed to get tableIds, reason:%s, suid:%" PRIu64, tstrerror(code), tableUid); - taosArrayDestroy(res); - terrno = code; - return code; } else { qDebug("success to get tableIds, size:%d, suid:%" PRIu64, (int)taosArrayGetSize(res), tableUid); } From b1cdc7ff3cb3099aaeefb5fb659889d5b5cc08a7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 11:42:55 +0800 Subject: [PATCH 87/92] test: valgrind case --- tests/script/tsim/insert/basic0.sim | 163 +++++++++++--------------- tests/script/tsim/insert/basic1.sim | 41 ++----- tests/script/tsim/valgrind/basic1.sim | 70 ++++++----- 3 files changed, 116 insertions(+), 158 deletions(-) diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 722bc0f907..6de904eca1 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -32,7 +32,6 @@ if $rows != 3 then return -1 endi - print =============== insert data, mode1: one row one table in sql print =============== insert data, mode1: mulit rows one table in sql #print =============== insert data, mode1: one rows mulit table in sql @@ -41,9 +40,6 @@ sql insert into ct1 values(now+0s, 10, 2.0, 3.0) sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) sql insert into ct2 values(now+0s, 10, 2.0, 3.0) sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) -#sql insert into ct1 values(now+4s, -14, -2.4, -3.4) ct2 values(now+4s, -14, -2.4, -3.4) -#sql insert into ct1 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6) ct2 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6) - sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) #=================================================================== @@ -67,16 +63,6 @@ endi if $data03 != 3.000000000 then return -1 endi -#if $data41 != -14 then -# return -1 -#endi -#if $data42 != -2.40000 then -# return -1 -#endi -#if $data43 != -3.400000000 then -# return -1 -#endi - print =============== select count(*) from child table sql select count(*) from ct1 @@ -107,10 +93,10 @@ if $data03 != 4 then endi #print =============== select first(*)/first(column) from child table -#sql select first(*) from ct1 -#print ====> select first(*) from ct1 -#print rows: $rows -#print $data00 $data01 $data02 $data03 +sql select first(*) from ct1 +print ====> select first(*) from ct1 +print rows: $rows +print $data00 $data01 $data02 $data03 sql select first(ts), first(c1), first(c2), first(c3) from ct1 print ====> select first(ts), first(c1), first(c2), first(c3) from ct1 @@ -217,23 +203,23 @@ if $data32 != -3.300000000 then return -1 endi #=================================================================== -#=================================================================== #print =============== query data from stb -#sql select * from stb -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +print $rows +if $rows != 9 then + return -1 +endi #print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 9 then -# return -1 -#endi +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 9 then + return -1 +endi print =============== select count(column) from supter table sql select ts, c1, c2, c3 from stb @@ -264,28 +250,23 @@ if $data03 != 3.000000000 then endi #print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print rows: $rows -#print $data00 $data01 $data02 $data03 -#print $data10 $data11 $data12 $data13 -#print $data20 $data21 $data22 $data23 -#print $data30 $data31 $data32 $data33 -#if $data00 != 9 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +sql select count(ts), count(c1), count(c2), count(c3) from stb +print rows: $rows +print $data00 $data01 $data02 $data03 +if $data00 != 9 then + return -1 +endi +if $data01 != 9 then + return -1 +endi +if $data02 != 9 then + return -1 +endi +if $data03 != 9 then + return -1 +endi #=================================================================== -#=================================================================== - print =============== stop and restart taosd, then again do query above system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start @@ -326,16 +307,6 @@ endi if $data03 != 3.000000000 then return -1 endi -#if $data41 != -14 then -# return -1 -#endi -#if $data42 != -2.40000 then -# return -1 -#endi -#if $data43 != -3.400000000 then -# return -1 -#endi - print =============== select count(*) from child table sql select count(*) from ct1 @@ -366,10 +337,10 @@ if $data03 != 4 then endi #print =============== select first(*)/first(column) from child table -#sql select first(*) from ct1 -#print ====> select first(*) from ct1 -#print rows: $rows -#print $data00 $data01 $data02 $data03 +sql select first(*) from ct1 +print ====> select first(*) from ct1 +print rows: $rows +print $data00 $data01 $data02 $data03 sql select first(ts), first(c1), first(c2), first(c3) from ct1 print ====> select first(ts), first(c1), first(c2), first(c3) from ct1 @@ -474,24 +445,23 @@ endi if $data32 != -3.300000000 then return -1 endi -#=================================================================== -#=================================================================== -#print =============== query data from stb -#sql select * from stb -#if $rows != 4 then -# return -1 -#endi +#=================================================================== +print =============== query data from stb +sql select * from stb +if $rows != 9 then + return -1 +endi -#print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 9 then -# return -1 -#endi +print =============== select count(*) from supter table +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 9 then + return -1 +endi print =============== select count(column) from supter table sql select ts, c1, c2, c3 from stb @@ -521,20 +491,19 @@ if $data03 != 3.000000000 then endi #print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print $data00 $data01 $data02 $data03 -#if $data00 != 8 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +sql select count(ts), count(c1), count(c2), count(c3) from stb +print $data00 $data01 $data02 $data03 +if $data00 != 9 then + return -1 +endi +if $data01 != 9 then + return -1 +endi +if $data02 != 9 then + return -1 +endi +if $data03 != 9 then + return -1 +endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/insert/basic1.sim b/tests/script/tsim/insert/basic1.sim index d98407b380..6d31dcdffb 100644 --- a/tests/script/tsim/insert/basic1.sim +++ b/tests/script/tsim/insert/basic1.sim @@ -1,9 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 50 sql connect - print =============== create database sql create database d1 sql show databases @@ -17,7 +15,6 @@ sql use d1 print =============== create super table, include all type sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned) - sql create stable if not exists stb_1 (ts timestamp, i int) tags (j int) sql create table stb_2 (ts timestamp, i int) tags (j int) sql create stable stb_3 (ts timestamp, i int) tags (j int) @@ -36,11 +33,6 @@ if $rows != 2 then return -1 endi - -print =============== insert data, mode1: one row one table in sql -print =============== insert data, mode1: mulit rows one table in sql -print =============== insert data, mode1: one rows mulit table in sql -print =============== insert data, mode1: mulit rows mulit table in sql sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) @@ -69,32 +61,15 @@ if $data03 != -2 then endi print =============== query data from st, but not support select * from super table, waiting fix -#sql select * from st -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +if $rows != 4 then + return -1 +endi print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - print =============== query data sql select * from c1 print rows: $rows @@ -119,9 +94,9 @@ if $data03 != -2 then endi print =============== query data from st, but not support select * from super table, waiting fix -#sql select * from st -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +if $rows != 4 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index f0430195c9..784b83d96b 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c debugflag -v 131 -system sh/exec.sh -n dnode1 -s start -v +system sh/exec.sh -n dnode1 -s start sql connect print =============== step1: create drop show dnodes @@ -23,51 +23,65 @@ if $data(1)[4] != ready then endi print =============== step2: create db -sql create database d1 vgroups 1 buffer 3 +sql create database d1 vgroups 3 buffer 3 sql show databases sql use d1 sql show vgroups -print =============== step3: create show stable -sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) +print =============== step3: create show stable, include all type +sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned) +sql create stable if not exists stb_1 (ts timestamp, c1 int) tags (j int) +sql create table stb_2 (ts timestamp, c1 int) tags (t1 int) +sql create stable stb_3 (ts timestamp, c1 int) tags (t1 int) sql show stables -if $rows != 1 then +if $rows != 4 then return -1 endi -print =============== step4: create show table -sql create table ct1 using stb tags(1000) -sql create table ct2 using stb tags(2000) -sql create table ct3 using stb tags(3000) +print =============== step4: ccreate child table +sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql show tables -if $rows != 3 then +if $rows != 2 then return -1 endi print =============== step5: insert data -sql insert into ct1 values(now+0s, 10, 2.0, 3.0) -sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) -sql insert into ct2 values(now+0s, 10, 2.0, 3.0) -sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) -sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) +sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c2 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c2 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) -print =============== step6: query data -sql select * from ct1 -sql select * from stb -sql select c1, c2, c3 from ct1 -sql select ts, c1, c2, c3 from stb +print =============== step6: alter insert +sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) -print =============== step7: count -sql select count(*) from ct1; +print =============== restart +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start -v + +print =============== stepa: query data +sql select * from c1 +#sql select * from stb +#sql select * from stb_1 +#sql select ts, c1, c2, c3 from c1 +#sql select ts, c1, c2, c3 from stb +#sql select ts, c1 from stb_2 +#sql select ts, c1, t1 from c1 +#sql select ts, c1, t1 from stb +#sql select ts, c1, t1 from stb_2 + +print =============== stepb: count +#sql select count(*) from c1; #sql select count(*) from stb; -#sql select count(ts), count(c1), count(c2), count(c3) from ct1 +#sql select count(ts), count(c1), count(c2), count(c3) from c1 #sql select count(ts), count(c1), count(c2), count(c3) from stb -print =============== step8: func -#sql select first(ts), first(c1), first(c2), first(c3) from ct1 -#sql select min(c1), min(c2), min(c3) from ct1 -#sql select max(c1), max(c2), max(c3) from ct1 -#sql select sum(c1), sum(c2), sum(c3) from ct1 +print =============== stepc: func +#sql select first(ts), first(c1), first(c2), first(c3) from c1 +#sql select min(c2), min(c3), min(c4) from c1 +#sql select max(c2), max(c3), max(c4) from c1 +#sql select sum(c2), sum(c3), sum(c4) from c1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT From 1657df208d6e34ac1524f22d27d1599457355d25 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 13:40:52 +0800 Subject: [PATCH 88/92] test: restore some 2.0 case --- tests/script/jenkins/basic.txt | 18 +++++++++--------- tests/script/tsim/tag/4.sim | 16 ++++++++-------- tests/script/tsim/tag/5.sim | 20 ++++++++++---------- tests/script/tsim/tag/6.sim | 24 ++++++++++++------------ tests/script/tsim/tag/bigint.sim | 5 ++--- tests/script/tsim/tag/binary.sim | 5 ++--- tests/script/tsim/tag/binary_binary.sim | 4 ++-- tests/script/tsim/tag/bool.sim | 7 +++---- tests/script/tsim/tag/bool_binary.sim | 4 ++-- tests/script/tsim/tag/bool_int.sim | 4 ++-- tests/script/tsim/tag/double.sim | 4 ++-- tests/script/tsim/tag/float.sim | 4 ++-- tests/script/tsim/tag/int.sim | 5 ++--- tests/script/tsim/tag/int_binary.sim | 4 ++-- tests/script/tsim/tag/int_float.sim | 4 ++-- tests/script/tsim/tag/smallint.sim | 5 ++--- tests/script/tsim/tag/tinyint.sim | 5 ++--- 17 files changed, 66 insertions(+), 72 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index af0e338c9b..78dec01a74 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -283,21 +283,21 @@ ./test.sh -f tsim/tag/3.sim ./test.sh -f tsim/tag/4.sim ./test.sh -f tsim/tag/5.sim -./test.sh -f tsim/tag/6.sim -./test.sh -f tsim/tag/add.sim +#./test.sh -f tsim/tag/6.sim +#./test.sh -f tsim/tag/add.sim ./test.sh -f tsim/tag/bigint.sim ./test.sh -f tsim/tag/binary_binary.sim ./test.sh -f tsim/tag/binary.sim ./test.sh -f tsim/tag/bool_binary.sim ./test.sh -f tsim/tag/bool_int.sim ./test.sh -f tsim/tag/bool.sim -./test.sh -f tsim/tag/change.sim -./test.sh -f tsim/tag/column.sim -./test.sh -f tsim/tag/commit.sim -./test.sh -f tsim/tag/create.sim -./test.sh -f tsim/tag/delete.sim -./test.sh -f tsim/tag/double.sim -./test.sh -f tsim/tag/filter.sim +#./test.sh -f tsim/tag/change.sim +#./test.sh -f tsim/tag/column.sim +#./test.sh -f tsim/tag/commit.sim +#./test.sh -f tsim/tag/create.sim +#./test.sh -f tsim/tag/delete.sim +#./test.sh -f tsim/tag/double.sim +#./test.sh -f tsim/tag/filter.sim ./test.sh -f tsim/tag/float.sim ./test.sh -f tsim/tag/int_binary.sim ./test.sh -f tsim/tag/int_float.sim diff --git a/tests/script/tsim/tag/4.sim b/tests/script/tsim/tag/4.sim index 0bb1cde75d..fcdb146fb9 100644 --- a/tests/script/tsim/tag/4.sim +++ b/tests/script/tsim/tag/4.sim @@ -675,27 +675,27 @@ if $data00 != 25 then endi print =============== step24 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/5.sim b/tests/script/tsim/tag/5.sim index e3edbcaa5d..92695ddfcf 100644 --- a/tests/script/tsim/tag/5.sim +++ b/tests/script/tsim/tag/5.sim @@ -792,33 +792,33 @@ endi print =============== step27 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 partition by tgcol5 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/6.sim b/tests/script/tsim/tag/6.sim index d4e1d52c3c..4f7f5b88d1 100644 --- a/tests/script/tsim/tag/6.sim +++ b/tests/script/tsim/tag/6.sim @@ -941,39 +941,39 @@ if $data00 != 25 then endi print =============== step31 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 partition by tgcol5 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 interval(1d) group by tgcol6 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 partition by tgcol6 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/bigint.sim b/tests/script/tsim/tag/bigint.sim index 2e1af227c0..813387eb38 100644 --- a/tests/script/tsim/tag/bigint.sim +++ b/tests/script/tsim/tag/bigint.sim @@ -221,11 +221,10 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/binary.sim b/tests/script/tsim/tag/binary.sim index 2cabf30bb1..6ede988954 100644 --- a/tests/script/tsim/tag/binary.sim +++ b/tests/script/tsim/tag/binary.sim @@ -221,11 +221,10 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/binary_binary.sim b/tests/script/tsim/tag/binary_binary.sim index 8a77de5226..071b457b44 100644 --- a/tests/script/tsim/tag/binary_binary.sim +++ b/tests/script/tsim/tag/binary_binary.sim @@ -290,9 +290,9 @@ if $data00 != 25 then endi print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/bool.sim b/tests/script/tsim/tag/bool.sim index 26e320c41e..356269e1e1 100644 --- a/tests/script/tsim/tag/bool.sim +++ b/tests/script/tsim/tag/bool.sim @@ -218,12 +218,11 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) +print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/bool_binary.sim b/tests/script/tsim/tag/bool_binary.sim index d776127757..3fcb085e37 100644 --- a/tests/script/tsim/tag/bool_binary.sim +++ b/tests/script/tsim/tag/bool_binary.sim @@ -290,9 +290,9 @@ if $data00 != 25 then endi print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/bool_int.sim b/tests/script/tsim/tag/bool_int.sim index daeb0c711f..2ff640b329 100644 --- a/tests/script/tsim/tag/bool_int.sim +++ b/tests/script/tsim/tag/bool_int.sim @@ -306,9 +306,9 @@ if $data00 != 25 then endi print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/double.sim b/tests/script/tsim/tag/double.sim index 3f936318fb..fedc1c89ec 100644 --- a/tests/script/tsim/tag/double.sim +++ b/tests/script/tsim/tag/double.sim @@ -223,9 +223,9 @@ endi print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/float.sim b/tests/script/tsim/tag/float.sim index 215869e003..0ed12d2269 100644 --- a/tests/script/tsim/tag/float.sim +++ b/tests/script/tsim/tag/float.sim @@ -223,9 +223,9 @@ endi print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/int.sim b/tests/script/tsim/tag/int.sim index d97079de91..e561cde56a 100644 --- a/tests/script/tsim/tag/int.sim +++ b/tests/script/tsim/tag/int.sim @@ -221,11 +221,10 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/int_binary.sim b/tests/script/tsim/tag/int_binary.sim index fef77a16d9..01d73cf0c2 100644 --- a/tests/script/tsim/tag/int_binary.sim +++ b/tests/script/tsim/tag/int_binary.sim @@ -290,9 +290,9 @@ if $data00 != 25 then endi print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/int_float.sim b/tests/script/tsim/tag/int_float.sim index f184fdce0c..0b20ff3d62 100644 --- a/tests/script/tsim/tag/int_float.sim +++ b/tests/script/tsim/tag/int_float.sim @@ -306,9 +306,9 @@ if $data00 != 25 then endi print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/smallint.sim b/tests/script/tsim/tag/smallint.sim index cb65a93d5f..47e28db46c 100644 --- a/tests/script/tsim/tag/smallint.sim +++ b/tests/script/tsim/tag/smallint.sim @@ -221,11 +221,10 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi diff --git a/tests/script/tsim/tag/tinyint.sim b/tests/script/tsim/tag/tinyint.sim index c6d9df2597..0941c9cf18 100644 --- a/tests/script/tsim/tag/tinyint.sim +++ b/tests/script/tsim/tag/tinyint.sim @@ -221,11 +221,10 @@ if $data00 != 25 then return -1 endi - print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi From 91a59257348752373cfa9e50edb53519b19ec204 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 13:41:43 +0800 Subject: [PATCH 89/92] test: restore some 2.0 case --- .../script/general/connection/connection.sim | 21 ------------ tests/script/general/connection/mqtt.sim | 19 ----------- tests/script/general/connection/sim.tar.gz | Bin 9104 -> 0 bytes .../general/connection/test_old_data.sim | 32 ------------------ tests/script/jenkins/basic.txt | 4 +-- 5 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 tests/script/general/connection/connection.sim delete mode 100644 tests/script/general/connection/mqtt.sim delete mode 100644 tests/script/general/connection/sim.tar.gz delete mode 100644 tests/script/general/connection/test_old_data.sim diff --git a/tests/script/general/connection/connection.sim b/tests/script/general/connection/connection.sim deleted file mode 100644 index 1af6e1fda6..0000000000 --- a/tests/script/general/connection/connection.sim +++ /dev/null @@ -1,21 +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 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============= step1 -sql close -print close1 -sql connect - -print ============= step2 -sql close -sql connect - -print ============= step3 -sql close -sql connect - -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/connection/mqtt.sim b/tests/script/general/connection/mqtt.sim deleted file mode 100644 index c2c50ef17e..0000000000 --- a/tests/script/general/connection/mqtt.sim +++ /dev/null @@ -1,19 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c mqtt -v 1 - -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect -sql create database mqttdb; -sql create table mqttdb.devices(ts timestamp, value double) tags(name binary(32), model binary(32), serial binary(16), param binary(16), unit binary(16)); - -sleep 1000 -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/connection/sim.tar.gz b/tests/script/general/connection/sim.tar.gz deleted file mode 100644 index 10bc1a6bace1c8b6796a98c53e3aa3c15e0bfd7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9104 zcmbWbbx>7b^zcmySGtiF5ou8bK|rpQw1i5-1?iAbTHp{;(k&pZh%`voC8PvNB^8kF zh6~)-4_}|(yzgJ{JM%ne&diy;*WPQ+teVeSoKY~me-GidDMdW}uPo@EG+OR!CE1N& z72pR)PRamZ&!8hqzuR>eq_aZjFjPcseS88bU*Z!Pey^*2TaNXpS zn$m0i&%D;(<3tNz8Qcm;{-o4>DE2uuLq-I%zWPiZtW8f+e&Rq#FEN5E9&VMhp!Qe{%3jR_IM!*dD=X^C&Yt=@QDbdM3cl{&2DcdLxIH_14({jF#l3~*E z@VK5@)q}hy;C`?Wn93H*Q`@byLrvh?aIgBR*keAnz$iO~#=pPZJQ~EPhk1yd_=APq zru*XAX;c!v=RFokaz|eaqAzE2Fc!5*dvpEM4FwBUmiW3&-zIsZ$Y<5MjkMD4t@1_e zr_W&@HD>OkKlVjN3#-yLn5@9Qrl?8_CUu?~ibb)FKedht`}|g1mA(F{cs7;7=J00L z+rFM(G&{u~Qm0>X-FzK+GTKqbtQlh^VV9orC7PJ1ib}#=xOjE(f>=CLn37N+Ma-Vo z{iTDquydo5tm0FOS6A)&N<5c;p4oUCrK!KSr~Kk3&OGt`D`!v4+%5Et)W$!Ctigd~ zg(beX9b-s)Q?$KaatwWZWzRR!PR-M2awC=PS@<|!FblAL6x_d=ZYLR zZd5-aEw=IE?Q$HbcGlbV>Tprry;4fi>0lx#7?;`-Fy7Oq8B+2l%~dC&rln6((8xsH z&esO@%ZNp=$l%q~P4|?-aN~y5*xpV7nfpeMxr!*qJxY zW`6xZDV^;OEI^V{ErtVDmS1jqu0@Xb?SH?FZkD;?vi6Xp9ac*ThbcoCjn~6ZC2ot^ z-LYY;8mjvm<{m;%WDb3LJAQhJ3CH~Ts6DbNFeM$;J>(tm%EN&-Ci9~j?VT^1w^@q^ zQLK$>wl%J$H5y-tJO?wJZ@6_yxt86}@8&XFd~}QT{Q7DOzNod8`?^CES?u*p@Rd95 z`!el$g9=ai^RH4vwz6vRt>XQ5r1GX@GWpIlEHN9Eqz>h?ehl0PeiFBKS_fI=OX>f6 zi|FO=C}6njy*39EZ;7y-fC#RmT6a9k3(h&bv{;}hL#X{8hayk}amy!7*Y8wi>$)aG z-dUzgMD19N2tEBY3ZbRV4(Kw)pS(MDC&BaWU_GRcub| z!!e`^T-w0jD}|u-Q7##%8J?bx`xWGJOnPIJ{3)T<-0Q8CU;WU_oUlJ}fWh#^DU{uQ z1t@W_b)0_GxLBA}X5)bq@J1;DhSXM@eyEACsw|k*12E&=;26 z5!l8eZ6(8XR{M^@$6ia@bEq~2NL3KH9^jN|La&zsvg#8s*PacyJ^s+-`r@Km_&P7N z3=CELvU+8rQ7Pg(7T(&>6gL4h;~WuKmOVI{_vj|eU8w!*h01j-2;wa zvBZ-5i1?6qp&-vZ;<5_w+ekaeQ9blKGX56_BN@nSv-@PieOXX-<_rYajNE~d$#O7h zQ|%|j8+Z*qE~IGSB=5>3khIFZQk%DWe|w_y@8=0m%+LFDKNL)OXS7~~Oc8#)TlSK& z36_Oh+6c8B4q49_;kD`HwrOg^Q-dYLIJxYI85bdQkIuh+GpfWEwmemFdvyC+!>{Lk zPwI}i9?><`Pe*Jz-&3o!X5zbhXZMwplpjZo+hMyQn6yDtxQ+q8X*3k7{~jC8Yqudk zh-}nw{31~;`fGvvRWe`EnkovaA0*zl}1~M^BJ`XM<-`4z;^C?}* z4qV_na;ugTkK{ZpIQT^h$o)0}e8PNY>%hcjU0W^91B-oH;T(;$4qQD2e4JTABgS@N z06x24kRD*0j@nplo!-8_z~uBcv(2G_>b?6t$$SJIflb6MKaVb`-xXmVi8^{sjIsHB z$CT-Mt0pmatatAQ%2w*O=wW?r|Df`{erXNtaCr5fM3Gez(ST+2@AYrW zc{d*16TJWd=igG=DB7ASPt4bLTa{<1~%3z zHzbGRp}zP|0sG`Os}|;l3M_aZ6@YI-8DG^$@RKXQFt*Wdj#wVEH5%$R^JK&EgP*iG ztIe++_q@Mm9?}dHsN&g;T)B#-tho;rJ)1KdTuaceonxKlh(yl|BM%(h%)0~s_Y;In zC3*eRqQH=O>4rG*r)%HQ!5u4S!zVK$f#Vn|CtT?f^7>bRB3Cz#RgT*7WlCMMbizq& z97usR){Tn_%voGHa1futJC2k6E$xJWzy{4Wx8>Z)FvkOYi@fv^+4Exi&`LOp)&K6> zm~tuk&Tl`^n1ZxZ7RO$@VzG(#YTio0n79kL=W2>V%$K}=suEnBm?t*85yV|qV%%Q# zWdZO{HxXr4pV+u|rxR=rfr3-GH&OcqBw{`c9X5*^HE+Q2?|2KLwdAPF<{=_aT&BdG zZJF~wL{UliAzEF5><$sTa{`%F}K_0t`vURhCYBjVLb9$6K;YkHL5 zL?_Oe6hd!vu#F^kReh{$C}Nk#qx5=wKd1*5O6W@Sl24*Vs@&*F>RRKsKw+hLp4+U< z)!YR9x(|M;SSLDja>sY3D7;kf*?vX!@tGB$lLFzGo~f3;ieQ48o`C*~@N#`vZC4v< zP_pW*O%DBogeo3Yg0vDgi#kzzTWj4Z*(jR?OW)$s(f#DgTVIwui+heNRIrAvNz~H~ zQu(GS?@u$x1bd7kr_a(zUS`D8QH7?xHY_DsF6Ollx&4)fK45qnSZun#p1o zW$c_lHTo>%!@-!f@{<^s`=1wVG87z4G{b5Sx5M2E>igUJIvzi`PlV5;p?_jB!NL$L zn72D4^FeiGOuICQOD(=pQRqPtWw*F1FY^H1Pg74KgQ1R%M+QmcEW|SB;q6pobV|exdMyxnF#YKX9x8x7^RauL{h#9Z2EuU4-x+G5&J*pvt9#t(VQ;Y)xh?xZ8KE; z2R^-<^Ar|)@!t)pb;z60L<&deBS{;-0a2MxgQwK*4Yc?rzeDV&cph*-c17tFJ52Yi z7tCC)7m(MJ4-g6R8sJUvsC{4DZJoA>@%89C-mz;US_8+&vQ1!(IEna;&0#VuN~T}l ze_!!*ko-)C)z{+usUT~jTUb+`6c#bdk^AHVSp#_YAo*CqgWFJR5E*X#2w}R1zb=VOQ%FU@3D^iP(L-7CaLDpask6=mjfQVT_zckY z#7P8XM^?16b!k;>cxCViVUgJ1wE~BsBPDOLeTShKjlBYHY` zjK6{9ogX{c2~!$QL}TC&_XDfKnJ85GIdQoj2tu;%1=6JvP(F<3io*5&1pk4KIT~nb zCT|0T5Qs4bF4^Gbm5^<81#jgVvJtpsjTL1BcOYSCu?27Gc#o+F*^y{x06giJa5IRT zr;F|fQd0qhfgP5!kl@4-AWFyri&xdQksaUC3c$z{h(4^nQ;7M8OaVBiXHyq0E(?QT#tDf}iD6o(X(9Y5@`pMkR=Blbr|?9OF8!Pl3Wuawb+jc9d@?$0w=x`X8iW8VV;l z`_W+0M5$aZ;Uc=8CL6%i2p@M#NPr*ldBbDpl`kXoT)WQru)9TZGtw+*@3Wc7EW%G> z6Ay88@XI&n0N8H0aEx&57(R)MtLNaRdf|4rZRW`hh$~-PDW&2}uHs9|ZHfBgM3l=lf^J^e4RXFODdw%UPuPiA; ze|o|wKn?JgAHUrH<55H+?X~xCEX>;kVpmawOZ|?_z}TJhmG^GgB~PqYII}(s@nMK* zt89sHUB&g*FOgPGz~sMVmfNGOGy2ij+8BN?8jX^Uh7Y+F*>kY0XmW-AuyPZE{Su@G3A`i7}UwM%-gi>F7T7A|mc~^th)QVrhBy%k-TR z=g(ySam*LH2K_%zNGNlYPz1r(3KdRJ@L=?N-_qeE77)f8+e&`~pHT-`~k$k2nKUn57E6sFdTxo>Lx zZW)IA+E-M0Mi;7CQV6{vXdXK&0+zOB4}QL9$-q=@0+oVch@O54qg;pUqMJHGiX^Gu zvh0^)CwzQ{_;U{Z#F4-&ar0zTM>&}C=n3Zwt;-H(0QZzyaSO#6lm%8PNY{`|(QW^? zDD!;?Vxmv)znmoXA>Edn|A9=TlDc-Ey z+8=Hy@6joC8n++5eU77}$N@=5IU%B%;0?hW+@$?q>9=z0kx1?(JR#9tp2jXg*UY<<^k`C^4lFXf6;tU zGU35xTvzSsJ2bh-9Lsps27uFzt3;=HIRZ9FI9bnk?@hSOzP;yu z$5bCXQs%YxnxyrHilYC=j*4D~XhP3y=kF6NWTktQKUuCCO3leUa}>ij5fL6WIvR^! zvM*B|#xt*dGpk)zRkPTZP;$;~!D~4n0sm*ikd8JCD5;vyLo#wSpldYjDCawp zPhcCPd^sJ43k7X;QF&+*UXuyK#_=)Df@|}Dp$<3C>h3mbaI2(3&C5{x>{^d?t*Zbt z|B}HHyfl(SR&SF3G3+PQX8DC`eI=pRaUgQQ&cZNy_a~U4x7IBt{+aC+!MCQ`>EV< z9F{*blhbURsrxQSTZJEfg>LlO)wLszYuiT_IqWbwgP`2Eg_ufRDd=}~%*9USn`>zu-n*__d#miB6w-0UZ{}5! zyov_7ug9l>+SZO(YmF;$pQc&1VUOhzY$(EtNWLSLHr3M_sXOeb`fEXOh+7 zF`(z^b@G_Y_^a`Qjt`91D-&nI)&s8^Nb)n7P>MG84EQ*_Rq zAB`K>hN4YjnVqdFpXB(a@(Nd!V}4Iof6TMq_;B&KqK*slP30GK2%q`V(=-Wb#pvSy z;xO!oiGSG`Wh~#Drh>?XQ`tl0cIV=+=9Zo3+-%1TuXSN_*n_HYbU1LB7N!RbHvvEC z8OZw;hXxOV2T$hH>g(k_Hxa4gXf0$gcAmyy0^)cUw1WbHZ0)!`n9vrSO152S0^E4X zMvR6lC5+;FX+E9-2f7h7lP{3pLv+DX5C5H6hPU89$pWhG#C*9JF9KqK$dCBrYtT^* z);dVuV^0w6B7aeka=a;aZIy5^AE$J;498$7cfJR^7>LZ&&}%c&w|h(-yL5b9B;w53 z5lzf=m*s4bRx*KA-7ZKh$B;vUpW8MA@!>gj4~>t4=OJ8z(_HTmZjG_sgNTwrZ2MD% z5iohDJ2ERybGRI=o!U>~Fo=WxBCr8-`U&OGGqPes_VKMA0Mr%oJxFmn91Tf^weDd( zLk`TYkpy#5*?V=*pW*iWim5;c=4V%Q&!*wjtFEsY-ybJ$g1<3bXOd_+3qmhnd6_a& zxp4MC{ywMF$8bqhg@=SBcZ8fJ_2GOS6}9@g$fp4a9|@$wTx4W<+>OUh#01c3c^J;a zv;C|$ds<20HwaG~!jEvi%&>yxF1o#*b^Gq*r!zjC$Q*w?)ZdPr<>WX{fj=hg8eC2m z|FoJL??DZiUKBhQ9}6h8E*+q`3qogseu5&h4peaNz}bU*u=fDuqsEQCSi>Rw-cik8 zIv9Tot~L8;wiwDO-2fq2kqHpf8+ejK^2Y`5*?#-Q{5v_EVE$Vil1=U%PNL{6pIFi% zuz>iivLo=)r%m&CWalEVM5p(FzxuyJL2_U=+~3#Rq8<02ia_j14nhv?Vry;+8aDz6 zg*Fk#=L`ivAHrKfa(jOcPL2;5eu#0-W0sSotUYtoX_LM^2?8SN1S8rYNh)fTDnWCM zqtt@4Ho3^*2=Bv6l)W2stN!9ApeDGEtk$uTInYZGHgckFwiVlsmkQIkv4(Ri&u|$= z^Q$++ecC#Vf097=mz&5oH^VGwA~NlF@8BY*Lk}|Ngji85w_yL(mX3fE;eVFI+|7p~it{(UJcaE(cv_e!2#N z0wZv6cDdA(dEW5up7!hRaJ=aONDn09sS_jvO8gUe7_aCSWVH?IUc&J%Th7y{cU1sw z{S&+*U(&BQ|9UXjsrxlPBJXXYmh#ynz=U~s$RHsU)1j4{`GDc6p}{U|4BAD=hL8y3 zfU`&D&*%JD|INz`G8Qbf0<}IEHKd-P=_n4&te@EY5pp&t5794LWXuZat=gG6U-_;o z1(m$J#@WrXS9wf=kmE64n*Ja(8EQLn)c^G;GjZ6LdBl?7p<2#F1w?~gy?=7vw8{_n z#(YxGglBdP%gDG#&2H#;CL0i(1yyH}uI%f1{zbJ^`7yc0V7KPJz(L=R+o*9G<2I|Z z2?MwCGrd2r)Vp4-yk;qf=+7dzI5ndt)zwn9rsYlaPvlxSNypR|pQP1n+4_aAH8D2U z?UfhQJ4);da}x+7)ovsxqn-sx6t4yt#d52_MSj4sMS!-f#Pv+$b#Uuqp{1i8{x$Wt z@#UIc`VCD{wWz!D{LI3siRp<^CaA>xgO3RFw^eXs+{Z1WjcbSQyj%z~IhEwPGL;BQ zDxwb}SYn6if*(q^64fH`ZnI~TF>WSIM5tF% z$0}yHZilJe0n2-?IRW8+01raH@Pv2vTerrZt`RoiSP#9`&xQ$q;{;{F(kbGTFKghz zsFHHHI9bl9AFJor*W2F{y7q;{=wxq++}4so3)agrc76RT?SYJ7-?ch-*R)c4 zH`6^o%&i<8?33JXt!lo*BX(?&3|@xTg3B31Uw{<(0vbVLZU!j+v?i#$xvAycUUM-# z1UM%_0uggB#Cs{4*(-J3Ee0&P!6ajVUa9{KtE>oIh8|4<(V6dohGI?c7xwZX_A zBKNP#w=O!8PogsvzqIvNgl*1d1UpztQj_w_B7}=$a5*mmagc3IZ#qsy@SO#QDuQ$u zEW>EAP>@YR=eGV}sTQqnaAugD*J|m@sBdKo4oUnAREfG`oQbN8w}|bN{AF|ty{+CH z^!duzA>~C+pg#;2?vX45;Y63sRbui4@V`{J1gpW#bJ%a_JQW&tx43R-oNs6pIbE;V z6|iwV8jC!-We5iBzz%HivYv$j^3$z(UiBid1{0lxKRgt}qr%{ni5!Q|E)evOz^ur- zGi>i&4eo=z%H-?2y9_=$H_A)+*d<3W@3Ik@JK7ApCo`3KYnb{K zMtw#muzm1vnAJFKWV*V=m_*k#Px>lHz5!+u$m@HlkX-FwIa;rk+)(!BgZ7a0jNMrg za3J!U2_fBj{1Nn7d#xM5TS3b^0X<#VrOvi}$_C1UYr zc5K_L^AjhZ@AR>sSJc$vK0m)S!V3KOrSei5@3sc7_EF%ADZGO#|qfL586Ok4cj!*x%FPZUb3fmH{SZ|xYv zKkQ}fwX`K|MeO+9sBNA4uB9X2pWpXLv=~ADt$?AB?jaTTwD_`xN6oH#z@hntzJlx# zUO?n+YJZnkc*}pCa!sz7vAzh7Yzz+I-JOrHSW5CWYgFfc!XJ0C+@2LHy0{TpTZKkv*G=mGrtJARpJK<>J~q z^ZLL3zZ50Y1J+Txk-m`!9j3Vm{SI$p&j zR7MZp%zppgQfNiH?Jj?>K}(JDfg8~Cq`H_me_pX0c$YG^(Q8jEI{m&?XxEbL>y^Bf zyo3F>D*xLYZN1p$h;l)yK$%i$4;)^a+l!v5MrW?H*N%y=w$v6`bR{>4|LiJ~=0I`_(+mIr diff --git a/tests/script/general/connection/test_old_data.sim b/tests/script/general/connection/test_old_data.sim deleted file mode 100644 index 83df850f0b..0000000000 --- a/tests/script/general/connection/test_old_data.sim +++ /dev/null @@ -1,32 +0,0 @@ -system sh/stop_dnodes.sh -system sh/mv_old_data.sh - -print ============== deploy - -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print =============== step1 - -sql use test -sql select * from m1 - -print $rows points data are retrieved -if $rows != 7 then - return -1 -endi - -print =============== step 2 - -sql select * from t1 - -print $rows points data are retrieved -if $rows != 7 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 \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 78dec01a74..2ba337ddb5 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -298,11 +298,11 @@ #./test.sh -f tsim/tag/delete.sim #./test.sh -f tsim/tag/double.sim #./test.sh -f tsim/tag/filter.sim -./test.sh -f tsim/tag/float.sim +#./test.sh -f tsim/tag/float.sim ./test.sh -f tsim/tag/int_binary.sim ./test.sh -f tsim/tag/int_float.sim ./test.sh -f tsim/tag/int.sim -./test.sh -f tsim/tag/set.sim +#./test.sh -f tsim/tag/set.sim ./test.sh -f tsim/tag/smallint.sim ./test.sh -f tsim/tag/tinyint.sim From 75aca0b0316bb7468bc521a0aa0ee367f0f744a1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 14 Jul 2022 13:53:23 +0800 Subject: [PATCH 90/92] fix(query): set correct fill output column index, fix some memory leak, and do some internal refactor, --- include/common/tcommon.h | 14 -------- include/common/tdatablock.h | 6 +++- include/libs/stream/tstream.h | 4 +-- source/common/src/tdatablock.c | 15 +++++++- source/dnode/vnode/src/tq/tqRead.c | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 15 ++++---- source/libs/executor/src/scanoperator.c | 4 +-- source/libs/executor/src/tfill.c | 46 ++++++++++++++----------- source/libs/function/src/udfd.c | 6 ++-- source/libs/stream/src/streamData.c | 2 +- source/libs/stream/src/streamDispatch.c | 2 +- source/libs/stream/src/streamExec.c | 8 ++--- 12 files changed, 65 insertions(+), 59 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index d8264ac5b5..005a4e9f57 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -162,7 +162,6 @@ typedef struct SQueryTableDataCond { int64_t endVersion; } SQueryTableDataCond; -void* blockDataDestroy(SSDataBlock* pBlock); int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock); void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock); @@ -170,19 +169,6 @@ int32_t tEncodeDataBlocks(void** buf, const SArray* blocks); void* tDecodeDataBlocks(const void* buf, SArray** blocks); void colDataDestroy(SColumnInfoData* pColData); -static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) { - int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock); - for (int32_t i = 0; i < numOfOutput; ++i) { - SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); - colDataDestroy(pColInfoData); - } - - taosArrayDestroy(pBlock->pDataBlock); - taosMemoryFreeClear(pBlock->pBlockAgg); -} - -static FORCE_INLINE void tDeleteSSDataBlock(SSDataBlock* pBlock) { blockDestroyInner(pBlock); } - //====================================================================================================================== // the following structure shared by parser and executor typedef struct SColumn { diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index af333f72aa..a4f5904018 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -226,8 +226,12 @@ int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n); int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src); int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src); -SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData); + SSDataBlock* createDataBlock(); +void* blockDataDestroy(SSDataBlock* pBlock); +void blockDataFreeRes(SSDataBlock* pBlock); +SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData); + int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData); SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId); diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index a08db7b8f8..071c539ff3 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -340,12 +340,12 @@ static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBloc if (pTask->sinkType == TASK_SINK__TABLE) { ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE); pTask->tbSink.tbSinkFunc(pTask, pTask->tbSink.vnode, 0, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); } else if (pTask->sinkType == TASK_SINK__SMA) { ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE); pTask->smaSink.smaSink(pTask->smaSink.vnode, pTask->smaSink.smaId, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); } else { ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 9f5a247d76..47cfa5d410 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1197,15 +1197,28 @@ int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) { return TSDB_CODE_SUCCESS; } +void blockDataFreeRes(SSDataBlock* pBlock) { + int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock); + for (int32_t i = 0; i < numOfOutput; ++i) { + SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); + colDataDestroy(pColInfoData); + } + + taosArrayDestroy(pBlock->pDataBlock); + taosMemoryFreeClear(pBlock->pBlockAgg); + memset(&pBlock->info, 0, sizeof(SDataBlockInfo)); +} + void* blockDataDestroy(SSDataBlock* pBlock) { if (pBlock == NULL) { return NULL; } - blockDestroyInner(pBlock); + blockDataFreeRes(pBlock); taosMemoryFreeClear(pBlock); return NULL; } + int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { ASSERT(src != NULL); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 8753ecc47c..a7ad935caa 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -319,7 +319,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { return 0; FAIL: - tDeleteSSDataBlock(pBlock); + blockDataFreeRes(pBlock); return -1; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 4aaa80d3ae..5e30fcd5b2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -209,10 +209,10 @@ static void resetDataBlockScanInfo(SHashObj* pTableMap) { p->iterInit = false; p->iiter.hasVal = false; if (p->iter.iter != NULL) { - tsdbTbDataIterDestroy(p->iter.iter); + p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter); } - taosArrayDestroy(p->delSkyline); + p->delSkyline = taosArrayDestroy(p->delSkyline); } } @@ -224,18 +224,15 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) { p->iiter.hasVal = false; if (p->iter.iter != NULL) { - tsdbTbDataIterDestroy(p->iter.iter); - p->iter.iter = NULL; + p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter); } if (p->iiter.iter != NULL) { - tsdbTbDataIterDestroy(p->iiter.iter); - p->iiter.iter = NULL; + p->iiter.iter = tsdbTbDataIterDestroy(p->iiter.iter); } - taosArrayDestroy(p->delSkyline); - taosArrayDestroy(p->pBlockList); - p->delSkyline = NULL; + p->delSkyline = taosArrayDestroy(p->delSkyline); + p->pBlockList = taosArrayDestroy(p->pBlockList); } taosHashCleanup(pTableMap); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 701002d0e7..1d309931d6 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1193,8 +1193,6 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock } } - taosArrayDestroy(pBlock->pDataBlock); - ASSERT(pInfo->pRes->pDataBlock != NULL); // currently only the tbname pseudo column @@ -1202,12 +1200,14 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, pInfo->pRes, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { + blockDataFreeRes((SSDataBlock*) pBlock); longjmp(pTaskInfo->env, code); } } doFilter(pInfo->pCondition, pInfo->pRes); blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); + blockDataFreeRes((SSDataBlock*) pBlock); return 0; } diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 959c03a3b1..e0bdcfdc3a 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -71,13 +71,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SPoint point1, point2, point; int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order); - // set the primary timestamp column value - int32_t index = pFillInfo->numOfCurrent; - SColumnInfoData* pCol0 = taosArrayGet(pBlock->pDataBlock, pFillInfo->tsSlotId); - char* val = colDataGetData(pCol0, index); - - // set the primary timestamp value - *(TSKEY*)val = pFillInfo->currentKey; +// set the primary timestamp column value + int32_t index = pFillInfo->numOfCurrent; // set the other values if (pFillInfo->type == TSDB_FILL_PREV) { @@ -92,7 +87,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { - colDataAppend(pDstColInfoData, index, (const char*)&ts, false); + colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false); } else { SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstColInfoData, index, pKey); @@ -101,41 +96,51 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* } else if (pFillInfo->type == TSDB_FILL_NEXT) { SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next : pFillInfo->prev; // todo refactor: start from 0 not 1 - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag)) { continue; } - SGroupKeys* pKey = taosArrayGet(p, i); SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); - doSetVal(pDstColInfoData, index, pKey); + + if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { + colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false); + } else { + SGroupKeys* pKey = taosArrayGet(p, i); + doSetVal(pDstColInfoData, index, pKey); + } } } else if (pFillInfo->type == TSDB_FILL_LINEAR) { // TODO : linear interpolation supports NULL value if (outOfBound) { setNullRow(pBlock, pFillInfo->currentKey, index); } else { - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag)) { continue; } - int32_t srcSlotId = GET_SRC_SLOT_ID(pCol); - int32_t dstSlotId = GET_DEST_SLOT_ID(pCol); SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); - int16_t type = pCol->pExpr->base.resSchema.type; + int16_t type = pDstCol->info.type; + if (type == TSDB_DATA_TYPE_TIMESTAMP) { + colDataAppend(pDstCol, index, (const char*)&pFillInfo->currentKey, false); + continue; + } + SGroupKeys* pKey = taosArrayGet(pFillInfo->prev, i); if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pKey->isNull) { colDataAppendNULL(pDstCol, index); continue; } - SGroupKeys* pKey1 = taosArrayGet(pFillInfo->prev, 0); - int64_t prevTs = *(int64_t*)pKey1->pData; + SGroupKeys* pKey1 = taosArrayGet(pFillInfo->prev, pFillInfo->tsSlotId); + + int64_t prevTs = *(int64_t*)pKey1->pData; + int32_t srcSlotId = GET_SRC_SLOT_ID(pCol); SColumnInfoData* pSrcCol = taosArrayGet(pSrcBlock->pDataBlock, srcSlotId); char* data = colDataGetData(pSrcCol, pFillInfo->index); @@ -153,7 +158,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* } else if (pFillInfo->type == TSDB_FILL_NULL) { // fill with NULL setNullRow(pBlock, pFillInfo->currentKey, index); } else { // fill with user specified value for each column - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag) /* || IS_VAR_DATA_TYPE(pCol->schema.type)*/) { continue; @@ -176,6 +181,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* colDataAppend(pDst, index, (char*)&v, false); } else if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) { colDataAppend(pDst, index, (const char*)&pFillInfo->currentKey, false); + } else { // varchar/nchar data + colDataAppendNULL(pDst, index); } } } @@ -234,8 +241,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t outputRows) { pFillInfo->numOfCurrent = 0; - // todo make sure the first column is always the primary timestamp column? - SColumnInfoData* pTsCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, 0); + SColumnInfoData* pTsCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->tsSlotId); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order); bool ascFill = FILL_IS_ASC_FILL(pFillInfo); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index a412b589a9..fd9b588d46 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -296,8 +296,8 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { switch (call->callType) { case TSDB_UDF_CALL_SCALA_PROC: { - tDeleteSSDataBlock(&call->block); - tDeleteSSDataBlock(&subRsp->resultData); + blockDataFreeRes(&call->block); + blockDataFreeRes(&subRsp->resultData); break; } case TSDB_UDF_CALL_AGG_INIT: { @@ -305,7 +305,7 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { break; } case TSDB_UDF_CALL_AGG_PROC: { - tDeleteSSDataBlock(&call->block); + blockDataFreeRes(&call->block); freeUdfInterBuf(&subRsp->resultBuf); break; } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 2b3307b7f5..8e16b23e56 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -116,7 +116,7 @@ void streamFreeQitem(SStreamQueueItem* data) { blockDataDestroy(((SStreamTrigger*)data)->pBlock); taosFreeQitem(data); } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE) { - taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(data); } else if (type == STREAM_INPUT__DATA_SUBMIT) { streamDataSubmitRefDec((SStreamDataSubmit*)data); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 05efce8bc2..e2faf28abe 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -313,7 +313,7 @@ int32_t streamDispatch(SStreamTask* pTask, SMsgCb* pMsgCb) { atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); return -1; } - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); tmsgSendReq(pEpSet, &dispatchMsg); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index d0d81e3343..023c092028 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -106,7 +106,7 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { qDebug("stream task %d exec end", pTask->taskId); if (pTask->taskStatus == TASK_STATUS__DROPPING) { - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); return NULL; } @@ -121,7 +121,7 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { qRes->blocks = pRes; if (streamTaskOutput(pTask, qRes) < 0) { /*streamQueueProcessFail(pTask->inputQueue);*/ - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); taosFreeQitem(qRes); return NULL; } @@ -155,7 +155,7 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb) { pRes = streamExecForQall(pTask, pRes); if (pRes == NULL) goto FAIL; - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE); qDebug("stream exec, return result"); return 0; @@ -163,7 +163,7 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb) { continue; } else if (execStatus == TASK_EXEC_STATUS__EXECUTING) { ASSERT(taosArrayGetSize(pRes) == 0); - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); return 0; } else { ASSERT(0); From 4849b0cb78a17395a5443c5da5213b5ff48be374 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Thu, 14 Jul 2022 13:58:23 +0800 Subject: [PATCH 91/92] test: fix win test error --- cmake/cmake.options | 8 +++++++- include/os/osDef.h | 10 +++++++++- tests/pytest/util/dnodes.py | 24 ++++++++++++------------ tests/script/sh/exec.bat | 7 +++++-- tests/script/test-all.bat | 2 +- tests/script/wtest.bat | 3 ++- tests/system-test/test.py | 19 ++++++++++++++++++- 7 files changed, 54 insertions(+), 19 deletions(-) diff --git a/cmake/cmake.options b/cmake/cmake.options index e013ff7592..2acd46694b 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -79,10 +79,16 @@ ENDIF () option( BUILD_SANITIZER - "If build addr2line" + "If build sanitizer" OFF ) +option( + TDENGINE_3 + "TDengine 3.x" + ON + ) + option( BUILD_ADDR2LINE "If build addr2line" diff --git a/include/os/osDef.h b/include/os/osDef.h index 6f6199de7a..14f38eb7ff 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -22,7 +22,10 @@ extern "C" { #if defined(_TD_DARWIN_64) // specific +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int(*__compar_fn_t)(const void *, const void *); +#endif // for send function in tsocket.c #if defined(MSG_NOSIGNAL) @@ -41,7 +44,10 @@ extern "C" { #endif #if defined(_ALPINE) +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int(*__compar_fn_t)(const void *, const void *); +#endif void error (int, int, const char *); #ifndef PTHREAD_MUTEX_RECURSIVE_NP #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE @@ -54,7 +60,10 @@ extern "C" { char *stpncpy (char *dest, const char *src, size_t n); // specific +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int (*__compar_fn_t)(const void *, const void *); +#endif #define ssize_t int #define _SSIZE_T_ #define bzero(ptr, size) memset((ptr), 0, (size)) @@ -69,7 +78,6 @@ extern "C" { char * strsep(char **stringp, const char *delim); char * getpass(const char *prefix); char * strndup(const char *s, size_t n); - int gettimeofday(struct timeval *ptv, void *pTimeZone); // for send function in tsocket.c #define MSG_NOSIGNAL 0 diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index a38b14a52d..96723978ae 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -382,7 +382,7 @@ class TDDnode: if self.valgrind == 0: if platform.system().lower() == 'windows': - cmd = "mintty -h never -w hide %s -c %s" % ( + cmd = "mintty -h never %s -c %s" % ( binPath, self.cfgDir) else: cmd = "nohup %s -c %s > /dev/null 2>&1 & " % ( @@ -391,7 +391,7 @@ class TDDnode: valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir if platform.system().lower() == 'windows': - cmd = "mintty -h never -w hide %s %s -c %s" % ( + cmd = "mintty -h never %s %s -c %s" % ( valgrindCmdline, binPath, self.cfgDir) else: cmd = "nohup %s %s -c %s 2>&1 & " % ( @@ -518,20 +518,20 @@ class TDDnode: if self.running != 0: if platform.system().lower() == 'windows': - os.system("wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId | xargs echo | awk '{print $2}' | xargs taskkill -f -pid"%self.index) + psCmd = "for /f %a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^'') do @(ps | grep %a | awk '{print $1}' | xargs kill -INT )" % (self.index) else: psCmd = "ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}'" % (toBeKilled,self.index) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + + while(processID): + killCmd = "kill -INT %s > /dev/null 2>&1" % processID + os.system(killCmd) + time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") - - while(processID): - killCmd = "kill -INT %s > /dev/null 2>&1" % processID - os.system(killCmd) - time.sleep(1) - processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") - if self.valgrind: - time.sleep(2) + if self.valgrind: + time.sleep(2) self.running = 0 tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index)) diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index e4c998c25b..88dd43349e 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -77,7 +77,10 @@ goto :eof :check_offline sleep 1 for /f "tokens=2" %%C in ('wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" get processId ^| xargs echo') do ( - echo check taosd offline - goto :check_offline + for /f "tokens=1" %%D in ('ps ^| grep %%C') do ( + echo kill -INT %%D + echo check taosd offline %NODE_NAME% %%C %%D + goto :check_offline + ) ) goto :eof \ No newline at end of file diff --git a/tests/script/test-all.bat b/tests/script/test-all.bat index f771f8fcb6..056d989e6b 100644 --- a/tests/script/test-all.bat +++ b/tests/script/test-all.bat @@ -24,7 +24,7 @@ for /F "usebackq tokens=*" %%i in (!caseFile!) do ( ) ) ) -exit !exitNum! +exit /b !exitNum! :colorEcho set timeNow=%time% diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index e3bbff9db5..f674277df9 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -44,9 +44,10 @@ echo serverPort 7100 >> %TAOS_CFG% echo logDir %LOG_DIR% >> %TAOS_CFG% echo scriptDir %SCRIPT_DIR% >> %TAOS_CFG% echo numOfLogLines 100000000 >> %TAOS_CFG% -echo rpcDebugFlag 135 >> %TAOS_CFG% +echo rpcDebugFlag 143 >> %TAOS_CFG% echo tmrDebugFlag 131 >> %TAOS_CFG% echo cDebugFlag 135 >> %TAOS_CFG% +echo qDebugFlag 143 >> %TAOS_CFG% echo udebugFlag 135 >> %TAOS_CFG% echo wal 0 >> %TAOS_CFG% echo asyncLog 0 >> %TAOS_CFG% diff --git a/tests/system-test/test.py b/tests/system-test/test.py index fd0979745e..b893f7af64 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -37,12 +37,13 @@ def checkRunTimeError(): time.sleep(1) timeCount = timeCount + 1 print("checkRunTimeError",timeCount) - if (timeCount>900): + if (timeCount>600): print("stop the test.") os.system("TASKKILL /F /IM taosd.exe") os.system("TASKKILL /F /IM taos.exe") os.system("TASKKILL /F /IM tmq_sim.exe") os.system("TASKKILL /F /IM mintty.exe") + os.system("TASKKILL /F /IM python.exe") quit(0) hwnd = win32gui.FindWindow(None, "Microsoft Visual C++ Runtime Library") if hwnd: @@ -228,6 +229,22 @@ if __name__ == "__main__": tdDnodes.deploy(1,updateCfgDict) tdDnodes.start(1) tdCases.logSql(logSql) + if queryPolicy != 1: + queryPolicy=int(queryPolicy) + conn = taos.connect( + host, + config=tdDnodes.getSimCfgPath()) + tdSql.init(conn.cursor()) + tdSql.execute("create qnode on dnode 1") + tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy) + tdSql.query("show local variables;") + for i in range(tdSql.queryRows): + if tdSql.queryResult[i][0] == "queryPolicy" : + if int(tdSql.queryResult[i][1]) == int(queryPolicy): + tdLog.success('alter queryPolicy to %d successfully'%queryPolicy) + else : + tdLog.debug(tdSql.queryResult) + tdLog.exit("alter queryPolicy to %d failed"%queryPolicy) else : tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums,mnodeNums=mnodeNums) From 869f2729707b64404f3a915fad367eb4f6dfd321 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 14 Jul 2022 15:05:39 +0800 Subject: [PATCH 92/92] test: modify case --- tests/system-test/7-tmq/dataFromTsdbNWal.py | 19 +++++++++---------- tests/system-test/7-tmq/tmqCommon.py | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/system-test/7-tmq/dataFromTsdbNWal.py b/tests/system-test/7-tmq/dataFromTsdbNWal.py index a55fbbfd18..227ce9d5a5 100644 --- a/tests/system-test/7-tmq/dataFromTsdbNWal.py +++ b/tests/system-test/7-tmq/dataFromTsdbNWal.py @@ -38,9 +38,9 @@ class TDTestCase: 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, - 'ctbNum': 10, + 'ctbNum': 100, 'rowsPerTbl': 10000, - 'batchNum': 1000, + 'batchNum': 3000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 10, 'showMsg': 1, @@ -64,9 +64,7 @@ class TDTestCase: ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - tdLog.info("restart taosd to ensure that the data falls into the disk") - # tdDnodes.stop(1) - # tdDnodes.start(1) + tdLog.info("flush db to let data falls into the disk") tdSql.query("flush database %s"%(paraDict['dbName'])) return @@ -85,7 +83,7 @@ class TDTestCase: 'ctbStartIdx': 0, 'ctbNum': 10, 'rowsPerTbl': 10000, - 'batchNum': 10, + 'batchNum': 100, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -95,8 +93,6 @@ class TDTestCase: paraDict['vgroups'] = self.vgroups paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl - paraDict['batchNum'] = 100 - paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl topicNameList = ['topic1'] expectRowsList = [] @@ -125,6 +121,8 @@ class TDTestCase: tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) # after start consume, continue insert some data + paraDict['batchNum'] = 100 + paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) @@ -137,11 +135,12 @@ class TDTestCase: expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) if expectRowsList[0] != resultList[0]: - tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("%d tmq consume rows error!"%consumerId) - tmqCom.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 98c9e37132..060e17c11f 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -444,6 +444,7 @@ class TMQCom: # skip first line for it is schema queryFile.readline() + lines = 0 while True: dst = queryFile.readline()