diff --git a/cmake/cmake.define b/cmake/cmake.define index 53d25e1097..e875a0d306 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -3,12 +3,6 @@ cmake_minimum_required(VERSION 3.16) if (NOT DEFINED TD_GRANT) SET(TD_GRANT FALSE) endif() -if (NOT DEFINED TD_USB_DONGLE) - SET(TD_USB_DONGLE FALSE) -endif() -IF (TD_GRANT) - ADD_DEFINITIONS(-D_GRANT) -ENDIF () IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 0137b71479..63ebbd9879 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -171,60 +171,69 @@ #define TK_BUFSIZE 153 #define TK_STREAM 154 #define TK_INTO 155 -#define TK_KILL 156 -#define TK_CONNECTION 157 -#define TK_MERGE 158 -#define TK_VGROUP 159 -#define TK_REDISTRIBUTE 160 -#define TK_SPLIT 161 -#define TK_SYNCDB 162 -#define TK_NULL 163 -#define TK_FIRST 164 -#define TK_LAST 165 -#define TK_NOW 166 -#define TK_TODAY 167 -#define TK_CAST 168 -#define TK_ROWTS 169 -#define TK_TBNAME 170 -#define TK_QSTARTTS 171 -#define TK_QENDTS 172 -#define TK_WSTARTTS 173 -#define TK_WENDTS 174 -#define TK_WDURATION 175 -#define TK_BETWEEN 176 -#define TK_IS 177 -#define TK_NK_LT 178 -#define TK_NK_GT 179 -#define TK_NK_LE 180 -#define TK_NK_GE 181 -#define TK_NK_NE 182 -#define TK_MATCH 183 -#define TK_NMATCH 184 -#define TK_JOIN 185 -#define TK_INNER 186 -#define TK_SELECT 187 -#define TK_DISTINCT 188 -#define TK_WHERE 189 -#define TK_PARTITION 190 -#define TK_BY 191 -#define TK_SESSION 192 -#define TK_STATE_WINDOW 193 -#define TK_SLIDING 194 -#define TK_FILL 195 -#define TK_VALUE 196 -#define TK_NONE 197 -#define TK_PREV 198 -#define TK_LINEAR 199 -#define TK_NEXT 200 -#define TK_GROUP 201 -#define TK_HAVING 202 -#define TK_ORDER 203 -#define TK_SLIMIT 204 -#define TK_SOFFSET 205 -#define TK_LIMIT 206 -#define TK_OFFSET 207 -#define TK_ASC 208 -#define TK_NULLS 209 +#define TK_TRIGGER 156 +#define TK_AT_ONCE 157 +#define TK_WINDOW_CLOSE 158 +#define TK_WATERMARK 159 +#define TK_KILL 160 +#define TK_CONNECTION 161 +#define TK_MERGE 162 +#define TK_VGROUP 163 +#define TK_REDISTRIBUTE 164 +#define TK_SPLIT 165 +#define TK_SYNCDB 166 +#define TK_NULL 167 +#define TK_NK_QUESTION 168 +#define TK_NK_ARROW 169 +#define TK_ROWTS 170 +#define TK_TBNAME 171 +#define TK_QSTARTTS 172 +#define TK_QENDTS 173 +#define TK_WSTARTTS 174 +#define TK_WENDTS 175 +#define TK_WDURATION 176 +#define TK_CAST 177 +#define TK_NOW 178 +#define TK_TODAY 179 +#define TK_COUNT 180 +#define TK_FIRST 181 +#define TK_LAST 182 +#define TK_LAST_ROW 183 +#define TK_BETWEEN 184 +#define TK_IS 185 +#define TK_NK_LT 186 +#define TK_NK_GT 187 +#define TK_NK_LE 188 +#define TK_NK_GE 189 +#define TK_NK_NE 190 +#define TK_MATCH 191 +#define TK_NMATCH 192 +#define TK_CONTAINS 193 +#define TK_JOIN 194 +#define TK_INNER 195 +#define TK_SELECT 196 +#define TK_DISTINCT 197 +#define TK_WHERE 198 +#define TK_PARTITION 199 +#define TK_BY 200 +#define TK_SESSION 201 +#define TK_STATE_WINDOW 202 +#define TK_SLIDING 203 +#define TK_FILL 204 +#define TK_VALUE 205 +#define TK_NONE 206 +#define TK_PREV 207 +#define TK_LINEAR 208 +#define TK_NEXT 209 +#define TK_GROUP 210 +#define TK_HAVING 211 +#define TK_ORDER 212 +#define TK_SLIMIT 213 +#define TK_SOFFSET 214 +#define TK_LIMIT 215 +#define TK_OFFSET 216 +#define TK_ASC 217 +#define TK_NULLS 218 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -233,7 +242,6 @@ #define TK_NK_OCT 304 // oct number #define TK_NK_BIN 305 // bin format data 0b111 #define TK_NK_FILE 306 -#define TK_NK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query #define TK_NK_BITNOT 501 #define TK_INSERT 502 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 992b99df60..22bbc36ee1 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -137,6 +137,7 @@ bool fmIsWindowPseudoColumnFunc(int32_t funcId); bool fmIsWindowClauseFunc(int32_t funcId); bool fmIsSpecialDataRequiredFunc(int32_t funcId); bool fmIsDynamicScanOptimizedFunc(int32_t funcId); +bool fmIsMultiResFunc(int32_t funcId); typedef enum EFuncDataRequired { FUNC_DATA_REQUIRED_DATA_LOAD = 1, diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e1a63bd66b..6810b63f4e 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -272,6 +272,33 @@ typedef struct SKillStmt { int32_t targetId; } SKillStmt; +typedef enum EStreamTriggerType { + STREAM_TRIGGER_AT_ONCE = 1, + STREAM_TRIGGER_WINDOW_CLOSE +} EStreamTriggerType; + +typedef struct SStreamOptions { + ENodeType type; + EStreamTriggerType triggerType; + SNode* pWatermark; +} SStreamOptions; + +typedef struct SCreateStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + char targetDbName[TSDB_DB_NAME_LEN]; + char targetTabName[TSDB_TABLE_NAME_LEN]; + bool ignoreExists; + SStreamOptions* pOptions; + SNode* pQuery; +} SCreateStreamStmt; + +typedef struct SDropStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + bool ignoreNotExists; +} SDropStreamStmt; + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 02636a178e..8db93ee5f9 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -80,6 +80,7 @@ typedef enum ENodeType { QUERY_NODE_TABLE_OPTIONS, QUERY_NODE_INDEX_OPTIONS, QUERY_NODE_EXPLAIN_OPTIONS, + QUERY_NODE_STREAM_OPTIONS, // Statement nodes are used in parser and planner module. QUERY_NODE_SET_OPERATOR, @@ -151,6 +152,12 @@ typedef enum ENodeType { QUERY_NODE_SHOW_CONNECTIONS_STMT, QUERY_NODE_SHOW_QUERIES_STMT, QUERY_NODE_SHOW_VNODES_STMT, + QUERY_NODE_SHOW_APPS_STMT, + QUERY_NODE_SHOW_SCORES_STMT, + QUERY_NODE_SHOW_VARIABLE_STMT, + QUERY_NODE_SHOW_CREATE_DATABASE_STMT, + QUERY_NODE_SHOW_CREATE_TABLE_STMT, + QUERY_NODE_SHOW_CREATE_STABLE_STMT, QUERY_NODE_KILL_CONNECTION_STMT, QUERY_NODE_KILL_QUERY_STMT, diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 2730723a17..53b0fec8ff 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -662,7 +662,7 @@ TEST(testCase, agg_query_tables) { TAOS_RES* pRes = taos_query(pConn, "use abc1"); taos_free_result(pRes); - pRes = taos_query(pConn, "select * from test_block_raw.all_type"); + pRes = taos_query(pConn, "select count(*) from tu"); if (taos_errno(pRes) != 0) { printf("failed to select from table, reason:%s\n", taos_errstr(pRes)); taos_free_result(pRes); @@ -674,9 +674,6 @@ TEST(testCase, agg_query_tables) { int32_t numOfFields = taos_num_fields(pRes); int32_t n = 0; - void* data = NULL; - int32_t code = taos_fetch_raw_block(pRes, &n, &data); - char str[512] = {0}; while ((pRow = taos_fetch_row(pRes)) != NULL) { int32_t* length = taos_fetch_lengths(pRes); diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index ef75adeb5d..cb8746c963 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -377,7 +377,7 @@ tDataTypeDescriptor tDataTypes[15] = { getStatics_i64}, {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", 0, 0, tsCompressFloat, tsDecompressFloat, getStatics_f}, {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", 0, 0, tsCompressDouble, tsDecompressDouble, getStatics_d}, - {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, + {TSDB_DATA_TYPE_VARCHAR, 6, 0, "VARCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", INT64_MIN, INT64_MAX, tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_nchr}, @@ -402,7 +402,7 @@ char tTokenTypeSwitcher[13] = { TSDB_DATA_TYPE_DOUBLE, // TK_DOUBLE TSDB_DATA_TYPE_BINARY, // TK_STRING TSDB_DATA_TYPE_BIGINT, // TK_TIMESTAMP - TSDB_DATA_TYPE_BINARY, // TK_BINARY + TSDB_DATA_TYPE_VARCHAR, // TK_BINARY TSDB_DATA_TYPE_NCHAR, // TK_NCHAR }; diff --git a/source/dnode/mgmt/implement/CMakeLists.txt b/source/dnode/mgmt/implement/CMakeLists.txt index 26c14edc77..fbe7530395 100644 --- a/source/dnode/mgmt/implement/CMakeLists.txt +++ b/source/dnode/mgmt/implement/CMakeLists.txt @@ -6,12 +6,4 @@ target_link_libraries( target_include_directories( dnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) - -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(dnode grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(dnode usb_dongle) -else() -ENDIF () \ No newline at end of file +) \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 484b6646b5..925197d708 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -91,9 +91,9 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->keep = pCreate->daysToKeep0; pCfg->streamMode = pCreate->streamMode; pCfg->isWeak = true; - pCfg->tsdbCfg.keep = pCreate->daysToKeep0; - pCfg->tsdbCfg.keep1 = pCreate->daysToKeep2; pCfg->tsdbCfg.keep2 = pCreate->daysToKeep0; + pCfg->tsdbCfg.keep0 = pCreate->daysToKeep2; + pCfg->tsdbCfg.keep1 = pCreate->daysToKeep0; pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; pCfg->tsdbCfg.retentions = pCreate->pRetensions; pCfg->metaCfg.lruSize = pCreate->cacheBlockSize; @@ -121,6 +121,8 @@ static void vmGenerateWrapperCfg(SVnodesMgmt *pMgmt, SCreateVnodeReq *pCreate, S int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { SRpcMsg *pReq = &pMsg->rpcMsg; SCreateVnodeReq createReq = {0}; + char path[TSDB_FILENAME_LEN]; + if (tDeserializeSCreateVnodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; @@ -143,6 +145,14 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { return -1; } + // create vnode + snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vnodeCfg.vgId); + if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) { + tFreeSCreateVnodeReq(&createReq); + dError("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr()); + return -1; + } + SMsgCb msgCb = pMgmt->pDnode->data.msgCb; msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 8cb5e2a528..a4bd12a7f7 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -12,8 +12,8 @@ target_link_libraries( IF (TD_GRANT) TARGET_LINK_LIBRARIES(mnode grant) ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(mnode usb_dongle) +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) ENDIF () if(${BUILD_TEST}) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index c0b25d74d1..146c6e2523 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -27,7 +27,7 @@ void mndCleanupDb(SMnode *pMnode); SDbObj *mndAcquireDb(SMnode *pMnode, const char *db); void mndReleaseDb(SMnode *pMnode, SDbObj *pDb); int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, void **ppRsp, int32_t *pRspLen); -char *mnGetDbStr(char *src); +char *mndGetDbStr(char *src); int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUseDbReq *pReq); #ifdef __cplusplus diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 43d5814ffb..6c797b9044 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1342,7 +1342,7 @@ SYNC_DB_OVER: return code; } -char *mnGetDbStr(char *src) { +char *mndGetDbStr(char *src) { char *pos = strstr(src, TS_PATH_DELIMITER); if (pos != NULL) ++pos; @@ -1357,7 +1357,7 @@ static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, in int32_t cols = 0; char* buf = taosMemoryMalloc(pShow->bytes[cols]); - char *name = mnGetDbStr(pDb->name); + char *name = mndGetDbStr(pDb->name); if (name != NULL) { STR_WITH_MAXSIZE_TO_VARSTR(buf, name, pShow->bytes[cols]); } else { diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index 55eb1ca4bd..f626332fc2 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -82,7 +82,7 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "wallevel", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, + {.name = "wal", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, @@ -95,11 +95,13 @@ static const SInfosTableSchema userDBSchema[] = { }; static const SInfosTableSchema userFuncSchema[] = { - {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "name", .bytes = TSDB_FUNC_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "comment", .bytes = PATH_MAX - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "aggregate", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "comment", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "code_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema userIdxSchema[] = { diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 617cebf61d..1a14c94640 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -131,6 +131,13 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { req.type = retrieveReq.type; strncpy(req.db, retrieveReq.db, tListLen(req.db)); + STableMetaRsp *pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + if (pMeta == NULL) { + terrno = TSDB_CODE_MND_INVALID_INFOS_TBL; + mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); + return -1; + } + pShow = mndCreateShowObj(pMnode, &req); if (pShow == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -138,7 +145,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { return -1; } - pShow->pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + pShow->pMeta = pMeta; pShow->numOfColumns = pShow->pMeta->numOfColumns; int32_t offset = 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 537ddc03c3..59fe7d16b9 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -58,7 +58,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans); static int32_t mndProcessTransReq(SNodeMsg *pReq); static int32_t mndProcessKillTransReq(SNodeMsg *pReq); -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter); int32_t mndInitTrans(SMnode *pMnode) { @@ -73,7 +73,7 @@ int32_t mndInitTrans(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq); mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq); -// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans); return sdbSetTable(pMnode->pSdb, table); } @@ -1259,7 +1259,7 @@ void mndTransPullup(SMnode *pMnode) { sdbWriteFile(pMnode->pSdb); } -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -1273,34 +1273,34 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pTrans->id; - cols++; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransStr(pTrans->stage)); - cols++; + char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)stage, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - char *name = mnGetDbStr(pTrans->dbname); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]); - cols++; + char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)dbname, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransType(pTrans->transType)); - cols++; + char transType[TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndTransType(pTrans->transType), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)transType, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->lastExecTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, pTrans->lastError); - cols++; + char lastError[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, pTrans->lastError, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)lastError, false); numOfRows++; sdbRelease(pSdb, pTrans); diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 9b669b303a..15f2aed22a 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -1,17 +1,17 @@ enable_testing() -#add_subdirectory(user) add_subdirectory(acct) -#add_subdirectory(trans) -#add_subdirectory(qnode) -#add_subdirectory(snode) add_subdirectory(bnode) -#add_subdirectory(show) -#add_subdirectory(profile) -#add_subdirectory(dnode) -#add_subdirectory(mnode) -#add_subdirectory(db) -#add_subdirectory(stb) -#add_subdirectory(sma) -#add_subdirectory(func) -#add_subdirectory(topic) +add_subdirectory(db) +add_subdirectory(dnode) +add_subdirectory(func) +add_subdirectory(mnode) +add_subdirectory(profile) +add_subdirectory(qnode) +add_subdirectory(show) +add_subdirectory(sma) +add_subdirectory(snode) +add_subdirectory(stb) +add_subdirectory(topic) +add_subdirectory(trans) +add_subdirectory(user) diff --git a/source/dnode/mnode/impl/test/db/CMakeLists.txt b/source/dnode/mnode/impl/test/db/CMakeLists.txt index 1a5b4d3936..3f6a80835f 100644 --- a/source/dnode/mnode/impl/test/db/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/db/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_db -# COMMAND mnode_test_db -#) +add_test( + NAME dbTest + COMMAND dbTest +) diff --git a/source/dnode/mnode/impl/test/db/db.cpp b/source/dnode/mnode/impl/test/db/db.cpp index 0282663b17..adba6ca434 100644 --- a/source/dnode/mnode/impl/test/db/db.cpp +++ b/source/dnode/mnode/impl/test/db/db.cpp @@ -26,29 +26,8 @@ class MndTestDb : public ::testing::Test { Testbase MndTestDb::test; TEST_F(MndTestDb, 01_ShowDb) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vgroups"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "ntables"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_SMALLINT, 2, "replica"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_SMALLINT, 2, "quorum"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_SMALLINT, 2, "days"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "keep0,keep1,keep2"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "cache"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_INT, 4, "blocks"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_INT, 4, "minrows"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "maxrows"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_TINYINT, 1, "wallevel"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_INT, 4, "fsync"); - CHECK_SCHEMA(14, TSDB_DATA_TYPE_TINYINT, 1, "comp"); - CHECK_SCHEMA(15, TSDB_DATA_TYPE_TINYINT, 1, "cachelast"); - CHECK_SCHEMA(16, TSDB_DATA_TYPE_BINARY, 3 + VARSTR_HEADER_SIZE, "precision"); -// CHECK_SCHEMA(17, TSDB_DATA_TYPE_TINYINT, 1, "update"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { @@ -58,7 +37,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -66,6 +45,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -74,6 +54,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -84,47 +67,11 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // ntables - CheckInt16(1); // replica - CheckInt16(1); // quorum - CheckInt16(10); // days - CheckBinary("3650,3650,3650", 24); // days - CheckInt32(16); // cache - CheckInt32(10); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(1); // wallevel - CheckInt32(3000); // fsync - CheckInt8(2); // comp - CheckInt8(0); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update - - test.SendShowMetaReq(TSDB_MGMT_TABLE_VGROUP, "1.d1"); - CHECK_META("show vgroups", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "vgId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "tables"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "v1_dnode"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, 9 + VARSTR_HEADER_SIZE, "v1_status"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_VGROUP, "vgroups", "1.d1"); EXPECT_EQ(test.GetShowRows(), 2); - CheckInt32(2); - CheckInt32(3); - IgnoreInt32(); - IgnoreInt32(); - CheckInt16(1); - CheckInt16(1); - CheckBinary("master", 9); - CheckBinary("master", 9); { SAlterDbReq alterdbReq = {0}; @@ -147,55 +94,14 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); { SDropDbReq dropdbReq = {0}; @@ -214,11 +120,8 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { EXPECT_STREQ(dropdbRsp.db, "1.d1"); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { @@ -228,7 +131,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -236,6 +139,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -244,6 +148,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -254,12 +161,8 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d2", TSDB_DB_NAME_LEN - 1); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); uint64_t d2_uid = 0; diff --git a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt index 16e08d6c35..d064df90bc 100644 --- a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_dnode -# COMMAND mnode_test_dnode -#) +add_test( + NAME mdnodeTest + COMMAND mdnodeTest +) diff --git a/source/dnode/mnode/impl/test/dnode/mdnode.cpp b/source/dnode/mnode/impl/test/dnode/mdnode.cpp index f575556345..a4cbc201a9 100644 --- a/source/dnode/mnode/impl/test/dnode/mdnode.cpp +++ b/source/dnode/mnode/impl/test/dnode/mdnode.cpp @@ -51,27 +51,8 @@ TestServer MndTestDnode::server4; TestServer MndTestDnode::server5; TEST_F(MndTestDnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vnodes"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_SMALLINT, 2, "support_vnodes"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "status"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "offline_reason"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); } TEST_F(MndTestDnode, 02_ConfigDnode) { @@ -162,25 +143,8 @@ TEST_F(MndTestDnode, 03_Create_Dnode) { taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9024", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); } TEST_F(MndTestDnode, 04_Drop_Dnode) { @@ -236,19 +200,9 @@ TEST_F(MndTestDnode, 04_Drop_Dnode) { ASSERT_EQ(pRsp->code, TSDB_CODE_MND_DNODE_NOT_EXIST); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); - taosMsleep(2000); server2.Stop(); server2.DoStart(); @@ -298,40 +252,9 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { } taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - // restart uInfo("stop all server"); test.Restart(); @@ -341,37 +264,6 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { server5.Restart(); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); } diff --git a/source/dnode/mnode/impl/test/func/CMakeLists.txt b/source/dnode/mnode/impl/test/func/CMakeLists.txt index 26b0a60968..ecb4f851be 100644 --- a/source/dnode/mnode/impl/test/func/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/func/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. FUNC_SRC) -add_executable(mnode_test_func ${FUNC_SRC}) +aux_source_directory(. MNODE_FUNC_TEST_SRC) +add_executable(funcTest ${MNODE_FUNC_TEST_SRC}) target_link_libraries( - mnode_test_func + funcTest PUBLIC sut ) add_test( - NAME mnode_test_func - COMMAND mnode_test_func + NAME funcTest + COMMAND funcTest ) diff --git a/source/dnode/mnode/impl/test/func/func.cpp b/source/dnode/mnode/impl/test/func/func.cpp index f34f77de0c..6b9c410738 100644 --- a/source/dnode/mnode/impl/test/func/func.cpp +++ b/source/dnode/mnode/impl/test/func/func.cpp @@ -26,18 +26,7 @@ class MndTestFunc : public ::testing::Test { Testbase MndTestFunc::test; TEST_F(MndTestFunc, 01_Show_Func) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, PATH_MAX + VARSTR_HEADER_SIZE, "comment"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "aggregate"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_TYPE_STR_MAX_LEN + VARSTR_HEADER_SIZE, "outputtype"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_INT, 4, "code_len"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_INT, 4, "bufsize"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -194,19 +183,8 @@ TEST_F(MndTestFunc, 02_Create_Func) { } } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f1", TSDB_FUNC_NAME_LEN); - CheckBinaryByte('m', TSDB_FUNC_COMMENT_LEN); - CheckInt32(0); - CheckBinary("SMALLINT", TSDB_TYPE_STR_MAX_LEN); - CheckTimestamp(); - CheckInt32(TSDB_FUNC_CODE_LEN); - CheckInt32(4); } TEST_F(MndTestFunc, 03_Retrieve_Func) { @@ -331,10 +309,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -529,20 +504,12 @@ TEST_F(MndTestFunc, 04_Drop_Func) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f2", TSDB_FUNC_NAME_LEN); } diff --git a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt index 4d9b473291..94c25281b2 100644 --- a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. MTEST_SRC) -add_executable(mnode_test_mnode ${MTEST_SRC}) +aux_source_directory(. MNODE_MNODE_TEST_SRC) +add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC}) target_link_libraries( - mnode_test_mnode + mmnodeTest PUBLIC sut ) add_test( - NAME mnode_test_mnode - COMMAND mnode_test_mnode + NAME mmnodeTest + COMMAND mmnodeTest ) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index dd2867f7f9..444c674667 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -39,23 +39,8 @@ Testbase MndTestMnode::test; TestServer MndTestMnode::server2; TEST_F(MndTestMnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - CHECK_META("show mnodes", 5); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, 12 + VARSTR_HEADER_SIZE, "role"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "role_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) { @@ -104,8 +89,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -122,20 +106,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("localhost:9029", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckBinary("slave", 12); - CheckTimestamp(); - CheckTimestamp(); - IgnoreTimestamp(); - IgnoreTimestamp(); } { @@ -151,15 +123,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } { diff --git a/source/dnode/mnode/impl/test/profile/CMakeLists.txt b/source/dnode/mnode/impl/test/profile/CMakeLists.txt index 88d7366b7d..8b811ebfed 100644 --- a/source/dnode/mnode/impl/test/profile/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/profile/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. PROFILE_SRC) -add_executable(mnode_test_profile ${PROFILE_SRC}) +aux_source_directory(. MNODE_PROFILE_TEST_SRC) +add_executable(profileTest ${MNODE_PROFILE_TEST_SRC}) target_link_libraries( - mnode_test_profile + profileTest PUBLIC sut ) add_test( - NAME mnode_test_profile - COMMAND mnode_test_profile + NAME profileTest + COMMAND profileTest ) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index b06c98466b..2c3be2135b 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -46,7 +46,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { EXPECT_EQ(connectRsp.acctId, 1); EXPECT_GT(connectRsp.clusterId, 0); - EXPECT_EQ(connectRsp.connId, 1); + EXPECT_NE(connectRsp.connId, 0); EXPECT_EQ(connectRsp.superUser, 1); EXPECT_EQ(connectRsp.epSet.inUse, 0); @@ -74,32 +74,16 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { } TEST_F(MndTestProfile, 03_ConnectMsg_Show) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - CHECK_META("show connections", 7); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, "program"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "login_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_access"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(1); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("mnode_test_profile", TSDB_APP_NAME_LEN); - CheckInt32(1234); - IgnoreBinary(TSDB_IPv4ADDR_LEN + 6); - CheckTimestamp(); - CheckTimestamp(); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + EXPECT_EQ(test.GetShowRows(), 0); } TEST_F(MndTestProfile, 04_HeartBeatMsg) { SClientHbBatchReq batchReq = {0}; batchReq.reqs = taosArrayInit(0, sizeof(SClientHbReq)); SClientHbReq req = {0}; - req.connKey = {.connId = 123, .hbType = CONN_TYPE__TMQ}; + req.connKey.tscRid = 123; + req.connKey.connType = CONN_TYPE__TMQ; req.info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); SKv kv = {0}; kv.key = 123; @@ -311,24 +295,6 @@ TEST_F(MndTestProfile, 08_KillQueryMsg_InvalidConn) { } TEST_F(MndTestProfile, 09_KillQueryMsg) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QUERIES, ""); - CHECK_META("show queries", 14); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "queryId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 22 + VARSTR_HEADER_SIZE, "qid"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "created_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BIGINT, 8, "time"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 18 + VARSTR_HEADER_SIZE, "sql_obj_id"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "ep"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_BOOL, 1, "stable_query"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "sub_queries"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, "sub_query_info"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, "sql"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QUERIES, "queries", ""); EXPECT_EQ(test.GetShowRows(), 0); } diff --git a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt index 77ac39e409..8259f9f47d 100644 --- a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. QTEST_SRC) -add_executable(mnode_test_qnode ${QTEST_SRC}) +aux_source_directory(. MNODE_QNODE_TEST_SRC) +add_executable(mqnodeTest ${MNODE_QNODE_TEST_SRC}) target_link_libraries( - mnode_test_qnode + mqnodeTest PUBLIC sut ) add_test( - NAME mnode_test_qnode - COMMAND mnode_test_qnode + NAME mqnodeTest + COMMAND mqnodeTest ) diff --git a/source/dnode/mnode/impl/test/qnode/qnode.cpp b/source/dnode/mnode/impl/test/qnode/qnode.cpp index be214cacf2..7240e0f183 100644 --- a/source/dnode/mnode/impl/test/qnode/qnode.cpp +++ b/source/dnode/mnode/impl/test/qnode/qnode.cpp @@ -39,14 +39,7 @@ Testbase MndTestQnode::test; TestServer MndTestQnode::server2; TEST_F(MndTestQnode, 01_Show_Qnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckBinary("localhost:9015", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { diff --git a/source/dnode/mnode/impl/test/show/CMakeLists.txt b/source/dnode/mnode/impl/test/show/CMakeLists.txt index cc0706ca50..69e93e7086 100644 --- a/source/dnode/mnode/impl/test/show/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/show/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SHOW_SRC) -add_executable(mnode_test_show ${SHOW_SRC}) +aux_source_directory(. MNODE_SHOW_TEST_SRC) +add_executable(showTest ${MNODE_SHOW_TEST_SRC}) target_link_libraries( - mnode_test_show + showTest PUBLIC sut ) add_test( - NAME mnode_test_show - COMMAND mnode_test_show + NAME showTest + COMMAND showTest ) diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index a57d99a257..201a42e3ef 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -34,9 +34,9 @@ TEST_F(MndTestShow, 01_ShowMsg_InvalidMsgMax) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { @@ -48,9 +48,9 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 03_ShowMsg_Conn) { @@ -67,42 +67,11 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - - STableMetaRsp* pMeta = test.GetShowMeta(); - EXPECT_STREQ(pMeta->tbName, "show connections"); - EXPECT_EQ(pMeta->numOfTags, 0); - EXPECT_EQ(pMeta->numOfColumns, 7); - EXPECT_EQ(pMeta->precision, 0); - EXPECT_EQ(pMeta->tableType, 0); - EXPECT_EQ(pMeta->update, 0); - EXPECT_EQ(pMeta->sversion, 0); - EXPECT_EQ(pMeta->tversion, 0); - EXPECT_EQ(pMeta->tuid, 0); - EXPECT_EQ(pMeta->suid, 0); - - test.SendShowRetrieveReq(); - - SRetrieveTableRsp* pRetrieveRsp = test.GetRetrieveRsp(); - EXPECT_EQ(pRetrieveRsp->numOfRows, 1); - EXPECT_EQ(pRetrieveRsp->useconds, 0); - EXPECT_EQ(pRetrieveRsp->completed, 1); - EXPECT_EQ(pRetrieveRsp->precision, TSDB_TIME_PRECISION_MILLI); - EXPECT_EQ(pRetrieveRsp->compressed, 0); - EXPECT_EQ(pRetrieveRsp->compLen, 0); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + // EXPECT_EQ(test.GetShowRows(), 1); } TEST_F(MndTestShow, 04_ShowMsg_Cluster) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CLUSTER, ""); - CHECK_META( "show cluster", 3); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BIGINT, 8, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_CLUSTER, "cluster", ""); EXPECT_EQ(test.GetShowRows(), 1); - - IgnoreInt64(); - IgnoreBinary(TSDB_CLUSTER_ID_LEN); - CheckTimestamp(); } \ No newline at end of file diff --git a/source/dnode/mnode/impl/test/sma/CMakeLists.txt b/source/dnode/mnode/impl/test/sma/CMakeLists.txt index 943695abf3..3f9ec123a8 100644 --- a/source/dnode/mnode/impl/test/sma/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/sma/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SMA_SRC) -add_executable(mnode_test_sma ${SMA_SRC}) +aux_source_directory(. MNODE_SMA_TEST_SRC) +add_executable(smaTest ${MNODE_SMA_TEST_SRC}) target_link_libraries( - mnode_test_sma + smaTest PUBLIC sut ) add_test( - NAME mnode_test_sma - COMMAND mnode_test_sma + NAME smaTest + COMMAND smaTest ) diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp index 4b0e33a323..4f3b0d6e37 100644 --- a/source/dnode/mnode/impl/test/sma/sma.cpp +++ b/source/dnode/mnode/impl/test/sma/sma.cpp @@ -207,7 +207,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -216,7 +216,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateTSmaReq(smaname, stbname, 0, "expr", "tagsFilter", "sql", "ast", &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -225,7 +225,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); CHECK_META("show indexes", 3); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -239,7 +239,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildDropTSmaReq(smaname, 0, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } @@ -263,10 +263,8 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildCreateBSmaStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 1); -// CheckBinary("bsmastb", TSDB_TABLE_NAME_LEN); } test.Restart(); @@ -281,8 +279,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildDropStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 0); } diff --git a/source/dnode/mnode/impl/test/snode/CMakeLists.txt b/source/dnode/mnode/impl/test/snode/CMakeLists.txt index 44a5f35f94..9c60da364c 100644 --- a/source/dnode/mnode/impl/test/snode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/snode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. STEST_SRC) -add_executable(mnode_test_snode ${STEST_SRC}) +aux_source_directory(. MNODE_SNODE_TEST_SRC) +add_executable(msnodeTest ${MNODE_SNODE_TEST_SRC}) target_link_libraries( - mnode_test_snode + msnodeTest PUBLIC sut ) add_test( - NAME mnode_test_snode - COMMAND mnode_test_snode + NAME msnodeTest + COMMAND msnodeTest ) diff --git a/source/dnode/mnode/impl/test/snode/snode.cpp b/source/dnode/mnode/impl/test/snode/snode.cpp index 7d24d89154..3742c06b0a 100644 --- a/source/dnode/mnode/impl/test/snode/snode.cpp +++ b/source/dnode/mnode/impl/test/snode/snode.cpp @@ -39,14 +39,7 @@ Testbase MndTestSnode::test; TestServer MndTestSnode::server2; TEST_F(MndTestSnode, 01_Show_Snode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestSnode, 02_Create_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckBinary("localhost:9017", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { diff --git a/source/dnode/mnode/impl/test/stb/CMakeLists.txt b/source/dnode/mnode/impl/test/stb/CMakeLists.txt index 70e20d3411..d2fe387997 100644 --- a/source/dnode/mnode/impl/test/stb/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/stb/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_stb -# COMMAND mnode_test_stb -#) +add_test( + NAME stbTest + COMMAND stbTest +) diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp index f45c0795cd..f8f8799c9f 100644 --- a/source/dnode/mnode/impl/test/stb/stb.cpp +++ b/source/dnode/mnode/impl/test/stb/stb.cpp @@ -43,7 +43,7 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -314,19 +314,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "columns"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "tags"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } // ----- meta ------ @@ -407,15 +396,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -432,9 +414,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 0); } @@ -496,13 +476,7 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(4); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); } { @@ -542,13 +516,8 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(2); } { @@ -611,13 +580,8 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -668,13 +632,8 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -734,13 +693,8 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(3); - CheckInt32(3); } { @@ -799,13 +753,8 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -862,13 +811,8 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { diff --git a/source/dnode/mnode/impl/test/topic/CMakeLists.txt b/source/dnode/mnode/impl/test/topic/CMakeLists.txt index 63a77713d6..076228ec9d 100644 --- a/source/dnode/mnode/impl/test/topic/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/topic/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TOPIC_SRC) -add_executable(mnode_test_topic ${TOPIC_SRC}) +aux_source_directory(. MNODE_TOPIC_TEST_SRC) +add_executable(topicTest ${MNODE_TOPIC_TEST_SRC}) target_link_libraries( - mnode_test_topic + topicTest PUBLIC sut ) add_test( - NAME mnode_test_topic - COMMAND mnode_test_topic + NAME topicTest + COMMAND topicTest ) diff --git a/source/dnode/mnode/impl/test/topic/topic.cpp b/source/dnode/mnode/impl/test/topic/topic.cpp index 2111d61e3f..ee47a3c8b4 100644 --- a/source/dnode/mnode/impl/test/topic/topic.cpp +++ b/source/dnode/mnode/impl/test/topic/topic.cpp @@ -101,7 +101,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_EQ(pRsp->code, 0); } - { test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, ""); } + { test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, ""); } { int32_t contLen = 0; @@ -128,7 +128,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); CHECK_META("show topics", 3); CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); @@ -145,7 +145,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -169,7 +169,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_TOPIC_NOT_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } diff --git a/source/dnode/mnode/impl/test/trans/CMakeLists.txt b/source/dnode/mnode/impl/test/trans/CMakeLists.txt index d7c9756794..fa0ef9f263 100644 --- a/source/dnode/mnode/impl/test/trans/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/trans/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TRANS_SRC) -add_executable(mnode_test_trans ${TRANS_SRC}) +aux_source_directory(. MNODE_TRANS_TEST_SRC) +add_executable(transTest ${MNODE_TRANS_TEST_SRC}) target_link_libraries( - mnode_test_trans + transTest PUBLIC sut ) add_test( - NAME mnode_test_trans - COMMAND mnode_test_trans + NAME transTest + COMMAND transTest ) diff --git a/source/dnode/mnode/impl/test/trans/trans.cpp b/source/dnode/mnode/impl/test/trans/trans.cpp index 560b30d13c..bcf6fe8536 100644 --- a/source/dnode/mnode/impl/test/trans/trans.cpp +++ b/source/dnode/mnode/impl/test/trans/trans.cpp @@ -26,11 +26,11 @@ class MndTestTrans : public ::testing::Test { } static void KillThenRestartServer() { - char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; + char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; TdFilePtr pFile = taosOpenFile(file, TD_FILE_READ); - int32_t size = 3 * 1024 * 1024; - void* buffer = taosMemoryMalloc(size); - int32_t readLen = taosReadFile(pFile, buffer, size); + int32_t size = 3 * 1024 * 1024; + void* buffer = taosMemoryMalloc(size); + int32_t readLen = taosReadFile(pFile, buffer, size); if (readLen < 0 || readLen == size) { ASSERT(1); } @@ -65,18 +65,7 @@ TestServer MndTestTrans::server2; TEST_F(MndTestTrans, 00_Create_User_Crash) { { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, "stage"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "db"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE, "type"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_exec_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_ERROR_LEN - 1 + VARSTR_HEADER_SIZE, "last_error"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -109,26 +98,13 @@ TEST_F(MndTestTrans, 01_Create_User_Crash) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); KillThenRestartServer(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { @@ -144,9 +120,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -163,9 +137,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_QNODE_ALREADY_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -185,8 +157,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -208,18 +179,8 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { { // show trans - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - test.SendShowRetrieveReq(); - + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(4); - CheckTimestamp(); - CheckBinary("undoAction", TSDB_TRANS_STAGE_LEN); - CheckBinary("", TSDB_DB_NAME_LEN - 1); - CheckBinary("create-qnode", TSDB_TRANS_TYPE_LEN); - CheckTimestamp(); - CheckBinary("Unable to establish connection", TSDB_TRANS_ERROR_LEN - 1); } // kill trans @@ -238,8 +199,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { // show trans { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -258,11 +218,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_NETWORK_UNAVAIL); } - uInfo("======== kill and restart server") - KillThenRestartServer(); + uInfo("======== kill and restart server") KillThenRestartServer(); - uInfo("======== server2 start") - server2.DoStart(); + uInfo("======== server2 start") server2.DoStart(); uInfo("======== server2 started") @@ -286,14 +244,11 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_NE(retry, retryMax); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } } - // create db // partial create stb // drop db failed diff --git a/source/dnode/mnode/impl/test/user/CMakeLists.txt b/source/dnode/mnode/impl/test/user/CMakeLists.txt index c6aeef7221..b39ea0e73f 100644 --- a/source/dnode/mnode/impl/test/user/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/user/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. USER_SRC) -add_executable(mnode_test_user ${USER_SRC}) +aux_source_directory(. MNODE_USER_TEST_SRC) +add_executable(userTest ${MNODE_USER_TEST_SRC}) target_link_libraries( - mnode_test_user + userTest PUBLIC sut ) add_test( - NAME mnode_test_user - COMMAND mnode_test_user + NAME userTest + COMMAND userTest ) diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp index 97a144fdee..4e7f3c0213 100644 --- a/source/dnode/mnode/impl/test/user/user.cpp +++ b/source/dnode/mnode/impl/test/user/user.cpp @@ -26,21 +26,8 @@ class MndTestUser : public ::testing::Test { Testbase MndTestUser::test; TEST_F(MndTestUser, 01_Show_User) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "privilege"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "account"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestUser, 02_Create_User) { @@ -99,18 +86,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -125,8 +102,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -144,18 +120,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -170,8 +136,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -191,8 +156,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -437,8 +401,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -497,10 +460,7 @@ TEST_F(MndTestUser, 05_Drop_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -533,25 +493,9 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SAlterUserReq alterReq = {0}; alterReq.alterType = TSDB_ALTER_USER_PASSWD; @@ -567,25 +511,8 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SDropUserReq dropReq = {0}; strcpy(dropReq.user, "u1"); @@ -599,37 +526,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - // restart test.Restart(); taosMsleep(1000); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 3ab007e3a2..c0e458219c 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -4,13 +4,13 @@ target_sources( vnode PRIVATE # vnode + "src/vnd/vnodeOpen.c" "src/vnd/vnodeArenaMAImpl.c" "src/vnd/vnodeBufferPool.c" # "src/vnd/vnodeBufferPool2.c" "src/vnd/vnodeCfg.c" "src/vnd/vnodeCommit.c" "src/vnd/vnodeInt.c" - "src/vnd/vnodeMain.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" "src/vnd/vnodeWrite.c" diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 6a0dd4f6ec..74ea742a70 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -42,11 +42,12 @@ typedef struct STsdbCfg STsdbCfg; // todo: remove typedef struct STqCfg STqCfg; // todo: remove typedef struct SVnodeCfg SVnodeCfg; -int vnodeInit(); +int vnodeInit(int nthreads); void vnodeCleanup(); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs); +void vnodeDestroy(const char *path); SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg); void vnodeClose(SVnode *pVnode); -void vnodeDestroy(const char *path); void vnodePreprocessWriteReqs(SVnode *pVnode, SArray *pMsgs); int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); @@ -122,12 +123,12 @@ struct STsdbCfg { int8_t precision; int8_t update; int8_t compression; - int32_t daysPerFile; - int32_t minRowsPerFileBlock; - int32_t maxRowsPerFileBlock; - int32_t keep; - int32_t keep1; + int32_t days; + int32_t minRows; + int32_t maxRows; int32_t keep2; + int32_t keep0; + int32_t keep1; uint64_t lruCacheSize; SArray *retentions; }; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 1cdb38b650..cb40900e81 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -30,6 +30,8 @@ extern "C" { #define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) // clang-format on +// vnodeCfg ==================== + // vnodeModule ==================== int vnodeScheduleTask(int (*execute)(void*), void* arg); @@ -38,6 +40,11 @@ int vnodeQueryOpen(SVnode* pVnode); void vnodeQueryClose(SVnode* pVnode); int vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); +// vnodeCommit ==================== +int vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); +int vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); +int vnodeLoadInfo(const char* dir, SVnodeInfo* pInfo); + #if 1 // SVBufPool int vnodeOpenBufPool(SVnode* pVnode); @@ -75,9 +82,9 @@ void vmaFree(SVMemAllocator* pVMA, void* ptr); bool vmaIsFull(SVMemAllocator* pVMA); // vnodeCfg.h -extern const SVnodeCfg defaultVnodeOptions; +extern const SVnodeCfg vnodeCfgDefault; -int vnodeValidateOptions(const SVnodeCfg*); +int vnodeCheckCfg(const SVnodeCfg*); void vnodeOptionsCopy(SVnodeCfg* pDest, const SVnodeCfg* pSrc); // For commit diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index f988df01cb..e95878b04e 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -27,6 +27,7 @@ #include "tdbInt.h" #include "tfs.h" #include "tglobal.h" +#include "tjson.h" #include "tlist.h" #include "tlockfree.h" #include "tlosertree.h" @@ -43,6 +44,7 @@ extern "C" { #endif +typedef struct SVnodeInfo SVnodeInfo; typedef struct SMeta SMeta; typedef struct STsdb STsdb; typedef struct STQ STQ; @@ -72,6 +74,11 @@ struct SVState { int64_t applied; }; +struct SVnodeInfo { + SVnodeCfg config; + SVState state; +}; + struct SVnode { int32_t vgId; char* path; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index eb32663387..a1edb7cd9c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -55,7 +55,7 @@ typedef struct { #define TSDB_COMMIT_BUF(ch) TSDB_READ_BUF(&((ch)->readh)) #define TSDB_COMMIT_COMP_BUF(ch) TSDB_READ_COMP_BUF(&((ch)->readh)) #define TSDB_COMMIT_EXBUF(ch) TSDB_READ_EXBUF(&((ch)->readh)) -#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRowsPerFileBlock) +#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRows) #define TSDB_COMMIT_TXN_VERSION(ch) FS_TXN_VERSION(REPO_FS(TSDB_COMMIT_REPO(ch))) static void tsdbStartCommit(STsdb *pRepo); @@ -217,14 +217,14 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) { TSKEY minKey, midKey, maxKey, now; now = taosGetTimestamp(pCfg->precision); - minKey = now - pCfg->keep * tsTickPerDay[pCfg->precision]; - midKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; - maxKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + minKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; + midKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + maxKey = now - pCfg->keep0 * tsTickPerDay[pCfg->precision]; pRtn->minKey = minKey; - pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->daysPerFile, pCfg->precision)); + pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision)); + pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->days, pCfg->precision)); + pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->days, pCfg->precision)); tsdbDebug("vgId:%d now:%" PRId64 " minKey:%" PRId64 " minFid:%d, midFid:%d, maxFid:%d", REPO_ID(pRepo), now, minKey, pRtn->minFid, pRtn->midFid, pRtn->maxFid); } @@ -286,7 +286,7 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdb *pRepo) { return -1; } - pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRows); if (pCommith->pDataCols == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyCommitH(pCommith); @@ -319,7 +319,7 @@ static int tsdbNextCommitFid(SCommitH *pCommith) { if (nextKey == TSDB_DATA_TIMESTAMP_NULL) { continue; } else { - int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->daysPerFile, pCfg->precision)); + int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->days, pCfg->precision)); if (fid == TSDB_IVLD_FID || fid > tfid) { fid = tfid; } @@ -346,7 +346,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) { ASSERT(pSet == NULL || pSet->fid == fid); tsdbResetCommitFile(pCommith); - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); // Set and open files if (tsdbSetAndOpenCommitFile(pCommith, pSet, fid) < 0) { @@ -1210,8 +1210,8 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF int64_t offset = 0, offsetAggr = 0; int rowsToWrite = pDataCols->numOfRows; - ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRowsPerFileBlock); - ASSERT((!isLast) || rowsToWrite < pCfg->minRowsPerFileBlock); + ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRows); + ASSERT((!isLast) || rowsToWrite < pCfg->minRows); // Make buffer space if (tsdbMakeRoom(ppBuf, tsdbBlockStatisSize(pDataCols->numOfCols, SBlockVerLatest)) < 0) { @@ -1460,7 +1460,7 @@ static int tsdbCommitMemData(SCommitH *pCommith, SCommitIter *pIter, TSKEY keyLi if (pCommith->pDataCols->numOfRows <= 0) break; - if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRowsPerFileBlock) { + if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRows) { pDFile = TSDB_COMMIT_DATA_FILE(pCommith); isLast = false; } else { @@ -1619,7 +1619,7 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols if (pCommith->pDataCols->numOfRows == 0) break; if (isLastOneBlock) { - if (pCommith->pDataCols->numOfRows < pCfg->minRowsPerFileBlock) { + if (pCommith->pDataCols->numOfRows < pCfg->minRows) { pDFile = TSDB_COMMIT_LAST_FILE(pCommith); isLast = true; } else { @@ -1667,7 +1667,8 @@ static void tsdbLoadAndMergeFromCache(SDataCols *pDataCols, int *iter, SCommitIt if (tdGetColDataOfRow(&sVal, pDataCols->cols + i, *iter, pDataCols->bitmapMode) < 0) { TASSERT(0); } - tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, pTarget->bitmapMode); + tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, + pTarget->bitmapMode); } ++pTarget->numOfRows; @@ -1774,11 +1775,11 @@ static bool tsdbCanAddSubBlock(SCommitH *pCommith, SBlock *pBlock, SMergeInfo *p ASSERT(mergeRows > 0); - if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRowsPerFileBlock) { + if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRows) { if (pBlock->last) { - if (pCommith->isLFileSame && mergeRows < pCfg->minRowsPerFileBlock) return true; + if (pCommith->isLFileSame && mergeRows < pCfg->minRows) return true; } else { - if (pCommith->isDFileSame && mergeRows <= pCfg->maxRowsPerFileBlock) return true; + if (pCommith->isDFileSame && mergeRows <= pCfg->maxRows) return true; } } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index bd3888864d..866c02cbb3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -190,8 +190,8 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) { // ================== STsdbFS STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) { - int keep = pCfg->keep; - int days = pCfg->daysPerFile; + int keep = pCfg->keep2; + int days = pCfg->days; int maxFSet = TSDB_MAX_FSETS(keep, days); STsdbFS *pfs; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 5a477e646c..5f401c9b2b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -19,9 +19,9 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg); static int tsdbMemTableInsertTbData(STsdb *pRepo, SSubmitBlk *pBlock, int32_t *pAffectedRows); static STbData *tsdbNewTbData(tb_uid_t uid); static void tsdbFreeTbData(STbData *pTbData); -static char * tsdbGetTsTupleKey(const void *data); +static char *tsdbGetTsTupleKey(const void *data); static int tsdbTbDataComp(const void *arg1, const void *arg2); -static char * tsdbTbDataGetUid(const void *arg); +static char *tsdbTbDataGetUid(const void *arg); static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema **ppSchema, STSRow *row); STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) { @@ -74,7 +74,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) { } int tsdbMemTableInsert(STsdb *pTsdb, STsdbMemTable *pMemTable, SSubmitReq *pMsg, SSubmitRsp *pRsp) { - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitMsgIter msgIter = {0}; int32_t affectedrows = 0, numOfRows = 0; @@ -119,12 +119,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey TKEY *filterKeys, int nFilterKeys, bool keepDup, SMergeInfo *pMergeInfo) { ASSERT(maxRowsToRead > 0 && nFilterKeys >= 0); if (pIter == NULL) return 0; - STSchema * pSchema = NULL; + STSchema *pSchema = NULL; TSKEY rowKey = 0; TSKEY fKey = 0; bool isRowDel = false; int filterIter = 0; - STSRow * row = NULL; + STSRow *row = NULL; SMergeInfo mInfo; if (pMergeInfo == NULL) pMergeInfo = &mInfo; @@ -259,12 +259,12 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { ASSERT(pMsg != NULL); // STsdbMeta * pMeta = pTsdb->tsdbMeta; SSubmitMsgIter msgIter = {0}; - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitBlkIter blkIter = {0}; - STSRow * row = NULL; + STSRow *row = NULL; TSKEY now = taosGetTimestamp(pTsdb->config.precision); - TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep; - TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.daysPerFile; + TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep2; + TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.days; terrno = TSDB_CODE_SUCCESS; pMsg->length = htonl(pMsg->length); @@ -332,9 +332,9 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p // STable *pTable = NULL; SSubmitBlkIter blkIter = {0}; STsdbMemTable *pMemTable = pTsdb->mem; - void * tptr; - STbData * pTbData; - STSRow * row; + void *tptr; + STbData *pTbData; + STSRow *row; TSKEY keyMin; TSKEY keyMax; @@ -504,7 +504,7 @@ int tsdbInsertDataToMemTable(STsdbMemTable *pMemTable, SSubmitReq *pMsg) { #include "tskiplist.h" #define TSDB_DATA_SKIPLIST_LEVEL 5 -#define TSDB_MAX_INSERT_BATCH 512 +#define TSDB_MAX_INSERT_BATCH 512 typedef struct { int32_t totalLen; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index 2c57a7406e..3560c9feaa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -17,12 +17,12 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .lruCacheSize = 0, - .daysPerFile = 10, - .minRowsPerFileBlock = 100, - .maxRowsPerFileBlock = 4096, - .keep = 3650, - .keep1 = 3650, + .days = 10, + .minRows = 100, + .maxRows = 4096, .keep2 = 3650, + .keep0 = 3650, + .keep1 = 3650, .update = 0, .compression = TWO_STAGE_COMP}; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 90da0946e6..9149a5e3e1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -314,7 +314,7 @@ static int64_t getEarliestValidTimestamp(STsdb* pTsdb) { STsdbCfg* pCfg = &pTsdb->config; int64_t now = taosGetTimestamp(pCfg->precision); - return now - (tsTickPerDay[pCfg->precision] * pCfg->keep) + 1; // needs to add one tick + return now - (tsTickPerDay[pCfg->precision] * pCfg->keep2) + 1; // needs to add one tick } static void setQueryTimewindow(STsdbReadHandle* pTsdbReadHandle, STsdbQueryCond* pCond) { @@ -404,7 +404,7 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond, pReadHandle->defaultLoadColumn = getDefaultLoadColumns(pReadHandle, true); } - pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRowsPerFileBlock); + pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRows); if (pReadHandle->pDataCols == NULL) { tsdbError("%p failed to malloc buf for pDataCols, %s", pReadHandle, pReadHandle->idStr); terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; @@ -2199,7 +2199,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ASCENDING_TRAVERSE(pTsdbReadHandle->order) && win.skey > pTsdbReadHandle->window.ekey) || @@ -2295,7 +2295,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* // find the start data block in file pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); @@ -2321,7 +2321,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ascTraverse && win.skey > pTsdbReadHandle->window.ekey) || @@ -2396,7 +2396,7 @@ static int32_t getDataBlocksInFiles(STsdbReadHandle* pTsdbReadHandle, bool* exis if (!pTsdbReadHandle->locateStart) { pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index a3b00c2877..b15271a51a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -43,14 +43,14 @@ int tsdbInitReadH(SReadH *pReadh, STsdb *pRepo) { return -1; } - pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[0] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); return -1; } - pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[1] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); @@ -276,8 +276,8 @@ int tsdbLoadBlockData(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo) { return 0; } -int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, - int numOfColsIds, bool mergeBitmap) { +int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, int numOfColsIds, + bool mergeBitmap) { ASSERT(pBlock->numOfSubBlocks > 0); int8_t update = pReadh->pRepo->config.update; @@ -513,7 +513,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -606,9 +606,10 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat if (tsdbMakeRoom((void **)(&TSDB_READ_COMP_BUF(pReadh)), zsize) < 0) return -1; } - if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, pBlockCol->blen, - pBlock->algorithm, pBlock->numOfRows, tLenBitmap, pDataCols->maxPoints, - TSDB_READ_COMP_BUF(pReadh), (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { + if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, + pBlockCol ? pBlockCol->blen : 0, pBlock->algorithm, pBlock->numOfRows, + tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh), + (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %u", TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset); return -1; @@ -710,7 +711,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -747,6 +748,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { // load the key row blockCol.colId = colId; TD_SET_COL_ROWS_NORM(&blockCol); // default is NORM for the primary key column + blockCol.blen = 0; blockCol.len = pBlock->keyLen; blockCol.type = pDataCol->type; blockCol.offset = TSDB_KEY_COL_OFFSET; @@ -836,7 +838,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc } if (tsdbCheckAndDecodeColumnData(pDataCol, pReadh->pBuf, pBlockCol->len, pBlockCol->blen, pBlock->algorithm, - pBlock->numOfRows, tLenBitmap, pCfg->maxRowsPerFileBlock, pReadh->pCBuf, + pBlock->numOfRows, tLenBitmap, pCfg->maxRows, pReadh->pCBuf, (int32_t)taosTSizeof(pReadh->pCBuf)) < 0) { tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), pBlockCol->colId, offset); diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 7de5a0d5a9..7abdf22073 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -106,7 +106,8 @@ struct SSmaStat { // expired window static int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t version); -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version); +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version); static int32_t tsdbInitSmaStat(SSmaStat **pSmaStat); static void *tsdbFreeSmaStatItem(SSmaStatItem *pSmaStatItem); static int32_t tsdbDestroySmaState(SSmaStat *pSmaStat); @@ -197,7 +198,7 @@ static SPoolMem *openPool() { static void clearPool(SPoolMem *pPool) { if (!pPool) return; - + SPoolMem *pMem; do { @@ -544,7 +545,8 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { return TSDB_CODE_SUCCESS; }; -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version) { +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version) { SSmaStatItem *pItem = taosHashGet(pItemsHash, &indexUid, sizeof(indexUid)); if (pItem == NULL) { // TODO: use TSDB_SMA_STAT_EXPIRED and update by stream computing later @@ -946,7 +948,7 @@ static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t */ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLevel) { STsdbCfg *pCfg = REPO_CFG(pTsdb); - int32_t daysPerFile = pCfg->daysPerFile; + int32_t daysPerFile = pCfg->days; if (storageLevel == SMA_STORAGE_LEVEL_TSDB) { int32_t days = SMA_STORAGE_TSDB_TIMES * (interval / tsTickPerDay[pCfg->precision]); diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index ef417cabc6..34b983c20c 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,14 +15,15 @@ #include "vnodeInt.h" -const SVnodeCfg defaultVnodeOptions = { - .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; /* TODO */ +const SVnodeCfg vnodeCfgDefault = { + .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; -int vnodeValidateOptions(const SVnodeCfg *pVnodeOptions) { +int vnodeCheckCfg(const SVnodeCfg *pCfg) { // TODO return 0; } +#if 1 //====================================================================== void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { memcpy((void *)pDest, (void *)pSrc, sizeof(SVnodeCfg)); } @@ -46,3 +47,5 @@ int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) { return TSDB_CODE_SUCCESS; } + +#endif \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index b4c3725a5e..fa249d3ba1 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -15,11 +15,128 @@ #include "vnodeInt.h" +#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME_TMP "vnode_tmp.json" + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); static int vnodeCommit(void *arg); static void vnodeWaitCommit(SVnode *pVnode); +int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile; + char *data; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + // encode info + data = NULL; + + if (vnodeEncodeInfo(pInfo, &data) < 0) { + return -1; + } + + // save info to a vnode_tmp.json + pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosWriteFile(pFile, data, strlen(data)) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + if (taosFsyncFile(pFile) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // free info binary + taosMemoryFree(data); + + vInfo("vgId: %d vnode info is saved, fname: %s", pInfo->config.vgId, fname); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(data); + return -1; +} + +int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + char tfname[TSDB_FILENAME_LEN]; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + if (taosRenameFile(tfname, fname) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + vInfo("vgId: %d vnode info is committed", pInfo->config.vgId); + + return 0; +} + +int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile = NULL; + char *pData = NULL; + int64_t size; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + + // read info + pFile = taosOpenFile(fname, TD_FILE_READ); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosFStatFile(pFile, &size, NULL) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + pData = taosMemoryMalloc(size); + if (pData == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + if (taosReadFile(pFile, pData, size) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // decode info + if (vnodeDecodeInfo(pData, pInfo) < 0) { + taosMemoryFree(pData); + return -1; + } + + taosMemoryFree(pData); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(pData); + return -1; +} + int vnodeAsyncCommit(SVnode *pVnode) { vnodeWaitCommit(pVnode); @@ -60,4 +177,133 @@ static int vnodeEndCommit(SVnode *pVnode) { return 0; } -static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } \ No newline at end of file +static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } + +static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { + const SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonAddIntegerToObject(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + + return 0; +} + +static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { + SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonGetNumberValue(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonGetNumberValue(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + + return 0; +} + +static int vnodeEncodeState(const void *pObj, SJson *pJson) { + const SVState *pState = (SVState *)pObj; + + if (tjsonAddIntegerToObject(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeDecodeState(const SJson *pJson, void *pObj) { + SVState *pState = (SVState *)pObj; + + if (tjsonGetNumberValue(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData) { + SJson *pJson; + char *pData; + + *ppData = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonAddObject(pJson, "config", vnodeEncodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonAddObject(pJson, "state", vnodeEncodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + pData = tjsonToString(pJson); + if (pData == NULL) { + goto _err; + } + + tjsonDelete(pJson); + + *ppData = pData; + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} + +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo) { + SJson *pJson = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonToObject(pJson, "config", vnodeDecodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonToObject(pJson, "state", vnodeDecodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + tjsonDelete(pJson); + + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} diff --git a/source/dnode/vnode/src/vnd/vnodeMain.c b/source/dnode/vnode/src/vnd/vnodeOpen.c similarity index 80% rename from source/dnode/vnode/src/vnd/vnodeMain.c rename to source/dnode/vnode/src/vnd/vnodeOpen.c index 2fd848a39d..241c26ab1c 100644 --- a/source/dnode/vnode/src/vnd/vnodeMain.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -20,11 +20,42 @@ static void vnodeFree(SVnode *pVnode); static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { + SVnodeInfo info = {0}; + char dir[TSDB_FILENAME_LEN]; + + // TODO: check if directory exists + + // check config + if (vnodeCheckCfg(pCfg) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + + // create vnode env + if (tfsMkdir(pTfs, path) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + info.config = *pCfg; + + if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) { + vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + + vInfo("vgId: %d vnode is created", pCfg->vgId); + + return 0; +} + SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { SVnode *pVnode = NULL; // Set default options - SVnodeCfg cfg = defaultVnodeOptions; + SVnodeCfg cfg = vnodeCfgDefault; if (pVnodeCfg != NULL) { cfg.vgId = pVnodeCfg->vgId; cfg.msgCb = pVnodeCfg->msgCb; @@ -36,7 +67,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { } // Validate options - if (vnodeValidateOptions(&cfg) < 0) { + if (vnodeCheckCfg(&cfg) < 0) { // TODO return NULL; } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 7b03d5ca34..1add43a04b 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -20,9 +20,9 @@ extern "C" { #endif #include "os.h" -#include "tsort.h" #include "tcommon.h" #include "tlosertree.h" +#include "tsort.h" #include "ttszip.h" #include "tvariant.h" @@ -35,13 +35,13 @@ extern "C" { #include "tarray.h" #include "thash.h" #include "tlockfree.h" -#include "tpagedbuf.h" #include "tmsg.h" +#include "tpagedbuf.h" typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order); -#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) -#define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0u) +#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) +#define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0u) #define QUERY_IS_ASC_QUERY(q) (GET_FORWARD_DIRECTION_FACTOR((q)->order.order) == QUERY_ASC_FORWARD_STEP) #define GET_TABLEGROUP(q, _index) ((SArray*)taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index))) @@ -65,7 +65,7 @@ enum { }; typedef struct SResultRowCell { - uint64_t groupId; + uint64_t groupId; SResultRowPosition pos; } SResultRowCell; @@ -73,11 +73,11 @@ typedef struct SResultRowCell { * If the number of generated results is greater than this value, * query query will be halt and return results to client immediate. */ -typedef struct SResultInfo { // TODO refactor - int64_t totalRows; // total generated result size in rows - int64_t totalBytes; // total results in bytes. - int32_t capacity; // capacity of current result output buffer - int32_t threshold; // result size threshold in rows. +typedef struct SResultInfo { // TODO refactor + int64_t totalRows; // total generated result size in rows + int64_t totalBytes; // total results in bytes. + int32_t capacity; // capacity of current result output buffer + int32_t threshold; // result size threshold in rows. } SResultInfo; typedef struct STableQueryInfo { @@ -154,27 +154,27 @@ typedef struct SOperatorCostInfo { // The basic query information extracted from the SQueryInfo tree to support the // execution of query in a data node. typedef struct STaskAttr { - SLimit limit; - SLimit slimit; - bool stableQuery; // super table query or not - bool topBotQuery; // TODO used bitwise flag - bool groupbyColumn; // denote if this is a groupby normal column query - bool timeWindowInterpo; // if the time window start/end required interpolation - bool tsCompQuery; // is tscomp query - bool diffQuery; // is diff query - bool pointInterpQuery; // point interpolation query - int32_t havingNum; // having expr number - int16_t numOfCols; - int16_t numOfTags; - STimeWindow window; - SInterval interval; - int16_t precision; - int16_t numOfOutput; - int16_t fillType; - int32_t resultRowSize; - int32_t tagLen; // tag value length of current query + SLimit limit; + SLimit slimit; + bool stableQuery; // super table query or not + bool topBotQuery; // TODO used bitwise flag + bool groupbyColumn; // denote if this is a groupby normal column query + bool timeWindowInterpo; // if the time window start/end required interpolation + bool tsCompQuery; // is tscomp query + bool diffQuery; // is diff query + bool pointInterpQuery; // point interpolation query + int32_t havingNum; // having expr number + int16_t numOfCols; + int16_t numOfTags; + STimeWindow window; + SInterval interval; + int16_t precision; + int16_t numOfOutput; + int16_t fillType; + int32_t resultRowSize; + int32_t tagLen; // tag value length of current query - SExprInfo *pExpr1; + SExprInfo* pExpr1; SColumnInfo* tagColList; int32_t numOfFilterCols; int64_t* fillVal; @@ -187,13 +187,15 @@ struct SOperatorInfo; struct SAggSupporter; struct SOptrBasicInfo; -typedef void (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter *pSup, struct SOptrBasicInfo *pInfo, char **result, int32_t *length); -typedef bool (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter *pSup, struct SOptrBasicInfo *pInfo, char *result, int32_t length); +typedef void (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter* pSup, + struct SOptrBasicInfo* pInfo, char** result, int32_t* length); +typedef bool (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter* pSup, + struct SOptrBasicInfo* pInfo, char* result, int32_t length); typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr); typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr, bool* newgroup); typedef void (*__optr_close_fn_t)(void* param, int32_t num); -typedef int32_t (*__optr_get_explain_fn_t)(struct SOperatorInfo* pOptr, void **pOptrExplain); +typedef int32_t (*__optr_get_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain); typedef struct STaskIdInfo { uint64_t queryId; // this is also a request id @@ -203,21 +205,22 @@ typedef struct STaskIdInfo { } STaskIdInfo; typedef struct SExecTaskInfo { - STaskIdInfo id; - uint32_t status; - STimeWindow window; - STaskCostInfo cost; - int64_t owner; // if it is in execution - int32_t code; - uint64_t totalRows; // total number of rows - STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure - char* sql; // query sql string - jmp_buf env; // jump to this position when error happens. - EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + STaskIdInfo id; + uint32_t status; + STimeWindow window; + STaskCostInfo cost; + int64_t owner; // if it is in execution + int32_t code; + uint64_t totalRows; // total number of rows + STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure + char* sql; // query sql string + jmp_buf env; // jump to this position when error happens. + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] struct SOperatorInfo* pRoot; } SExecTaskInfo; typedef struct STaskRuntimeEnv { + jmp_buf env; STaskAttr* pQueryAttr; uint32_t status; // query status @@ -231,17 +234,17 @@ typedef struct STaskRuntimeEnv { SArray* pResultRowArrayList; // The array list that contains the Result rows char* keyBuf; // window key buffer // The window result objects pool, all the resultRow Objects are allocated and managed by this object. - char** prevRow; - SArray* prevResult; // intermediate result, SArray - STSBuf* pTsBuf; // timestamp filter list - STSCursor cur; + char** prevRow; + SArray* prevResult; // intermediate result, SArray + STSBuf* pTsBuf; // timestamp filter list + STSCursor cur; - char* tagVal; // tag value of current data block + char* tagVal; // tag value of current data block struct SScalarFunctionSupport* scalarSup; STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure struct SOperatorInfo* proot; - SGroupResInfo groupResInfo; - int64_t currentOffset; // dynamic offset value + SGroupResInfo groupResInfo; + int64_t currentOffset; // dynamic offset value STableQueryInfo* current; SResultInfo resultInfo; @@ -249,10 +252,10 @@ typedef struct STaskRuntimeEnv { } STaskRuntimeEnv; enum { - OP_NOT_OPENED = 0x0, - OP_OPENED = 0x1, + OP_NOT_OPENED = 0x0, + OP_OPENED = 0x1, OP_RES_TO_RETURN = 0x5, - OP_EXEC_DONE = 0x9, + OP_EXEC_DONE = 0x9, }; typedef struct SOperatorInfo { @@ -263,7 +266,7 @@ typedef struct SOperatorInfo { char* name; // name, used to show the query execution plan void* info; // extension attribution SExprInfo* pExpr; - STaskRuntimeEnv* pRuntimeEnv; // todo remove it + STaskRuntimeEnv* pRuntimeEnv; // todo remove it SExecTaskInfo* pTaskInfo; SOperatorCostInfo cost; SResultInfo resultInfo; @@ -272,8 +275,8 @@ typedef struct SOperatorInfo { // todo extract struct __optr_open_fn_t _openFn; // DO NOT invoke this function directly __optr_fn_t getNextFn; - __optr_fn_t getStreamResFn; // execute the aggregate in the stream model. - __optr_fn_t cleanupFn; // call this function to release the allocated resources ASAP + __optr_fn_t getStreamResFn; // execute the aggregate in the stream model. + __optr_fn_t cleanupFn; // call this function to release the allocated resources ASAP __optr_close_fn_t closeFn; __optr_encode_fn_t encodeResultRow; __optr_decode_fn_t decodeResultRow; @@ -288,33 +291,33 @@ typedef struct { typedef enum { EX_SOURCE_DATA_NOT_READY = 0x1, - EX_SOURCE_DATA_READY = 0x2, + EX_SOURCE_DATA_READY = 0x2, EX_SOURCE_DATA_EXHAUSTED = 0x3, } EX_SOURCE_STATUS; typedef struct SSourceDataInfo { - struct SExchangeInfo *pEx; + struct SExchangeInfo* pEx; int32_t index; - SRetrieveTableRsp *pRsp; + SRetrieveTableRsp* pRsp; uint64_t totalRows; int32_t code; EX_SOURCE_STATUS status; } SSourceDataInfo; typedef struct SLoadRemoteDataInfo { - uint64_t totalSize; // total load bytes from remote - uint64_t totalRows; // total number of rows - uint64_t totalElapsed; // total elapsed time + uint64_t totalSize; // total load bytes from remote + uint64_t totalRows; // total number of rows + uint64_t totalElapsed; // total elapsed time } SLoadRemoteDataInfo; typedef struct SExchangeInfo { - SArray* pSources; - SArray* pSourceDataInfo; - tsem_t ready; - void* pTransporter; - SSDataBlock* pResult; - bool seqLoadData; // sequential load data or not, false by default - int32_t current; + SArray* pSources; + SArray* pSourceDataInfo; + tsem_t ready; + void* pTransporter; + SSDataBlock* pResult; + bool seqLoadData; // sequential load data or not, false by default + int32_t current; SLoadRemoteDataInfo loadInfo; } SExchangeInfo; @@ -335,7 +338,7 @@ typedef struct STableScanInfo { int32_t current; int32_t reverseTimes; // 0 by default SNode* pFilterNode; // filter operator info - SqlFunctionCtx* pCtx; // next operator query context + SqlFunctionCtx* pCtx; // next operator query context SResultRowInfo* pResultRowInfo; int32_t* rowCellInfoOffset; SExprInfo* pExpr; @@ -344,6 +347,7 @@ typedef struct STableScanInfo { int32_t numOfOutput; int64_t elapsedTime; int32_t prevGroupId; // previous table group id + int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan int32_t dataBlockLoadFlag; } STableScanInfo; @@ -356,15 +360,15 @@ typedef struct STagScanInfo { } STagScanInfo; typedef struct SStreamBlockScanInfo { - SArray* pBlockLists; // multiple SSDatablock. - SSDataBlock* pRes; // result SSDataBlock - int32_t blockType; // current block type - int32_t validBlockIndex; // Is current data has returned? - SColumnInfo* pCols; // the output column info - uint64_t numOfRows; // total scanned rows - uint64_t numOfExec; // execution times - void* readerHandle; // stream block reader handle - SArray* pColMatchInfo; // + SArray* pBlockLists; // multiple SSDatablock. + SSDataBlock* pRes; // result SSDataBlock + int32_t blockType; // current block type + int32_t validBlockIndex; // Is current data has returned? + SColumnInfo* pCols; // the output column info + uint64_t numOfRows; // total scanned rows + uint64_t numOfExec; // execution times + void* readerHandle; // stream block reader handle + SArray* pColMatchInfo; // } SStreamBlockScanInfo; typedef struct SSysTableScanInfo { @@ -373,57 +377,57 @@ typedef struct SSysTableScanInfo { void* readHandle; }; - SRetrieveMetaTableRsp *pRsp; - SRetrieveTableReq req; - SEpSet epSet; - tsem_t ready; + SRetrieveMetaTableRsp* pRsp; + SRetrieveTableReq req; + SEpSet epSet; + tsem_t ready; - int32_t accountId; - bool showRewrite; - SNode *pCondition; // db_name filter condition, to discard data that are not in current database - void *pCur; // cursor for iterate the local table meta store. - SArray *scanCols; // SArray scan column id list + int32_t accountId; + bool showRewrite; + SNode* pCondition; // db_name filter condition, to discard data that are not in current database + void* pCur; // cursor for iterate the local table meta store. + SArray* scanCols; // SArray scan column id list - int32_t type; // show type, TODO remove it + int32_t type; // show type, TODO remove it SName name; - SSDataBlock *pRes; + SSDataBlock* pRes; int32_t capacity; int64_t numOfBlocks; // extract basic running information. SLoadRemoteDataInfo loadInfo; } SSysTableScanInfo; typedef struct SOptrBasicInfo { - SResultRowInfo resultRowInfo; - int32_t* rowCellInfoOffset; // offset value for each row result cell info - SqlFunctionCtx* pCtx; - SSDataBlock* pRes; - int32_t capacity; // TODO remove it + SResultRowInfo resultRowInfo; + int32_t* rowCellInfoOffset; // offset value for each row result cell info + SqlFunctionCtx* pCtx; + SSDataBlock* pRes; + int32_t capacity; // TODO remove it } SOptrBasicInfo; -//TODO move the resultrowsiz together with SOptrBasicInfo:rowCellInfoOffset +// TODO move the resultrowsiz together with SOptrBasicInfo:rowCellInfoOffset typedef struct SAggSupporter { - SHashObj* pResultRowHashTable; // quick locate the window object for each result - SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not - SArray* pResultRowArrayList; // The array list that contains the Result rows - char* keyBuf; // window key buffer - SDiskbasedBuf *pResultBuf; // query result buffer based on blocked-wised disk file - int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row + SHashObj* pResultRowHashTable; // quick locate the window object for each result + SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not + SArray* pResultRowArrayList; // The array list that contains the Result rows + char* keyBuf; // window key buffer + SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file + int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row } SAggSupporter; typedef struct STableIntervalOperatorInfo { - SOptrBasicInfo binfo; // basic info - SGroupResInfo groupResInfo; // multiple results build supporter - SInterval interval; // interval info - int32_t primaryTsIndex; // primary time stamp slot id from result of downstream operator. - STimeWindow win; // query time range - bool timeWindowInterpo; // interpolation needed or not - char **pRow; // previous row/tuple of already processed datablock - SAggSupporter aggSup; // aggregate supporter - STableQueryInfo *pCurrent; // current tableQueryInfo struct - int32_t order; // current SSDataBlock scan order - EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] - SArray *pUpdatedWindow; // updated time window due to the input data block from the downstream operator. - SColumnInfoData timeWindowData; // query time window info for scalar function execution. + SOptrBasicInfo binfo; // basic info + SGroupResInfo groupResInfo; // multiple results build supporter + SInterval interval; // interval info + int32_t primaryTsIndex; // primary time stamp slot id from result of downstream operator. + STimeWindow win; // query time range + bool timeWindowInterpo; // interpolation needed or not + char** pRow; // previous row/tuple of already processed datablock + SAggSupporter aggSup; // aggregate supporter + STableQueryInfo* pCurrent; // current tableQueryInfo struct + int32_t order; // current SSDataBlock scan order + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + SArray* pUpdatedWindow; // updated time window due to the input data block from the downstream operator. + SColumnInfoData timeWindowData; // query time window info for scalar function execution. } STableIntervalOperatorInfo; typedef struct SAggOperatorInfo { @@ -444,17 +448,17 @@ typedef struct SAggOperatorInfo { typedef struct SProjectOperatorInfo { SOptrBasicInfo binfo; SAggSupporter aggSup; - SSDataBlock *existDataBlock; - SArray *pPseudoColInfo; + SSDataBlock* existDataBlock; + SArray* pPseudoColInfo; SLimit limit; SLimit slimit; - uint64_t groupId; - int64_t curSOffset; - int64_t curGroupOutput; + uint64_t groupId; + int64_t curSOffset; + int64_t curGroupOutput; - int64_t curOffset; - int64_t curOutput; + int64_t curOffset; + int64_t curOutput; } SProjectOperatorInfo; typedef struct SFillOperatorInfo { @@ -469,86 +473,87 @@ typedef struct SFillOperatorInfo { } SFillOperatorInfo; typedef struct { - char *pData; - bool isNull; - int16_t type; - int32_t bytes; + char* pData; + bool isNull; + int16_t type; + int32_t bytes; } SGroupKeys, SStateKeys; typedef struct SGroupbyOperatorInfo { - SOptrBasicInfo binfo; - SArray* pGroupCols; - SArray* pGroupColVals; // current group column values, SArray - SNode* pCondition; - bool isInit; // denote if current val is initialized or not - char* keyBuf; // group by keys for hash - int32_t groupKeyLen; // total group by column width - SGroupResInfo groupResInfo; - SAggSupporter aggSup; - SExprInfo* pScalarExprInfo; - int32_t numOfScalarExpr;// the number of scalar expression in group operator - SqlFunctionCtx*pScalarFuncCtx; + SOptrBasicInfo binfo; + SArray* pGroupCols; + SArray* pGroupColVals; // current group column values, SArray + SNode* pCondition; + bool isInit; // denote if current val is initialized or not + char* keyBuf; // group by keys for hash + int32_t groupKeyLen; // total group by column width + SGroupResInfo groupResInfo; + SAggSupporter aggSup; + SExprInfo* pScalarExprInfo; + int32_t numOfScalarExpr; // the number of scalar expression in group operator + SqlFunctionCtx* pScalarFuncCtx; } SGroupbyOperatorInfo; typedef struct SDataGroupInfo { uint64_t groupId; int64_t numOfRows; - SArray *pPageList; + SArray* pPageList; } SDataGroupInfo; // The sort in partition may be needed later. typedef struct SPartitionOperatorInfo { - SOptrBasicInfo binfo; - SArray* pGroupCols; - SArray* pGroupColVals; // current group column values, SArray - char* keyBuf; // group by keys for hash - int32_t groupKeyLen; // total group by column width - SHashObj* pGroupSet; // quick locate the window object for each result + SOptrBasicInfo binfo; + SArray* pGroupCols; + SArray* pGroupColVals; // current group column values, SArray + char* keyBuf; // group by keys for hash + int32_t groupKeyLen; // total group by column width + SHashObj* pGroupSet; // quick locate the window object for each result - SDiskbasedBuf* pBuf; // query result buffer based on blocked-wised disk file - int32_t rowCapacity; // maximum number of rows for each buffer page - int32_t* columnOffset; // start position for each column data + SDiskbasedBuf* pBuf; // query result buffer based on blocked-wised disk file + int32_t rowCapacity; // maximum number of rows for each buffer page + int32_t* columnOffset; // start position for each column data - void* pGroupIter; // group iterator - int32_t pageIndex; // page index of current group + void* pGroupIter; // group iterator + int32_t pageIndex; // page index of current group } SPartitionOperatorInfo; typedef struct SWindowRowsSup { - STimeWindow win; - TSKEY prevTs; - int32_t startRowIndex; - int32_t numOfRows; + STimeWindow win; + TSKEY prevTs; + int32_t startRowIndex; + int32_t numOfRows; } SWindowRowsSup; typedef struct SSessionAggOperatorInfo { - SOptrBasicInfo binfo; - SAggSupporter aggSup; - SGroupResInfo groupResInfo; - SWindowRowsSup winSup; - bool reptScan; // next round scan - int64_t gap; // session window gap - SColumnInfoData timeWindowData; // query time window info for scalar function execution. + SOptrBasicInfo binfo; + SAggSupporter aggSup; + SGroupResInfo groupResInfo; + SWindowRowsSup winSup; + bool reptScan; // next round scan + int64_t gap; // session window gap + SColumnInfoData timeWindowData; // query time window info for scalar function execution. } SSessionAggOperatorInfo; typedef struct STimeSliceOperatorInfo { - SOptrBasicInfo binfo; - SInterval interval; - SGroupResInfo groupResInfo; // multiple results build supporter + SOptrBasicInfo binfo; + SInterval interval; + SGroupResInfo groupResInfo; // multiple results build supporter } STimeSliceOperatorInfo; typedef struct SStateWindowOperatorInfo { - SOptrBasicInfo binfo; - SAggSupporter aggSup; - SGroupResInfo groupResInfo; - SWindowRowsSup winSup; - int32_t colIndex; // start row index - bool hasKey; - SStateKeys stateKey; - SColumnInfoData timeWindowData; // query time window info for scalar function execution. -// bool reptScan; + SOptrBasicInfo binfo; + SAggSupporter aggSup; + SGroupResInfo groupResInfo; + SWindowRowsSup winSup; + int32_t colIndex; // start row index + bool hasKey; + SStateKeys stateKey; + SColumnInfoData timeWindowData; // query time window info for scalar function execution. + // bool reptScan; } SStateWindowOperatorInfo; typedef struct SSortedMergeOperatorInfo { + SOptrBasicInfo binfo; SArray* pSortInfo; int32_t numOfSources; @@ -565,22 +570,26 @@ typedef struct SSortedMergeOperatorInfo { } SSortedMergeOperatorInfo; typedef struct SSortOperatorInfo { - uint32_t sortBufSize; // max buffer size for in-memory sort - SSDataBlock *pDataBlock; - SArray* pSortInfo; - SSortHandle *pSortHandle; - SArray* inputSlotMap; // for index map from table scan output - int32_t bufPageSize; - int32_t numOfRowsInRes; + uint32_t sortBufSize; // max buffer size for in-memory sort + SSDataBlock* pDataBlock; + SArray* pSortInfo; + SSortHandle* pSortHandle; + SArray* inputSlotMap; // for index map from table scan output + int32_t bufPageSize; + int32_t numOfRowsInRes; // TODO extact struct - int64_t startTs; // sort start time - uint64_t sortElapsed; // sort elapsed time, time to flush to disk not included. - uint64_t totalSize; // total load bytes from remote - uint64_t totalRows; // total number of rows - uint64_t totalElapsed; // total elapsed time + int64_t startTs; // sort start time + uint64_t sortElapsed; // sort elapsed time, time to flush to disk not included. + uint64_t totalSize; // total load bytes from remote + uint64_t totalRows; // total number of rows + uint64_t totalElapsed; // total elapsed time } SSortOperatorInfo; +typedef struct STagFilterOperatorInfo { + SOptrBasicInfo binfo; +} STagFilterOperatorInfo; + typedef struct SJoinOperatorInfo { SSDataBlock *pRes; int32_t joinType; @@ -597,23 +606,28 @@ typedef struct SJoinOperatorInfo { } SJoinOperatorInfo; int32_t operatorDummyOpenFn(SOperatorInfo* pOperator); -void operatorDummyCloseFn(void* param, int32_t numOfCols); +void operatorDummyCloseFn(void* param, int32_t numOfCols); int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num); int32_t initAggInfo(SOptrBasicInfo* pBasicInfo, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, int32_t numOfRows, SSDataBlock* pResultBlock, size_t keyBufSize, const char* pkey); -void toSDatablock(SSDataBlock* pBlock, int32_t rowCapacity, SGroupResInfo* pGroupResInfo, SExprInfo* pExprInfo, SDiskbasedBuf* pBuf, int32_t* rowCellOffset); -void finalizeMultiTupleQueryResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset); -void doApplyFunctions(SqlFunctionCtx* pCtx, STimeWindow* pWin, SColumnInfoData* pTimeWindowData, int32_t offset, int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput, int32_t order); -int32_t setGroupResultOutputBuf(SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t type, int16_t bytes, int32_t groupId, SDiskbasedBuf* pBuf, SExecTaskInfo* pTaskInfo, SAggSupporter* pAggSup); -void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput); -int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, - char* pData, int32_t compLen, int32_t numOfOutput, int64_t startTs, - uint64_t* total, SArray* pColList); -void doSetOperatorCompleted(SOperatorInfo* pOperator); -void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); +void toSDatablock(SSDataBlock* pBlock, int32_t rowCapacity, SGroupResInfo* pGroupResInfo, SExprInfo* pExprInfo, + SDiskbasedBuf* pBuf, int32_t* rowCellOffset); +void finalizeMultiTupleQueryResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbasedBuf* pBuf, + SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset); +void doApplyFunctions(SqlFunctionCtx* pCtx, STimeWindow* pWin, SColumnInfoData* pTimeWindowData, int32_t offset, + int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput, int32_t order); +int32_t setGroupResultOutputBuf(SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t type, int16_t bytes, + int32_t groupId, SDiskbasedBuf* pBuf, SExecTaskInfo* pTaskInfo, SAggSupporter* pAggSup); +void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput); +int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData, + int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total, + SArray* pColList); +void doSetOperatorCompleted(SOperatorInfo* pOperator); +void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowCellInfoOffset); SOperatorInfo* createExchangeOperatorInfo(const SNodeList* pSources, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); + SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfCols, int32_t dataLoadFlag, int32_t repeatTime, int32_t reverseTime, SArray* pColMatchInfo, SSDataBlock* pResBlock, SNode* pCondition, SExecTaskInfo* pTaskInfo); SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExprInfo* pScalarExprInfo, @@ -624,23 +638,34 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SExprInfo* p SOperatorInfo *createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pResBlock, SArray* pSortInfo, SArray* pIndexMap, SExecTaskInfo* pTaskInfo); SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t num, SArray* pSortInfo, SArray* pGroupInfo, SExecTaskInfo* pTaskInfo); + SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataBlock* pResBlock, const SName* pName, - SNode* pCondition, SEpSet epset, SArray* colList, SExecTaskInfo* pTaskInfo, bool showRewrite, int32_t accountId); -SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlot, + SNode* pCondition, SEpSet epset, SArray* colList, + SExecTaskInfo* pTaskInfo, bool showRewrite, int32_t accountId); +SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlot, const STableGroupInfo* pTableGroupInfo, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, int64_t gap, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SArray* pGroupColList, - SNode* pCondition, SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); +SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResBlock, int64_t gap, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SArray* pGroupColList, SNode* pCondition, + SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock* pResBlock, SArray* pColList, SArray* pTableIdList, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock* pResBlock, SArray* pColList, + SArray* pTableIdList, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, SInterval* pInterval, SSDataBlock* pResBlock, - int32_t fillType, char* fillVal, bool multigroupResult, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, + SInterval* pInterval, SSDataBlock* pResBlock, int32_t fillType, char* fillVal, + bool multigroupResult, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, + SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SArray* pGroupColList, - SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); -SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SArray* pGroupColList, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); +SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo); SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SNode* pOnCondition, SExecTaskInfo* pTaskInfo); @@ -651,7 +676,8 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntim SOperatorInfo* createTagScanOperatorInfo(SReaderHandle* pReaderHandle, SExprInfo* pExpr, int32_t numOfOutput); #endif -void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList); +void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, + int32_t numOfOutput, SArray* pPseudoList); void setInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t order); @@ -663,23 +689,27 @@ STableQueryInfo* createTableQueryInfo(void* buf, bool groupbyColumn, STimeWindow bool isTaskKilled(SExecTaskInfo* pTaskInfo); int32_t checkForQueryBuf(size_t numOfTables); -void setTaskKilled(SExecTaskInfo* pTaskInfo); +void setTaskKilled(SExecTaskInfo* pTaskInfo); void publishOperatorProfEvent(SOperatorInfo* operatorInfo, EQueryProfEventType eventType); void publishQueryAbortEvent(SExecTaskInfo* pTaskInfo, int32_t code); void queryCostStatis(SExecTaskInfo* pTaskInfo); -void doDestroyTask(SExecTaskInfo* pTaskInfo); +void doDestroyTask(SExecTaskInfo* pTaskInfo); int32_t getMaximumIdleDurationSec(); void doInvokeUdf(struct SUdfInfo* pUdfInfo, SqlFunctionCtx* pCtx, int32_t idx, int32_t type); void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status); -int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, EOPTR_EXEC_MODEL model); -int32_t getOperatorExplainExecInfo(SOperatorInfo *operatorInfo, SExplainExecInfo **pRes, int32_t *capacity, int32_t *resNum); +int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, + EOPTR_EXEC_MODEL model); +int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo** pRes, int32_t* capacity, + int32_t* resNum); -bool aggDecodeResultRow(SOperatorInfo* pOperator, SAggSupporter *pSup, SOptrBasicInfo *pInfo, char* result, int32_t length); -void aggEncodeResultRow(SOperatorInfo* pOperator, SAggSupporter *pSup, SOptrBasicInfo *pInfo, char **result, int32_t *length); +bool aggDecodeResultRow(SOperatorInfo* pOperator, SAggSupporter* pSup, SOptrBasicInfo* pInfo, char* result, + int32_t length); +void aggEncodeResultRow(SOperatorInfo* pOperator, SAggSupporter* pSup, SOptrBasicInfo* pInfo, char** result, + int32_t* length); #ifdef __cplusplus } diff --git a/source/libs/executor/inc/indexoperator.h b/source/libs/executor/inc/indexoperator.h new file mode 100644 index 0000000000..9e67ac7f41 --- /dev/null +++ b/source/libs/executor/inc/indexoperator.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "filter.h" +#include "tglobal.h" + +typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltStatus; + +SIdxFltStatus idxGetFltStatus(SNode *pFilterNode); +// construct tag filter operator later +int32_t doFilterTag(const SNode *pFilterNode, SArray *resutl); diff --git a/source/libs/executor/src/indexoperator.c b/source/libs/executor/src/indexoperator.c new file mode 100644 index 0000000000..b5b9cdb740 --- /dev/null +++ b/source/libs/executor/src/indexoperator.c @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "indexoperator.h" +#include "executorimpl.h" +#include "nodes.h" + +typedef struct SIFCtx { + int32_t code; + SHashObj *pRes; /* element is SScalarParam */ +} SIFCtx; + +typedef struct SIFParam { + SArray * result; + SHashObj *pFilter; +} SIFParam; +// construct tag filter operator later +static void destroyTagFilterOperatorInfo(void *param) { + STagFilterOperatorInfo *pInfo = (STagFilterOperatorInfo *)param; +} + +static void sifFreeParam(SIFParam *param) { + if (param == NULL) return; + taosArrayDestroy(param->result); +} + +int32_t sifInitOperParams(SIFParam *params, SOperatorNode *node, SIFCtx *ctx) { + int32_t code = 0; + return code; +} +static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *output) { + qError("index-filter not support buildin function"); + return TSDB_CODE_SUCCESS; +} +static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) { + SIFParam *params = NULL; + + return TSDB_CODE_SUCCESS; +} + +static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *output) { return TSDB_CODE_SUCCESS; } + +static EDealRes sifWalkFunction(SNode *pNode, void *context) { + // impl later + SFunctionNode *node = (SFunctionNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecFunction(node, ctx, &output); + if (ctx->code != TSDB_CODE_SUCCESS) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; +} +static EDealRes sifWalkLogic(SNode *pNode, void *context) { + SLogicConditionNode *node = (SLogicConditionNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecLogic(node, ctx, &output); + if (ctx->code) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; +} +static EDealRes sifWalkOper(SNode *pNode, void *context) { + SOperatorNode *node = (SOperatorNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecOper(node, ctx, &output); + if (ctx->code) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + + return DEAL_RES_CONTINUE; +} + +EDealRes sifCalcWalker(SNode *node, void *context) { + if (QUERY_NODE_VALUE == nodeType(node) || QUERY_NODE_NODE_LIST == nodeType(node) || + QUERY_NODE_COLUMN == nodeType(node)) { + return DEAL_RES_CONTINUE; + } + SIFCtx *ctx = (SIFCtx *)context; + if (QUERY_NODE_FUNCTION == nodeType(node)) { + return sifWalkFunction(node, ctx); + } + if (QUERY_NODE_LOGIC_CONDITION == nodeType(node)) { + return sifWalkLogic(node, ctx); + } + if (QUERY_NODE_OPERATOR == nodeType(node)) { + return sifWalkOper(node, ctx); + } + + qError("invalid node type for index filter calculating, type:%d", nodeType(node)); + ctx->code = TSDB_CODE_QRY_INVALID_INPUT; + return DEAL_RES_ERROR; +} + +void sifFreeRes(SHashObj *res) { + void *pIter = taosHashIterate(res, NULL); + while (pIter) { + SIFParam *p = pIter; + if (p) { + sifFreeParam(p); + } + pIter = taosHashIterate(res, pIter); + } + taosHashCleanup(res); +} +static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) { + if (pNode == NULL || pDst == NULL) { + return TSDB_CODE_QRY_INVALID_INPUT; + } + int32_t code = 0; + SIFCtx ctx = {.code = 0}; + ctx.pRes = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); + if (NULL == ctx.pRes) { + qError("index-filter failed to taosHashInit"); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx); + if (ctx.code != TSDB_CODE_SUCCESS) { + return ctx.code; + } + if (pDst) { + SIFParam *res = (SIFParam *)taosHashGet(ctx.pRes, (void *)&pNode, POINTER_BYTES); + if (res == NULL) { + qError("no valid res in hash, node:(%p), type(%d)", (void *)&pNode, nodeType(pNode)); + return TSDB_CODE_QRY_APP_ERROR; + } + taosArrayAddAll(pDst->result, res->result); + + sifFreeParam(res); + taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES); + } + return TSDB_CODE_SUCCESS; +} + +int32_t doFilterTag(const SNode *pFilterNode, SArray *result) { + if (pFilterNode == NULL) { + return TSDB_CODE_SUCCESS; + } + + SFilterInfo *filter = NULL; + // todo move to the initialization function + int32_t code = filterInitFromNode((SNode *)pFilterNode, &filter, 0); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + SIFParam param = {0}; + code = sifCalculate((SNode *)pFilterNode, ¶m); + + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + taosArrayAddAll(result, param.result); + sifFreeParam(¶m); + + return code; +} + +SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) { + if (pFilterNode == NULL) { + return SFLT_NOT_INDEX; + } + // impl later + return SFLT_ACCURATE_INDEX; +} diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 814076fc34..fb36c9d978 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -37,6 +37,7 @@ extern "C" { #define FUNC_MGT_WINDOW_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(8) #define FUNC_MGT_SPECIAL_DATA_REQUIRED FUNC_MGT_FUNC_CLASSIFICATION_MASK(9) #define FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED FUNC_MGT_FUNC_CLASSIFICATION_MASK(10) +#define FUNC_MGT_MULTI_RES_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(11) #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 6ed1f891a4..bba5145812 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -203,9 +203,9 @@ static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len } static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // first(*)/first(col_list) has been rewritten as first(col) + // first(col_list) will be rewritten as first(col) if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + return TSDB_CODE_SUCCESS; } SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); @@ -370,6 +370,20 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le return TSDB_CODE_SUCCESS; } +static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + SExprNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); + if (QUERY_NODE_VALUE != nodeType(pPara) || (!IS_VAR_DATA_TYPE(pPara->resType.type))) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes, .type = TSDB_DATA_TYPE_JSON}; + return TSDB_CODE_SUCCESS; +} + const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "count", @@ -475,7 +489,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last_row", .type = FUNCTION_TYPE_LAST_ROW, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateLastRow, .getEnvFunc = getMinmaxFuncEnv, .initFunc = maxFunctionSetup, @@ -485,7 +499,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "first", .type = FUNCTION_TYPE_FIRST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -495,7 +509,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last", .type = FUNCTION_TYPE_LAST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -871,6 +885,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .initFunc = NULL, .sprocessFunc = winDurFunction, .finalizeFunc = NULL + }, + { + .name = "to_json", + .type = FUNCTION_TYPE_TO_JSON, + .classification = FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateToJson, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = NULL, + .finalizeFunc = NULL } }; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index d0af3487ce..9500064949 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -138,6 +138,10 @@ bool fmIsDynamicScanOptimizedFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED); } +bool fmIsMultiResFunc(int32_t funcId) { + return isSpecificClassifyFunc(funcId, FUNC_MGT_MULTI_RES_FUNC); +} + void fmFuncMgtDestroy() { void* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 8731b26c4a..758f9d5d6f 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -84,6 +84,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SIndexOptions)); case QUERY_NODE_EXPLAIN_OPTIONS: return makeNode(type, sizeof(SExplainOptions)); + case QUERY_NODE_STREAM_OPTIONS: + return makeNode(type, sizeof(SStreamOptions)); case QUERY_NODE_SET_OPERATOR: return makeNode(type, sizeof(SSetOperator)); case QUERY_NODE_SELECT_STMT: @@ -146,6 +148,19 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SDescribeStmt)); case QUERY_NODE_RESET_QUERY_CACHE_STMT: return makeNode(type, sizeof(SNode)); + case QUERY_NODE_COMPACT_STMT: + case QUERY_NODE_CREATE_FUNCTION_STMT: + case QUERY_NODE_DROP_FUNCTION_STMT: + break; + case QUERY_NODE_CREATE_STREAM_STMT: + return makeNode(type, sizeof(SCreateStreamStmt)); + case QUERY_NODE_DROP_STREAM_STMT: + return makeNode(type, sizeof(SDropStreamStmt)); + case QUERY_NODE_MERGE_VGROUP_STMT: + case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: + case QUERY_NODE_SPLIT_VGROUP_STMT: + case QUERY_NODE_SYNCDB_STMT: + break; case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: @@ -169,7 +184,16 @@ SNodeptr nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_CONFIGS_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: case QUERY_NODE_SHOW_VNODES_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return makeNode(type, sizeof(SShowStmt)); + case QUERY_NODE_KILL_CONNECTION_STMT: + case QUERY_NODE_KILL_QUERY_STMT: + return makeNode(type, sizeof(SKillStmt)); case QUERY_NODE_LOGIC_PLAN_SCAN: return makeNode(type, sizeof(SScanLogicNode)); case QUERY_NODE_LOGIC_PLAN_JOIN: @@ -675,6 +699,7 @@ int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode) { if (NULL != pList->pTail) { pList->pTail->pNext = p; } + p->pPrev = pList->pTail; pList->pTail = p; ++(pList->length); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index b4319b4747..ebd07669c3 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -86,6 +86,7 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt); SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, const SToken* pAlias); SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); @@ -166,8 +167,9 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups); SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName); -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery); -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName); +SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery); +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName); SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2); SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index d6fc943265..91ac6ce2d2 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -293,6 +293,7 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. table_options(A) ::= . { A = createTableOptions(pCxt); } table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { ((STableOptions*)B)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C); A = B; } table_options(A) ::= table_options(B) KEEP integer_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } +table_options(A) ::= table_options(B) KEEP variable_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { ((STableOptions*)B)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { ((STableOptions*)B)->pSma = C; A = B; } table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { ((STableOptions*)B)->pFuncs = C; A = B; } @@ -306,6 +307,7 @@ alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). %destructor alter_table_option { } alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } +alter_table_option(A) ::= KEEP variable_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } %type col_name_list { SNodeList* } @@ -424,8 +426,17 @@ bufsize_opt(A) ::= . bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = strtol(B.z, NULL, 10); } /************************************************ create/drop stream **************************************************/ -cmd ::= CREATE STREAM stream_name(A) INTO table_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateStreamStmt(pCxt, &A, &B, C); } -cmd ::= DROP STREAM stream_name(A). { pCxt->pRootNode = createDropStreamStmt(pCxt, &A); } +cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) + stream_options(B) into_opt(C) AS query_expression(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, B, C, D); } +cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); } + +into_opt(A) ::= . { A = NULL; } +into_opt(A) ::= INTO full_table_name(B). { A = B; } + +stream_options(A) ::= . { A = createStreamOptions(pCxt); } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } @@ -455,6 +466,7 @@ literal(A) ::= NK_BOOL(B). literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); } literal(A) ::= duration_literal(B). { A = B; } literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } +literal(A) ::= NK_QUESTION(B). { A = createRawExprNode(pCxt, &B, createPlaceholderValueNode(pCxt)); } duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); } @@ -501,10 +513,6 @@ column_name(A) ::= NK_ID(B). %type function_name { SToken } %destructor function_name { } function_name(A) ::= NK_ID(B). { A = B; } -function_name(A) ::= FIRST(B). { A = B; } -function_name(A) ::= LAST(B). { A = B; } -function_name(A) ::= NOW(B). { A = B; } -function_name(A) ::= TODAY(B). { A = B; } %type table_alias { SToken } %destructor table_alias { } @@ -532,13 +540,9 @@ stream_name(A) ::= NK_ID(B). /************************************************ expression **********************************************************/ expression(A) ::= literal(B). { A = B; } -//expression(A) ::= NK_QUESTION(B). { A = B; } expression(A) ::= pseudo_column(B). { A = B; } expression(A) ::= column_reference(B). { A = B; } -expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } -expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); } -expression(A) ::= function_name(B) NK_LP NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNodeNoParam(pCxt, &B)); } -expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } +expression(A) ::= function_expression(B). { A = B; } //expression(A) ::= case_expression(B). { A = B; } expression(A) ::= subquery(B). { A = B; } expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); } @@ -575,6 +579,10 @@ expression(A) ::= expression(B) NK_REM expression(C). SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } +expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). { + SToken s = getTokenFromRawExprNode(pCxt, B); + A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C))); + } %type expression_list { SNodeList* } %destructor expression_list { nodesDestroyList($$); } @@ -584,15 +592,43 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -//pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -//pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= 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) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= 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) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } + +function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } +function_expression(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); } + +%type noarg_func { SToken } +%destructor noarg_func { } +noarg_func(A) ::= NOW(B). { A = B; } +noarg_func(A) ::= TODAY(B). { A = B; } + +%type star_func { SToken } +%destructor star_func { } +star_func(A) ::= COUNT(B). { A = B; } +star_func(A) ::= FIRST(B). { A = B; } +star_func(A) ::= LAST(B). { A = B; } +star_func(A) ::= LAST_ROW(B). { A = B; } + +%type star_func_para_list { SNodeList* } +%destructor star_func_para_list { nodesDestroyList($$); } +star_func_para_list(A) ::= NK_STAR(B). { A = createNodeList(pCxt, createColumnNode(pCxt, NULL, &B)); } +star_func_para_list(A) ::= other_para_list(B). { A = B; } + +%type other_para_list { SNodeList* } +%destructor other_para_list { nodesDestroyList($$); } +other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); } +other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); } + +star_func_para(A) ::= expression(B). { A = releaseRawExprNode(pCxt, B); } +star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); } /************************************************ predicate ***********************************************************/ predicate(A) ::= expression(B) compare_op(C) expression(D). { @@ -637,6 +673,7 @@ compare_op(A) ::= LIKE. compare_op(A) ::= NOT LIKE. { A = OP_TYPE_NOT_LIKE; } compare_op(A) ::= MATCH. { A = OP_TYPE_MATCH; } compare_op(A) ::= NMATCH. { A = OP_TYPE_NMATCH; } +compare_op(A) ::= CONTAINS. { A = OP_TYPE_JSON_CONTAINS; } %type in_op { EOperatorType } %destructor in_op { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 884549b118..f2b8b73a87 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -305,6 +305,13 @@ SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) { return (SNode*)val; } +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt) { + SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + CHECK_OUT_OF_MEM(val); + // todo + return (SNode*)val; +} + SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2) { SLogicConditionNode* cond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); CHECK_OUT_OF_MEM(cond); @@ -944,6 +951,18 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S return (SNode*)pStmt; } +SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SHOW_CREATE_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { + SNode* pStmt = nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) { char password[TSDB_USET_PASSWORD_LEN] = {0}; if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { @@ -1175,16 +1194,34 @@ SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName) return pStmt; } -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); - CHECK_OUT_OF_MEM(pStmt); - return pStmt; +SNode* createStreamOptions(SAstCreateContext* pCxt) { + SStreamOptions* pOptions = nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); + CHECK_OUT_OF_MEM(pOptions); + pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + return (SNode*)pOptions; } -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery) { + SCreateStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); - return pStmt; + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + if (NULL != pRealTable) { + strcpy(pStmt->targetDbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->targetTabName, ((SRealTableNode*)pRealTable)->table.tableName); + nodesDestroyNode(pRealTable); + } + pStmt->ignoreExists = ignoreExists; + pStmt->pOptions = (SStreamOptions*)pOptions; + pStmt->pQuery = pQuery; + return (SNode*)pStmt; +} + +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName) { + SDropStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + pStmt->ignoreNotExists = ignoreNotExists; + return (SNode*)pStmt; } SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 0493771b61..af2b831b93 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -39,6 +39,7 @@ static SKeyword keywordTable[] = { {"APPS", TK_APPS}, {"AS", TK_AS}, {"ASC", TK_ASC}, + {"AT_ONCE", TK_AT_ONCE}, {"BETWEEN", TK_BETWEEN}, {"BINARY", TK_BINARY}, {"BIGINT", TK_BIGINT}, @@ -50,6 +51,7 @@ static SKeyword keywordTable[] = { {"BY", TK_BY}, {"CACHE", TK_CACHE}, {"CACHELAST", TK_CACHELAST}, + {"CAST", TK_CAST}, {"COLUMN", TK_COLUMN}, {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, @@ -57,6 +59,7 @@ static SKeyword keywordTable[] = { {"CONNS", TK_CONNS}, {"CONNECTION", TK_CONNECTION}, {"CONNECTIONS", TK_CONNECTIONS}, + {"COUNT", TK_COUNT}, {"CREATE", TK_CREATE}, {"DATABASE", TK_DATABASE}, {"DATABASES", TK_DATABASES}, @@ -100,6 +103,7 @@ static SKeyword keywordTable[] = { {"KEEP", TK_KEEP}, {"KILL", TK_KILL}, {"LAST", TK_LAST}, + {"LAST_ROW", TK_LAST_ROW}, {"LICENCE", TK_LICENCE}, {"LIKE", TK_LIKE}, {"LIMIT", TK_LIMIT}, @@ -132,10 +136,8 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -145,7 +147,6 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -178,6 +179,7 @@ static SKeyword keywordTable[] = { {"TODAY", TK_TODAY}, {"TOPIC", TK_TOPIC}, {"TOPICS", TK_TOPICS}, + {"TRIGGER", TK_TRIGGER}, {"TSERIES", TK_TSERIES}, {"TTL", TK_TTL}, {"UNION", TK_UNION}, @@ -194,9 +196,14 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, + {"WATERMARK", TK_WATERMARK}, + {"WHERE", TK_WHERE}, + {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, + {"_QENDTS", TK_QENDTS}, + {"_QSTARTTS", TK_QSTARTTS}, + {"_ROWTS", TK_ROWTS}, {"_WDURATION", TK_WDURATION}, {"_WENDTS", TK_WENDTS}, - {"WHERE", TK_WHERE}, {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, @@ -260,7 +267,6 @@ static SKeyword keywordTable[] = { // {"RESTRICT", TK_RESTRICT}, // {"ROW", TK_ROW}, // {"STATEMENT", TK_STATEMENT}, - // {"TRIGGER", TK_TRIGGER}, // {"VIEW", TK_VIEW}, // {"SEMI", TK_SEMI}, // {"PARTITIONS", TK_PARTITIONS}, @@ -345,6 +351,9 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { } *tokenId = TK_NK_COMMENT; return i; + } else if (z[1] == '>') { + *tokenId = TK_NK_ARROW; + return 2; } *tokenId = TK_NK_MINUS; return 1; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f89f5fbb22..dc1338be68 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -770,92 +770,165 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { return TSDB_CODE_SUCCESS; } -static bool isFirstLastFunc(SFunctionNode* pFunc) { - return (FUNCTION_TYPE_FIRST == pFunc->funcType || FUNCTION_TYPE_LAST == pFunc->funcType); -} - -static bool isFirstLastStar(SNode* pNode) { - if (QUERY_NODE_FUNCTION != nodeType(pNode) || !isFirstLastFunc((SFunctionNode*)pNode)) { +static bool isMultiResFunc(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || !fmIsMultiResFunc(((SFunctionNode*)pNode)->funcId)) { return false; } SNodeList* pParameterList = ((SFunctionNode*)pNode)->pParameterList; - if (LIST_LENGTH(pParameterList) != 1) { - return false; + if (LIST_LENGTH(pParameterList) > 1) { + return true; } SNode* pParam = nodesListGetNode(pParameterList, 0); return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false); } -static SNode* createFirstLastFunc(SFunctionNode* pSrcFunc, SColumnNode* pCol) { +static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } pFunc->pParameterList = nodesMakeList(); - if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListAppend(pFunc->pParameterList, pCol)) { + if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListStrictAppend(pFunc->pParameterList, nodesCloneNode(pExpr))) { nodesDestroyNode(pFunc); return NULL; } - pFunc->node.resType = pCol->node.resType; + pFunc->node.resType = pExpr->resType; pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), - (FUNCTION_TYPE_FIRST == pSrcFunc->funcType ? "first(%s)" : "last(%s)"), pCol->colName); + char buf[TSDB_FUNC_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN]; + int32_t len = 0; + if (QUERY_NODE_COLUMN == nodeType(pExpr)) { + SColumnNode* pCol = (SColumnNode*)pExpr; + len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + } else { + len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + } + strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); return (SNode*)pFunc; } -static int32_t createFirstLastAllCols(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { - SNodeList* pCols = NULL; - if (TSDB_CODE_SUCCESS != createAllColumns(pCxt, &pCols)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SNodeList* pFuncs = nodesMakeList(); - if (NULL == pFuncs) { - return TSDB_CODE_OUT_OF_MEMORY; - } - SNode* pCol = NULL; - FOREACH(pCol, pCols) { - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pFuncs, createFirstLastFunc(pSrcFunc, (SColumnNode*)pCol))) { - nodesDestroyNode(pFuncs); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - *pOutput = pFuncs; - return TSDB_CODE_SUCCESS; -} - -static bool isTableStar(SNode* pNode) { - return (QUERY_NODE_COLUMN == nodeType(pNode)) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); -} - -static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { - *pOutput = nodesMakeList(); - if (NULL == *pOutput) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); - } - bool foundTable = false; +static int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput) { SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel); size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); - if (0 == strcmp(pTable->tableAlias, pCol->tableAlias)) { - int32_t code = createColumnNodeByTable(pCxt, pTable, *pOutput); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - foundTable = true; + if (NULL == pTableAlias || 0 == strcmp(pTable->tableAlias, pTableAlias)) { + *pOutput = pTable; + return TSDB_CODE_SUCCESS; + } + } + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pTableAlias); +} + +static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, pCol->tableAlias, &pTable); + if (TSDB_CODE_SUCCESS == code && NULL == *pOutput) { + *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); + } + } + if (TSDB_CODE_SUCCESS == code) { + code = createColumnNodeByTable(pCxt, pTable, *pOutput); + } + return code; +} + +static bool isStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static bool isTableStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' != ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrcParas, SNodeList** pOutput) { + int32_t code = TSDB_CODE_SUCCESS; + + SNodeList* pExprs = NULL; + SNode* pPara = NULL; + FOREACH(pPara, pSrcParas) { + if (isStar(pPara)) { + code = createAllColumns(pCxt, &pExprs); + // The syntax definition ensures that * and other parameters do not appear at the same time + break; + } else if (isTableStar(pPara)) { + code = createTableAllCols(pCxt, (SColumnNode*)pPara, &pExprs); + } else { + code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara)); + } + if (TSDB_CODE_SUCCESS != code) { break; } } - if (!foundTable) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pExprs; + } else { + nodesDestroyList(pExprs); } - return TSDB_CODE_SUCCESS; + + return code; +} + +static int32_t createMultiResFuncs(SFunctionNode* pSrcFunc, SNodeList* pExprs, SNodeList** pOutput) { + SNodeList* pFuncs = nodesMakeList(); + if (NULL == pFuncs) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pExpr = NULL; + FOREACH(pExpr, pExprs) { + code = nodesListStrictAppend(pFuncs, createMultiResFunc(pSrcFunc, (SExprNode*)pExpr)); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pFuncs; + } else { + nodesDestroyList(pFuncs); + } + + return code; +} + +static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { + SNodeList* pExprs = NULL; + int32_t code = createMultiResFuncsParas(pCxt, pSrcFunc->pParameterList, &pExprs); + if (TSDB_CODE_SUCCESS == code) { + code = createMultiResFuncs(pSrcFunc, pExprs, pOutput); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pExprs); + } + + return code; +} + +static bool isCountStar(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || 1 != LIST_LENGTH(((SFunctionNode*)pNode)->pParameterList)) { + return false; + } + SNode* pPara = nodesListGetNode(((SFunctionNode*)pNode)->pParameterList, 0); + return (QUERY_NODE_COLUMN == nodeType(pPara) && 0 == strcmp(((SColumnNode*)pPara)->colName, "*")); +} + +static int32_t rewriteCountStar(STranslateContext* pCxt, SFunctionNode* pCount) { + SColumnNode* pCol = nodesListGetNode(pCount->pParameterList, 0); + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, ('\0' == pCol->tableAlias[0] ? NULL : pCol->tableAlias), &pTable); + if (TSDB_CODE_SUCCESS == code && QUERY_NODE_REAL_TABLE == nodeType(pTable)) { + setColumnInfoBySchema((SRealTableNode*)pTable, ((SRealTableNode*)pTable)->pMeta->schema, false, pCol); + } + return code; } static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { @@ -864,9 +937,9 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { } else { SNode* pNode = NULL; WHERE_EACH(pNode, pSelect->pProjectionList) { - if (isFirstLastStar(pNode)) { + if (isMultiResFunc(pNode)) { SNodeList* pFuncs = NULL; - if (TSDB_CODE_SUCCESS != createFirstLastAllCols(pCxt, (SFunctionNode*)pNode, &pFuncs)) { + if (TSDB_CODE_SUCCESS != createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs)) { return TSDB_CODE_OUT_OF_MEMORY; } INSERT_LIST(pSelect->pProjectionList, pFuncs); @@ -880,6 +953,11 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { INSERT_LIST(pSelect->pProjectionList, pCols); ERASE_NODE(pSelect->pProjectionList); continue; + } else if (isCountStar(pNode)) { + int32_t code = rewriteCountStar(pCxt, (SFunctionNode*)pNode); + if (TSDB_CODE_SUCCESS != code) { + return code; + } } WHERE_NEXT; } @@ -2067,6 +2145,46 @@ static int32_t translateKillQuery(STranslateContext* pCxt, SKillStmt* pStmt) { return buildCmdMsg(pCxt, TDMT_MND_KILL_QUERY, (FSerializeFunc)tSerializeSKillQueryReq, &killReq); } +static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SCMCreateStreamReq createReq = {0}; + + createReq.igExists = pStmt->ignoreExists; + + SName name = {.type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId}; + strcpy(name.dbname, pCxt->pParseCxt->db); + strcpy(name.tname, pStmt->streamName); + tNameExtractFullName(&name, createReq.name); + + if ('\0' != pStmt->targetTabName[0]) { + strcpy(name.dbname, pStmt->targetDbName); + strcpy(name.tname, pStmt->targetTabName); + tNameExtractFullName(&name, createReq.outputSTbName); + } + + int32_t code = translateQuery(pCxt, pStmt->pQuery); + if (TSDB_CODE_SUCCESS == code) { + code = nodesNodeToString(pStmt->pQuery, false, &createReq.ast, NULL); + } + + if (TSDB_CODE_SUCCESS == code) { + createReq.sql = strdup(pCxt->pParseCxt->pSql); + if (NULL == createReq.sql) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, &createReq); + } + + tFreeSCMCreateStreamReq(&createReq); + return code; +} + +static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) { + // todo + return TSDB_CODE_SUCCESS; +} static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { int32_t code = TSDB_CODE_SUCCESS; @@ -2160,6 +2278,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_KILL_QUERY_STMT: code = translateKillQuery(pCxt, (SKillStmt*)pNode); break; + case QUERY_NODE_CREATE_STREAM_STMT: + code = translateCreateStream(pCxt, (SCreateStreamStmt*)pNode); + break; + case QUERY_NODE_DROP_STREAM_STMT: + code = translateDropStream(pCxt, (SDropStreamStmt*)pNode); + break; default: break; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index f4436bb3e2..80aad1dc66 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 316 +#define YYNOCODE 333 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy21; - EFillMode yy22; - EOperatorType yy84; - bool yy121; - SDataType yy160; - ENullOrder yy281; - SToken yy409; - int32_t yy452; - SNodeList* yy488; - SNode* yy504; - EOrder yy522; - EJoinType yy556; + SAlterOption yy11; + int32_t yy100; + EJoinType yy162; + EOperatorType yy218; + EOrder yy326; + SDataType yy430; + SNode* yy452; + SNodeList* yy478; + SToken yy479; + EFillMode yy540; + ENullOrder yy595; + bool yy659; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,18 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 550 -#define YYNRULE 412 -#define YYNRULE_WITH_ACTION 412 -#define YYNTOKEN 210 -#define YY_MAX_SHIFT 549 -#define YY_MIN_SHIFTREDUCE 811 -#define YY_MAX_SHIFTREDUCE 1222 -#define YY_ERROR_ACTION 1223 -#define YY_ACCEPT_ACTION 1224 -#define YY_NO_ACTION 1225 -#define YY_MIN_REDUCE 1226 -#define YY_MAX_REDUCE 1637 +#define YYNSTATE 568 +#define YYNRULE 432 +#define YYNTOKEN 219 +#define YY_MAX_SHIFT 567 +#define YY_MIN_SHIFTREDUCE 842 +#define YY_MAX_SHIFTREDUCE 1273 +#define YY_ERROR_ACTION 1274 +#define YY_ACCEPT_ACTION 1275 +#define YY_NO_ACTION 1276 +#define YY_MIN_REDUCE 1277 +#define YY_MAX_REDUCE 1708 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -210,487 +209,545 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1559) +#define YY_ACTTAB_COUNT (1929) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 452, 1224, 258, 270, 452, 465, 1436, 25, 195, 118, - /* 10 */ 1437, 1238, 30, 28, 73, 21, 307, 1505, 1337, 1487, - /* 20 */ 267, 370, 1056, 23, 464, 32, 31, 29, 27, 26, - /* 30 */ 1346, 1483, 1489, 32, 31, 29, 27, 26, 1054, 275, - /* 40 */ 1078, 1523, 32, 31, 29, 27, 26, 1616, 434, 464, - /* 50 */ 11, 30, 28, 1165, 283, 1324, 1487, 1061, 451, 267, - /* 60 */ 132, 1056, 1474, 1474, 1614, 30, 28, 450, 1483, 1489, - /* 70 */ 1505, 464, 349, 267, 1, 1056, 278, 1054, 70, 1506, - /* 80 */ 1507, 1512, 1555, 1427, 1429, 1616, 260, 1551, 127, 11, - /* 90 */ 1076, 1054, 1226, 1278, 1523, 1616, 1061, 546, 132, 1164, - /* 100 */ 191, 434, 1614, 12, 349, 1098, 414, 1582, 1615, 1055, - /* 110 */ 1061, 451, 1614, 1, 500, 1474, 94, 93, 92, 91, - /* 120 */ 90, 89, 88, 87, 86, 12, 124, 7, 1095, 138, - /* 130 */ 1487, 70, 1506, 1507, 1512, 1555, 546, 1386, 1393, 260, - /* 140 */ 1551, 127, 1483, 1490, 257, 384, 1057, 378, 1055, 1391, - /* 150 */ 546, 383, 465, 313, 98, 51, 379, 377, 50, 380, - /* 160 */ 1583, 311, 1055, 1060, 1080, 1081, 1082, 1083, 449, 1110, - /* 170 */ 1111, 1112, 1113, 1114, 1115, 1116, 431, 1346, 32, 31, - /* 180 */ 29, 27, 26, 239, 1079, 1057, 85, 133, 133, 84, - /* 190 */ 83, 82, 81, 80, 79, 78, 77, 76, 503, 1057, - /* 200 */ 1318, 101, 1060, 1080, 1081, 1082, 1083, 449, 1110, 1111, - /* 210 */ 1112, 1113, 1114, 1115, 1116, 1249, 1060, 1080, 1081, 1082, - /* 220 */ 1083, 449, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 30, - /* 230 */ 28, 306, 119, 305, 99, 425, 1304, 267, 133, 1056, - /* 240 */ 1523, 398, 30, 28, 129, 1562, 1563, 447, 1567, 238, - /* 250 */ 267, 1076, 1056, 542, 541, 1054, 251, 133, 328, 1569, - /* 260 */ 1474, 340, 32, 31, 29, 27, 26, 11, 1054, 1077, - /* 270 */ 341, 1505, 1616, 133, 1061, 899, 271, 1566, 53, 424, - /* 280 */ 30, 28, 165, 1163, 116, 132, 373, 1061, 267, 1614, - /* 290 */ 1056, 1, 1348, 165, 901, 1523, 66, 373, 252, 1342, - /* 300 */ 250, 249, 447, 372, 7, 1219, 1054, 491, 375, 384, - /* 310 */ 102, 378, 451, 465, 546, 383, 1474, 1338, 98, 375, - /* 320 */ 379, 377, 312, 380, 53, 1061, 1055, 546, 1080, 1081, - /* 330 */ 1082, 1083, 71, 1506, 1507, 1512, 1555, 97, 1346, 1055, - /* 340 */ 1554, 1551, 7, 339, 6, 1341, 334, 333, 332, 331, - /* 350 */ 330, 502, 327, 326, 325, 324, 323, 319, 318, 317, - /* 360 */ 316, 315, 314, 1057, 421, 546, 32, 31, 29, 27, - /* 370 */ 26, 382, 381, 1189, 1218, 514, 1057, 1055, 335, 301, - /* 380 */ 1060, 1080, 1081, 1082, 1083, 449, 1110, 1111, 1112, 1113, - /* 390 */ 1114, 1115, 1116, 1060, 1080, 1081, 1082, 1083, 449, 1110, - /* 400 */ 1111, 1112, 1113, 1114, 1115, 1116, 418, 1187, 1188, 1190, - /* 410 */ 1191, 29, 27, 26, 1057, 116, 1393, 133, 30, 28, - /* 420 */ 426, 422, 272, 1349, 142, 141, 267, 1391, 1056, 1179, - /* 430 */ 60, 1060, 1080, 1081, 1082, 1083, 449, 1110, 1111, 1112, - /* 440 */ 1113, 1114, 1115, 1116, 1054, 32, 31, 29, 27, 26, - /* 450 */ 1084, 1339, 937, 488, 487, 486, 941, 485, 943, 944, - /* 460 */ 484, 946, 481, 1061, 952, 478, 954, 955, 475, 472, - /* 470 */ 32, 31, 29, 27, 26, 515, 513, 1335, 1393, 1056, - /* 480 */ 1, 1275, 465, 242, 465, 465, 1248, 1160, 465, 1428, - /* 490 */ 1393, 73, 1424, 320, 321, 1054, 277, 348, 376, 140, - /* 500 */ 117, 1392, 465, 546, 116, 223, 1322, 1346, 1098, 1346, - /* 510 */ 1346, 1343, 1348, 1346, 1061, 1055, 1128, 221, 848, 1247, - /* 520 */ 847, 32, 31, 29, 27, 26, 217, 1346, 1331, 1376, - /* 530 */ 143, 1474, 431, 522, 521, 520, 519, 282, 849, 518, - /* 540 */ 517, 516, 103, 511, 510, 509, 508, 507, 506, 505, - /* 550 */ 504, 109, 1057, 1246, 546, 500, 1393, 101, 1333, 242, - /* 560 */ 438, 1245, 279, 1244, 1474, 1129, 1055, 1391, 190, 1060, - /* 570 */ 1080, 1081, 1082, 1083, 449, 1110, 1111, 1112, 1113, 1114, - /* 580 */ 1115, 1116, 465, 1133, 1329, 407, 442, 9, 8, 280, - /* 590 */ 99, 462, 1128, 68, 1243, 170, 115, 116, 1474, 433, - /* 600 */ 128, 1562, 1563, 1057, 1567, 1348, 1474, 1346, 1474, 24, - /* 610 */ 265, 1123, 1124, 1125, 1126, 1127, 1131, 1132, 1242, 406, - /* 620 */ 1060, 49, 48, 310, 1227, 137, 1241, 1240, 448, 408, - /* 630 */ 304, 1085, 1463, 1505, 1237, 1236, 1235, 465, 247, 1474, - /* 640 */ 296, 1129, 292, 288, 134, 85, 463, 1569, 84, 83, - /* 650 */ 82, 81, 80, 79, 78, 77, 76, 1523, 1569, 1133, - /* 660 */ 1616, 1141, 1346, 1474, 447, 1565, 1234, 1233, 290, 133, - /* 670 */ 490, 1474, 1474, 132, 451, 1505, 1564, 1614, 1474, 1474, - /* 680 */ 1474, 1474, 1130, 435, 431, 24, 265, 1123, 1124, 1125, - /* 690 */ 1126, 1127, 1131, 1132, 69, 1506, 1507, 1512, 1555, 1523, - /* 700 */ 1134, 1239, 241, 1551, 465, 1232, 447, 549, 1323, 101, - /* 710 */ 439, 1474, 1474, 209, 1616, 107, 451, 1505, 1231, 410, - /* 720 */ 1474, 214, 443, 1230, 96, 1229, 22, 132, 435, 1346, - /* 730 */ 538, 1614, 534, 530, 526, 213, 70, 1506, 1507, 1512, - /* 740 */ 1555, 1523, 99, 45, 260, 1551, 1628, 1186, 447, 176, - /* 750 */ 1474, 847, 188, 1562, 430, 1589, 429, 1305, 451, 1616, - /* 760 */ 437, 67, 1474, 1474, 207, 1505, 465, 368, 1474, 210, - /* 770 */ 1474, 1172, 132, 496, 446, 281, 1614, 1078, 70, 1506, - /* 780 */ 1507, 1512, 1555, 1574, 1160, 298, 260, 1551, 1628, 1523, - /* 790 */ 158, 1346, 431, 156, 461, 498, 447, 1612, 1265, 160, - /* 800 */ 300, 1260, 159, 9, 8, 162, 451, 1505, 161, 164, - /* 810 */ 1474, 1258, 163, 873, 495, 494, 493, 101, 492, 419, - /* 820 */ 385, 192, 413, 387, 396, 172, 70, 1506, 1507, 1512, - /* 830 */ 1555, 1523, 874, 390, 260, 1551, 1628, 394, 447, 179, - /* 840 */ 1040, 344, 169, 181, 440, 1573, 1221, 1222, 451, 34, - /* 850 */ 99, 34, 1474, 1135, 1505, 1093, 1064, 435, 405, 1387, - /* 860 */ 130, 1562, 1563, 153, 1567, 1063, 126, 1494, 229, 1506, - /* 870 */ 1507, 1512, 366, 65, 362, 358, 354, 152, 1523, 1492, - /* 880 */ 34, 185, 367, 62, 1023, 447, 198, 1120, 1616, 1505, - /* 890 */ 200, 1585, 95, 432, 105, 451, 457, 1505, 206, 1474, - /* 900 */ 1524, 132, 2, 54, 194, 1614, 150, 1076, 107, 285, - /* 910 */ 45, 389, 930, 1523, 925, 71, 1506, 1507, 1512, 1555, - /* 920 */ 447, 1523, 289, 445, 1551, 470, 397, 1067, 447, 958, - /* 930 */ 451, 1505, 899, 105, 1474, 106, 1066, 962, 451, 968, - /* 940 */ 167, 1032, 1474, 392, 246, 266, 248, 215, 386, 322, - /* 950 */ 120, 1506, 1507, 1512, 166, 1523, 1426, 329, 234, 1506, - /* 960 */ 1507, 1512, 447, 149, 107, 122, 1505, 146, 967, 105, - /* 970 */ 139, 342, 451, 108, 337, 1505, 1474, 1089, 336, 343, - /* 980 */ 43, 1088, 338, 42, 144, 145, 346, 345, 436, 1629, - /* 990 */ 1523, 1087, 71, 1506, 1507, 1512, 1555, 447, 347, 1523, - /* 1000 */ 1505, 1552, 148, 52, 350, 151, 447, 451, 1086, 369, - /* 1010 */ 371, 1474, 400, 1336, 415, 374, 451, 402, 399, 75, - /* 1020 */ 1474, 1321, 401, 155, 1523, 1332, 157, 234, 1506, 1507, - /* 1030 */ 1512, 447, 110, 111, 256, 171, 233, 1506, 1507, 1512, - /* 1040 */ 174, 451, 1505, 1334, 1330, 1474, 412, 112, 1505, 113, - /* 1050 */ 1085, 420, 409, 1596, 1505, 455, 1586, 411, 1595, 1061, - /* 1060 */ 5, 120, 1506, 1507, 1512, 184, 1523, 177, 427, 428, - /* 1070 */ 1576, 416, 1523, 447, 417, 125, 186, 4, 1523, 447, - /* 1080 */ 100, 1160, 210, 451, 180, 447, 496, 1474, 1084, 451, - /* 1090 */ 264, 259, 423, 1474, 35, 451, 268, 444, 1570, 1474, - /* 1100 */ 1630, 261, 1505, 234, 1506, 1507, 1512, 441, 498, 234, - /* 1110 */ 1506, 1507, 1512, 1505, 193, 226, 1506, 1507, 1512, 1631, - /* 1120 */ 17, 1537, 1435, 187, 1613, 453, 1523, 495, 494, 493, - /* 1130 */ 454, 492, 1434, 447, 269, 458, 459, 1523, 1505, 460, - /* 1140 */ 202, 204, 216, 451, 447, 59, 1347, 1474, 61, 497, - /* 1150 */ 468, 1319, 218, 212, 451, 545, 220, 222, 1474, 224, - /* 1160 */ 225, 1468, 1523, 232, 1506, 1507, 1512, 1505, 1467, 447, - /* 1170 */ 41, 284, 1505, 286, 235, 1506, 1507, 1512, 1464, 451, - /* 1180 */ 1505, 287, 291, 1474, 1050, 1051, 135, 1462, 293, 294, - /* 1190 */ 295, 1523, 1461, 297, 1460, 299, 1523, 1451, 447, 227, - /* 1200 */ 1506, 1507, 1512, 447, 1523, 136, 302, 303, 451, 1035, - /* 1210 */ 1034, 447, 1474, 451, 1505, 1445, 1444, 1474, 308, 309, - /* 1220 */ 1443, 451, 1442, 1006, 1419, 1474, 1418, 1417, 236, 1506, - /* 1230 */ 1507, 1512, 1416, 228, 1506, 1507, 1512, 1415, 1523, 1414, - /* 1240 */ 1413, 237, 1506, 1507, 1512, 447, 1412, 1411, 1410, 1409, - /* 1250 */ 1505, 1408, 1407, 1406, 1405, 451, 1505, 1404, 1403, 1474, - /* 1260 */ 104, 1402, 1505, 1401, 1400, 1399, 1398, 1008, 1397, 1396, - /* 1270 */ 1395, 1394, 1277, 1459, 1523, 1520, 1506, 1507, 1512, 1453, - /* 1280 */ 1523, 447, 1441, 1432, 147, 1325, 1523, 447, 1276, 866, - /* 1290 */ 1274, 451, 1272, 447, 351, 1474, 352, 451, 353, 1270, - /* 1300 */ 355, 1474, 357, 451, 1505, 359, 1268, 1474, 1257, 1505, - /* 1310 */ 356, 1519, 1506, 1507, 1512, 363, 360, 244, 1506, 1507, - /* 1320 */ 1512, 361, 364, 1518, 1506, 1507, 1512, 365, 1523, 1256, - /* 1330 */ 1253, 1327, 975, 1523, 973, 447, 1326, 1266, 274, 273, - /* 1340 */ 447, 898, 897, 896, 253, 451, 1261, 514, 1069, 1474, - /* 1350 */ 451, 1505, 895, 892, 1474, 891, 254, 1505, 74, 388, - /* 1360 */ 512, 1259, 154, 255, 1062, 245, 1506, 1507, 1512, 1252, - /* 1370 */ 243, 1506, 1507, 1512, 393, 1523, 391, 1251, 395, 72, - /* 1380 */ 1458, 1523, 447, 1061, 168, 1042, 1505, 1452, 447, 403, - /* 1390 */ 1440, 1439, 451, 114, 1431, 55, 1474, 173, 451, 3, - /* 1400 */ 14, 121, 1474, 34, 1492, 15, 39, 57, 178, 189, - /* 1410 */ 1523, 183, 240, 1506, 1507, 1512, 182, 447, 230, 1506, - /* 1420 */ 1507, 1512, 19, 466, 1185, 44, 1178, 451, 123, 404, - /* 1430 */ 175, 1474, 56, 38, 20, 1065, 37, 1157, 1207, 1156, - /* 1440 */ 1206, 131, 16, 1212, 262, 1211, 1210, 231, 1506, 1507, - /* 1450 */ 1512, 263, 8, 1096, 1094, 33, 196, 13, 18, 1430, - /* 1460 */ 197, 1121, 203, 1183, 1071, 469, 199, 201, 1491, 46, - /* 1470 */ 58, 467, 1070, 62, 959, 456, 205, 276, 40, 471, - /* 1480 */ 936, 36, 473, 208, 956, 474, 476, 953, 477, 1073, - /* 1490 */ 947, 10, 479, 945, 480, 482, 483, 951, 63, 970, - /* 1500 */ 950, 966, 47, 64, 489, 964, 864, 501, 905, 949, - /* 1510 */ 499, 211, 887, 886, 885, 948, 884, 883, 882, 881, - /* 1520 */ 880, 902, 900, 877, 876, 875, 872, 871, 870, 869, - /* 1530 */ 969, 1273, 523, 524, 1271, 525, 528, 527, 529, 1269, - /* 1540 */ 531, 532, 1267, 1255, 533, 535, 536, 537, 1254, 539, - /* 1550 */ 540, 1250, 543, 544, 1225, 1058, 548, 219, 547, + /* 0 */ 1388, 1687, 1386, 1561, 268, 26, 203, 323, 482, 1275, + /* 10 */ 469, 1547, 33, 31, 1686, 1561, 1490, 77, 1685, 1300, + /* 20 */ 277, 1547, 1095, 285, 380, 1543, 1550, 1577, 34, 32, + /* 30 */ 30, 29, 28, 1397, 466, 1543, 1549, 248, 1093, 1577, + /* 40 */ 1547, 481, 53, 417, 465, 1533, 466, 441, 1533, 1116, + /* 50 */ 12, 33, 31, 1216, 1543, 1549, 465, 1101, 481, 277, + /* 60 */ 1533, 1095, 293, 1393, 1533, 445, 125, 1562, 468, 1564, + /* 70 */ 1565, 464, 104, 459, 1, 482, 359, 1093, 72, 1562, + /* 80 */ 468, 1564, 1565, 464, 321, 459, 1375, 418, 1626, 12, + /* 90 */ 482, 1230, 249, 1622, 124, 36, 1101, 564, 1355, 77, + /* 100 */ 1397, 1687, 33, 31, 1687, 123, 387, 1289, 102, 1094, + /* 110 */ 277, 1701, 1095, 1, 136, 1397, 1373, 136, 1685, 1118, + /* 120 */ 22, 1685, 443, 132, 1633, 1634, 1687, 1638, 1093, 1278, + /* 130 */ 34, 32, 30, 29, 28, 359, 564, 1329, 1446, 136, + /* 140 */ 12, 560, 559, 1685, 267, 1577, 1096, 1101, 1094, 1444, + /* 150 */ 87, 127, 466, 86, 85, 84, 83, 82, 81, 80, + /* 160 */ 79, 78, 1438, 469, 1, 518, 280, 1099, 1100, 1489, + /* 170 */ 1144, 1145, 1146, 1147, 1148, 1149, 1150, 461, 1155, 1156, + /* 180 */ 1157, 1158, 1159, 1160, 53, 1096, 434, 564, 431, 395, + /* 190 */ 316, 389, 315, 1299, 481, 394, 137, 99, 101, 1094, + /* 200 */ 390, 388, 1298, 391, 1640, 1392, 1099, 1100, 878, 1144, + /* 210 */ 1145, 1146, 1147, 1148, 1149, 1150, 461, 1155, 1156, 1157, + /* 220 */ 1158, 1159, 1160, 100, 378, 137, 441, 383, 1637, 33, + /* 230 */ 31, 34, 32, 30, 29, 28, 1096, 277, 1533, 1095, + /* 240 */ 930, 137, 34, 32, 30, 29, 28, 1533, 36, 386, + /* 250 */ 137, 104, 1522, 436, 432, 1093, 441, 1099, 1100, 932, + /* 260 */ 1144, 1145, 1146, 1147, 1148, 1149, 1150, 461, 1155, 1156, + /* 270 */ 1157, 1158, 1159, 1160, 1101, 33, 31, 1161, 55, 266, + /* 280 */ 250, 104, 174, 277, 435, 1095, 1326, 102, 300, 87, + /* 290 */ 1297, 7, 86, 85, 84, 83, 82, 81, 80, 79, + /* 300 */ 78, 1093, 133, 1633, 1634, 1131, 1638, 281, 9, 8, + /* 310 */ 395, 1120, 389, 1178, 564, 121, 394, 102, 1119, 101, + /* 320 */ 1101, 390, 388, 1399, 391, 317, 1094, 1240, 30, 29, + /* 330 */ 28, 260, 134, 1633, 1634, 1533, 1638, 7, 540, 539, + /* 340 */ 538, 537, 292, 1117, 536, 535, 534, 107, 529, 528, + /* 350 */ 527, 526, 525, 524, 523, 522, 114, 100, 385, 384, + /* 360 */ 564, 383, 1179, 1096, 1687, 428, 1238, 1239, 1241, 1242, + /* 370 */ 137, 225, 1094, 261, 1427, 259, 258, 136, 382, 1296, + /* 380 */ 1184, 1685, 1192, 386, 1099, 1100, 448, 1144, 1145, 1146, + /* 390 */ 1147, 1148, 1149, 1150, 461, 1155, 1156, 1157, 1158, 1159, + /* 400 */ 1160, 449, 33, 31, 34, 32, 30, 29, 28, 1096, + /* 410 */ 277, 69, 1095, 137, 25, 275, 1173, 1174, 1175, 1176, + /* 420 */ 1177, 1181, 1182, 1183, 1533, 105, 143, 409, 1093, 198, + /* 430 */ 1099, 1100, 1389, 1144, 1145, 1146, 1147, 1148, 1149, 1150, + /* 440 */ 461, 1155, 1156, 1157, 1158, 1159, 1160, 1101, 33, 31, + /* 450 */ 284, 283, 51, 1215, 288, 50, 277, 1446, 1095, 24, + /* 460 */ 1109, 1480, 1482, 282, 7, 400, 1687, 1446, 1444, 34, + /* 470 */ 32, 30, 29, 28, 1093, 482, 1102, 1295, 1481, 136, + /* 480 */ 408, 1640, 287, 1685, 322, 532, 879, 564, 878, 311, + /* 490 */ 121, 393, 392, 1101, 173, 1101, 345, 403, 1399, 1094, + /* 500 */ 1397, 1294, 397, 6, 1293, 1636, 880, 521, 172, 1369, + /* 510 */ 1, 968, 505, 504, 503, 972, 502, 974, 975, 501, + /* 520 */ 977, 498, 1533, 983, 495, 985, 986, 492, 489, 247, + /* 530 */ 120, 1116, 290, 564, 45, 483, 1096, 44, 338, 518, + /* 540 */ 121, 350, 147, 146, 450, 1094, 1533, 1105, 1399, 1533, + /* 550 */ 351, 34, 32, 30, 29, 28, 1292, 1099, 1100, 1640, + /* 560 */ 1144, 1145, 1146, 1147, 1148, 1149, 1150, 461, 1155, 1156, + /* 570 */ 1157, 1158, 1159, 1160, 34, 32, 30, 29, 28, 1180, + /* 580 */ 1291, 508, 1096, 1635, 1110, 515, 514, 533, 531, 250, + /* 590 */ 34, 32, 30, 29, 28, 447, 1121, 1185, 9, 8, + /* 600 */ 62, 1533, 1288, 1099, 1100, 1113, 1144, 1145, 1146, 1147, + /* 610 */ 1148, 1149, 1150, 461, 1155, 1156, 1157, 1158, 1159, 1160, + /* 620 */ 1561, 1390, 1178, 349, 520, 1533, 344, 343, 342, 341, + /* 630 */ 340, 23, 337, 336, 335, 334, 333, 329, 328, 327, + /* 640 */ 326, 325, 324, 482, 1577, 482, 1214, 1533, 482, 567, + /* 650 */ 121, 444, 330, 1131, 331, 1211, 1446, 358, 1400, 1645, + /* 660 */ 1211, 465, 289, 221, 1287, 1533, 98, 1444, 1397, 482, + /* 670 */ 1397, 1179, 556, 1397, 552, 548, 544, 220, 1394, 1081, + /* 680 */ 1082, 1446, 416, 73, 1562, 468, 1564, 1565, 464, 1184, + /* 690 */ 459, 482, 1445, 1626, 1397, 482, 1290, 270, 1622, 131, + /* 700 */ 291, 1270, 1286, 70, 1514, 1285, 215, 452, 1477, 1533, + /* 710 */ 1561, 199, 482, 482, 184, 145, 1397, 424, 1653, 1382, + /* 720 */ 1397, 479, 480, 25, 275, 1173, 1174, 1175, 1176, 1177, + /* 730 */ 1181, 1182, 1183, 1223, 1577, 1316, 478, 1397, 1397, 1118, + /* 740 */ 482, 444, 165, 308, 456, 163, 1284, 1533, 1283, 217, + /* 750 */ 1533, 465, 1282, 1281, 1166, 1533, 1280, 396, 407, 200, + /* 760 */ 1118, 1384, 310, 167, 423, 1397, 166, 180, 1561, 169, + /* 770 */ 1380, 405, 168, 73, 1562, 468, 1564, 1565, 464, 1269, + /* 780 */ 459, 429, 1073, 1626, 176, 1311, 68, 270, 1622, 131, + /* 790 */ 1277, 1533, 1577, 1533, 1272, 1273, 64, 1533, 1533, 466, + /* 800 */ 171, 1533, 1309, 170, 177, 460, 507, 398, 1654, 465, + /* 810 */ 1356, 1439, 410, 1533, 96, 95, 94, 93, 92, 91, + /* 820 */ 90, 89, 88, 112, 401, 47, 1561, 420, 377, 1237, + /* 830 */ 1554, 73, 1562, 468, 1564, 1565, 464, 193, 459, 187, + /* 840 */ 1656, 1626, 1552, 189, 35, 270, 1622, 1699, 1186, 442, + /* 850 */ 1577, 35, 453, 122, 904, 1151, 1660, 466, 231, 35, + /* 860 */ 206, 1170, 1104, 1056, 208, 1578, 160, 465, 1103, 130, + /* 870 */ 229, 1533, 109, 905, 202, 376, 474, 372, 368, 364, + /* 880 */ 159, 110, 2, 148, 1561, 214, 1116, 295, 299, 73, + /* 890 */ 1562, 468, 1564, 1565, 464, 255, 459, 112, 930, 1626, + /* 900 */ 257, 961, 1065, 270, 1622, 1699, 54, 47, 1577, 157, + /* 910 */ 222, 956, 332, 487, 1683, 466, 110, 989, 111, 112, + /* 920 */ 993, 1479, 1000, 999, 110, 465, 144, 339, 113, 1533, + /* 930 */ 347, 346, 348, 1107, 352, 353, 1125, 149, 354, 1106, + /* 940 */ 1561, 1124, 355, 152, 1123, 356, 71, 73, 1562, 468, + /* 950 */ 1564, 1565, 464, 1561, 459, 155, 52, 1626, 360, 357, + /* 960 */ 1122, 270, 1622, 1699, 1577, 379, 156, 381, 151, 158, + /* 970 */ 153, 466, 1644, 1387, 49, 48, 320, 1577, 142, 162, + /* 980 */ 1383, 465, 164, 314, 463, 1533, 265, 150, 115, 116, + /* 990 */ 445, 1561, 1385, 1381, 465, 256, 117, 306, 1533, 302, + /* 1000 */ 298, 139, 97, 238, 1562, 468, 1564, 1565, 464, 441, + /* 1010 */ 459, 118, 1101, 175, 411, 1577, 245, 1562, 468, 1564, + /* 1020 */ 1565, 464, 466, 459, 1518, 1599, 223, 412, 421, 1687, + /* 1030 */ 415, 137, 465, 1121, 104, 419, 1533, 1657, 179, 182, + /* 1040 */ 422, 430, 136, 472, 1667, 185, 1685, 188, 438, 1561, + /* 1050 */ 427, 269, 5, 445, 74, 1562, 468, 1564, 1565, 464, + /* 1060 */ 433, 459, 426, 1647, 1626, 1666, 4, 1211, 1625, 1622, + /* 1070 */ 102, 103, 192, 1577, 129, 194, 1120, 1641, 37, 1561, + /* 1080 */ 466, 16, 271, 451, 195, 196, 1633, 440, 454, 439, + /* 1090 */ 465, 1488, 1687, 1684, 1533, 1702, 201, 1607, 470, 471, + /* 1100 */ 224, 475, 1487, 1577, 210, 136, 279, 212, 476, 1685, + /* 1110 */ 463, 61, 74, 1562, 468, 1564, 1565, 464, 477, 459, + /* 1120 */ 465, 63, 1626, 485, 1533, 1370, 455, 1622, 1561, 1398, + /* 1130 */ 226, 219, 563, 43, 128, 232, 233, 1561, 228, 1095, + /* 1140 */ 230, 1527, 245, 1562, 468, 1564, 1565, 464, 462, 459, + /* 1150 */ 457, 1598, 1577, 1526, 294, 1093, 1523, 296, 297, 466, + /* 1160 */ 1089, 1577, 1090, 140, 301, 1521, 303, 304, 466, 465, + /* 1170 */ 307, 305, 1520, 1533, 1101, 1561, 1519, 309, 465, 1504, + /* 1180 */ 141, 312, 1533, 313, 1068, 1067, 1498, 1561, 1497, 318, + /* 1190 */ 319, 125, 1562, 468, 1564, 1565, 464, 1496, 459, 1577, + /* 1200 */ 74, 1562, 468, 1564, 1565, 464, 466, 459, 1495, 1472, + /* 1210 */ 1626, 1577, 1039, 1471, 564, 1623, 465, 1470, 466, 1469, + /* 1220 */ 1533, 108, 1456, 425, 1468, 1467, 1094, 1466, 465, 1465, + /* 1230 */ 1464, 1463, 1533, 1462, 1461, 446, 1700, 1460, 246, 1562, + /* 1240 */ 468, 1564, 1565, 464, 1459, 459, 1561, 1458, 1457, 1455, + /* 1250 */ 241, 1562, 468, 1564, 1565, 464, 1454, 459, 1453, 1561, + /* 1260 */ 1452, 1451, 1041, 1096, 1450, 1449, 1448, 1447, 1328, 1512, + /* 1270 */ 1577, 154, 1376, 1327, 897, 1325, 361, 466, 1506, 1494, + /* 1280 */ 1485, 362, 363, 1577, 1099, 1100, 1323, 465, 437, 365, + /* 1290 */ 466, 1533, 1321, 366, 276, 367, 371, 369, 370, 1319, + /* 1300 */ 465, 373, 1308, 1307, 1533, 1304, 374, 274, 1378, 246, + /* 1310 */ 1562, 468, 1564, 1565, 464, 76, 459, 1561, 1005, 375, + /* 1320 */ 1008, 1377, 246, 1562, 468, 1564, 1565, 464, 929, 459, + /* 1330 */ 1317, 161, 928, 1561, 262, 927, 926, 1312, 923, 263, + /* 1340 */ 1310, 1577, 922, 1303, 264, 1561, 399, 402, 466, 404, + /* 1350 */ 1302, 406, 530, 75, 532, 1511, 46, 1577, 465, 1505, + /* 1360 */ 413, 1075, 1533, 119, 466, 278, 1493, 1492, 1484, 1577, + /* 1370 */ 186, 178, 38, 414, 465, 181, 466, 3, 1533, 1374, + /* 1380 */ 246, 1562, 468, 1564, 1565, 464, 465, 459, 56, 35, + /* 1390 */ 1533, 13, 1561, 40, 1236, 41, 234, 1562, 468, 1564, + /* 1400 */ 1565, 464, 126, 459, 14, 1561, 1229, 183, 240, 1562, + /* 1410 */ 468, 1564, 1565, 464, 1208, 459, 1577, 191, 190, 20, + /* 1420 */ 1552, 57, 21, 466, 39, 15, 11, 1207, 197, 1577, + /* 1430 */ 58, 1263, 1258, 465, 135, 1257, 466, 1533, 1372, 272, + /* 1440 */ 106, 1262, 1261, 1561, 513, 273, 465, 8, 17, 1154, + /* 1450 */ 1533, 1171, 458, 1139, 27, 242, 1562, 468, 1564, 1565, + /* 1460 */ 464, 1153, 459, 1152, 205, 10, 516, 1577, 235, 1562, + /* 1470 */ 468, 1564, 1565, 464, 466, 459, 138, 1234, 204, 18, + /* 1480 */ 467, 1483, 19, 207, 465, 512, 511, 510, 1533, 509, + /* 1490 */ 209, 59, 211, 1561, 213, 60, 473, 64, 1551, 106, + /* 1500 */ 216, 1111, 42, 513, 484, 990, 243, 1562, 468, 1564, + /* 1510 */ 1565, 464, 486, 459, 286, 488, 490, 1577, 987, 984, + /* 1520 */ 491, 493, 494, 1561, 466, 516, 978, 496, 497, 499, + /* 1530 */ 976, 500, 982, 967, 465, 981, 980, 506, 1533, 979, + /* 1540 */ 65, 1002, 66, 67, 512, 511, 510, 1577, 509, 995, + /* 1550 */ 998, 1001, 895, 936, 466, 517, 236, 1562, 468, 1564, + /* 1560 */ 1565, 464, 519, 459, 465, 911, 218, 918, 1533, 917, + /* 1570 */ 916, 1561, 915, 914, 913, 912, 933, 931, 908, 907, + /* 1580 */ 1561, 543, 906, 903, 902, 901, 244, 1562, 468, 1564, + /* 1590 */ 1565, 464, 900, 459, 1324, 1577, 541, 542, 1322, 546, + /* 1600 */ 545, 1320, 466, 547, 1577, 549, 550, 551, 1318, 553, + /* 1610 */ 554, 466, 465, 1306, 557, 555, 1533, 558, 1305, 1301, + /* 1620 */ 562, 465, 561, 566, 1097, 1533, 227, 565, 1561, 1276, + /* 1630 */ 1276, 1276, 1276, 1276, 237, 1562, 468, 1564, 1565, 464, + /* 1640 */ 1276, 459, 1276, 1573, 1562, 468, 1564, 1565, 464, 1276, + /* 1650 */ 459, 1276, 1577, 1276, 1276, 1276, 1561, 1276, 1276, 466, + /* 1660 */ 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 465, + /* 1670 */ 1276, 1276, 1276, 1533, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1680 */ 1577, 1276, 1276, 1276, 1276, 1276, 1276, 466, 1276, 1276, + /* 1690 */ 1276, 1572, 1562, 468, 1564, 1565, 464, 465, 459, 1276, + /* 1700 */ 1276, 1533, 1276, 1276, 1276, 1276, 1276, 1561, 1276, 1276, + /* 1710 */ 1276, 1276, 1276, 1276, 1276, 1276, 1561, 1276, 1276, 1571, + /* 1720 */ 1562, 468, 1564, 1565, 464, 1276, 459, 1276, 1276, 1276, + /* 1730 */ 1276, 1577, 1276, 1276, 1276, 1276, 1276, 1276, 466, 1276, + /* 1740 */ 1577, 1276, 1276, 1276, 1276, 1276, 1276, 466, 465, 1276, + /* 1750 */ 1276, 1276, 1533, 1276, 1276, 1276, 1276, 465, 1276, 1276, + /* 1760 */ 1276, 1533, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1770 */ 253, 1562, 468, 1564, 1565, 464, 1276, 459, 1276, 252, + /* 1780 */ 1562, 468, 1564, 1565, 464, 1276, 459, 1561, 1276, 1276, + /* 1790 */ 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1800 */ 1276, 1276, 1276, 1561, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1810 */ 1276, 1577, 1276, 1276, 1276, 1276, 1276, 1276, 466, 1276, + /* 1820 */ 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1577, 465, 1276, + /* 1830 */ 1276, 1276, 1533, 1276, 466, 1276, 1276, 1276, 1276, 1276, + /* 1840 */ 1276, 1276, 1276, 1276, 465, 1276, 1276, 1276, 1533, 1276, + /* 1850 */ 254, 1562, 468, 1564, 1565, 464, 1276, 459, 1561, 1276, + /* 1860 */ 1276, 1276, 1276, 1276, 1276, 1276, 251, 1562, 468, 1564, + /* 1870 */ 1565, 464, 1276, 459, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1880 */ 1276, 1276, 1577, 1276, 1276, 1276, 1276, 1276, 1276, 466, + /* 1890 */ 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 465, + /* 1900 */ 1276, 1276, 1276, 1533, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1910 */ 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, 1276, + /* 1920 */ 1276, 239, 1562, 468, 1564, 1565, 464, 1276, 459, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 254, 210, 241, 257, 254, 219, 260, 279, 280, 212, - /* 10 */ 260, 214, 12, 13, 228, 2, 263, 213, 213, 258, - /* 20 */ 20, 235, 22, 2, 20, 12, 13, 14, 15, 16, - /* 30 */ 244, 270, 271, 12, 13, 14, 15, 16, 38, 241, - /* 40 */ 20, 237, 12, 13, 14, 15, 16, 294, 244, 20, - /* 50 */ 50, 12, 13, 14, 263, 0, 258, 57, 254, 20, - /* 60 */ 307, 22, 258, 258, 311, 12, 13, 14, 270, 271, - /* 70 */ 213, 20, 49, 20, 74, 22, 246, 38, 274, 275, - /* 80 */ 276, 277, 278, 253, 254, 294, 282, 283, 284, 50, - /* 90 */ 20, 38, 0, 0, 237, 294, 57, 97, 307, 4, - /* 100 */ 296, 244, 311, 74, 49, 75, 302, 303, 307, 109, - /* 110 */ 57, 254, 311, 74, 49, 258, 24, 25, 26, 27, - /* 120 */ 28, 29, 30, 31, 32, 74, 236, 74, 75, 47, - /* 130 */ 258, 274, 275, 276, 277, 278, 97, 247, 237, 282, - /* 140 */ 283, 284, 270, 271, 243, 52, 146, 54, 109, 248, - /* 150 */ 97, 58, 219, 219, 61, 73, 63, 64, 76, 66, - /* 160 */ 303, 228, 109, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 173, 174, 175, 219, 244, 12, 13, - /* 180 */ 14, 15, 16, 249, 20, 146, 21, 187, 187, 24, - /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 225, 146, - /* 200 */ 227, 244, 163, 164, 165, 166, 167, 168, 169, 170, - /* 210 */ 171, 172, 173, 174, 175, 213, 163, 164, 165, 166, - /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 175, 12, - /* 230 */ 13, 145, 222, 147, 277, 20, 226, 20, 187, 22, - /* 240 */ 237, 263, 12, 13, 287, 288, 289, 244, 291, 18, - /* 250 */ 20, 20, 22, 216, 217, 38, 35, 187, 27, 272, - /* 260 */ 258, 30, 12, 13, 14, 15, 16, 50, 38, 20, - /* 270 */ 39, 213, 294, 187, 57, 38, 229, 290, 221, 276, - /* 280 */ 12, 13, 61, 188, 237, 307, 65, 57, 20, 311, - /* 290 */ 22, 74, 245, 61, 57, 237, 218, 65, 77, 242, - /* 300 */ 79, 80, 244, 82, 74, 139, 38, 85, 87, 52, - /* 310 */ 232, 54, 254, 219, 97, 58, 258, 239, 61, 87, - /* 320 */ 63, 64, 228, 66, 221, 57, 109, 97, 164, 165, - /* 330 */ 166, 167, 274, 275, 276, 277, 278, 234, 244, 109, - /* 340 */ 282, 283, 74, 112, 43, 242, 115, 116, 117, 118, - /* 350 */ 119, 57, 121, 122, 123, 124, 125, 126, 127, 128, - /* 360 */ 129, 130, 131, 146, 136, 97, 12, 13, 14, 15, - /* 370 */ 16, 223, 224, 163, 208, 71, 146, 109, 67, 75, - /* 380 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 390 */ 173, 174, 175, 163, 164, 165, 166, 167, 168, 169, - /* 400 */ 170, 171, 172, 173, 174, 175, 196, 197, 198, 199, - /* 410 */ 200, 14, 15, 16, 146, 237, 237, 187, 12, 13, - /* 420 */ 192, 193, 243, 245, 113, 114, 20, 248, 22, 75, - /* 430 */ 218, 163, 164, 165, 166, 167, 168, 169, 170, 171, - /* 440 */ 172, 173, 174, 175, 38, 12, 13, 14, 15, 16, - /* 450 */ 20, 239, 88, 89, 90, 91, 92, 93, 94, 95, - /* 460 */ 96, 97, 98, 57, 100, 101, 102, 103, 104, 105, - /* 470 */ 12, 13, 14, 15, 16, 223, 224, 238, 237, 22, - /* 480 */ 74, 0, 219, 50, 219, 219, 213, 186, 219, 248, - /* 490 */ 237, 228, 244, 228, 228, 38, 229, 228, 235, 251, - /* 500 */ 18, 248, 219, 97, 237, 23, 0, 244, 75, 244, - /* 510 */ 244, 228, 245, 244, 57, 109, 83, 35, 20, 213, - /* 520 */ 22, 12, 13, 14, 15, 16, 230, 244, 238, 233, - /* 530 */ 48, 258, 219, 52, 53, 54, 55, 56, 40, 58, - /* 540 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - /* 550 */ 69, 70, 146, 213, 97, 49, 237, 244, 238, 50, - /* 560 */ 3, 213, 243, 213, 258, 132, 109, 248, 138, 163, - /* 570 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - /* 580 */ 174, 175, 219, 150, 238, 219, 71, 1, 2, 229, - /* 590 */ 277, 228, 83, 111, 213, 238, 138, 237, 258, 286, - /* 600 */ 287, 288, 289, 146, 291, 245, 258, 244, 258, 176, - /* 610 */ 177, 178, 179, 180, 181, 182, 183, 184, 213, 266, - /* 620 */ 163, 139, 140, 141, 0, 143, 213, 213, 238, 263, - /* 630 */ 148, 20, 0, 213, 213, 213, 213, 219, 156, 258, - /* 640 */ 158, 132, 160, 161, 162, 21, 228, 272, 24, 25, - /* 650 */ 26, 27, 28, 29, 30, 31, 32, 237, 272, 150, - /* 660 */ 294, 75, 244, 258, 244, 290, 213, 213, 36, 187, - /* 670 */ 238, 258, 258, 307, 254, 213, 290, 311, 258, 258, - /* 680 */ 258, 258, 132, 263, 219, 176, 177, 178, 179, 180, - /* 690 */ 181, 182, 183, 184, 274, 275, 276, 277, 278, 237, - /* 700 */ 150, 214, 282, 283, 219, 213, 244, 19, 0, 244, - /* 710 */ 71, 258, 258, 228, 294, 71, 254, 213, 213, 75, - /* 720 */ 258, 33, 207, 213, 36, 213, 176, 307, 263, 244, - /* 730 */ 42, 311, 44, 45, 46, 47, 274, 275, 276, 277, - /* 740 */ 278, 237, 277, 71, 282, 283, 284, 75, 244, 138, - /* 750 */ 258, 22, 287, 288, 289, 293, 291, 226, 254, 294, - /* 760 */ 203, 73, 258, 258, 76, 213, 219, 38, 258, 61, - /* 770 */ 258, 14, 307, 65, 50, 228, 311, 20, 274, 275, - /* 780 */ 276, 277, 278, 185, 186, 142, 282, 283, 284, 237, - /* 790 */ 78, 244, 219, 81, 106, 87, 244, 293, 0, 78, - /* 800 */ 157, 0, 81, 1, 2, 78, 254, 213, 81, 78, - /* 810 */ 258, 0, 81, 38, 106, 107, 108, 244, 110, 305, - /* 820 */ 22, 314, 134, 22, 21, 137, 274, 275, 276, 277, - /* 830 */ 278, 237, 57, 22, 282, 283, 284, 34, 244, 71, - /* 840 */ 152, 254, 154, 75, 205, 293, 164, 165, 254, 71, - /* 850 */ 277, 71, 258, 75, 213, 75, 38, 263, 254, 247, - /* 860 */ 287, 288, 289, 33, 291, 38, 36, 74, 274, 275, - /* 870 */ 276, 277, 42, 74, 44, 45, 46, 47, 237, 86, - /* 880 */ 71, 299, 216, 84, 75, 244, 71, 163, 294, 213, - /* 890 */ 75, 273, 71, 292, 71, 254, 75, 213, 75, 258, - /* 900 */ 237, 307, 295, 73, 308, 311, 76, 20, 71, 219, - /* 910 */ 71, 4, 75, 237, 75, 274, 275, 276, 277, 278, - /* 920 */ 244, 237, 36, 282, 283, 71, 19, 109, 244, 75, - /* 930 */ 254, 213, 38, 71, 258, 71, 109, 75, 254, 75, - /* 940 */ 33, 144, 258, 36, 269, 261, 223, 264, 41, 219, - /* 950 */ 274, 275, 276, 277, 47, 237, 219, 252, 274, 275, - /* 960 */ 276, 277, 244, 133, 71, 135, 213, 137, 75, 71, - /* 970 */ 120, 219, 254, 75, 132, 213, 258, 20, 250, 268, - /* 980 */ 73, 20, 250, 76, 154, 221, 244, 262, 312, 313, - /* 990 */ 237, 20, 274, 275, 276, 277, 278, 244, 255, 237, - /* 1000 */ 213, 283, 221, 221, 219, 221, 244, 254, 20, 215, - /* 1010 */ 237, 258, 268, 237, 261, 223, 254, 267, 244, 219, - /* 1020 */ 258, 0, 153, 237, 237, 237, 237, 274, 275, 276, - /* 1030 */ 277, 244, 237, 237, 215, 218, 274, 275, 276, 277, - /* 1040 */ 218, 254, 213, 237, 237, 258, 255, 237, 213, 237, - /* 1050 */ 20, 195, 262, 304, 213, 194, 273, 244, 304, 57, - /* 1060 */ 202, 274, 275, 276, 277, 300, 237, 259, 306, 201, - /* 1070 */ 301, 190, 237, 244, 258, 298, 297, 189, 237, 244, - /* 1080 */ 244, 186, 61, 254, 259, 244, 65, 258, 20, 254, - /* 1090 */ 261, 258, 258, 258, 120, 254, 261, 206, 272, 258, - /* 1100 */ 313, 209, 213, 274, 275, 276, 277, 204, 87, 274, - /* 1110 */ 275, 276, 277, 213, 309, 274, 275, 276, 277, 315, - /* 1120 */ 74, 281, 259, 285, 310, 258, 237, 106, 107, 108, - /* 1130 */ 258, 110, 259, 244, 258, 135, 256, 237, 213, 255, - /* 1140 */ 244, 218, 233, 254, 244, 218, 244, 258, 74, 223, - /* 1150 */ 240, 227, 219, 218, 254, 215, 220, 211, 258, 231, - /* 1160 */ 231, 0, 237, 274, 275, 276, 277, 213, 0, 244, - /* 1170 */ 265, 64, 213, 38, 274, 275, 276, 277, 0, 254, - /* 1180 */ 213, 159, 159, 258, 38, 38, 38, 0, 38, 38, - /* 1190 */ 159, 237, 0, 38, 0, 38, 237, 0, 244, 274, - /* 1200 */ 275, 276, 277, 244, 237, 74, 150, 149, 254, 109, - /* 1210 */ 146, 244, 258, 254, 213, 0, 0, 258, 53, 142, - /* 1220 */ 0, 254, 0, 86, 0, 258, 0, 0, 274, 275, - /* 1230 */ 276, 277, 0, 274, 275, 276, 277, 0, 237, 0, - /* 1240 */ 0, 274, 275, 276, 277, 244, 0, 0, 0, 0, - /* 1250 */ 213, 0, 0, 0, 0, 254, 213, 0, 0, 258, - /* 1260 */ 120, 0, 213, 0, 0, 0, 0, 22, 0, 0, - /* 1270 */ 0, 0, 0, 0, 237, 274, 275, 276, 277, 0, - /* 1280 */ 237, 244, 0, 0, 43, 0, 237, 244, 0, 51, - /* 1290 */ 0, 254, 0, 244, 38, 258, 36, 254, 43, 0, - /* 1300 */ 38, 258, 43, 254, 213, 38, 0, 258, 0, 213, - /* 1310 */ 36, 274, 275, 276, 277, 38, 36, 274, 275, 276, - /* 1320 */ 277, 43, 36, 274, 275, 276, 277, 43, 237, 0, - /* 1330 */ 0, 0, 38, 237, 22, 244, 0, 0, 12, 13, - /* 1340 */ 244, 38, 38, 38, 22, 254, 0, 71, 22, 258, - /* 1350 */ 254, 213, 38, 38, 258, 38, 22, 213, 83, 39, - /* 1360 */ 71, 0, 81, 22, 38, 274, 275, 276, 277, 0, - /* 1370 */ 274, 275, 276, 277, 22, 237, 38, 0, 22, 20, - /* 1380 */ 0, 237, 244, 57, 155, 38, 213, 0, 244, 22, - /* 1390 */ 0, 0, 254, 151, 0, 74, 258, 43, 254, 71, - /* 1400 */ 191, 74, 258, 71, 86, 191, 71, 4, 75, 86, - /* 1410 */ 237, 71, 274, 275, 276, 277, 74, 244, 274, 275, - /* 1420 */ 276, 277, 74, 97, 75, 138, 75, 254, 135, 138, - /* 1430 */ 133, 258, 74, 138, 71, 109, 71, 75, 38, 75, - /* 1440 */ 38, 86, 71, 75, 38, 38, 38, 274, 275, 276, - /* 1450 */ 277, 38, 2, 75, 75, 74, 86, 74, 74, 0, - /* 1460 */ 75, 163, 43, 75, 22, 38, 74, 74, 86, 74, - /* 1470 */ 74, 85, 146, 84, 75, 136, 133, 38, 74, 74, - /* 1480 */ 22, 185, 38, 86, 75, 74, 38, 75, 74, 163, - /* 1490 */ 75, 191, 38, 75, 74, 38, 74, 99, 74, 38, - /* 1500 */ 99, 38, 74, 74, 87, 22, 51, 72, 57, 99, - /* 1510 */ 50, 71, 38, 38, 38, 99, 38, 38, 38, 38, - /* 1520 */ 22, 57, 38, 38, 38, 38, 38, 38, 38, 38, - /* 1530 */ 109, 0, 38, 36, 0, 43, 36, 38, 43, 0, - /* 1540 */ 38, 36, 0, 0, 43, 38, 36, 43, 0, 38, - /* 1550 */ 37, 0, 22, 21, 316, 22, 20, 22, 21, 316, - /* 1560 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1570 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1580 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1590 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1600 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1610 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1620 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1630 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1640 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1650 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1660 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1670 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1680 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1690 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1700 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1710 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1720 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1730 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1740 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1750 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1760 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, + /* 0 */ 222, 311, 247, 222, 250, 296, 297, 228, 228, 219, + /* 10 */ 263, 267, 12, 13, 324, 222, 269, 237, 328, 222, + /* 20 */ 20, 267, 22, 250, 244, 281, 282, 246, 12, 13, + /* 30 */ 14, 15, 16, 253, 253, 281, 282, 258, 38, 246, + /* 40 */ 267, 20, 230, 228, 263, 267, 253, 228, 267, 20, + /* 50 */ 50, 12, 13, 14, 281, 282, 263, 57, 20, 20, + /* 60 */ 267, 22, 272, 251, 267, 272, 285, 286, 287, 288, + /* 70 */ 289, 290, 253, 292, 74, 228, 49, 38, 285, 286, + /* 80 */ 287, 288, 289, 290, 237, 292, 0, 272, 295, 50, + /* 90 */ 228, 75, 299, 300, 231, 74, 57, 97, 235, 237, + /* 100 */ 253, 311, 12, 13, 311, 221, 244, 223, 289, 109, + /* 110 */ 20, 330, 22, 74, 324, 253, 0, 324, 328, 20, + /* 120 */ 2, 328, 303, 304, 305, 306, 311, 308, 38, 0, + /* 130 */ 12, 13, 14, 15, 16, 49, 97, 0, 246, 324, + /* 140 */ 50, 225, 226, 328, 252, 246, 146, 57, 109, 257, + /* 150 */ 21, 245, 253, 24, 25, 26, 27, 28, 29, 30, + /* 160 */ 31, 32, 256, 263, 74, 49, 266, 167, 168, 269, + /* 170 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 180 */ 180, 181, 182, 183, 230, 146, 287, 97, 136, 52, + /* 190 */ 145, 54, 147, 222, 20, 58, 196, 243, 61, 109, + /* 200 */ 63, 64, 222, 66, 283, 251, 167, 168, 22, 170, + /* 210 */ 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + /* 220 */ 181, 182, 183, 61, 38, 196, 228, 65, 307, 12, + /* 230 */ 13, 12, 13, 14, 15, 16, 146, 20, 267, 22, + /* 240 */ 38, 196, 12, 13, 14, 15, 16, 267, 74, 87, + /* 250 */ 196, 253, 0, 201, 202, 38, 228, 167, 168, 57, + /* 260 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 270 */ 180, 181, 182, 183, 57, 12, 13, 14, 155, 156, + /* 280 */ 50, 253, 159, 20, 20, 22, 0, 289, 36, 21, + /* 290 */ 222, 74, 24, 25, 26, 27, 28, 29, 30, 31, + /* 300 */ 32, 38, 304, 305, 306, 75, 308, 238, 1, 2, + /* 310 */ 52, 20, 54, 83, 97, 246, 58, 289, 20, 61, + /* 320 */ 57, 63, 64, 254, 66, 272, 109, 167, 14, 15, + /* 330 */ 16, 35, 304, 305, 306, 267, 308, 74, 52, 53, + /* 340 */ 54, 55, 56, 20, 58, 59, 60, 61, 62, 63, + /* 350 */ 64, 65, 66, 67, 68, 69, 70, 61, 232, 233, + /* 360 */ 97, 65, 132, 146, 311, 205, 206, 207, 208, 209, + /* 370 */ 196, 239, 109, 77, 242, 79, 80, 324, 82, 222, + /* 380 */ 150, 328, 75, 87, 167, 168, 3, 170, 171, 172, + /* 390 */ 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + /* 400 */ 183, 71, 12, 13, 12, 13, 14, 15, 16, 146, + /* 410 */ 20, 227, 22, 196, 184, 185, 186, 187, 188, 189, + /* 420 */ 190, 191, 192, 193, 267, 241, 47, 272, 38, 138, + /* 430 */ 167, 168, 248, 170, 171, 172, 173, 174, 175, 176, + /* 440 */ 177, 178, 179, 180, 181, 182, 183, 57, 12, 13, + /* 450 */ 12, 13, 73, 4, 255, 76, 20, 246, 22, 2, + /* 460 */ 22, 262, 263, 252, 74, 4, 311, 246, 257, 12, + /* 470 */ 13, 14, 15, 16, 38, 228, 38, 222, 257, 324, + /* 480 */ 19, 283, 238, 328, 237, 71, 20, 97, 22, 75, + /* 490 */ 246, 232, 233, 57, 33, 57, 67, 36, 254, 109, + /* 500 */ 253, 222, 41, 43, 222, 307, 40, 234, 47, 236, + /* 510 */ 74, 88, 89, 90, 91, 92, 93, 94, 95, 96, + /* 520 */ 97, 98, 267, 100, 101, 102, 103, 104, 105, 18, + /* 530 */ 138, 20, 238, 97, 73, 97, 146, 76, 27, 49, + /* 540 */ 246, 30, 113, 114, 214, 109, 267, 109, 254, 267, + /* 550 */ 39, 12, 13, 14, 15, 16, 222, 167, 168, 283, + /* 560 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 570 */ 180, 181, 182, 183, 12, 13, 14, 15, 16, 132, + /* 580 */ 222, 85, 146, 307, 146, 232, 233, 232, 233, 50, + /* 590 */ 12, 13, 14, 15, 16, 212, 20, 150, 1, 2, + /* 600 */ 227, 267, 222, 167, 168, 167, 170, 171, 172, 173, + /* 610 */ 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + /* 620 */ 222, 248, 83, 112, 57, 267, 115, 116, 117, 118, + /* 630 */ 119, 184, 121, 122, 123, 124, 125, 126, 127, 128, + /* 640 */ 129, 130, 131, 228, 246, 228, 197, 267, 228, 19, + /* 650 */ 246, 253, 237, 75, 237, 195, 246, 237, 254, 194, + /* 660 */ 195, 263, 252, 33, 222, 267, 36, 257, 253, 228, + /* 670 */ 253, 132, 42, 253, 44, 45, 46, 47, 237, 157, + /* 680 */ 158, 246, 275, 285, 286, 287, 288, 289, 290, 150, + /* 690 */ 292, 228, 257, 295, 253, 228, 223, 299, 300, 301, + /* 700 */ 237, 139, 222, 73, 237, 222, 76, 71, 253, 267, + /* 710 */ 222, 313, 228, 228, 138, 260, 253, 319, 320, 247, + /* 720 */ 253, 237, 237, 184, 185, 186, 187, 188, 189, 190, + /* 730 */ 191, 192, 193, 14, 246, 0, 106, 253, 253, 20, + /* 740 */ 228, 253, 78, 142, 50, 81, 222, 267, 222, 237, + /* 750 */ 267, 263, 222, 222, 14, 267, 222, 22, 21, 331, + /* 760 */ 20, 247, 161, 78, 134, 253, 81, 137, 222, 78, + /* 770 */ 247, 34, 81, 285, 286, 287, 288, 289, 290, 217, + /* 780 */ 292, 322, 152, 295, 154, 0, 74, 299, 300, 301, + /* 790 */ 0, 267, 246, 267, 181, 182, 84, 267, 267, 253, + /* 800 */ 78, 267, 0, 81, 247, 247, 247, 22, 320, 263, + /* 810 */ 235, 256, 279, 267, 24, 25, 26, 27, 28, 29, + /* 820 */ 30, 31, 32, 71, 22, 71, 222, 75, 225, 75, + /* 830 */ 74, 285, 286, 287, 288, 289, 290, 316, 292, 71, + /* 840 */ 284, 295, 86, 75, 71, 299, 300, 301, 75, 309, + /* 850 */ 246, 71, 216, 18, 38, 75, 310, 253, 23, 71, + /* 860 */ 71, 167, 38, 75, 75, 246, 33, 263, 38, 36, + /* 870 */ 35, 267, 71, 57, 325, 42, 75, 44, 45, 46, + /* 880 */ 47, 71, 312, 48, 222, 75, 20, 228, 36, 285, + /* 890 */ 286, 287, 288, 289, 290, 280, 292, 71, 38, 295, + /* 900 */ 232, 75, 144, 299, 300, 301, 73, 71, 246, 76, + /* 910 */ 273, 75, 228, 71, 310, 253, 71, 75, 71, 71, + /* 920 */ 75, 228, 75, 75, 71, 263, 120, 261, 75, 267, + /* 930 */ 132, 259, 259, 109, 228, 277, 20, 230, 263, 109, + /* 940 */ 222, 20, 271, 230, 20, 253, 111, 285, 286, 287, + /* 950 */ 288, 289, 290, 222, 292, 230, 230, 295, 228, 264, + /* 960 */ 20, 299, 300, 301, 246, 224, 133, 246, 135, 230, + /* 970 */ 137, 253, 310, 246, 139, 140, 141, 246, 143, 246, + /* 980 */ 246, 263, 246, 148, 253, 267, 224, 154, 246, 246, + /* 990 */ 272, 222, 246, 246, 263, 160, 246, 162, 267, 164, + /* 1000 */ 165, 166, 228, 285, 286, 287, 288, 289, 290, 228, + /* 1010 */ 292, 246, 57, 227, 153, 246, 285, 286, 287, 288, + /* 1020 */ 289, 290, 253, 292, 267, 294, 277, 276, 253, 311, + /* 1030 */ 263, 196, 263, 20, 253, 271, 267, 284, 227, 227, + /* 1040 */ 264, 204, 324, 203, 321, 268, 328, 268, 210, 222, + /* 1050 */ 267, 267, 211, 272, 285, 286, 287, 288, 289, 290, + /* 1060 */ 267, 292, 199, 318, 295, 321, 198, 195, 299, 300, + /* 1070 */ 289, 253, 317, 246, 315, 314, 20, 283, 120, 222, + /* 1080 */ 253, 74, 218, 213, 302, 304, 305, 306, 215, 308, + /* 1090 */ 263, 268, 311, 327, 267, 332, 326, 298, 267, 267, + /* 1100 */ 242, 135, 268, 246, 253, 324, 267, 227, 265, 328, + /* 1110 */ 253, 227, 285, 286, 287, 288, 289, 290, 264, 292, + /* 1120 */ 263, 74, 295, 249, 267, 236, 299, 300, 222, 253, + /* 1130 */ 228, 227, 224, 274, 278, 240, 240, 222, 229, 22, + /* 1140 */ 220, 0, 285, 286, 287, 288, 289, 290, 291, 292, + /* 1150 */ 293, 294, 246, 0, 64, 38, 0, 38, 163, 253, + /* 1160 */ 38, 246, 38, 38, 163, 0, 38, 38, 253, 263, + /* 1170 */ 38, 163, 0, 267, 57, 222, 0, 38, 263, 0, + /* 1180 */ 74, 150, 267, 149, 109, 146, 0, 222, 0, 53, + /* 1190 */ 142, 285, 286, 287, 288, 289, 290, 0, 292, 246, + /* 1200 */ 285, 286, 287, 288, 289, 290, 253, 292, 0, 0, + /* 1210 */ 295, 246, 86, 0, 97, 300, 263, 0, 253, 0, + /* 1220 */ 267, 120, 0, 270, 0, 0, 109, 0, 263, 0, + /* 1230 */ 0, 0, 267, 0, 0, 329, 330, 0, 285, 286, + /* 1240 */ 287, 288, 289, 290, 0, 292, 222, 0, 0, 0, + /* 1250 */ 285, 286, 287, 288, 289, 290, 0, 292, 0, 222, + /* 1260 */ 0, 0, 22, 146, 0, 0, 0, 0, 0, 0, + /* 1270 */ 246, 43, 0, 0, 51, 0, 38, 253, 0, 0, + /* 1280 */ 0, 36, 43, 246, 167, 168, 0, 263, 323, 38, + /* 1290 */ 253, 267, 0, 36, 270, 43, 43, 38, 36, 0, + /* 1300 */ 263, 38, 0, 0, 267, 0, 36, 270, 0, 285, + /* 1310 */ 286, 287, 288, 289, 290, 83, 292, 222, 22, 43, + /* 1320 */ 38, 0, 285, 286, 287, 288, 289, 290, 38, 292, + /* 1330 */ 0, 81, 38, 222, 22, 38, 38, 0, 38, 22, + /* 1340 */ 0, 246, 38, 0, 22, 222, 39, 38, 253, 22, + /* 1350 */ 0, 22, 71, 20, 71, 0, 138, 246, 263, 0, + /* 1360 */ 22, 38, 267, 151, 253, 270, 0, 0, 0, 246, + /* 1370 */ 75, 135, 194, 138, 263, 43, 253, 71, 267, 0, + /* 1380 */ 285, 286, 287, 288, 289, 290, 263, 292, 74, 71, + /* 1390 */ 267, 200, 222, 138, 75, 71, 285, 286, 287, 288, + /* 1400 */ 289, 290, 74, 292, 200, 222, 75, 133, 285, 286, + /* 1410 */ 287, 288, 289, 290, 75, 292, 246, 71, 74, 74, + /* 1420 */ 86, 74, 71, 253, 71, 71, 200, 75, 86, 246, + /* 1430 */ 4, 75, 38, 263, 86, 38, 253, 267, 0, 38, + /* 1440 */ 61, 38, 38, 222, 65, 38, 263, 2, 71, 75, + /* 1450 */ 267, 167, 74, 22, 74, 285, 286, 287, 288, 289, + /* 1460 */ 290, 75, 292, 75, 75, 74, 87, 246, 285, 286, + /* 1470 */ 287, 288, 289, 290, 253, 292, 86, 75, 86, 74, + /* 1480 */ 169, 0, 74, 74, 263, 106, 107, 108, 267, 110, + /* 1490 */ 74, 74, 43, 222, 133, 74, 136, 84, 86, 61, + /* 1500 */ 86, 22, 74, 65, 85, 75, 285, 286, 287, 288, + /* 1510 */ 289, 290, 38, 292, 38, 74, 38, 246, 75, 75, + /* 1520 */ 74, 38, 74, 222, 253, 87, 75, 38, 74, 38, + /* 1530 */ 75, 74, 99, 22, 263, 99, 99, 87, 267, 99, + /* 1540 */ 74, 38, 74, 74, 106, 107, 108, 246, 110, 22, + /* 1550 */ 38, 109, 51, 57, 253, 50, 285, 286, 287, 288, + /* 1560 */ 289, 290, 72, 292, 263, 22, 71, 38, 267, 38, + /* 1570 */ 38, 222, 38, 38, 38, 38, 57, 38, 38, 38, + /* 1580 */ 222, 43, 38, 38, 38, 38, 285, 286, 287, 288, + /* 1590 */ 289, 290, 38, 292, 0, 246, 38, 36, 0, 36, + /* 1600 */ 38, 0, 253, 43, 246, 38, 36, 43, 0, 38, + /* 1610 */ 36, 253, 263, 0, 38, 43, 267, 37, 0, 0, + /* 1620 */ 21, 263, 22, 20, 22, 267, 22, 21, 222, 333, + /* 1630 */ 333, 333, 333, 333, 285, 286, 287, 288, 289, 290, + /* 1640 */ 333, 292, 333, 285, 286, 287, 288, 289, 290, 333, + /* 1650 */ 292, 333, 246, 333, 333, 333, 222, 333, 333, 253, + /* 1660 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 263, + /* 1670 */ 333, 333, 333, 267, 333, 333, 333, 333, 333, 333, + /* 1680 */ 246, 333, 333, 333, 333, 333, 333, 253, 333, 333, + /* 1690 */ 333, 285, 286, 287, 288, 289, 290, 263, 292, 333, + /* 1700 */ 333, 267, 333, 333, 333, 333, 333, 222, 333, 333, + /* 1710 */ 333, 333, 333, 333, 333, 333, 222, 333, 333, 285, + /* 1720 */ 286, 287, 288, 289, 290, 333, 292, 333, 333, 333, + /* 1730 */ 333, 246, 333, 333, 333, 333, 333, 333, 253, 333, + /* 1740 */ 246, 333, 333, 333, 333, 333, 333, 253, 263, 333, + /* 1750 */ 333, 333, 267, 333, 333, 333, 333, 263, 333, 333, + /* 1760 */ 333, 267, 333, 333, 333, 333, 333, 333, 333, 333, + /* 1770 */ 285, 286, 287, 288, 289, 290, 333, 292, 333, 285, + /* 1780 */ 286, 287, 288, 289, 290, 333, 292, 222, 333, 333, + /* 1790 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, + /* 1800 */ 333, 333, 333, 222, 333, 333, 333, 333, 333, 333, + /* 1810 */ 333, 246, 333, 333, 333, 333, 333, 333, 253, 333, + /* 1820 */ 333, 333, 333, 333, 333, 333, 333, 246, 263, 333, + /* 1830 */ 333, 333, 267, 333, 253, 333, 333, 333, 333, 333, + /* 1840 */ 333, 333, 333, 333, 263, 333, 333, 333, 267, 333, + /* 1850 */ 285, 286, 287, 288, 289, 290, 333, 292, 222, 333, + /* 1860 */ 333, 333, 333, 333, 333, 333, 285, 286, 287, 288, + /* 1870 */ 289, 290, 333, 292, 333, 333, 333, 333, 333, 333, + /* 1880 */ 333, 333, 246, 333, 333, 333, 333, 333, 333, 253, + /* 1890 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 263, + /* 1900 */ 333, 333, 333, 267, 333, 333, 333, 333, 333, 333, + /* 1910 */ 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, + /* 1920 */ 333, 285, 286, 287, 288, 289, 290, 333, 292, }; -#define YY_SHIFT_COUNT (549) +#define YY_SHIFT_COUNT (567) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1551) +#define YY_SHIFT_MAX (1619) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 482, 0, 39, 217, 217, 217, 217, 230, 217, 217, - /* 10 */ 268, 406, 51, 53, 268, 268, 268, 268, 268, 268, - /* 20 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 30 */ 268, 268, 268, 268, 268, 29, 29, 29, 70, 1326, - /* 40 */ 1326, 86, 4, 4, 1, 1326, 164, 164, 4, 4, - /* 50 */ 4, 4, 4, 4, 23, 20, 215, 1, 20, 4, - /* 60 */ 4, 20, 4, 20, 20, 20, 4, 65, 231, 433, - /* 70 */ 509, 509, 165, 221, 457, 257, 457, 457, 457, 457, - /* 80 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 90 */ 457, 457, 457, 457, 457, 164, 498, 55, 237, 430, - /* 100 */ 430, 430, 506, 237, 249, 20, 20, 20, 222, 294, - /* 110 */ 364, 364, 364, 364, 364, 364, 364, 688, 624, 93, - /* 120 */ 166, 210, 164, 164, 232, 228, 729, 611, 598, 301, - /* 130 */ 598, 757, 557, 95, 887, 886, 894, 797, 887, 887, - /* 140 */ 850, 842, 842, 887, 957, 961, 23, 249, 971, 23, - /* 150 */ 23, 887, 23, 988, 20, 20, 20, 20, 20, 20, - /* 160 */ 20, 20, 20, 20, 20, 894, 887, 988, 249, 957, - /* 170 */ 869, 961, 65, 249, 971, 65, 1030, 856, 861, 1002, - /* 180 */ 856, 861, 1002, 1002, 858, 868, 881, 888, 895, 249, - /* 190 */ 1068, 974, 892, 891, 903, 1046, 20, 861, 1002, 1002, - /* 200 */ 861, 1002, 1000, 249, 971, 65, 222, 65, 249, 1074, - /* 210 */ 894, 294, 887, 65, 988, 1559, 1559, 1559, 1559, 1559, - /* 220 */ 481, 830, 92, 907, 708, 1021, 354, 13, 21, 30, - /* 230 */ 458, 250, 250, 250, 250, 250, 250, 250, 82, 311, - /* 240 */ 397, 586, 550, 397, 397, 397, 632, 643, 304, 712, - /* 250 */ 721, 727, 731, 798, 801, 811, 803, 644, 672, 768, - /* 260 */ 802, 682, 639, 515, 778, 724, 780, 793, 809, 815, - /* 270 */ 821, 823, 837, 818, 827, 839, 854, 862, 864, 893, - /* 280 */ 898, 799, 775, 1161, 1168, 1107, 1178, 1135, 1022, 1146, - /* 290 */ 1147, 1148, 1023, 1187, 1150, 1151, 1031, 1192, 1155, 1194, - /* 300 */ 1157, 1197, 1131, 1056, 1058, 1100, 1064, 1215, 1216, 1165, - /* 310 */ 1077, 1220, 1222, 1137, 1224, 1226, 1227, 1232, 1237, 1239, - /* 320 */ 1240, 1246, 1247, 1248, 1249, 1251, 1252, 1253, 1254, 1257, - /* 330 */ 1140, 1258, 1261, 1263, 1264, 1265, 1266, 1245, 1268, 1269, - /* 340 */ 1270, 1271, 1272, 1273, 1279, 1282, 1283, 1241, 1285, 1238, - /* 350 */ 1288, 1290, 1256, 1260, 1255, 1292, 1262, 1274, 1259, 1299, - /* 360 */ 1267, 1280, 1278, 1306, 1277, 1286, 1284, 1308, 1329, 1330, - /* 370 */ 1331, 1275, 1281, 1294, 1276, 1312, 1336, 1303, 1304, 1305, - /* 380 */ 1314, 1289, 1276, 1315, 1317, 1337, 1322, 1346, 1334, 1320, - /* 390 */ 1361, 1341, 1338, 1369, 1352, 1377, 1356, 1359, 1380, 1287, - /* 400 */ 1229, 1347, 1387, 1242, 1367, 1291, 1293, 1390, 1391, 1295, - /* 410 */ 1394, 1321, 1354, 1297, 1328, 1332, 1209, 1333, 1335, 1349, - /* 420 */ 1327, 1342, 1348, 1351, 1340, 1318, 1358, 1363, 1214, 1362, - /* 430 */ 1364, 1323, 1296, 1365, 1355, 1368, 1371, 1300, 1403, 1400, - /* 440 */ 1402, 1406, 1407, 1408, 1413, 1450, 1298, 1370, 1378, 1381, - /* 450 */ 1379, 1383, 1384, 1385, 1388, 1392, 1393, 1339, 1395, 1459, - /* 460 */ 1419, 1343, 1396, 1389, 1382, 1397, 1442, 1404, 1386, 1399, - /* 470 */ 1427, 1439, 1405, 1409, 1444, 1411, 1412, 1448, 1414, 1415, - /* 480 */ 1454, 1420, 1418, 1457, 1422, 1398, 1401, 1410, 1416, 1458, - /* 490 */ 1417, 1424, 1461, 1421, 1428, 1429, 1463, 1276, 1483, 1455, - /* 500 */ 1460, 1451, 1435, 1440, 1474, 1475, 1476, 1478, 1479, 1480, - /* 510 */ 1481, 1498, 1464, 1289, 1484, 1276, 1485, 1486, 1487, 1488, - /* 520 */ 1489, 1490, 1491, 1531, 1494, 1497, 1492, 1534, 1499, 1500, - /* 530 */ 1495, 1539, 1502, 1505, 1501, 1542, 1507, 1510, 1504, 1543, - /* 540 */ 1511, 1513, 1548, 1551, 1530, 1532, 1533, 1535, 1537, 1536, + /* 0 */ 835, 0, 39, 90, 90, 90, 90, 217, 90, 90, + /* 10 */ 263, 390, 436, 390, 390, 390, 390, 390, 390, 390, + /* 20 */ 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, + /* 30 */ 390, 390, 390, 390, 390, 390, 174, 21, 21, 21, + /* 40 */ 29, 438, 438, 45, 38, 38, 54, 438, 38, 38, + /* 50 */ 38, 38, 38, 38, 27, 38, 99, 264, 54, 298, + /* 60 */ 99, 38, 38, 99, 38, 99, 298, 99, 99, 38, + /* 70 */ 490, 511, 230, 539, 539, 268, 1117, 296, 1117, 1117, + /* 80 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, + /* 90 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 258, 466, 86, + /* 100 */ 202, 202, 291, 291, 291, 116, 202, 202, 323, 298, + /* 110 */ 99, 99, 99, 496, 567, 423, 423, 423, 423, 423, + /* 120 */ 423, 423, 630, 129, 137, 562, 160, 162, 123, 52, + /* 130 */ 186, 576, 465, 460, 465, 719, 383, 449, 740, 866, + /* 140 */ 852, 860, 758, 866, 866, 806, 798, 798, 866, 916, + /* 150 */ 27, 298, 921, 27, 323, 924, 27, 27, 866, 27, + /* 160 */ 940, 99, 99, 99, 99, 99, 99, 99, 99, 99, + /* 170 */ 99, 99, 866, 940, 955, 916, 490, 861, 298, 921, + /* 180 */ 490, 323, 924, 490, 1013, 837, 840, 955, 837, 840, + /* 190 */ 955, 955, 841, 838, 863, 868, 872, 323, 1056, 958, + /* 200 */ 864, 873, 870, 1007, 99, 840, 955, 955, 840, 955, + /* 210 */ 966, 323, 924, 490, 496, 490, 323, 1047, 567, 866, + /* 220 */ 490, 940, 1929, 1929, 1929, 1929, 1929, 1929, 286, 833, + /* 230 */ 790, 461, 1379, 1438, 16, 118, 457, 392, 578, 219, + /* 240 */ 219, 219, 219, 219, 219, 219, 219, 379, 429, 307, + /* 250 */ 447, 314, 314, 314, 314, 252, 601, 414, 664, 685, + /* 260 */ 691, 722, 735, 785, 802, 737, 522, 752, 754, 768, + /* 270 */ 597, 613, 330, 636, 773, 694, 780, 756, 788, 789, + /* 280 */ 801, 810, 826, 824, 830, 836, 842, 845, 847, 848, + /* 290 */ 853, 712, 816, 1141, 1153, 1090, 1156, 1119, 995, 1122, + /* 300 */ 1124, 1125, 1001, 1165, 1128, 1129, 1008, 1172, 1132, 1176, + /* 310 */ 1139, 1179, 1106, 1031, 1034, 1075, 1039, 1186, 1188, 1136, + /* 320 */ 1048, 1197, 1208, 1126, 1209, 1213, 1217, 1219, 1224, 1225, + /* 330 */ 1227, 1229, 1230, 1231, 1233, 1234, 1237, 1244, 1247, 1248, + /* 340 */ 1101, 1222, 1249, 1256, 1258, 1260, 1261, 1240, 1264, 1265, + /* 350 */ 1266, 1267, 1268, 1269, 1278, 1279, 1280, 1228, 1272, 1223, + /* 360 */ 1273, 1275, 1238, 1245, 1239, 1286, 1251, 1257, 1252, 1292, + /* 370 */ 1259, 1262, 1253, 1299, 1263, 1270, 1276, 1302, 1303, 1305, + /* 380 */ 1308, 1232, 1250, 1282, 1281, 1283, 1296, 1321, 1290, 1294, + /* 390 */ 1297, 1298, 1281, 1283, 1300, 1304, 1330, 1312, 1337, 1317, + /* 400 */ 1307, 1340, 1322, 1309, 1343, 1327, 1350, 1329, 1333, 1355, + /* 410 */ 1218, 1323, 1359, 1212, 1338, 1235, 1236, 1366, 1367, 1255, + /* 420 */ 1368, 1314, 1332, 1274, 1306, 1318, 1191, 1295, 1324, 1319, + /* 430 */ 1328, 1344, 1345, 1331, 1346, 1334, 1347, 1351, 1204, 1339, + /* 440 */ 1352, 1342, 1178, 1353, 1348, 1356, 1354, 1226, 1426, 1394, + /* 450 */ 1397, 1401, 1403, 1404, 1407, 1445, 1284, 1377, 1374, 1378, + /* 460 */ 1386, 1380, 1388, 1390, 1391, 1405, 1392, 1431, 1311, 1408, + /* 470 */ 1389, 1402, 1409, 1416, 1360, 1417, 1481, 1449, 1361, 1421, + /* 480 */ 1413, 1412, 1414, 1479, 1428, 1419, 1430, 1474, 1476, 1441, + /* 490 */ 1443, 1478, 1446, 1444, 1483, 1448, 1451, 1489, 1454, 1455, + /* 500 */ 1491, 1457, 1433, 1436, 1437, 1440, 1511, 1450, 1466, 1503, + /* 510 */ 1442, 1468, 1469, 1512, 1281, 1283, 1527, 1501, 1505, 1496, + /* 520 */ 1490, 1495, 1529, 1531, 1532, 1534, 1535, 1536, 1537, 1543, + /* 530 */ 1519, 1281, 1539, 1283, 1540, 1541, 1544, 1545, 1546, 1547, + /* 540 */ 1554, 1594, 1558, 1561, 1538, 1598, 1562, 1563, 1560, 1601, + /* 550 */ 1567, 1570, 1564, 1608, 1571, 1574, 1572, 1613, 1576, 1580, + /* 560 */ 1618, 1619, 1600, 1599, 1602, 1604, 1606, 1603, }; -#define YY_REDUCE_COUNT (219) -#define YY_REDUCE_MIN (-272) -#define YY_REDUCE_MAX (1173) +#define YY_REDUCE_COUNT (227) +#define YY_REDUCE_MIN (-310) +#define YY_REDUCE_MAX (1636) static const short yy_reduce_ofst[] = { - /* 0 */ -209, 420, -196, -143, 462, 504, 552, 594, 58, 641, - /* 10 */ 676, 718, 465, 684, 753, 762, 787, 829, 835, 841, - /* 20 */ 889, 900, 925, 954, 959, 967, 1001, 1037, 1043, 1049, - /* 30 */ 1091, 1096, 1138, 1144, 1173, 313, -43, 573, 366, -239, - /* 40 */ -202, -247, -214, 263, -22, -128, -254, -170, -67, 94, - /* 50 */ 265, 266, 269, 283, 103, -99, 3, -199, 47, 363, - /* 60 */ 418, 179, 485, 267, 319, 360, 547, 78, -66, -272, - /* 70 */ -272, -272, -203, -110, -195, 10, 2, 273, 306, 340, - /* 80 */ 348, 350, 381, 405, 413, 414, 421, 422, 423, 453, - /* 90 */ 454, 492, 505, 510, 512, -250, 37, 57, 148, -13, - /* 100 */ 375, 386, 212, 252, 248, 178, 241, 253, 296, -27, - /* 110 */ 239, 290, 320, 346, 357, 390, 432, 353, 487, 531, - /* 120 */ 507, 514, 587, 604, 612, 582, 666, 618, 601, 601, - /* 130 */ 601, 663, 596, 607, 690, 675, 723, 683, 730, 737, - /* 140 */ 705, 728, 732, 752, 711, 725, 764, 742, 743, 781, - /* 150 */ 782, 785, 784, 794, 773, 776, 786, 788, 789, 795, - /* 160 */ 796, 806, 807, 810, 812, 792, 800, 819, 774, 744, - /* 170 */ 750, 790, 817, 813, 791, 822, 783, 749, 808, 816, - /* 180 */ 754, 825, 833, 834, 769, 765, 777, 779, 601, 836, - /* 190 */ 826, 838, 804, 814, 805, 840, 663, 863, 867, 872, - /* 200 */ 873, 876, 880, 896, 884, 923, 909, 927, 902, 910, - /* 210 */ 926, 924, 933, 935, 940, 905, 928, 929, 936, 946, + /* 0 */ -210, -207, 398, 488, 546, 604, 662, 718, 769, 827, + /* 10 */ 857, 906, 915, 953, 965, -219, 1037, 731, 1024, 1095, + /* 20 */ 1111, 1123, 1170, 1183, 1221, 1271, 1301, 1349, 1358, 1406, + /* 30 */ 1434, 1485, 1494, 1565, 1581, 1636, 781, -181, -2, 28, + /* 40 */ -185, -246, -227, 53, -220, -138, 155, -256, -153, 247, + /* 50 */ 415, 417, 420, 441, -46, 467, -108, -101, -310, -100, + /* 60 */ 69, 484, 485, 211, 512, 244, 199, 410, 294, 463, + /* 70 */ 184, -221, -291, -291, -291, -116, -222, -94, -203, -29, + /* 80 */ -20, 68, 157, 255, 279, 282, 334, 358, 380, 442, + /* 90 */ 480, 483, 524, 526, 530, 531, 534, -137, -84, -188, + /* 100 */ 126, 259, -79, 198, 276, 373, 353, 355, 455, -253, + /* 110 */ 404, 221, 435, 132, 273, -245, 472, 514, 523, 557, + /* 120 */ 558, 559, 407, 473, 575, 428, 459, 555, 533, 521, + /* 130 */ 603, 556, 540, 540, 540, 619, 549, 570, 619, 659, + /* 140 */ 615, 668, 637, 684, 693, 666, 672, 673, 706, 658, + /* 150 */ 707, 675, 671, 713, 692, 695, 725, 726, 730, 739, + /* 160 */ 741, 721, 727, 733, 734, 736, 742, 743, 746, 747, + /* 170 */ 750, 765, 774, 762, 757, 749, 786, 751, 767, 764, + /* 180 */ 811, 775, 776, 812, 753, 723, 777, 783, 744, 779, + /* 190 */ 784, 793, 745, 755, 759, 761, 540, 818, 794, 782, + /* 200 */ 763, 766, 770, 799, 619, 823, 831, 832, 834, 839, + /* 210 */ 843, 851, 854, 880, 858, 884, 876, 874, 889, 902, + /* 220 */ 904, 908, 859, 856, 895, 896, 909, 920, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 10 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 20 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 30 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 40 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 50 */ 1223, 1223, 1223, 1223, 1282, 1223, 1223, 1223, 1223, 1223, - /* 60 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1280, 1420, 1223, - /* 70 */ 1557, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 80 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 90 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1282, 1223, 1568, - /* 100 */ 1568, 1568, 1280, 1223, 1223, 1223, 1223, 1223, 1375, 1223, - /* 110 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1454, 1223, 1223, - /* 120 */ 1632, 1223, 1223, 1223, 1328, 1592, 1223, 1584, 1560, 1574, - /* 130 */ 1561, 1223, 1617, 1577, 1223, 1223, 1223, 1446, 1223, 1223, - /* 140 */ 1425, 1422, 1422, 1223, 1223, 1223, 1282, 1223, 1223, 1282, - /* 150 */ 1282, 1223, 1282, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 160 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 170 */ 1456, 1223, 1280, 1223, 1223, 1280, 1223, 1599, 1597, 1223, - /* 180 */ 1599, 1597, 1223, 1223, 1611, 1607, 1590, 1588, 1574, 1223, - /* 190 */ 1223, 1223, 1635, 1623, 1619, 1223, 1223, 1597, 1223, 1223, - /* 200 */ 1597, 1223, 1433, 1223, 1223, 1280, 1223, 1280, 1223, 1344, - /* 210 */ 1223, 1223, 1223, 1280, 1223, 1448, 1378, 1378, 1283, 1228, - /* 220 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 230 */ 1223, 1522, 1610, 1609, 1521, 1534, 1533, 1532, 1223, 1223, - /* 240 */ 1516, 1223, 1223, 1517, 1515, 1514, 1223, 1223, 1223, 1223, - /* 250 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 260 */ 1558, 1223, 1620, 1624, 1223, 1223, 1223, 1493, 1223, 1223, - /* 270 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 280 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 290 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 300 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 310 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 320 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 330 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 340 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 350 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 360 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 370 */ 1223, 1223, 1223, 1223, 1389, 1223, 1223, 1223, 1223, 1223, - /* 380 */ 1223, 1309, 1308, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 390 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 400 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 410 */ 1223, 1223, 1223, 1223, 1581, 1591, 1223, 1223, 1223, 1223, - /* 420 */ 1223, 1223, 1223, 1223, 1223, 1493, 1223, 1608, 1223, 1567, - /* 430 */ 1563, 1223, 1223, 1559, 1223, 1223, 1618, 1223, 1223, 1223, - /* 440 */ 1223, 1223, 1223, 1223, 1223, 1553, 1223, 1223, 1223, 1223, - /* 450 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 460 */ 1223, 1223, 1223, 1223, 1492, 1223, 1223, 1223, 1223, 1223, - /* 470 */ 1223, 1223, 1372, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 480 */ 1223, 1223, 1223, 1223, 1223, 1357, 1355, 1354, 1353, 1223, - /* 490 */ 1350, 1223, 1223, 1223, 1223, 1223, 1223, 1380, 1223, 1223, - /* 500 */ 1223, 1223, 1223, 1303, 1223, 1223, 1223, 1223, 1223, 1223, - /* 510 */ 1223, 1223, 1223, 1294, 1223, 1293, 1223, 1223, 1223, 1223, - /* 520 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 530 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, - /* 540 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, + /* 0 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 10 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 20 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 30 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 40 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 50 */ 1274, 1274, 1274, 1274, 1333, 1274, 1274, 1274, 1274, 1274, + /* 60 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 70 */ 1331, 1473, 1274, 1628, 1274, 1274, 1274, 1274, 1274, 1274, + /* 80 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 90 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1333, + /* 100 */ 1274, 1274, 1639, 1639, 1639, 1331, 1274, 1274, 1274, 1274, + /* 110 */ 1274, 1274, 1274, 1426, 1274, 1274, 1274, 1274, 1274, 1274, + /* 120 */ 1274, 1274, 1507, 1274, 1274, 1703, 1274, 1379, 1513, 1663, + /* 130 */ 1274, 1655, 1631, 1645, 1632, 1274, 1688, 1648, 1274, 1274, + /* 140 */ 1274, 1274, 1499, 1274, 1274, 1478, 1475, 1475, 1274, 1274, + /* 150 */ 1333, 1274, 1274, 1333, 1274, 1274, 1333, 1333, 1274, 1333, + /* 160 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 170 */ 1274, 1274, 1274, 1274, 1274, 1274, 1331, 1509, 1274, 1274, + /* 180 */ 1331, 1274, 1274, 1331, 1274, 1670, 1668, 1274, 1670, 1668, + /* 190 */ 1274, 1274, 1682, 1678, 1661, 1659, 1645, 1274, 1274, 1274, + /* 200 */ 1706, 1694, 1690, 1274, 1274, 1668, 1274, 1274, 1668, 1274, + /* 210 */ 1486, 1274, 1274, 1331, 1274, 1331, 1274, 1395, 1274, 1274, + /* 220 */ 1331, 1274, 1501, 1515, 1429, 1429, 1334, 1279, 1274, 1274, + /* 230 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1576, + /* 240 */ 1681, 1680, 1604, 1603, 1602, 1600, 1575, 1274, 1274, 1274, + /* 250 */ 1274, 1569, 1570, 1568, 1567, 1274, 1274, 1274, 1274, 1274, + /* 260 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 270 */ 1629, 1274, 1691, 1695, 1274, 1274, 1274, 1553, 1274, 1274, + /* 280 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 290 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 300 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 310 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 320 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 330 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 340 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 350 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 360 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 370 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 380 */ 1274, 1274, 1274, 1274, 1442, 1441, 1274, 1274, 1274, 1274, + /* 390 */ 1274, 1274, 1360, 1359, 1274, 1274, 1274, 1274, 1274, 1274, + /* 400 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 410 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 420 */ 1274, 1274, 1274, 1274, 1652, 1662, 1274, 1274, 1274, 1274, + /* 430 */ 1274, 1274, 1274, 1274, 1274, 1553, 1274, 1679, 1274, 1638, + /* 440 */ 1634, 1274, 1274, 1630, 1274, 1274, 1689, 1274, 1274, 1274, + /* 450 */ 1274, 1274, 1274, 1274, 1274, 1624, 1274, 1597, 1274, 1274, + /* 460 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1563, 1274, + /* 470 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 480 */ 1274, 1552, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1423, + /* 490 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 500 */ 1274, 1274, 1408, 1406, 1405, 1404, 1274, 1401, 1274, 1274, + /* 510 */ 1274, 1274, 1274, 1274, 1432, 1431, 1274, 1274, 1274, 1274, + /* 520 */ 1274, 1354, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 530 */ 1274, 1345, 1274, 1344, 1274, 1274, 1274, 1274, 1274, 1274, + /* 540 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 550 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, + /* 560 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, }; /********** End of lemon-generated parsing tables *****************************/ @@ -953,166 +1010,183 @@ static const char *const yyTokenName[] = { /* 153 */ "BUFSIZE", /* 154 */ "STREAM", /* 155 */ "INTO", - /* 156 */ "KILL", - /* 157 */ "CONNECTION", - /* 158 */ "MERGE", - /* 159 */ "VGROUP", - /* 160 */ "REDISTRIBUTE", - /* 161 */ "SPLIT", - /* 162 */ "SYNCDB", - /* 163 */ "NULL", - /* 164 */ "FIRST", - /* 165 */ "LAST", - /* 166 */ "NOW", - /* 167 */ "TODAY", - /* 168 */ "CAST", - /* 169 */ "ROWTS", - /* 170 */ "TBNAME", - /* 171 */ "QSTARTTS", - /* 172 */ "QENDTS", - /* 173 */ "WSTARTTS", - /* 174 */ "WENDTS", - /* 175 */ "WDURATION", - /* 176 */ "BETWEEN", - /* 177 */ "IS", - /* 178 */ "NK_LT", - /* 179 */ "NK_GT", - /* 180 */ "NK_LE", - /* 181 */ "NK_GE", - /* 182 */ "NK_NE", - /* 183 */ "MATCH", - /* 184 */ "NMATCH", - /* 185 */ "JOIN", - /* 186 */ "INNER", - /* 187 */ "SELECT", - /* 188 */ "DISTINCT", - /* 189 */ "WHERE", - /* 190 */ "PARTITION", - /* 191 */ "BY", - /* 192 */ "SESSION", - /* 193 */ "STATE_WINDOW", - /* 194 */ "SLIDING", - /* 195 */ "FILL", - /* 196 */ "VALUE", - /* 197 */ "NONE", - /* 198 */ "PREV", - /* 199 */ "LINEAR", - /* 200 */ "NEXT", - /* 201 */ "GROUP", - /* 202 */ "HAVING", - /* 203 */ "ORDER", - /* 204 */ "SLIMIT", - /* 205 */ "SOFFSET", - /* 206 */ "LIMIT", - /* 207 */ "OFFSET", - /* 208 */ "ASC", - /* 209 */ "NULLS", - /* 210 */ "cmd", - /* 211 */ "account_options", - /* 212 */ "alter_account_options", - /* 213 */ "literal", - /* 214 */ "alter_account_option", - /* 215 */ "user_name", - /* 216 */ "dnode_endpoint", - /* 217 */ "dnode_host_name", - /* 218 */ "not_exists_opt", - /* 219 */ "db_name", - /* 220 */ "db_options", - /* 221 */ "exists_opt", - /* 222 */ "alter_db_options", - /* 223 */ "integer_list", - /* 224 */ "variable_list", - /* 225 */ "retention_list", - /* 226 */ "alter_db_option", - /* 227 */ "retention", - /* 228 */ "full_table_name", - /* 229 */ "column_def_list", - /* 230 */ "tags_def_opt", - /* 231 */ "table_options", - /* 232 */ "multi_create_clause", - /* 233 */ "tags_def", - /* 234 */ "multi_drop_clause", - /* 235 */ "alter_table_clause", - /* 236 */ "alter_table_options", - /* 237 */ "column_name", - /* 238 */ "type_name", - /* 239 */ "create_subtable_clause", - /* 240 */ "specific_tags_opt", - /* 241 */ "literal_list", - /* 242 */ "drop_table_clause", - /* 243 */ "col_name_list", - /* 244 */ "table_name", - /* 245 */ "column_def", - /* 246 */ "func_name_list", - /* 247 */ "alter_table_option", - /* 248 */ "col_name", - /* 249 */ "db_name_cond_opt", - /* 250 */ "like_pattern_opt", - /* 251 */ "table_name_cond", - /* 252 */ "from_db_opt", - /* 253 */ "func_name", - /* 254 */ "function_name", - /* 255 */ "index_name", - /* 256 */ "index_options", - /* 257 */ "func_list", - /* 258 */ "duration_literal", - /* 259 */ "sliding_opt", - /* 260 */ "func", - /* 261 */ "expression_list", - /* 262 */ "topic_name", - /* 263 */ "query_expression", - /* 264 */ "analyze_opt", - /* 265 */ "explain_options", - /* 266 */ "agg_func_opt", - /* 267 */ "bufsize_opt", - /* 268 */ "stream_name", - /* 269 */ "dnode_list", - /* 270 */ "signed", - /* 271 */ "signed_literal", - /* 272 */ "table_alias", - /* 273 */ "column_alias", - /* 274 */ "expression", - /* 275 */ "pseudo_column", - /* 276 */ "column_reference", - /* 277 */ "subquery", - /* 278 */ "predicate", - /* 279 */ "compare_op", - /* 280 */ "in_op", - /* 281 */ "in_predicate_value", - /* 282 */ "boolean_value_expression", - /* 283 */ "boolean_primary", - /* 284 */ "common_expression", - /* 285 */ "from_clause", - /* 286 */ "table_reference_list", - /* 287 */ "table_reference", - /* 288 */ "table_primary", - /* 289 */ "joined_table", - /* 290 */ "alias_opt", - /* 291 */ "parenthesized_joined_table", - /* 292 */ "join_type", - /* 293 */ "search_condition", - /* 294 */ "query_specification", - /* 295 */ "set_quantifier_opt", - /* 296 */ "select_list", - /* 297 */ "where_clause_opt", - /* 298 */ "partition_by_clause_opt", - /* 299 */ "twindow_clause_opt", - /* 300 */ "group_by_clause_opt", - /* 301 */ "having_clause_opt", - /* 302 */ "select_sublist", - /* 303 */ "select_item", - /* 304 */ "fill_opt", - /* 305 */ "fill_mode", - /* 306 */ "group_by_list", - /* 307 */ "query_expression_body", - /* 308 */ "order_by_clause_opt", - /* 309 */ "slimit_clause_opt", - /* 310 */ "limit_clause_opt", - /* 311 */ "query_primary", - /* 312 */ "sort_specification_list", - /* 313 */ "sort_specification", - /* 314 */ "ordering_specification_opt", - /* 315 */ "null_ordering_opt", + /* 156 */ "TRIGGER", + /* 157 */ "AT_ONCE", + /* 158 */ "WINDOW_CLOSE", + /* 159 */ "WATERMARK", + /* 160 */ "KILL", + /* 161 */ "CONNECTION", + /* 162 */ "MERGE", + /* 163 */ "VGROUP", + /* 164 */ "REDISTRIBUTE", + /* 165 */ "SPLIT", + /* 166 */ "SYNCDB", + /* 167 */ "NULL", + /* 168 */ "NK_QUESTION", + /* 169 */ "NK_ARROW", + /* 170 */ "ROWTS", + /* 171 */ "TBNAME", + /* 172 */ "QSTARTTS", + /* 173 */ "QENDTS", + /* 174 */ "WSTARTTS", + /* 175 */ "WENDTS", + /* 176 */ "WDURATION", + /* 177 */ "CAST", + /* 178 */ "NOW", + /* 179 */ "TODAY", + /* 180 */ "COUNT", + /* 181 */ "FIRST", + /* 182 */ "LAST", + /* 183 */ "LAST_ROW", + /* 184 */ "BETWEEN", + /* 185 */ "IS", + /* 186 */ "NK_LT", + /* 187 */ "NK_GT", + /* 188 */ "NK_LE", + /* 189 */ "NK_GE", + /* 190 */ "NK_NE", + /* 191 */ "MATCH", + /* 192 */ "NMATCH", + /* 193 */ "CONTAINS", + /* 194 */ "JOIN", + /* 195 */ "INNER", + /* 196 */ "SELECT", + /* 197 */ "DISTINCT", + /* 198 */ "WHERE", + /* 199 */ "PARTITION", + /* 200 */ "BY", + /* 201 */ "SESSION", + /* 202 */ "STATE_WINDOW", + /* 203 */ "SLIDING", + /* 204 */ "FILL", + /* 205 */ "VALUE", + /* 206 */ "NONE", + /* 207 */ "PREV", + /* 208 */ "LINEAR", + /* 209 */ "NEXT", + /* 210 */ "GROUP", + /* 211 */ "HAVING", + /* 212 */ "ORDER", + /* 213 */ "SLIMIT", + /* 214 */ "SOFFSET", + /* 215 */ "LIMIT", + /* 216 */ "OFFSET", + /* 217 */ "ASC", + /* 218 */ "NULLS", + /* 219 */ "cmd", + /* 220 */ "account_options", + /* 221 */ "alter_account_options", + /* 222 */ "literal", + /* 223 */ "alter_account_option", + /* 224 */ "user_name", + /* 225 */ "dnode_endpoint", + /* 226 */ "dnode_host_name", + /* 227 */ "not_exists_opt", + /* 228 */ "db_name", + /* 229 */ "db_options", + /* 230 */ "exists_opt", + /* 231 */ "alter_db_options", + /* 232 */ "integer_list", + /* 233 */ "variable_list", + /* 234 */ "retention_list", + /* 235 */ "alter_db_option", + /* 236 */ "retention", + /* 237 */ "full_table_name", + /* 238 */ "column_def_list", + /* 239 */ "tags_def_opt", + /* 240 */ "table_options", + /* 241 */ "multi_create_clause", + /* 242 */ "tags_def", + /* 243 */ "multi_drop_clause", + /* 244 */ "alter_table_clause", + /* 245 */ "alter_table_options", + /* 246 */ "column_name", + /* 247 */ "type_name", + /* 248 */ "create_subtable_clause", + /* 249 */ "specific_tags_opt", + /* 250 */ "literal_list", + /* 251 */ "drop_table_clause", + /* 252 */ "col_name_list", + /* 253 */ "table_name", + /* 254 */ "column_def", + /* 255 */ "func_name_list", + /* 256 */ "alter_table_option", + /* 257 */ "col_name", + /* 258 */ "db_name_cond_opt", + /* 259 */ "like_pattern_opt", + /* 260 */ "table_name_cond", + /* 261 */ "from_db_opt", + /* 262 */ "func_name", + /* 263 */ "function_name", + /* 264 */ "index_name", + /* 265 */ "index_options", + /* 266 */ "func_list", + /* 267 */ "duration_literal", + /* 268 */ "sliding_opt", + /* 269 */ "func", + /* 270 */ "expression_list", + /* 271 */ "topic_name", + /* 272 */ "query_expression", + /* 273 */ "analyze_opt", + /* 274 */ "explain_options", + /* 275 */ "agg_func_opt", + /* 276 */ "bufsize_opt", + /* 277 */ "stream_name", + /* 278 */ "stream_options", + /* 279 */ "into_opt", + /* 280 */ "dnode_list", + /* 281 */ "signed", + /* 282 */ "signed_literal", + /* 283 */ "table_alias", + /* 284 */ "column_alias", + /* 285 */ "expression", + /* 286 */ "pseudo_column", + /* 287 */ "column_reference", + /* 288 */ "function_expression", + /* 289 */ "subquery", + /* 290 */ "star_func", + /* 291 */ "star_func_para_list", + /* 292 */ "noarg_func", + /* 293 */ "other_para_list", + /* 294 */ "star_func_para", + /* 295 */ "predicate", + /* 296 */ "compare_op", + /* 297 */ "in_op", + /* 298 */ "in_predicate_value", + /* 299 */ "boolean_value_expression", + /* 300 */ "boolean_primary", + /* 301 */ "common_expression", + /* 302 */ "from_clause", + /* 303 */ "table_reference_list", + /* 304 */ "table_reference", + /* 305 */ "table_primary", + /* 306 */ "joined_table", + /* 307 */ "alias_opt", + /* 308 */ "parenthesized_joined_table", + /* 309 */ "join_type", + /* 310 */ "search_condition", + /* 311 */ "query_specification", + /* 312 */ "set_quantifier_opt", + /* 313 */ "select_list", + /* 314 */ "where_clause_opt", + /* 315 */ "partition_by_clause_opt", + /* 316 */ "twindow_clause_opt", + /* 317 */ "group_by_clause_opt", + /* 318 */ "having_clause_opt", + /* 319 */ "select_sublist", + /* 320 */ "select_item", + /* 321 */ "fill_opt", + /* 322 */ "fill_mode", + /* 323 */ "group_by_list", + /* 324 */ "query_expression_body", + /* 325 */ "order_by_clause_opt", + /* 326 */ "slimit_clause_opt", + /* 327 */ "limit_clause_opt", + /* 328 */ "query_primary", + /* 329 */ "sort_specification_list", + /* 330 */ "sort_specification", + /* 331 */ "ordering_specification_opt", + /* 332 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1275,263 +1349,283 @@ static const char *const yyRuleName[] = { /* 152 */ "table_options ::=", /* 153 */ "table_options ::= table_options COMMENT NK_STRING", /* 154 */ "table_options ::= table_options KEEP integer_list", - /* 155 */ "table_options ::= table_options TTL NK_INTEGER", - /* 156 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 157 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 158 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 159 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 160 */ "alter_table_options ::= alter_table_option", - /* 161 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 162 */ "alter_table_option ::= COMMENT NK_STRING", - /* 163 */ "alter_table_option ::= KEEP integer_list", - /* 164 */ "alter_table_option ::= TTL NK_INTEGER", - /* 165 */ "col_name_list ::= col_name", - /* 166 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 167 */ "col_name ::= column_name", - /* 168 */ "cmd ::= SHOW DNODES", - /* 169 */ "cmd ::= SHOW USERS", - /* 170 */ "cmd ::= SHOW DATABASES", - /* 171 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 172 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 173 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 174 */ "cmd ::= SHOW MNODES", - /* 175 */ "cmd ::= SHOW MODULES", - /* 176 */ "cmd ::= SHOW QNODES", - /* 177 */ "cmd ::= SHOW FUNCTIONS", - /* 178 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 179 */ "cmd ::= SHOW STREAMS", - /* 180 */ "cmd ::= SHOW ACCOUNTS", - /* 181 */ "cmd ::= SHOW APPS", - /* 182 */ "cmd ::= SHOW CONNECTIONS", - /* 183 */ "cmd ::= SHOW LICENCE", - /* 184 */ "cmd ::= SHOW GRANTS", - /* 185 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 186 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 187 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 188 */ "cmd ::= SHOW QUERIES", - /* 189 */ "cmd ::= SHOW SCORES", - /* 190 */ "cmd ::= SHOW TOPICS", - /* 191 */ "cmd ::= SHOW VARIABLES", - /* 192 */ "cmd ::= SHOW BNODES", - /* 193 */ "cmd ::= SHOW SNODES", - /* 194 */ "db_name_cond_opt ::=", - /* 195 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 196 */ "like_pattern_opt ::=", - /* 197 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 198 */ "table_name_cond ::= table_name", - /* 199 */ "from_db_opt ::=", - /* 200 */ "from_db_opt ::= FROM db_name", - /* 201 */ "func_name_list ::= func_name", - /* 202 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 203 */ "func_name ::= function_name", - /* 204 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 205 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 206 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 207 */ "index_options ::=", - /* 208 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 209 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 210 */ "func_list ::= func", - /* 211 */ "func_list ::= func_list NK_COMMA func", - /* 212 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 213 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 214 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 215 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 216 */ "cmd ::= DESC full_table_name", - /* 217 */ "cmd ::= DESCRIBE full_table_name", - /* 218 */ "cmd ::= RESET QUERY CACHE", - /* 219 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 220 */ "analyze_opt ::=", - /* 221 */ "analyze_opt ::= ANALYZE", - /* 222 */ "explain_options ::=", - /* 223 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 224 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 225 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 226 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 227 */ "cmd ::= DROP FUNCTION function_name", - /* 228 */ "agg_func_opt ::=", - /* 229 */ "agg_func_opt ::= AGGREGATE", - /* 230 */ "bufsize_opt ::=", - /* 231 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 232 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", - /* 233 */ "cmd ::= DROP STREAM stream_name", - /* 234 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 235 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 236 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 237 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 238 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 239 */ "dnode_list ::= DNODE NK_INTEGER", - /* 240 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 241 */ "cmd ::= SYNCDB db_name REPLICA", - /* 242 */ "cmd ::= query_expression", - /* 243 */ "literal ::= NK_INTEGER", - /* 244 */ "literal ::= NK_FLOAT", - /* 245 */ "literal ::= NK_STRING", - /* 246 */ "literal ::= NK_BOOL", - /* 247 */ "literal ::= TIMESTAMP NK_STRING", - /* 248 */ "literal ::= duration_literal", - /* 249 */ "literal ::= NULL", - /* 250 */ "duration_literal ::= NK_VARIABLE", - /* 251 */ "signed ::= NK_INTEGER", - /* 252 */ "signed ::= NK_PLUS NK_INTEGER", - /* 253 */ "signed ::= NK_MINUS NK_INTEGER", - /* 254 */ "signed ::= NK_FLOAT", - /* 255 */ "signed ::= NK_PLUS NK_FLOAT", - /* 256 */ "signed ::= NK_MINUS NK_FLOAT", - /* 257 */ "signed_literal ::= signed", - /* 258 */ "signed_literal ::= NK_STRING", - /* 259 */ "signed_literal ::= NK_BOOL", - /* 260 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 261 */ "signed_literal ::= duration_literal", - /* 262 */ "signed_literal ::= NULL", - /* 263 */ "literal_list ::= signed_literal", - /* 264 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 265 */ "db_name ::= NK_ID", - /* 266 */ "table_name ::= NK_ID", - /* 267 */ "column_name ::= NK_ID", - /* 268 */ "function_name ::= NK_ID", - /* 269 */ "function_name ::= FIRST", - /* 270 */ "function_name ::= LAST", - /* 271 */ "function_name ::= NOW", - /* 272 */ "function_name ::= TODAY", - /* 273 */ "table_alias ::= NK_ID", - /* 274 */ "column_alias ::= NK_ID", - /* 275 */ "user_name ::= NK_ID", - /* 276 */ "index_name ::= NK_ID", - /* 277 */ "topic_name ::= NK_ID", - /* 278 */ "stream_name ::= NK_ID", - /* 279 */ "expression ::= literal", - /* 280 */ "expression ::= pseudo_column", - /* 281 */ "expression ::= column_reference", - /* 282 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 283 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 284 */ "expression ::= function_name NK_LP NK_RP", - /* 285 */ "expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 286 */ "expression ::= subquery", - /* 287 */ "expression ::= NK_LP expression NK_RP", - /* 288 */ "expression ::= NK_PLUS expression", - /* 289 */ "expression ::= NK_MINUS expression", - /* 290 */ "expression ::= expression NK_PLUS expression", - /* 291 */ "expression ::= expression NK_MINUS expression", - /* 292 */ "expression ::= expression NK_STAR expression", - /* 293 */ "expression ::= expression NK_SLASH expression", - /* 294 */ "expression ::= expression NK_REM expression", - /* 295 */ "expression_list ::= expression", - /* 296 */ "expression_list ::= expression_list NK_COMMA expression", - /* 297 */ "column_reference ::= column_name", - /* 298 */ "column_reference ::= table_name NK_DOT column_name", - /* 299 */ "pseudo_column ::= ROWTS", - /* 300 */ "pseudo_column ::= TBNAME", - /* 301 */ "pseudo_column ::= QSTARTTS", - /* 302 */ "pseudo_column ::= QENDTS", - /* 303 */ "pseudo_column ::= WSTARTTS", - /* 304 */ "pseudo_column ::= WENDTS", - /* 305 */ "pseudo_column ::= WDURATION", - /* 306 */ "predicate ::= expression compare_op expression", - /* 307 */ "predicate ::= expression BETWEEN expression AND expression", - /* 308 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 309 */ "predicate ::= expression IS NULL", - /* 310 */ "predicate ::= expression IS NOT NULL", - /* 311 */ "predicate ::= expression in_op in_predicate_value", - /* 312 */ "compare_op ::= NK_LT", - /* 313 */ "compare_op ::= NK_GT", - /* 314 */ "compare_op ::= NK_LE", - /* 315 */ "compare_op ::= NK_GE", - /* 316 */ "compare_op ::= NK_NE", - /* 317 */ "compare_op ::= NK_EQ", - /* 318 */ "compare_op ::= LIKE", - /* 319 */ "compare_op ::= NOT LIKE", - /* 320 */ "compare_op ::= MATCH", - /* 321 */ "compare_op ::= NMATCH", - /* 322 */ "in_op ::= IN", - /* 323 */ "in_op ::= NOT IN", - /* 324 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 325 */ "boolean_value_expression ::= boolean_primary", - /* 326 */ "boolean_value_expression ::= NOT boolean_primary", - /* 327 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 328 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 329 */ "boolean_primary ::= predicate", - /* 330 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 331 */ "common_expression ::= expression", - /* 332 */ "common_expression ::= boolean_value_expression", - /* 333 */ "from_clause ::= FROM table_reference_list", - /* 334 */ "table_reference_list ::= table_reference", - /* 335 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 336 */ "table_reference ::= table_primary", - /* 337 */ "table_reference ::= joined_table", - /* 338 */ "table_primary ::= table_name alias_opt", - /* 339 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 340 */ "table_primary ::= subquery alias_opt", - /* 341 */ "table_primary ::= parenthesized_joined_table", - /* 342 */ "alias_opt ::=", - /* 343 */ "alias_opt ::= table_alias", - /* 344 */ "alias_opt ::= AS table_alias", - /* 345 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 346 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 347 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 348 */ "join_type ::=", - /* 349 */ "join_type ::= INNER", - /* 350 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 351 */ "set_quantifier_opt ::=", - /* 352 */ "set_quantifier_opt ::= DISTINCT", - /* 353 */ "set_quantifier_opt ::= ALL", - /* 354 */ "select_list ::= NK_STAR", - /* 355 */ "select_list ::= select_sublist", - /* 356 */ "select_sublist ::= select_item", - /* 357 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 358 */ "select_item ::= common_expression", - /* 359 */ "select_item ::= common_expression column_alias", - /* 360 */ "select_item ::= common_expression AS column_alias", - /* 361 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 362 */ "where_clause_opt ::=", - /* 363 */ "where_clause_opt ::= WHERE search_condition", - /* 364 */ "partition_by_clause_opt ::=", - /* 365 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 366 */ "twindow_clause_opt ::=", - /* 367 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 368 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 370 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 371 */ "sliding_opt ::=", - /* 372 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 373 */ "fill_opt ::=", - /* 374 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 375 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 376 */ "fill_mode ::= NONE", - /* 377 */ "fill_mode ::= PREV", - /* 378 */ "fill_mode ::= NULL", - /* 379 */ "fill_mode ::= LINEAR", - /* 380 */ "fill_mode ::= NEXT", - /* 381 */ "group_by_clause_opt ::=", - /* 382 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 383 */ "group_by_list ::= expression", - /* 384 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 385 */ "having_clause_opt ::=", - /* 386 */ "having_clause_opt ::= HAVING search_condition", - /* 387 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 388 */ "query_expression_body ::= query_primary", - /* 389 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 390 */ "query_primary ::= query_specification", - /* 391 */ "order_by_clause_opt ::=", - /* 392 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 393 */ "slimit_clause_opt ::=", - /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 396 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 397 */ "limit_clause_opt ::=", - /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 400 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 401 */ "subquery ::= NK_LP query_expression NK_RP", - /* 402 */ "search_condition ::= common_expression", - /* 403 */ "sort_specification_list ::= sort_specification", - /* 404 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 405 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 406 */ "ordering_specification_opt ::=", - /* 407 */ "ordering_specification_opt ::= ASC", - /* 408 */ "ordering_specification_opt ::= DESC", - /* 409 */ "null_ordering_opt ::=", - /* 410 */ "null_ordering_opt ::= NULLS FIRST", - /* 411 */ "null_ordering_opt ::= NULLS LAST", + /* 155 */ "table_options ::= table_options KEEP variable_list", + /* 156 */ "table_options ::= table_options TTL NK_INTEGER", + /* 157 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 158 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 159 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 160 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 161 */ "alter_table_options ::= alter_table_option", + /* 162 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 163 */ "alter_table_option ::= COMMENT NK_STRING", + /* 164 */ "alter_table_option ::= KEEP integer_list", + /* 165 */ "alter_table_option ::= KEEP variable_list", + /* 166 */ "alter_table_option ::= TTL NK_INTEGER", + /* 167 */ "col_name_list ::= col_name", + /* 168 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 169 */ "col_name ::= column_name", + /* 170 */ "cmd ::= SHOW DNODES", + /* 171 */ "cmd ::= SHOW USERS", + /* 172 */ "cmd ::= SHOW DATABASES", + /* 173 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 174 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 175 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 176 */ "cmd ::= SHOW MNODES", + /* 177 */ "cmd ::= SHOW MODULES", + /* 178 */ "cmd ::= SHOW QNODES", + /* 179 */ "cmd ::= SHOW FUNCTIONS", + /* 180 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 181 */ "cmd ::= SHOW STREAMS", + /* 182 */ "cmd ::= SHOW ACCOUNTS", + /* 183 */ "cmd ::= SHOW APPS", + /* 184 */ "cmd ::= SHOW CONNECTIONS", + /* 185 */ "cmd ::= SHOW LICENCE", + /* 186 */ "cmd ::= SHOW GRANTS", + /* 187 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 188 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 189 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 190 */ "cmd ::= SHOW QUERIES", + /* 191 */ "cmd ::= SHOW SCORES", + /* 192 */ "cmd ::= SHOW TOPICS", + /* 193 */ "cmd ::= SHOW VARIABLES", + /* 194 */ "cmd ::= SHOW BNODES", + /* 195 */ "cmd ::= SHOW SNODES", + /* 196 */ "db_name_cond_opt ::=", + /* 197 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 198 */ "like_pattern_opt ::=", + /* 199 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 200 */ "table_name_cond ::= table_name", + /* 201 */ "from_db_opt ::=", + /* 202 */ "from_db_opt ::= FROM db_name", + /* 203 */ "func_name_list ::= func_name", + /* 204 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 205 */ "func_name ::= function_name", + /* 206 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 207 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 208 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 209 */ "index_options ::=", + /* 210 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 211 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 212 */ "func_list ::= func", + /* 213 */ "func_list ::= func_list NK_COMMA func", + /* 214 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 215 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 216 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 217 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 218 */ "cmd ::= DESC full_table_name", + /* 219 */ "cmd ::= DESCRIBE full_table_name", + /* 220 */ "cmd ::= RESET QUERY CACHE", + /* 221 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 222 */ "analyze_opt ::=", + /* 223 */ "analyze_opt ::= ANALYZE", + /* 224 */ "explain_options ::=", + /* 225 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 226 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 227 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 228 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 229 */ "cmd ::= DROP FUNCTION function_name", + /* 230 */ "agg_func_opt ::=", + /* 231 */ "agg_func_opt ::= AGGREGATE", + /* 232 */ "bufsize_opt ::=", + /* 233 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 234 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 235 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 236 */ "into_opt ::=", + /* 237 */ "into_opt ::= INTO full_table_name", + /* 238 */ "stream_options ::=", + /* 239 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 240 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 241 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 242 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 243 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 244 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 245 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 246 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 247 */ "dnode_list ::= DNODE NK_INTEGER", + /* 248 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 249 */ "cmd ::= SYNCDB db_name REPLICA", + /* 250 */ "cmd ::= query_expression", + /* 251 */ "literal ::= NK_INTEGER", + /* 252 */ "literal ::= NK_FLOAT", + /* 253 */ "literal ::= NK_STRING", + /* 254 */ "literal ::= NK_BOOL", + /* 255 */ "literal ::= TIMESTAMP NK_STRING", + /* 256 */ "literal ::= duration_literal", + /* 257 */ "literal ::= NULL", + /* 258 */ "literal ::= NK_QUESTION", + /* 259 */ "duration_literal ::= NK_VARIABLE", + /* 260 */ "signed ::= NK_INTEGER", + /* 261 */ "signed ::= NK_PLUS NK_INTEGER", + /* 262 */ "signed ::= NK_MINUS NK_INTEGER", + /* 263 */ "signed ::= NK_FLOAT", + /* 264 */ "signed ::= NK_PLUS NK_FLOAT", + /* 265 */ "signed ::= NK_MINUS NK_FLOAT", + /* 266 */ "signed_literal ::= signed", + /* 267 */ "signed_literal ::= NK_STRING", + /* 268 */ "signed_literal ::= NK_BOOL", + /* 269 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 270 */ "signed_literal ::= duration_literal", + /* 271 */ "signed_literal ::= NULL", + /* 272 */ "literal_list ::= signed_literal", + /* 273 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 274 */ "db_name ::= NK_ID", + /* 275 */ "table_name ::= NK_ID", + /* 276 */ "column_name ::= NK_ID", + /* 277 */ "function_name ::= NK_ID", + /* 278 */ "table_alias ::= NK_ID", + /* 279 */ "column_alias ::= NK_ID", + /* 280 */ "user_name ::= NK_ID", + /* 281 */ "index_name ::= NK_ID", + /* 282 */ "topic_name ::= NK_ID", + /* 283 */ "stream_name ::= NK_ID", + /* 284 */ "expression ::= literal", + /* 285 */ "expression ::= pseudo_column", + /* 286 */ "expression ::= column_reference", + /* 287 */ "expression ::= function_expression", + /* 288 */ "expression ::= subquery", + /* 289 */ "expression ::= NK_LP expression NK_RP", + /* 290 */ "expression ::= NK_PLUS expression", + /* 291 */ "expression ::= NK_MINUS expression", + /* 292 */ "expression ::= expression NK_PLUS expression", + /* 293 */ "expression ::= expression NK_MINUS expression", + /* 294 */ "expression ::= expression NK_STAR expression", + /* 295 */ "expression ::= expression NK_SLASH expression", + /* 296 */ "expression ::= expression NK_REM expression", + /* 297 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 298 */ "expression_list ::= expression", + /* 299 */ "expression_list ::= expression_list NK_COMMA expression", + /* 300 */ "column_reference ::= column_name", + /* 301 */ "column_reference ::= table_name NK_DOT column_name", + /* 302 */ "pseudo_column ::= ROWTS", + /* 303 */ "pseudo_column ::= TBNAME", + /* 304 */ "pseudo_column ::= QSTARTTS", + /* 305 */ "pseudo_column ::= QENDTS", + /* 306 */ "pseudo_column ::= WSTARTTS", + /* 307 */ "pseudo_column ::= WENDTS", + /* 308 */ "pseudo_column ::= WDURATION", + /* 309 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 310 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 311 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 312 */ "function_expression ::= noarg_func NK_LP NK_RP", + /* 313 */ "noarg_func ::= NOW", + /* 314 */ "noarg_func ::= TODAY", + /* 315 */ "star_func ::= COUNT", + /* 316 */ "star_func ::= FIRST", + /* 317 */ "star_func ::= LAST", + /* 318 */ "star_func ::= LAST_ROW", + /* 319 */ "star_func_para_list ::= NK_STAR", + /* 320 */ "star_func_para_list ::= other_para_list", + /* 321 */ "other_para_list ::= star_func_para", + /* 322 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 323 */ "star_func_para ::= expression", + /* 324 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 325 */ "predicate ::= expression compare_op expression", + /* 326 */ "predicate ::= expression BETWEEN expression AND expression", + /* 327 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 328 */ "predicate ::= expression IS NULL", + /* 329 */ "predicate ::= expression IS NOT NULL", + /* 330 */ "predicate ::= expression in_op in_predicate_value", + /* 331 */ "compare_op ::= NK_LT", + /* 332 */ "compare_op ::= NK_GT", + /* 333 */ "compare_op ::= NK_LE", + /* 334 */ "compare_op ::= NK_GE", + /* 335 */ "compare_op ::= NK_NE", + /* 336 */ "compare_op ::= NK_EQ", + /* 337 */ "compare_op ::= LIKE", + /* 338 */ "compare_op ::= NOT LIKE", + /* 339 */ "compare_op ::= MATCH", + /* 340 */ "compare_op ::= NMATCH", + /* 341 */ "compare_op ::= CONTAINS", + /* 342 */ "in_op ::= IN", + /* 343 */ "in_op ::= NOT IN", + /* 344 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 345 */ "boolean_value_expression ::= boolean_primary", + /* 346 */ "boolean_value_expression ::= NOT boolean_primary", + /* 347 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 348 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 349 */ "boolean_primary ::= predicate", + /* 350 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 351 */ "common_expression ::= expression", + /* 352 */ "common_expression ::= boolean_value_expression", + /* 353 */ "from_clause ::= FROM table_reference_list", + /* 354 */ "table_reference_list ::= table_reference", + /* 355 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 356 */ "table_reference ::= table_primary", + /* 357 */ "table_reference ::= joined_table", + /* 358 */ "table_primary ::= table_name alias_opt", + /* 359 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 360 */ "table_primary ::= subquery alias_opt", + /* 361 */ "table_primary ::= parenthesized_joined_table", + /* 362 */ "alias_opt ::=", + /* 363 */ "alias_opt ::= table_alias", + /* 364 */ "alias_opt ::= AS table_alias", + /* 365 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 366 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 367 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 368 */ "join_type ::=", + /* 369 */ "join_type ::= INNER", + /* 370 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 371 */ "set_quantifier_opt ::=", + /* 372 */ "set_quantifier_opt ::= DISTINCT", + /* 373 */ "set_quantifier_opt ::= ALL", + /* 374 */ "select_list ::= NK_STAR", + /* 375 */ "select_list ::= select_sublist", + /* 376 */ "select_sublist ::= select_item", + /* 377 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 378 */ "select_item ::= common_expression", + /* 379 */ "select_item ::= common_expression column_alias", + /* 380 */ "select_item ::= common_expression AS column_alias", + /* 381 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 382 */ "where_clause_opt ::=", + /* 383 */ "where_clause_opt ::= WHERE search_condition", + /* 384 */ "partition_by_clause_opt ::=", + /* 385 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 386 */ "twindow_clause_opt ::=", + /* 387 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 388 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 389 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 390 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 391 */ "sliding_opt ::=", + /* 392 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 393 */ "fill_opt ::=", + /* 394 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 395 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 396 */ "fill_mode ::= NONE", + /* 397 */ "fill_mode ::= PREV", + /* 398 */ "fill_mode ::= NULL", + /* 399 */ "fill_mode ::= LINEAR", + /* 400 */ "fill_mode ::= NEXT", + /* 401 */ "group_by_clause_opt ::=", + /* 402 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 403 */ "group_by_list ::= expression", + /* 404 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 405 */ "having_clause_opt ::=", + /* 406 */ "having_clause_opt ::= HAVING search_condition", + /* 407 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 408 */ "query_expression_body ::= query_primary", + /* 409 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 410 */ "query_primary ::= query_specification", + /* 411 */ "order_by_clause_opt ::=", + /* 412 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 413 */ "slimit_clause_opt ::=", + /* 414 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 415 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 416 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 417 */ "limit_clause_opt ::=", + /* 418 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 419 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 420 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 421 */ "subquery ::= NK_LP query_expression NK_RP", + /* 422 */ "search_condition ::= common_expression", + /* 423 */ "sort_specification_list ::= sort_specification", + /* 424 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 425 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 426 */ "ordering_specification_opt ::=", + /* 427 */ "ordering_specification_opt ::= ASC", + /* 428 */ "ordering_specification_opt ::= DESC", + /* 429 */ "null_ordering_opt ::=", + /* 430 */ "null_ordering_opt ::= NULLS FIRST", + /* 431 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1658,156 +1752,164 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 210: /* cmd */ - case 213: /* literal */ - case 220: /* db_options */ - case 222: /* alter_db_options */ - case 227: /* retention */ - case 228: /* full_table_name */ - case 231: /* table_options */ - case 235: /* alter_table_clause */ - case 236: /* alter_table_options */ - case 239: /* create_subtable_clause */ - case 242: /* drop_table_clause */ - case 245: /* column_def */ - case 248: /* col_name */ - case 249: /* db_name_cond_opt */ - case 250: /* like_pattern_opt */ - case 251: /* table_name_cond */ - case 252: /* from_db_opt */ - case 253: /* func_name */ - case 256: /* index_options */ - case 258: /* duration_literal */ - case 259: /* sliding_opt */ - case 260: /* func */ - case 263: /* query_expression */ - case 265: /* explain_options */ - case 270: /* signed */ - case 271: /* signed_literal */ - case 274: /* expression */ - case 275: /* pseudo_column */ - case 276: /* column_reference */ - case 277: /* subquery */ - case 278: /* predicate */ - case 281: /* in_predicate_value */ - case 282: /* boolean_value_expression */ - case 283: /* boolean_primary */ - case 284: /* common_expression */ - case 285: /* from_clause */ - case 286: /* table_reference_list */ - case 287: /* table_reference */ - case 288: /* table_primary */ - case 289: /* joined_table */ - case 291: /* parenthesized_joined_table */ - case 293: /* search_condition */ - case 294: /* query_specification */ - case 297: /* where_clause_opt */ - case 299: /* twindow_clause_opt */ - case 301: /* having_clause_opt */ - case 303: /* select_item */ - case 304: /* fill_opt */ - case 307: /* query_expression_body */ - case 309: /* slimit_clause_opt */ - case 310: /* limit_clause_opt */ - case 311: /* query_primary */ - case 313: /* sort_specification */ + case 219: /* cmd */ + case 222: /* literal */ + case 229: /* db_options */ + case 231: /* alter_db_options */ + case 236: /* retention */ + case 237: /* full_table_name */ + case 240: /* table_options */ + case 244: /* alter_table_clause */ + case 245: /* alter_table_options */ + case 248: /* create_subtable_clause */ + case 251: /* drop_table_clause */ + case 254: /* column_def */ + case 257: /* col_name */ + case 258: /* db_name_cond_opt */ + case 259: /* like_pattern_opt */ + case 260: /* table_name_cond */ + case 261: /* from_db_opt */ + case 262: /* func_name */ + case 265: /* index_options */ + case 267: /* duration_literal */ + case 268: /* sliding_opt */ + case 269: /* func */ + case 272: /* query_expression */ + case 274: /* explain_options */ + case 278: /* stream_options */ + case 279: /* into_opt */ + case 281: /* signed */ + case 282: /* signed_literal */ + case 285: /* expression */ + case 286: /* pseudo_column */ + case 287: /* column_reference */ + case 288: /* function_expression */ + case 289: /* subquery */ + case 294: /* star_func_para */ + case 295: /* predicate */ + case 298: /* in_predicate_value */ + case 299: /* boolean_value_expression */ + case 300: /* boolean_primary */ + case 301: /* common_expression */ + case 302: /* from_clause */ + case 303: /* table_reference_list */ + case 304: /* table_reference */ + case 305: /* table_primary */ + case 306: /* joined_table */ + case 308: /* parenthesized_joined_table */ + case 310: /* search_condition */ + case 311: /* query_specification */ + case 314: /* where_clause_opt */ + case 316: /* twindow_clause_opt */ + case 318: /* having_clause_opt */ + case 320: /* select_item */ + case 321: /* fill_opt */ + case 324: /* query_expression_body */ + case 326: /* slimit_clause_opt */ + case 327: /* limit_clause_opt */ + case 328: /* query_primary */ + case 330: /* sort_specification */ { - nodesDestroyNode((yypminor->yy504)); + nodesDestroyNode((yypminor->yy452)); } break; - case 211: /* account_options */ - case 212: /* alter_account_options */ - case 214: /* alter_account_option */ - case 267: /* bufsize_opt */ + case 220: /* account_options */ + case 221: /* alter_account_options */ + case 223: /* alter_account_option */ + case 276: /* bufsize_opt */ { } break; - case 215: /* user_name */ - case 216: /* dnode_endpoint */ - case 217: /* dnode_host_name */ - case 219: /* db_name */ - case 237: /* column_name */ - case 244: /* table_name */ - case 254: /* function_name */ - case 255: /* index_name */ - case 262: /* topic_name */ - case 268: /* stream_name */ - case 272: /* table_alias */ - case 273: /* column_alias */ - case 290: /* alias_opt */ + case 224: /* user_name */ + case 225: /* dnode_endpoint */ + case 226: /* dnode_host_name */ + case 228: /* db_name */ + case 246: /* column_name */ + case 253: /* table_name */ + case 263: /* function_name */ + case 264: /* index_name */ + case 271: /* topic_name */ + case 277: /* stream_name */ + case 283: /* table_alias */ + case 284: /* column_alias */ + case 290: /* star_func */ + case 292: /* noarg_func */ + case 307: /* alias_opt */ { } break; - case 218: /* not_exists_opt */ - case 221: /* exists_opt */ - case 264: /* analyze_opt */ - case 266: /* agg_func_opt */ - case 295: /* set_quantifier_opt */ + case 227: /* not_exists_opt */ + case 230: /* exists_opt */ + case 273: /* analyze_opt */ + case 275: /* agg_func_opt */ + case 312: /* set_quantifier_opt */ { } break; - case 223: /* integer_list */ - case 224: /* variable_list */ - case 225: /* retention_list */ - case 229: /* column_def_list */ - case 230: /* tags_def_opt */ - case 232: /* multi_create_clause */ - case 233: /* tags_def */ - case 234: /* multi_drop_clause */ - case 240: /* specific_tags_opt */ - case 241: /* literal_list */ - case 243: /* col_name_list */ - case 246: /* func_name_list */ - case 257: /* func_list */ - case 261: /* expression_list */ - case 269: /* dnode_list */ - case 296: /* select_list */ - case 298: /* partition_by_clause_opt */ - case 300: /* group_by_clause_opt */ - case 302: /* select_sublist */ - case 306: /* group_by_list */ - case 308: /* order_by_clause_opt */ - case 312: /* sort_specification_list */ + case 232: /* integer_list */ + case 233: /* variable_list */ + case 234: /* retention_list */ + case 238: /* column_def_list */ + case 239: /* tags_def_opt */ + case 241: /* multi_create_clause */ + case 242: /* tags_def */ + case 243: /* multi_drop_clause */ + case 249: /* specific_tags_opt */ + case 250: /* literal_list */ + case 252: /* col_name_list */ + case 255: /* func_name_list */ + case 266: /* func_list */ + case 270: /* expression_list */ + case 280: /* dnode_list */ + case 291: /* star_func_para_list */ + case 293: /* other_para_list */ + case 313: /* select_list */ + case 315: /* partition_by_clause_opt */ + case 317: /* group_by_clause_opt */ + case 319: /* select_sublist */ + case 323: /* group_by_list */ + case 325: /* order_by_clause_opt */ + case 329: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy488)); + nodesDestroyList((yypminor->yy478)); } break; - case 226: /* alter_db_option */ - case 247: /* alter_table_option */ + case 235: /* alter_db_option */ + case 256: /* alter_table_option */ { } break; - case 238: /* type_name */ + case 247: /* type_name */ { } break; - case 279: /* compare_op */ - case 280: /* in_op */ + case 296: /* compare_op */ + case 297: /* in_op */ { } break; - case 292: /* join_type */ + case 309: /* join_type */ { } break; - case 305: /* fill_mode */ + case 322: /* fill_mode */ { } break; - case 314: /* ordering_specification_opt */ + case 331: /* ordering_specification_opt */ { } break; - case 315: /* null_ordering_opt */ + case 332: /* null_ordering_opt */ { } @@ -1935,18 +2037,15 @@ static YYACTIONTYPE yy_find_shift_action( do{ i = yy_shift_ofst[stateno]; assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + /* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */ assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); - if( yy_lookahead[i]!=iLookAhead ){ + if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", @@ -1961,8 +2060,16 @@ static YYACTIONTYPE yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1976,7 +2083,6 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && iyytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; + yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -3018,11 +2728,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,211,&yymsp[0].minor); + yy_destructor(yypParser,220,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,212,&yymsp[0].minor); + yy_destructor(yypParser,221,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3036,20 +2746,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,211,&yymsp[-2].minor); +{ yy_destructor(yypParser,220,&yymsp[-2].minor); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,214,&yymsp[0].minor); +{ yy_destructor(yypParser,223,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,212,&yymsp[-1].minor); +{ yy_destructor(yypParser,221,&yymsp[-1].minor); { } - yy_destructor(yypParser,214,&yymsp[0].minor); + yy_destructor(yypParser,223,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3063,31 +2773,31 @@ 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,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy479, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy479, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy479); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy409, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy479, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy479); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3104,22 +2814,24 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 265: /* db_name ::= NK_ID */ yytestcase(yyruleno==265); - case 266: /* table_name ::= NK_ID */ yytestcase(yyruleno==266); - case 267: /* column_name ::= NK_ID */ yytestcase(yyruleno==267); - case 268: /* function_name ::= NK_ID */ yytestcase(yyruleno==268); - case 269: /* function_name ::= FIRST */ yytestcase(yyruleno==269); - case 270: /* function_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* function_name ::= NOW */ yytestcase(yyruleno==271); - case 272: /* function_name ::= TODAY */ yytestcase(yyruleno==272); - case 273: /* table_alias ::= NK_ID */ yytestcase(yyruleno==273); - case 274: /* column_alias ::= NK_ID */ yytestcase(yyruleno==274); - case 275: /* user_name ::= NK_ID */ yytestcase(yyruleno==275); - case 276: /* index_name ::= NK_ID */ yytestcase(yyruleno==276); - case 277: /* topic_name ::= NK_ID */ yytestcase(yyruleno==277); - case 278: /* stream_name ::= NK_ID */ yytestcase(yyruleno==278); -{ yylhsminor.yy409 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 274: /* db_name ::= NK_ID */ yytestcase(yyruleno==274); + case 275: /* table_name ::= NK_ID */ yytestcase(yyruleno==275); + case 276: /* column_name ::= NK_ID */ yytestcase(yyruleno==276); + case 277: /* function_name ::= NK_ID */ yytestcase(yyruleno==277); + case 278: /* table_alias ::= NK_ID */ yytestcase(yyruleno==278); + case 279: /* column_alias ::= NK_ID */ yytestcase(yyruleno==279); + case 280: /* user_name ::= NK_ID */ yytestcase(yyruleno==280); + case 281: /* index_name ::= NK_ID */ yytestcase(yyruleno==281); + case 282: /* topic_name ::= NK_ID */ yytestcase(yyruleno==282); + case 283: /* stream_name ::= NK_ID */ yytestcase(yyruleno==283); + case 313: /* noarg_func ::= NOW */ yytestcase(yyruleno==313); + case 314: /* noarg_func ::= TODAY */ yytestcase(yyruleno==314); + case 315: /* star_func ::= COUNT */ yytestcase(yyruleno==315); + case 316: /* star_func ::= FIRST */ yytestcase(yyruleno==316); + case 317: /* star_func ::= LAST */ yytestcase(yyruleno==317); + case 318: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==318); +{ yylhsminor.yy479 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy479 = yylhsminor.yy479; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3152,1093 +2864,1133 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 49: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy121, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy659, &yymsp[-1].minor.yy479, yymsp[0].minor.yy452); } break; case 50: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy659, &yymsp[0].minor.yy479); } break; case 51: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy479); } break; case 52: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy479, yymsp[0].minor.yy452); } break; case 53: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy121 = true; } +{ yymsp[-2].minor.yy659 = true; } break; case 54: /* not_exists_opt ::= */ case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); - case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); - case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); - case 351: /* set_quantifier_opt ::= */ yytestcase(yyruleno==351); -{ yymsp[1].minor.yy121 = false; } + case 222: /* analyze_opt ::= */ yytestcase(yyruleno==222); + case 230: /* agg_func_opt ::= */ yytestcase(yyruleno==230); + case 371: /* set_quantifier_opt ::= */ yytestcase(yyruleno==371); +{ yymsp[1].minor.yy659 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy121 = true; } +{ yymsp[-1].minor.yy659 = true; } break; case 57: /* db_options ::= */ -{ yymsp[1].minor.yy504 = createDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy452 = createDatabaseOptions(pCxt); } break; case 58: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 59: /* db_options ::= db_options CACHE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 60: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 61: /* db_options ::= db_options COMP NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 62: /* db_options ::= db_options DAYS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 63: /* db_options ::= db_options DAYS NK_VARIABLE */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 64: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 65: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 66: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 67: /* db_options ::= db_options KEEP integer_list */ case 68: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==68); -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pKeep = yymsp[0].minor.yy478; yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 69: /* db_options ::= db_options PRECISION NK_STRING */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 70: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 71: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 72: /* db_options ::= db_options TTL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 73: /* db_options ::= db_options WAL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 74: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 75: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 76: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 77: /* db_options ::= db_options RETENTIONS retention_list */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pRetentions = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy452)->pRetentions = yymsp[0].minor.yy478; yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 78: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy504 = createDatabaseOptions(pCxt); yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createDatabaseOptions(pCxt); yylhsminor.yy452 = setDatabaseAlterOption(pCxt, yylhsminor.yy452, &yymsp[0].minor.yy11); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; case 79: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy452, &yymsp[0].minor.yy11); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; case 80: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 81: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 82: /* alter_db_option ::= KEEP integer_list */ case 83: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==83); -{ yymsp[-1].minor.yy21.type = DB_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } +{ yymsp[-1].minor.yy11.type = DB_OPTION_KEEP; yymsp[-1].minor.yy11.pList = yymsp[0].minor.yy478; } break; case 84: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_WAL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_WAL; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 85: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 86: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 87: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy11.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 88: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy478 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy478 = yylhsminor.yy478; break; case 89: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 240: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==240); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 248: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==248); +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-2].minor.yy478, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy478 = yylhsminor.yy478; break; case 90: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy488 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy478 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy478 = yylhsminor.yy478; break; case 91: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-2].minor.yy478, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy478 = yylhsminor.yy478; break; case 92: /* retention_list ::= retention */ case 112: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==112); case 115: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==115); case 122: /* column_def_list ::= column_def */ yytestcase(yyruleno==122); - case 165: /* col_name_list ::= col_name */ yytestcase(yyruleno==165); - case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); - case 210: /* func_list ::= func */ yytestcase(yyruleno==210); - case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); - case 356: /* select_sublist ::= select_item */ yytestcase(yyruleno==356); - case 403: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==403); -{ yylhsminor.yy488 = createNodeList(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 167: /* col_name_list ::= col_name */ yytestcase(yyruleno==167); + case 203: /* func_name_list ::= func_name */ yytestcase(yyruleno==203); + case 212: /* func_list ::= func */ yytestcase(yyruleno==212); + case 272: /* literal_list ::= signed_literal */ yytestcase(yyruleno==272); + case 321: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==321); + case 376: /* select_sublist ::= select_item */ yytestcase(yyruleno==376); + case 423: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==423); +{ yylhsminor.yy478 = createNodeList(pCxt, yymsp[0].minor.yy452); } + yymsp[0].minor.yy478 = yylhsminor.yy478; break; case 93: /* retention_list ::= retention_list NK_COMMA retention */ case 123: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==123); - case 166: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==166); - case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); - case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); - case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); - case 357: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==357); - case 404: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==404); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 168: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==168); + case 204: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==204); + case 213: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==213); + case 273: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==273); + case 322: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==322); + case 377: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==377); + case 424: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==424); +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-2].minor.yy478, yymsp[0].minor.yy452); } + yymsp[-2].minor.yy478 = yylhsminor.yy478; break; case 94: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy504 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 95: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 97: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==97); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy121, yymsp[-5].minor.yy504, yymsp[-3].minor.yy488, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy659, yymsp[-5].minor.yy452, yymsp[-3].minor.yy478, yymsp[-1].minor.yy478, yymsp[0].minor.yy452); } break; case 96: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy478); } break; case 98: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy478); } break; case 99: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy659, yymsp[0].minor.yy452); } break; case 100: /* cmd ::= ALTER TABLE alter_table_clause */ case 101: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==101); - case 242: /* cmd ::= query_expression */ yytestcase(yyruleno==242); -{ pCxt->pRootNode = yymsp[0].minor.yy504; } + case 250: /* cmd ::= query_expression */ yytestcase(yyruleno==250); +{ pCxt->pRootNode = yymsp[0].minor.yy452; } break; case 102: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy504 = createAlterTableOption(pCxt, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableOption(pCxt, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; case 103: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy479, yymsp[0].minor.yy430); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 104: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy452, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy479); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; case 105: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy479, yymsp[0].minor.yy430); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 106: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy479, &yymsp[0].minor.yy479); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 107: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy479, yymsp[0].minor.yy430); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 108: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy452, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy479); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; case 109: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy479, yymsp[0].minor.yy430); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 110: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy479, &yymsp[0].minor.yy479); } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; case 111: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy504 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy504, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy452, &yymsp[-2].minor.yy479, yymsp[0].minor.yy452); } + yymsp[-5].minor.yy452 = yylhsminor.yy452; break; case 113: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 116: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==116); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-1].minor.yy478, yymsp[0].minor.yy452); } + yymsp[-1].minor.yy478 = yylhsminor.yy478; break; case 114: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy504 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy121, yymsp[-7].minor.yy504, yymsp[-5].minor.yy504, yymsp[-4].minor.yy488, yymsp[-1].minor.yy488); } - yymsp[-8].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy659, yymsp[-7].minor.yy452, yymsp[-5].minor.yy452, yymsp[-4].minor.yy478, yymsp[-1].minor.yy478); } + yymsp[-8].minor.yy452 = yylhsminor.yy452; break; case 117: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy504 = createDropTableClause(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createDropTableClause(pCxt, yymsp[-1].minor.yy659, yymsp[0].minor.yy452); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 364: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==364); - case 381: /* group_by_clause_opt ::= */ yytestcase(yyruleno==381); - case 391: /* order_by_clause_opt ::= */ yytestcase(yyruleno==391); -{ yymsp[1].minor.yy488 = NULL; } + case 384: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==384); + case 401: /* group_by_clause_opt ::= */ yytestcase(yyruleno==401); + case 411: /* order_by_clause_opt ::= */ yytestcase(yyruleno==411); +{ yymsp[1].minor.yy478 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-2].minor.yy478 = yymsp[-1].minor.yy478; } break; case 120: /* full_table_name ::= table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy479, NULL); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; case 121: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createRealTableNode(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy479, NULL); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 124: /* column_def ::= column_name type_name */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160, NULL); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy479, yymsp[0].minor.yy430, NULL); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; case 125: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy452 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy479, yymsp[-2].minor.yy430, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; case 126: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 127: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 128: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 129: /* type_name ::= INT */ case 130: /* type_name ::= INTEGER */ yytestcase(yyruleno==130); -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_INT); } break; case 131: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 132: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 133: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 134: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy430 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 135: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 136: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy430 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 137: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy430 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 138: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy430 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 139: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy430 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 140: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy430 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 141: /* type_name ::= JSON */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 142: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy430 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 143: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 144: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 145: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy430 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy430 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 147: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy430 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 148: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy430 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 355: /* select_list ::= select_sublist */ yytestcase(yyruleno==355); -{ yylhsminor.yy488 = yymsp[0].minor.yy488; } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 320: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==320); + case 375: /* select_list ::= select_sublist */ yytestcase(yyruleno==375); +{ yylhsminor.yy478 = yymsp[0].minor.yy478; } + yymsp[0].minor.yy478 = yylhsminor.yy478; break; case 151: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-3].minor.yy478 = yymsp[-1].minor.yy478; } break; case 152: /* table_options ::= */ -{ yymsp[1].minor.yy504 = createTableOptions(pCxt); } +{ yymsp[1].minor.yy452 = createTableOptions(pCxt); } break; case 153: /* table_options ::= table_options COMMENT NK_STRING */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((STableOptions*)yymsp[-2].minor.yy452)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; case 154: /* table_options ::= table_options KEEP integer_list */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 155: /* table_options ::= table_options KEEP variable_list */ yytestcase(yyruleno==155); +{ ((STableOptions*)yymsp[-2].minor.yy452)->pKeep = yymsp[0].minor.yy478; yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 155: /* table_options ::= table_options TTL NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 156: /* table_options ::= table_options TTL NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy452)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 156: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pSma = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 157: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy452)->pSma = yymsp[-1].minor.yy478; yylhsminor.yy452 = yymsp[-4].minor.yy452; } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; - case 157: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pFuncs = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 158: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy452)->pFuncs = yymsp[-1].minor.yy478; yylhsminor.yy452 = yymsp[-4].minor.yy452; } + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; - case 158: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 159: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ +{ ((STableOptions*)yymsp[-2].minor.yy452)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 159: /* table_options ::= table_options DELAY NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 160: /* table_options ::= table_options DELAY NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy452)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 160: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy504 = createTableOptions(pCxt); yylhsminor.yy504 = setTableAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 161: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy452 = createTableOptions(pCxt); yylhsminor.yy452 = setTableAlterOption(pCxt, yylhsminor.yy452, &yymsp[0].minor.yy11); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 161: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy504 = setTableAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 162: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy452 = setTableAlterOption(pCxt, yymsp[-1].minor.yy452, &yymsp[0].minor.yy11); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 162: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 163: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy11.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 163: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } + case 164: /* alter_table_option ::= KEEP integer_list */ + case 165: /* alter_table_option ::= KEEP variable_list */ yytestcase(yyruleno==165); +{ yymsp[-1].minor.yy11.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy11.pList = yymsp[0].minor.yy478; } break; - case 164: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 166: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy11.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy11.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 167: /* col_name ::= column_name */ -{ yylhsminor.yy504 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 169: /* col_name ::= column_name */ +{ yylhsminor.yy452 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy479); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 168: /* cmd ::= SHOW DNODES */ + case 170: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 169: /* cmd ::= SHOW USERS */ + case 171: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 170: /* cmd ::= SHOW DATABASES */ + case 172: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 171: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 173: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } break; - case 172: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 174: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } break; - case 173: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy504, NULL); } + case 175: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy452, NULL); } break; - case 174: /* cmd ::= SHOW MNODES */ + case 176: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 175: /* cmd ::= SHOW MODULES */ + case 177: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 176: /* cmd ::= SHOW QNODES */ + case 178: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 177: /* cmd ::= SHOW FUNCTIONS */ + case 179: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 178: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 180: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } break; - case 179: /* cmd ::= SHOW STREAMS */ + case 181: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 180: /* cmd ::= SHOW ACCOUNTS */ + case 182: /* cmd ::= SHOW ACCOUNTS */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 181: /* cmd ::= SHOW APPS */ -//{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } + case 183: /* cmd ::= SHOW APPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } break; - case 182: /* cmd ::= SHOW CONNECTIONS */ + case 184: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; - case 183: /* cmd ::= SHOW LICENCE */ - case 184: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==184); + case 185: /* cmd ::= SHOW LICENCE */ + case 186: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==186); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 185: /* cmd ::= SHOW CREATE DATABASE db_name */ -//{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } + case 187: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy479); } break; - case 186: /* cmd ::= SHOW CREATE TABLE full_table_name */ -//{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy504); } + case 188: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy452); } break; - case 187: /* cmd ::= SHOW CREATE STABLE full_table_name */ -//{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy504); } + case 189: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy452); } break; - case 188: /* cmd ::= SHOW QUERIES */ + case 190: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 189: /* cmd ::= SHOW SCORES */ -//{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } + case 191: /* cmd ::= SHOW SCORES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 190: /* cmd ::= SHOW TOPICS */ + case 192: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 191: /* cmd ::= SHOW VARIABLES */ -//{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } + case 193: /* cmd ::= SHOW VARIABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 192: /* cmd ::= SHOW BNODES */ + case 194: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); } break; - case 193: /* cmd ::= SHOW SNODES */ + case 195: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); } break; - case 194: /* db_name_cond_opt ::= */ - case 199: /* from_db_opt ::= */ yytestcase(yyruleno==199); -{ yymsp[1].minor.yy504 = createDefaultDatabaseCondValue(pCxt); } + case 196: /* db_name_cond_opt ::= */ + case 201: /* from_db_opt ::= */ yytestcase(yyruleno==201); +{ yymsp[1].minor.yy452 = createDefaultDatabaseCondValue(pCxt); } break; - case 195: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 197: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy479); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 196: /* like_pattern_opt ::= */ - case 207: /* index_options ::= */ yytestcase(yyruleno==207); - case 362: /* where_clause_opt ::= */ yytestcase(yyruleno==362); - case 366: /* twindow_clause_opt ::= */ yytestcase(yyruleno==366); - case 371: /* sliding_opt ::= */ yytestcase(yyruleno==371); - case 373: /* fill_opt ::= */ yytestcase(yyruleno==373); - case 385: /* having_clause_opt ::= */ yytestcase(yyruleno==385); - case 393: /* slimit_clause_opt ::= */ yytestcase(yyruleno==393); - case 397: /* limit_clause_opt ::= */ yytestcase(yyruleno==397); -{ yymsp[1].minor.yy504 = NULL; } + case 198: /* like_pattern_opt ::= */ + case 209: /* index_options ::= */ yytestcase(yyruleno==209); + case 236: /* into_opt ::= */ yytestcase(yyruleno==236); + case 382: /* where_clause_opt ::= */ yytestcase(yyruleno==382); + case 386: /* twindow_clause_opt ::= */ yytestcase(yyruleno==386); + case 391: /* sliding_opt ::= */ yytestcase(yyruleno==391); + case 393: /* fill_opt ::= */ yytestcase(yyruleno==393); + case 405: /* having_clause_opt ::= */ yytestcase(yyruleno==405); + case 413: /* slimit_clause_opt ::= */ yytestcase(yyruleno==413); + case 417: /* limit_clause_opt ::= */ yytestcase(yyruleno==417); +{ yymsp[1].minor.yy452 = NULL; } break; - case 197: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 199: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 198: /* table_name_cond ::= table_name */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 200: /* table_name_cond ::= table_name */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy479); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 200: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } + case 202: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy479); } break; - case 203: /* func_name ::= function_name */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 205: /* func_name ::= function_name */ +{ yylhsminor.yy452 = createFunctionNode(pCxt, &yymsp[0].minor.yy479, NULL); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 204: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy121, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, NULL, yymsp[0].minor.yy504); } + case 206: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy659, &yymsp[-3].minor.yy479, &yymsp[-1].minor.yy479, NULL, yymsp[0].minor.yy452); } break; - case 205: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488, NULL); } + case 207: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy659, &yymsp[-5].minor.yy479, &yymsp[-3].minor.yy479, yymsp[-1].minor.yy478, NULL); } break; - case 206: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409); } + case 208: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy659, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy479); } break; - case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy504 = createIndexOption(pCxt, yymsp[-6].minor.yy488, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL, yymsp[0].minor.yy504); } + case 210: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy452 = createIndexOption(pCxt, yymsp[-6].minor.yy478, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), NULL, yymsp[0].minor.yy452); } break; - case 209: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy504 = createIndexOption(pCxt, yymsp[-8].minor.yy488, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[0].minor.yy504); } + case 211: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ +{ yymsp[-10].minor.yy452 = createIndexOption(pCxt, yymsp[-8].minor.yy478, releaseRawExprNode(pCxt, yymsp[-4].minor.yy452), releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), yymsp[0].minor.yy452); } break; - case 212: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 214: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy452 = createFunctionNode(pCxt, &yymsp[-3].minor.yy479, yymsp[-1].minor.yy478); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; - case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504, NULL); } + case 215: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy659, &yymsp[-2].minor.yy479, yymsp[0].minor.yy452, NULL); } break; - case 214: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, NULL, &yymsp[0].minor.yy409); } + case 216: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy659, &yymsp[-2].minor.yy479, NULL, &yymsp[0].minor.yy479); } break; - case 215: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } + case 217: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy659, &yymsp[0].minor.yy479); } break; - case 216: /* cmd ::= DESC full_table_name */ - case 217: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==217); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy504); } + case 218: /* cmd ::= DESC full_table_name */ + case 219: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==219); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy452); } break; - case 218: /* cmd ::= RESET QUERY CACHE */ + case 220: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 219: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy121, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 221: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy659, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } break; - case 221: /* analyze_opt ::= ANALYZE */ - case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); - case 352: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==352); -{ yymsp[0].minor.yy121 = true; } + case 223: /* analyze_opt ::= ANALYZE */ + case 231: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==231); + case 372: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==372); +{ yymsp[0].minor.yy659 = true; } break; - case 222: /* explain_options ::= */ -{ yymsp[1].minor.yy504 = createDefaultExplainOptions(pCxt); } + case 224: /* explain_options ::= */ +{ yymsp[1].minor.yy452 = createDefaultExplainOptions(pCxt); } break; - case 223: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy504 = setExplainVerbose(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 225: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy452 = setExplainVerbose(pCxt, yymsp[-2].minor.yy452, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 224: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy504 = setExplainRatio(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 226: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy452 = setExplainRatio(pCxt, yymsp[-2].minor.yy452, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 225: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy488); } + case 227: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy478); } break; - case 226: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy160, yymsp[0].minor.yy452); } + case 228: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy659, &yymsp[-5].minor.yy479, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy430, yymsp[0].minor.yy100); } break; - case 227: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy409); } + case 229: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy479); } break; - case 230: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy452 = 0; } + case 232: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy100 = 0; } break; - case 231: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy452 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 233: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy100 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 232: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy409, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } + case 234: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy659, &yymsp[-4].minor.yy479, yymsp[-3].minor.yy452, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } break; - case 233: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy409); } + case 235: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy659, &yymsp[0].minor.yy479); } break; - case 234: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 237: /* into_opt ::= INTO full_table_name */ + case 353: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==353); + case 383: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==383); + case 406: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==406); +{ yymsp[-1].minor.yy452 = yymsp[0].minor.yy452; } + break; + case 238: /* stream_options ::= */ +{ yymsp[1].minor.yy452 = createStreamOptions(pCxt); } + break; + case 239: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy452)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 240: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy452)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 241: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy452)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); yylhsminor.yy452 = yymsp[-2].minor.yy452; } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 242: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 235: /* cmd ::= KILL QUERY NK_INTEGER */ + case 243: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 236: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 244: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 237: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy488); } + case 245: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy478); } break; - case 238: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 246: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 239: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 247: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy478 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 241: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy409); } + case 249: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy479); } break; - case 243: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 251: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 244: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 252: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 245: /* literal ::= NK_STRING */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 253: /* literal ::= NK_STRING */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 246: /* literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 254: /* literal ::= NK_BOOL */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 247: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 255: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 248: /* literal ::= duration_literal */ - case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); - case 279: /* expression ::= literal */ yytestcase(yyruleno==279); - case 280: /* expression ::= pseudo_column */ yytestcase(yyruleno==280); - case 281: /* expression ::= column_reference */ yytestcase(yyruleno==281); - case 286: /* expression ::= subquery */ yytestcase(yyruleno==286); - case 325: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==325); - case 329: /* boolean_primary ::= predicate */ yytestcase(yyruleno==329); - case 331: /* common_expression ::= expression */ yytestcase(yyruleno==331); - case 332: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==332); - case 334: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==334); - case 336: /* table_reference ::= table_primary */ yytestcase(yyruleno==336); - case 337: /* table_reference ::= joined_table */ yytestcase(yyruleno==337); - case 341: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==341); - case 388: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==388); - case 390: /* query_primary ::= query_specification */ yytestcase(yyruleno==390); -{ yylhsminor.yy504 = yymsp[0].minor.yy504; } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 256: /* literal ::= duration_literal */ + case 266: /* signed_literal ::= signed */ yytestcase(yyruleno==266); + case 284: /* expression ::= literal */ yytestcase(yyruleno==284); + case 285: /* expression ::= pseudo_column */ yytestcase(yyruleno==285); + case 286: /* expression ::= column_reference */ yytestcase(yyruleno==286); + case 287: /* expression ::= function_expression */ yytestcase(yyruleno==287); + case 288: /* expression ::= subquery */ yytestcase(yyruleno==288); + case 345: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==345); + case 349: /* boolean_primary ::= predicate */ yytestcase(yyruleno==349); + case 351: /* common_expression ::= expression */ yytestcase(yyruleno==351); + case 352: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==352); + case 354: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==354); + case 356: /* table_reference ::= table_primary */ yytestcase(yyruleno==356); + case 357: /* table_reference ::= joined_table */ yytestcase(yyruleno==357); + case 361: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==361); + case 408: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==408); + case 410: /* query_primary ::= query_specification */ yytestcase(yyruleno==410); +{ yylhsminor.yy452 = yymsp[0].minor.yy452; } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 249: /* literal ::= NULL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 257: /* literal ::= NULL */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 250: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 258: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 251: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 259: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 252: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 260: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 253: /* signed ::= NK_MINUS NK_INTEGER */ + case 261: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 262: /* 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.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 254: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 263: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 255: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 264: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 256: /* signed ::= NK_MINUS NK_FLOAT */ + case 265: /* 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.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 258: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 267: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 259: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 268: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 260: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 269: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 261: /* signed_literal ::= duration_literal */ - case 358: /* select_item ::= common_expression */ yytestcase(yyruleno==358); - case 402: /* search_condition ::= common_expression */ yytestcase(yyruleno==402); -{ yylhsminor.yy504 = releaseRawExprNode(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 270: /* signed_literal ::= duration_literal */ + case 323: /* star_func_para ::= expression */ yytestcase(yyruleno==323); + case 378: /* select_item ::= common_expression */ yytestcase(yyruleno==378); + case 422: /* search_condition ::= common_expression */ yytestcase(yyruleno==422); +{ yylhsminor.yy452 = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); } + yymsp[0].minor.yy452 = yylhsminor.yy452; break; - case 262: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 271: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 282: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 289: /* expression ::= NK_LP expression NK_RP */ + case 350: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==350); +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 283: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; - break; - case 284: /* expression ::= function_name NK_LP NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0, createFunctionNodeNoParam(pCxt, &yymsp[-2].minor.yy409)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 285: /* expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy160)); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; - break; - case 287: /* expression ::= NK_LP expression NK_RP */ - case 330: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==330); -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 288: /* expression ::= NK_PLUS expression */ + case 290: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 289: /* expression ::= NK_MINUS expression */ + case 291: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy452), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 290: /* expression ::= expression NK_PLUS expression */ + case 292: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 291: /* expression ::= expression NK_MINUS expression */ + case 293: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 292: /* expression ::= expression NK_STAR expression */ + case 294: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 293: /* expression ::= expression NK_SLASH expression */ + case 295: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 294: /* expression ::= expression NK_REM expression */ + case 296: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 295: /* expression_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; - break; - case 296: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 297: /* column_reference ::= column_name */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy409, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 298: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 299: /* pseudo_column ::= ROWTS */ - case 300: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==302); - case 303: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==303); - case 304: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==304); - case 305: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==305); -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 306: /* predicate ::= expression compare_op expression */ - case 311: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==311); + case 297: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy84, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 307: /* predicate ::= expression BETWEEN expression AND expression */ + case 298: /* expression_list ::= expression */ +{ yylhsminor.yy478 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); } + yymsp[0].minor.yy478 = yylhsminor.yy478; + break; + case 299: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-2].minor.yy478, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); } + yymsp[-2].minor.yy478 = yylhsminor.yy478; + break; + case 300: /* column_reference ::= column_name */ +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy479, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy479)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; + break; + case 301: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy479, createColumnNode(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy479)); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 302: /* pseudo_column ::= ROWTS */ + case 303: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==303); + case 304: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==304); + case 305: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==305); + case 306: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==306); + case 307: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==307); + case 308: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==308); +{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy452 = yylhsminor.yy452; + break; + case 309: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 310: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==310); +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy479, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy479, yymsp[-1].minor.yy478)); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; + break; + case 311: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), yymsp[-1].minor.yy430)); } + yymsp[-5].minor.yy452 = yylhsminor.yy452; + break; + case 312: /* function_expression ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy479, NULL)); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 319: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy478 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy478 = yylhsminor.yy478; + break; + case 324: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 381: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==381); +{ yylhsminor.yy452 = createColumnNode(pCxt, &yymsp[-2].minor.yy479, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 325: /* predicate ::= expression compare_op expression */ + case 330: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==330); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy218, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 308: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 326: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy452), releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + yymsp[-4].minor.yy452 = yylhsminor.yy452; break; - case 309: /* predicate ::= expression IS NULL */ + case 327: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[-5].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-5].minor.yy452 = yylhsminor.yy452; break; - case 310: /* predicate ::= expression IS NOT NULL */ + case 328: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), NULL)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 312: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_THAN; } - break; - case 313: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_THAN; } - break; - case 314: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_EQUAL; } - break; - case 315: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_EQUAL; } - break; - case 316: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy84 = OP_TYPE_NOT_EQUAL; } - break; - case 317: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy84 = OP_TYPE_EQUAL; } - break; - case 318: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LIKE; } - break; - case 319: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_LIKE; } - break; - case 320: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_MATCH; } - break; - case 321: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_NMATCH; } - break; - case 322: /* in_op ::= IN */ -{ yymsp[0].minor.yy84 = OP_TYPE_IN; } - break; - case 323: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_IN; } - break; - case 324: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 326: /* boolean_value_expression ::= NOT boolean_primary */ + case 329: /* predicate ::= expression IS NOT NULL */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; - case 327: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 331: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy218 = OP_TYPE_LOWER_THAN; } + break; + case 332: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy218 = OP_TYPE_GREATER_THAN; } + break; + case 333: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy218 = OP_TYPE_LOWER_EQUAL; } + break; + case 334: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy218 = OP_TYPE_GREATER_EQUAL; } + break; + case 335: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy218 = OP_TYPE_NOT_EQUAL; } + break; + case 336: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy218 = OP_TYPE_EQUAL; } + break; + case 337: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy218 = OP_TYPE_LIKE; } + break; + case 338: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy218 = OP_TYPE_NOT_LIKE; } + break; + case 339: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy218 = OP_TYPE_MATCH; } + break; + case 340: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy218 = OP_TYPE_NMATCH; } + break; + case 341: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy218 = OP_TYPE_JSON_CONTAINS; } + break; + case 342: /* in_op ::= IN */ +{ yymsp[0].minor.yy218 = OP_TYPE_IN; } + break; + case 343: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy218 = OP_TYPE_NOT_IN; } + break; + case 344: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy478)); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; + break; + case 346: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy452), NULL)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 328: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 347: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 333: /* from_clause ::= FROM table_reference_list */ - case 363: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==363); - case 386: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==386); -{ yymsp[-1].minor.yy504 = yymsp[0].minor.yy504; } + case 348: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); + yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 335: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy504, yymsp[0].minor.yy504, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 355: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy452 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy452, yymsp[0].minor.yy452, NULL); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 338: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 358: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy452 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy479, &yymsp[0].minor.yy479); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 339: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 359: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy452 = createRealTableNode(pCxt, &yymsp[-3].minor.yy479, &yymsp[-1].minor.yy479, &yymsp[0].minor.yy479); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; - case 340: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy504 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 360: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy452 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452), &yymsp[0].minor.yy479); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 342: /* alias_opt ::= */ -{ yymsp[1].minor.yy409 = nil_token; } + case 362: /* alias_opt ::= */ +{ yymsp[1].minor.yy479 = nil_token; } break; - case 343: /* alias_opt ::= table_alias */ -{ yylhsminor.yy409 = yymsp[0].minor.yy409; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 363: /* alias_opt ::= table_alias */ +{ yylhsminor.yy479 = yymsp[0].minor.yy479; } + yymsp[0].minor.yy479 = yylhsminor.yy479; break; - case 344: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy409 = yymsp[0].minor.yy409; } + case 364: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy479 = yymsp[0].minor.yy479; } break; - case 345: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 346: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==346); -{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } + case 365: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 366: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==366); +{ yymsp[-2].minor.yy452 = yymsp[-1].minor.yy452; } break; - case 347: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, yymsp[-4].minor.yy556, yymsp[-5].minor.yy504, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + case 367: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy452 = createJoinTableNode(pCxt, yymsp[-4].minor.yy162, yymsp[-5].minor.yy452, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } + yymsp[-5].minor.yy452 = yylhsminor.yy452; break; - case 348: /* join_type ::= */ -{ yymsp[1].minor.yy556 = JOIN_TYPE_INNER; } + case 368: /* join_type ::= */ +{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } break; - case 349: /* join_type ::= INNER */ -{ yymsp[0].minor.yy556 = JOIN_TYPE_INNER; } + case 369: /* join_type ::= INNER */ +{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } break; - case 350: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 370: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy504 = createSelectStmt(pCxt, yymsp[-7].minor.yy121, yymsp[-6].minor.yy488, yymsp[-5].minor.yy504); - yymsp[-8].minor.yy504 = addWhereClause(pCxt, yymsp[-8].minor.yy504, yymsp[-4].minor.yy504); - yymsp[-8].minor.yy504 = addPartitionByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-3].minor.yy488); - yymsp[-8].minor.yy504 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy504, yymsp[-2].minor.yy504); - yymsp[-8].minor.yy504 = addGroupByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-1].minor.yy488); - yymsp[-8].minor.yy504 = addHavingClause(pCxt, yymsp[-8].minor.yy504, yymsp[0].minor.yy504); + yymsp[-8].minor.yy452 = createSelectStmt(pCxt, yymsp[-7].minor.yy659, yymsp[-6].minor.yy478, yymsp[-5].minor.yy452); + yymsp[-8].minor.yy452 = addWhereClause(pCxt, yymsp[-8].minor.yy452, yymsp[-4].minor.yy452); + yymsp[-8].minor.yy452 = addPartitionByClause(pCxt, yymsp[-8].minor.yy452, yymsp[-3].minor.yy478); + yymsp[-8].minor.yy452 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy452, yymsp[-2].minor.yy452); + yymsp[-8].minor.yy452 = addGroupByClause(pCxt, yymsp[-8].minor.yy452, yymsp[-1].minor.yy478); + yymsp[-8].minor.yy452 = addHavingClause(pCxt, yymsp[-8].minor.yy452, yymsp[0].minor.yy452); } break; - case 353: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy121 = false; } + case 373: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy659 = false; } break; - case 354: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy488 = NULL; } + case 374: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy478 = NULL; } break; - case 359: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 379: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy452 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452), &yymsp[0].minor.yy479); } + yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 360: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 380: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy452 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), &yymsp[0].minor.yy479); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 361: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy504 = createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 385: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 402: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==402); + case 412: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==412); +{ yymsp[-2].minor.yy478 = yymsp[0].minor.yy478; } break; - case 365: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 382: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==382); - case 392: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==392); -{ yymsp[-2].minor.yy488 = yymsp[0].minor.yy488; } + case 387: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy452 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } break; - case 367: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy504 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 388: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy452 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } break; - case 368: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy504 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 389: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy452 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), NULL, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } break; - case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 390: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy452 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy452), releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } break; - case 370: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 392: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy452 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy452); } break; - case 372: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy504 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy504); } + case 394: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy452 = createFillNode(pCxt, yymsp[-1].minor.yy540, NULL); } break; - case 374: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy504 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); } + case 395: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy452 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy478)); } break; - case 375: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy504 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } + case 396: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy540 = FILL_MODE_NONE; } break; - case 376: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy22 = FILL_MODE_NONE; } + case 397: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy540 = FILL_MODE_PREV; } break; - case 377: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy22 = FILL_MODE_PREV; } + case 398: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy540 = FILL_MODE_NULL; } break; - case 378: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy22 = FILL_MODE_NULL; } + case 399: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy540 = FILL_MODE_LINEAR; } break; - case 379: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; } + case 400: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy540 = FILL_MODE_NEXT; } break; - case 380: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; } + case 403: /* group_by_list ::= expression */ +{ yylhsminor.yy478 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } + yymsp[0].minor.yy478 = yylhsminor.yy478; break; - case 383: /* group_by_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 404: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy478 = addNodeToList(pCxt, yymsp[-2].minor.yy478, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } + yymsp[-2].minor.yy478 = yylhsminor.yy478; break; - case 384: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 387: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 407: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy504 = addOrderByClause(pCxt, yymsp[-3].minor.yy504, yymsp[-2].minor.yy488); - yylhsminor.yy504 = addSlimitClause(pCxt, yylhsminor.yy504, yymsp[-1].minor.yy504); - yylhsminor.yy504 = addLimitClause(pCxt, yylhsminor.yy504, yymsp[0].minor.yy504); + yylhsminor.yy452 = addOrderByClause(pCxt, yymsp[-3].minor.yy452, yymsp[-2].minor.yy478); + yylhsminor.yy452 = addSlimitClause(pCxt, yylhsminor.yy452, yymsp[-1].minor.yy452); + yylhsminor.yy452 = addLimitClause(pCxt, yylhsminor.yy452, yymsp[0].minor.yy452); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; - case 389: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy504 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 409: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy452 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy452, yymsp[0].minor.yy452); } + yymsp[-3].minor.yy452 = yylhsminor.yy452; break; - case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==398); -{ yymsp[-1].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 414: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 418: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==418); +{ yymsp[-1].minor.yy452 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==399); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 415: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 419: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==419); +{ yymsp[-3].minor.yy452 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 396: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 400: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==400); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 416: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 420: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==420); +{ yymsp[-3].minor.yy452 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 401: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy504); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 421: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy452); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 405: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy504 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[-1].minor.yy522, yymsp[0].minor.yy281); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 425: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy452 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), yymsp[-1].minor.yy326, yymsp[0].minor.yy595); } + yymsp[-2].minor.yy452 = yylhsminor.yy452; break; - case 406: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy522 = ORDER_ASC; } + case 426: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy326 = ORDER_ASC; } break; - case 407: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy522 = ORDER_ASC; } + case 427: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy326 = ORDER_ASC; } break; - case 408: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy522 = ORDER_DESC; } + case 428: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy326 = ORDER_DESC; } break; - case 409: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy281 = NULL_ORDER_DEFAULT; } + case 429: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy595 = NULL_ORDER_DEFAULT; } break; - case 410: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_FIRST; } + case 430: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy595 = NULL_ORDER_FIRST; } break; - case 411: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_LAST; } + case 431: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy595 = NULL_ORDER_LAST; } break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyruleno +#include "parserTestUtil.h" #include "parInt.h" using namespace std; @@ -44,7 +45,7 @@ protected: query_ = nullptr; bool res = runImpl(parseCode, translateCode); qDestroyQuery(query_); - if (1/*!res*/) { + if (!res || g_isDump) { dump(); } return res; @@ -57,7 +58,7 @@ private: int32_t code = parse(&cxt_, &query_); if (code != TSDB_CODE_SUCCESS) { parseErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == parseCode); + return (code == parseCode); } if (TSDB_CODE_SUCCESS != parseCode) { return false; @@ -66,7 +67,7 @@ private: code = translate(&cxt_, query_); if (code != TSDB_CODE_SUCCESS) { translateErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == translateCode); + return (code == translateCode); } translatedAstStr_ = toString(query_->pRoot); code = calculateConstant(&cxt_, query_); @@ -243,6 +244,19 @@ TEST_F(ParserTest, selectPseudoColumn) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, selectMultiResFunc) { + setDatabase("root", "test"); + + // bind("SELECT last(*), first(*), last_row(*) FROM t1"); + // ASSERT_TRUE(run()); + + bind("SELECT last(c1, c2), first(t1.*), last_row(c3) FROM t1"); + ASSERT_TRUE(run()); + + bind("SELECT last(t2.*), first(t1.c1, t2.*), last_row(t1.*, t2.*) FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, selectClause) { setDatabase("root", "test"); @@ -726,6 +740,22 @@ TEST_F(ParserTest, dropTopic) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, createStream) { + setDatabase("root", "test"); + + bind("create stream s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream s1 into st1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 trigger window_close watermark 10s into st1 as select * from t1"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, explain) { setDatabase("root", "test"); diff --git a/source/libs/parser/test/parserTestMain.cpp b/source/libs/parser/test/parserTestMain.cpp index 9a9711ca96..8cd69418b9 100644 --- a/source/libs/parser/test/parserTestMain.cpp +++ b/source/libs/parser/test/parserTestMain.cpp @@ -15,12 +15,16 @@ #include +#include #include #include "mockCatalog.h" +#include "parserTestUtil.h" #include "parToken.h" #include "functionMgt.h" +bool g_isDump = false; + class ParserEnv : public testing::Environment { public: virtual void SetUp() { @@ -38,8 +42,27 @@ public: virtual ~ParserEnv() {} }; +static void parseArg(int argc, char* argv[]) { + int opt = 0; + const char *optstring = ""; + static struct option long_options[] = { + {"dump", no_argument, NULL, 'd'}, + {0, 0, 0, 0} + }; + while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { + switch (opt) { + case 'd': + g_isDump = true; + break; + default: + break; + } + } +} + int main(int argc, char* argv[]) { testing::AddGlobalTestEnvironment(new ParserEnv()); testing::InitGoogleTest(&argc, argv); + parseArg(argc, argv); return RUN_ALL_TESTS(); } diff --git a/source/libs/parser/test/parserTestUtil.h b/source/libs/parser/test/parserTestUtil.h new file mode 100644 index 0000000000..f5efed50a8 --- /dev/null +++ b/source/libs/parser/test/parserTestUtil.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +extern bool g_isDump; \ No newline at end of file diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 48aa89eae6..14fa36a958 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -196,14 +196,14 @@ TEST_F(PlannerTest, selectGroupBy) { bind("SELECT count(*) FROM t1"); ASSERT_TRUE(run()); - // bind("SELECT c1, max(c3), min(c2), count(*) FROM t1 GROUP BY c1"); - // ASSERT_TRUE(run()); + bind("SELECT c1, max(c3), min(c3), count(*) FROM t1 GROUP BY c1"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); + ASSERT_TRUE(run()); } TEST_F(PlannerTest, selectSubquery) { diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 93bc16a7a2..4e59e1bea6 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -14,12 +14,12 @@ */ #include "catalog.h" +#include "command.h" #include "query.h" #include "schedulerInt.h" #include "tmsg.h" #include "tref.h" #include "trpc.h" -#include "command.h" SSchedulerMgmt schMgmt = {0}; @@ -68,8 +68,8 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel * } int32_t schInitJob(SSchJob **pSchJob, SQueryPlan *pDag, void *transport, SArray *pNodeList, const char *sql, - int64_t startTs, bool syncSchedule) { - int32_t code = 0; + int64_t startTs, bool syncSchedule) { + int32_t code = 0; SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); if (NULL == pJob) { qError("QID:%" PRIx64 " calloc %d failed", pDag->queryId, (int32_t)sizeof(SSchJob)); @@ -141,7 +141,6 @@ _return: SCH_RET(code); } - void schFreeRpcCtx(SRpcCtx *pCtx) { if (NULL == pCtx) { return; @@ -1047,12 +1046,12 @@ _return: int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRsp *pRsp) { SCH_TASK_DLOG("got explain rsp, rows:%d, complete:%d", htonl(pRsp->numOfRows), pRsp->completed); - + atomic_store_32(&pJob->resNumOfRows, htonl(pRsp->numOfRows)); atomic_store_ptr(&pJob->resData, pRsp); SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCCEED); - + schProcessOnDataFetched(pJob); return TSDB_CODE_SUCCESS; @@ -1146,7 +1145,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch if (NULL == msg) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } - + if (!SCH_IS_EXPLAIN_JOB(pJob)) { SCH_TASK_ELOG("invalid msg received for none explain query, msg type:%s", TMSG_INFO(msgType)); SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); @@ -1180,13 +1179,13 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch } if (SCH_IS_EXPLAIN_JOB(pJob)) { - if (rsp->completed) { + if (rsp->completed) { SRetrieveTableRsp *pRsp = NULL; SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); } - + return TSDB_CODE_SUCCESS; } @@ -1238,23 +1237,24 @@ _return: } int32_t schGetTaskFromTaskList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { - int32_t s = taosHashGetSize(pTaskList); - if (s <= 0) { - return TSDB_CODE_SUCCESS; - } - - SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); - if (NULL == task || NULL == (*task)) { - return TSDB_CODE_SUCCESS; - } + int32_t s = taosHashGetSize(pTaskList); + if (s <= 0) { + return TSDB_CODE_SUCCESS; + } - *pTask = *task; + SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); + if (NULL == task || NULL == (*task)) { + return TSDB_CODE_SUCCESS; + } - return TSDB_CODE_SUCCESS; + *pTask = *task; + + return TSDB_CODE_SUCCESS; } int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCode) { - if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || taosArrayGetSize(pTask->execNodes) <= 0) { + if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || + taosArrayGetSize(pTask->execNodes) <= 0) { return TSDB_CODE_SUCCESS; } @@ -1264,7 +1264,6 @@ int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCo return TSDB_CODE_SUCCESS; } - int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { int32_t code = 0; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; @@ -1282,13 +1281,15 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in if (TDMT_VND_EXPLAIN_RSP == msgType) { schGetTaskFromTaskList(pJob->succTasks, pParam->taskId, &pTask); } else { - SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } } - + if (NULL == pTask) { - SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } @@ -1444,7 +1445,7 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { } int32_t schGenerateTaskCallBackAHandle(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SMsgSendInfo **pMsgSendInfo) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == msgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1565,7 +1566,7 @@ _return: } int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *pReadyMsgSendInfo = NULL; SMsgSendInfo *pExplainMsgSendInfo = NULL; @@ -1578,7 +1579,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_RES_READY, &pReadyMsgSendInfo)); SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_EXPLAIN, &pExplainMsgSendInfo)); - int32_t msgType = TDMT_VND_RES_READY_RSP; + int32_t msgType = TDMT_VND_RES_READY_RSP; SRpcCtxVal ctxVal = {.val = pReadyMsgSendInfo, .clone = schCloneSMsgSendInfo, .freeFunc = schFreeRpcCtxVal}; if (taosHashPut(pCtx->args, &msgType, sizeof(msgType), &ctxVal, sizeof(ctxVal))) { SCH_TASK_ELOG("taosHashPut msg %d to rpcCtx failed", msgType); @@ -1599,7 +1600,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { _return: taosHashCleanup(pCtx->args); - + if (pReadyMsgSendInfo) { taosMemoryFreeClear(pReadyMsgSendInfo->param); taosMemoryFreeClear(pReadyMsgSendInfo); @@ -1818,7 +1819,7 @@ _return: taosMemoryFreeClear(pMsgSendInfo->param); taosMemoryFreeClear(pMsgSendInfo); } - + SCH_RET(code); } @@ -2319,7 +2320,7 @@ _return: } int32_t schExecStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, - bool syncSchedule) { + bool syncSchedule) { qDebug("QID:0x%" PRIx64 " job started", pDag->queryId); int32_t code = 0; @@ -2608,7 +2609,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { SCH_ERR_JRET(schFetchFromRemote(pJob)); tsem_wait(&pJob->rspSem); - } + } } else { SCH_JOB_ELOG("job status error for fetch, status:%s", jobTaskStatusStr(status)); SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR); @@ -2670,11 +2671,11 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { for (int32_t i = pJob->levelNum - 1; i >= 0; --i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); - + for (int32_t m = 0; m < pLevel->taskNum; ++m) { - SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); SQuerySubDesc subDesc = {.tid = pTask->taskId, .status = pTask->status}; - + taosArrayPush(pSub, &subDesc); } } @@ -2682,7 +2683,6 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { return TSDB_CODE_SUCCESS; } - int32_t scheduleCancelJob(int64_t job) { SSchJob *pJob = schAcquireJob(job); if (NULL == pJob) { @@ -2734,15 +2734,17 @@ void schedulerFreeTaskList(SArray *taskList) { void schedulerDestroy(void) { if (schMgmt.jobRef) { SSchJob *pJob = taosIterateRef(schMgmt.jobRef, 0); - + int64_t refId = 0; + while (pJob) { + refId = pJob->refId; + taosRemoveRef(schMgmt.jobRef, pJob->refId); - pJob = taosIterateRef(schMgmt.jobRef, pJob->refId); + pJob = taosIterateRef(schMgmt.jobRef, refId); } taosCloseRef(schMgmt.jobRef); schMgmt.jobRef = 0; } } - diff --git a/tests/script/runAllSimCases.sh b/tests/script/runAllSimCases.sh index e1eea1cc38..70f2f86115 100755 --- a/tests/script/runAllSimCases.sh +++ b/tests/script/runAllSimCases.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash ################################################## # @@ -8,13 +8,73 @@ set -e #set -x +VALGRIND=0 +LOG_BK_DIR=/data/valgrind_log_backup # 192.168.0.203 +while getopts "v:r" arg +do + case $arg in + v) + VALGRIND=1 + ;; + r) + LOG_BK_DIR=$(echo $OPTARG) + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +echo "VALGRIND: $VALGRIND, LOG_BK_DIR: $LOG_BK_DIR" + +CURRENT_DIR=`pwd` +TSIM_LOG_DIR=$CURRENT_DIR/../../sim/tsim/log +TAOSD_LOG_DIR=$CURRENT_DIR/../../sim + +echo "tsim log dir: $TSIM_LOG_DIR" +echo "taosd log dir: $TAOSD_LOG_DIR" + +if [[ $VALGRIND -eq 1 ]]; then + if [ -d ${LOG_BK_DIR} ]; then + rm -rf ${LOG_BK_DIR}/* + else + mkdir -p $LOG_BK_DIR/ + fi +fi while read line do firstChar=`echo ${line:0:1}` if [[ -n "$line" ]] && [[ $firstChar != "#" ]]; then - echo "======== $line ========" - $line + if [[ $VALGRIND -eq 1 ]]; then + echo "======== $line -v ========" + $line -v + + # move all valgrind log files of the sim case to valgrind back dir + # get current sim case name for + result=`echo ${line%sim*}` + result=`echo ${result#*/}` + result=`echo ${result#*/}` + result=`echo ${result////-}` + tsimLogFile=valgrind-${result}sim.log + + echo "cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} " + cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} + cp ${TAOSD_LOG_DIR}/dnode1/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode2/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode3/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode4/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode5/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode6/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode7/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode8/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode9/log/valgrind*.log ${LOG_BK_DIR}/ ||: + + else + echo "======== $line ========" + $line + fi fi done < ./jenkins/basic.txt diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index 50ded73555..606f778920 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -97,13 +97,14 @@ if [ "$CLEAR_OPTION" = "clear" ]; then fi if [ "$EXEC_OPTON" = "start" ]; then - echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR - + #echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR if [ "$VALGRIND_OPTION" = "true" ]; then TT=`date +%s` - mkdir ${LOG_DIR}/${TT} - nohup valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & + #mkdir ${LOG_DIR}/${TT} + echo "nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" + nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & else + echo "nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & fi diff --git a/tests/script/test.sh b/tests/script/test.sh index f5a9e4187b..27fa4933e0 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -126,7 +126,7 @@ if [ -n "$FILE_NAME" ]; then echo "------------------------------------------------------------------------" if [ $VALGRIND -eq 1 ]; then echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v - valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v + valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${LOG_DIR}/valgrind-tsim.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else if [[ $MULTIPROCESS -eq 1 ]];then echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 1ae8b372dc..94bd0f1ecf 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -537,4 +537,4 @@ endi #endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim index 70a9719b40..74bc444da2 100644 --- a/tests/script/tsim/query/stddev.sim +++ b/tests/script/tsim/query/stddev.sim @@ -1,17 +1,16 @@ 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 $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 + $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 @@ -23,108 +22,410 @@ endi sql connect -$dbPrefix = db -$tbPrefix = ctb -$mtPrefix = stb -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select stddev(tbcol) from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step3 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print ===> select stddev(tbcol) from $tb where ts <= $ms -sql select stddev(tbcol) from $tb where ts <= $ms -print ====> $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1.414213562 then - return -1 -endi - -print =============== step4 -sql select stddev(tbcol) as b from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step5 -sql select _wstartts, stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - print expect 0.000000000, actual: $data01 - return -1 -endi - -sql select _wstartts, stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then - return -1 -endi - -print =============== step6 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -sql select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi - -print $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 - -if $rows != 5 then - print expect 5, actual: $rows - return -1 -endi - -print =============== clear -sql drop database $db +print =============== create database +sql create database db sql show databases +if $rows != 3 then + return -1 +endi + +sql use db + +print =============== create super table and child table +sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int) +sql show stables +print $rows $data00 $data01 $data02 if $rows != 1 then return -1 endi +sql create table ct1 using stb1 tags ( 1 ) +sql create table ct2 using stb1 tags ( 2 ) +sql create table ct3 using stb1 tags ( 3 ) +sql create table ct4 using stb1 tags ( 4 ) +sql show tables +print $rows $data00 $data10 $data20 +if $rows != 4 then + return -1 +endi + +sql create table t1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + +print =============== insert data into child table ct1 (s) +sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a ) +sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a ) + +print =============== insert data into child table ct4 (y) +sql insert into ct4 values ( '2019-01-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2019-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct4 values ( '2019-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct4 values ( '2020-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct4 values ( '2020-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct4 values ( '2020-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct4 values ( '2020-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2021-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct4 values ( '2021-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into ct4 values ( '2021-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into ct4 values ( '2022-02-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) +sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) + +print =============== insert data into child table t1 +sql insert into t1 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into t1 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into t1 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into t1 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into t1 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into t1 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into t1 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into t1 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into t1 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) + +print ================ start query ====================== + +print =============== step1 +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +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 ===> $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 ===> $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 ===> $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 ===> $rows +# if $rows != 3 then +# return -1 +# endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 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_0: + $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_0 +endi + +print =============== step2 after wal +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +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 ===> $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 ===> $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 ===> $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 ===> $rows +if $rows != 3 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =============== clear +sql drop database db +sql show databases +if $rows != 2 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file