From 0e535f77f75a38fe924a6695117ebba42dd21cda Mon Sep 17 00:00:00 2001 From: cpwu Date: Tue, 28 Jun 2022 09:43:17 +0800 Subject: [PATCH 01/68] fix constant --- tests/pytest/util/constant.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/pytest/util/constant.py b/tests/pytest/util/constant.py index 807398f70f..5be1c603b3 100644 --- a/tests/pytest/util/constant.py +++ b/tests/pytest/util/constant.py @@ -84,16 +84,16 @@ SMALLINT_MIN = -32768 SMALLINT_UN_MAX = 65535 SMALLINT_UN_MIN = 0 -INT_MAX = 2147483647 -INT_MIN = -2147483648 +INT_MAX = 2_147_483_647 +INT_MIN = -2_147_483_648 -INT_UN_MAX = 4294967295 +INT_UN_MAX = 4_294_967_295 INT_UN_MIN = 0 -BIGINT_MAX = 9223372036854775807 -BIGINT_MIN = -9223372036854775808 +BIGINT_MAX = 9_223_372_036_854_775_807 +BIGINT_MIN = -9_223_372_036_854_775_808 -BIGINT_UN_MAX = 18446744073709551615 +BIGINT_UN_MAX = 18_446_744_073_709_551_615 BIGINT_UN_MIN = 0 FLOAT_MAX = 3.40E+38 @@ -131,13 +131,13 @@ COL_COUNT_MIN = 2 TAG_COL_COUNT_MAX = 4096 TAG_COL_COUNT_MIN = 3 -MNODE_SHM_SIZE_MAX = 2147483647 -MNODE_SHM_SIZE_MIN = 6292480 -MNODE_SHM_SIZE_DEFAULT = 6292480 +MNODE_SHM_SIZE_MAX = 2_147_483_647 +MNODE_SHM_SIZE_MIN = 6_292_480 +MNODE_SHM_SIZE_DEFAULT = 6_292_480 -VNODE_SHM_SIZE_MAX = 2147483647 -VNODE_SHM_SIZE_MIN = 6292480 -VNODE_SHM_SIZE_DEFAULT = 31458304 +VNODE_SHM_SIZE_MAX = 2_147_483_647 +VNODE_SHM_SIZE_MIN = 6_292_480 +VNODE_SHM_SIZE_DEFAULT = 31_458_304 # time_init TIME_MS = 1 @@ -160,6 +160,7 @@ INTERVAL_MIN = 1 * TIME_MS if PRECISION == PRECISION_DEFAULT else 1 * TIME_US # streams and related agg-function SMA_INDEX_FUNCTIONS = ["MIN", "MAX"] ROLLUP_FUNCTIONS = ["AVG", "SUM", "MIN", "MAX", "LAST", "FIRST"] +BLOCK_FUNCTIONS = ["SUM", "MIN", "MAX"] SMA_WATMARK_MAXDELAY_INIT = ['a', "s", "m"] WATERMARK_MAX = 900000 WATERMARK_MIN = 0 From 4a55ed07b3a82bc6893f358dbd26b911a9908877 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 28 Jun 2022 10:34:51 +0800 Subject: [PATCH 02/68] feature: query redirect --- include/common/tmsgdef.h | 16 ++++++----- source/client/src/clientEnv.c | 2 +- source/client/src/clientImpl.c | 2 +- source/dnode/mgmt/mgmt_mnode/src/mmHandle.c | 10 +++---- source/dnode/mgmt/mgmt_qnode/src/qmHandle.c | 12 ++++---- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 12 ++++---- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/mnode/impl/src/mndMain.c | 6 ++-- source/dnode/mnode/impl/src/mndQuery.c | 24 ++++++++-------- source/dnode/qnode/src/qnode.c | 14 +++++----- source/dnode/vnode/src/vnd/vnodeSvr.c | 14 +++++----- source/libs/executor/src/executorimpl.c | 2 +- source/libs/function/src/udfd.c | 2 +- source/libs/parser/src/parTranslater.c | 2 +- source/libs/planner/src/planPhysiCreater.c | 2 +- source/libs/qcom/src/queryUtil.c | 2 +- source/libs/qworker/src/qwMsg.c | 6 ++-- source/libs/qworker/test/qworkerTests.cpp | 16 +++++------ source/libs/scheduler/src/schJob.c | 6 ++-- source/libs/scheduler/src/schRemote.c | 28 +++++++++---------- source/libs/scheduler/test/schedulerTests.cpp | 10 +++---- 21 files changed, 96 insertions(+), 94 deletions(-) diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index acf08bd47e..cbf0c4b2fe 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -167,10 +167,6 @@ enum { TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY, "query", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY_CONTINUE, "query-continue", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_FETCH, "fetch", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TABLE, "create-table", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TABLE, "alter-table", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TABLE, "drop-table", NULL, NULL) @@ -184,12 +180,9 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_CHANGE, "vnode-mq-vg-change", SMqRebVgReq, SMqRebVgRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_DELETE, "vnode-mq-vg-delete", SMqVDeleteReq, SMqVDeleteRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_COMMIT_OFFSET, "vnode-commit-offset", STqOffset, STqOffset) - TD_DEF_MSG_TYPE(TDMT_VND_CANCEL_TASK, "vnode-cancel-task", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_DROP_TASK, "vnode-drop-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TOPIC, "vnode-create-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TOPIC, "vnode-alter-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TOPIC, "vnode-drop-topic", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_EXPLAIN, "vnode-explain", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_SUBSCRIBE, "vnode-subscribe", SMVSubscribeReq, SMVSubscribeRsp) TD_DEF_MSG_TYPE(TDMT_VND_CONSUME, "vnode-consume", SMqPollReq, SMqDataBlkRsp) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL) @@ -206,6 +199,15 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_COMPACT, "compact", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TTL_TABLE, "drop-ttl-stb", NULL, NULL) + TD_NEW_MSG_SEG(TDMT_SCH_MSG) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY, "query", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_CONTINUE, "query-continue", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_FETCH, "fetch", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "vnode-cancel-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "vnode-drop-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "vnode-explain", NULL, NULL) + TD_NEW_MSG_SEG(TDMT_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DEPLOY, "stream-task-deploy", SStreamTaskDeployReq, SStreamTaskDeployRsp) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DROP, "stream-task-drop", NULL, NULL) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 22b491994e..a36c7a0048 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -91,7 +91,7 @@ void closeTransporter(SAppInstInfo *pAppInfo) { static bool clientRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 8c63046323..632b8441c4 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -808,7 +808,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { code = handleSubmitExecRes(pRequest, pRes->res, pCatalog, &epset); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: { code = handleQueryExecRes(pRequest, pRes->res, pCatalog, &epset); break; } diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 3bf6d9b04f..fbf3379490 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -209,10 +209,10 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_SHOW_VARIABLES, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_SERVER_VERSION, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -220,7 +220,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_CHANGE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_DELETE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 864f5b485a..1a7b5c1a1b 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -107,14 +107,14 @@ SArray *qmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MON_QM_INFO, qmPutNodeMsgToMonitorQueue, 0) == NULL) goto _OVER; // Requests handled by VNODE - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; code = 0; _OVER: diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 00d83f0ad4..938e5f32b0 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -324,16 +324,16 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MON_VM_LOAD, vmPutMsgToMonitorQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_UPDATE_TAG_VAL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_CFG, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -349,7 +349,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_COMMIT_OFFSET, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CONSUME, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 7e31cc3144..c1b5b86d4c 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,7 +251,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 136afb714e..0a9c5a82c8 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -527,9 +527,9 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; - if (pMsg->msgType == TDMT_VND_QUERY || pMsg->msgType == TDMT_VND_QUERY_CONTINUE || - pMsg->msgType == TDMT_VND_QUERY_HEARTBEAT || pMsg->msgType == TDMT_VND_FETCH || - pMsg->msgType == TDMT_VND_DROP_TASK) { + if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || + pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || pMsg->msgType == TDMT_SCH_FETCH || + pMsg->msgType == TDMT_SCH_DROP_TASK) { return 0; } if (mndAcquireRpcRef(pMsg->info.node) == 0) return 0; diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index 671152f9c6..b67a11997e 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -19,13 +19,13 @@ #include "qworker.h" int32_t mndPreProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) return 0; + if (TDMT_SCH_QUERY != pMsg->msgType) return 0; SMnode *pMnode = pMsg->info.node; return qWorkerPreprocessQueryMsg(pMnode->pQuery, pMsg); } void mndPostProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) return; + if (TDMT_SCH_QUERY != pMsg->msgType) return; SMnode *pMnode = pMsg->info.node; qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg); } @@ -37,19 +37,19 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { mTrace("msg:%p, in query queue is processing", pMsg); switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: code = qWorkerProcessQueryMsg(&handle, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: code = qWorkerProcessCQueryMsg(&handle, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: code = qWorkerProcessFetchMsg(pMnode, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: code = qWorkerProcessDropMsg(pMnode, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pMnode, pMnode->pQuery, pMsg, 0); break; default: @@ -67,11 +67,11 @@ int32_t mndInitQuery(SMnode *pMnode) { return -1; } - mndSetMsgHandle(pMnode, TDMT_VND_QUERY, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_QUERY_CONTINUE, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_FETCH, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_DROP_TASK, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_QUERY_HEARTBEAT, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_CONTINUE, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_FETCH, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_HEARTBEAT, mndProcessQueryMsg); return 0; } diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index ebaf73a952..a0aa640ed6 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -65,7 +65,7 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { } int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg * pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType) { return 0; } @@ -78,28 +78,28 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { qTrace("message in qnode queue is processing"); switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: code = qWorkerProcessQueryMsg(&handle, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: code = qWorkerProcessCQueryMsg(&handle, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: code = qWorkerProcessFetchMsg(pQnode, pQnode->pQuery, pMsg, ts); break; case TDMT_VND_FETCH_RSP: code = qWorkerProcessFetchRsp(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: code = qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: code = qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg, ts); break; case TDMT_VND_CONSUME: // code = tqProcessConsumeReq(pQnode->pTq, pMsg); // break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg, ts); break; default: diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 72c766e0ae..63b7289661 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -216,7 +216,7 @@ _err: } int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType) { return 0; } @@ -227,9 +227,9 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { vTrace("message in vnode query queue is processing"); SReadHandle handle = {.meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode, .pMsgCb = &pVnode->msgCb}; switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: return qWorkerProcessQueryMsg(&handle, pVnode->pQuery, pMsg, 0); - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: return qWorkerProcessCQueryMsg(&handle, pVnode->pQuery, pMsg, 0); default: vError("unknown msg type:%d in query queue", pMsg->msgType); @@ -243,15 +243,15 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { int32_t msgLen = pMsg->contLen - sizeof(SMsgHead); switch (pMsg->msgType) { - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: return qWorkerProcessFetchMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_FETCH_RSP: return qWorkerProcessFetchRsp(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_TABLE_META: return vnodeGetTableMeta(pVnode, pMsg); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 17e5482b60..a4a46c6e63 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2035,7 +2035,7 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf pMsgSendInfo->param = pWrapper; pMsgSendInfo->msgInfo.pData = pMsg; pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq); - pMsgSendInfo->msgType = TDMT_VND_FETCH; + pMsgSendInfo->msgType = TDMT_SCH_FETCH; pMsgSendInfo->fp = loadRemoteDataCallback; int64_t transporterId = 0; diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 364ee0692f..c6c1f00395 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -549,7 +549,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 45240536e3..dc149f0224 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5965,7 +5965,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_EXPLAIN_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; pQuery->haveResultSet = true; - pQuery->msgType = TDMT_VND_QUERY; + pQuery->msgType = TDMT_SCH_QUERY; break; case QUERY_NODE_DELETE_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 46747af3a9..77df96f82d 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1555,7 +1555,7 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic if (SUBPLAN_TYPE_MODIFY == pLogicSubplan->subplanType) { code = buildVnodeModifySubplan(pCxt, pLogicSubplan, pSubplan); } else { - pSubplan->msgType = TDMT_VND_QUERY; + pSubplan->msgType = TDMT_SCH_QUERY; code = createPhysiNode(pCxt, pLogicSubplan->pNode, pSubplan, &pSubplan->pNode); if (TSDB_CODE_SUCCESS == code && !pCxt->pPlanCxt->streamQuery && !pCxt->pPlanCxt->topicQuery) { code = createDataDispatcher(pCxt, pSubplan->pNode, &pSubplan->pDataSink); diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 9ba149a33b..40c5807057 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -216,7 +216,7 @@ void destroyQueryExecRes(SQueryExecRes* pRes) { tFreeSSubmitRsp((SSubmitRsp*)pRes->res); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: { taosArrayDestroy((SArray*)pRes->res); break; } diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 82a62b5c5a..8c1371fce9 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -169,7 +169,7 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { req->taskId = tId; SRpcMsg pNewMsg = { - .msgType = TDMT_VND_QUERY_CONTINUE, + .msgType = TDMT_SCH_QUERY_CONTINUE, .pCont = req, .contLen = sizeof(SQueryContinueReq), .code = 0, @@ -202,7 +202,7 @@ int32_t qwRegisterQueryBrokenLinkArg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { req->refId = htobe64(rId); SRpcMsg brokenMsg = { - .msgType = TDMT_VND_DROP_TASK, + .msgType = TDMT_SCH_DROP_TASK, .pCont = req, .contLen = sizeof(STaskDropReq), .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, @@ -236,7 +236,7 @@ int32_t qwRegisterHbBrokenLinkArg(SQWorker *mgmt, uint64_t sId, SRpcHandleInfo * } SRpcMsg brokenMsg = { - .msgType = TDMT_VND_QUERY_HEARTBEAT, + .msgType = TDMT_SCH_QUERY_HEARTBEAT, .pCont = msg, .contLen = msgSize, .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 5bb6acee60..7c7d262167 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -122,7 +122,7 @@ void qwtBuildQueryReqMsg(SRpcMsg *queryRpc) { qwtqueryMsg.taskId = htobe64(1); qwtqueryMsg.phyLen = htonl(100); qwtqueryMsg.sqlLen = 0; - queryRpc->msgType = TDMT_VND_QUERY; + queryRpc->msgType = TDMT_SCH_QUERY; queryRpc->pCont = &qwtqueryMsg; queryRpc->contLen = sizeof(SSubQueryMsg) + 100; } @@ -131,7 +131,7 @@ void qwtBuildFetchReqMsg(SResFetchReq *fetchMsg, SRpcMsg *fetchRpc) { fetchMsg->sId = htobe64(1); fetchMsg->queryId = htobe64(atomic_load_64(&qwtTestQueryId)); fetchMsg->taskId = htobe64(1); - fetchRpc->msgType = TDMT_VND_FETCH; + fetchRpc->msgType = TDMT_SCH_FETCH; fetchRpc->pCont = fetchMsg; fetchRpc->contLen = sizeof(SResFetchReq); } @@ -140,7 +140,7 @@ void qwtBuildDropReqMsg(STaskDropReq *dropMsg, SRpcMsg *dropRpc) { dropMsg->sId = htobe64(1); dropMsg->queryId = htobe64(atomic_load_64(&qwtTestQueryId)); dropMsg->taskId = htobe64(1); - dropRpc->msgType = TDMT_VND_DROP_TASK; + dropRpc->msgType = TDMT_SCH_DROP_TASK; dropRpc->pCont = dropMsg; dropRpc->contLen = sizeof(STaskDropReq); } @@ -756,9 +756,9 @@ void *queryQueueThread(void *param) { } } - if (TDMT_VND_QUERY == queryRpc->msgType) { + if (TDMT_SCH_QUERY == queryRpc->msgType) { qWorkerProcessQueryMsg(mockPointer, mgmt, queryRpc, 0); - } else if (TDMT_VND_QUERY_CONTINUE == queryRpc->msgType) { + } else if (TDMT_SCH_QUERY_CONTINUE == queryRpc->msgType) { qWorkerProcessCQueryMsg(mockPointer, mgmt, queryRpc, 0); } else { printf("unknown msg in query queue, type:%d\n", queryRpc->msgType); @@ -813,13 +813,13 @@ void *fetchQueueThread(void *param) { } switch (fetchRpc->msgType) { - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: qWorkerProcessFetchMsg(mockPointer, mgmt, fetchRpc, 0); break; - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: qWorkerProcessCancelMsg(mockPointer, mgmt, fetchRpc, 0); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); break; default: diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 89f355d78c..54d0d2f2e5 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1183,7 +1183,7 @@ int32_t schFetchFromRemote(SSchJob *pJob) { return TSDB_CODE_SUCCESS; } - SCH_ERR_JRET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, TDMT_VND_FETCH)); + SCH_ERR_JRET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, TDMT_SCH_FETCH)); return TSDB_CODE_SUCCESS; @@ -1222,7 +1222,7 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_VND_DROP_TASK); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK); nodeInfo = taosHashIterate(pTask->execNodes, nodeInfo); } @@ -1307,7 +1307,7 @@ int32_t schSaveJobQueryRes(SSchJob *pJob, SQueryTableRsp *rsp) { tbInfo.tversion = rsp->tversion; taosArrayPush((SArray *)pJob->execRes.res, &tbInfo); - pJob->execRes.msgType = TDMT_VND_QUERY; + pJob->execRes.msgType = TDMT_SCH_QUERY; } return TSDB_CODE_SUCCESS; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 0bd747785c..a1691a3dd3 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -568,22 +568,22 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { case TDMT_VND_SUBMIT: *fp = schHandleSubmitCallback; break; - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: *fp = schHandleQueryCallback; break; case TDMT_VND_DELETE: *fp = schHandleDeleteCallback; break; - case TDMT_VND_EXPLAIN: + case TDMT_SCH_EXPLAIN: *fp = schHandleExplainCallback; break; - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: *fp = schHandleFetchCallback; break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: *fp = schHandleDropCallback; break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: *fp = schHandleHbCallback; break; case TDMT_SCH_LINK_BROKEN: @@ -694,7 +694,7 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { int32_t msgType = TDMT_VND_QUERY_HEARTBEAT_RSP; __async_send_cb_fn_t fp = NULL; - SCH_ERR_JRET(schGetCallbackFp(TDMT_VND_QUERY_HEARTBEAT, &fp)); + SCH_ERR_JRET(schGetCallbackFp(TDMT_SCH_QUERY_HEARTBEAT, &fp)); param->nodeEpId = epId; param->pTrans = pJob->conn.pTrans; @@ -784,7 +784,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { } SSchTrans trans = {.pTrans = pJob->conn.pTrans, .pHandle = SCH_GET_TASK_HANDLE(pTask)}; - SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, NULL, 0, TDMT_VND_EXPLAIN, &trans, false, &pExplainMsgSendInfo)); + SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, NULL, 0, TDMT_SCH_EXPLAIN, &trans, false, &pExplainMsgSendInfo)); int32_t msgType = TDMT_VND_EXPLAIN_RSP; SRpcCtxVal ctxVal = {.val = pExplainMsgSendInfo, .clone = schCloneSMsgSendInfo}; @@ -882,7 +882,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery SEpSet *epSet = &addr->epSet; SMsgSendInfo *pMsgSendInfo = NULL; - bool isHb = (TDMT_VND_QUERY_HEARTBEAT == msgType); + bool isHb = (TDMT_SCH_QUERY_HEARTBEAT == msgType); SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, msg, msgSize, msgType, trans, isHb, &pMsgSendInfo)); SCH_ERR_JRET(schUpdateSendTargetInfo(pMsgSendInfo, addr, pTask)); @@ -926,7 +926,7 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId, SArray* taskAction) { int32_t code = 0; SRpcCtx rpcCtx = {0}; SSchTrans trans = {0}; - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT; + int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT; req.header.vgId = nodeEpId->nodeId; req.sId = schMgmt.sId; @@ -1032,7 +1032,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, tSerializeSVDeleteReq(msg, msgSize, &req); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: { SCH_ERR_RET(schMakeQueryRpcCtx(pJob, pTask, &rpcCtx)); uint32_t len = strlen(pJob->sql); @@ -1060,7 +1060,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, persistHandle = true; break; } - case TDMT_VND_FETCH: { + case TDMT_SCH_FETCH: { msgSize = sizeof(SResFetchReq); msg = taosMemoryCalloc(1, msgSize); if (NULL == msg) { @@ -1078,7 +1078,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, break; } - case TDMT_VND_DROP_TASK: { + case TDMT_SCH_DROP_TASK: { msgSize = sizeof(STaskDropReq); msg = taosMemoryCalloc(1, msgSize); if (NULL == msg) { @@ -1096,7 +1096,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->refId = htobe64(pJob->refId); break; } - case TDMT_VND_QUERY_HEARTBEAT: { + case TDMT_SCH_QUERY_HEARTBEAT: { SCH_ERR_RET(schMakeHbRpcCtx(pJob, pTask, &rpcCtx)); SSchedulerHbReq req = {0}; @@ -1135,7 +1135,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, SCH_ERR_JRET(schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL))); - if (msgType == TDMT_VND_QUERY) { + if (msgType == TDMT_SCH_QUERY) { SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execIdx)); } diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index e5cc3cd481..43822e4f5b 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -118,7 +118,7 @@ void schtBuildQueryDag(SQueryPlan *dag) { scanPlan->level = 1; scanPlan->pParents = nodesMakeList(); scanPlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - scanPlan->msgType = TDMT_VND_QUERY; + scanPlan->msgType = TDMT_SCH_QUERY; mergePlan->id.queryId = qId; mergePlan->id.groupId = schtMergeTemplateId; @@ -130,7 +130,7 @@ void schtBuildQueryDag(SQueryPlan *dag) { mergePlan->pChildren = nodesMakeList(); mergePlan->pParents = NULL; mergePlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - mergePlan->msgType = TDMT_VND_QUERY; + mergePlan->msgType = TDMT_SCH_QUERY; merge->pNodeList = nodesMakeList(); scan->pNodeList = nodesMakeList(); @@ -181,7 +181,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { scanPlan[i].level = 1; scanPlan[i].pParents = nodesMakeList(); scanPlan[i].pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - scanPlan[i].msgType = TDMT_VND_QUERY; + scanPlan[i].msgType = TDMT_SCH_QUERY; nodesListAppend(scanPlan[i].pParents, (SNode*)mergePlan); nodesListAppend(mergePlan->pChildren, (SNode*)(scanPlan + i)); @@ -198,7 +198,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { mergePlan->pParents = NULL; mergePlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - mergePlan->msgType = TDMT_VND_QUERY; + mergePlan->msgType = TDMT_SCH_QUERY; nodesListAppend(merge->pNodeList, (SNode*)mergePlan); @@ -896,7 +896,7 @@ TEST(queryTest, flowCtrlCase) { taosHashCancelIterate(pJob->execTasks, pIter); - if (task->lastMsgType == TDMT_VND_QUERY) { + if (task->lastMsgType == TDMT_SCH_QUERY) { SQueryTableRsp rsp = {0}; code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); From 6d8fd7e50607fc192b39c6407aa9596a1543c0c2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 29 Jun 2022 10:51:22 +0800 Subject: [PATCH 03/68] feat: query redirect --- include/common/tmsgdef.h | 7 +- include/libs/qcom/query.h | 16 ++- source/client/src/clientEnv.c | 5 +- source/client/src/clientImpl.c | 5 +- source/dnode/mgmt/mgmt_mnode/src/mmHandle.c | 1 + source/dnode/mgmt/mgmt_qnode/src/qmHandle.c | 1 + source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 1 + source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/mnode/impl/src/mndMain.c | 6 +- source/dnode/mnode/impl/src/mndQuery.c | 6 +- source/dnode/qnode/src/qnode.c | 3 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 3 +- source/libs/function/src/udfd.c | 2 +- source/libs/planner/src/planPhysiCreater.c | 6 +- source/libs/qcom/src/queryUtil.c | 3 +- source/libs/scheduler/inc/schedulerInt.h | 1 + source/libs/scheduler/src/schJob.c | 107 +++++++++++++++++- source/libs/scheduler/src/schRemote.c | 31 +++-- 18 files changed, 170 insertions(+), 36 deletions(-) diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index cbf0c4b2fe..df14b0b34e 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -201,12 +201,13 @@ enum { TD_NEW_MSG_SEG(TDMT_SCH_MSG) TD_DEF_MSG_TYPE(TDMT_SCH_QUERY, "query", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_MERGE_QUERY, "merge-query", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_CONTINUE, "query-continue", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_FETCH, "fetch", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "vnode-cancel-task", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "vnode-drop-task", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "vnode-explain", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "cancel-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL) TD_NEW_MSG_SEG(TDMT_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DEPLOY, "stream-task-deploy", SStreamTaskDeployReq, SStreamTaskDeployRsp) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 0b767e96f6..3681c2f071 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -138,6 +138,7 @@ typedef struct SDataBuf { void* pData; uint32_t len; void* handle; + SEpSet* pEpSet; } SDataBuf; typedef struct STargetInfo { @@ -234,13 +235,24 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define NEED_CLIENT_HANDLE_ERROR(_code) \ (NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \ NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code)) +#define NEED_REDIRECT_ERROR(_code) \ + ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ + (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \ + (_code) == TSDB_CODE_APP_NOT_READY) + #define NEED_CLIENT_RM_TBLMETA_REQ(_type) \ ((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_VND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \ (_type) == TDMT_VND_DROP_STB) +#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \ + ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \ + (_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_APP_NOT_READY) + #define NEED_SCHEDULER_RETRY_ERROR(_code) \ - ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ - (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR) + (NEED_SCHEDULER_REDIRECT_ERROR(_code) || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR) + + + #define REQUEST_TOTAL_EXEC_TIMES 2 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index a36c7a0048..4cc79096d1 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -89,9 +89,8 @@ void closeTransporter(SAppInstInfo *pAppInfo) { } static bool clientRpcRfp(int32_t code, tmsg_t msgType) { - if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { + if (NEED_REDIRECT_ERROR(code)) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 632b8441c4..68a225f64c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -808,7 +808,8 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { code = handleSubmitExecRes(pRequest, pRes->res, pCatalog, &epset); break; } - case TDMT_SCH_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { code = handleQueryExecRes(pRequest, pRes->res, pCatalog, &epset); break; } @@ -1306,7 +1307,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { updateTargetEpSet(pSendInfo, pTscObj, pMsg, pEpSet); - SDataBuf buf = {.len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle}; + SDataBuf buf = {.len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle, .pEpSet = pEpSet}; if (pMsg->contLen > 0) { buf.pData = taosMemoryCalloc(1, pMsg->contLen); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index fbf3379490..59d68b2110 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -210,6 +210,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_SERVER_VERSION, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 1a7b5c1a1b..5911daaa2b 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -108,6 +108,7 @@ SArray *qmGetMsgHandles() { // Requests handled by VNODE if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 938e5f32b0..5bc9582527 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -325,6 +325,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index c1b5b86d4c..75e69e3716 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,7 +251,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 0a9c5a82c8..0f353b20a3 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -527,9 +527,9 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; - if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || - pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || pMsg->msgType == TDMT_SCH_FETCH || - pMsg->msgType == TDMT_SCH_DROP_TASK) { + if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || + pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || + pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) { return 0; } if (mndAcquireRpcRef(pMsg->info.node) == 0) return 0; diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index b67a11997e..aec99fa3b7 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -19,13 +19,13 @@ #include "qworker.h" int32_t mndPreProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_SCH_QUERY != pMsg->msgType) return 0; + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) return 0; SMnode *pMnode = pMsg->info.node; return qWorkerPreprocessQueryMsg(pMnode->pQuery, pMsg); } void mndPostProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_SCH_QUERY != pMsg->msgType) return; + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) return; SMnode *pMnode = pMsg->info.node; qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg); } @@ -38,6 +38,7 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { mTrace("msg:%p, in query queue is processing", pMsg); switch (pMsg->msgType) { case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: code = qWorkerProcessQueryMsg(&handle, pMnode->pQuery, pMsg, 0); break; case TDMT_SCH_QUERY_CONTINUE: @@ -68,6 +69,7 @@ int32_t mndInitQuery(SMnode *pMnode) { } mndSetMsgHandle(pMnode, TDMT_SCH_QUERY, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_MERGE_QUERY, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_CONTINUE, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_FETCH, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index a0aa640ed6..5909d6f599 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -65,7 +65,7 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { } int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg * pMsg) { - if (TDMT_SCH_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) { return 0; } @@ -79,6 +79,7 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { switch (pMsg->msgType) { case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: code = qWorkerProcessQueryMsg(&handle, pQnode->pQuery, pMsg, ts); break; case TDMT_SCH_QUERY_CONTINUE: diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 63b7289661..64fa6c705d 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -216,7 +216,7 @@ _err: } int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { - if (TDMT_SCH_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) { return 0; } @@ -228,6 +228,7 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { SReadHandle handle = {.meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode, .pMsgCb = &pVnode->msgCb}; switch (pMsg->msgType) { case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: return qWorkerProcessQueryMsg(&handle, pVnode->pQuery, pMsg, 0); case TDMT_SCH_QUERY_CONTINUE: return qWorkerProcessCQueryMsg(&handle, pVnode->pQuery, pMsg, 0); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index c6c1f00395..4aad544e19 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -549,7 +549,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 77df96f82d..cbb12fee0e 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1555,7 +1555,11 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic if (SUBPLAN_TYPE_MODIFY == pLogicSubplan->subplanType) { code = buildVnodeModifySubplan(pCxt, pLogicSubplan, pSubplan); } else { - pSubplan->msgType = TDMT_SCH_QUERY; + if (SUBPLAN_TYPE_SCAN == pSubplan->subplanType) { + pSubplan->msgType = TDMT_SCH_QUERY; + } else { + pSubplan->msgType = TDMT_SCH_MERGE_QUERY; + } code = createPhysiNode(pCxt, pLogicSubplan->pNode, pSubplan, &pSubplan->pNode); if (TSDB_CODE_SUCCESS == code && !pCxt->pPlanCxt->streamQuery && !pCxt->pPlanCxt->topicQuery) { code = createDataDispatcher(pCxt, pSubplan->pNode, &pSubplan->pDataSink); diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 40c5807057..69d48b2179 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -216,7 +216,8 @@ void destroyQueryExecRes(SQueryExecRes* pRes) { tFreeSSubmitRsp((SSubmitRsp*)pRes->res); break; } - case TDMT_SCH_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { taosArrayDestroy((SArray*)pRes->res); break; } diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index a119795787..4e36bd3f10 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -383,6 +383,7 @@ char* schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob); int32_t schSetJobQueryRes(SSchJob* pJob, SQueryResult* pRes); +int32_t schUpdateTaskCandidateAddr(SSchTask *pTask, SEpSet* pEpSet); #ifdef __cplusplus diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 54d0d2f2e5..fd27193b0f 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -682,6 +682,25 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } +int32_t schUpdateTaskCandidateAddr(SSchTask *pTask, SEpSet* pEpSet) { + if (NULL == pTask->candidateAddrs || 1 != taosArrayGetSize(pTask->candidateAddrs)) { + SCH_TASK_ELOG("not able to update cndidate addr, addr num %d", (pTask->candidateAddrs ? taosArrayGetSize(pTask->candidateAddrs): 0)); + SCH_ERR_RET(TSDB_CODE_APP_ERROR); + } + + SQueryNodeAddr* pAddr = taosArrayGet(pTask->candidateAddrs, 0); + + SEp* pOld = &pAddr->epSet.eps[pAddr->epSet.inUse]; + SEp* pNew = &pEpSet->eps[pEpSet->inUse]; + + SCH_TASK_DLOG("update task ep from %s:%d to %s:%d", pOld->fqdn, pOld->port, pNew->fqdn, pNew->port); + + memcpy(&pAddr->epSet, pEpSet, sizeof(pAddr->epSet)); + + return TSDB_CODE_SUCCESS; +} + + int32_t schRemoveTaskFromExecList(SSchJob *pJob, SSchTask *pTask) { int32_t code = taosHashRemove(pJob->execTasks, &pTask->taskId, sizeof(pTask->taskId)); if (code) { @@ -821,7 +840,6 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo return TSDB_CODE_SUCCESS; } - // TODO CHECK epList/condidateList if (SCH_IS_DATA_SRC_TASK(pTask)) { if ((pTask->execIdx + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { *needRetry = false; @@ -853,7 +871,6 @@ int32_t schHandleTaskRetry(SSchJob *pJob, SSchTask *pTask) { SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); if (SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) { - SCH_ERR_RET(schDecTaskFlowQuota(pJob, pTask)); SCH_ERR_RET(schLaunchTasksInFlowCtrlList(pJob, pTask)); } @@ -1237,7 +1254,8 @@ int32_t schRescheduleTask(SSchJob *pJob, SSchTask *pTask) { } SCH_LOCK_TASK(pTask); - if (JOB_TASK_STATUS_EXECUTING == pTask->status && pJob->fetchTask != pTask && taosArrayGetSize(pTask->candidateAddrs) > 1) { + if (SCH_TASK_TIMEOUT(pTask) && JOB_TASK_STATUS_EXECUTING == pTask->status && + pJob->fetchTask != pTask && taosArrayGetSize(pTask->candidateAddrs) > 1) { SCH_TASK_DLOG("task execIdx %d will be rescheduled now", pTask->execIdx); schDropTaskOnExecNode(pJob, pTask); taosHashClear(pTask->execNodes); @@ -1281,7 +1299,7 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { continue; } - if (taskStatus->status == JOB_TASK_STATUS_NOT_START && SCH_TASK_TIMEOUT(pTask)) { + if (taskStatus->status == JOB_TASK_STATUS_NOT_START) { schRescheduleTask(pJob, pTask); } @@ -1657,5 +1675,86 @@ _return: SCH_RET(code); } +int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { + int32_t code = 0; + + if ((pTask->execIdx + 1) >= pTask->maxExecTimes) { + SCH_TASK_DLOG("task no more retry since reach max try times, execIdx:%d", pTask->execIdx); + SCH_UNLOCK_TASK(pTask); + schProcessOnJobFailure(pJob, rspCode); + return TSDB_CODE_SUCCESS; + } + + SCH_TASK_DLOG("task will be redirected now, status:%d", SCH_GET_TASK_STATUS_STR(pTask)); + + schDropTaskOnExecNode(pJob, pTask); + taosHashClear(pTask->execNodes); + SCH_ERR_JRET(schRemoveTaskFromExecList(pJob, pTask)); + schDeregisterTaskHb(pJob, pTask); + atomic_sub_fetch_32(&pTask->level->taskLaunchedNum, 1); + taosMemoryFreeClear(pTask->msg); + pTask->msgLen = 0; + pTask->lastMsgType = 0; + memset(&pTask->succeedAddr, 0, sizeof(pTask->succeedAddr)); + + if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + if (SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) { + if (JOB_TASK_STATUS_EXECUTING == SCH_GET_TASK_STATUS(pTask)) { + SCH_ERR_JRET(schLaunchTasksInFlowCtrlList(pJob, pTask)); + } + } + } else { + pTask->childReady = 0; + + int32_t childrenNum = taosArrayGetSize(pTask->children); + for (int32_t i = 0; i < childrenNum; ++i) { + SSchTask* pChild = taosArrayGetP(pTask->children, i); + SCH_LOCK_TASK(pChild); + code = schDoTaskRedirect(pJob, pChild, rspCode); + SCH_UNLOCK_TASK(pChild); + SCH_ERR_JRET(code); + } + + qClearSubplanExecutionNode(pTask->plan); + } + + SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); + + SCH_ERR_JRET(schLaunchTask(pJob, pTask)); + + SCH_UNLOCK_TASK(pTask); + + return TSDB_CODE_SUCCESS; + +_return: + + code = schProcessOnTaskFailure(pJob, pTask, code); + + SCH_UNLOCK_TASK(pTask); + + SCH_RET(code); +} + +int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SDataBuf* pData, int32_t rspCode) { + int32_t code = 0; + + if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + if (NULL == pData->pEpSet) { + SCH_TASK_ELOG("no epset updated while got error %s", tstrerror(rspCode)); + SCH_ERR_JRET(rspCode); + } + + SCH_ERR_JRET(schUpdateTaskCandidateAddr(pTask, pData->pEpSet)); + } + + schDoTaskRedirect(pJob, pTask, rspCode); + +_return: + + schProcessOnTaskFailure(pJob, pTask, code); + + SCH_RET(code); +} + diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index a1691a3dd3..76d2061936 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -90,15 +90,6 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, char *msg, int32_t msgSize, int32_t rspCode) { int32_t code = 0; - int8_t status = 0; - - if (schJobNeedToStop(pJob, &status)) { - SCH_TASK_ELOG("rsp not processed cause of job status, job status:%s, rspCode:0x%x", jobTaskStatusStr(status), rspCode); - taosMemoryFreeClear(msg); - SCH_RET(atomic_load_32(&pJob->errCode)); - } - - SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); switch (msgType) { case TDMT_VND_CREATE_TABLE_RSP: { @@ -392,8 +383,23 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL); SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execIdx)); + + int8_t status = 0; + if (schJobNeedToStop(pJob, &status)) { + SCH_TASK_ELOG("rsp will not be processed cause of job status %s, rspCode:0x%x", jobTaskStatusStr(status), rspCode); + code = atomic_load_32(&pJob->errCode); + goto _return; + } + + SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); + + if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || ((rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL) && msgSize > 0)) { + code = schHandleRedirect(pJob, pTask, msgType, pMsg, rspCode); + goto _return; + } SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode)); + pMsg->pData = NULL; _return: @@ -405,6 +411,7 @@ _return: schReleaseJob(pParam->refId); } + taosMemoryFreeClear(pMsg->pData); taosMemoryFreeClear(param); SCH_RET(code); } @@ -569,6 +576,7 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { *fp = schHandleSubmitCallback; break; case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: *fp = schHandleQueryCallback; break; case TDMT_VND_DELETE: @@ -1032,7 +1040,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, tSerializeSVDeleteReq(msg, msgSize, &req); break; } - case TDMT_SCH_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { SCH_ERR_RET(schMakeQueryRpcCtx(pJob, pTask, &rpcCtx)); uint32_t len = strlen(pJob->sql); @@ -1135,7 +1144,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, SCH_ERR_JRET(schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL))); - if (msgType == TDMT_SCH_QUERY) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY) { SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execIdx)); } From 5df4cd9054eeb3e17e383696ca0500ca1d69be88 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 29 Jun 2022 11:27:01 +0800 Subject: [PATCH 04/68] feat: query redirect --- include/libs/planner/planner.h | 2 +- source/libs/planner/src/planner.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 727cdd8ad6..2ab703df95 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -48,7 +48,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo // @pSource one execution location of this group of datasource subplans int32_t qSetSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId, SDownstreamSourceNode* pSource); -int32_t qClearSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId); +int32_t qClearSubplanExecutionNode(SSubplan* pSubplan); // Convert to subplan to string for the scheduler to send to the executor int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen); diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index 1b9d16311c..b1268358fb 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -85,11 +85,24 @@ int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstream return setSubplanExecutionNode(subplan->pNode, groupId, pSource); } -int32_t qClearSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId) { - // todo - return TSDB_CODE_FAILED; +static void clearSubplanExecutionNode(SPhysiNode* pNode) { + if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == nodeType(pNode)) { + SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pNode; + NODES_DESTORY_LIST(pExchange->pSrcEndPoints); + } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE == nodeType(pNode)) { + SMergePhysiNode* pMerge = (SMergePhysiNode*)pNode; + pMerge->numOfChannels = LIST_LENGTH(pMerge->node.pChildren); + SNode* pChild = NULL; + FOREACH(pChild, pMerge->node.pChildren) { NODES_DESTORY_LIST(((SExchangePhysiNode*)pChild)->pSrcEndPoints); } + } + + SNode* pChild = NULL; + FOREACH(pChild, pNode->pChildren) { clearSubplanExecutionNode((SPhysiNode*)pChild); } } +void qClearSubplanExecutionNode(SSubplan* pSubplan) { clearSubplanExecutionNode(pSubplan->pNode); } + + int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen) { if (SUBPLAN_TYPE_MODIFY == pSubplan->subplanType && NULL == pSubplan->pNode) { SDataInserterNode* insert = (SDataInserterNode*)pSubplan->pDataSink; From c6440a7a3c08496f555cc81a7ba9c1570ece8dc2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 29 Jun 2022 11:33:37 +0800 Subject: [PATCH 05/68] feat: query redirect --- include/common/tmsgdef.h | 4 +--- source/libs/transport/src/transSvr.c | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index df14b0b34e..008bdcc294 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -208,6 +208,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "cancel-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) TD_NEW_MSG_SEG(TDMT_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DEPLOY, "stream-task-deploy", SStreamTaskDeployReq, SStreamTaskDeployRsp) @@ -217,9 +218,6 @@ enum { TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RECOVER, "stream-task-recover", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL) - TD_NEW_MSG_SEG(TDMT_SCH_MSG) - TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) - TD_NEW_MSG_SEG(TDMT_MON_MSG) TD_DEF_MSG_TYPE(TDMT_MON_MM_INFO, "monitor-minfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_VM_INFO, "monitor-vinfo", NULL, NULL) diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 9809f3d564..f53507c8aa 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1042,7 +1042,7 @@ void transReleaseSrvHandle(void* handle) { m->type = Release; tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refId); return; _return1: @@ -1071,7 +1071,7 @@ void transSendResponse(const STransMsg* msg) { STraceId* trace = (STraceId*)&msg->info.traceId; tGTrace("conn %p start to send resp (1/2)", exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refId); return; _return1: @@ -1100,7 +1100,7 @@ void transRegisterMsg(const STransMsg* msg) { m->type = Register; tTrace("%s conn %p start to register brokenlink callback", transLabel(pThrd->pTransInst), exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refId); return; From 3501475f602d3c54acdb2f3b5217c8d7d51df315 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 29 Jun 2022 16:11:41 +0800 Subject: [PATCH 06/68] enh: add new code --- include/util/taoserror.h | 1 + source/util/src/terror.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 08e09dca2f..db6f1c0e1e 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -86,6 +86,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x0102) #define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0103) #define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0104) +#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0105) //client #define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200) diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 96f0fb21ca..3ab307dc3f 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -89,8 +89,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_REDIRECT, "Redirect") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_AUTH_FAILURE, "Authentication failure") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_UNAVAIL, "Unable to establish connection") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQDN") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken") //client TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation") From 170b7cb83717cc82c8ee7ffbd9ab498373c6f581 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Wed, 29 Jun 2022 17:10:09 +0800 Subject: [PATCH 07/68] fix: clean windows environment before test --- Jenkinsfile2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index f618912295..920eb0c01d 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -130,6 +130,9 @@ def pre_test(){ def pre_test_win(){ bat ''' hostname + taskkill /f /t /im python.exe + taskkill /f /t /im bash.exe + taskkill /f /t /im taosd.exe ipconfig set date /t From 86e379f081a59925c3798851d32d0940b3ed73f2 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 29 Jun 2022 17:11:30 +0800 Subject: [PATCH 08/68] feat: add retry --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 587e2bad98..e21237ec10 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -399,7 +399,7 @@ void cliHandleExcept(SCliConn* pConn) { STransConnCtx* pCtx = pMsg ? pMsg->ctx : NULL; STransMsg transMsg = {0}; - transMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + transMsg.code = TSDB_CODE_RPC_BROKEN_LINK; transMsg.msgType = pMsg ? pMsg->msg.msgType + 1 : 0; transMsg.info.ahandle = NULL; From 914e06e8cb44d1f9139d6eb488571e6736f4e50b Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 29 Jun 2022 17:15:08 +0800 Subject: [PATCH 09/68] feat: query redirect --- include/libs/planner/planner.h | 2 +- include/libs/qcom/query.h | 3 +- source/client/src/clientHb.c | 2 +- source/client/src/clientImpl.c | 2 +- source/client/src/clientMsgHandler.c | 16 ++-- source/client/src/tmq.c | 8 +- source/dnode/mgmt/mgmt_qnode/src/qmHandle.c | 2 +- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/qnode/src/qnode.c | 2 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- source/libs/catalog/src/ctgRemote.c | 2 +- source/libs/executor/src/executorimpl.c | 2 +- source/libs/executor/src/scanoperator.c | 2 +- source/libs/qworker/inc/qwInt.h | 3 + source/libs/qworker/inc/qwMsg.h | 2 +- source/libs/qworker/src/qwMsg.c | 18 ++-- source/libs/qworker/src/qworker.c | 17 ++-- source/libs/qworker/test/qworkerTests.cpp | 7 +- source/libs/scheduler/inc/schedulerInt.h | 5 +- source/libs/scheduler/src/schJob.c | 10 +-- source/libs/scheduler/src/schRemote.c | 85 +++++-------------- source/libs/scheduler/test/schedulerTests.cpp | 18 ++-- source/libs/transport/src/transSvr.c | 2 + 23 files changed, 87 insertions(+), 127 deletions(-) diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 2ab703df95..b4c75da131 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -48,7 +48,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo // @pSource one execution location of this group of datasource subplans int32_t qSetSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId, SDownstreamSourceNode* pSource); -int32_t qClearSubplanExecutionNode(SSubplan* pSubplan); +void qClearSubplanExecutionNode(SSubplan* pSubplan); // Convert to subplan to string for the scheduler to send to the executor int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen); diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 5767926e5e..92131e354a 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -135,6 +135,7 @@ typedef struct STableMetaOutput { } STableMetaOutput; typedef struct SDataBuf { + int32_t msgType; void* pData; uint32_t len; void* handle; @@ -147,7 +148,7 @@ typedef struct STargetInfo { int32_t vgId; } STargetInfo; -typedef int32_t (*__async_send_cb_fn_t)(void* param, const SDataBuf* pMsg, int32_t code); +typedef int32_t (*__async_send_cb_fn_t)(void* param, SDataBuf* pMsg, int32_t code); typedef int32_t (*__async_exec_fn_t)(void* param); typedef struct SRequestConnInfo { diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 2de630e181..48fa2d7938 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -262,7 +262,7 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { return TSDB_CODE_SUCCESS; } -static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) { +static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { static int32_t emptyRspNum = 0; if (code != 0) { taosMemoryFreeClear(param); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 68a225f64c..b20fd4b9b0 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1307,7 +1307,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { updateTargetEpSet(pSendInfo, pTscObj, pMsg, pEpSet); - SDataBuf buf = {.len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle, .pEpSet = pEpSet}; + SDataBuf buf = {.msgType = pMsg->msgType, .len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle, .pEpSet = pEpSet}; if (pMsg->contLen > 0) { buf.pData = taosMemoryCalloc(1, pMsg->contLen); diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 5c30df4ae2..ce866d2c20 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -26,7 +26,7 @@ static void setErrno(SRequestObj* pRequest, int32_t code) { terrno = code; } -int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; setErrno(pRequest, code); @@ -39,7 +39,7 @@ int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { taosMemoryFree(pMsg->pData); @@ -116,7 +116,7 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) { return pMsgSendInfo; } -int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { // todo rsp with the vnode id list SRequestObj* pRequest = param; taosMemoryFree(pMsg->pData); @@ -132,7 +132,7 @@ int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (TSDB_CODE_MND_DB_NOT_EXIST == code) { @@ -211,7 +211,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return 0; } -int32_t processCreateSTableRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) { assert(pMsg != NULL && param != NULL); SRequestObj* pRequest = param; @@ -229,7 +229,7 @@ int32_t processCreateSTableRsp(void* param, const SDataBuf* pMsg, int32_t code) return code; } -int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); @@ -250,7 +250,7 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processAlterStbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processAlterStbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); @@ -357,7 +357,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { return TSDB_CODE_SUCCESS; } -int32_t processShowVariablesRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 637a7ee5dd..165deaa6c5 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -372,7 +372,7 @@ int32_t tmqCommitCb(void* param, const SDataBuf* pMsg, int32_t code) { return 0; } -int32_t tmqCommitCb2(void* param, const SDataBuf* pBuf, int32_t code) { +int32_t tmqCommitCb2(void* param, SDataBuf* pBuf, int32_t code) { SMqCommitCbParam2* pParam = (SMqCommitCbParam2*)param; SMqCommitCbParamSet* pParamSet = (SMqCommitCbParamSet*)pParam->params; // push into array @@ -862,7 +862,7 @@ void tmqClearUnhandleMsg(tmq_t* tmq) { } } -int32_t tmqSubscribeCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqSubscribeCb(void* param, SDataBuf* pMsg, int32_t code) { SMqSubscribeCbParam* pParam = (SMqSubscribeCbParam*)param; pParam->rspErr = code; /*tmq_t* tmq = pParam->tmq;*/ @@ -1116,7 +1116,7 @@ int32_t tmqGetSkipLogNum(tmq_message_t* tmq_message) { } #endif -int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { SMqPollCbParam* pParam = (SMqPollCbParam*)param; SMqClientVg* pVg = pParam->pVg; SMqClientTopic* pTopic = pParam->pTopic; @@ -1368,7 +1368,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqAskEpRsp* pRsp) { } #endif -int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) { SMqAskEpCbParam* pParam = (SMqAskEpCbParam*)param; tmq_t* tmq = pParam->tmq; int8_t async = pParam->async; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 5911daaa2b..1f22eefddf 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -111,7 +111,7 @@ SArray *qmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 75e69e3716..4e581fd28e 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -86,7 +86,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { return; case TDMT_MND_SYSTABLE_RETRIEVE_RSP: case TDMT_DND_SYSTABLE_RETRIEVE_RSP: - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: qWorkerProcessFetchRsp(NULL, NULL, pRpc, 0); return; case TDMT_MND_STATUS_RSP: diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index 5909d6f599..cfc63b083d 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -88,7 +88,7 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { case TDMT_SCH_FETCH: code = qWorkerProcessFetchMsg(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: code = qWorkerProcessFetchRsp(pQnode, pQnode->pQuery, pMsg, ts); break; case TDMT_SCH_CANCEL_TASK: diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 64fa6c705d..d0a1b5417f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -246,7 +246,7 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { switch (pMsg->msgType) { case TDMT_SCH_FETCH: return qWorkerProcessFetchMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: return qWorkerProcessFetchRsp(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_SCH_CANCEL_TASK: return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0); diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 304da88888..59ad009527 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -241,7 +241,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, } -int32_t ctgHandleMsgCallback(void *param, const SDataBuf *pMsg, int32_t rspCode) { +int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SCtgTaskCallbackParam* cbParam = (SCtgTaskCallbackParam*)param; int32_t code = 0; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 9b38f46ca6..c6f1096bfe 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1933,7 +1933,7 @@ typedef struct SFetchRspHandleWrapper { int32_t sourceIndex; } SFetchRspHandleWrapper; -int32_t loadRemoteDataCallback(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { SFetchRspHandleWrapper* pWrapper = (SFetchRspHandleWrapper*)param; SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pWrapper->exchangeId); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c51ef44154..146b6ca76b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1322,7 +1322,7 @@ static void getDBNameFromCondition(SNode* pCondition, const char* dbName) { nodesWalkExpr(pCondition, getDBNameFromConditionWalker, (char*)dbName); } -static int32_t loadSysTableCallback(void* param, const SDataBuf* pMsg, int32_t code) { +static int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code) { SOperatorInfo* operator=(SOperatorInfo*) param; SSysTableScanInfo* pScanResInfo = (SSysTableScanInfo*)operator->info; if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 2368b13dd6..4edd7a8a6e 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -82,6 +82,7 @@ extern SQWDebug gQWDebug; typedef struct SQWMsg { void *node; int32_t code; + int32_t msgType; char *msg; int32_t msgLen; SRpcHandleInfo connInfo; @@ -100,6 +101,7 @@ typedef struct SQWHbInfo { typedef struct SQWPhaseInput { int32_t code; + int32_t msgType; } SQWPhaseInput; typedef struct SQWPhaseOutput { @@ -119,6 +121,7 @@ typedef struct SQWTaskCtx { int8_t phase; int8_t taskType; int8_t explain; + int32_t queryType; bool queryFetched; bool queryEnd; diff --git a/source/libs/qworker/inc/qwMsg.h b/source/libs/qworker/inc/qwMsg.h index 8c7c030dce..9e9d1f44cb 100644 --- a/source/libs/qworker/inc/qwMsg.h +++ b/source/libs/qworker/inc/qwMsg.h @@ -39,7 +39,7 @@ int32_t qwBuildAndSendFetchRsp(SRpcHandleInfo *pConn, SRetrieveTableRsp *pRsp, i int32_t code); void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete); int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn); -int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo); +int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo); int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execInfo, int32_t num); void qwFreeFetchRsp(void *msg); int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp); diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 8c1371fce9..70a6a70c44 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -43,7 +43,7 @@ void qwFreeFetchRsp(void *msg) { } } -int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo) { +int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo) { SQueryTableRsp *pRsp = (SQueryTableRsp *)rpcMallocCont(sizeof(SQueryTableRsp)); pRsp->code = code; if (tbInfo) { @@ -53,7 +53,7 @@ int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* } SRpcMsg rpcRsp = { - .msgType = TDMT_VND_QUERY_RSP, + .msgType = rspType, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -73,7 +73,7 @@ int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execIn tSerializeSExplainRsp(pRsp, contLen, &rsp); SRpcMsg rpcRsp = { - .msgType = TDMT_VND_EXPLAIN_RSP, + .msgType = TDMT_SCH_EXPLAIN_RSP, .pCont = pRsp, .contLen = contLen, .code = 0, @@ -92,7 +92,7 @@ int32_t qwBuildAndSendHbRsp(SRpcHandleInfo *pConn, SSchedulerHbRsp *pStatus, int tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus); SRpcMsg rpcRsp = { - .msgType = TDMT_VND_QUERY_HEARTBEAT_RSP, + .msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP, .contLen = contLen, .pCont = pRsp, .code = code, @@ -112,7 +112,7 @@ int32_t qwBuildAndSendFetchRsp(SRpcHandleInfo *pConn, SRetrieveTableRsp *pRsp, i } SRpcMsg rpcRsp = { - .msgType = TDMT_VND_FETCH_RSP, + .msgType = TDMT_SCH_FETCH_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp) + dataLength, .code = code, @@ -129,7 +129,7 @@ int32_t qwBuildAndSendCancelRsp(SRpcHandleInfo *pConn, int32_t code) { pRsp->code = code; SRpcMsg rpcRsp = { - .msgType = TDMT_VND_CANCEL_TASK_RSP, + .msgType = TDMT_SCH_CANCEL_TASK_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -145,7 +145,7 @@ int32_t qwBuildAndSendDropRsp(SRpcHandleInfo *pConn, int32_t code) { pRsp->code = code; SRpcMsg rpcRsp = { - .msgType = TDMT_VND_DROP_TASK_RSP, + .msgType = TDMT_SCH_DROP_TASK_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -325,9 +325,9 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int uint64_t tId = msg->taskId; int64_t rId = msg->refId; - SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info}; + SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info, .msgType = pMsg->msgType}; char * sql = strndup(msg->msg, msg->sqlLen); - QW_SCH_TASK_DLOG("processQuery start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, sql); + QW_SCH_TASK_DLOG("processQuery start, node:%p, type:%s, handle:%p, sql:%s", node, TMSG_INFO(pMsg->msgType), pMsg->info.handle, sql); QW_ERR_RET(qwProcessQuery(QW_FPARAMS(), &qwMsg, msg->taskType, msg->explain, sql)); QW_SCH_TASK_DLOG("processQuery end, node:%p", node); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 4250785f7c..8ab293d0ad 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -417,17 +417,10 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp } if (QW_PHASE_POST_QUERY == phase) { -#if 0 - if (QW_IS_EVENT_RECEIVED(ctx, QW_EVENT_READY)) { - readyConnection = &ctx->connInfo; - QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_READY); - } -#else connInfo = ctx->ctrlConnInfo; rspConnection = &connInfo; QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_READY); -#endif } if (QW_IS_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) { @@ -458,8 +451,8 @@ _return: } if (rspConnection) { - qwBuildAndSendQueryRsp(rspConnection, code, ctx ? &ctx->tbInfo : NULL); - QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", rspConnection->handle, code, tstrerror(code)); + qwBuildAndSendQueryRsp(input->msgType + 1, rspConnection, code, ctx ? &ctx->tbInfo : NULL); + QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", rspConnection->handle, code, tstrerror(code)); } if (ctx) { @@ -530,8 +523,9 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex QW_ERR_JRET(qwGetTaskCtx(QW_FPARAMS(), &ctx)); - atomic_store_8(&ctx->taskType, taskType); - atomic_store_8(&ctx->explain, explain); + ctx->taskType = taskType; + ctx->explain = explain; + ctx->queryType = qwMsg->msgType; QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg); @@ -571,6 +565,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex _return: input.code = code; + input.msgType = qwMsg->msgType; code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); // if (!queryRsped) { diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 7c7d262167..bc37400249 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -202,7 +202,8 @@ void qwtSendReqToDnode(void* pVnode, struct SEpSet* epSet, struct SRpcMsg* pReq) void qwtRpcSendResponse(const SRpcMsg *pRsp) { switch (pRsp->msgType) { - case TDMT_VND_QUERY_RSP: { + case TDMT_SCH_QUERY_RSP: + case TDMT_SCH_MERGE_QUERY_RSP: { SQueryTableRsp *rsp = (SQueryTableRsp *)pRsp->pCont; if (pRsp->code) { @@ -213,7 +214,7 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { rpcFreeCont(rsp); break; } - case TDMT_VND_FETCH_RSP: { + case TDMT_SCH_FETCH_RSP: { SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)pRsp->pCont; if (0 == pRsp->code && 0 == rsp->completed) { @@ -229,7 +230,7 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { break; } - case TDMT_VND_DROP_TASK_RSP: { + case TDMT_SCH_DROP_TASK_RSP: { STaskDropRsp *rsp = (STaskDropRsp *)pRsp->pCont; rpcFreeCont(rsp); diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 4e36bd3f10..fb0c43b0ff 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -353,7 +353,7 @@ void schFreeJobImpl(void *job); int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx); int32_t schEnsureHbConnection(SSchJob *pJob, SSchTask *pTask); int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans); -int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code); +int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code); void schFreeRpcCtx(SRpcCtx *pCtx); int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp); bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus); @@ -383,7 +383,8 @@ char* schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob); int32_t schSetJobQueryRes(SSchJob* pJob, SQueryResult* pRes); -int32_t schUpdateTaskCandidateAddr(SSchTask *pTask, SEpSet* pEpSet); +int32_t schUpdateTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask, SEpSet* pEpSet); +int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode); #ifdef __cplusplus diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index fd27193b0f..643594f4e0 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -682,9 +682,9 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } -int32_t schUpdateTaskCandidateAddr(SSchTask *pTask, SEpSet* pEpSet) { +int32_t schUpdateTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask, SEpSet* pEpSet) { if (NULL == pTask->candidateAddrs || 1 != taosArrayGetSize(pTask->candidateAddrs)) { - SCH_TASK_ELOG("not able to update cndidate addr, addr num %d", (pTask->candidateAddrs ? taosArrayGetSize(pTask->candidateAddrs): 0)); + SCH_TASK_ELOG("not able to update cndidate addr, addr num %d", (int32_t)(pTask->candidateAddrs ? taosArrayGetSize(pTask->candidateAddrs): 0)); SCH_ERR_RET(TSDB_CODE_APP_ERROR); } @@ -1685,7 +1685,7 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { return TSDB_CODE_SUCCESS; } - SCH_TASK_DLOG("task will be redirected now, status:%d", SCH_GET_TASK_STATUS_STR(pTask)); + SCH_TASK_DLOG("task will be redirected now, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); schDropTaskOnExecNode(pJob, pTask); taosHashClear(pTask->execNodes); @@ -1735,7 +1735,7 @@ _return: SCH_RET(code); } -int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SDataBuf* pData, int32_t rspCode) { +int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode) { int32_t code = 0; if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { @@ -1744,7 +1744,7 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SData SCH_ERR_JRET(rspCode); } - SCH_ERR_JRET(schUpdateTaskCandidateAddr(pTask, pData->pEpSet)); + SCH_ERR_JRET(schUpdateTaskCandidateAddr(pJob, pTask, pData->pEpSet)); } schDoTaskRedirect(pJob, pTask, rspCode); diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 76d2061936..91f5ff979c 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -28,9 +28,10 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy int32_t reqMsgType = msgType - 1; switch (msgType) { case TDMT_SCH_LINK_BROKEN: - case TDMT_VND_EXPLAIN_RSP: + case TDMT_SCH_EXPLAIN_RSP: return TSDB_CODE_SUCCESS; - case TDMT_VND_QUERY_RSP: // query_rsp may be processed later than ready_rsp + case TDMT_SCH_MERGE_QUERY_RSP: + case TDMT_SCH_QUERY_RSP: // query_rsp may be processed later than ready_rsp if (lastMsgType != reqMsgType && -1 != lastMsgType) { SCH_TASK_DLOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); @@ -43,7 +44,7 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy SCH_SET_TASK_LASTMSG_TYPE(pTask, -1); return TSDB_CODE_SUCCESS; - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: if (lastMsgType != reqMsgType && -1 != lastMsgType) { SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); @@ -238,7 +239,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch break; } - case TDMT_VND_QUERY_RSP: { + case TDMT_SCH_QUERY_RSP: + case TDMT_SCH_MERGE_QUERY_RSP: { SQueryTableRsp *rsp = (SQueryTableRsp *)msg; SCH_ERR_JRET(rspCode); @@ -255,7 +257,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch break; } - case TDMT_VND_EXPLAIN_RSP: { + case TDMT_SCH_EXPLAIN_RSP: { SCH_ERR_JRET(rspCode); if (NULL == msg) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); @@ -285,7 +287,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch } break; } - case TDMT_VND_FETCH_RSP: { + case TDMT_SCH_FETCH_RSP: { SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)msg; SCH_ERR_JRET(rspCode); @@ -333,8 +335,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch schProcessOnDataFetched(pJob); break; } - case TDMT_VND_DROP_TASK_RSP: { - // SHOULD NEVER REACH HERE + case TDMT_SCH_DROP_TASK_RSP: { + // NEVER REACH HERE SCH_TASK_ELOG("invalid status to handle drop task rsp, refId:0x%" PRIx64, pJob->refId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); break; @@ -358,8 +360,9 @@ _return: } -int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { +int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { int32_t code = 0; + int32_t msgType = pMsg->msgType; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; SSchTask *pTask = NULL; @@ -393,8 +396,8 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); - if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || ((rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL) && msgSize > 0)) { - code = schHandleRedirect(pJob, pTask, msgType, pMsg, rspCode); + if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || ((rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL) && pMsg->len > 0)) { + code = schHandleRedirect(pJob, pTask, (SDataBuf *)pMsg, rspCode); goto _return; } @@ -416,46 +419,14 @@ _return: SCH_RET(code); } -int32_t schHandleSubmitCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_SUBMIT_RSP, code); -} - -int32_t schHandleCreateTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_CREATE_TABLE_RSP, code); -} - -int32_t schHandleDropTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_DROP_TABLE_RSP, code); -} - -int32_t schHandleAlterTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_ALTER_TABLE_RSP, code); -} - -int32_t schHandleQueryCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_QUERY_RSP, code); -} - -int32_t schHandleDeleteCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_DELETE_RSP, code); -} - -int32_t schHandleFetchCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_FETCH_RSP, code); -} - -int32_t schHandleExplainCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_EXPLAIN_RSP, code); -} - -int32_t schHandleDropCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); taosMemoryFreeClear(param); return TSDB_CODE_SUCCESS; } -int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleLinkBrokenCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchCallbackParamHeader *head = (SSchCallbackParamHeader *)param; rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); @@ -468,7 +439,7 @@ int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t c SCH_ERR_RET(schBuildAndSendHbMsg(&hbParam->nodeEpId, NULL)); } else { - SCH_ERR_RET(schHandleCallback(param, pMsg, TDMT_SCH_LINK_BROKEN, code)); + SCH_ERR_RET(schHandleCallback(param, pMsg, code)); } return TSDB_CODE_SUCCESS; @@ -564,29 +535,15 @@ _return: int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { switch (msgType) { case TDMT_VND_CREATE_TABLE: - *fp = schHandleCreateTbCallback; - break; case TDMT_VND_DROP_TABLE: - *fp = schHandleDropTbCallback; - break; case TDMT_VND_ALTER_TABLE: - *fp = schHandleAlterTbCallback; - break; case TDMT_VND_SUBMIT: - *fp = schHandleSubmitCallback; - break; case TDMT_SCH_QUERY: case TDMT_SCH_MERGE_QUERY: - *fp = schHandleQueryCallback; - break; case TDMT_VND_DELETE: - *fp = schHandleDeleteCallback; - break; case TDMT_SCH_EXPLAIN: - *fp = schHandleExplainCallback; - break; case TDMT_SCH_FETCH: - *fp = schHandleFetchCallback; + *fp = schHandleCallback; break; case TDMT_SCH_DROP_TASK: *fp = schHandleDropCallback; @@ -700,7 +657,7 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT_RSP; + int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP; __async_send_cb_fn_t fp = NULL; SCH_ERR_JRET(schGetCallbackFp(TDMT_SCH_QUERY_HEARTBEAT, &fp)); @@ -730,7 +687,7 @@ _return: SCH_RET(code); } -int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchedulerHbRsp rsp = {0}; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; @@ -794,7 +751,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SSchTrans trans = {.pTrans = pJob->conn.pTrans, .pHandle = SCH_GET_TASK_HANDLE(pTask)}; SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, NULL, 0, TDMT_SCH_EXPLAIN, &trans, false, &pExplainMsgSendInfo)); - int32_t msgType = TDMT_VND_EXPLAIN_RSP; + int32_t msgType = TDMT_SCH_EXPLAIN_RSP; SRpcCtxVal ctxVal = {.val = pExplainMsgSendInfo, .clone = schCloneSMsgSendInfo}; if (taosHashPut(pCtx->args, &msgType, sizeof(msgType), &ctxVal, sizeof(ctxVal))) { SCH_TASK_ELOG("taosHashPut msg %d to rpcCtx failed", msgType); diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index 43822e4f5b..22b08e9037 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -412,7 +412,7 @@ void *schtCreateFetchRspThread(void *param) { rsp->completed = 1; rsp->numOfRows = 10; - code = schHandleResponseMsg(pJob, pJob->fetchTask, TDMT_VND_FETCH_RSP, (char *)rsp, sizeof(*rsp), 0); + code = schHandleResponseMsg(pJob, pJob->fetchTask, TDMT_SCH_FETCH_RSP, (char *)rsp, sizeof(*rsp), 0); schReleaseJob(job); @@ -445,7 +445,7 @@ void *schtFetchRspThread(void *aa) { dataBuf.pData = rsp; dataBuf.len = sizeof(*rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_FETCH_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_FETCH_RSP, 0); assert(code == 0 || code); } @@ -547,7 +547,7 @@ void* schtRunJobThread(void *aa) { dataBuf.pData = &rsp; dataBuf.len = sizeof(rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_QUERY_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0); assert(code == 0 || code); pIter = taosHashIterate(execTasks, pIter); @@ -566,7 +566,7 @@ void* schtRunJobThread(void *aa) { dataBuf.pData = &rsp; dataBuf.len = sizeof(rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_QUERY_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0); assert(code == 0 || code); pIter = taosHashIterate(execTasks, pIter); @@ -677,7 +677,7 @@ TEST(queryTest, normalCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -688,7 +688,7 @@ TEST(queryTest, normalCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -780,7 +780,7 @@ TEST(queryTest, readyFirstCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -791,7 +791,7 @@ TEST(queryTest, readyFirstCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -898,7 +898,7 @@ TEST(queryTest, flowCtrlCase) { if (task->lastMsgType == TDMT_SCH_QUERY) { SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); } else { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index f53507c8aa..aacae590a0 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1114,4 +1114,6 @@ _return2: rpcFreeCont(msg->pCont); } +int transGetConnInfo(void* thandle, STransHandleInfo* pConnInfo) { return -1; } + #endif From 53efe75146118cbd821df10ad52f8f5bad83c263 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 29 Jun 2022 17:56:35 +0800 Subject: [PATCH 10/68] feat: query redirect --- include/libs/qcom/query.h | 7 ++++--- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/libs/function/src/udfd.c | 2 +- source/libs/qworker/src/qwMsg.c | 8 ++++---- source/libs/scheduler/inc/schedulerInt.h | 2 ++ source/libs/scheduler/src/schRemote.c | 4 ++-- source/libs/transport/src/transCli.c | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 92131e354a..9881c8cb44 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -239,7 +239,7 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define NEED_REDIRECT_ERROR(_code) \ ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \ - (_code) == TSDB_CODE_APP_NOT_READY) + (_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK) #define NEED_CLIENT_RM_TBLMETA_REQ(_type) \ ((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_VND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \ @@ -249,8 +249,9 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \ (_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_APP_NOT_READY) -#define NEED_SCHEDULER_RETRY_ERROR(_code) \ - (NEED_SCHEDULER_REDIRECT_ERROR(_code) || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR) +#define NEED_SCHEDULER_RETRY_ERROR(_code) \ + (NEED_SCHEDULER_REDIRECT_ERROR(_code) || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ + (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR || (_code) == TSDB_CODE_RPC_BROKEN_LINK) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 4e581fd28e..91912bb764 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -250,7 +250,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { + code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_BROKEN_LINK) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 4aad544e19..708ea4bd38 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -548,7 +548,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { } static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { + code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_BROKEN_LINK) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 70a6a70c44..30772ff1ac 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -205,7 +205,7 @@ int32_t qwRegisterQueryBrokenLinkArg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { .msgType = TDMT_SCH_DROP_TASK, .pCont = req, .contLen = sizeof(STaskDropReq), - .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, + .code = TSDB_CODE_RPC_BROKEN_LINK, .info = *pConn, }; @@ -239,7 +239,7 @@ int32_t qwRegisterHbBrokenLinkArg(SQWorker *mgmt, uint64_t sId, SRpcHandleInfo * .msgType = TDMT_SCH_QUERY_HEARTBEAT, .pCont = msg, .contLen = msgSize, - .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, + .code = TSDB_CODE_RPC_BROKEN_LINK, .info = *pConn, }; @@ -484,7 +484,7 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info}; - if (TSDB_CODE_RPC_NETWORK_UNAVAIL == pMsg->code) { + if (TSDB_CODE_RPC_BROKEN_LINK == pMsg->code) { QW_SCH_TASK_DLOG("receive drop task due to network broken, error:%s", tstrerror(pMsg->code)); } @@ -522,7 +522,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_ uint64_t sId = req.sId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info}; - if (TSDB_CODE_RPC_NETWORK_UNAVAIL == pMsg->code) { + if (TSDB_CODE_RPC_BROKEN_LINK == pMsg->code) { QW_SCH_DLOG("receive Hb msg due to network broken, error:%s", tstrerror(pMsg->code)); } diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index fb0c43b0ff..8dfc703dd9 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -306,6 +306,8 @@ extern SSchedulerMgmt schMgmt; #define SCH_IS_WAIT_ALL_JOB(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_IS_NEED_DROP_JOB(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define SCH_SUB_TASK_NETWORK_ERR(_code, _len) (((_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_BROKEN_LINK) && ((_len) > 0)) #define SCH_IS_LEVEL_UNFINISHED(_level) ((_level)->taskLaunchedNum < (_level)->taskNum) #define SCH_GET_CUR_EP(_addr) (&(_addr)->epSet.eps[(_addr)->epSet.inUse]) diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 91f5ff979c..3688cb0240 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -384,7 +384,7 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { goto _return; } - bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL); + bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || SCH_NETWORK_ERR(rspCode)); SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execIdx)); int8_t status = 0; @@ -396,7 +396,7 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); - if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || ((rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL) && pMsg->len > 0)) { + if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || SCH_SUB_TASK_NETWORK_ERR(rspCode, pMsg->len > 0)) { code = schHandleRedirect(pJob, pTask, (SDataBuf *)pMsg, rspCode); goto _return; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e21237ec10..5de907f8cb 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -328,7 +328,7 @@ void cliHandleResp(SCliConn* conn) { tDebug("%s conn %p construct ahandle %p by %s, persist: 1", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle, TMSG_INFO(transMsg.msgType)); if (!CONN_RELEASE_BY_SERVER(conn) && transMsg.info.ahandle == NULL) { - transMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + transMsg.code = TSDB_CODE_RPC_BROKEN_LINK; transMsg.info.ahandle = transCtxDumpBrokenlinkVal(&conn->ctx, (int32_t*)&(transMsg.msgType)); tDebug("%s conn %p construct ahandle %p due brokenlink, persist: 1", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle); From e389dcedc8fb3bdebd20b107c0f446e62d4df56a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 30 Jun 2022 10:30:36 +0800 Subject: [PATCH 11/68] add query epset --- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 1 + source/dnode/mnode/impl/src/mndMain.c | 23 ++++++++++--------- source/dnode/vnode/src/vnd/vnodeSync.c | 10 ++++---- source/libs/transport/src/transCli.c | 23 +++++++++++++------ 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 91912bb764..939d6f52f3 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -41,6 +41,7 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) { } static inline void dmSendRedirectRsp(SRpcMsg *pMsg, const SEpSet *pNewEpSet) { + pMsg->info.hasEpSet = 1; SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info}; int32_t contLen = tSerializeSEpSet(NULL, 0, pNewEpSet); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index ff237c5a0c..c39c9847a9 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -58,7 +58,7 @@ static void *mndBuildTimerMsg(int32_t *pContLen) { static void mndPullupTrans(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRANS_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); @@ -67,14 +67,14 @@ static void mndPullupTrans(SMnode *pMnode) { static void mndTtlTimer(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); SRpcMsg rpcMsg = {.msgType = TDMT_MND_TTL_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } static void mndCalMqRebalance(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_MQ_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg); @@ -83,7 +83,7 @@ static void mndCalMqRebalance(SMnode *pMnode) { static void mndPullupTelem(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_TELEM_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg); @@ -395,7 +395,7 @@ void mndStop(SMnode *pMnode) { } int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { - SMnode *pMnode = pMsg->info.node; + SMnode * pMnode = pMsg->info.node; SSyncMgmt *pMgmt = &pMnode->syncMgmt; int32_t code = 0; @@ -413,7 +413,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { } do { - char *syncNodeStr = sync2SimpleStr(pMgmt->sync); + char * syncNodeStr = sync2SimpleStr(pMgmt->sync); static int64_t mndTick = 0; if (++mndTick % 10 == 1) { mTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); @@ -527,8 +527,8 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; - if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || - pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || + if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || + pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) { return 0; } @@ -552,6 +552,7 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet); pMsg->info.rsp = rpcMallocCont(contLen); + pMsg->info.hasEpSet = 1; if (pMsg->info.rsp != NULL) { tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet); pMsg->info.rspLen = contLen; @@ -578,7 +579,7 @@ static int32_t mndCheckMsgContent(SRpcMsg *pMsg) { } int32_t mndProcessRpcMsg(SRpcMsg *pMsg) { - SMnode *pMnode = pMsg->info.node; + SMnode * pMnode = pMsg->info.node; const STraceId *trace = &pMsg->info.traceId; MndMsgFp fp = pMnode->msgFp[TMSG_INDEX(pMsg->msgType)]; @@ -631,7 +632,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr SMonStbInfo *pStbInfo, SMonGrantInfo *pGrantInfo) { if (mndAcquireRpcRef(pMnode) != 0) return -1; - SSdb *pSdb = pMnode->pSdb; + SSdb * pSdb = pMnode->pSdb; int64_t ms = taosGetTimestampMs(); pClusterInfo->dnodes = taosArrayInit(sdbGetSize(pSdb, SDB_DNODE), sizeof(SMonDnodeDesc)); @@ -712,7 +713,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr pGrantInfo->timeseries_used += pVgroup->numOfTimeSeries; tstrncpy(desc.status, "unsynced", sizeof(desc.status)); for (int32_t i = 0; i < pVgroup->replica; ++i) { - SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; + SVnodeGid * pVgid = &pVgroup->vnodeGid[i]; SMonVnodeDesc *pVnDesc = &desc.vnodes[i]; pVnDesc->dnode_id = pVgid->dnodeId; tstrncpy(pVnDesc->vnode_role, syncStr(pVgid->role), sizeof(pVnDesc->vnode_role)); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index d324a76438..67e507858f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -119,7 +119,7 @@ static int32_t vnodeProcessAlterReplicaReq(SVnode *pVnode, SRpcMsg *pMsg) { } void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode *pVnode = pInfo->ahandle; + SVnode * pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -178,7 +178,7 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { for (int32_t i = 0; i < newEpSet.numOfEps; ++i) { vGTrace("vgId:%d, msg:%p redirect:%d ep:%s:%u", vgId, pMsg, i, newEpSet.eps[i].fqdn, newEpSet.eps[i].port); } - + pMsg->info.hasEpSet = 1; SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info}; tmsgSendRedirectRsp(&rsp, &newEpSet); } else { @@ -199,7 +199,7 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { } void vnodeApplyMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode *pVnode = pInfo->ahandle; + SVnode * pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -240,7 +240,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { STraceId *trace = &pMsg->info.traceId; do { - char *syncNodeStr = sync2SimpleStr(pVnode->sync); + char * syncNodeStr = sync2SimpleStr(pVnode->sync); static int64_t vndTick = 0; if (++vndTick % 10 == 1) { vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); @@ -375,7 +375,7 @@ static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReCon } static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { - SVnode *pVnode = pFsm->data; + SVnode * pVnode = pFsm->data; SSnapshot snapshot = {0}; SyncIndex beginIndex = SYNC_INDEX_INVALID; char logBuf[256] = {0}; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 5de907f8cb..b48939f9f9 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1014,19 +1014,28 @@ void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { } bool cliTryToExtractEpSet(STransMsg* pResp, SEpSet* dst) { - if (pResp == NULL || pResp->info.hasEpSet == 0) { + if ((pResp == NULL || pResp->info.hasEpSet == 0)) { + return false; + } + // rebuild resp msg + SEpSet epset; + if (tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epset) < 0) { return false; } - tDeserializeSEpSet(pResp->pCont, pResp->contLen, dst); int32_t tlen = tSerializeSEpSet(NULL, 0, dst); - int32_t bufLen = pResp->contLen - tlen; - char* buf = rpcMallocCont(bufLen); - - memcpy(buf, (char*)pResp->pCont + tlen, bufLen); + char* buf = NULL; + int32_t len = pResp->contLen - tlen; + if (len != 0) { + buf = rpcMallocCont(len); + memcpy(buf, (char*)pResp->pCont + tlen, len); + } + rpcFreeCont(pResp->pCont); pResp->pCont = buf; - pResp->contLen = bufLen; + pResp->contLen = len; + + *dst = epset; return true; } int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { From a535df75902d2fb9326012a5e4c7376ac45c86de Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 30 Jun 2022 11:04:49 +0800 Subject: [PATCH 12/68] feat: query redirect --- include/common/tmsg.h | 5 ++ include/libs/nodes/plannodes.h | 1 + source/common/src/tmsg.c | 2 + source/libs/executor/src/executorimpl.c | 35 ++++---- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesCodeFuncs.c | 6 ++ source/libs/qworker/inc/qwInt.h | 27 +++--- source/libs/qworker/src/qwDbg.c | 59 ++++++++++++- source/libs/qworker/src/qwMsg.c | 46 ++++++++++ source/libs/qworker/src/qwUtil.c | 28 +++--- source/libs/qworker/src/qworker.c | 35 +++++++- source/libs/scheduler/inc/schedulerInt.h | 27 +++--- source/libs/scheduler/src/schJob.c | 106 +++++++++++++---------- source/libs/scheduler/src/schRemote.c | 15 ++-- 14 files changed, 282 insertions(+), 111 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index c5b0b89311..2876105748 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1494,6 +1494,7 @@ typedef struct SSubQueryMsg { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; int8_t taskType; int8_t explain; uint32_t sqlLen; // the query sql, @@ -1513,6 +1514,7 @@ typedef struct { uint64_t sId; uint64_t queryId; uint64_t taskId; + int32_t execId; } SQueryContinueReq; typedef struct { @@ -1534,6 +1536,7 @@ typedef struct { uint64_t sId; uint64_t queryId; uint64_t taskId; + int32_t execId; } SResFetchReq; typedef struct { @@ -1545,6 +1548,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; int8_t status; } STaskStatus; @@ -1602,6 +1606,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; } STaskDropReq; typedef struct { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 4671c8b81e..8031b16d93 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -346,6 +346,7 @@ typedef struct SDownstreamSourceNode { SQueryNodeAddr addr; uint64_t taskId; uint64_t schedId; + int32_t execId; } SDownstreamSourceNode; typedef struct SExchangePhysiNode { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e9b5c67d76..23b33674e4 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4312,6 +4312,7 @@ int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pR if (tEncodeU64(&encoder, status->queryId) < 0) return -1; if (tEncodeU64(&encoder, status->taskId) < 0) return -1; if (tEncodeI64(&encoder, status->refId) < 0) return -1; + if (tEncodeI32(&encoder, status->execId) < 0) return -1; if (tEncodeI8(&encoder, status->status) < 0) return -1; } } else { @@ -4342,6 +4343,7 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp * if (tDecodeU64(&decoder, &status.queryId) < 0) return -1; if (tDecodeU64(&decoder, &status.taskId) < 0) return -1; if (tDecodeI64(&decoder, &status.refId) < 0) return -1; + if (tDecodeI32(&decoder, &status.execId) < 0) return -1; if (tDecodeI8(&decoder, &status.status) < 0) return -1; taosArrayPush(pRsp->taskStatus, &status); } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index c6f1096bfe..535272bc42 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2010,13 +2010,14 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); - qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", %d/%" PRIzu, GET_TASKID(pTaskInfo), - pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, sourceIndex, totalSources); + qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu, GET_TASKID(pTaskInfo), + pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, pSource->execId, sourceIndex, totalSources); pMsg->header.vgId = htonl(pSource->addr.nodeId); pMsg->sId = htobe64(pSource->schedId); pMsg->taskId = htobe64(pSource->taskId); pMsg->queryId = htobe64(pTaskInfo->id.queryId); + pMsg->execId = htonl(pSource->execId); // send the fetch remote task result reques SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); @@ -2145,9 +2146,9 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx SSDataBlock* pRes = pExchangeInfo->pResult; SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; if (pRsp->numOfRows == 0) { - qDebug("%s vgId:%d, taskId:0x%" PRIx64 " index:%d completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 + qDebug("%s vgId:%d, taskId:0x%" PRIx64 " execId:%d index:%d completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", completed:%d try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, i, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pDataInfo->totalRows, pExchangeInfo->loadInfo.totalRows, completed + 1, i + 1, totalSources); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; completed += 1; @@ -2165,17 +2166,17 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx } if (pRsp->completed == 1) { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d" " index:%d completed, numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 ", completed:%d try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, i, pRes->info.rows, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pRes->info.rows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, completed + 1, i + 1, totalSources); completed += 1; pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, totalRows:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 ", totalBytes:%" PRIu64, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pLoadInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pLoadInfo->totalRows, pLoadInfo->totalSize); } @@ -2249,8 +2250,8 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pExchangeInfo->current); if (pDataInfo->code != TSDB_CODE_SUCCESS) { - qError("%s vgId:%d, taskID:0x%" PRIx64 " error happens, code:%s", GET_TASKID(pTaskInfo), pSource->addr.nodeId, - pSource->taskId, tstrerror(pDataInfo->code)); + qError("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d error happens, code:%s", GET_TASKID(pTaskInfo), pSource->addr.nodeId, + pSource->taskId, pSource->execId, tstrerror(pDataInfo->code)); pOperator->pTaskInfo->code = pDataInfo->code; return NULL; } @@ -2258,9 +2259,9 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { SRetrieveTableRsp* pRsp = pDataInfo->pRsp; SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; if (pRsp->numOfRows == 0) { - qDebug("%s vgId:%d, taskID:0x%" PRIx64 " %d of total completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 + qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 " try next", - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pExchangeInfo->current + 1, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pExchangeInfo->current + 1, pDataInfo->totalRows, pLoadInfo->totalRows); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; @@ -2276,17 +2277,17 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { pTableRsp->compLen, pTableRsp->numOfCols, startTs, &pDataInfo->totalRows, NULL); if (pRsp->completed == 1) { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, rowsOfSource:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 " try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, pExchangeInfo->current + 1, totalSources); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; pExchangeInfo->current += 1; } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, totalRows:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 ", totalBytes:%" PRIu64, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pLoadInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pLoadInfo->totalRows, pLoadInfo->totalSize); } @@ -2378,7 +2379,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo* } for (int32_t i = 0; i < numOfSources; ++i) { - SNodeListNode* pNode = (SNodeListNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); + SDownstreamSourceNode* pNode = (SDownstreamSourceNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); taosArrayPush(pInfo->pSources, pNode); } diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index b372bf75fc..97b8baec58 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -582,6 +582,7 @@ static int32_t downstreamSourceCopy(const SDownstreamSourceNode* pSrc, SDownstre COPY_OBJECT_FIELD(addr, sizeof(SQueryNodeAddr)); COPY_SCALAR_FIELD(taskId); COPY_SCALAR_FIELD(schedId); + COPY_SCALAR_FIELD(execId); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index df7429bd88..4375a7b04c 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -3441,6 +3441,9 @@ static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->schedId); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->execId); + } return code; } @@ -3455,6 +3458,9 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceSchedId, &pNode->schedId); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetIntValue(pJson, jkDownstreamSourceSchedId, &pNode->execId); + } return code; } diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 4edd7a8a6e..4fa2615470 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -75,6 +75,7 @@ typedef struct SQWDebug { bool lockEnable; bool statusEnable; bool dumpEnable; + bool tmp; } SQWDebug; extern SQWDebug gQWDebug; @@ -122,6 +123,7 @@ typedef struct SQWTaskCtx { int8_t taskType; int8_t explain; int32_t queryType; + int32_t execId; bool queryFetched; bool queryEnd; @@ -200,8 +202,8 @@ typedef struct SQWorkerMgmt { int32_t paramIdx; } SQWorkerMgmt; -#define QW_FPARAMS_DEF SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId -#define QW_IDS() sId, qId, tId, rId +#define QW_FPARAMS_DEF SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId +#define QW_IDS() sId, qId, tId, rId, eId #define QW_FPARAMS() mgmt, QW_IDS() #define QW_STAT_INC(_item, _n) atomic_add_fetch_64(&(_item), _n) @@ -226,15 +228,18 @@ typedef struct SQWorkerMgmt { #define QW_TASK_READY(status) \ (status == JOB_TASK_STATUS_SUCCEED || status == JOB_TASK_STATUS_FAILED || status == JOB_TASK_STATUS_CANCELLED || \ status == JOB_TASK_STATUS_PARTIAL_SUCCEED) -#define QW_SET_QTID(id, qId, tId) \ - do { \ - *(uint64_t *)(id) = (qId); \ - *(uint64_t *)((char *)(id) + sizeof(qId)) = (tId); \ +#define QW_SET_QTID(id, qId, tId, eId) \ + do { \ + *(uint64_t *)(id) = (qId); \ + *(uint64_t *)((char *)(id) + sizeof(qId)) = (tId); \ + *(int32_t *)((char *)(id) + sizeof(qId) + sizeof(tId)) = (eId); \ } while (0) -#define QW_GET_QTID(id, qId, tId) \ - do { \ - (qId) = *(uint64_t *)(id); \ - (tId) = *(uint64_t *)((char *)(id) + sizeof(qId)); \ + +#define QW_GET_QTID(id, qId, tId, eId) \ + do { \ + (qId) = *(uint64_t *)(id); \ + (tId) = *(uint64_t *)((char *)(id) + sizeof(qId)); \ + (eId) = *(int32_t *)((char *)(id) + sizeof(qId) + sizeof(tId)); \ } while (0) #define QW_ERR_RET(c) \ @@ -365,6 +370,8 @@ void qwFreeTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx *ctx); void qwDbgDumpMgmtInfo(SQWorker *mgmt); int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore); +int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SEpSet *pEpSet); +int32_t qwAddTaskCtx(QW_FPARAMS_DEF); #ifdef __cplusplus diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index add9700a3a..0fa01a304c 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -9,7 +9,7 @@ #include "tmsg.h" #include "tname.h" -SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false}; +SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false, .tmp = true}; int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore) { if (!gQWDebug.statusEnable) { @@ -121,3 +121,60 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) { } +int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SEpSet *pEpSet) { + int32_t contLen = 0; + char* rsp = NULL; + + if (pEpSet) { + contLen = tSerializeSEpSet(NULL, 0, pEpSet); + rsp = rpcMallocCont(contLen); + tSerializeSEpSet(rsp, contLen, pEpSet); + } + + SRpcMsg rpcRsp = { + .msgType = rspType, + .pCont = rsp, + .contLen = contLen, + .code = code, + .info = *pConn, + }; + + tmsgSendRsp(&rpcRsp); + + qDebug("response %s msg, code: %s", TMSG_INFO(rspType), tstrerror(code)); + + return TSDB_CODE_SUCCESS; +} + + +int32_t qwDbgEnableDebug(char *option) { + if (0 == strcasecmp(option, "lock")) { + gQWDebug.lockEnable = true; + qDebug("qw lock debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "status")) { + gQWDebug.statusEnable = true; + qDebug("qw status debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "dump")) { + gQWDebug.dumpEnable = true; + qDebug("qw dump debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "tmp")) { + gQWDebug.tmp = true; + qDebug("qw tmp debug enabled"); + return TSDB_CODE_SUCCESS; + } + + qError("invalid qw debug option:%s", option); + + return TSDB_CODE_APP_ERROR; +} + + diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 30772ff1ac..cc642caa70 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -156,6 +156,41 @@ int32_t qwBuildAndSendDropRsp(SRpcHandleInfo *pConn, int32_t code) { return TSDB_CODE_SUCCESS; } +int32_t qwBuildAndSendDropMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { + STaskDropReq *req = (STaskDropReq *)rpcMallocCont(sizeof(STaskDropReq)); + if (NULL == req) { + QW_SCH_TASK_ELOG("rpcMallocCont %d failed", (int32_t)sizeof(STaskDropReq)); + QW_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + req->header.vgId = mgmt->nodeId; + req->sId = sId; + req->queryId = qId; + req->taskId = tId; + req->refId = rId; + req->execId = eId; + + SRpcMsg pNewMsg = { + .msgType = TDMT_SCH_DROP_TASK, + .pCont = req, + .contLen = sizeof(STaskDropReq), + .code = 0, + .info = *pConn, + }; + + int32_t code = tmsgPutToQueue(&mgmt->msgCb, FETCH_QUEUE, &pNewMsg); + if (TSDB_CODE_SUCCESS != code) { + QW_SCH_TASK_ELOG("put drop task msg to queue failed, vgId:%d, code:%s", mgmt->nodeId, tstrerror(code)); + rpcFreeCont(req); + QW_ERR_RET(code); + } + + QW_SCH_TASK_DLOG("drop task msg put to queue, vgId:%d", mgmt->nodeId); + + return TSDB_CODE_SUCCESS; +} + + int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { SQueryContinueReq *req = (SQueryContinueReq *)rpcMallocCont(sizeof(SQueryContinueReq)); if (NULL == req) { @@ -167,6 +202,7 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { req->sId = sId; req->queryId = qId; req->taskId = tId; + req->execId = eId; SRpcMsg pNewMsg = { .msgType = TDMT_SCH_QUERY_CONTINUE, @@ -266,6 +302,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); msg->phyLen = ntohl(msg->phyLen); msg->sqlLen = ntohl(msg->sqlLen); @@ -273,6 +310,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info}; @@ -295,6 +333,7 @@ int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; QW_SCH_TASK_DLOG("Abort prerocessQuery start, handle:%p", pMsg->info.handle); qwAbortPrerocessQuery(QW_FPARAMS()); @@ -324,6 +363,7 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info, .msgType = pMsg->msgType}; char * sql = strndup(msg->msg, msg->sqlLen); @@ -356,6 +396,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = 0; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -387,11 +428,13 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int msg->sId = be64toh(msg->sId); msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = 0; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -476,11 +519,13 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info}; @@ -553,6 +598,7 @@ int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SR uint64_t qId = req.queryId; uint64_t tId = req.taskId; int64_t rId = 0; + int32_t eId = 0; SQWMsg qwMsg = {.node = node, .msg = req.msg, .msgLen = req.phyLen, .connInfo = pMsg->info}; QW_SCH_TASK_DLOG("processDelete start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, req.sql); diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index 0759cf360a..1fb0a34314 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -135,8 +135,8 @@ int32_t qwAcquireScheduler(SQWorker *mgmt, uint64_t sId, int32_t rwType, SQWSchS void qwReleaseScheduler(int32_t rwType, SQWorker *mgmt) { QW_UNLOCK(rwType, &mgmt->schLock); } int32_t qwAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch, SQWTaskStatus **task) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); QW_LOCK(rwType, &sch->tasksLock); *task = taosHashGet(sch->tasksHash, id, sizeof(id)); @@ -151,8 +151,8 @@ int32_t qwAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch, S int32_t qwAddTaskStatusImpl(QW_FPARAMS_DEF, SQWSchStatus *sch, int32_t rwType, int32_t status, SQWTaskStatus **task) { int32_t code = 0; - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskStatus ntask = {0}; ntask.status = status; @@ -207,8 +207,8 @@ int32_t qwAddAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch void qwReleaseTaskStatus(int32_t rwType, SQWSchStatus *sch) { QW_UNLOCK(rwType, &sch->tasksLock); } int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); *ctx = taosHashAcquire(mgmt->ctxHash, id, sizeof(id)); if (NULL == (*ctx)) { @@ -220,8 +220,8 @@ int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { } int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); *ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id)); if (NULL == (*ctx)) { @@ -233,8 +233,8 @@ int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { } int32_t qwAddTaskCtxImpl(QW_FPARAMS_DEF, bool acquire, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskCtx nctx = {0}; @@ -314,8 +314,8 @@ void qwFreeTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { } int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskCtx octx; SQWTaskCtx *ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id)); @@ -348,8 +348,8 @@ int32_t qwDropTaskStatus(QW_FPARAMS_DEF) { SQWTaskStatus *task = NULL; int32_t code = 0; - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); if (qwAcquireScheduler(mgmt, sId, QW_WRITE, &sch)) { QW_TASK_WLOG_E("scheduler does not exist"); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 8ab293d0ad..2b23f7a27f 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -168,7 +168,7 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) // TODO GET EXECUTOR API TO GET MORE INFO - QW_GET_QTID(key, status.queryId, status.taskId); + QW_GET_QTID(key, status.queryId, status.taskId, status.execId); status.status = taskStatus->status; status.refId = taskStatus->refId; @@ -493,7 +493,9 @@ int32_t qwPrerocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo)); - QW_ERR_JRET(qwAddAcquireTaskCtx(QW_FPARAMS(), &ctx)); + QW_ERR_JRET(qwAddTaskCtx(QW_FPARAMS())); + + QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); ctx->ctrlConnInfo = qwMsg->connInfo; @@ -562,6 +564,33 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL)); } + + if (gQWDebug.tmp) { +#if 0 + SEpSet epSet = {0}; + epSet.inUse = 1; + epSet.numOfEps = 3; + strcpy(epSet.eps[0].fqdn, "localhost"); + epSet.eps[0].port = 7100; + strcpy(epSet.eps[1].fqdn, "localhost"); + epSet.eps[1].port = 7200; + strcpy(epSet.eps[2].fqdn, "localhost"); + epSet.eps[2].port = 7300; + + qwDbgBuildAndSendRedirectRsp(pMsg->msgType + 1, &pMsg->info, TSDB_CODE_RPC_REDIRECT, &epSet); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; +#else + if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType) { + ctx->phase = QW_PHASE_POST_QUERY; + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, NULL); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } +#endif + } + + _return: input.code = code; @@ -734,8 +763,6 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { SQWTaskCtx *ctx = NULL; bool locked = false; - // TODO : TASK ALREADY REMOVED AND A NEW DROP MSG RECEIVED - QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); QW_LOCK(QW_WRITE, &ctx->lock); diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 8dfc703dd9..8595e41640 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -125,7 +125,7 @@ typedef struct SSchTaskCallbackParam { uint64_t queryId; int64_t refId; uint64_t taskId; - int32_t execIdx; + int32_t execId; void *pTrans; } SSchTaskCallbackParam; @@ -171,7 +171,7 @@ typedef struct SSchTask { uint64_t taskId; // task id SRWLatch lock; // task lock int32_t maxExecTimes; // task may exec times - int32_t execIdx; // task current execute try index + int32_t execId; // task current execute try index SSchLevel *level; // level SRWLatch planLock; // task update plan lock SSubplan *plan; // subplan @@ -243,9 +243,9 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_START_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.execUseTime[idx] = us; \ - if (0 == (_task)->execIdx) { \ + if (0 == (_task)->execId) { \ (_task)->profile.startTs = us; \ } \ } while (0) @@ -253,7 +253,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_WAIT_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.waitTime += us - (_task)->profile.execUseTime[idx]; \ } while (0) @@ -261,12 +261,12 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_END_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.execUseTime[idx] = us - (_task)->profile.execUseTime[idx]; \ (_task)->profile.endTs = us; \ } while (0) -#define SCH_TASK_TIMEOUT(_task) ((taosGetTimestampUs() - (_task)->profile.execUseTime[(_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES]) > (_task)->timeoutUsec) +#define SCH_TASK_TIMEOUT(_task) ((taosGetTimestampUs() - (_task)->profile.execUseTime[(_task)->execId % SCH_TASK_MAX_EXEC_TIMES]) > (_task)->timeoutUsec) #define SCH_TASK_READY_FOR_LAUNCH(readyNum, task) ((readyNum) >= taosArrayGetSize((task)->children)) @@ -274,6 +274,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_UNLOCK_TASK(_task) SCH_UNLOCK(SCH_WRITE, &(_task)->lock) #define SCH_TASK_ID(_task) ((_task) ? (_task)->taskId : -1) +#define SCH_TASK_EID(_task) ((_task) ? (_task)->execId : -1) #define SCH_SET_TASK_LASTMSG_TYPE(_task, _type) do { if(_task) { atomic_store_32(&(_task)->lastMsgType, _type); } } while (0) #define SCH_GET_TASK_LASTMSG_TYPE(_task) ((_task) ? atomic_load_32(&(_task)->lastMsgType) : -1) @@ -318,13 +319,13 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 " " param, pJob->queryId, __VA_ARGS__) #define SCH_TASK_ELOG(param, ...) \ - qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_DLOG(param, ...) \ - qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_DLOGL(param, ...) \ - qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_WLOG(param, ...) \ - qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) #define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) @@ -366,7 +367,7 @@ void schProcessOnDataFetched(SSchJob *job); int32_t schGetTaskInJob(SSchJob *pJob, uint64_t taskId, SSchTask **pTask); void schFreeRpcCtxVal(const void *arg); int32_t schMakeBrokenLinkVal(SSchJob *pJob, SSchTask *pTask, SRpcBrokenlinkVal *brokenVal, bool isHb); -int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execIdx); +int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execId); int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync); int32_t schExecJobImpl(SSchedulerReq *pReq, SSchJob *pJob, bool sync); int32_t schUpdateJobStatus(SSchJob *pJob, int8_t newStatus); @@ -378,7 +379,7 @@ int32_t schExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes); int32_t schAsyncExecJob(SSchedulerReq *pReq, int64_t *pJob); int32_t schFetchRows(SSchJob *pJob); int32_t schAsyncFetchRows(SSchJob *pJob); -int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execIdx); +int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execId); int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList); void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo); char* schGetOpStr(SCH_OP_TYPE type); diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 643594f4e0..26824738e9 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -28,7 +28,7 @@ FORCE_INLINE int32_t schReleaseJob(int64_t refId) { qDebug("sch release jobId:0x int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel) { pTask->plan = pPlan; pTask->level = pLevel; - pTask->execIdx = -1; + pTask->execId = -1; pTask->maxExecTimes = SCH_TASK_MAX_EXEC_TIMES; pTask->timeoutUsec = SCH_DEFAULT_TASK_TIMEOUT_USEC; SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); @@ -428,59 +428,59 @@ int32_t schRecordTaskSucceedNode(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } -int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execIdx) { +int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execId) { SSchNodeInfo nodeInfo = {.addr = *addr, .handle = NULL}; - if (taosHashPut(pTask->execNodes, &execIdx, sizeof(execIdx), &nodeInfo, sizeof(nodeInfo))) { + if (taosHashPut(pTask->execNodes, &execId, sizeof(execId), &nodeInfo, sizeof(nodeInfo))) { SCH_TASK_ELOG("taosHashPut nodeInfo to execNodes failed, errno:%d", errno); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - SCH_TASK_DLOG("task execNode added, execIdx:%d", execIdx); + SCH_TASK_DLOG("task execNode added, execId:%d", execId); return TSDB_CODE_SUCCESS; } -int32_t schDropTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execIdx) { +int32_t schDropTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execId) { if (NULL == pTask->execNodes) { return TSDB_CODE_SUCCESS; } - if (taosHashRemove(pTask->execNodes, &execIdx, sizeof(execIdx))) { - SCH_TASK_ELOG("fail to remove execIdx %d from execNodeList", execIdx); + if (taosHashRemove(pTask->execNodes, &execId, sizeof(execId))) { + SCH_TASK_ELOG("fail to remove execId %d from execNodeList", execId); } else { - SCH_TASK_DLOG("execIdx %d removed from execNodeList", execIdx); + SCH_TASK_DLOG("execId %d removed from execNodeList", execId); } - if (execIdx != pTask->execIdx) { // ignore it - SCH_TASK_DLOG("execIdx %d is not current execIdx %d", execIdx, pTask->execIdx); + if (execId != pTask->execId) { // ignore it + SCH_TASK_DLOG("execId %d is not current execId %d", execId, pTask->execId); SCH_RET(TSDB_CODE_SCH_IGNORE_ERROR); } return TSDB_CODE_SUCCESS; } -int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execIdx) { +int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execId) { if (taosHashGetSize(pTask->execNodes) <= 0) { return TSDB_CODE_SUCCESS; } - SSchNodeInfo *nodeInfo = taosHashGet(pTask->execNodes, &execIdx, sizeof(execIdx)); + SSchNodeInfo *nodeInfo = taosHashGet(pTask->execNodes, &execId, sizeof(execId)); nodeInfo->handle = handle; - SCH_TASK_DLOG("handle updated to %p for execIdx %d", handle, execIdx); + SCH_TASK_DLOG("handle updated to %p for execId %d", handle, execId); return TSDB_CODE_SUCCESS; } -int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execIdx) { +int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execId) { if (dropExecNode) { - SCH_RET(schDropTaskExecNode(pJob, pTask, handle, execIdx)); + SCH_RET(schDropTaskExecNode(pJob, pTask, handle, execId)); } SCH_SET_TASK_HANDLE(pTask, handle); - schUpdateTaskExecNode(pJob, pTask, handle, execIdx); + schUpdateTaskExecNode(pJob, pTask, handle, execId); return TSDB_CODE_SUCCESS; } @@ -828,9 +828,9 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo } } - if ((pTask->execIdx + 1) >= pTask->maxExecTimes) { + if ((pTask->execId + 1) >= pTask->maxExecTimes) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since reach max try times, execIdx:%d", pTask->execIdx); + SCH_TASK_DLOG("task no more retry since reach max try times, execId:%d", pTask->execId); return TSDB_CODE_SUCCESS; } @@ -841,9 +841,9 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo } if (SCH_IS_DATA_SRC_TASK(pTask)) { - if ((pTask->execIdx + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { + if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since all ep tried, execIdx:%d, epNum:%d", pTask->execIdx, + SCH_TASK_DLOG("task no more retry since all ep tried, execId:%d, epNum:%d", pTask->execId, SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)); return TSDB_CODE_SUCCESS; } @@ -859,7 +859,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo } *needRetry = true; - SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execIdx + 1, errCode, tstrerror(errCode)); + SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode)); return TSDB_CODE_SUCCESS; } @@ -1171,6 +1171,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) { SDownstreamSourceNode source = {.type = QUERY_NODE_DOWNSTREAM_SOURCE, .taskId = pTask->taskId, .schedId = schMgmt.sId, + .execId = pTask->execId, .addr = pTask->succeedAddr}; qSetSubplanExecutionNode(parent->plan, pTask->plan->id.groupId, &source); SCH_UNLOCK(SCH_WRITE, &parent->lock); @@ -1256,7 +1257,7 @@ int32_t schRescheduleTask(SSchJob *pJob, SSchTask *pTask) { SCH_LOCK_TASK(pTask); if (SCH_TASK_TIMEOUT(pTask) && JOB_TASK_STATUS_EXECUTING == pTask->status && pJob->fetchTask != pTask && taosArrayGetSize(pTask->candidateAddrs) > 1) { - SCH_TASK_DLOG("task execIdx %d will be rescheduled now", pTask->execIdx); + SCH_TASK_DLOG("task execId %d will be rescheduled now", pTask->execId); schDropTaskOnExecNode(pJob, pTask); taosHashClear(pTask->execNodes); schProcessOnTaskFailure(pJob, pTask, TSDB_CODE_SCH_TIMEOUT_ERROR); @@ -1283,7 +1284,7 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { continue; } - SCH_JOB_DLOG("TID:0x%" PRIx64 " task status in server: %s", taskStatus->taskId, jobTaskStatusStr(taskStatus->status)); + SCH_JOB_DLOG("TID:0x%" PRIx64 "EID:%d task status in server: %s", taskStatus->taskId, taskStatus->execId, jobTaskStatusStr(taskStatus->status)); pTask = NULL; schGetTaskInJob(pJob, taskStatus->taskId, &pTask); @@ -1292,6 +1293,13 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { schReleaseJob(taskStatus->refId); continue; } + + if (taskStatus->execId != pTask->execId) { + // TODO DROP TASK FROM SERVER!!!! + SCH_TASK_DLOG("EID %d in hb rsp mis-match", taskStatus->execId); + schReleaseJob(taskStatus->refId); + continue; + } if (taskStatus->status == JOB_TASK_STATUS_FAILED) { // RECORD AND HANDLE ERROR!!!! @@ -1362,9 +1370,9 @@ int32_t schLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) { int32_t code = 0; atomic_add_fetch_32(&pTask->level->taskLaunchedNum, 1); - pTask->execIdx++; + pTask->execId++; - SCH_TASK_DLOG("start to launch task's %dth exec", pTask->execIdx); + SCH_TASK_DLOG("start to launch task's %dth exec", pTask->execId); SCH_LOG_TASK_START_TS(pTask); @@ -1677,10 +1685,14 @@ _return: int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { int32_t code = 0; + int8_t status = 0; + if (schJobNeedToStop(pJob, &status)) { + SCH_TASK_ELOG("redirect will no continue cause of job status %s", jobTaskStatusStr(status)); + SCH_RET(atomic_load_32(&pJob->errCode)); + } - if ((pTask->execIdx + 1) >= pTask->maxExecTimes) { - SCH_TASK_DLOG("task no more retry since reach max try times, execIdx:%d", pTask->execIdx); - SCH_UNLOCK_TASK(pTask); + if ((pTask->execId + 1) >= pTask->maxExecTimes) { + SCH_TASK_DLOG("task no more retry since reach max try times, execId:%d", pTask->execId); schProcessOnJobFailure(pJob, rspCode); return TSDB_CODE_SUCCESS; } @@ -1703,34 +1715,36 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { SCH_ERR_JRET(schLaunchTasksInFlowCtrlList(pJob, pTask)); } } - } else { - pTask->childReady = 0; + + SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); - int32_t childrenNum = taosArrayGetSize(pTask->children); - for (int32_t i = 0; i < childrenNum; ++i) { - SSchTask* pChild = taosArrayGetP(pTask->children, i); - SCH_LOCK_TASK(pChild); - code = schDoTaskRedirect(pJob, pChild, rspCode); - SCH_UNLOCK_TASK(pChild); - SCH_ERR_JRET(code); - } - - qClearSubplanExecutionNode(pTask->plan); + SCH_ERR_JRET(schLaunchTask(pJob, pTask)); + + return TSDB_CODE_SUCCESS; } + + // merge plan + + pTask->childReady = 0; + + qClearSubplanExecutionNode(pTask->plan); + SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); - SCH_ERR_JRET(schLaunchTask(pJob, pTask)); - - SCH_UNLOCK_TASK(pTask); + int32_t childrenNum = taosArrayGetSize(pTask->children); + for (int32_t i = 0; i < childrenNum; ++i) { + SSchTask* pChild = taosArrayGetP(pTask->children, i); + SCH_LOCK_TASK(pChild); + schDoTaskRedirect(pJob, pChild, rspCode); + SCH_UNLOCK_TASK(pChild); + } return TSDB_CODE_SUCCESS; _return: code = schProcessOnTaskFailure(pJob, pTask, code); - - SCH_UNLOCK_TASK(pTask); SCH_RET(code); } @@ -1747,7 +1761,7 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32 SCH_ERR_JRET(schUpdateTaskCandidateAddr(pJob, pTask, pData->pEpSet)); } - schDoTaskRedirect(pJob, pTask, rspCode); + SCH_RET(schDoTaskRedirect(pJob, pTask, rspCode)); _return: diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 3688cb0240..3d547ffbf8 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -379,13 +379,13 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SCH_TASK_DLOG("rsp msg received, type:%s, handle:%p, code:%s", TMSG_INFO(msgType), pMsg->handle, tstrerror(rspCode)); - if (pParam->execIdx != pTask->execIdx) { - SCH_TASK_DLOG("execIdx %d mis-match current execIdx %d", pParam->execIdx, pTask->execIdx); + if (pParam->execId != pTask->execId) { + SCH_TASK_DLOG("execId %d mis-match current execId %d", pParam->execId, pTask->execId); goto _return; } bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || SCH_NETWORK_ERR(rspCode)); - SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execIdx)); + SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execId)); int8_t status = 0; if (schJobNeedToStop(pJob, &status)) { @@ -401,7 +401,7 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { goto _return; } - SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode)); + code = schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode); pMsg->pData = NULL; _return: @@ -458,7 +458,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo param->refId = pJob->refId; param->taskId = SCH_TASK_ID(pTask); param->pTrans = pJob->conn.pTrans; - param->execIdx = pTask->execIdx; + param->execId = pTask->execId; *pParam = param; return TSDB_CODE_SUCCESS; @@ -1015,6 +1015,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); pMsg->refId = htobe64(pJob->refId); + pMsg->execId = htonl(pTask->execId); pMsg->taskType = TASK_TYPE_TEMP; pMsg->explain = SCH_IS_EXPLAIN_JOB(pJob); pMsg->phyLen = htonl(pTask->msgLen); @@ -1041,6 +1042,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->sId = htobe64(schMgmt.sId); pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); + pMsg->execId = htonl(pTask->execId); break; } @@ -1060,6 +1062,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); pMsg->refId = htobe64(pJob->refId); + pMsg->execId = htobe64(pTask->execId); break; } case TDMT_SCH_QUERY_HEARTBEAT: { @@ -1102,7 +1105,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, (rpcCtx.args ? &rpcCtx : NULL))); if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY) { - SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execIdx)); + SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execId)); } return TSDB_CODE_SUCCESS; From 1a8cf049b7cd653c7e6fda116f314f7092359abd Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 30 Jun 2022 13:39:13 +0800 Subject: [PATCH 13/68] refactor(sync): add syncAppendEntriesBatch --- include/common/tmsgdef.h | 1 + include/libs/sync/syncTools.h | 27 ++ source/libs/sync/inc/syncSnapshot.h | 14 +- source/libs/sync/src/syncMessage.c | 275 +++++++++++++++++- source/libs/sync/src/syncRaftCfg.c | 8 +- source/libs/sync/src/syncSnapshot.c | 10 +- source/libs/sync/test/CMakeLists.txt | 14 + .../sync/test/syncAppendEntriesBatchTest.cpp | 139 +++++++++ 8 files changed, 471 insertions(+), 17 deletions(-) create mode 100644 source/libs/sync/test/syncAppendEntriesBatchTest.cpp diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index acf08bd47e..926d4eb51f 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -236,6 +236,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SYNC_REQUEST_VOTE, "sync-request-vote", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_REQUEST_VOTE_REPLY, "sync-request-vote-reply", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_APPEND_ENTRIES, "sync-append-entries", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SYNC_APPEND_ENTRIES_BATCH, "sync-append-entries-batch", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_APPEND_ENTRIES_REPLY, "sync-append-entries-reply", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_NOOP, "sync-noop", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_UNKNOWN, "sync-unknown", NULL, NULL) diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 46f279ed85..8975f930db 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -325,22 +325,49 @@ void syncAppendEntriesLog(const SyncAppendEntries* pMsg); void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg); // --------------------------------------------- +typedef struct SOffsetAndContLen { + int32_t offset; + int32_t contLen; +} SOffsetAndContLen; + typedef struct SyncAppendEntriesBatch { uint32_t bytes; int32_t vgId; uint32_t msgType; SRaftId srcId; SRaftId destId; + // private data SyncTerm term; SyncIndex prevLogIndex; SyncTerm prevLogTerm; SyncIndex commitIndex; SyncTerm privateTerm; + int32_t dataCount; uint32_t dataLen; char data[]; } SyncAppendEntriesBatch; +SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId); +void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchSerialize(const SyncAppendEntriesBatch* pMsg, char* buf, uint32_t bufLen); +void syncAppendEntriesBatchDeserialize(const char* buf, uint32_t len, SyncAppendEntriesBatch* pMsg); +char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint32_t* len); +SyncAppendEntriesBatch* syncAppendEntriesBatchDeserialize2(const char* buf, uint32_t len); +void syncAppendEntriesBatch2RpcMsg(const SyncAppendEntriesBatch* pMsg, SRpcMsg* pRpcMsg); +void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesBatch* pMsg); +SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg); +cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg); +char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatch2RpcMsgArray(SyncAppendEntriesBatch* pSyncMsg, SRpcMsg* rpcMsgArr, int32_t maxArrSize, + int32_t* pRetArrSize); + +// for debug ---------------------- +void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg); + // --------------------------------------------- typedef struct SyncAppendEntriesReply { uint32_t bytes; diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 14688f8912..a9b4470b42 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -40,8 +40,8 @@ typedef struct SSyncSnapshotSender { bool start; int32_t seq; int32_t ack; - void *pReader; - void *pCurrentBlock; + void * pReader; + void * pCurrentBlock; int32_t blockLen; SSnapshot snapshot; SSyncCfg lastConfig; @@ -62,14 +62,14 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender); int32_t snapshotReSend(SSyncSnapshotSender *pSender); cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender); -char *snapshotSender2Str(SSyncSnapshotSender *pSender); -char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event); +char * snapshotSender2Str(SSyncSnapshotSender *pSender); +char * snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event); //--------------------------------------------------- typedef struct SSyncSnapshotReceiver { bool start; int32_t ack; - void *pWriter; + void * pWriter; SyncTerm term; SyncTerm privateTerm; SSnapshot snapshot; @@ -85,8 +85,8 @@ bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver); -char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver); -char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event); +char * snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver); +char * snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event); //--------------------------------------------------- // on message diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 119a178893..acece6d48a 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -591,7 +591,7 @@ void syncPingReplySerialize(const SyncPingReply* pMsg, char* buf, uint32_t bufLe void syncPingReplyDeserialize(const char* buf, uint32_t len, SyncPingReply* pMsg) { memcpy(pMsg, buf, len); ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncPing) + pMsg->dataLen); + ASSERT(pMsg->bytes == sizeof(SyncPingReply) + pMsg->dataLen); } char* syncPingReplySerialize2(const SyncPingReply* pMsg, uint32_t* len) { @@ -1426,6 +1426,279 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg) { } } +// ---- message process SyncAppendEntriesBatch---- + +// block1: SOffsetAndContLen +// block2: SOffsetAndContLen Array +// block3: SRpcMsg Array +// block4: SRpcMsg pCont Array + +SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId) { + ASSERT(rpcMsgArr != NULL); + ASSERT(arrSize > 0); + + int32_t dataLen = 0; + int32_t metaArrayLen = sizeof(SOffsetAndContLen) * arrSize; // + int32_t rpcArrayLen = sizeof(SRpcMsg) * arrSize; // SRpcMsg + int32_t contArrayLen = 0; + for (int i = 0; i < arrSize; ++i) { // SRpcMsg pCont + contArrayLen += rpcMsgArr[i].contLen; + } + dataLen += (metaArrayLen + rpcArrayLen + contArrayLen); + + uint32_t bytes = sizeof(SyncAppendEntriesBatch) + dataLen; + SyncAppendEntriesBatch* pMsg = taosMemoryMalloc(bytes); + memset(pMsg, 0, bytes); + pMsg->bytes = bytes; + pMsg->vgId = vgId; + pMsg->msgType = TDMT_SYNC_APPEND_ENTRIES_BATCH; + pMsg->dataCount = arrSize; + pMsg->dataLen = dataLen; + + SOffsetAndContLen* metaArr = (SOffsetAndContLen*)(pMsg->data); + SRpcMsg* msgArr = (SRpcMsg*)((char*)(pMsg->data) + metaArrayLen); + char* pData = pMsg->data; + + for (int i = 0; i < arrSize; ++i) { + // init + if (i == 0) { + metaArr[i].offset = metaArrayLen + rpcArrayLen; + metaArr[i].contLen = rpcMsgArr[i].contLen; + } else { + metaArr[i].offset = metaArr[i - 1].offset + metaArr[i - 1].contLen; + metaArr[i].contLen = rpcMsgArr[i].contLen; + } + + // init msgArr + msgArr[i] = rpcMsgArr[i]; + + // init data + ASSERT(rpcMsgArr[i].contLen == metaArr[i].contLen); + memcpy(pData + metaArr[i].offset, rpcMsgArr[i].pCont, rpcMsgArr[i].contLen); + } + + return pMsg; +} + +void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg) { + if (pMsg != NULL) { + taosMemoryFree(pMsg); + } +} + +void syncAppendEntriesBatchSerialize(const SyncAppendEntriesBatch* pMsg, char* buf, uint32_t bufLen) { + ASSERT(pMsg->bytes <= bufLen); + memcpy(buf, pMsg, pMsg->bytes); +} + +void syncAppendEntriesBatchDeserialize(const char* buf, uint32_t len, SyncAppendEntriesBatch* pMsg) { + memcpy(pMsg, buf, len); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncAppendEntriesBatch) + pMsg->dataLen); +} + +char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint32_t* len) { + char* buf = taosMemoryMalloc(pMsg->bytes); + ASSERT(buf != NULL); + syncAppendEntriesBatchSerialize(pMsg, buf, pMsg->bytes); + if (len != NULL) { + *len = pMsg->bytes; + } + return buf; +} + +SyncAppendEntriesBatch* syncAppendEntriesBatchDeserialize2(const char* buf, uint32_t len) { + uint32_t bytes = *((uint32_t*)buf); + SyncAppendEntriesBatch* pMsg = taosMemoryMalloc(bytes); + ASSERT(pMsg != NULL); + syncAppendEntriesBatchDeserialize(buf, len, pMsg); + ASSERT(len == pMsg->bytes); + return pMsg; +} + +void syncAppendEntriesBatch2RpcMsg(const SyncAppendEntriesBatch* pMsg, SRpcMsg* pRpcMsg) { + memset(pRpcMsg, 0, sizeof(*pRpcMsg)); + pRpcMsg->msgType = pMsg->msgType; + pRpcMsg->contLen = pMsg->bytes; + pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); + syncAppendEntriesBatchSerialize(pMsg, pRpcMsg->pCont, pRpcMsg->contLen); +} + +void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesBatch* pMsg) { + syncAppendEntriesBatchDeserialize(pRpcMsg->pCont, pRpcMsg->contLen, pMsg); +} + +SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg) { + SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + ASSERT(pMsg != NULL); + return pMsg; +} + +cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pMsg != NULL) { + cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); + cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); + cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); + + cJSON* pSrcId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->srcId.addr); + cJSON_AddStringToObject(pSrcId, "addr", u64buf); + { + uint64_t u64 = pMsg->srcId.addr; + cJSON* pTmp = pSrcId; + char host[128] = {0}; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId); + cJSON_AddItemToObject(pRoot, "srcId", pSrcId); + + cJSON* pDestId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->destId.addr); + cJSON_AddStringToObject(pDestId, "addr", u64buf); + { + uint64_t u64 = pMsg->destId.addr; + cJSON* pTmp = pDestId; + char host[128] = {0}; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); + cJSON_AddItemToObject(pRoot, "destId", pDestId); + + snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%ld", pMsg->prevLogIndex); + cJSON_AddStringToObject(pRoot, "prevLogIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->prevLogTerm); + cJSON_AddStringToObject(pRoot, "prevLogTerm", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%ld", pMsg->commitIndex); + cJSON_AddStringToObject(pRoot, "commitIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->privateTerm); + cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + + cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); + cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); + + int32_t metaArrayLen = sizeof(SOffsetAndContLen) * pMsg->dataCount; // + int32_t rpcArrayLen = sizeof(SRpcMsg) * pMsg->dataCount; // SRpcMsg + int32_t contArrayLen = pMsg->dataLen - metaArrayLen - rpcArrayLen; + + cJSON_AddNumberToObject(pRoot, "metaArrayLen", metaArrayLen); + cJSON_AddNumberToObject(pRoot, "rpcArrayLen", rpcArrayLen); + cJSON_AddNumberToObject(pRoot, "contArrayLen", contArrayLen); + + SOffsetAndContLen* metaArr = (SOffsetAndContLen*)(pMsg->data); + SRpcMsg* msgArr = (SRpcMsg*)(pMsg->data + metaArrayLen); + void* pData = (void*)(pMsg->data + metaArrayLen + rpcArrayLen); + + cJSON* pMetaArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pMeta = cJSON_CreateObject(); + cJSON_AddNumberToObject(pMeta, "offset", metaArr[i].offset); + cJSON_AddNumberToObject(pMeta, "contLen", metaArr[i].contLen); + cJSON_AddItemToArray(pMetaArr, pMeta); + } + + cJSON* pMsgArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "msgArr", pMsgArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pRpcMsgJson = cJSON_CreateObject(); + cJSON_AddNumberToObject(pRpcMsgJson, "code", msgArr[i].code); + cJSON_AddNumberToObject(pRpcMsgJson, "contLen", msgArr[i].contLen); + cJSON_AddNumberToObject(pRpcMsgJson, "msgType", msgArr[i].msgType); + cJSON_AddItemToArray(pMsgArr, pRpcMsgJson); + } + + char* s; + s = syncUtilprintBin((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data", s); + taosMemoryFree(s); + s = syncUtilprintBin2((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data2", s); + taosMemoryFree(s); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SyncAppendEntriesBatch", pRoot); + return pJson; +} + +char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg) { + cJSON* pJson = syncAppendEntriesBatch2Json(pMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +void syncAppendEntriesBatch2RpcMsgArray(SyncAppendEntriesBatch* pSyncMsg, SRpcMsg* rpcMsgArr, int32_t maxArrSize, + int32_t* pRetArrSize) { + if (pRetArrSize != NULL) { + *pRetArrSize = pSyncMsg->dataCount; + } + + int32_t arrSize = pSyncMsg->dataCount; + if (arrSize > maxArrSize) { + arrSize = maxArrSize; + } + + int32_t metaArrayLen = sizeof(SOffsetAndContLen) * pSyncMsg->dataCount; // + int32_t rpcArrayLen = sizeof(SRpcMsg) * pSyncMsg->dataCount; // SRpcMsg + int32_t contArrayLen = pSyncMsg->dataLen - metaArrayLen - rpcArrayLen; + + SOffsetAndContLen* metaArr = (SOffsetAndContLen*)(pSyncMsg->data); + SRpcMsg* msgArr = (SRpcMsg*)(pSyncMsg->data + metaArrayLen); + void* pData = pSyncMsg->data + metaArrayLen + rpcArrayLen; + + for (int i = 0; i < arrSize; ++i) { + rpcMsgArr[i] = msgArr[i]; + rpcMsgArr[i].pCont = rpcMallocCont(msgArr[i].contLen); + void* pRpcCont = pSyncMsg->data + metaArr[i].offset; + memcpy(rpcMsgArr[i].pCont, pRpcCont, rpcMsgArr[i].contLen); + } +} + +// for debug ---------------------- +void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + printf("syncAppendEntriesBatchPrint | len:%lu | %s \n", strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + printf("syncAppendEntriesBatchPrint2 | len:%lu | %s | %s \n", strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + sTrace("syncAppendEntriesBatchLog | len:%lu | %s", strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + sTraceLong("syncAppendEntriesBatchLog2 | len:%lu | %s | %s", strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + // ---- message process SyncAppendEntriesReply---- SyncAppendEntriesReply* syncAppendEntriesReplyBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncAppendEntriesReply); diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index 43890c196c..ec3f18132d 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -101,7 +101,7 @@ cJSON *syncCfg2Json(SSyncCfg *pSyncCfg) { char *syncCfg2Str(SSyncCfg *pSyncCfg) { cJSON *pJson = syncCfg2Json(pSyncCfg); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -109,7 +109,7 @@ char *syncCfg2Str(SSyncCfg *pSyncCfg) { char *syncCfg2SimpleStr(SSyncCfg *pSyncCfg) { if (pSyncCfg != NULL) { int32_t len = 512; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); memset(s, 0, len); snprintf(s, len, "{replica-num:%d, my-index:%d, ", pSyncCfg->replicaNum, pSyncCfg->myIndex); @@ -205,7 +205,7 @@ cJSON *raftCfg2Json(SRaftCfg *pRaftCfg) { char *raftCfg2Str(SRaftCfg *pRaftCfg) { cJSON *pJson = raftCfg2Json(pRaftCfg); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -280,7 +280,7 @@ int32_t raftCfgFromJson(const cJSON *pRoot, SRaftCfg *pRaftCfg) { (pRaftCfg->configIndexArr)[i] = atoll(pIndex->valuestring); } - cJSON *pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); + cJSON * pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); int32_t code = syncCfgFromJson(pJsonSyncCfg, &(pRaftCfg->cfg)); ASSERT(code == 0); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 70f3801e61..56f5aaa239 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -349,14 +349,14 @@ cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) { char *snapshotSender2Str(SSyncSnapshotSender *pSender) { cJSON *pJson = snapshotSender2Json(pSender); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) { int32_t len = 256; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); SRaftId destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; char host[64]; @@ -604,7 +604,7 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { cJSON_AddStringToObject(pFromId, "addr", u64buf); { uint64_t u64 = pReceiver->fromId.addr; - cJSON *pTmp = pFromId; + cJSON * pTmp = pFromId; char host[128] = {0}; uint16_t port; syncUtilU642Addr(u64, host, sizeof(host), &port); @@ -637,14 +637,14 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) { cJSON *pJson = snapshotReceiver2Json(pReceiver); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event) { int32_t len = 256; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); SRaftId fromId = pReceiver->fromId; char host[128]; diff --git a/source/libs/sync/test/CMakeLists.txt b/source/libs/sync/test/CMakeLists.txt index bc63462a9e..c549b78399 100644 --- a/source/libs/sync/test/CMakeLists.txt +++ b/source/libs/sync/test/CMakeLists.txt @@ -21,6 +21,7 @@ add_executable(syncEntryCacheTest "") add_executable(syncRequestVoteTest "") add_executable(syncRequestVoteReplyTest "") add_executable(syncAppendEntriesTest "") +add_executable(syncAppendEntriesBatchTest "") add_executable(syncAppendEntriesReplyTest "") add_executable(syncClientRequestTest "") add_executable(syncTimeoutTest "") @@ -146,6 +147,10 @@ target_sources(syncAppendEntriesTest PRIVATE "syncAppendEntriesTest.cpp" ) +target_sources(syncAppendEntriesBatchTest + PRIVATE + "syncAppendEntriesBatchTest.cpp" +) target_sources(syncAppendEntriesReplyTest PRIVATE "syncAppendEntriesReplyTest.cpp" @@ -387,6 +392,11 @@ target_include_directories(syncAppendEntriesTest "${TD_SOURCE_DIR}/include/libs/sync" "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) +target_include_directories(syncAppendEntriesBatchTest + PUBLIC + "${TD_SOURCE_DIR}/include/libs/sync" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" +) target_include_directories(syncAppendEntriesReplyTest PUBLIC "${TD_SOURCE_DIR}/include/libs/sync" @@ -636,6 +646,10 @@ target_link_libraries(syncAppendEntriesTest sync gtest_main ) +target_link_libraries(syncAppendEntriesBatchTest + sync + gtest_main +) target_link_libraries(syncAppendEntriesReplyTest sync gtest_main diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp new file mode 100644 index 0000000000..8784ddd637 --- /dev/null +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -0,0 +1,139 @@ +//#include +#include +#include "syncIO.h" +#include "syncInt.h" +#include "syncMessage.h" +#include "syncUtil.h" +#include "trpc.h" + +void logTest() { + sTrace("--- sync log test: trace"); + sDebug("--- sync log test: debug"); + sInfo("--- sync log test: info"); + sWarn("--- sync log test: warn"); + sError("--- sync log test: error"); + sFatal("--- sync log test: fatal"); +} + +SRpcMsg *createRpcMsg(int32_t i, int32_t dataLen) { + SRpcMsg *pRpcMsg = (SRpcMsg *)taosMemoryMalloc(sizeof(SRpcMsg)); + memset(pRpcMsg, 0, sizeof(SRpcMsg)); + + pRpcMsg->msgType = TDMT_SYNC_PING; + pRpcMsg->contLen = dataLen; + pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); + pRpcMsg->code = 10 * i; + snprintf((char *)pRpcMsg->pCont, pRpcMsg->contLen, "value_%d", i); + + return pRpcMsg; +} + +SyncAppendEntriesBatch *createMsg() { + SRpcMsg rpcMsgArr[5]; + memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); + + for (int32_t i = 0; i < 5; ++i) { + SRpcMsg *pRpcMsg = createRpcMsg(i, 20); + rpcMsgArr[i] = *pRpcMsg; + taosMemoryFree(pRpcMsg); + } + + SyncAppendEntriesBatch *pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, 5, 1234); + pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234); + pMsg->srcId.vgId = 100; + pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678); + pMsg->destId.vgId = 100; + pMsg->prevLogIndex = 11; + pMsg->prevLogTerm = 22; + pMsg->commitIndex = 33; + pMsg->privateTerm = 44; + return pMsg; +} + +void test1() { + SyncAppendEntriesBatch *pMsg = createMsg(); + syncAppendEntriesBatchLog2((char *)"test1:", pMsg); + + SRpcMsg rpcMsgArr[5]; + int32_t retArrSize; + syncAppendEntriesBatch2RpcMsgArray(pMsg, rpcMsgArr, 5, &retArrSize); + for (int i = 0; i < retArrSize; ++i) { + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), "==test1 decode rpc msg %d: msgType:%d, code:%d, contLen:%d, pCont:%s \n", i, + rpcMsgArr[i].msgType, rpcMsgArr[i].code, rpcMsgArr[i].contLen, (char *)rpcMsgArr[i].pCont); + sTrace("%s", logBuf); + } + + syncAppendEntriesBatchDestroy(pMsg); +} + +/* +void test2() { + SyncAppendEntries *pMsg = createMsg(); + uint32_t len = pMsg->bytes; + char * serialized = (char *)taosMemoryMalloc(len); + syncAppendEntriesSerialize(pMsg, serialized, len); + SyncAppendEntries *pMsg2 = syncAppendEntriesBuild(pMsg->dataLen, 1000); + syncAppendEntriesDeserialize(serialized, len, pMsg2); + syncAppendEntriesLog2((char *)"test2: syncAppendEntriesSerialize -> syncAppendEntriesDeserialize ", pMsg2); + + taosMemoryFree(serialized); + syncAppendEntriesDestroy(pMsg); + syncAppendEntriesDestroy(pMsg2); +} + +void test3() { + SyncAppendEntries *pMsg = createMsg(); + uint32_t len; + char * serialized = syncAppendEntriesSerialize2(pMsg, &len); + SyncAppendEntries *pMsg2 = syncAppendEntriesDeserialize2(serialized, len); + syncAppendEntriesLog2((char *)"test3: syncAppendEntriesSerialize3 -> syncAppendEntriesDeserialize2 ", pMsg2); + + taosMemoryFree(serialized); + syncAppendEntriesDestroy(pMsg); + syncAppendEntriesDestroy(pMsg2); +} + +void test4() { + SyncAppendEntries *pMsg = createMsg(); + SRpcMsg rpcMsg; + syncAppendEntries2RpcMsg(pMsg, &rpcMsg); + SyncAppendEntries *pMsg2 = (SyncAppendEntries *)taosMemoryMalloc(rpcMsg.contLen); + syncAppendEntriesFromRpcMsg(&rpcMsg, pMsg2); + syncAppendEntriesLog2((char *)"test4: syncAppendEntries2RpcMsg -> syncAppendEntriesFromRpcMsg ", pMsg2); + + rpcFreeCont(rpcMsg.pCont); + syncAppendEntriesDestroy(pMsg); + syncAppendEntriesDestroy(pMsg2); +} + +void test5() { + SyncAppendEntries *pMsg = createMsg(); + SRpcMsg rpcMsg; + syncAppendEntries2RpcMsg(pMsg, &rpcMsg); + SyncAppendEntries *pMsg2 = syncAppendEntriesFromRpcMsg2(&rpcMsg); + syncAppendEntriesLog2((char *)"test5: syncAppendEntries2RpcMsg -> syncAppendEntriesFromRpcMsg2 ", pMsg2); + + rpcFreeCont(rpcMsg.pCont); + syncAppendEntriesDestroy(pMsg); + syncAppendEntriesDestroy(pMsg2); +} +*/ + +int main() { + gRaftDetailLog = true; + tsAsyncLog = 0; + sDebugFlag = DEBUG_DEBUG + DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; + logTest(); + + test1(); + + /* + test2(); + test3(); + test4(); + test5(); + */ + + return 0; +} From 47bc36872f47cb2338e29f3f24a4f90ea1bf09d1 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 30 Jun 2022 13:44:26 +0800 Subject: [PATCH 14/68] feat: query redirect --- include/common/tmsg.h | 1 + source/client/src/clientImpl.c | 4 ++-- source/libs/nodes/src/nodesCodeFuncs.c | 5 +++-- source/libs/qworker/inc/qwInt.h | 20 ++++++++--------- source/libs/qworker/src/qwMsg.c | 4 +++- source/libs/qworker/src/qworker.c | 30 ++++++++++++++------------ source/libs/scheduler/src/schJob.c | 5 +++-- source/libs/scheduler/src/schRemote.c | 2 +- 8 files changed, 39 insertions(+), 32 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 2876105748..4ba668cbf5 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1594,6 +1594,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; } STaskCancelReq; typedef struct { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b20fd4b9b0..51e43f927b 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1294,10 +1294,10 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { */ int32_t elapsed = pRequest->metric.rsp - pRequest->metric.start; if (pMsg->code == TSDB_CODE_SUCCESS) { - tscDebug("0x%" PRIx64 " message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self, + tscDebug("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self, TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId); } else { - tscError("0x%" PRIx64 " SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self, TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId); } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 4375a7b04c..72263feea1 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -3430,6 +3430,7 @@ static int32_t jsonToSlotDescNode(const SJson* pJson, void* pObj) { static const char* jkDownstreamSourceAddr = "Addr"; static const char* jkDownstreamSourceTaskId = "TaskId"; static const char* jkDownstreamSourceSchedId = "SchedId"; +static const char* jkDownstreamSourceExecId = "ExecId"; static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) { const SDownstreamSourceNode* pNode = (const SDownstreamSourceNode*)pObj; @@ -3442,7 +3443,7 @@ static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->schedId); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->execId); + code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceExecId, pNode->execId); } return code; @@ -3459,7 +3460,7 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) { code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceSchedId, &pNode->schedId); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetIntValue(pJson, jkDownstreamSourceSchedId, &pNode->execId); + code = tjsonGetIntValue(pJson, jkDownstreamSourceExecId, &pNode->execId); } return code; diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 4fa2615470..6faffa13b3 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -281,22 +281,22 @@ typedef struct SQWorkerMgmt { #define QW_SCH_ELOG(param, ...) qError("QW:%p SID:%" PRIx64 " " param, mgmt, sId, __VA_ARGS__) #define QW_SCH_DLOG(param, ...) qDebug("QW:%p SID:%" PRIx64 " " param, mgmt, sId, __VA_ARGS__) -#define QW_TASK_ELOG(param, ...) qError("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) -#define QW_TASK_WLOG(param, ...) qWarn("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) -#define QW_TASK_DLOG(param, ...) qDebug("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) +#define QW_TASK_ELOG(param, ...) qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) +#define QW_TASK_WLOG(param, ...) qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) +#define QW_TASK_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) #define QW_TASK_DLOGL(param, ...) \ - qDebugL("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) + qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) -#define QW_TASK_ELOG_E(param) qError("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) -#define QW_TASK_WLOG_E(param) qWarn("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) -#define QW_TASK_DLOG_E(param) qDebug("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) +#define QW_TASK_ELOG_E(param) qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) +#define QW_TASK_WLOG_E(param) qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) +#define QW_TASK_DLOG_E(param) qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) #define QW_SCH_TASK_ELOG(param, ...) \ - qError("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qError("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_WLOG(param, ...) \ - qWarn("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qWarn("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_DLOG(param, ...) \ - qDebug("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qDebug("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_LOCK_DEBUG(...) \ do { \ diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index cc642caa70..cc4228f7c7 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -480,11 +480,13 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -598,7 +600,7 @@ int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SR uint64_t qId = req.queryId; uint64_t tId = req.taskId; int64_t rId = 0; - int32_t eId = 0; + int32_t eId = -1; SQWMsg qwMsg = {.node = node, .msg = req.msg, .msgLen = req.phyLen, .connInfo = pMsg->info}; QW_SCH_TASK_DLOG("processDelete start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, req.sql); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 2b23f7a27f..cd48452df2 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -566,20 +566,22 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex if (gQWDebug.tmp) { -#if 0 - SEpSet epSet = {0}; - epSet.inUse = 1; - epSet.numOfEps = 3; - strcpy(epSet.eps[0].fqdn, "localhost"); - epSet.eps[0].port = 7100; - strcpy(epSet.eps[1].fqdn, "localhost"); - epSet.eps[1].port = 7200; - strcpy(epSet.eps[2].fqdn, "localhost"); - epSet.eps[2].port = 7300; - - qwDbgBuildAndSendRedirectRsp(pMsg->msgType + 1, &pMsg->info, TSDB_CODE_RPC_REDIRECT, &epSet); - gQWDebug.tmp = false; - return TSDB_CODE_SUCCESS; +#if 1 + if (TDMT_SCH_QUERY == qwMsg->msgType) { + SEpSet epSet = {0}; + epSet.inUse = 1; + epSet.numOfEps = 3; + strcpy(epSet.eps[0].fqdn, "localhost"); + epSet.eps[0].port = 7100; + strcpy(epSet.eps[1].fqdn, "localhost"); + epSet.eps[1].port = 7200; + strcpy(epSet.eps[2].fqdn, "localhost"); + epSet.eps[2].port = 7300; + + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, &epSet); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } #else if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType) { ctx->phase = QW_PHASE_POST_QUERY; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 26824738e9..29179536df 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1276,6 +1276,9 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { for (int32_t i = 0; i < taskNum; ++i) { STaskStatus *taskStatus = taosArrayGet(pStatusList, i); + qDebug("QID:%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d task status in server: %s", + taskStatus->queryId, taskStatus->taskId, taskStatus->execId, jobTaskStatusStr(taskStatus->status)); + SSchJob *pJob = schAcquireJob(taskStatus->refId); if (NULL == pJob) { qWarn("job not found, refId:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64, taskStatus->refId, @@ -1284,8 +1287,6 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { continue; } - SCH_JOB_DLOG("TID:0x%" PRIx64 "EID:%d task status in server: %s", taskStatus->taskId, taskStatus->execId, jobTaskStatusStr(taskStatus->status)); - pTask = NULL; schGetTaskInJob(pJob, taskStatus->taskId, &pTask); if (NULL == pTask) { diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 3d547ffbf8..69e41d3111 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -1062,7 +1062,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); pMsg->refId = htobe64(pJob->refId); - pMsg->execId = htobe64(pTask->execId); + pMsg->execId = htonl(pTask->execId); break; } case TDMT_SCH_QUERY_HEARTBEAT: { From 25b3f88ebe9f731440c8facee72f0611e585aad4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 30 Jun 2022 13:55:41 +0800 Subject: [PATCH 15/68] add query epset --- source/libs/transport/src/transCli.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b48939f9f9..77cc5dbaf7 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1054,7 +1054,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { */ STransConnCtx* pCtx = pMsg->ctx; int32_t code = pResp->code; - if (pTransInst->retry != NULL && pTransInst->retry(code, pResp->msgType - 1)) { + bool retry = (pTransInst->retry != NULL && pTransInst->retry(code, pResp->msgType - 1)) ? true : false; + if (retry) { pMsg->sent = 0; pCtx->retryCnt += 1; if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { @@ -1083,11 +1084,13 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { STraceId* trace = &pResp->info.traceId; - if (cliTryToExtractEpSet(pResp, &pCtx->epSet)) { + bool hasEpSet = cliTryToExtractEpSet(pResp, &pCtx->epSet); + if (hasEpSet) { char tbuf[256] = {0}; EPSET_DEBUG_STR(&pCtx->epSet, tbuf); tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); } + if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { @@ -1099,10 +1102,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { pCtx->pRsp = NULL; } else { tGTrace("%s conn %p handle resp", CONN_GET_INST_LABEL(pConn), pConn); - if (!cliIsEpsetUpdated(code, pCtx)) { - pTransInst->cfp(pTransInst->parent, pResp, NULL); - } else { + if (retry == false && hasEpSet == true) { pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet); + } else { + if (!cliIsEpsetUpdated(code, pCtx)) { + pTransInst->cfp(pTransInst->parent, pResp, NULL); + } else { + pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet); + } } } return 0; From a8e526a6de3bfd5b59461ccfe81f3e998b0865e7 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 30 Jun 2022 14:31:12 +0800 Subject: [PATCH 16/68] feat: support query redirect --- source/libs/qworker/src/qwDbg.c | 32 +++++++++++++++++++++++++++++- source/libs/qworker/src/qworker.c | 29 --------------------------- source/libs/scheduler/src/schJob.c | 12 ++++++----- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index 0fa01a304c..68058334ab 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -9,7 +9,7 @@ #include "tmsg.h" #include "tname.h" -SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false, .tmp = true}; +SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false, .tmp = false}; int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore) { if (!gQWDebug.statusEnable) { @@ -138,6 +138,7 @@ int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int .code = code, .info = *pConn, }; + rpcRsp.info.hasEpSet = 1; tmsgSendRsp(&rpcRsp); @@ -146,6 +147,35 @@ int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int return TSDB_CODE_SUCCESS; } +int32_t qwDbgResponseREdirect(SQWMsg *qwMsg, SQWTaskCtx *ctx) { + if (gQWDebug.tmp) { + if (TDMT_SCH_QUERY == qwMsg->msgType) { + SEpSet epSet = {0}; + epSet.inUse = 1; + epSet.numOfEps = 3; + strcpy(epSet.eps[0].fqdn, "localhost"); + epSet.eps[0].port = 7100; + strcpy(epSet.eps[1].fqdn, "localhost"); + epSet.eps[1].port = 7200; + strcpy(epSet.eps[2].fqdn, "localhost"); + epSet.eps[2].port = 7300; + + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, &epSet); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } + + if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType) { + ctx->phase = QW_PHASE_POST_QUERY; + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, NULL); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } + } + + return TSDB_CODE_SUCCESS; +} + int32_t qwDbgEnableDebug(char *option) { if (0 == strcasecmp(option, "lock")) { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index cd48452df2..949b67249f 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -564,35 +564,6 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL)); } - - if (gQWDebug.tmp) { -#if 1 - if (TDMT_SCH_QUERY == qwMsg->msgType) { - SEpSet epSet = {0}; - epSet.inUse = 1; - epSet.numOfEps = 3; - strcpy(epSet.eps[0].fqdn, "localhost"); - epSet.eps[0].port = 7100; - strcpy(epSet.eps[1].fqdn, "localhost"); - epSet.eps[1].port = 7200; - strcpy(epSet.eps[2].fqdn, "localhost"); - epSet.eps[2].port = 7300; - - qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, &epSet); - gQWDebug.tmp = false; - return TSDB_CODE_SUCCESS; - } -#else - if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType) { - ctx->phase = QW_PHASE_POST_QUERY; - qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, NULL); - gQWDebug.tmp = false; - return TSDB_CODE_SUCCESS; - } -#endif - } - - _return: input.code = code; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 29179536df..b2a96cbb23 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1684,7 +1684,7 @@ _return: SCH_RET(code); } -int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { +int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode) { int32_t code = 0; int8_t status = 0; if (schJobNeedToStop(pJob, &status)) { @@ -1711,6 +1711,10 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { memset(&pTask->succeedAddr, 0, sizeof(pTask->succeedAddr)); if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + if (pData) { + SCH_ERR_JRET(schUpdateTaskCandidateAddr(pJob, pTask, pData->pEpSet)); + } + if (SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) { if (JOB_TASK_STATUS_EXECUTING == SCH_GET_TASK_STATUS(pTask)) { SCH_ERR_JRET(schLaunchTasksInFlowCtrlList(pJob, pTask)); @@ -1737,7 +1741,7 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, int32_t rspCode) { for (int32_t i = 0; i < childrenNum; ++i) { SSchTask* pChild = taosArrayGetP(pTask->children, i); SCH_LOCK_TASK(pChild); - schDoTaskRedirect(pJob, pChild, rspCode); + schDoTaskRedirect(pJob, pChild, NULL, rspCode); SCH_UNLOCK_TASK(pChild); } @@ -1758,11 +1762,9 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32 SCH_TASK_ELOG("no epset updated while got error %s", tstrerror(rspCode)); SCH_ERR_JRET(rspCode); } - - SCH_ERR_JRET(schUpdateTaskCandidateAddr(pJob, pTask, pData->pEpSet)); } - SCH_RET(schDoTaskRedirect(pJob, pTask, rspCode)); + SCH_RET(schDoTaskRedirect(pJob, pTask, pData, rspCode)); _return: From 4695dc2dae310bc6011b2f814e92038efb00589e Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 30 Jun 2022 14:41:50 +0800 Subject: [PATCH 17/68] feat(tmq): add snapshot test --- examples/c/tmq.c | 2 +- include/libs/executor/executor.h | 4 +- source/client/src/tmq.c | 16 +- source/dnode/vnode/inc/vnode.h | 1 + source/dnode/vnode/src/inc/tq.h | 13 +- source/dnode/vnode/src/tq/tq.c | 14 +- source/dnode/vnode/src/tq/tqExec.c | 18 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 55 +++-- source/libs/executor/inc/executorimpl.h | 18 +- source/libs/executor/src/executorMain.c | 13 +- source/libs/executor/src/executorimpl.c | 30 ++- source/libs/executor/src/scanoperator.c | 49 +++- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/tmq/snapshot1.sim | 308 ++++++++++++++++++++++++ tests/test/c/tmqSim.c | 28 +-- 15 files changed, 505 insertions(+), 65 deletions(-) create mode 100644 tests/script/tsim/tmq/snapshot1.sim diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 4226587d56..697a53e570 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -199,7 +199,7 @@ tmq_t* build_consumer() { tmq_conf_set(conf, "msg.with.table.name", "true"); tmq_conf_set(conf, "enable.auto.commit", "true"); - tmq_conf_set(conf, "experiment.use.snapshot", "false"); + tmq_conf_set(conf, "experimental.snapshot.enable", "true"); tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 6b4772dc2e..d3e3c58622 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -36,6 +36,7 @@ typedef struct SReadHandle { void* vnode; void* mnd; SMsgCb* pMsgCb; + bool tqReader; } SReadHandle; typedef enum { @@ -133,7 +134,6 @@ int32_t qKillTask(qTaskInfo_t tinfo); */ int32_t qAsyncKillTask(qTaskInfo_t tinfo); - /** * destroy query info structure * @param qHandle @@ -172,6 +172,8 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le */ int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts); +int32_t qPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts); + #ifdef __cplusplus } #endif diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 5493628e74..aa78649ba7 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -54,7 +54,8 @@ struct tmq_conf_t { int8_t autoCommit; int8_t resetOffset; int8_t withTbName; - int8_t useSnapshot; + int8_t spEnable; + int32_t spBatchSize; uint16_t port; int32_t autoCommitInterval; char* ip; @@ -288,18 +289,23 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value } } - if (strcmp(key, "experiment.use.snapshot") == 0) { + if (strcmp(key, "experimental.snapshot.enable") == 0) { if (strcmp(value, "true") == 0) { - conf->useSnapshot = true; + conf->spEnable = true; return TMQ_CONF_OK; } else if (strcmp(value, "false") == 0) { - conf->useSnapshot = false; + conf->spEnable = false; return TMQ_CONF_OK; } else { return TMQ_CONF_INVALID; } } + if (strcmp(key, "experimental.snapshot.batch.size") == 0) { + conf->spBatchSize = atoi(value); + return TMQ_CONF_OK; + } + if (strcmp(key, "td.connect.ip") == 0) { conf->ip = strdup(value); return TMQ_CONF_OK; @@ -918,7 +924,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { strcpy(pTmq->clientId, conf->clientId); strcpy(pTmq->groupId, conf->groupId); pTmq->withTbName = conf->withTbName; - pTmq->useSnapshot = conf->useSnapshot; + pTmq->useSnapshot = conf->spEnable; pTmq->autoCommit = conf->autoCommit; pTmq->autoCommitInterval = conf->autoCommitInterval; pTmq->commitCb = conf->commitCb; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index cef0bbbc01..4dc11a4815 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -116,6 +116,7 @@ typedef void *tsdbReaderT; #define BLOCK_LOAD_TABLE_SEQ_ORDER 2 #define BLOCK_LOAD_TABLE_RR_ORDER 3 +int32_t tsdbSetTableId(tsdbReaderT reader, int64_t uid); int32_t tsdbSetTableList(tsdbReaderT reader, SArray *tableList); tsdbReaderT tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, SArray *tableList, uint64_t qId, uint64_t taskId); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 38a4f28041..cab4805b20 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -161,7 +161,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead* // tqExec int32_t tqLogScanExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataRsp* pRsp, int32_t workerId); -int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, int32_t workerId); +int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, STqOffsetVal offset, int32_t workerId); int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp); // tqMeta @@ -183,6 +183,17 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore); // tqSink void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data); +static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t uid, int64_t ts) { + pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA; + pOffsetVal->uid = uid; + pOffsetVal->ts = ts; +} + +static FORCE_INLINE void tqOffsetResetToLog(STqOffsetVal* pOffsetVal, int64_t ver) { + pOffsetVal->type = TMQ_OFFSET__LOG; + pOffsetVal->version = ver; +} + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index a08515ed5c..0563b67f4a 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -228,17 +228,6 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su static int32_t tqInitMetaRsp(SMqMetaRsp* pRsp, const SMqPollReq* pReq) { return 0; } -static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t uid, int64_t ts) { - pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA; - pOffsetVal->uid = uid; - pOffsetVal->ts = ts; -} - -static FORCE_INLINE void tqOffsetResetToLog(STqOffsetVal* pOffsetVal, int64_t ver) { - pOffsetVal->type = TMQ_OFFSET__LOG; - pOffsetVal->version = ver; -} - int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { SMqPollReq* pReq = pMsg->pCont; int64_t consumerId = pReq->consumerId; @@ -394,7 +383,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { char formatBuf[50]; tFormatOffset(formatBuf, 50, &dataRsp.reqOffset); tqInfo("retrieve using snapshot req offset %s", formatBuf); - if (tqScanSnapshot(pTq, &pHandle->execHandle, &dataRsp, workerId) < 0) { + if (tqScanSnapshot(pTq, &pHandle->execHandle, &dataRsp, fetchOffsetNew, workerId) < 0) { ASSERT(0); } @@ -655,6 +644,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) { .reader = pHandle->execHandle.pExecReader[i], .meta = pTq->pVnode->pMeta, .vnode = pTq->pVnode, + .tqReader = true, }; pHandle->execHandle.execCol.task[i] = qCreateStreamExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle); ASSERT(pHandle->execHandle.execCol.task[i]); diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index eb09199c70..ac6cc2e411 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -59,13 +59,18 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i return 0; } -int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, int32_t workerId) { +int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, STqOffsetVal offset, int32_t workerId) { ASSERT(pExec->subType == TOPIC_SUB_TYPE__COLUMN); qTaskInfo_t task = pExec->execCol.task[workerId]; - // TODO set uid and ts + if (qStreamScanSnapshot(task) < 0) { ASSERT(0); } + if (qPrepareScan(task, offset.uid, offset.ts) < 0) { + ASSERT(0); + } + + int32_t rowCnt = 0; while (1) { SSDataBlock* pDataBlock = NULL; uint64_t ts = 0; @@ -86,7 +91,16 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, i /*tqAddTbNameToRsp(pTq, uid, pRsp, workerId);*/ } pRsp->blockNum++; + + rowCnt += pDataBlock->info.rows; + if (rowCnt >= 4096) break; } + int64_t uid; + int64_t ts; + if (qGetStreamScanStatus(task, &uid, &ts) < 0) { + ASSERT(0); + } + tqOffsetResetToData(&pRsp->rspOffset, uid, ts); return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 03f18cc766..e182add5d6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -112,9 +112,9 @@ typedef struct STsdbReadHandle { STimeWindow window; // the primary query time window that applies to all queries // SColumnDataAgg* statis; // query level statistics, only one table block statistics info exists at any time // SColumnDataAgg** pstatis;// the ptr array list to return to caller - int32_t numOfBlocks; + int32_t numOfBlocks; SSDataBlock* pResBlock; -// SArray* pColumns; // column list, SColumnInfoData array list + // SArray* pColumns; // column list, SColumnInfoData array list bool locateStart; int32_t outputCapacity; int32_t realNumOfRows; @@ -223,6 +223,22 @@ int64_t tsdbGetNumOfRowsInMemTable(tsdbReaderT* pHandle) { return rows; } +static SArray* createCheckInfoFromUid(STsdbReadHandle* pTsdbReadHandle, int64_t uid) { + SArray* pTableCheckInfo = taosArrayInit(1, sizeof(STableCheckInfo)); + if (pTableCheckInfo == NULL) { + return NULL; + } + STableCheckInfo info = { + .tableId = uid, + }; + info.suid = pTsdbReadHandle->suid; + + taosArrayPush(pTableCheckInfo, &info); + tsdbDebug("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pTsdbReadHandle, info.tableId, info.lastKey, + pTsdbReadHandle->idStr); + return pTableCheckInfo; +} + static SArray* createCheckInfoFromTableGroup(STsdbReadHandle* pTsdbReadHandle, SArray* pTableList) { size_t tableSize = taosArrayGetSize(pTableList); @@ -428,8 +444,8 @@ static STsdbReadHandle* tsdbQueryTablesImpl(SVnode* pVnode, SQueryTableDataCond* for (int32_t i = 0; i < pCond->numOfCols; ++i) { SColumnInfoData colInfo = {.info = pCond->colList[i], 0}; - int32_t code = blockDataAppendColInfo(pReadHandle->pResBlock, &colInfo); - if (code != TSDB_CODE_SUCCESS){ + int32_t code = blockDataAppendColInfo(pReadHandle->pResBlock, &colInfo); + if (code != TSDB_CODE_SUCCESS) { goto _end; } } @@ -494,9 +510,19 @@ static int32_t setCurrentSchema(SVnode* pVnode, STsdbReadHandle* pTsdbReadHandle return TSDB_CODE_SUCCESS; } -int32_t tsdbSetTableList(tsdbReaderT reader, SArray* tableList){ +int32_t tsdbSetTableId(tsdbReaderT reader, int64_t uid) { STsdbReadHandle* pTsdbReadHandle = reader; - if(pTsdbReadHandle->pTableCheckInfo) taosArrayDestroy(pTsdbReadHandle->pTableCheckInfo); + if (pTsdbReadHandle->pTableCheckInfo) taosArrayDestroy(pTsdbReadHandle->pTableCheckInfo); + pTsdbReadHandle->pTableCheckInfo = createCheckInfoFromUid(pTsdbReadHandle, uid); + if (pTsdbReadHandle->pTableCheckInfo == NULL) { + return TSDB_CODE_TDB_OUT_OF_MEMORY; + } + return TDB_CODE_SUCCESS; +} + +int32_t tsdbSetTableList(tsdbReaderT reader, SArray* tableList) { + STsdbReadHandle* pTsdbReadHandle = reader; + if (pTsdbReadHandle->pTableCheckInfo) taosArrayDestroy(pTsdbReadHandle->pTableCheckInfo); pTsdbReadHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pTsdbReadHandle, tableList); if (pTsdbReadHandle->pTableCheckInfo == NULL) { return TSDB_CODE_TDB_OUT_OF_MEMORY; @@ -505,10 +531,10 @@ int32_t tsdbSetTableList(tsdbReaderT reader, SArray* tableList){ } tsdbReaderT tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* tableList, uint64_t qId, - uint64_t taskId) { - if(taosArrayGetSize(tableList) == 0){ - return NULL; - } + uint64_t taskId) { + /*if (taosArrayGetSize(tableList) == 0) {*/ + /*return NULL;*/ + /*}*/ STsdbReadHandle* pTsdbReadHandle = tsdbQueryTablesImpl(pVnode, pCond, qId, taskId); if (pTsdbReadHandle == NULL) { return NULL; @@ -553,8 +579,7 @@ tsdbReaderT tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* t } tsdbDebug("%p total numOfTable:%" PRIzu " in this query, table %" PRIzu " %s", pTsdbReadHandle, - taosArrayGetSize(pTsdbReadHandle->pTableCheckInfo), taosArrayGetSize(tableList), - pTsdbReadHandle->idStr); + taosArrayGetSize(pTsdbReadHandle->pTableCheckInfo), taosArrayGetSize(tableList), pTsdbReadHandle->idStr); return (tsdbReaderT)pTsdbReadHandle; } @@ -1073,7 +1098,7 @@ static int32_t getFileIdFromKey(TSKEY key, int32_t daysPerFile, int32_t precisio } int64_t fid = (int64_t)(key / (daysPerFile * tsTickPerMin[precision])); // set the starting fileId - if (fid < 0LL && llabs(fid) > INT32_MAX) { // data value overflow for INT32 + if (fid < 0LL && llabs(fid) > INT32_MAX) { // data value overflow for INT32 fid = INT32_MIN; } @@ -2612,7 +2637,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* 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 ((win.skey > pTsdbReadHandle->window.ekey)/* || (!ascTraverse && win.ekey < pTsdbReadHandle->window.ekey)*/) { + if ((win.skey > pTsdbReadHandle->window.ekey) /* || (!ascTraverse && win.ekey < pTsdbReadHandle->window.ekey)*/) { tsdbUnLockFS(REPO_FS(pTsdbReadHandle->pTsdb)); tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %s", pTsdbReadHandle, pTsdbReadHandle->window.skey, pTsdbReadHandle->window.ekey, pTsdbReadHandle->idStr); @@ -2886,7 +2911,7 @@ int32_t tsdbGetCtbIdList(SMeta* pMeta, int64_t suid, SArray* list) { */ int32_t tsdbGetStbIdList(SMeta* pMeta, int64_t suid, SArray* list) { SMStbCursor* pCur = metaOpenStbCursor(pMeta, suid); - if(!pCur) { + if (!pCur) { return TSDB_CODE_FAILED; } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 6b5826bf88..618cf50b86 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -248,6 +248,11 @@ typedef struct SSampleExecInfo { uint32_t seed; // random seed value } SSampleExecInfo; +enum { + TABLE_SCAN__TABLE_ORDER = 1, + TABLE_SCAN__BLOCK_ORDER = 1, +}; + typedef struct STableScanInfo { void* dataReader; SReadHandle readHandle; @@ -272,13 +277,21 @@ typedef struct STableScanInfo { int32_t curTWinIdx; int32_t currentGroupId; + int32_t currentTable; uint64_t queryId; // todo remove it uint64_t taskId; // todo remove it struct { uint64_t uid; - int64_t t; - } scanStatus; + int64_t ts; + } lastStatus; + + struct { + uint64_t uid; + int64_t ts; + } expStatus; + + int8_t scanMode; } STableScanInfo; typedef struct STagScanInfo { @@ -713,6 +726,7 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput); void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle); void setTbNameColData(void* pMeta, const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId); +int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts); int32_t doGetScanStatus(SOperatorInfo* pOperator, uint64_t* uid, int64_t* ts); SSDataBlock* loadNextDataBlock(void* param); diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 0871575d95..deb4f970df 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -222,7 +222,7 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) { } int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len) { - SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*) tinfo; + SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*)tinfo; if (pTaskInfo == NULL || pInput == NULL || len == 0) { return TSDB_CODE_INVALID_PARA; @@ -231,11 +231,14 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le return decodeOperator(pTaskInfo->pRoot, pInput, len); } +int32_t qPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; -int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) { - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*) tinfo; - - return TSDB_CODE_SUCCESS; + return doPrepareScan(pTaskInfo->pRoot, uid, ts); } +int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + return doGetScanStatus(pTaskInfo->pRoot, uid, ts); +} diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 95782ce001..6fc1d2b0b4 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1033,7 +1033,7 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData SqlFunctionCtx* pCtx = pTableScanInfo->pCtx; uint32_t status = BLK_DATA_NOT_LOAD; - int32_t numOfOutput = 0;//pTableScanInfo->numOfOutput; + int32_t numOfOutput = 0; // pTableScanInfo->numOfOutput; for (int32_t i = 0; i < numOfOutput; ++i) { int32_t functionId = pCtx[i].functionId; int32_t colId = pTableScanInfo->pExpr[i].base.pParam[0].pCol->colId; @@ -2821,13 +2821,35 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan } } +int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { + int32_t type = pOperator->operatorType; + if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + SStreamBlockScanInfo* pScanInfo = pOperator->info; + STableScanInfo* pSnapShotScanInfo = pScanInfo->pSnapshotReadOp->info; + /**uid = pSnapShotScanInfo->scanStatus.uid;*/ + /**ts = pSnapShotScanInfo->scanStatus.t;*/ + if (pSnapShotScanInfo->lastStatus.uid != uid || pSnapShotScanInfo->lastStatus.ts != ts) { + // rebuild scan + // + } + } else { + if (pOperator->pDownstream[0] == NULL) { + return TSDB_CODE_INVALID_PARA; + } else { + doPrepareScan(pOperator->pDownstream[0], uid, ts); + } + } + + return TSDB_CODE_SUCCESS; +} + int32_t doGetScanStatus(SOperatorInfo* pOperator, uint64_t* uid, int64_t* ts) { int32_t type = pOperator->operatorType; if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { SStreamBlockScanInfo* pScanInfo = pOperator->info; - STableScanInfo* pSnapShotScanInfo = pScanInfo->pSnapshotReadOp->info; - *uid = pSnapShotScanInfo->scanStatus.uid; - *ts = pSnapShotScanInfo->scanStatus.t; + STableScanInfo* pSnapShotScanInfo = pScanInfo->pSnapshotReadOp->info; + *uid = pSnapShotScanInfo->lastStatus.uid; + *ts = pSnapShotScanInfo->lastStatus.ts; } else { if (pOperator->pDownstream[0] == NULL) { return TSDB_CODE_INVALID_PARA; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ca4afdeb7f..c057485f51 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -416,8 +416,8 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { pOperator->cost.totalCost = pTableScanInfo->readRecorder.elapsedTime; // todo refactor - pTableScanInfo->scanStatus.uid = pBlock->info.uid; - pTableScanInfo->scanStatus.t = pBlock->info.window.ekey; + pTableScanInfo->lastStatus.uid = pBlock->info.uid; + pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey; return pBlock; } @@ -513,6 +513,44 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { STableScanInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + // if scan table by table + if (pInfo->scanMode == TABLE_SCAN__TABLE_ORDER) { + // check status + if (pInfo->lastStatus.uid == pInfo->expStatus.uid && pInfo->lastStatus.ts == pInfo->expStatus.ts) { + SSDataBlock* result = doTableScanGroup(pOperator); + if (result) { + return result; + } + // if no data, switch to next table and continue scan + pInfo->currentTable++; + if (pInfo->currentTable >= taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList)) { + return NULL; + } + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, pInfo->currentTable); + /*pTableInfo->uid */ + tsdbSetTableId(pInfo->dataReader, pTableInfo->uid); + tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + pInfo->scanTimes = 0; + pInfo->curTWinIdx = 0; + pInfo->lastStatus.ts = pInfo->expStatus.ts; + pInfo->lastStatus.uid = pInfo->expStatus.uid; + return doTableScan(pOperator); + } + // reset to exp table and window start from ts + tsdbSetTableId(pInfo->dataReader, pInfo->expStatus.uid); + SQueryTableDataCond tmpCond = pInfo->cond; + tmpCond.twindows[0] = (STimeWindow){ + .skey = pInfo->expStatus.ts, + .ekey = INT64_MAX, + }; + tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); + pInfo->scanTimes = 0; + pInfo->curTWinIdx = 0; + pInfo->lastStatus.ts = pInfo->expStatus.ts; + pInfo->lastStatus.uid = pInfo->expStatus.uid; + return doTableScan(pOperator); + } + if (pInfo->currentGroupId == -1) { pInfo->currentGroupId++; if (pInfo->currentGroupId >= taosArrayGetSize(pTaskInfo->tableqinfoList.pGroupList)) { @@ -1207,6 +1245,13 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys if (pHandle) { SOperatorInfo* pTableScanDummy = createTableScanOperatorInfo(pTableScanNode, pHandle, pTaskInfo, queryId, taskId); STableScanInfo* pSTInfo = (STableScanInfo*)pTableScanDummy->info; + + SArray* tableList = taosArrayGetP(pTaskInfo->tableqinfoList.pGroupList, 0); + if (pHandle->tqReader) { + pSTInfo->scanMode = TABLE_SCAN__TABLE_ORDER; + pSTInfo->dataReader = tsdbReaderOpen(pHandle->vnode, &pSTInfo->cond, tableList, 0, 0); + } + if (pSTInfo->interval.interval > 0) { pInfo->pUpdateInfo = updateInfoInitP(&pSTInfo->interval, pTwSup->waterMark); } else { diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index cc114ac55f..2a3cb88c1f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -129,6 +129,7 @@ ./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim ./test.sh -f tsim/tmq/topic.sim ./test.sh -f tsim/tmq/snapshot.sim +./test.sh -f tsim/tmq/snapshot1.sim # --- stable ./test.sh -f tsim/stable/disk.sim diff --git a/tests/script/tsim/tmq/snapshot1.sim b/tests/script/tsim/tmq/snapshot1.sim new file mode 100644 index 0000000000..8c4a719006 --- /dev/null +++ b/tests/script/tsim/tmq/snapshot1.sim @@ -0,0 +1,308 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +#basic1Of2Cons.sim: vgroups=1, one topic for 2 consumers, firstly insert data, then start consume. Include six topics +#basic2Of2ConsOverlap.sim: vgroups=1, multi topics for 2 consumers, firstly insert data, then start consume. Include six topics +#basic3Of2Cons.sim: vgroups=4, one topic for 2 consumers, firstly insert data, then start consume. Include six topics +#basic4Of2Cons.sim: vgroups=4, multi topics for 2 consumers, firstly insert data, then start consume. Include six topics + +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# + +run tsim/tmq/prepareBasicEnv-1vgrp.sim + +#---- global parameters start ----# +$dbName = db +$vgroups = 1 +$stbPrefix = stb +$ctbPrefix = ctb +$ntbPrefix = ntb +$stbNum = 1 +$ctbNum = 10 +$ntbNum = 10 +$rowsPerCtb = 10 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 +#---- global parameters end ----# + +$pullDelay = 5 +$ifcheckdata = 1 +$ifmanualcommit = 1 +$showMsg = 1 +$showRow = 0 + +sql connect +sql use $dbName + +print == create topics from super table +sql create topic topic_stb_column as select ts, c3 from stb +sql create topic topic_stb_all as select ts, c1, c2, c3 from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb + +print == create topics from child table +sql create topic topic_ctb_column as select ts, c3 from ctb0 +sql create topic topic_ctb_all as select * from ctb0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0 + +print == create topics from normal table +sql create topic topic_ntb_column as select ts, c3 from ntb0 +sql create topic topic_ntb_all as select * from ntb0 +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 + +#sql show topics +#if $rows != 9 then +# return -1 +#endi + +#'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest' +$keyList = ' . group.id:cgrp1 +$keyList = $keyList . , +$keyList = $keyList . enable.auto.commit:false +#$keyList = $keyList . , +#$keyList = $keyList . auto.commit.interval.ms:6000 +#$keyList = $keyList . , +#$keyList = $keyList . auto.offset.reset:earliest +$keyList = $keyList . ' +print ========== key list: $keyList + +$topicNum = 2 + +#=============================== start consume =============================# + + +print ================ test consume from stb +print == overlap toipcs: topic_stb_column + topic_stb_all, topic_stb_function + topic_stb_all +$topicList = ' . topic_stb_column +$topicList = $topicList . , +$topicList = $topicList . topic_stb_all +$topicList = $topicList . ' + +$consumerId = 0 +$totalMsgOfOneTopic = $ctbNum * $rowsPerCtb +$totalMsgOfStb = $totalMsgOfOneTopic * $topicNum +$expectmsgcnt = $totalMsgOfStb +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + + +$topicList = ' . topic_stb_all +$topicList = $topicList . , +$topicList = $topicList . topic_stb_function +$topicList = $topicList . ' +$consumerId = 1 +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + +print == start consumer to pull msgs from stb +print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start -e 1 +system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start -e 1 + +print == check consume result +wait_consumer_end_from_stb: +sql select * from consumeresult +print ==> rows: $rows +print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print ==> rows[1]: $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +if $rows != 2 then + sleep 1000 + goto wait_consumer_end_from_stb +endi +if $data[0][1] == 0 then + if $data[1][1] != 1 then + return -1 + endi +endi +if $data[0][1] == 1 then + if $data[1][1] != 0 then + return -1 + endi +endi + +# $data[0][3]/$data[1][3] should be between $totalMsgOfOneTopic and $totalMsgOfStb. +if $data[0][3] < $totalMsgOfOneTopic then + return -1 +endi +if $data[0][3] > $totalMsgOfStb then + return -1 +endi +if $data[1][3] < $totalMsgOfOneTopic then + return -1 +endi +if $data[1][3] > $totalMsgOfStb then + return -1 +endi + +$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb +$sumOfRows = $data[0][3] + $data[1][3] +if $sumOfRows != $totalMsgCons then + return -1 +endi + +####################################################################################### +# clear consume info and consume result +#run tsim/tmq/clearConsume.sim +# because drop table function no stable, so by create new db for consume info and result. Modify it later +$cdbName = cdb1 +sql create database $cdbName vgroups 1 +sleep 500 +sql use $cdbName + +print == create consume info table and consume result table for ctb +sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int) +sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) + +sql show tables +if $rows != 2 then + return -1 +endi +####################################################################################### + + +print ================ test consume from ctb +print == overlap toipcs: topic_ctb_column + topic_ctb_all, topic_ctb_function + topic_ctb_all +$topicList = ' . topic_ctb_column +$topicList = $topicList . , +$topicList = $topicList . topic_ctb_all +$topicList = $topicList . ' +$consumerId = 0 + +$totalMsgOfOneTopic = $rowsPerCtb +$totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum +$expectmsgcnt = $totalMsgOfCtb +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + +$topicList = ' . topic_ctb_function +$topicList = $topicList . , +$topicList = $topicList . topic_ctb_all +$topicList = $topicList . ' +$consumerId = 1 +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + +print == start consumer to pull msgs from ctb +print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start -e 1 +system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start -e 1 + +print == check consume result +wait_consumer_end_from_ctb: +sql select * from consumeresult +print ==> rows: $rows +print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print ==> rows[1]: $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +if $rows != 2 then + sleep 1000 + goto wait_consumer_end_from_ctb +endi +if $data[0][1] == 0 then + if $data[1][1] != 1 then + return -1 + endi +endi +if $data[0][1] == 1 then + if $data[1][1] != 0 then + return -1 + endi +endi + +if $data[0][3] == $totalMsgOfOneTopic then + if $data[1][3] == $totalMsgOfCtb then + goto check_ok_1 + endi +elif $data[1][3] == $totalMsgOfOneTopic then + if $data[0][3] == $totalMsgOfCtb then + goto check_ok_1 + endi +endi +return -1 +check_ok_1: + +####################################################################################### +# clear consume info and consume result +#run tsim/tmq/clearConsume.sim +# because drop table function no stable, so by create new db for consume info and result. Modify it later +$cdbName = cdb2 +sql create database $cdbName vgroups 1 +sleep 500 +sql use $cdbName + +print == create consume info table and consume result table for ntb +sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int) +sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) + +sql show tables +if $rows != 2 then + return -1 +endi +####################################################################################### + + +print ================ test consume from ntb +print == overlap toipcs: topic_ntb_column + topic_ntb_all, topic_ntb_function + topic_ntb_all +$topicList = ' . topic_ntb_column +$topicList = $topicList . , +$topicList = $topicList . topic_ntb_all +$topicList = $topicList . ' + +$consumerId = 0 +$totalMsgOfOneTopic = $rowsPerCtb +$totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum +$expectmsgcnt = $totalMsgOfNtb +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + + +$topicList = ' . topic_ntb_function +$topicList = $topicList . , +$topicList = $topicList . topic_ntb_all +$topicList = $topicList . ' +$consumerId = 1 +sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) + +print == start consumer to pull msgs from ntb +print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start -e 1 +system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start -e 1 + +print == check consume result from ntb +wait_consumer_end_from_ntb: +sql select * from consumeresult +print ==> rows: $rows +print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print ==> rows[1]: $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +if $rows != 2 then + sleep 1000 + goto wait_consumer_end_from_ntb +endi +if $data[0][1] == 0 then + if $data[1][1] != 1 then + return -1 + endi +endi +if $data[0][1] == 1 then + if $data[1][1] != 0 then + return -1 + endi +endi + + +if $data[0][3] == $totalMsgOfOneTopic then + if $data[1][3] == $totalMsgOfNtb then + goto check_ok_3 + endi +elif $data[1][3] == $totalMsgOfOneTopic then + if $data[0][3] == $totalMsgOfNtb then + goto check_ok_3 + endi +endi +return -1 +check_ok_3: + +sql select * from performance_schema.`consumers` +if $rows != 0 then + return -1 +endi + +#sql select * from performance_schema.`subscriptions` +#if $rows != 0 then +# return -1 +#endi + +#------ not need stop consumer, because it exit after pull msg overthan expect msg +#system tsim/tmq/consume.sh -s stop -x SIGINT + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 81fa72d15a..07fdcc2415 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -124,15 +124,13 @@ char* getCurrentTimeString(char* timeString) { return timeString; } -static void tmqStop(int signum, void *info, void *ctx) { +static void tmqStop(int signum, void* info, void* ctx) { running = 0; char tmpString[128]; - taosFprintfFile(g_fp, "%s tmqStop() receive stop signal[%d]\n", getCurrentTimeString(tmpString), signum); + taosFprintfFile(g_fp, "%s tmqStop() receive stop signal[%d]\n", getCurrentTimeString(tmpString), signum); } -static void tmqSetSignalHandle() { - taosSetSignal(SIGINT, tmqStop); -} +static void tmqSetSignalHandle() { taosSetSignal(SIGINT, tmqStop); } void initLogFile() { char filename[256]; @@ -463,16 +461,16 @@ static int32_t msg_process(TAOS_RES* msg, SThreadInfo* pInfo, int32_t msgIndex) int32_t precision = taos_result_precision(msg); const char* tbName = tmq_get_table_name(msg); - #if 0 +#if 0 // get schema //============================== stub =================================================// for (int32_t i = 0; i < numOfFields; i++) { taosFprintfFile(g_fp, "%02d: name: %s, type: %d, len: %d\n", i, fields[i].name, fields[i].type, fields[i].bytes); } //============================== stub =================================================// - #endif +#endif - dumpToFileForCheck(pInfo->pConsumeRowsFile, row, fields, length, numOfFields, precision); + dumpToFileForCheck(pInfo->pConsumeRowsFile, row, fields, length, numOfFields, precision); taos_print_row(buf, row, fields, numOfFields); @@ -529,7 +527,7 @@ static void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) { g_once_commit_flag = 1; notifyMainScript((SThreadInfo*)param, (int32_t)NOTIFY_CMD_START_COMMIT); } - + char tmpString[128]; taosFprintfFile(g_fp, "%s tmq_commit_cb_print() be called\n", getCurrentTimeString(tmpString)); } @@ -565,7 +563,7 @@ void build_consumer(SThreadInfo* pInfo) { // tmq_conf_set(conf, "auto.offset.reset", "latest"); // if (g_stConfInfo.useSnapshot) { - tmq_conf_set(conf, "experiment.use.snapshot", "true"); + tmq_conf_set(conf, "experimental.snapshot.enable", "true"); } pInfo->tmq = tmq_consumer_new(conf, NULL, 0); @@ -683,13 +681,13 @@ void* consumeThreadFunc(void* param) { pInfo->taos = taos_connect(NULL, "root", "taosdata", NULL, 0); if (pInfo->taos == NULL) { taosFprintfFile(g_fp, "taos_connect() fail, can not notify and save consume result to main scripte\n"); - return NULL; + return NULL; } build_consumer(pInfo); build_topic_list(pInfo); if ((NULL == pInfo->tmq) || (NULL == pInfo->topicList)) { - taosFprintfFile(g_fp, "create consumer fail! tmq is null or topicList is null\n"); + taosFprintfFile(g_fp, "create consumer fail! tmq is null or topicList is null\n"); assert(0); return NULL; } @@ -697,7 +695,7 @@ void* consumeThreadFunc(void* param) { int32_t err = tmq_subscribe(pInfo->tmq, pInfo->topicList); if (err != 0) { pError("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_subscribe() fail! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_subscribe() fail! reason: %s\n", tmq_err2str(err)); assert(0); return NULL; } @@ -718,13 +716,13 @@ void* consumeThreadFunc(void* param) { err = tmq_unsubscribe(pInfo->tmq); if (err != 0) { pError("tmq_unsubscribe() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_unsubscribe()! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_unsubscribe()! reason: %s\n", tmq_err2str(err)); } err = tmq_consumer_close(pInfo->tmq); if (err != 0) { pError("tmq_consumer_close() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_consumer_close()! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_consumer_close()! reason: %s\n", tmq_err2str(err)); } pInfo->tmq = NULL; From 6141bb03dab8d6f5513c550a125ba0fc17e69993 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 30 Jun 2022 15:04:54 +0800 Subject: [PATCH 18/68] feat: insert from csv --- source/libs/parser/inc/sql.y | 10 +- source/libs/parser/src/parInsert.c | 70 +- source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 54 +- source/libs/parser/src/sql.c | 2713 ++++++++++++------------ tools/shell/src/shellEngine.c | 11 +- 6 files changed, 1463 insertions(+), 1396 deletions(-) diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index cb43bfef0e..08b817dbed 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -848,14 +848,10 @@ set_quantifier_opt(A) ::= ALL. %type select_list { SNodeList* } %destructor select_list { nodesDestroyList($$); } -select_list(A) ::= NK_STAR. { A = NULL; } -select_list(A) ::= select_sublist(B). { A = B; } - -%type select_sublist { SNodeList* } -%destructor select_sublist { nodesDestroyList($$); } -select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); } -select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); } +select_list(A) ::= select_item(B). { A = createNodeList(pCxt, B); } +select_list(A) ::= select_list(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); } +select_item(A) ::= NK_STAR(B). { A = createColumnNode(pCxt, NULL, &B); } select_item(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); } select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 044ec90a7f..b97f1df38b 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1302,6 +1302,74 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da return TSDB_CODE_SUCCESS; } +static int32_t parseCsvFile(SInsertParseContext* pCxt, TdFilePtr fp, STableDataBlocks* pDataBlock, int maxRows, + int32_t* numOfRows) { + STableComInfo tinfo = getTableInfo(pDataBlock->pTableMeta); + int32_t extendedRowSize = getExtendedRowSize(pDataBlock); + CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + + (*numOfRows) = 0; + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \" + char* pLine = NULL; + int64_t readLen = 0; + while ((readLen = taosGetLineFile(fp, &pLine)) != -1) { + if (('\r' == pLine[readLen - 1]) || ('\n' == pLine[readLen - 1])) { + pLine[--readLen] = '\0'; + } + + if (readLen == 0) { + continue; + } + + if ((*numOfRows) >= maxRows || pDataBlock->size + extendedRowSize >= pDataBlock->nAllocSize) { + int32_t tSize; + CHECK_CODE(allocateMemIfNeed(pDataBlock, extendedRowSize, &tSize)); + ASSERT(tSize >= maxRows); + maxRows = tSize; + } + + strtolower(pLine, pLine); + char* pRawSql = pCxt->pSql; + pCxt->pSql = pLine; + bool gotRow = false; + CHECK_CODE(parseOneRow(pCxt, pDataBlock, tinfo.precision, &gotRow, tmpTokenBuf)); + if (gotRow) { + pDataBlock->size += extendedRowSize; // len; + (*numOfRows)++; + } + pCxt->pSql = pRawSql; + } + + if (0 == (*numOfRows) && (!TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT))) { + return buildSyntaxErrMsg(&pCxt->msg, "no any data points", NULL); + } + return TSDB_CODE_SUCCESS; +} + +static int32_t parseDataFromFile(SInsertParseContext* pCxt, SToken filePath, STableDataBlocks* dataBuf) { + char filePathStr[TSDB_FILENAME_LEN] = {0}; + strncpy(filePathStr, filePath.z, filePath.n); + TdFilePtr fp = taosOpenFile(filePathStr, TD_FILE_READ | TD_FILE_STREAM); + if (NULL == fp) { + return TAOS_SYSTEM_ERROR(errno); + } + + int32_t maxNumOfRows; + CHECK_CODE(allocateMemIfNeed(dataBuf, getExtendedRowSize(dataBuf), &maxNumOfRows)); + + int32_t numOfRows = 0; + CHECK_CODE(parseCsvFile(pCxt, fp, dataBuf, maxNumOfRows, &numOfRows)); + + SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData); + if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) { + return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than 32767"); + } + + dataBuf->numOfTables = 1; + pCxt->totalNum += numOfRows; + return TSDB_CODE_SUCCESS; +} + void destroyCreateSubTbReq(SVCreateTbReq* pReq) { taosMemoryFreeClear(pReq->name); taosMemoryFreeClear(pReq->ctb.pTag); @@ -1421,7 +1489,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { if (0 == sToken.n || (TK_NK_STRING != sToken.type && TK_NK_ID != sToken.type)) { return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", sToken.z); } - // todo + CHECK_CODE(parseDataFromFile(pCxt, sToken, dataBuf)); pCxt->pOutput->insertType = TSDB_QUERY_TYPE_FILE_INSERT; tbNum++; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 7f5d742dc7..3b2ad84235 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -86,6 +86,7 @@ static SKeyword keywordTable[] = { {"EXISTS", TK_EXISTS}, {"EXPLAIN", TK_EXPLAIN}, {"EVERY", TK_EVERY}, + {"FILE", TK_FILE}, {"FILL", TK_FILL}, {"FIRST", TK_FIRST}, {"FLOAT", TK_FLOAT}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 521c733ceb..985fa6c9ae 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1984,34 +1984,38 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod } static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { - if (NULL == pSelect->pProjectionList) { // select * ... - return createAllColumns(pCxt, &pSelect->pProjectionList); - } else { - SNode* pNode = NULL; - WHERE_EACH(pNode, pSelect->pProjectionList) { - int32_t code = TSDB_CODE_SUCCESS; - if (isMultiResFunc(pNode)) { - SNodeList* pFuncs = NULL; - code = createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs); - if (TSDB_CODE_SUCCESS == code) { - INSERT_LIST(pSelect->pProjectionList, pFuncs); - ERASE_NODE(pSelect->pProjectionList); - continue; - } - } else if (isTableStar(pNode)) { - SNodeList* pCols = NULL; - code = createTableAllCols(pCxt, (SColumnNode*)pNode, &pCols); - if (TSDB_CODE_SUCCESS == code) { - INSERT_LIST(pSelect->pProjectionList, pCols); - ERASE_NODE(pSelect->pProjectionList); - continue; - } + SNode* pNode = NULL; + WHERE_EACH(pNode, pSelect->pProjectionList) { + int32_t code = TSDB_CODE_SUCCESS; + if (isStar(pNode)) { + SNodeList* pCols = NULL; + code = createAllColumns(pCxt, &pCols); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pCols); + ERASE_NODE(pSelect->pProjectionList); + continue; } - if (TSDB_CODE_SUCCESS != code) { - return code; + } else if (isMultiResFunc(pNode)) { + SNodeList* pFuncs = NULL; + code = createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pFuncs); + ERASE_NODE(pSelect->pProjectionList); + continue; + } + } else if (isTableStar(pNode)) { + SNodeList* pCols = NULL; + code = createTableAllCols(pCxt, (SColumnNode*)pNode, &pCols); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pCols); + ERASE_NODE(pSelect->pProjectionList); + continue; } - WHERE_NEXT; } + if (TSDB_CODE_SUCCESS != code) { + return code; + } + WHERE_NEXT; } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 5eb9c72267..6b71a50ac0 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 374 +#define YYNOCODE 373 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNodeList* yy24; - SDataType yy48; - bool yy97; - SAlterOption yy189; - int32_t yy244; - EFillMode yy250; - EJoinType yy596; - EOrder yy598; - int8_t yy619; - SNode* yy652; - ENullOrder yy653; - SToken yy657; - EOperatorType yy700; - int64_t yy701; + SToken yy7; + int32_t yy20; + EJoinType yy54; + int8_t yy57; + SAlterOption yy139; + SNode* yy184; + int64_t yy193; + SNodeList* yy296; + SDataType yy332; + EOrder yy394; + bool yy419; + EOperatorType yy496; + EFillMode yy540; + ENullOrder yy627; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 653 -#define YYNRULE 483 +#define YYNSTATE 652 +#define YYNRULE 482 #define YYNTOKEN 250 -#define YY_MAX_SHIFT 652 -#define YY_MIN_SHIFTREDUCE 953 -#define YY_MAX_SHIFTREDUCE 1435 -#define YY_ERROR_ACTION 1436 -#define YY_ACCEPT_ACTION 1437 -#define YY_NO_ACTION 1438 -#define YY_MIN_REDUCE 1439 -#define YY_MAX_REDUCE 1921 +#define YY_MAX_SHIFT 651 +#define YY_MIN_SHIFTREDUCE 952 +#define YY_MAX_SHIFTREDUCE 1433 +#define YY_ERROR_ACTION 1434 +#define YY_ACCEPT_ACTION 1435 +#define YY_NO_ACTION 1436 +#define YY_MIN_REDUCE 1437 +#define YY_MAX_REDUCE 1918 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,679 +216,682 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2489) +#define YY_ACTTAB_COUNT (2447) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 567, 422, 1437, 423, 1474, 1742, 1673, 430, 317, 423, - /* 10 */ 1474, 111, 39, 37, 1504, 140, 1739, 1451, 460, 69, - /* 20 */ 326, 1440, 1236, 1742, 488, 151, 334, 526, 1573, 1564, - /* 30 */ 1261, 566, 115, 1311, 1739, 1234, 1847, 486, 1612, 484, - /* 40 */ 1739, 1568, 101, 1735, 1741, 100, 99, 98, 97, 96, - /* 50 */ 95, 94, 93, 92, 570, 119, 1306, 1625, 1755, 14, - /* 60 */ 1844, 1735, 1741, 343, 331, 1242, 373, 1735, 1741, 39, - /* 70 */ 37, 1372, 570, 1623, 566, 474, 473, 326, 570, 1236, - /* 80 */ 472, 1847, 1, 116, 469, 553, 1773, 468, 467, 466, - /* 90 */ 1311, 1625, 1234, 329, 529, 117, 1670, 567, 337, 1725, - /* 100 */ 1462, 549, 504, 1899, 649, 1843, 1899, 1623, 111, 528, - /* 110 */ 153, 1840, 1841, 1306, 1845, 465, 14, 156, 1313, 1314, - /* 120 */ 156, 1896, 1242, 1439, 1896, 1573, 1480, 1786, 1135, 1136, - /* 130 */ 88, 1756, 552, 1758, 1759, 548, 42, 570, 78, 2, - /* 140 */ 1832, 1725, 1899, 209, 319, 1828, 152, 110, 109, 108, - /* 150 */ 107, 106, 105, 104, 103, 102, 156, 439, 232, 1566, - /* 160 */ 1896, 649, 1501, 1237, 141, 1235, 505, 1860, 1530, 60, - /* 170 */ 520, 73, 474, 473, 644, 1313, 1314, 472, 1743, 338, - /* 180 */ 116, 469, 1618, 1620, 468, 467, 466, 1240, 1241, 1739, - /* 190 */ 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, - /* 200 */ 1305, 1307, 1308, 1309, 1310, 1312, 1315, 33, 32, 245, - /* 210 */ 246, 40, 38, 36, 35, 34, 1735, 1741, 421, 159, - /* 220 */ 1237, 425, 1235, 626, 625, 624, 341, 570, 623, 622, - /* 230 */ 621, 121, 616, 615, 614, 613, 612, 611, 610, 609, - /* 240 */ 131, 605, 1262, 986, 1240, 1241, 61, 1289, 1290, 1292, - /* 250 */ 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, - /* 260 */ 1309, 1310, 1312, 1315, 39, 37, 566, 1236, 60, 490, - /* 270 */ 304, 1396, 326, 159, 1236, 40, 38, 36, 35, 34, - /* 280 */ 1234, 1261, 1406, 990, 991, 1311, 84, 1234, 1093, 593, - /* 290 */ 592, 591, 1097, 590, 1099, 1100, 589, 1102, 586, 120, - /* 300 */ 1108, 583, 1110, 1111, 580, 577, 159, 1565, 1306, 1899, - /* 310 */ 1242, 14, 512, 1394, 1395, 1397, 1398, 1242, 602, 1551, - /* 320 */ 379, 39, 37, 156, 60, 1755, 604, 1896, 43, 326, - /* 330 */ 1003, 1236, 1002, 1260, 2, 330, 60, 129, 128, 599, - /* 340 */ 598, 597, 1311, 138, 1234, 458, 336, 1259, 372, 649, - /* 350 */ 371, 526, 1575, 1773, 138, 1899, 649, 296, 1549, 339, - /* 360 */ 1004, 550, 244, 1575, 1899, 1306, 1725, 138, 549, 1898, - /* 370 */ 1313, 1314, 231, 1896, 1242, 1899, 1575, 439, 157, 119, - /* 380 */ 33, 32, 1896, 530, 40, 38, 36, 35, 34, 1897, - /* 390 */ 1379, 8, 567, 1896, 1786, 1663, 1260, 87, 1756, 552, - /* 400 */ 1758, 1759, 548, 161, 570, 159, 168, 1832, 1237, 364, - /* 410 */ 1235, 298, 1828, 649, 1773, 1237, 604, 1235, 515, 117, - /* 420 */ 1573, 83, 519, 1899, 1218, 1219, 1242, 1313, 1314, 366, - /* 430 */ 362, 80, 1240, 1241, 154, 1840, 1841, 158, 1845, 1240, - /* 440 */ 1241, 1896, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, - /* 450 */ 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 101, - /* 460 */ 518, 159, 100, 99, 98, 97, 96, 95, 94, 93, - /* 470 */ 92, 427, 1237, 159, 1235, 33, 32, 1258, 26, 40, - /* 480 */ 38, 36, 35, 34, 33, 32, 412, 1321, 40, 38, - /* 490 */ 36, 35, 34, 1260, 521, 516, 1240, 1241, 596, 1289, - /* 500 */ 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, - /* 510 */ 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, 1316, 567, - /* 520 */ 202, 30, 240, 567, 326, 607, 1236, 1432, 159, 1461, - /* 530 */ 377, 1460, 170, 169, 378, 1745, 1003, 1311, 1002, 1234, - /* 540 */ 497, 1459, 28, 36, 35, 34, 7, 1573, 33, 32, - /* 550 */ 1386, 1573, 40, 38, 36, 35, 34, 33, 32, 1755, - /* 560 */ 1306, 40, 38, 36, 35, 34, 1004, 1291, 1458, 1242, - /* 570 */ 1725, 1747, 1725, 39, 37, 1755, 1619, 1620, 479, 71, - /* 580 */ 304, 326, 1725, 1236, 33, 32, 9, 1773, 40, 38, - /* 590 */ 36, 35, 34, 489, 1311, 550, 1234, 138, 69, 567, - /* 600 */ 1725, 567, 549, 1773, 11, 10, 1576, 201, 649, 1725, - /* 610 */ 382, 529, 397, 1431, 166, 1457, 1725, 1306, 549, 22, - /* 620 */ 1569, 482, 1313, 1314, 1550, 476, 1242, 1573, 1786, 1573, - /* 630 */ 200, 89, 1756, 552, 1758, 1759, 548, 429, 570, 67, - /* 640 */ 425, 1832, 66, 9, 1786, 1831, 1828, 88, 1756, 552, - /* 650 */ 1758, 1759, 548, 1055, 570, 55, 1725, 1832, 54, 526, - /* 660 */ 1562, 319, 1828, 152, 1291, 649, 1335, 1237, 1558, 1235, - /* 670 */ 33, 32, 1456, 1455, 40, 38, 36, 35, 34, 1313, - /* 680 */ 1314, 1548, 600, 1057, 1861, 1616, 1347, 119, 1454, 1340, - /* 690 */ 1453, 1240, 1241, 1450, 1289, 1290, 1292, 1293, 1294, 1295, - /* 700 */ 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, - /* 710 */ 1315, 471, 470, 1725, 1725, 33, 32, 1371, 602, 40, - /* 720 */ 38, 36, 35, 34, 1237, 1367, 1235, 117, 27, 1725, - /* 730 */ 1449, 1725, 1448, 1447, 1725, 310, 1446, 129, 128, 599, - /* 740 */ 598, 597, 155, 1840, 1841, 1274, 1845, 1669, 1240, 1241, - /* 750 */ 305, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, - /* 760 */ 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, - /* 770 */ 295, 1725, 1258, 1725, 1725, 602, 326, 1725, 1236, 405, - /* 780 */ 464, 1847, 417, 311, 1445, 309, 308, 1668, 462, 1311, - /* 790 */ 305, 1234, 464, 1263, 129, 128, 599, 598, 597, 390, - /* 800 */ 58, 418, 463, 392, 567, 1842, 620, 618, 553, 567, - /* 810 */ 1260, 567, 1306, 567, 463, 398, 567, 1444, 567, 1671, - /* 820 */ 438, 1242, 1570, 1713, 1702, 1725, 1443, 498, 1755, 502, - /* 830 */ 534, 567, 1573, 383, 1625, 990, 991, 1573, 2, 1573, - /* 840 */ 267, 1573, 564, 1603, 1573, 537, 1573, 33, 32, 1560, - /* 850 */ 1624, 40, 38, 36, 35, 34, 1773, 137, 1725, 1573, - /* 860 */ 649, 608, 601, 1545, 550, 1616, 1556, 1725, 1442, 1725, - /* 870 */ 352, 549, 1491, 416, 1313, 1314, 411, 410, 409, 408, + /* 0 */ 422, 1671, 423, 1472, 151, 1740, 1435, 430, 317, 423, + /* 10 */ 1472, 1370, 39, 37, 1502, 338, 1737, 1610, 1616, 1618, + /* 20 */ 326, 1438, 1235, 1740, 1896, 1562, 334, 525, 373, 379, + /* 30 */ 1260, 565, 1771, 1310, 1737, 1233, 1737, 1895, 30, 240, + /* 40 */ 518, 1893, 101, 1733, 1739, 100, 99, 98, 97, 96, + /* 50 */ 95, 94, 93, 92, 569, 119, 1305, 985, 1753, 14, + /* 60 */ 61, 1733, 1739, 1733, 1739, 1241, 296, 343, 1896, 39, + /* 70 */ 37, 1373, 569, 439, 569, 474, 473, 326, 517, 1235, + /* 80 */ 472, 157, 1, 116, 469, 1893, 1771, 468, 467, 466, + /* 90 */ 1310, 1002, 1233, 1001, 528, 117, 1377, 989, 990, 1723, + /* 100 */ 330, 548, 1259, 140, 648, 1449, 458, 1896, 138, 527, + /* 110 */ 153, 1838, 1839, 1305, 1843, 210, 14, 1573, 1312, 1313, + /* 120 */ 157, 1003, 1241, 1437, 1893, 1617, 1618, 1784, 1134, 1135, + /* 130 */ 88, 1754, 551, 1756, 1757, 547, 427, 569, 60, 2, + /* 140 */ 1830, 60, 1257, 73, 319, 1826, 152, 110, 109, 108, + /* 150 */ 107, 106, 105, 104, 103, 102, 141, 78, 156, 1054, + /* 160 */ 1528, 648, 1499, 1236, 519, 1234, 1856, 40, 38, 36, + /* 170 */ 35, 34, 474, 473, 1260, 1312, 1313, 472, 1564, 421, + /* 180 */ 116, 469, 425, 203, 468, 467, 466, 1239, 1240, 1056, + /* 190 */ 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, 1303, + /* 200 */ 1304, 1306, 1307, 1308, 1309, 1311, 1314, 565, 33, 32, + /* 210 */ 552, 1320, 40, 38, 36, 35, 34, 1259, 329, 160, + /* 220 */ 1236, 1668, 1234, 625, 624, 623, 341, 1369, 622, 621, + /* 230 */ 620, 121, 615, 614, 613, 612, 611, 610, 609, 608, + /* 240 */ 131, 604, 71, 304, 1239, 1240, 7, 1288, 1289, 1291, + /* 250 */ 1292, 1293, 1294, 1295, 544, 567, 1303, 1304, 1306, 1307, + /* 260 */ 1308, 1309, 1311, 1314, 39, 37, 1896, 60, 565, 42, + /* 270 */ 1623, 1394, 326, 1290, 1235, 160, 1259, 331, 160, 158, + /* 280 */ 412, 167, 607, 1893, 1543, 1310, 1621, 1233, 1092, 592, + /* 290 */ 591, 590, 1096, 589, 1098, 1099, 588, 1101, 585, 603, + /* 300 */ 1107, 582, 1109, 1110, 579, 576, 67, 1896, 1305, 66, + /* 310 */ 310, 14, 511, 1392, 1393, 1395, 1396, 1241, 601, 1235, + /* 320 */ 1894, 39, 37, 1753, 1893, 566, 171, 170, 60, 326, + /* 330 */ 43, 1235, 1233, 488, 2, 1549, 111, 129, 128, 598, + /* 340 */ 597, 596, 1310, 460, 1233, 1261, 486, 372, 484, 371, + /* 350 */ 1241, 1771, 1002, 1571, 1001, 1430, 648, 364, 311, 549, + /* 360 */ 309, 308, 1241, 462, 1723, 1305, 548, 464, 471, 470, + /* 370 */ 1312, 1313, 429, 1258, 1241, 425, 504, 366, 362, 33, + /* 380 */ 32, 529, 1003, 40, 38, 36, 35, 34, 1290, 463, + /* 390 */ 69, 8, 1784, 439, 1753, 87, 1754, 551, 1756, 1757, + /* 400 */ 547, 648, 569, 115, 160, 1830, 160, 1661, 566, 298, + /* 410 */ 1826, 84, 1566, 648, 22, 1236, 1896, 1234, 169, 111, + /* 420 */ 1460, 1896, 1771, 606, 120, 1366, 465, 1312, 1313, 157, + /* 430 */ 549, 244, 1563, 1893, 159, 1723, 1571, 548, 1893, 1239, + /* 440 */ 1240, 1429, 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, + /* 450 */ 567, 1303, 1304, 1306, 1307, 1308, 1309, 1311, 1314, 1262, + /* 460 */ 1236, 1723, 1234, 1784, 525, 160, 88, 1754, 551, 1756, + /* 470 */ 1757, 547, 1236, 569, 1234, 232, 1830, 533, 336, 552, + /* 480 */ 319, 1826, 1909, 490, 1239, 1240, 138, 595, 11, 10, + /* 490 */ 1669, 1864, 119, 1217, 1218, 1573, 1239, 1240, 58, 1288, + /* 500 */ 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, 1303, 1304, + /* 510 */ 1306, 1307, 1308, 1309, 1311, 1314, 39, 37, 1315, 36, + /* 520 */ 35, 34, 525, 1896, 326, 83, 1235, 566, 160, 1478, + /* 530 */ 651, 566, 117, 1560, 69, 80, 157, 1310, 162, 1233, + /* 540 */ 1893, 1547, 377, 1459, 262, 1623, 1623, 154, 1838, 1839, + /* 550 */ 119, 1843, 525, 337, 514, 1571, 1567, 566, 149, 1571, + /* 560 */ 1305, 1622, 1621, 641, 637, 633, 629, 260, 378, 1241, + /* 570 */ 1346, 339, 529, 39, 37, 1753, 566, 643, 1334, 138, + /* 580 */ 119, 326, 566, 1235, 1723, 1571, 9, 382, 1573, 213, + /* 590 */ 117, 1458, 85, 397, 1310, 254, 1233, 245, 246, 603, + /* 600 */ 1450, 1339, 529, 1771, 1571, 230, 1838, 524, 648, 523, + /* 610 */ 1571, 549, 1896, 566, 497, 1457, 1723, 1305, 548, 1711, + /* 620 */ 117, 1556, 1312, 1313, 398, 159, 1241, 1558, 562, 1893, + /* 630 */ 520, 515, 1723, 529, 1456, 230, 1838, 524, 618, 523, + /* 640 */ 27, 1571, 1896, 9, 1784, 50, 1753, 87, 1754, 551, + /* 650 */ 1756, 1757, 547, 1845, 569, 157, 1723, 1830, 304, 1893, + /* 660 */ 212, 298, 1826, 619, 617, 648, 352, 1236, 1554, 1234, + /* 670 */ 1455, 1454, 534, 1896, 1771, 1723, 1453, 1842, 367, 1312, + /* 680 */ 1313, 1209, 549, 205, 138, 1391, 157, 1723, 1452, 548, + /* 690 */ 1893, 1239, 1240, 1574, 1288, 1289, 1291, 1292, 1293, 1294, + /* 700 */ 1295, 544, 567, 1303, 1304, 1306, 1307, 1308, 1309, 1311, + /* 710 */ 1314, 1723, 1723, 525, 1845, 1784, 566, 1723, 88, 1754, + /* 720 */ 551, 1756, 1757, 547, 1236, 569, 1234, 438, 1830, 1723, + /* 730 */ 1451, 531, 319, 1826, 1909, 1529, 1741, 1667, 1841, 1448, + /* 740 */ 305, 119, 1447, 1887, 1571, 1446, 1445, 1737, 1239, 1240, + /* 750 */ 206, 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, + /* 760 */ 1303, 1304, 1306, 1307, 1308, 1309, 1311, 1314, 39, 37, + /* 770 */ 295, 1723, 1257, 543, 1733, 1739, 326, 566, 1235, 405, + /* 780 */ 1723, 117, 417, 1723, 594, 569, 1723, 1723, 1568, 1310, + /* 790 */ 1444, 1233, 599, 989, 990, 1614, 155, 1838, 1839, 390, + /* 800 */ 1843, 418, 512, 392, 26, 1571, 1845, 536, 1443, 1442, + /* 810 */ 33, 32, 1305, 28, 40, 38, 36, 35, 34, 33, + /* 820 */ 32, 1241, 235, 40, 38, 36, 35, 34, 1753, 1441, + /* 830 */ 1840, 1723, 1259, 383, 566, 566, 33, 32, 2, 464, + /* 840 */ 40, 38, 36, 35, 34, 1700, 498, 33, 32, 1723, + /* 850 */ 1723, 40, 38, 36, 35, 34, 1771, 541, 1440, 457, + /* 860 */ 648, 463, 1571, 1571, 528, 1666, 1850, 1366, 305, 1723, + /* 870 */ 1723, 548, 1489, 416, 1312, 1313, 411, 410, 409, 408, /* 880 */ 407, 404, 403, 402, 401, 400, 396, 395, 394, 393, - /* 890 */ 387, 386, 385, 384, 475, 381, 380, 1786, 299, 1245, - /* 900 */ 88, 1756, 552, 1758, 1759, 548, 567, 570, 208, 1725, - /* 910 */ 1832, 1852, 1367, 1486, 319, 1828, 1912, 565, 188, 1237, - /* 920 */ 205, 1235, 1274, 212, 544, 1867, 193, 619, 195, 191, - /* 930 */ 1333, 194, 144, 1370, 1573, 477, 72, 456, 452, 448, - /* 940 */ 444, 187, 197, 1240, 1241, 196, 1289, 1290, 1292, 1293, - /* 950 */ 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, - /* 960 */ 1310, 1312, 1315, 139, 567, 567, 70, 367, 273, 185, - /* 970 */ 52, 501, 595, 50, 199, 256, 340, 198, 1484, 542, - /* 980 */ 216, 1291, 271, 57, 1334, 1452, 56, 1531, 11, 10, - /* 990 */ 513, 235, 1573, 1573, 1434, 1435, 41, 41, 457, 41, - /* 1000 */ 480, 242, 171, 123, 126, 127, 491, 1339, 223, 1244, - /* 1010 */ 1027, 33, 32, 1393, 1774, 40, 38, 36, 35, 34, - /* 1020 */ 218, 342, 1475, 50, 575, 535, 126, 60, 127, 1248, - /* 1030 */ 526, 184, 177, 532, 182, 1613, 1341, 1297, 435, 1186, - /* 1040 */ 1028, 247, 538, 559, 253, 1086, 29, 324, 1328, 1329, - /* 1050 */ 1330, 1331, 1332, 1336, 1337, 1338, 112, 175, 119, 126, - /* 1060 */ 527, 1863, 299, 266, 1114, 86, 1118, 234, 1125, 5, - /* 1070 */ 3, 237, 239, 344, 1258, 347, 351, 306, 1055, 307, - /* 1080 */ 530, 263, 1202, 399, 167, 1665, 406, 414, 413, 419, - /* 1090 */ 1264, 415, 420, 428, 1333, 1267, 1123, 431, 117, 130, - /* 1100 */ 64, 63, 376, 432, 1266, 165, 174, 1325, 1755, 176, - /* 1110 */ 433, 370, 1268, 229, 1840, 525, 434, 524, 179, 436, - /* 1120 */ 1899, 1265, 294, 181, 183, 360, 68, 358, 354, 350, - /* 1130 */ 162, 345, 437, 186, 158, 440, 1773, 459, 1896, 1247, - /* 1140 */ 1707, 461, 91, 1563, 550, 297, 190, 1559, 1334, 1725, - /* 1150 */ 192, 549, 132, 264, 133, 203, 1561, 492, 1557, 134, - /* 1160 */ 135, 1755, 206, 493, 159, 499, 530, 503, 210, 1263, - /* 1170 */ 514, 1339, 1874, 316, 1864, 556, 496, 1786, 1873, 6, - /* 1180 */ 87, 1756, 552, 1758, 1759, 548, 1854, 570, 509, 1773, - /* 1190 */ 1832, 214, 511, 523, 298, 1828, 217, 550, 510, 508, - /* 1200 */ 146, 318, 1725, 1755, 549, 517, 1899, 224, 222, 225, - /* 1210 */ 29, 324, 1328, 1329, 1330, 1331, 1332, 1336, 1337, 1338, - /* 1220 */ 156, 507, 227, 1367, 1896, 118, 1262, 44, 539, 536, - /* 1230 */ 1786, 1773, 1848, 88, 1756, 552, 1758, 1759, 548, 550, - /* 1240 */ 570, 226, 228, 1832, 1725, 18, 549, 319, 1828, 1912, - /* 1250 */ 333, 332, 320, 1813, 560, 561, 1915, 1895, 1890, 249, - /* 1260 */ 1250, 533, 233, 236, 124, 540, 554, 555, 238, 125, - /* 1270 */ 1706, 1311, 1786, 1243, 251, 88, 1756, 552, 1758, 1759, - /* 1280 */ 548, 1755, 570, 265, 1675, 1832, 562, 557, 328, 319, - /* 1290 */ 1828, 1912, 79, 77, 1306, 1617, 1574, 573, 1546, 268, - /* 1300 */ 1851, 645, 646, 1242, 259, 648, 145, 289, 1755, 1773, - /* 1310 */ 51, 291, 290, 270, 272, 1719, 1718, 550, 62, 1717, - /* 1320 */ 1714, 346, 1725, 348, 549, 349, 1229, 1230, 163, 353, - /* 1330 */ 1712, 355, 356, 357, 1711, 359, 1773, 1710, 361, 530, - /* 1340 */ 1709, 1708, 571, 363, 550, 365, 1692, 368, 164, 1725, - /* 1350 */ 1786, 549, 1205, 280, 1756, 552, 1758, 1759, 548, 369, - /* 1360 */ 570, 1204, 1686, 1685, 374, 375, 530, 1684, 1683, 1174, - /* 1370 */ 1658, 1657, 1656, 65, 1655, 1654, 1755, 1786, 1653, 1899, - /* 1380 */ 280, 1756, 552, 1758, 1759, 548, 1652, 570, 1651, 388, - /* 1390 */ 389, 1650, 391, 158, 1649, 1648, 1647, 1896, 1646, 1645, - /* 1400 */ 1644, 1251, 1643, 1246, 1773, 1176, 1899, 1642, 1641, 1640, - /* 1410 */ 1639, 1638, 550, 1637, 1636, 122, 1635, 1725, 1755, 549, - /* 1420 */ 156, 1634, 1633, 1632, 1896, 1254, 1631, 1630, 1629, 1628, - /* 1430 */ 1627, 1626, 1503, 1471, 172, 424, 568, 1304, 1305, 1307, - /* 1440 */ 1308, 1309, 1310, 1755, 150, 1786, 1773, 1021, 89, 1756, - /* 1450 */ 552, 1758, 1759, 548, 547, 570, 113, 993, 1832, 1725, - /* 1460 */ 992, 549, 541, 1828, 426, 1470, 1700, 1694, 1682, 1681, - /* 1470 */ 1667, 1773, 180, 1552, 173, 114, 178, 1502, 1500, 550, - /* 1480 */ 526, 443, 442, 441, 1725, 1498, 549, 1786, 445, 447, - /* 1490 */ 287, 1756, 552, 1758, 1759, 548, 546, 570, 543, 1804, - /* 1500 */ 1755, 446, 1496, 450, 1494, 454, 449, 1483, 119, 453, - /* 1510 */ 1482, 451, 1786, 189, 455, 142, 1756, 552, 1758, 1759, - /* 1520 */ 548, 1467, 570, 1554, 1129, 1128, 1553, 1054, 1773, 49, - /* 1530 */ 530, 1053, 1052, 1051, 617, 1048, 550, 619, 1492, 312, - /* 1540 */ 1047, 1725, 1487, 549, 1046, 1485, 313, 314, 117, 481, - /* 1550 */ 478, 1466, 1465, 483, 485, 1464, 487, 1755, 1699, 90, - /* 1560 */ 531, 1913, 53, 229, 1840, 525, 1212, 524, 1693, 1786, - /* 1570 */ 1899, 494, 89, 1756, 552, 1758, 1759, 548, 1755, 570, - /* 1580 */ 1680, 1678, 1832, 1679, 156, 1773, 207, 1829, 1896, 136, - /* 1590 */ 495, 315, 1677, 550, 1676, 1408, 500, 4, 1725, 41, - /* 1600 */ 549, 45, 15, 215, 23, 47, 1773, 220, 25, 213, - /* 1610 */ 46, 1392, 506, 1385, 550, 143, 16, 219, 24, 1725, - /* 1620 */ 221, 549, 1745, 74, 230, 147, 1786, 1364, 17, 288, - /* 1630 */ 1756, 552, 1758, 1759, 548, 1755, 570, 1420, 13, 1419, - /* 1640 */ 1363, 321, 1425, 1414, 1424, 1423, 322, 1786, 10, 1326, - /* 1650 */ 283, 1756, 552, 1758, 1759, 548, 19, 570, 1755, 1282, - /* 1660 */ 1299, 148, 160, 1773, 31, 551, 1674, 1298, 12, 20, - /* 1670 */ 21, 550, 241, 1390, 1666, 243, 1725, 248, 549, 75, - /* 1680 */ 558, 250, 76, 252, 1744, 255, 1773, 1789, 80, 522, - /* 1690 */ 1301, 1252, 572, 574, 550, 1115, 569, 335, 578, 1725, - /* 1700 */ 1755, 549, 48, 576, 1786, 1112, 579, 142, 1756, 552, - /* 1710 */ 1758, 1759, 548, 323, 570, 1109, 1755, 581, 582, 584, - /* 1720 */ 587, 1092, 594, 1103, 1101, 585, 588, 1786, 1773, 1107, - /* 1730 */ 288, 1756, 552, 1758, 1759, 548, 547, 570, 81, 1106, - /* 1740 */ 1105, 1725, 82, 549, 1773, 1124, 59, 257, 1120, 1019, - /* 1750 */ 603, 1104, 550, 1914, 1043, 606, 258, 1725, 1061, 549, - /* 1760 */ 1041, 1036, 1040, 1039, 1038, 1037, 1755, 1035, 1034, 1786, - /* 1770 */ 1058, 325, 287, 1756, 552, 1758, 1759, 548, 1056, 570, - /* 1780 */ 1031, 1805, 1030, 1029, 1026, 1786, 1025, 1024, 288, 1756, - /* 1790 */ 552, 1758, 1759, 548, 1773, 570, 652, 1499, 627, 629, - /* 1800 */ 628, 1497, 550, 631, 632, 633, 1495, 1725, 635, 549, - /* 1810 */ 262, 636, 1493, 637, 639, 641, 640, 1481, 643, 983, - /* 1820 */ 1463, 327, 261, 1755, 149, 647, 1438, 1238, 650, 642, - /* 1830 */ 638, 634, 630, 260, 1438, 1786, 269, 1438, 288, 1756, - /* 1840 */ 552, 1758, 1759, 548, 651, 570, 1438, 1438, 1438, 1438, - /* 1850 */ 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 85, 550, - /* 1860 */ 1438, 254, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 1870 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1880 */ 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1438, - /* 1890 */ 1438, 1438, 1786, 1438, 563, 274, 1756, 552, 1758, 1759, - /* 1900 */ 548, 1755, 570, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1910 */ 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1920 */ 550, 1438, 1438, 1438, 1438, 1725, 211, 549, 1438, 1773, - /* 1930 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, - /* 1940 */ 1438, 1438, 1725, 1755, 549, 1438, 1438, 1210, 1438, 204, - /* 1950 */ 1438, 1438, 1438, 1786, 1755, 1438, 275, 1756, 552, 1758, - /* 1960 */ 1759, 548, 1438, 570, 1438, 1755, 1438, 1438, 1438, 1438, - /* 1970 */ 1786, 1773, 1438, 276, 1756, 552, 1758, 1759, 548, 550, - /* 1980 */ 570, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 1990 */ 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, - /* 2000 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, - /* 2010 */ 1438, 1438, 1786, 1438, 1438, 282, 1756, 552, 1758, 1759, - /* 2020 */ 548, 1438, 570, 1786, 1438, 1755, 284, 1756, 552, 1758, - /* 2030 */ 1759, 548, 1438, 570, 1786, 1773, 1438, 277, 1756, 552, - /* 2040 */ 1758, 1759, 548, 550, 570, 1438, 1438, 1438, 1725, 1755, - /* 2050 */ 549, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2060 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, - /* 2070 */ 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1773, 1438, 285, - /* 2080 */ 1756, 552, 1758, 1759, 548, 550, 570, 1438, 1438, 1438, - /* 2090 */ 1725, 1438, 549, 1438, 1786, 1438, 1438, 278, 1756, 552, - /* 2100 */ 1758, 1759, 548, 1438, 570, 1755, 1438, 1438, 1438, 1438, - /* 2110 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1438, - /* 2120 */ 1438, 286, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2130 */ 1438, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2140 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, - /* 2150 */ 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, - /* 2160 */ 1438, 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, - /* 2170 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 279, 1756, 552, - /* 2180 */ 1758, 1759, 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, - /* 2190 */ 1438, 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, - /* 2200 */ 1438, 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, - /* 2210 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, - /* 2220 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 292, 1756, 552, - /* 2230 */ 1758, 1759, 548, 1755, 570, 1786, 1773, 1438, 293, 1756, - /* 2240 */ 552, 1758, 1759, 548, 550, 570, 1438, 1773, 1438, 1725, - /* 2250 */ 1438, 549, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2260 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2270 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1786, 1438, 1438, - /* 2280 */ 1767, 1756, 552, 1758, 1759, 548, 1438, 570, 1786, 1755, - /* 2290 */ 1438, 1766, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2300 */ 1438, 1438, 1786, 1755, 1438, 1765, 1756, 552, 1758, 1759, - /* 2310 */ 548, 1438, 570, 1438, 1438, 1438, 1438, 1773, 1438, 1438, - /* 2320 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2330 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2340 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 2350 */ 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1786, 1438, - /* 2360 */ 1438, 302, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2370 */ 1438, 1438, 1786, 1438, 1438, 301, 1756, 552, 1758, 1759, - /* 2380 */ 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2390 */ 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, 1438, 1438, - /* 2400 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, - /* 2410 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2420 */ 1438, 1438, 1786, 1773, 1438, 303, 1756, 552, 1758, 1759, - /* 2430 */ 548, 550, 570, 1438, 1438, 1438, 1725, 1773, 549, 1438, - /* 2440 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2450 */ 1725, 1438, 549, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2460 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 300, 1756, 552, - /* 2470 */ 1758, 1759, 548, 1438, 570, 1438, 1438, 1438, 1786, 1438, - /* 2480 */ 1438, 281, 1756, 552, 1758, 1759, 548, 1438, 570, + /* 890 */ 387, 386, 385, 384, 475, 381, 380, 1784, 299, 1723, + /* 900 */ 88, 1754, 551, 1756, 1757, 547, 566, 569, 491, 566, + /* 910 */ 1830, 1273, 566, 566, 319, 1826, 152, 502, 224, 1236, + /* 920 */ 563, 1234, 1273, 564, 256, 600, 44, 4, 1614, 267, + /* 930 */ 1332, 217, 1601, 342, 1571, 194, 1857, 1571, 192, 1772, + /* 940 */ 1571, 1571, 196, 1239, 1240, 195, 1288, 1289, 1291, 1292, + /* 950 */ 1293, 1294, 1295, 544, 567, 1303, 1304, 1306, 1307, 1308, + /* 960 */ 1309, 1311, 1314, 139, 198, 52, 501, 197, 273, 101, + /* 970 */ 566, 219, 100, 99, 98, 97, 96, 95, 94, 93, + /* 980 */ 92, 340, 271, 57, 1333, 1324, 56, 200, 33, 32, + /* 990 */ 199, 1484, 40, 38, 36, 35, 34, 1753, 1571, 1482, + /* 1000 */ 1432, 1433, 172, 1290, 537, 41, 209, 1338, 11, 10, + /* 1010 */ 1244, 33, 32, 477, 1243, 40, 38, 36, 35, 34, + /* 1020 */ 41, 480, 1743, 1473, 41, 1771, 1611, 60, 242, 1860, + /* 1030 */ 526, 1026, 229, 549, 72, 123, 3, 126, 1723, 1548, + /* 1040 */ 548, 127, 234, 237, 239, 1340, 29, 324, 1327, 1328, + /* 1050 */ 1329, 1330, 1331, 1335, 1336, 1337, 50, 574, 1745, 126, + /* 1060 */ 1296, 1027, 299, 1404, 1185, 86, 1784, 5, 247, 89, + /* 1070 */ 1754, 551, 1756, 1757, 547, 558, 569, 253, 344, 1830, + /* 1080 */ 347, 1085, 1257, 1829, 1826, 351, 306, 1054, 307, 479, + /* 1090 */ 1201, 263, 399, 1663, 1332, 168, 266, 1113, 127, 1117, + /* 1100 */ 64, 63, 376, 112, 489, 166, 1753, 1546, 406, 414, + /* 1110 */ 126, 370, 413, 415, 333, 332, 419, 1263, 202, 420, + /* 1120 */ 428, 1266, 294, 431, 1249, 360, 175, 358, 354, 350, + /* 1130 */ 163, 345, 482, 601, 1771, 1310, 476, 1242, 1124, 432, + /* 1140 */ 1247, 201, 549, 1122, 1246, 177, 1265, 1723, 1333, 548, + /* 1150 */ 130, 433, 129, 128, 598, 597, 596, 1267, 1305, 434, + /* 1160 */ 180, 436, 182, 1264, 160, 437, 55, 1241, 184, 54, + /* 1170 */ 68, 1338, 440, 187, 459, 1784, 264, 461, 88, 1754, + /* 1180 */ 551, 1756, 1757, 547, 1705, 569, 91, 1561, 1830, 297, + /* 1190 */ 191, 1557, 319, 1826, 1909, 193, 132, 1753, 133, 1559, + /* 1200 */ 204, 601, 1555, 1849, 134, 135, 570, 492, 493, 496, + /* 1210 */ 29, 324, 1327, 1328, 1329, 1330, 1331, 1335, 1336, 1337, + /* 1220 */ 129, 128, 598, 597, 596, 1771, 207, 189, 499, 503, + /* 1230 */ 316, 1262, 211, 549, 508, 513, 1861, 555, 1723, 6, + /* 1240 */ 548, 144, 1871, 215, 1870, 510, 456, 452, 448, 444, + /* 1250 */ 188, 218, 318, 516, 1852, 529, 33, 32, 522, 223, + /* 1260 */ 40, 38, 36, 35, 34, 1250, 1784, 1245, 509, 280, + /* 1270 */ 1754, 551, 1756, 1757, 547, 70, 569, 507, 186, 33, + /* 1280 */ 32, 1753, 225, 40, 38, 36, 35, 34, 146, 1253, + /* 1290 */ 226, 506, 228, 227, 1366, 1896, 1261, 1846, 118, 1892, + /* 1300 */ 567, 1303, 1304, 1306, 1307, 1308, 1309, 538, 159, 1771, + /* 1310 */ 535, 18, 1893, 233, 320, 1912, 532, 549, 236, 553, + /* 1320 */ 539, 238, 1723, 124, 548, 1811, 554, 125, 1704, 1673, + /* 1330 */ 559, 1384, 560, 1753, 556, 328, 249, 251, 265, 529, + /* 1340 */ 185, 178, 77, 183, 561, 1572, 79, 435, 572, 1544, + /* 1350 */ 1784, 1615, 268, 280, 1754, 551, 1756, 1757, 547, 259, + /* 1360 */ 569, 1771, 644, 51, 645, 647, 176, 145, 289, 549, + /* 1370 */ 291, 272, 1717, 290, 1723, 270, 548, 1716, 62, 1896, + /* 1380 */ 1715, 346, 1712, 348, 349, 1753, 1228, 1229, 164, 353, + /* 1390 */ 1710, 355, 157, 356, 357, 1709, 1893, 359, 1708, 361, + /* 1400 */ 1707, 1753, 1784, 363, 1706, 89, 1754, 551, 1756, 1757, + /* 1410 */ 547, 365, 569, 1771, 1690, 1830, 369, 165, 368, 540, + /* 1420 */ 1826, 546, 1204, 1203, 1684, 1683, 1723, 375, 548, 1771, + /* 1430 */ 1682, 374, 1681, 1173, 1656, 1655, 1654, 549, 65, 1653, + /* 1440 */ 1652, 1651, 1723, 1650, 548, 1649, 388, 389, 1648, 391, + /* 1450 */ 1647, 1753, 122, 1633, 1784, 1646, 1645, 287, 1754, 551, + /* 1460 */ 1756, 1757, 547, 545, 569, 542, 1802, 1753, 1644, 1643, + /* 1470 */ 1784, 1642, 1641, 142, 1754, 551, 1756, 1757, 547, 1771, + /* 1480 */ 569, 1640, 1639, 1638, 1637, 1636, 1635, 549, 1634, 1632, + /* 1490 */ 1631, 1630, 1723, 1629, 548, 1771, 1628, 1175, 1627, 1626, + /* 1500 */ 1625, 1624, 1501, 549, 1469, 173, 113, 424, 1723, 1753, + /* 1510 */ 548, 992, 426, 150, 1468, 1698, 174, 530, 1910, 991, + /* 1520 */ 1784, 1753, 505, 89, 1754, 551, 1756, 1757, 547, 1692, + /* 1530 */ 569, 114, 1680, 1830, 179, 1679, 1784, 1771, 1827, 288, + /* 1540 */ 1754, 551, 1756, 1757, 547, 549, 569, 181, 1665, 1771, + /* 1550 */ 1723, 1550, 548, 1500, 1020, 1498, 441, 549, 442, 443, + /* 1560 */ 1496, 445, 1723, 446, 548, 1494, 447, 451, 449, 450, + /* 1570 */ 1492, 1753, 453, 1481, 1480, 455, 1465, 454, 1784, 1552, + /* 1580 */ 1127, 283, 1754, 551, 1756, 1757, 547, 1753, 569, 1128, + /* 1590 */ 1784, 1551, 190, 142, 1754, 551, 1756, 1757, 547, 1771, + /* 1600 */ 569, 49, 1053, 1052, 1051, 616, 1050, 549, 1490, 618, + /* 1610 */ 1047, 312, 1723, 1046, 548, 1771, 1045, 1485, 313, 521, + /* 1620 */ 1483, 478, 314, 546, 1464, 481, 323, 483, 1723, 1463, + /* 1630 */ 548, 1462, 485, 487, 90, 1697, 1211, 53, 1911, 1753, + /* 1640 */ 1784, 1691, 136, 288, 1754, 551, 1756, 1757, 547, 494, + /* 1650 */ 569, 1678, 1676, 208, 1677, 1753, 1784, 495, 315, 287, + /* 1660 */ 1754, 551, 1756, 1757, 547, 500, 569, 1771, 1803, 1675, + /* 1670 */ 1674, 41, 15, 47, 16, 549, 23, 221, 1406, 222, + /* 1680 */ 1723, 214, 548, 1771, 1743, 216, 1390, 143, 220, 24, + /* 1690 */ 25, 549, 1383, 1363, 325, 74, 1723, 45, 548, 1362, + /* 1700 */ 13, 231, 46, 17, 147, 1753, 1423, 1418, 1784, 1412, + /* 1710 */ 327, 288, 1754, 551, 1756, 1757, 547, 1753, 569, 1417, + /* 1720 */ 321, 1422, 1421, 322, 1784, 10, 1325, 288, 1754, 551, + /* 1730 */ 1756, 1757, 547, 1771, 569, 19, 1298, 148, 31, 161, + /* 1740 */ 1281, 549, 1672, 1664, 1297, 1771, 1723, 12, 548, 20, + /* 1750 */ 550, 241, 557, 549, 1388, 21, 243, 248, 1723, 75, + /* 1760 */ 548, 250, 76, 1742, 252, 255, 1300, 1251, 80, 573, + /* 1770 */ 335, 1753, 1787, 577, 1784, 571, 568, 274, 1754, 551, + /* 1780 */ 1756, 1757, 547, 48, 569, 1114, 1784, 1753, 575, 275, + /* 1790 */ 1754, 551, 1756, 1757, 547, 1111, 569, 578, 1753, 1771, + /* 1800 */ 580, 583, 586, 1108, 1102, 1091, 581, 549, 584, 1106, + /* 1810 */ 1100, 587, 1723, 1105, 548, 1771, 1104, 1123, 81, 1103, + /* 1820 */ 257, 82, 593, 549, 1119, 1042, 1771, 602, 1723, 59, + /* 1830 */ 548, 1018, 605, 1040, 549, 1060, 258, 1035, 1039, 1723, + /* 1840 */ 1784, 548, 1038, 276, 1754, 551, 1756, 1757, 547, 1037, + /* 1850 */ 569, 1753, 1036, 1034, 1033, 1055, 1784, 1057, 1030, 282, + /* 1860 */ 1754, 551, 1756, 1757, 547, 1029, 569, 1784, 1753, 1028, + /* 1870 */ 284, 1754, 551, 1756, 1757, 547, 1497, 569, 1025, 1771, + /* 1880 */ 1024, 1023, 626, 627, 1495, 630, 631, 549, 628, 1493, + /* 1890 */ 632, 634, 1723, 1753, 548, 635, 1771, 636, 1491, 638, + /* 1900 */ 639, 640, 1479, 642, 549, 982, 1461, 261, 646, 1723, + /* 1910 */ 1753, 548, 1237, 269, 1436, 649, 650, 1436, 1436, 1436, + /* 1920 */ 1784, 1771, 1436, 277, 1754, 551, 1756, 1757, 547, 549, + /* 1930 */ 569, 1436, 1436, 1436, 1723, 1436, 548, 1784, 1771, 1436, + /* 1940 */ 285, 1754, 551, 1756, 1757, 547, 549, 569, 1436, 1436, + /* 1950 */ 1436, 1723, 1753, 548, 1436, 1436, 1436, 1436, 1436, 1436, + /* 1960 */ 1436, 1436, 1784, 1436, 1753, 278, 1754, 551, 1756, 1757, + /* 1970 */ 547, 1436, 569, 1436, 1436, 1436, 1436, 1436, 1436, 1784, + /* 1980 */ 1771, 1436, 286, 1754, 551, 1756, 1757, 547, 549, 569, + /* 1990 */ 1436, 1436, 1771, 1723, 1436, 548, 1436, 1436, 1436, 1436, + /* 2000 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, + /* 2010 */ 1436, 1436, 1436, 1436, 1753, 1436, 1436, 1436, 1436, 1436, + /* 2020 */ 1436, 1784, 1436, 1436, 279, 1754, 551, 1756, 1757, 547, + /* 2030 */ 1436, 569, 1753, 1784, 1436, 1436, 292, 1754, 551, 1756, + /* 2040 */ 1757, 547, 1771, 569, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2050 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, + /* 2060 */ 1771, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 549, 1436, + /* 2070 */ 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, 1436, 1436, + /* 2080 */ 1436, 1436, 1753, 1784, 1436, 1436, 293, 1754, 551, 1756, + /* 2090 */ 1757, 547, 1436, 569, 1753, 1436, 1436, 1436, 1436, 1436, + /* 2100 */ 1436, 1784, 1436, 1436, 1765, 1754, 551, 1756, 1757, 547, + /* 2110 */ 1771, 569, 1436, 1436, 1436, 1436, 1436, 1436, 549, 1436, + /* 2120 */ 1436, 1436, 1771, 1723, 1436, 548, 1436, 1436, 1436, 1436, + /* 2130 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, + /* 2140 */ 1436, 1436, 1436, 1436, 1436, 1436, 1753, 1436, 1436, 1436, + /* 2150 */ 1436, 1784, 1436, 1436, 1764, 1754, 551, 1756, 1757, 547, + /* 2160 */ 1436, 569, 1436, 1784, 1753, 1436, 1763, 1754, 551, 1756, + /* 2170 */ 1757, 547, 1436, 569, 1771, 1436, 1436, 1436, 1436, 1436, + /* 2180 */ 1436, 1436, 549, 1436, 1436, 1436, 1436, 1723, 1753, 548, + /* 2190 */ 1436, 1436, 1771, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2200 */ 549, 1436, 1436, 1436, 1436, 1723, 1753, 548, 1436, 1436, + /* 2210 */ 1436, 1436, 1436, 1436, 1436, 1784, 1771, 1436, 302, 1754, + /* 2220 */ 551, 1756, 1757, 547, 549, 569, 1436, 1436, 1436, 1723, + /* 2230 */ 1436, 548, 1436, 1784, 1771, 1436, 301, 1754, 551, 1756, + /* 2240 */ 1757, 547, 549, 569, 1436, 1436, 1436, 1723, 1436, 548, + /* 2250 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1784, 1436, 1753, + /* 2260 */ 303, 1754, 551, 1756, 1757, 547, 1436, 569, 1436, 1436, + /* 2270 */ 1436, 1436, 1436, 1436, 1436, 1784, 1436, 1436, 300, 1754, + /* 2280 */ 551, 1756, 1757, 547, 1436, 569, 1436, 1771, 1436, 1436, + /* 2290 */ 1436, 1436, 1436, 1436, 1436, 549, 1436, 1436, 1436, 1436, + /* 2300 */ 1723, 1436, 548, 1436, 33, 32, 1436, 1436, 40, 38, + /* 2310 */ 36, 35, 34, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2320 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1784, 1436, + /* 2330 */ 1436, 281, 1754, 551, 1756, 1757, 547, 1436, 569, 1436, + /* 2340 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2350 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2360 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2370 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2380 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2390 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2400 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2410 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2420 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2430 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 2440 */ 1436, 1436, 1436, 1436, 1436, 1436, 137, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 261, 257, 250, 259, 260, 283, 0, 257, 286, 259, - /* 10 */ 260, 272, 12, 13, 0, 252, 294, 254, 279, 265, - /* 20 */ 20, 0, 22, 283, 21, 280, 286, 261, 289, 283, - /* 30 */ 20, 20, 278, 33, 294, 35, 323, 34, 293, 36, - /* 40 */ 294, 287, 21, 321, 322, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 332, 289, 56, 281, 253, 59, - /* 60 */ 347, 321, 322, 311, 288, 65, 311, 321, 322, 12, - /* 70 */ 13, 14, 332, 297, 20, 61, 62, 20, 332, 22, - /* 80 */ 66, 323, 82, 69, 70, 296, 281, 73, 74, 75, - /* 90 */ 33, 281, 35, 304, 289, 329, 307, 261, 288, 294, - /* 100 */ 253, 296, 311, 351, 104, 347, 351, 297, 272, 343, - /* 110 */ 344, 345, 346, 56, 348, 279, 59, 365, 118, 119, - /* 120 */ 365, 369, 65, 0, 369, 289, 0, 322, 118, 119, - /* 130 */ 325, 326, 327, 328, 329, 330, 82, 332, 263, 82, - /* 140 */ 335, 294, 351, 56, 339, 340, 341, 24, 25, 26, - /* 150 */ 27, 28, 29, 30, 31, 32, 365, 58, 353, 284, - /* 160 */ 369, 104, 0, 163, 266, 165, 361, 362, 270, 82, - /* 170 */ 20, 84, 61, 62, 48, 118, 119, 66, 283, 292, - /* 180 */ 69, 70, 295, 296, 73, 74, 75, 187, 188, 294, + /* 0 */ 257, 0, 259, 260, 280, 283, 250, 257, 286, 259, + /* 10 */ 260, 4, 12, 13, 0, 292, 294, 293, 295, 296, + /* 20 */ 20, 0, 22, 283, 351, 283, 286, 261, 311, 261, + /* 30 */ 20, 20, 281, 33, 294, 35, 294, 364, 336, 337, + /* 40 */ 289, 368, 21, 321, 322, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 332, 289, 56, 4, 253, 59, + /* 60 */ 4, 321, 322, 321, 322, 65, 298, 311, 351, 12, + /* 70 */ 13, 14, 332, 58, 332, 61, 62, 20, 327, 22, + /* 80 */ 66, 364, 82, 69, 70, 368, 281, 73, 74, 75, + /* 90 */ 33, 20, 35, 22, 289, 329, 14, 44, 45, 294, + /* 100 */ 273, 296, 20, 252, 104, 254, 35, 351, 281, 343, + /* 110 */ 344, 345, 346, 56, 348, 56, 59, 290, 118, 119, + /* 120 */ 364, 50, 65, 0, 368, 295, 296, 322, 118, 119, + /* 130 */ 325, 326, 327, 328, 329, 330, 14, 332, 82, 82, + /* 140 */ 335, 82, 20, 84, 339, 340, 341, 24, 25, 26, + /* 150 */ 27, 28, 29, 30, 31, 32, 266, 263, 353, 35, + /* 160 */ 270, 104, 0, 163, 20, 165, 361, 12, 13, 14, + /* 170 */ 15, 16, 61, 62, 20, 118, 119, 66, 284, 258, + /* 180 */ 69, 70, 261, 114, 73, 74, 75, 187, 188, 65, /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - /* 200 */ 200, 201, 202, 203, 204, 205, 206, 8, 9, 113, - /* 210 */ 114, 12, 13, 14, 15, 16, 321, 322, 258, 219, - /* 220 */ 163, 261, 165, 61, 62, 63, 64, 332, 66, 67, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 20, 8, 9, + /* 210 */ 296, 14, 12, 13, 14, 15, 16, 20, 304, 219, + /* 220 */ 163, 307, 165, 61, 62, 63, 64, 220, 66, 67, /* 230 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - /* 240 */ 78, 79, 20, 4, 187, 188, 4, 190, 191, 192, + /* 240 */ 78, 79, 173, 174, 187, 188, 39, 190, 191, 192, /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - /* 260 */ 203, 204, 205, 206, 12, 13, 20, 22, 82, 311, - /* 270 */ 174, 187, 20, 219, 22, 12, 13, 14, 15, 16, - /* 280 */ 35, 20, 83, 44, 45, 33, 263, 35, 95, 96, - /* 290 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 276, - /* 300 */ 107, 108, 109, 110, 111, 112, 219, 284, 56, 351, - /* 310 */ 65, 59, 228, 229, 230, 231, 232, 65, 94, 0, - /* 320 */ 261, 12, 13, 365, 82, 253, 58, 369, 82, 20, - /* 330 */ 20, 22, 22, 20, 82, 273, 82, 113, 114, 115, - /* 340 */ 116, 117, 33, 281, 35, 35, 273, 20, 162, 104, - /* 350 */ 164, 261, 290, 281, 281, 351, 104, 298, 0, 273, - /* 360 */ 50, 289, 113, 290, 351, 56, 294, 281, 296, 365, - /* 370 */ 118, 119, 150, 369, 65, 351, 290, 58, 365, 289, - /* 380 */ 8, 9, 369, 311, 12, 13, 14, 15, 16, 365, - /* 390 */ 14, 82, 261, 369, 322, 289, 20, 325, 326, 327, - /* 400 */ 328, 329, 330, 272, 332, 219, 300, 335, 163, 158, - /* 410 */ 165, 339, 340, 104, 281, 163, 58, 165, 148, 329, - /* 420 */ 289, 82, 289, 351, 175, 176, 65, 118, 119, 178, - /* 430 */ 179, 92, 187, 188, 344, 345, 346, 365, 348, 187, - /* 440 */ 188, 369, 190, 191, 192, 193, 194, 195, 196, 197, - /* 450 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 21, - /* 460 */ 327, 219, 24, 25, 26, 27, 28, 29, 30, 31, - /* 470 */ 32, 14, 163, 219, 165, 8, 9, 20, 2, 12, - /* 480 */ 13, 14, 15, 16, 8, 9, 76, 14, 12, 13, - /* 490 */ 14, 15, 16, 20, 224, 225, 187, 188, 93, 190, + /* 260 */ 203, 204, 205, 206, 12, 13, 351, 82, 20, 82, + /* 270 */ 281, 187, 20, 191, 22, 219, 20, 288, 219, 364, + /* 280 */ 76, 56, 269, 368, 271, 33, 297, 35, 95, 96, + /* 290 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 58, + /* 300 */ 107, 108, 109, 110, 111, 112, 81, 351, 56, 84, + /* 310 */ 37, 59, 228, 229, 230, 231, 232, 65, 94, 22, + /* 320 */ 364, 12, 13, 253, 368, 261, 122, 123, 82, 20, + /* 330 */ 82, 22, 35, 21, 82, 0, 272, 113, 114, 115, + /* 340 */ 116, 117, 33, 279, 35, 20, 34, 162, 36, 164, + /* 350 */ 65, 281, 20, 289, 22, 155, 104, 158, 85, 289, + /* 360 */ 87, 88, 65, 90, 294, 56, 296, 94, 267, 268, + /* 370 */ 118, 119, 258, 20, 65, 261, 311, 178, 179, 8, + /* 380 */ 9, 311, 50, 12, 13, 14, 15, 16, 191, 116, + /* 390 */ 265, 82, 322, 58, 253, 325, 326, 327, 328, 329, + /* 400 */ 330, 104, 332, 278, 219, 335, 219, 289, 261, 339, + /* 410 */ 340, 263, 287, 104, 43, 163, 351, 165, 300, 272, + /* 420 */ 253, 351, 281, 65, 276, 218, 279, 118, 119, 364, + /* 430 */ 289, 113, 284, 368, 364, 294, 289, 296, 368, 187, + /* 440 */ 188, 241, 190, 191, 192, 193, 194, 195, 196, 197, + /* 450 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 20, + /* 460 */ 163, 294, 165, 322, 261, 219, 325, 326, 327, 328, + /* 470 */ 329, 330, 163, 332, 165, 150, 335, 43, 273, 296, + /* 480 */ 339, 340, 341, 311, 187, 188, 281, 93, 1, 2, + /* 490 */ 307, 350, 289, 175, 176, 290, 187, 188, 3, 190, /* 500 */ 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - /* 510 */ 201, 202, 203, 204, 205, 206, 12, 13, 14, 261, - /* 520 */ 114, 336, 337, 261, 20, 65, 22, 155, 219, 253, - /* 530 */ 272, 253, 122, 123, 272, 46, 20, 33, 22, 35, - /* 540 */ 315, 253, 2, 14, 15, 16, 39, 289, 8, 9, - /* 550 */ 83, 289, 12, 13, 14, 15, 16, 8, 9, 253, - /* 560 */ 56, 12, 13, 14, 15, 16, 50, 191, 253, 65, - /* 570 */ 294, 82, 294, 12, 13, 253, 295, 296, 4, 173, - /* 580 */ 174, 20, 294, 22, 8, 9, 82, 281, 12, 13, - /* 590 */ 14, 15, 16, 19, 33, 289, 35, 281, 265, 261, - /* 600 */ 294, 261, 296, 281, 1, 2, 290, 33, 104, 294, - /* 610 */ 272, 289, 272, 241, 56, 253, 294, 56, 296, 43, - /* 620 */ 287, 47, 118, 119, 0, 51, 65, 289, 322, 289, - /* 630 */ 56, 325, 326, 327, 328, 329, 330, 258, 332, 81, - /* 640 */ 261, 335, 84, 82, 322, 339, 340, 325, 326, 327, - /* 650 */ 328, 329, 330, 35, 332, 81, 294, 335, 84, 261, - /* 660 */ 282, 339, 340, 341, 191, 104, 145, 163, 282, 165, - /* 670 */ 8, 9, 253, 253, 12, 13, 14, 15, 16, 118, - /* 680 */ 119, 0, 291, 65, 362, 294, 83, 289, 253, 168, - /* 690 */ 253, 187, 188, 253, 190, 191, 192, 193, 194, 195, + /* 510 */ 201, 202, 203, 204, 205, 206, 12, 13, 14, 14, + /* 520 */ 15, 16, 261, 351, 20, 82, 22, 261, 219, 0, + /* 530 */ 19, 261, 329, 282, 265, 92, 364, 33, 272, 35, + /* 540 */ 368, 0, 272, 253, 33, 281, 281, 344, 345, 346, + /* 550 */ 289, 348, 261, 288, 148, 289, 287, 261, 47, 289, + /* 560 */ 56, 297, 297, 52, 53, 54, 55, 56, 272, 65, + /* 570 */ 83, 273, 311, 12, 13, 253, 261, 48, 145, 281, + /* 580 */ 289, 20, 261, 22, 294, 289, 82, 272, 290, 150, + /* 590 */ 329, 253, 81, 272, 33, 84, 35, 113, 114, 58, + /* 600 */ 254, 168, 311, 281, 289, 344, 345, 346, 104, 348, + /* 610 */ 289, 289, 351, 261, 315, 253, 294, 56, 296, 0, + /* 620 */ 329, 282, 118, 119, 272, 364, 65, 282, 117, 368, + /* 630 */ 224, 225, 294, 311, 253, 344, 345, 346, 43, 348, + /* 640 */ 207, 289, 351, 82, 322, 43, 253, 325, 326, 327, + /* 650 */ 328, 329, 330, 323, 332, 364, 294, 335, 174, 368, + /* 660 */ 149, 339, 340, 267, 268, 104, 47, 163, 282, 165, + /* 670 */ 253, 253, 238, 351, 281, 294, 253, 347, 83, 118, + /* 680 */ 119, 170, 289, 172, 281, 83, 364, 294, 253, 296, + /* 690 */ 368, 187, 188, 290, 190, 191, 192, 193, 194, 195, /* 700 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - /* 710 */ 206, 267, 268, 294, 294, 8, 9, 4, 94, 12, - /* 720 */ 13, 14, 15, 16, 163, 218, 165, 329, 207, 294, - /* 730 */ 253, 294, 253, 253, 294, 37, 253, 113, 114, 115, - /* 740 */ 116, 117, 344, 345, 346, 83, 348, 306, 187, 188, - /* 750 */ 309, 190, 191, 192, 193, 194, 195, 196, 197, 198, + /* 710 */ 206, 294, 294, 261, 323, 322, 261, 294, 325, 326, + /* 720 */ 327, 328, 329, 330, 163, 332, 165, 272, 335, 294, + /* 730 */ 253, 236, 339, 340, 341, 270, 283, 306, 347, 253, + /* 740 */ 309, 289, 253, 350, 289, 253, 253, 294, 187, 188, + /* 750 */ 282, 190, 191, 192, 193, 194, 195, 196, 197, 198, /* 760 */ 199, 200, 201, 202, 203, 204, 205, 206, 12, 13, - /* 770 */ 18, 294, 20, 294, 294, 94, 20, 294, 22, 27, - /* 780 */ 94, 323, 30, 85, 253, 87, 88, 306, 90, 33, - /* 790 */ 309, 35, 94, 20, 113, 114, 115, 116, 117, 47, - /* 800 */ 3, 49, 116, 51, 261, 347, 267, 268, 296, 261, - /* 810 */ 20, 261, 56, 261, 116, 272, 261, 253, 261, 307, - /* 820 */ 272, 65, 272, 0, 272, 294, 253, 272, 253, 272, - /* 830 */ 43, 261, 289, 81, 281, 44, 45, 289, 82, 289, - /* 840 */ 274, 289, 272, 277, 289, 43, 289, 8, 9, 282, - /* 850 */ 297, 12, 13, 14, 15, 16, 281, 150, 294, 289, - /* 860 */ 104, 269, 291, 271, 289, 294, 282, 294, 253, 294, - /* 870 */ 47, 296, 0, 121, 118, 119, 124, 125, 126, 127, + /* 770 */ 18, 294, 20, 282, 321, 322, 20, 261, 22, 27, + /* 780 */ 294, 329, 30, 294, 282, 332, 294, 294, 272, 33, + /* 790 */ 253, 35, 291, 44, 45, 294, 344, 345, 346, 47, + /* 800 */ 348, 49, 362, 51, 2, 289, 323, 43, 253, 253, + /* 810 */ 8, 9, 56, 2, 12, 13, 14, 15, 16, 8, + /* 820 */ 9, 65, 371, 12, 13, 14, 15, 16, 253, 253, + /* 830 */ 347, 294, 20, 81, 261, 261, 8, 9, 82, 94, + /* 840 */ 12, 13, 14, 15, 16, 272, 272, 8, 9, 294, + /* 850 */ 294, 12, 13, 14, 15, 16, 281, 59, 253, 262, + /* 860 */ 104, 116, 289, 289, 289, 306, 217, 218, 309, 294, + /* 870 */ 294, 296, 0, 121, 118, 119, 124, 125, 126, 127, /* 880 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - /* 890 */ 138, 139, 140, 141, 22, 143, 144, 322, 59, 35, - /* 900 */ 325, 326, 327, 328, 329, 330, 261, 332, 56, 294, - /* 910 */ 335, 217, 218, 0, 339, 340, 341, 272, 33, 163, - /* 920 */ 282, 165, 83, 150, 282, 350, 86, 43, 86, 89, - /* 930 */ 91, 89, 47, 220, 289, 22, 84, 52, 53, 54, - /* 940 */ 55, 56, 86, 187, 188, 89, 190, 191, 192, 193, + /* 890 */ 138, 139, 140, 141, 22, 143, 144, 322, 59, 294, + /* 900 */ 325, 326, 327, 328, 329, 330, 261, 332, 318, 261, + /* 910 */ 335, 83, 261, 261, 339, 340, 341, 272, 358, 163, + /* 920 */ 272, 165, 83, 272, 272, 291, 42, 43, 294, 274, + /* 930 */ 91, 43, 277, 262, 289, 86, 361, 289, 89, 281, + /* 940 */ 289, 289, 86, 187, 188, 89, 190, 191, 192, 193, /* 950 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - /* 960 */ 204, 205, 206, 18, 261, 261, 81, 83, 23, 84, - /* 970 */ 150, 151, 282, 43, 86, 272, 272, 89, 0, 59, - /* 980 */ 43, 191, 37, 38, 145, 254, 41, 270, 1, 2, - /* 990 */ 363, 372, 289, 289, 118, 119, 43, 43, 262, 43, - /* 1000 */ 22, 43, 57, 43, 43, 43, 318, 168, 358, 35, - /* 1010 */ 35, 8, 9, 83, 281, 12, 13, 14, 15, 16, - /* 1020 */ 83, 262, 260, 43, 43, 238, 43, 82, 43, 165, - /* 1030 */ 261, 146, 147, 236, 149, 293, 83, 83, 153, 83, - /* 1040 */ 65, 83, 240, 83, 83, 83, 207, 208, 209, 210, - /* 1050 */ 211, 212, 213, 214, 215, 216, 43, 172, 289, 43, - /* 1060 */ 349, 324, 59, 83, 83, 120, 83, 366, 83, 221, - /* 1070 */ 352, 366, 366, 320, 20, 261, 47, 319, 35, 267, - /* 1080 */ 311, 313, 161, 261, 42, 261, 301, 145, 299, 261, - /* 1090 */ 20, 299, 255, 255, 91, 20, 83, 317, 329, 83, - /* 1100 */ 155, 156, 157, 296, 20, 160, 265, 187, 253, 265, - /* 1110 */ 310, 166, 20, 344, 345, 346, 312, 348, 265, 310, - /* 1120 */ 351, 20, 177, 265, 265, 180, 265, 182, 183, 184, - /* 1130 */ 185, 186, 302, 265, 365, 261, 281, 255, 369, 165, - /* 1140 */ 294, 281, 261, 281, 289, 255, 281, 281, 145, 294, - /* 1150 */ 281, 296, 281, 317, 281, 263, 281, 171, 281, 281, - /* 1160 */ 281, 253, 263, 316, 219, 261, 311, 261, 263, 20, - /* 1170 */ 227, 168, 357, 310, 324, 226, 296, 322, 357, 233, - /* 1180 */ 325, 326, 327, 328, 329, 330, 360, 332, 294, 281, - /* 1190 */ 335, 305, 294, 154, 339, 340, 305, 289, 235, 234, - /* 1200 */ 357, 294, 294, 253, 296, 294, 351, 356, 359, 355, + /* 960 */ 204, 205, 206, 18, 86, 150, 151, 89, 23, 21, + /* 970 */ 261, 83, 24, 25, 26, 27, 28, 29, 30, 31, + /* 980 */ 32, 272, 37, 38, 145, 187, 41, 86, 8, 9, + /* 990 */ 89, 0, 12, 13, 14, 15, 16, 253, 289, 0, + /* 1000 */ 118, 119, 57, 191, 240, 43, 56, 168, 1, 2, + /* 1010 */ 35, 8, 9, 22, 35, 12, 13, 14, 15, 16, + /* 1020 */ 43, 22, 46, 260, 43, 281, 293, 82, 43, 324, + /* 1030 */ 349, 35, 342, 289, 84, 43, 352, 43, 294, 0, + /* 1040 */ 296, 43, 365, 365, 365, 83, 207, 208, 209, 210, + /* 1050 */ 211, 212, 213, 214, 215, 216, 43, 43, 82, 43, + /* 1060 */ 83, 65, 59, 83, 83, 120, 322, 221, 83, 325, + /* 1070 */ 326, 327, 328, 329, 330, 83, 332, 83, 320, 335, + /* 1080 */ 261, 83, 20, 339, 340, 47, 319, 35, 267, 4, + /* 1090 */ 161, 313, 261, 261, 91, 42, 83, 83, 43, 83, + /* 1100 */ 155, 156, 157, 43, 19, 160, 253, 0, 301, 145, + /* 1110 */ 43, 166, 299, 299, 12, 13, 261, 20, 33, 255, + /* 1120 */ 255, 20, 177, 317, 22, 180, 265, 182, 183, 184, + /* 1130 */ 185, 186, 47, 94, 281, 33, 51, 35, 83, 296, + /* 1140 */ 165, 56, 289, 83, 165, 265, 20, 294, 145, 296, + /* 1150 */ 83, 310, 113, 114, 115, 116, 117, 20, 56, 312, + /* 1160 */ 265, 310, 265, 20, 219, 302, 81, 65, 265, 84, + /* 1170 */ 265, 168, 261, 265, 255, 322, 317, 281, 325, 326, + /* 1180 */ 327, 328, 329, 330, 294, 332, 261, 281, 335, 255, + /* 1190 */ 281, 281, 339, 340, 341, 281, 281, 253, 281, 281, + /* 1200 */ 263, 94, 281, 350, 281, 281, 104, 171, 316, 296, /* 1210 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - /* 1220 */ 365, 222, 320, 218, 369, 289, 20, 42, 239, 237, - /* 1230 */ 322, 281, 323, 325, 326, 327, 328, 329, 330, 289, - /* 1240 */ 332, 354, 342, 335, 294, 82, 296, 339, 340, 341, - /* 1250 */ 12, 13, 242, 338, 147, 303, 373, 368, 350, 289, - /* 1260 */ 22, 368, 367, 367, 305, 368, 294, 294, 367, 305, - /* 1270 */ 294, 33, 322, 35, 263, 325, 326, 327, 328, 329, - /* 1280 */ 330, 253, 332, 277, 294, 335, 302, 294, 294, 339, - /* 1290 */ 340, 341, 82, 263, 56, 294, 289, 285, 271, 261, - /* 1300 */ 350, 36, 256, 65, 263, 255, 309, 275, 253, 281, - /* 1310 */ 314, 275, 275, 264, 251, 0, 0, 289, 42, 0, - /* 1320 */ 0, 73, 294, 35, 296, 181, 35, 35, 35, 181, - /* 1330 */ 0, 35, 35, 181, 0, 181, 281, 0, 35, 311, - /* 1340 */ 0, 0, 104, 22, 289, 35, 0, 168, 82, 294, - /* 1350 */ 322, 296, 165, 325, 326, 327, 328, 329, 330, 167, - /* 1360 */ 332, 163, 0, 0, 159, 158, 311, 0, 0, 46, - /* 1370 */ 0, 0, 0, 142, 0, 0, 253, 322, 0, 351, - /* 1380 */ 325, 326, 327, 328, 329, 330, 0, 332, 0, 137, - /* 1390 */ 35, 0, 137, 365, 0, 0, 0, 369, 0, 0, - /* 1400 */ 0, 163, 0, 165, 281, 22, 351, 0, 0, 0, - /* 1410 */ 0, 0, 289, 0, 0, 42, 0, 294, 253, 296, - /* 1420 */ 365, 0, 0, 0, 369, 187, 0, 0, 0, 0, - /* 1430 */ 0, 0, 0, 0, 42, 46, 198, 199, 200, 201, - /* 1440 */ 202, 203, 204, 253, 43, 322, 281, 60, 325, 326, - /* 1450 */ 327, 328, 329, 330, 289, 332, 39, 14, 335, 294, - /* 1460 */ 14, 296, 339, 340, 46, 0, 0, 0, 0, 0, - /* 1470 */ 0, 281, 154, 0, 40, 39, 39, 0, 0, 289, - /* 1480 */ 261, 39, 47, 35, 294, 0, 296, 322, 35, 39, - /* 1490 */ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - /* 1500 */ 253, 47, 0, 47, 0, 47, 35, 0, 289, 35, - /* 1510 */ 0, 39, 322, 89, 39, 325, 326, 327, 328, 329, - /* 1520 */ 330, 0, 332, 0, 35, 22, 0, 35, 281, 91, - /* 1530 */ 311, 35, 35, 35, 43, 35, 289, 43, 0, 22, - /* 1540 */ 35, 294, 0, 296, 35, 0, 22, 22, 329, 35, - /* 1550 */ 49, 0, 0, 35, 35, 0, 22, 253, 0, 20, - /* 1560 */ 370, 371, 150, 344, 345, 346, 35, 348, 0, 322, - /* 1570 */ 351, 22, 325, 326, 327, 328, 329, 330, 253, 332, - /* 1580 */ 0, 0, 335, 0, 365, 281, 147, 340, 369, 169, - /* 1590 */ 150, 150, 0, 289, 0, 83, 152, 43, 294, 43, - /* 1600 */ 296, 217, 223, 83, 82, 43, 281, 43, 43, 82, - /* 1610 */ 43, 83, 308, 83, 289, 82, 223, 82, 82, 294, - /* 1620 */ 46, 296, 46, 82, 46, 46, 322, 83, 43, 325, - /* 1630 */ 326, 327, 328, 329, 330, 253, 332, 35, 223, 35, - /* 1640 */ 83, 35, 83, 83, 35, 35, 35, 322, 2, 187, - /* 1650 */ 325, 326, 327, 328, 329, 330, 43, 332, 253, 22, - /* 1660 */ 83, 46, 46, 281, 82, 189, 0, 83, 82, 82, - /* 1670 */ 82, 289, 83, 83, 0, 82, 294, 82, 296, 82, - /* 1680 */ 148, 39, 82, 146, 46, 46, 281, 82, 92, 364, - /* 1690 */ 83, 22, 93, 35, 289, 83, 82, 35, 35, 294, - /* 1700 */ 253, 296, 82, 82, 322, 83, 82, 325, 326, 327, - /* 1710 */ 328, 329, 330, 308, 332, 83, 253, 35, 82, 35, - /* 1720 */ 35, 22, 94, 83, 83, 82, 82, 322, 281, 106, - /* 1730 */ 325, 326, 327, 328, 329, 330, 289, 332, 82, 106, - /* 1740 */ 106, 294, 82, 296, 281, 35, 82, 43, 22, 60, - /* 1750 */ 59, 106, 289, 371, 35, 80, 43, 294, 65, 296, - /* 1760 */ 35, 22, 35, 35, 35, 35, 253, 35, 35, 322, - /* 1770 */ 65, 308, 325, 326, 327, 328, 329, 330, 35, 332, - /* 1780 */ 35, 334, 35, 35, 35, 322, 35, 35, 325, 326, - /* 1790 */ 327, 328, 329, 330, 281, 332, 19, 0, 35, 39, - /* 1800 */ 47, 0, 289, 35, 47, 39, 0, 294, 35, 296, - /* 1810 */ 33, 47, 0, 39, 35, 39, 47, 0, 35, 35, - /* 1820 */ 0, 308, 22, 253, 47, 21, 374, 22, 21, 52, - /* 1830 */ 53, 54, 55, 56, 374, 322, 22, 374, 325, 326, - /* 1840 */ 327, 328, 329, 330, 20, 332, 374, 374, 374, 374, - /* 1850 */ 374, 281, 374, 374, 374, 374, 374, 374, 81, 289, - /* 1860 */ 374, 84, 374, 374, 294, 374, 296, 374, 374, 374, - /* 1870 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - /* 1880 */ 374, 374, 374, 374, 253, 374, 374, 374, 374, 374, - /* 1890 */ 374, 374, 322, 374, 117, 325, 326, 327, 328, 329, - /* 1900 */ 330, 253, 332, 374, 374, 374, 374, 374, 374, 374, - /* 1910 */ 374, 374, 281, 374, 374, 374, 374, 374, 374, 374, - /* 1920 */ 289, 374, 374, 374, 374, 294, 149, 296, 374, 281, - /* 1930 */ 374, 374, 374, 374, 374, 374, 374, 289, 374, 374, - /* 1940 */ 374, 374, 294, 253, 296, 374, 374, 170, 374, 172, - /* 1950 */ 374, 374, 374, 322, 253, 374, 325, 326, 327, 328, - /* 1960 */ 329, 330, 374, 332, 374, 253, 374, 374, 374, 374, - /* 1970 */ 322, 281, 374, 325, 326, 327, 328, 329, 330, 289, - /* 1980 */ 332, 374, 281, 374, 294, 374, 296, 374, 374, 374, - /* 1990 */ 289, 374, 374, 281, 374, 294, 374, 296, 374, 374, - /* 2000 */ 374, 289, 374, 374, 374, 374, 294, 253, 296, 374, - /* 2010 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, - /* 2020 */ 330, 374, 332, 322, 374, 253, 325, 326, 327, 328, - /* 2030 */ 329, 330, 374, 332, 322, 281, 374, 325, 326, 327, - /* 2040 */ 328, 329, 330, 289, 332, 374, 374, 374, 294, 253, - /* 2050 */ 296, 374, 374, 281, 374, 374, 374, 374, 374, 374, - /* 2060 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, - /* 2070 */ 374, 374, 374, 374, 374, 374, 322, 281, 374, 325, - /* 2080 */ 326, 327, 328, 329, 330, 289, 332, 374, 374, 374, - /* 2090 */ 294, 374, 296, 374, 322, 374, 374, 325, 326, 327, - /* 2100 */ 328, 329, 330, 374, 332, 253, 374, 374, 374, 374, - /* 2110 */ 374, 374, 374, 374, 374, 374, 374, 374, 322, 374, - /* 2120 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2130 */ 374, 374, 374, 281, 374, 374, 374, 374, 374, 374, - /* 2140 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, - /* 2150 */ 374, 374, 374, 374, 374, 253, 374, 374, 374, 374, - /* 2160 */ 374, 374, 374, 374, 374, 374, 253, 374, 374, 374, - /* 2170 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2180 */ 328, 329, 330, 281, 332, 374, 374, 374, 374, 374, - /* 2190 */ 374, 289, 374, 374, 281, 374, 294, 374, 296, 374, - /* 2200 */ 374, 374, 289, 374, 374, 374, 374, 294, 253, 296, - /* 2210 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, - /* 2220 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2230 */ 328, 329, 330, 253, 332, 322, 281, 374, 325, 326, - /* 2240 */ 327, 328, 329, 330, 289, 332, 374, 281, 374, 294, - /* 2250 */ 374, 296, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2260 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, - /* 2270 */ 374, 374, 374, 374, 294, 374, 296, 322, 374, 374, - /* 2280 */ 325, 326, 327, 328, 329, 330, 374, 332, 322, 253, - /* 2290 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2300 */ 374, 374, 322, 253, 374, 325, 326, 327, 328, 329, - /* 2310 */ 330, 374, 332, 374, 374, 374, 374, 281, 374, 374, - /* 2320 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2330 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, - /* 2340 */ 374, 374, 374, 374, 294, 374, 296, 374, 374, 374, - /* 2350 */ 374, 374, 374, 253, 374, 374, 374, 374, 322, 374, - /* 2360 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2370 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, - /* 2380 */ 330, 281, 332, 374, 374, 374, 374, 374, 374, 289, - /* 2390 */ 374, 374, 374, 374, 294, 253, 296, 374, 374, 374, - /* 2400 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, - /* 2410 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - /* 2420 */ 374, 374, 322, 281, 374, 325, 326, 327, 328, 329, - /* 2430 */ 330, 289, 332, 374, 374, 374, 294, 281, 296, 374, - /* 2440 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2450 */ 294, 374, 296, 374, 374, 374, 374, 374, 374, 374, - /* 2460 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2470 */ 328, 329, 330, 374, 332, 374, 374, 374, 322, 374, - /* 2480 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, + /* 1220 */ 113, 114, 115, 116, 117, 281, 263, 33, 261, 261, + /* 1230 */ 310, 20, 263, 289, 294, 227, 324, 226, 294, 233, + /* 1240 */ 296, 47, 357, 305, 357, 294, 52, 53, 54, 55, + /* 1250 */ 56, 305, 294, 294, 360, 311, 8, 9, 154, 359, + /* 1260 */ 12, 13, 14, 15, 16, 163, 322, 165, 235, 325, + /* 1270 */ 326, 327, 328, 329, 330, 81, 332, 234, 84, 8, + /* 1280 */ 9, 253, 356, 12, 13, 14, 15, 16, 357, 187, + /* 1290 */ 355, 222, 320, 354, 218, 351, 20, 323, 289, 367, + /* 1300 */ 198, 199, 200, 201, 202, 203, 204, 239, 364, 281, + /* 1310 */ 237, 82, 368, 366, 242, 372, 367, 289, 366, 294, + /* 1320 */ 367, 366, 294, 305, 296, 338, 294, 305, 294, 294, + /* 1330 */ 147, 83, 303, 253, 294, 294, 289, 263, 277, 311, + /* 1340 */ 146, 147, 263, 149, 302, 289, 82, 153, 285, 271, + /* 1350 */ 322, 294, 261, 325, 326, 327, 328, 329, 330, 263, + /* 1360 */ 332, 281, 36, 314, 256, 255, 172, 309, 275, 289, + /* 1370 */ 275, 251, 0, 275, 294, 264, 296, 0, 42, 351, + /* 1380 */ 0, 73, 0, 35, 181, 253, 35, 35, 35, 181, + /* 1390 */ 0, 35, 364, 35, 181, 0, 368, 181, 0, 35, + /* 1400 */ 0, 253, 322, 22, 0, 325, 326, 327, 328, 329, + /* 1410 */ 330, 35, 332, 281, 0, 335, 167, 82, 168, 339, + /* 1420 */ 340, 289, 165, 163, 0, 0, 294, 158, 296, 281, + /* 1430 */ 0, 159, 0, 46, 0, 0, 0, 289, 142, 0, + /* 1440 */ 0, 0, 294, 0, 296, 0, 137, 35, 0, 137, + /* 1450 */ 0, 253, 42, 0, 322, 0, 0, 325, 326, 327, + /* 1460 */ 328, 329, 330, 331, 332, 333, 334, 253, 0, 0, + /* 1470 */ 322, 0, 0, 325, 326, 327, 328, 329, 330, 281, + /* 1480 */ 332, 0, 0, 0, 0, 0, 0, 289, 0, 0, + /* 1490 */ 0, 0, 294, 0, 296, 281, 0, 22, 0, 0, + /* 1500 */ 0, 0, 0, 289, 0, 42, 39, 46, 294, 253, + /* 1510 */ 296, 14, 46, 43, 0, 0, 40, 369, 370, 14, + /* 1520 */ 322, 253, 308, 325, 326, 327, 328, 329, 330, 0, + /* 1530 */ 332, 39, 0, 335, 39, 0, 322, 281, 340, 325, + /* 1540 */ 326, 327, 328, 329, 330, 289, 332, 154, 0, 281, + /* 1550 */ 294, 0, 296, 0, 60, 0, 35, 289, 47, 39, + /* 1560 */ 0, 35, 294, 47, 296, 0, 39, 39, 35, 47, + /* 1570 */ 0, 253, 35, 0, 0, 39, 0, 47, 322, 0, + /* 1580 */ 22, 325, 326, 327, 328, 329, 330, 253, 332, 35, + /* 1590 */ 322, 0, 89, 325, 326, 327, 328, 329, 330, 281, + /* 1600 */ 332, 91, 35, 35, 35, 43, 35, 289, 0, 43, + /* 1610 */ 35, 22, 294, 35, 296, 281, 35, 0, 22, 363, + /* 1620 */ 0, 49, 22, 289, 0, 35, 308, 35, 294, 0, + /* 1630 */ 296, 0, 35, 22, 20, 0, 35, 150, 370, 253, + /* 1640 */ 322, 0, 169, 325, 326, 327, 328, 329, 330, 22, + /* 1650 */ 332, 0, 0, 147, 0, 253, 322, 150, 150, 325, + /* 1660 */ 326, 327, 328, 329, 330, 152, 332, 281, 334, 0, + /* 1670 */ 0, 43, 223, 43, 223, 289, 82, 43, 83, 46, + /* 1680 */ 294, 82, 296, 281, 46, 83, 83, 82, 82, 82, + /* 1690 */ 43, 289, 83, 83, 308, 82, 294, 217, 296, 83, + /* 1700 */ 223, 46, 43, 43, 46, 253, 83, 35, 322, 83, + /* 1710 */ 308, 325, 326, 327, 328, 329, 330, 253, 332, 35, + /* 1720 */ 35, 35, 35, 35, 322, 2, 187, 325, 326, 327, + /* 1730 */ 328, 329, 330, 281, 332, 43, 83, 46, 82, 46, + /* 1740 */ 22, 289, 0, 0, 83, 281, 294, 82, 296, 82, + /* 1750 */ 189, 83, 148, 289, 83, 82, 82, 82, 294, 82, + /* 1760 */ 296, 39, 82, 46, 146, 46, 83, 22, 92, 35, + /* 1770 */ 35, 253, 82, 35, 322, 93, 82, 325, 326, 327, + /* 1780 */ 328, 329, 330, 82, 332, 83, 322, 253, 82, 325, + /* 1790 */ 326, 327, 328, 329, 330, 83, 332, 82, 253, 281, + /* 1800 */ 35, 35, 35, 83, 83, 22, 82, 289, 82, 106, + /* 1810 */ 83, 82, 294, 106, 296, 281, 106, 35, 82, 106, + /* 1820 */ 43, 82, 94, 289, 22, 35, 281, 59, 294, 82, + /* 1830 */ 296, 60, 80, 35, 289, 65, 43, 22, 35, 294, + /* 1840 */ 322, 296, 35, 325, 326, 327, 328, 329, 330, 35, + /* 1850 */ 332, 253, 35, 35, 35, 35, 322, 65, 35, 325, + /* 1860 */ 326, 327, 328, 329, 330, 35, 332, 322, 253, 35, + /* 1870 */ 325, 326, 327, 328, 329, 330, 0, 332, 35, 281, + /* 1880 */ 35, 35, 35, 47, 0, 35, 47, 289, 39, 0, + /* 1890 */ 39, 35, 294, 253, 296, 47, 281, 39, 0, 35, + /* 1900 */ 47, 39, 0, 35, 289, 35, 0, 22, 21, 294, + /* 1910 */ 253, 296, 22, 22, 373, 21, 20, 373, 373, 373, + /* 1920 */ 322, 281, 373, 325, 326, 327, 328, 329, 330, 289, + /* 1930 */ 332, 373, 373, 373, 294, 373, 296, 322, 281, 373, + /* 1940 */ 325, 326, 327, 328, 329, 330, 289, 332, 373, 373, + /* 1950 */ 373, 294, 253, 296, 373, 373, 373, 373, 373, 373, + /* 1960 */ 373, 373, 322, 373, 253, 325, 326, 327, 328, 329, + /* 1970 */ 330, 373, 332, 373, 373, 373, 373, 373, 373, 322, + /* 1980 */ 281, 373, 325, 326, 327, 328, 329, 330, 289, 332, + /* 1990 */ 373, 373, 281, 294, 373, 296, 373, 373, 373, 373, + /* 2000 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, + /* 2010 */ 373, 373, 373, 373, 253, 373, 373, 373, 373, 373, + /* 2020 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, + /* 2030 */ 373, 332, 253, 322, 373, 373, 325, 326, 327, 328, + /* 2040 */ 329, 330, 281, 332, 373, 373, 373, 373, 373, 373, + /* 2050 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, + /* 2060 */ 281, 373, 373, 373, 373, 373, 373, 373, 289, 373, + /* 2070 */ 373, 373, 373, 294, 373, 296, 373, 373, 373, 373, + /* 2080 */ 373, 373, 253, 322, 373, 373, 325, 326, 327, 328, + /* 2090 */ 329, 330, 373, 332, 253, 373, 373, 373, 373, 373, + /* 2100 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, + /* 2110 */ 281, 332, 373, 373, 373, 373, 373, 373, 289, 373, + /* 2120 */ 373, 373, 281, 294, 373, 296, 373, 373, 373, 373, + /* 2130 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, + /* 2140 */ 373, 373, 373, 373, 373, 373, 253, 373, 373, 373, + /* 2150 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, + /* 2160 */ 373, 332, 373, 322, 253, 373, 325, 326, 327, 328, + /* 2170 */ 329, 330, 373, 332, 281, 373, 373, 373, 373, 373, + /* 2180 */ 373, 373, 289, 373, 373, 373, 373, 294, 253, 296, + /* 2190 */ 373, 373, 281, 373, 373, 373, 373, 373, 373, 373, + /* 2200 */ 289, 373, 373, 373, 373, 294, 253, 296, 373, 373, + /* 2210 */ 373, 373, 373, 373, 373, 322, 281, 373, 325, 326, + /* 2220 */ 327, 328, 329, 330, 289, 332, 373, 373, 373, 294, + /* 2230 */ 373, 296, 373, 322, 281, 373, 325, 326, 327, 328, + /* 2240 */ 329, 330, 289, 332, 373, 373, 373, 294, 373, 296, + /* 2250 */ 373, 373, 373, 373, 373, 373, 373, 322, 373, 253, + /* 2260 */ 325, 326, 327, 328, 329, 330, 373, 332, 373, 373, + /* 2270 */ 373, 373, 373, 373, 373, 322, 373, 373, 325, 326, + /* 2280 */ 327, 328, 329, 330, 373, 332, 373, 281, 373, 373, + /* 2290 */ 373, 373, 373, 373, 373, 289, 373, 373, 373, 373, + /* 2300 */ 294, 373, 296, 373, 8, 9, 373, 373, 12, 13, + /* 2310 */ 14, 15, 16, 373, 373, 373, 373, 373, 373, 373, + /* 2320 */ 373, 373, 373, 373, 373, 373, 373, 373, 322, 373, + /* 2330 */ 373, 325, 326, 327, 328, 329, 330, 373, 332, 373, + /* 2340 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2350 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2360 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2370 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2380 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2390 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2400 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2410 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2420 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2430 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2440 */ 373, 373, 373, 373, 373, 373, 150, 373, 373, 373, + /* 2450 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2460 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2470 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2480 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2490 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2500 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2510 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2520 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2530 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2540 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, + /* 2550 */ 373, 373, 373, 373, 373, }; -#define YY_SHIFT_COUNT (652) +#define YY_SHIFT_COUNT (651) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1824) +#define YY_SHIFT_MAX (2296) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 945, 0, 0, 57, 252, 252, 252, 252, 309, 309, + /* 0 */ 945, 0, 0, 57, 57, 252, 252, 252, 309, 309, /* 10 */ 252, 252, 504, 561, 756, 561, 561, 561, 561, 561, /* 20 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, /* 30 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - /* 40 */ 561, 561, 54, 54, 246, 246, 246, 1238, 1238, 1238, - /* 50 */ 1238, 186, 87, 254, 11, 11, 239, 239, 242, 10, - /* 60 */ 254, 254, 11, 11, 11, 11, 11, 11, 11, 11, - /* 70 */ 99, 11, 11, 11, 150, 261, 313, 11, 11, 313, - /* 80 */ 11, 313, 313, 313, 11, 268, 752, 839, 1003, 1003, - /* 90 */ 438, 111, 245, 245, 245, 245, 245, 245, 245, 245, - /* 100 */ 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - /* 110 */ 245, 698, 10, 457, 457, 319, 618, 222, 222, 222, - /* 120 */ 358, 618, 327, 261, 6, 6, 313, 313, 361, 361, - /* 130 */ 405, 460, 193, 193, 193, 193, 193, 193, 193, 1777, - /* 140 */ 21, 14, 372, 84, 310, 406, 270, 376, 473, 516, - /* 150 */ 791, 686, 773, 694, 507, 694, 797, 797, 797, 713, - /* 160 */ 790, 848, 1054, 1029, 1043, 921, 1054, 1054, 1042, 942, - /* 170 */ 942, 1054, 1070, 1070, 1075, 99, 261, 99, 1084, 1092, - /* 180 */ 99, 1084, 99, 1101, 99, 99, 1054, 99, 1070, 313, - /* 190 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 200 */ 1054, 1070, 361, 1075, 268, 986, 261, 268, 1054, 1054, - /* 210 */ 1084, 268, 1149, 361, 943, 949, 361, 943, 949, 361, - /* 220 */ 361, 313, 946, 1039, 943, 963, 965, 999, 848, 1005, - /* 230 */ 327, 1206, 1185, 989, 992, 1010, 989, 992, 989, 992, - /* 240 */ 1163, 949, 361, 361, 361, 361, 361, 949, 361, 1107, - /* 250 */ 327, 1101, 268, 405, 268, 327, 1210, 361, 460, 1054, - /* 260 */ 268, 1265, 1070, 2489, 2489, 2489, 2489, 2489, 2489, 2489, - /* 270 */ 162, 885, 123, 574, 199, 576, 467, 476, 540, 707, - /* 280 */ 662, 549, 549, 549, 549, 549, 549, 549, 549, 624, - /* 290 */ 681, 224, 263, 263, 251, 558, 410, 3, 603, 521, - /* 300 */ 529, 529, 529, 529, 249, 96, 823, 884, 840, 842, - /* 310 */ 856, 888, 872, 913, 978, 852, 820, 930, 937, 987, - /* 320 */ 876, 787, 802, 953, 920, 954, 489, 956, 958, 960, - /* 330 */ 961, 962, 864, 974, 980, 981, 983, 985, 1013, 1016, - /* 340 */ 339, 975, 126, 1315, 1316, 1276, 1319, 1248, 1320, 1288, - /* 350 */ 1144, 1291, 1292, 1293, 1148, 1330, 1296, 1297, 1152, 1334, - /* 360 */ 1154, 1337, 1303, 1340, 1321, 1341, 1310, 1346, 1266, 1179, - /* 370 */ 1192, 1187, 1198, 1362, 1363, 1205, 1207, 1367, 1368, 1323, - /* 380 */ 1370, 1371, 1372, 1231, 1374, 1375, 1378, 1386, 1388, 1252, - /* 390 */ 1355, 1391, 1255, 1394, 1395, 1396, 1398, 1399, 1400, 1402, - /* 400 */ 1407, 1408, 1409, 1410, 1411, 1413, 1414, 1373, 1416, 1421, - /* 410 */ 1422, 1423, 1426, 1427, 1383, 1428, 1429, 1430, 1431, 1432, - /* 420 */ 1433, 1392, 1417, 1401, 1443, 1389, 1446, 1418, 1465, 1434, - /* 430 */ 1436, 1466, 1467, 1468, 1437, 1318, 1469, 1470, 1473, 1387, - /* 440 */ 1477, 1478, 1448, 1435, 1442, 1485, 1453, 1454, 1450, 1502, - /* 450 */ 1471, 1456, 1472, 1504, 1474, 1458, 1475, 1507, 1510, 1521, - /* 460 */ 1523, 1438, 1424, 1489, 1503, 1526, 1492, 1496, 1497, 1498, - /* 470 */ 1491, 1494, 1500, 1505, 1509, 1538, 1517, 1542, 1524, 1501, - /* 480 */ 1545, 1525, 1514, 1551, 1518, 1552, 1519, 1555, 1534, 1539, - /* 490 */ 1558, 1412, 1531, 1568, 1420, 1549, 1440, 1439, 1580, 1581, - /* 500 */ 1441, 1444, 1583, 1592, 1594, 1554, 1556, 1379, 1522, 1512, - /* 510 */ 1527, 1520, 1562, 1528, 1533, 1535, 1536, 1530, 1564, 1574, - /* 520 */ 1576, 1541, 1565, 1393, 1544, 1557, 1578, 1384, 1567, 1579, - /* 530 */ 1559, 1585, 1415, 1560, 1602, 1604, 1606, 1609, 1610, 1611, - /* 540 */ 1560, 1646, 1462, 1613, 1577, 1582, 1584, 1615, 1586, 1587, - /* 550 */ 1616, 1637, 1476, 1588, 1589, 1590, 1593, 1666, 1595, 1532, - /* 560 */ 1597, 1674, 1642, 1537, 1600, 1596, 1638, 1639, 1605, 1607, - /* 570 */ 1614, 1669, 1620, 1599, 1612, 1658, 1662, 1621, 1622, 1663, - /* 580 */ 1624, 1632, 1682, 1636, 1640, 1684, 1643, 1641, 1685, 1644, - /* 590 */ 1623, 1633, 1634, 1645, 1699, 1628, 1656, 1660, 1710, 1664, - /* 600 */ 1704, 1704, 1726, 1689, 1691, 1719, 1693, 1675, 1713, 1725, - /* 610 */ 1727, 1728, 1729, 1730, 1739, 1732, 1733, 1705, 1491, 1743, - /* 620 */ 1494, 1745, 1747, 1748, 1749, 1751, 1752, 1797, 1763, 1753, - /* 630 */ 1760, 1801, 1768, 1757, 1766, 1806, 1773, 1764, 1774, 1812, - /* 640 */ 1779, 1769, 1776, 1817, 1783, 1784, 1820, 1800, 1804, 1805, - /* 650 */ 1814, 1807, 1824, + /* 40 */ 561, 561, 187, 187, 248, 248, 248, 1102, 1102, 1102, + /* 50 */ 1102, 185, 59, 246, 11, 11, 53, 53, 56, 10, + /* 60 */ 246, 246, 11, 11, 11, 11, 11, 11, 11, 11, + /* 70 */ 15, 11, 11, 11, 144, 154, 256, 11, 11, 256, + /* 80 */ 11, 256, 256, 256, 11, 241, 752, 839, 1003, 1003, + /* 90 */ 948, 111, 297, 297, 297, 297, 297, 297, 297, 297, + /* 100 */ 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, + /* 110 */ 297, 273, 10, 122, 122, 335, 124, 325, 325, 325, + /* 120 */ 541, 124, 353, 154, 1, 1, 256, 256, 285, 285, + /* 130 */ 394, 358, 193, 193, 193, 193, 193, 193, 193, 511, + /* 140 */ 21, 14, 200, 84, 71, 69, 406, 82, 197, 332, + /* 150 */ 749, 745, 439, 649, 207, 649, 884, 495, 495, 495, + /* 160 */ 7, 812, 846, 1062, 1038, 1052, 929, 1062, 1062, 1053, + /* 170 */ 964, 964, 1062, 1097, 1097, 1101, 15, 154, 15, 1126, + /* 180 */ 1137, 15, 1126, 15, 1143, 15, 15, 1062, 15, 1097, + /* 190 */ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, + /* 200 */ 256, 1062, 1097, 285, 1101, 241, 1036, 154, 241, 1062, + /* 210 */ 1062, 1126, 241, 1211, 285, 1008, 1011, 285, 1008, 1011, + /* 220 */ 285, 285, 256, 1006, 1104, 1008, 1033, 1043, 1069, 846, + /* 230 */ 1076, 353, 1276, 1068, 1073, 1072, 1068, 1073, 1068, 1073, + /* 240 */ 1229, 1011, 285, 285, 285, 285, 285, 1011, 285, 1183, + /* 250 */ 353, 1143, 241, 394, 241, 353, 1264, 285, 358, 1062, + /* 260 */ 241, 1326, 1097, 2447, 2447, 2447, 2447, 2447, 2447, 2447, + /* 270 */ 162, 1194, 123, 1085, 980, 371, 1248, 802, 811, 2296, + /* 280 */ 828, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1039, + /* 290 */ 1107, 224, 155, 155, 199, 225, 204, 312, 487, 433, + /* 300 */ 505, 505, 505, 505, 318, 484, 619, 595, 849, 856, + /* 310 */ 878, 901, 872, 991, 999, 950, 815, 602, 888, 1007, + /* 320 */ 882, 434, 764, 962, 798, 977, 976, 981, 985, 992, + /* 330 */ 994, 998, 975, 979, 1013, 1014, 1016, 1055, 1060, 1067, + /* 340 */ 443, 996, 529, 1372, 1377, 1336, 1380, 1308, 1382, 1348, + /* 350 */ 1203, 1351, 1352, 1353, 1208, 1390, 1356, 1358, 1213, 1395, + /* 360 */ 1216, 1398, 1364, 1400, 1381, 1404, 1376, 1414, 1335, 1250, + /* 370 */ 1249, 1257, 1260, 1424, 1425, 1272, 1269, 1430, 1432, 1387, + /* 380 */ 1434, 1435, 1436, 1296, 1439, 1440, 1441, 1443, 1445, 1309, + /* 390 */ 1412, 1448, 1312, 1450, 1455, 1456, 1468, 1469, 1471, 1472, + /* 400 */ 1481, 1482, 1483, 1484, 1485, 1486, 1488, 1410, 1453, 1489, + /* 410 */ 1490, 1491, 1493, 1496, 1475, 1498, 1499, 1500, 1501, 1502, + /* 420 */ 1504, 1463, 1467, 1470, 1497, 1461, 1505, 1466, 1514, 1476, + /* 430 */ 1492, 1515, 1529, 1532, 1495, 1393, 1535, 1548, 1551, 1494, + /* 440 */ 1553, 1555, 1521, 1511, 1520, 1560, 1526, 1516, 1527, 1565, + /* 450 */ 1533, 1522, 1528, 1570, 1537, 1530, 1536, 1573, 1574, 1576, + /* 460 */ 1579, 1510, 1503, 1554, 1558, 1591, 1567, 1568, 1569, 1571, + /* 470 */ 1562, 1566, 1575, 1578, 1581, 1608, 1589, 1617, 1596, 1572, + /* 480 */ 1620, 1600, 1590, 1624, 1592, 1629, 1597, 1631, 1611, 1614, + /* 490 */ 1635, 1487, 1601, 1641, 1473, 1627, 1507, 1506, 1651, 1652, + /* 500 */ 1508, 1513, 1654, 1669, 1670, 1628, 1449, 1594, 1595, 1599, + /* 510 */ 1602, 1630, 1603, 1605, 1606, 1607, 1609, 1634, 1633, 1638, + /* 520 */ 1613, 1647, 1451, 1610, 1616, 1655, 1480, 1659, 1658, 1623, + /* 530 */ 1660, 1477, 1626, 1672, 1684, 1685, 1686, 1687, 1688, 1626, + /* 540 */ 1723, 1539, 1692, 1653, 1656, 1661, 1691, 1665, 1667, 1693, + /* 550 */ 1718, 1561, 1673, 1668, 1671, 1674, 1742, 1675, 1604, 1677, + /* 560 */ 1743, 1722, 1618, 1680, 1676, 1717, 1719, 1690, 1683, 1694, + /* 570 */ 1745, 1701, 1682, 1702, 1734, 1735, 1706, 1712, 1738, 1715, + /* 580 */ 1720, 1765, 1724, 1721, 1766, 1726, 1727, 1767, 1729, 1703, + /* 590 */ 1707, 1710, 1713, 1783, 1728, 1736, 1739, 1782, 1747, 1777, + /* 600 */ 1777, 1802, 1771, 1768, 1790, 1770, 1752, 1793, 1798, 1803, + /* 610 */ 1807, 1814, 1817, 1815, 1818, 1819, 1792, 1562, 1820, 1566, + /* 620 */ 1823, 1830, 1834, 1843, 1845, 1846, 1876, 1847, 1836, 1849, + /* 630 */ 1884, 1850, 1839, 1851, 1889, 1856, 1848, 1858, 1898, 1864, + /* 640 */ 1853, 1862, 1902, 1868, 1870, 1906, 1885, 1887, 1890, 1891, + /* 650 */ 1894, 1896, }; #define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-287) -#define YY_REDUCE_MAX (2156) +#define YY_REDUCE_MIN (-327) +#define YY_REDUCE_MAX (2006) static const short yy_reduce_ofst[] = { - /* 0 */ -248, 72, 855, -195, 322, 575, 908, 950, 1028, 1055, - /* 10 */ 306, 1123, 1165, 1190, 1247, 1304, 1325, 1382, 1405, 1447, - /* 20 */ 1463, 1513, 1570, 1631, 1648, 1690, 1701, 1712, 1754, 1772, - /* 30 */ 1796, 1852, 1902, 1913, 1955, 1966, 1980, 2036, 2050, 2100, - /* 40 */ 2142, 2156, 769, 1219, -234, 90, 398, -278, -260, -254, - /* 50 */ -105, -245, -209, -42, -261, -164, -256, -250, 4, -113, - /* 60 */ 13, 24, 131, 258, 262, 338, 340, 543, 548, 550, - /* 70 */ -246, 552, 555, 557, 133, -211, 62, 570, 645, -224, - /* 80 */ 703, 73, -190, 86, 704, 23, 59, 185, 185, 185, - /* 90 */ -237, -102, -153, 276, 278, 288, 315, 362, 419, 420, - /* 100 */ 435, 437, 440, 477, 479, 480, 483, 531, 564, 573, - /* 110 */ 615, -255, 281, -40, 379, 333, 444, -287, -242, 458, - /* 120 */ -125, 539, 106, 512, 441, 481, 316, 553, 391, 571, - /* 130 */ 566, 592, 378, 386, 567, 584, 638, 642, 690, 225, - /* 140 */ 731, 717, 619, 627, 736, 688, 650, 733, 733, 759, - /* 150 */ 762, 742, 737, 711, 711, 711, 701, 705, 706, 718, - /* 160 */ 733, 753, 814, 758, 812, 768, 822, 824, 785, 789, - /* 170 */ 792, 828, 837, 838, 780, 841, 807, 844, 800, 804, - /* 180 */ 853, 809, 858, 830, 859, 861, 874, 868, 882, 860, - /* 190 */ 862, 865, 866, 869, 871, 873, 875, 877, 878, 879, - /* 200 */ 881, 890, 846, 836, 892, 847, 880, 899, 904, 906, - /* 210 */ 863, 905, 850, 894, 815, 886, 898, 821, 891, 907, - /* 220 */ 911, 733, 826, 849, 843, 851, 854, 887, 902, 711, - /* 230 */ 936, 909, 900, 889, 895, 883, 893, 896, 897, 901, - /* 240 */ 915, 959, 972, 973, 976, 990, 993, 964, 994, 952, - /* 250 */ 970, 984, 1011, 1006, 1030, 1007, 1012, 1001, 1027, 1038, - /* 260 */ 1041, 1046, 1050, 996, 997, 1032, 1036, 1037, 1049, 1063, + /* 0 */ -244, 70, 322, -195, 575, 141, 393, 853, 944, 1028, + /* 10 */ 744, 1080, 1132, 1148, 1198, 1214, 1256, 1268, 1318, 1334, + /* 20 */ 1386, 1402, 1452, 1464, 1518, 1534, 1545, 1598, 1615, 1640, + /* 30 */ 1657, 1699, 1711, 1761, 1779, 1829, 1841, 1893, 1911, 1935, + /* 40 */ 1953, 2006, 261, 291, -234, 203, 452, -278, -260, -258, + /* 50 */ 453, -283, 65, 172, 64, 147, -257, -250, -327, -277, + /* 60 */ -85, -44, 266, 270, 296, 315, 321, 352, 455, 516, + /* 70 */ 125, 573, 574, 645, -249, -86, -173, 648, 651, -11, + /* 80 */ 652, 205, 265, 298, 709, 148, -232, -298, -298, -298, + /* 90 */ -149, -110, 167, 290, 338, 362, 381, 417, 418, 423, + /* 100 */ 435, 477, 486, 489, 492, 493, 537, 555, 556, 576, + /* 110 */ 605, -276, -170, -79, 114, 269, 101, 330, 391, 483, + /* 120 */ -106, 396, 118, 183, 431, 559, 403, 264, 501, 634, + /* 130 */ 655, 13, 251, 339, 345, 386, 468, 491, 502, 299, + /* 140 */ 346, 465, 451, 440, 597, 590, 560, 658, 658, 671, + /* 150 */ 763, 733, 705, 681, 681, 681, 690, 677, 678, 679, + /* 160 */ 684, 658, 758, 819, 767, 821, 778, 831, 832, 807, + /* 170 */ 813, 814, 855, 864, 865, 806, 861, 843, 880, 841, + /* 180 */ 847, 895, 851, 897, 863, 903, 905, 911, 908, 919, + /* 190 */ 896, 906, 909, 910, 914, 915, 917, 918, 921, 923, + /* 200 */ 924, 925, 934, 890, 859, 937, 892, 913, 963, 967, + /* 210 */ 968, 920, 969, 912, 940, 885, 938, 951, 887, 946, + /* 220 */ 958, 959, 658, 894, 900, 931, 926, 935, 939, 972, + /* 230 */ 681, 1009, 974, 932, 947, 943, 949, 952, 953, 955, + /* 240 */ 987, 1018, 1025, 1032, 1034, 1035, 1040, 1022, 1041, 1029, + /* 250 */ 1047, 1042, 1074, 1061, 1079, 1056, 1063, 1057, 1078, 1091, + /* 260 */ 1096, 1108, 1110, 1049, 1058, 1093, 1095, 1098, 1111, 1120, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 10 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 20 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 30 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 40 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 50 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 60 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 70 */ 1508, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 80 */ 1436, 1436, 1436, 1436, 1436, 1506, 1659, 1436, 1834, 1436, - /* 90 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 100 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 110 */ 1436, 1436, 1436, 1436, 1436, 1508, 1436, 1846, 1846, 1846, - /* 120 */ 1506, 1436, 1436, 1436, 1703, 1703, 1436, 1436, 1436, 1436, - /* 130 */ 1602, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1695, - /* 140 */ 1436, 1436, 1916, 1436, 1436, 1701, 1870, 1436, 1436, 1436, - /* 150 */ 1436, 1555, 1862, 1838, 1852, 1839, 1901, 1901, 1901, 1855, - /* 160 */ 1436, 1866, 1436, 1436, 1436, 1687, 1436, 1436, 1664, 1661, - /* 170 */ 1661, 1436, 1436, 1436, 1436, 1508, 1436, 1508, 1436, 1436, - /* 180 */ 1508, 1436, 1508, 1436, 1508, 1508, 1436, 1508, 1436, 1436, - /* 190 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 200 */ 1436, 1436, 1436, 1436, 1506, 1697, 1436, 1506, 1436, 1436, - /* 210 */ 1436, 1506, 1436, 1436, 1877, 1875, 1436, 1877, 1875, 1436, - /* 220 */ 1436, 1436, 1889, 1885, 1877, 1893, 1891, 1868, 1866, 1852, - /* 230 */ 1436, 1436, 1836, 1907, 1903, 1919, 1907, 1903, 1907, 1903, - /* 240 */ 1436, 1875, 1436, 1436, 1436, 1436, 1436, 1875, 1436, 1436, - /* 250 */ 1436, 1436, 1506, 1436, 1506, 1436, 1571, 1436, 1436, 1436, - /* 260 */ 1506, 1468, 1436, 1689, 1703, 1605, 1605, 1605, 1509, 1441, - /* 270 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 280 */ 1436, 1772, 1888, 1887, 1810, 1809, 1808, 1806, 1771, 1436, - /* 290 */ 1436, 1567, 1770, 1769, 1436, 1436, 1436, 1436, 1436, 1436, - /* 300 */ 1763, 1764, 1762, 1761, 1436, 1436, 1436, 1436, 1436, 1436, - /* 310 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1835, - /* 320 */ 1436, 1904, 1908, 1436, 1436, 1436, 1746, 1436, 1436, 1436, - /* 330 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 340 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 350 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 360 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 370 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 380 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 390 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 400 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 410 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 420 */ 1436, 1436, 1436, 1473, 1436, 1436, 1436, 1436, 1436, 1436, - /* 430 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 440 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 450 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 460 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 470 */ 1536, 1535, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 480 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 490 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 500 */ 1436, 1436, 1436, 1436, 1436, 1859, 1869, 1436, 1436, 1436, - /* 510 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 520 */ 1746, 1436, 1886, 1436, 1845, 1841, 1436, 1436, 1837, 1436, - /* 530 */ 1436, 1902, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 540 */ 1436, 1830, 1436, 1803, 1436, 1436, 1436, 1436, 1436, 1436, - /* 550 */ 1436, 1436, 1757, 1436, 1436, 1436, 1436, 1707, 1436, 1436, - /* 560 */ 1436, 1436, 1436, 1436, 1436, 1436, 1745, 1436, 1788, 1436, - /* 570 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1599, 1436, 1436, - /* 580 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 590 */ 1584, 1582, 1581, 1580, 1436, 1577, 1436, 1436, 1436, 1436, - /* 600 */ 1608, 1607, 1436, 1436, 1436, 1436, 1436, 1436, 1528, 1436, - /* 610 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1519, 1436, - /* 620 */ 1518, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 630 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 640 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 650 */ 1436, 1436, 1436, + /* 0 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 10 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 20 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 30 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 40 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 50 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 60 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 70 */ 1506, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 80 */ 1434, 1434, 1434, 1434, 1434, 1504, 1657, 1434, 1832, 1434, + /* 90 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 100 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 110 */ 1434, 1434, 1434, 1434, 1434, 1506, 1434, 1844, 1844, 1844, + /* 120 */ 1504, 1434, 1434, 1434, 1701, 1701, 1434, 1434, 1434, 1434, + /* 130 */ 1600, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1693, + /* 140 */ 1434, 1434, 1913, 1434, 1434, 1699, 1867, 1434, 1434, 1434, + /* 150 */ 1434, 1553, 1859, 1836, 1850, 1837, 1834, 1898, 1898, 1898, + /* 160 */ 1853, 1434, 1863, 1434, 1434, 1434, 1685, 1434, 1434, 1662, + /* 170 */ 1659, 1659, 1434, 1434, 1434, 1434, 1506, 1434, 1506, 1434, + /* 180 */ 1434, 1506, 1434, 1506, 1434, 1506, 1506, 1434, 1506, 1434, + /* 190 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 200 */ 1434, 1434, 1434, 1434, 1434, 1504, 1695, 1434, 1504, 1434, + /* 210 */ 1434, 1434, 1504, 1434, 1434, 1874, 1872, 1434, 1874, 1872, + /* 220 */ 1434, 1434, 1434, 1886, 1882, 1874, 1890, 1888, 1865, 1863, + /* 230 */ 1850, 1434, 1434, 1904, 1900, 1916, 1904, 1900, 1904, 1900, + /* 240 */ 1434, 1872, 1434, 1434, 1434, 1434, 1434, 1872, 1434, 1434, + /* 250 */ 1434, 1434, 1504, 1434, 1504, 1434, 1569, 1434, 1434, 1434, + /* 260 */ 1504, 1466, 1434, 1687, 1701, 1603, 1603, 1603, 1507, 1439, + /* 270 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 280 */ 1434, 1770, 1885, 1884, 1808, 1807, 1806, 1804, 1769, 1434, + /* 290 */ 1434, 1565, 1768, 1767, 1434, 1434, 1434, 1434, 1434, 1434, + /* 300 */ 1761, 1762, 1760, 1759, 1434, 1434, 1434, 1434, 1434, 1434, + /* 310 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1833, + /* 320 */ 1434, 1901, 1905, 1434, 1434, 1434, 1744, 1434, 1434, 1434, + /* 330 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 340 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 350 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 360 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 370 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 380 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 390 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 400 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 410 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 420 */ 1434, 1434, 1434, 1471, 1434, 1434, 1434, 1434, 1434, 1434, + /* 430 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 440 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 450 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 460 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 470 */ 1534, 1533, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 480 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 490 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 500 */ 1434, 1434, 1434, 1434, 1434, 1866, 1434, 1434, 1434, 1434, + /* 510 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1744, + /* 520 */ 1434, 1883, 1434, 1843, 1839, 1434, 1434, 1835, 1434, 1434, + /* 530 */ 1899, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 540 */ 1828, 1434, 1801, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 550 */ 1434, 1755, 1434, 1434, 1434, 1434, 1705, 1434, 1434, 1434, + /* 560 */ 1434, 1434, 1434, 1434, 1434, 1743, 1434, 1786, 1434, 1434, + /* 570 */ 1434, 1434, 1434, 1434, 1434, 1434, 1597, 1434, 1434, 1434, + /* 580 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1582, + /* 590 */ 1580, 1579, 1578, 1434, 1575, 1434, 1434, 1434, 1434, 1606, + /* 600 */ 1605, 1434, 1434, 1434, 1434, 1434, 1434, 1526, 1434, 1434, + /* 610 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1517, 1434, 1516, + /* 620 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 630 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 640 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + /* 650 */ 1434, 1434, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1606,19 +1609,18 @@ static const char *const yyTokenName[] = { /* 358 */ "twindow_clause_opt", /* 359 */ "group_by_clause_opt", /* 360 */ "having_clause_opt", - /* 361 */ "select_sublist", - /* 362 */ "select_item", - /* 363 */ "fill_mode", - /* 364 */ "group_by_list", - /* 365 */ "query_expression_body", - /* 366 */ "order_by_clause_opt", - /* 367 */ "slimit_clause_opt", - /* 368 */ "limit_clause_opt", - /* 369 */ "query_primary", - /* 370 */ "sort_specification_list", - /* 371 */ "sort_specification", - /* 372 */ "ordering_specification_opt", - /* 373 */ "null_ordering_opt", + /* 361 */ "select_item", + /* 362 */ "fill_mode", + /* 363 */ "group_by_list", + /* 364 */ "query_expression_body", + /* 365 */ "order_by_clause_opt", + /* 366 */ "slimit_clause_opt", + /* 367 */ "limit_clause_opt", + /* 368 */ "query_primary", + /* 369 */ "sort_specification_list", + /* 370 */ "sort_specification", + /* 371 */ "ordering_specification_opt", + /* 372 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2045,70 +2047,69 @@ static const char *const yyRuleName[] = { /* 416 */ "set_quantifier_opt ::=", /* 417 */ "set_quantifier_opt ::= DISTINCT", /* 418 */ "set_quantifier_opt ::= ALL", - /* 419 */ "select_list ::= NK_STAR", - /* 420 */ "select_list ::= select_sublist", - /* 421 */ "select_sublist ::= select_item", - /* 422 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 423 */ "select_item ::= common_expression", - /* 424 */ "select_item ::= common_expression column_alias", - /* 425 */ "select_item ::= common_expression AS column_alias", - /* 426 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 427 */ "where_clause_opt ::=", - /* 428 */ "where_clause_opt ::= WHERE search_condition", - /* 429 */ "partition_by_clause_opt ::=", - /* 430 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 431 */ "twindow_clause_opt ::=", - /* 432 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 433 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 434 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 435 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 436 */ "sliding_opt ::=", - /* 437 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 438 */ "fill_opt ::=", - /* 439 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 440 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 441 */ "fill_mode ::= NONE", - /* 442 */ "fill_mode ::= PREV", - /* 443 */ "fill_mode ::= NULL", - /* 444 */ "fill_mode ::= LINEAR", - /* 445 */ "fill_mode ::= NEXT", - /* 446 */ "group_by_clause_opt ::=", - /* 447 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 448 */ "group_by_list ::= expression", - /* 449 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 450 */ "having_clause_opt ::=", - /* 451 */ "having_clause_opt ::= HAVING search_condition", - /* 452 */ "range_opt ::=", - /* 453 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 454 */ "every_opt ::=", - /* 455 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 456 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 457 */ "query_expression_body ::= query_primary", - /* 458 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 459 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 460 */ "query_primary ::= query_specification", - /* 461 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 462 */ "order_by_clause_opt ::=", - /* 463 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 464 */ "slimit_clause_opt ::=", - /* 465 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 467 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 468 */ "limit_clause_opt ::=", - /* 469 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 471 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 472 */ "subquery ::= NK_LP query_expression NK_RP", - /* 473 */ "search_condition ::= common_expression", - /* 474 */ "sort_specification_list ::= sort_specification", - /* 475 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 476 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 477 */ "ordering_specification_opt ::=", - /* 478 */ "ordering_specification_opt ::= ASC", - /* 479 */ "ordering_specification_opt ::= DESC", - /* 480 */ "null_ordering_opt ::=", - /* 481 */ "null_ordering_opt ::= NULLS FIRST", - /* 482 */ "null_ordering_opt ::= NULLS LAST", + /* 419 */ "select_list ::= select_item", + /* 420 */ "select_list ::= select_list NK_COMMA select_item", + /* 421 */ "select_item ::= NK_STAR", + /* 422 */ "select_item ::= common_expression", + /* 423 */ "select_item ::= common_expression column_alias", + /* 424 */ "select_item ::= common_expression AS column_alias", + /* 425 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 426 */ "where_clause_opt ::=", + /* 427 */ "where_clause_opt ::= WHERE search_condition", + /* 428 */ "partition_by_clause_opt ::=", + /* 429 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 430 */ "twindow_clause_opt ::=", + /* 431 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 432 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 433 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 434 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 435 */ "sliding_opt ::=", + /* 436 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 437 */ "fill_opt ::=", + /* 438 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 439 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 440 */ "fill_mode ::= NONE", + /* 441 */ "fill_mode ::= PREV", + /* 442 */ "fill_mode ::= NULL", + /* 443 */ "fill_mode ::= LINEAR", + /* 444 */ "fill_mode ::= NEXT", + /* 445 */ "group_by_clause_opt ::=", + /* 446 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 447 */ "group_by_list ::= expression", + /* 448 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 449 */ "having_clause_opt ::=", + /* 450 */ "having_clause_opt ::= HAVING search_condition", + /* 451 */ "range_opt ::=", + /* 452 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 453 */ "every_opt ::=", + /* 454 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 455 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 456 */ "query_expression_body ::= query_primary", + /* 457 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 458 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 459 */ "query_primary ::= query_specification", + /* 460 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 461 */ "order_by_clause_opt ::=", + /* 462 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 463 */ "slimit_clause_opt ::=", + /* 464 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 465 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 467 */ "limit_clause_opt ::=", + /* 468 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 469 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 471 */ "subquery ::= NK_LP query_expression NK_RP", + /* 472 */ "search_condition ::= common_expression", + /* 473 */ "sort_specification_list ::= sort_specification", + /* 474 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 475 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 476 */ "ordering_specification_opt ::=", + /* 477 */ "ordering_specification_opt ::= ASC", + /* 478 */ "ordering_specification_opt ::= DESC", + /* 479 */ "null_ordering_opt ::=", + /* 480 */ "null_ordering_opt ::= NULLS FIRST", + /* 481 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2290,14 +2291,14 @@ static void yy_destructor( case 357: /* fill_opt */ case 358: /* twindow_clause_opt */ case 360: /* having_clause_opt */ - case 362: /* select_item */ - case 365: /* query_expression_body */ - case 367: /* slimit_clause_opt */ - case 368: /* limit_clause_opt */ - case 369: /* query_primary */ - case 371: /* sort_specification */ + case 361: /* select_item */ + case 364: /* query_expression_body */ + case 366: /* slimit_clause_opt */ + case 367: /* limit_clause_opt */ + case 368: /* query_primary */ + case 370: /* sort_specification */ { - nodesDestroyNode((yypminor->yy652)); + nodesDestroyNode((yypminor->yy184)); } break; case 251: /* account_options */ @@ -2370,12 +2371,11 @@ static void yy_destructor( case 353: /* select_list */ case 354: /* partition_by_clause_opt */ case 359: /* group_by_clause_opt */ - case 361: /* select_sublist */ - case 364: /* group_by_list */ - case 366: /* order_by_clause_opt */ - case 370: /* sort_specification_list */ + case 363: /* group_by_list */ + case 365: /* order_by_clause_opt */ + case 369: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy24)); + nodesDestroyList((yypminor->yy296)); } break; case 270: /* alter_db_option */ @@ -2400,17 +2400,17 @@ static void yy_destructor( } break; - case 363: /* fill_mode */ + case 362: /* fill_mode */ { } break; - case 372: /* ordering_specification_opt */ + case 371: /* ordering_specification_opt */ { } break; - case 373: /* null_ordering_opt */ + case 372: /* null_ordering_opt */ { } @@ -3128,70 +3128,69 @@ static const struct { { 352, 0 }, /* (416) set_quantifier_opt ::= */ { 352, -1 }, /* (417) set_quantifier_opt ::= DISTINCT */ { 352, -1 }, /* (418) set_quantifier_opt ::= ALL */ - { 353, -1 }, /* (419) select_list ::= NK_STAR */ - { 353, -1 }, /* (420) select_list ::= select_sublist */ - { 361, -1 }, /* (421) select_sublist ::= select_item */ - { 361, -3 }, /* (422) select_sublist ::= select_sublist NK_COMMA select_item */ - { 362, -1 }, /* (423) select_item ::= common_expression */ - { 362, -2 }, /* (424) select_item ::= common_expression column_alias */ - { 362, -3 }, /* (425) select_item ::= common_expression AS column_alias */ - { 362, -3 }, /* (426) select_item ::= table_name NK_DOT NK_STAR */ - { 320, 0 }, /* (427) where_clause_opt ::= */ - { 320, -2 }, /* (428) where_clause_opt ::= WHERE search_condition */ - { 354, 0 }, /* (429) partition_by_clause_opt ::= */ - { 354, -3 }, /* (430) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 358, 0 }, /* (431) twindow_clause_opt ::= */ - { 358, -6 }, /* (432) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 358, -4 }, /* (433) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 358, -6 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 358, -8 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 305, 0 }, /* (436) sliding_opt ::= */ - { 305, -4 }, /* (437) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 357, 0 }, /* (438) fill_opt ::= */ - { 357, -4 }, /* (439) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 357, -6 }, /* (440) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 363, -1 }, /* (441) fill_mode ::= NONE */ - { 363, -1 }, /* (442) fill_mode ::= PREV */ - { 363, -1 }, /* (443) fill_mode ::= NULL */ - { 363, -1 }, /* (444) fill_mode ::= LINEAR */ - { 363, -1 }, /* (445) fill_mode ::= NEXT */ - { 359, 0 }, /* (446) group_by_clause_opt ::= */ - { 359, -3 }, /* (447) group_by_clause_opt ::= GROUP BY group_by_list */ - { 364, -1 }, /* (448) group_by_list ::= expression */ - { 364, -3 }, /* (449) group_by_list ::= group_by_list NK_COMMA expression */ - { 360, 0 }, /* (450) having_clause_opt ::= */ - { 360, -2 }, /* (451) having_clause_opt ::= HAVING search_condition */ - { 355, 0 }, /* (452) range_opt ::= */ - { 355, -6 }, /* (453) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 356, 0 }, /* (454) every_opt ::= */ - { 356, -4 }, /* (455) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 311, -4 }, /* (456) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 365, -1 }, /* (457) query_expression_body ::= query_primary */ - { 365, -4 }, /* (458) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 365, -3 }, /* (459) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 369, -1 }, /* (460) query_primary ::= query_specification */ - { 369, -6 }, /* (461) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 366, 0 }, /* (462) order_by_clause_opt ::= */ - { 366, -3 }, /* (463) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 367, 0 }, /* (464) slimit_clause_opt ::= */ - { 367, -2 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 367, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 367, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 368, 0 }, /* (468) limit_clause_opt ::= */ - { 368, -2 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 368, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 368, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 329, -3 }, /* (472) subquery ::= NK_LP query_expression NK_RP */ - { 350, -1 }, /* (473) search_condition ::= common_expression */ - { 370, -1 }, /* (474) sort_specification_list ::= sort_specification */ - { 370, -3 }, /* (475) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 371, -3 }, /* (476) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 372, 0 }, /* (477) ordering_specification_opt ::= */ - { 372, -1 }, /* (478) ordering_specification_opt ::= ASC */ - { 372, -1 }, /* (479) ordering_specification_opt ::= DESC */ - { 373, 0 }, /* (480) null_ordering_opt ::= */ - { 373, -2 }, /* (481) null_ordering_opt ::= NULLS FIRST */ - { 373, -2 }, /* (482) null_ordering_opt ::= NULLS LAST */ + { 353, -1 }, /* (419) select_list ::= select_item */ + { 353, -3 }, /* (420) select_list ::= select_list NK_COMMA select_item */ + { 361, -1 }, /* (421) select_item ::= NK_STAR */ + { 361, -1 }, /* (422) select_item ::= common_expression */ + { 361, -2 }, /* (423) select_item ::= common_expression column_alias */ + { 361, -3 }, /* (424) select_item ::= common_expression AS column_alias */ + { 361, -3 }, /* (425) select_item ::= table_name NK_DOT NK_STAR */ + { 320, 0 }, /* (426) where_clause_opt ::= */ + { 320, -2 }, /* (427) where_clause_opt ::= WHERE search_condition */ + { 354, 0 }, /* (428) partition_by_clause_opt ::= */ + { 354, -3 }, /* (429) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 358, 0 }, /* (430) twindow_clause_opt ::= */ + { 358, -6 }, /* (431) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 358, -4 }, /* (432) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 358, -6 }, /* (433) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 358, -8 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 305, 0 }, /* (435) sliding_opt ::= */ + { 305, -4 }, /* (436) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 357, 0 }, /* (437) fill_opt ::= */ + { 357, -4 }, /* (438) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 357, -6 }, /* (439) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 362, -1 }, /* (440) fill_mode ::= NONE */ + { 362, -1 }, /* (441) fill_mode ::= PREV */ + { 362, -1 }, /* (442) fill_mode ::= NULL */ + { 362, -1 }, /* (443) fill_mode ::= LINEAR */ + { 362, -1 }, /* (444) fill_mode ::= NEXT */ + { 359, 0 }, /* (445) group_by_clause_opt ::= */ + { 359, -3 }, /* (446) group_by_clause_opt ::= GROUP BY group_by_list */ + { 363, -1 }, /* (447) group_by_list ::= expression */ + { 363, -3 }, /* (448) group_by_list ::= group_by_list NK_COMMA expression */ + { 360, 0 }, /* (449) having_clause_opt ::= */ + { 360, -2 }, /* (450) having_clause_opt ::= HAVING search_condition */ + { 355, 0 }, /* (451) range_opt ::= */ + { 355, -6 }, /* (452) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 356, 0 }, /* (453) every_opt ::= */ + { 356, -4 }, /* (454) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 311, -4 }, /* (455) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 364, -1 }, /* (456) query_expression_body ::= query_primary */ + { 364, -4 }, /* (457) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 364, -3 }, /* (458) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 368, -1 }, /* (459) query_primary ::= query_specification */ + { 368, -6 }, /* (460) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 365, 0 }, /* (461) order_by_clause_opt ::= */ + { 365, -3 }, /* (462) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 366, 0 }, /* (463) slimit_clause_opt ::= */ + { 366, -2 }, /* (464) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 366, -4 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 366, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 367, 0 }, /* (467) limit_clause_opt ::= */ + { 367, -2 }, /* (468) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 367, -4 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 367, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 329, -3 }, /* (471) subquery ::= NK_LP query_expression NK_RP */ + { 350, -1 }, /* (472) search_condition ::= common_expression */ + { 369, -1 }, /* (473) sort_specification_list ::= sort_specification */ + { 369, -3 }, /* (474) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 370, -3 }, /* (475) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 371, 0 }, /* (476) ordering_specification_opt ::= */ + { 371, -1 }, /* (477) ordering_specification_opt ::= ASC */ + { 371, -1 }, /* (478) ordering_specification_opt ::= DESC */ + { 372, 0 }, /* (479) null_ordering_opt ::= */ + { 372, -2 }, /* (480) null_ordering_opt ::= NULLS FIRST */ + { 372, -2 }, /* (481) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3328,69 +3327,69 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,253,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy0, yymsp[0].minor.yy619); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy0, yymsp[0].minor.yy57); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy7); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy619 = 1; } +{ yymsp[1].minor.yy57 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy619 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy57 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy193, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy193, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy701 = yymsp[0].minor.yy701; } - yymsp[0].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy193 = yymsp[0].minor.yy193; } + yymsp[0].minor.yy193 = yylhsminor.yy193; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy701 = yymsp[-2].minor.yy701 | yymsp[0].minor.yy701; } - yymsp[-2].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy193 = yymsp[-2].minor.yy193 | yymsp[0].minor.yy193; } + yymsp[-2].minor.yy193 = yylhsminor.yy193; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy657 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy7 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy7 = yylhsminor.yy7; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy657 = yymsp[-2].minor.yy657; } - yymsp[-2].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy7 = yymsp[-2].minor.yy7; } + yymsp[-2].minor.yy7 = yylhsminor.yy7; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy657, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy7, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy7); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3431,8 +3430,8 @@ static YYACTIONTYPE yy_reduce( case 360: /* star_func ::= FIRST */ yytestcase(yyruleno==360); case 361: /* star_func ::= LAST */ yytestcase(yyruleno==361); case 362: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==362); -{ yylhsminor.yy657 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy7 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy7 = yylhsminor.yy7; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3465,156 +3464,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy97, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy419, &yymsp[-1].minor.yy7, yymsp[0].minor.yy184); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy7); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy7, yymsp[0].minor.yy184); } break; case 66: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy97 = true; } +{ yymsp[-2].minor.yy419 = true; } break; case 67: /* not_exists_opt ::= */ case 69: /* exists_opt ::= */ yytestcase(yyruleno==69); case 248: /* analyze_opt ::= */ yytestcase(yyruleno==248); case 256: /* agg_func_opt ::= */ yytestcase(yyruleno==256); case 416: /* set_quantifier_opt ::= */ yytestcase(yyruleno==416); -{ yymsp[1].minor.yy97 = false; } +{ yymsp[1].minor.yy419 = false; } break; case 68: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy97 = true; } +{ yymsp[-1].minor.yy419 = true; } break; case 70: /* db_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy184 = createDefaultDatabaseOptions(pCxt); } break; case 71: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 72: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 73: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 74: /* db_options ::= db_options DURATION NK_INTEGER */ case 75: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==75); -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 76: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 77: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 78: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 79: /* db_options ::= db_options KEEP integer_list */ case 80: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==80); -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_KEEP, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_KEEP, yymsp[0].minor.yy296); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 81: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 82: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 83: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 84: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 85: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 86: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 87: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 88: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 89: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_RETENTIONS, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_RETENTIONS, yymsp[0].minor.yy296); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 90: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 91: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy652 = createAlterDatabaseOptions(pCxt); yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yylhsminor.yy652, &yymsp[0].minor.yy189); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterDatabaseOptions(pCxt); yylhsminor.yy184 = setAlterDatabaseOption(pCxt, yylhsminor.yy184, &yymsp[0].minor.yy139); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 92: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy652, &yymsp[0].minor.yy189); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy184, &yymsp[0].minor.yy139); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 93: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 94: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 95: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 96: /* alter_db_option ::= KEEP integer_list */ case 97: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==97); -{ yymsp[-1].minor.yy189.type = DB_OPTION_KEEP; yymsp[-1].minor.yy189.pList = yymsp[0].minor.yy24; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_KEEP; yymsp[-1].minor.yy139.pList = yymsp[0].minor.yy296; } break; case 98: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_PAGES; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_PAGES; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 99: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 100: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_STRICT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_STRICT; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 101: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_WAL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = DB_OPTION_WAL; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 102: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 277: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==277); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy296 = yylhsminor.yy296; break; case 104: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy24 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy296 = yylhsminor.yy296; break; case 106: /* retention_list ::= retention */ case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); @@ -3625,10 +3624,10 @@ static YYACTIONTYPE yy_reduce( case 231: /* func_list ::= func */ yytestcase(yyruleno==231); case 303: /* literal_list ::= signed_literal */ yytestcase(yyruleno==303); case 365: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==365); - case 421: /* select_sublist ::= select_item */ yytestcase(yyruleno==421); - case 474: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==474); -{ yylhsminor.yy24 = createNodeList(pCxt, yymsp[0].minor.yy652); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 419: /* select_list ::= select_item */ yytestcase(yyruleno==419); + case 473: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==473); +{ yylhsminor.yy296 = createNodeList(pCxt, yymsp[0].minor.yy184); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 107: /* retention_list ::= retention_list NK_COMMA retention */ case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); @@ -3637,251 +3636,250 @@ static YYACTIONTYPE yy_reduce( case 232: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==232); case 304: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==304); case 366: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==366); - case 422: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==422); - case 475: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==475); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 420: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==420); + case 474: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==474); +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy296 = yylhsminor.yy296; break; case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy652 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-5].minor.yy652, yymsp[-3].minor.yy24, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy419, yymsp[-5].minor.yy184, yymsp[-3].minor.yy296, yymsp[-1].minor.yy296, yymsp[0].minor.yy184); } break; case 110: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy296); } break; case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy296); } break; case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy419, yymsp[0].minor.yy184); } break; case 114: /* cmd ::= ALTER TABLE alter_table_clause */ case 115: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==115); case 280: /* cmd ::= query_expression */ yytestcase(yyruleno==280); -{ pCxt->pRootNode = yymsp[0].minor.yy652; } +{ pCxt->pRootNode = yymsp[0].minor.yy184; } break; case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy652 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy184, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy7); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy184, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy7); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy652 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy652, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy184, &yymsp[-2].minor.yy7, yymsp[0].minor.yy184); } + yymsp[-5].minor.yy184 = yylhsminor.yy184; break; case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-1].minor.yy296, yymsp[0].minor.yy184); } + yymsp[-1].minor.yy296 = yylhsminor.yy296; break; case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ -{ yylhsminor.yy652 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy97, yymsp[-8].minor.yy652, yymsp[-6].minor.yy652, yymsp[-5].minor.yy24, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-9].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy419, yymsp[-8].minor.yy184, yymsp[-6].minor.yy184, yymsp[-5].minor.yy296, yymsp[-2].minor.yy296, yymsp[0].minor.yy184); } + yymsp[-9].minor.yy184 = yylhsminor.yy184; break; case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy652 = createDropTableClause(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createDropTableClause(pCxt, yymsp[-1].minor.yy419, yymsp[0].minor.yy184); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 132: /* specific_tags_opt ::= */ case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); - case 429: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==429); - case 446: /* group_by_clause_opt ::= */ yytestcase(yyruleno==446); - case 462: /* order_by_clause_opt ::= */ yytestcase(yyruleno==462); -{ yymsp[1].minor.yy24 = NULL; } + case 428: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==428); + case 445: /* group_by_clause_opt ::= */ yytestcase(yyruleno==445); + case 461: /* order_by_clause_opt ::= */ yytestcase(yyruleno==461); +{ yymsp[1].minor.yy296 = NULL; } break; case 133: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy24 = yymsp[-1].minor.yy24; } +{ yymsp[-2].minor.yy296 = yymsp[-1].minor.yy296; } break; case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy657, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy7, NULL); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, NULL); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRealTableNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7, NULL); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48, NULL); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332, NULL); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-2].minor.yy48, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-2].minor.yy332, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 143: /* type_name ::= INT */ case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_INT); } break; case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 164: /* tags_def_opt ::= tags_def */ case 364: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==364); - case 420: /* select_list ::= select_sublist */ yytestcase(yyruleno==420); -{ yylhsminor.yy24 = yymsp[0].minor.yy24; } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = yymsp[0].minor.yy296; } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy24 = yymsp[-1].minor.yy24; } +{ yymsp[-3].minor.yy296 = yymsp[-1].minor.yy296; } break; case 166: /* table_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy184 = createDefaultTableOptions(pCxt); } break; case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy296); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy296); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy24); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-4].minor.yy184, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy296); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_SMA, yymsp[-1].minor.yy24); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-4].minor.yy184, TABLE_OPTION_SMA, yymsp[-1].minor.yy296); } + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 173: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy652 = createAlterTableOptions(pCxt); yylhsminor.yy652 = setTableOption(pCxt, yylhsminor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createAlterTableOptions(pCxt); yylhsminor.yy184 = setTableOption(pCxt, yylhsminor.yy184, yymsp[0].minor.yy139.type, &yymsp[0].minor.yy139.val); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy139.type, &yymsp[0].minor.yy139.val); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy139.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } break; case 177: /* duration_list ::= duration_literal */ case 332: /* expression_list ::= expression */ yytestcase(yyruleno==332); -{ yylhsminor.yy24 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 333: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==333); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); } + yymsp[-2].minor.yy296 = yylhsminor.yy296; break; case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy657, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[0].minor.yy7, NULL); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 182: /* rollup_func_name ::= FIRST */ case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 186: /* col_name ::= column_name */ -{ yylhsminor.yy652 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy7); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 187: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3893,13 +3891,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, OP_TYPE_LIKE); } break; case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, OP_TYPE_LIKE); } break; case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy652, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy184, NULL, OP_TYPE_LIKE); } break; case 193: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -3914,7 +3912,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy652, yymsp[-1].minor.yy652, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy184, yymsp[-1].minor.yy184, OP_TYPE_EQUAL); } break; case 198: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -3933,13 +3931,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy7); } break; case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy184); } break; case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy184); } break; case 207: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -3972,7 +3970,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy184); } break; case 218: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -3982,150 +3980,150 @@ static YYACTIONTYPE yy_reduce( break; case 220: /* db_name_cond_opt ::= */ case 225: /* from_db_opt ::= */ yytestcase(yyruleno==225); -{ yymsp[1].minor.yy652 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy184 = createDefaultDatabaseCondValue(pCxt); } break; case 221: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy7); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 222: /* like_pattern_opt ::= */ case 262: /* into_opt ::= */ yytestcase(yyruleno==262); case 397: /* from_clause_opt ::= */ yytestcase(yyruleno==397); - case 427: /* where_clause_opt ::= */ yytestcase(yyruleno==427); - case 431: /* twindow_clause_opt ::= */ yytestcase(yyruleno==431); - case 436: /* sliding_opt ::= */ yytestcase(yyruleno==436); - case 438: /* fill_opt ::= */ yytestcase(yyruleno==438); - case 450: /* having_clause_opt ::= */ yytestcase(yyruleno==450); - case 452: /* range_opt ::= */ yytestcase(yyruleno==452); - case 454: /* every_opt ::= */ yytestcase(yyruleno==454); - case 464: /* slimit_clause_opt ::= */ yytestcase(yyruleno==464); - case 468: /* limit_clause_opt ::= */ yytestcase(yyruleno==468); -{ yymsp[1].minor.yy652 = NULL; } + case 426: /* where_clause_opt ::= */ yytestcase(yyruleno==426); + case 430: /* twindow_clause_opt ::= */ yytestcase(yyruleno==430); + case 435: /* sliding_opt ::= */ yytestcase(yyruleno==435); + case 437: /* fill_opt ::= */ yytestcase(yyruleno==437); + case 449: /* having_clause_opt ::= */ yytestcase(yyruleno==449); + case 451: /* range_opt ::= */ yytestcase(yyruleno==451); + case 453: /* every_opt ::= */ yytestcase(yyruleno==453); + case 463: /* slimit_clause_opt ::= */ yytestcase(yyruleno==463); + case 467: /* limit_clause_opt ::= */ yytestcase(yyruleno==467); +{ yymsp[1].minor.yy184 = NULL; } break; case 223: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 224: /* table_name_cond ::= table_name */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy7); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 226: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } +{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy7); } break; case 227: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, NULL, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy7, NULL, yymsp[0].minor.yy184); } break; case 228: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } break; case 229: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy652 = createIndexOption(pCxt, yymsp[-7].minor.yy24, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-9].minor.yy184 = createIndexOption(pCxt, yymsp[-7].minor.yy296, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy652 = createIndexOption(pCxt, yymsp[-9].minor.yy24, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-11].minor.yy184 = createIndexOption(pCxt, yymsp[-9].minor.yy296, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; case 233: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-1].minor.yy296); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 234: /* sma_stream_opt ::= */ case 264: /* stream_options ::= */ yytestcase(yyruleno==264); -{ yymsp[1].minor.yy652 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy184 = createStreamOptions(pCxt); } break; case 235: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 268: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==268); -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy184)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-2].minor.yy184; } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 236: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy184)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-2].minor.yy184; } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 237: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy419, &yymsp[-2].minor.yy7, yymsp[0].minor.yy184); } break; case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy657, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, &yymsp[0].minor.yy7, false); } break; case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[0].minor.yy657, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy419, &yymsp[-5].minor.yy7, &yymsp[0].minor.yy7, true); } break; case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, yymsp[0].minor.yy652, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, yymsp[0].minor.yy184, false); } break; case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, yymsp[0].minor.yy652, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy419, &yymsp[-5].minor.yy7, yymsp[0].minor.yy184, true); } break; case 242: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } break; case 243: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy419, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } break; case 244: /* cmd ::= DESC full_table_name */ case 245: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==245); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy184); } break; case 246: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 247: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy97, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy419, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; case 249: /* analyze_opt ::= ANALYZE */ case 257: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==257); case 417: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==417); -{ yymsp[0].minor.yy97 = true; } +{ yymsp[0].minor.yy419 = true; } break; case 250: /* explain_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy184 = createDefaultExplainOptions(pCxt); } break; case 251: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy652 = setExplainVerbose(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setExplainVerbose(pCxt, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 252: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy652 = setExplainRatio(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = setExplainRatio(pCxt, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 253: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy24); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy296); } break; case 254: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-8].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy48, yymsp[0].minor.yy244); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy419, yymsp[-8].minor.yy419, &yymsp[-5].minor.yy7, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy332, yymsp[0].minor.yy20); } break; case 255: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } break; case 258: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy244 = 0; } +{ yymsp[1].minor.yy20 = 0; } break; case 259: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy244 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy20 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 260: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy97, &yymsp[-4].minor.yy657, yymsp[-2].minor.yy652, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy419, &yymsp[-4].minor.yy7, yymsp[-2].minor.yy184, yymsp[-3].minor.yy184, yymsp[0].minor.yy184); } break; case 261: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } break; case 263: /* into_opt ::= INTO full_table_name */ case 398: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==398); - case 428: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==428); - case 451: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==451); -{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } + case 427: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==427); + case 450: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==450); +{ yymsp[-1].minor.yy184 = yymsp[0].minor.yy184; } break; case 265: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy184)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy184 = yymsp[-2].minor.yy184; } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 266: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy184)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy184 = yymsp[-2].minor.yy184; } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 267: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy652)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-3].minor.yy652; } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-3].minor.yy184)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy184)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-3].minor.yy184; } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 269: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -4143,39 +4141,39 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 274: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy296); } break; case 275: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 276: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +{ yymsp[-1].minor.yy296 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 278: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy657); } +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy7); } break; case 279: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; case 281: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 282: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 283: /* literal ::= NK_STRING */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 284: /* literal ::= NK_BOOL */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 285: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 286: /* literal ::= duration_literal */ case 296: /* signed_literal ::= signed */ yytestcase(yyruleno==296); @@ -4193,165 +4191,165 @@ static YYACTIONTYPE yy_reduce( case 401: /* table_reference ::= table_primary */ yytestcase(yyruleno==401); case 402: /* table_reference ::= joined_table */ yytestcase(yyruleno==402); case 406: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==406); - case 457: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==457); - case 460: /* query_primary ::= query_specification */ yytestcase(yyruleno==460); -{ yylhsminor.yy652 = yymsp[0].minor.yy652; } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 456: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==456); + case 459: /* query_primary ::= query_specification */ yytestcase(yyruleno==459); +{ yylhsminor.yy184 = yymsp[0].minor.yy184; } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 287: /* literal ::= NULL */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 288: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 289: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 290: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 291: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 292: /* 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.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 293: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 294: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; case 295: /* 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.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 297: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 298: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 299: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 300: /* signed_literal ::= duration_literal */ case 302: /* signed_literal ::= literal_func */ yytestcase(yyruleno==302); case 367: /* star_func_para ::= expression */ yytestcase(yyruleno==367); - case 423: /* select_item ::= common_expression */ yytestcase(yyruleno==423); - case 473: /* search_condition ::= common_expression */ yytestcase(yyruleno==473); -{ yylhsminor.yy652 = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 422: /* select_item ::= common_expression */ yytestcase(yyruleno==422); + case 472: /* search_condition ::= common_expression */ yytestcase(yyruleno==472); +{ yylhsminor.yy184 = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 301: /* signed_literal ::= NULL */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 321: /* expression ::= NK_LP expression NK_RP */ case 394: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==394); -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 322: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 323: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy184), NULL)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 324: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 325: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 326: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 327: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 328: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 329: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 330: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 331: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 334: /* column_reference ::= column_name */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy657, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy7, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy7)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 335: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7, createColumnNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 336: /* pseudo_column ::= ROWTS */ case 337: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==337); @@ -4361,319 +4359,320 @@ static YYACTIONTYPE yy_reduce( case 342: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==342); case 343: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==343); case 349: /* literal_func ::= NOW */ yytestcase(yyruleno==349); -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; case 338: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy657)))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy7)))); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 344: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 345: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==345); -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24)); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-1].minor.yy296)); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 346: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy48)); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy332)); } + yymsp[-5].minor.yy184 = yylhsminor.yy184; break; case 348: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy657, NULL)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy7, NULL)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 363: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy24 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy296 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; case 368: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 426: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==426); -{ yylhsminor.yy652 = createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 425: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==425); +{ yylhsminor.yy184 = createColumnNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 369: /* predicate ::= expression compare_op expression */ case 374: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==374); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy700, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy496, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 370: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy184), releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; + yymsp[-4].minor.yy184 = yylhsminor.yy184; break; case 371: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; + yymsp[-5].minor.yy184 = yylhsminor.yy184; break; case 372: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), NULL)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 373: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL)); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 375: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_THAN; } +{ yymsp[0].minor.yy496 = OP_TYPE_LOWER_THAN; } break; case 376: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_THAN; } +{ yymsp[0].minor.yy496 = OP_TYPE_GREATER_THAN; } break; case 377: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_EQUAL; } +{ yymsp[0].minor.yy496 = OP_TYPE_LOWER_EQUAL; } break; case 378: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_EQUAL; } +{ yymsp[0].minor.yy496 = OP_TYPE_GREATER_EQUAL; } break; case 379: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy700 = OP_TYPE_NOT_EQUAL; } +{ yymsp[0].minor.yy496 = OP_TYPE_NOT_EQUAL; } break; case 380: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy700 = OP_TYPE_EQUAL; } +{ yymsp[0].minor.yy496 = OP_TYPE_EQUAL; } break; case 381: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy700 = OP_TYPE_LIKE; } +{ yymsp[0].minor.yy496 = OP_TYPE_LIKE; } break; case 382: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_LIKE; } +{ yymsp[-1].minor.yy496 = OP_TYPE_NOT_LIKE; } break; case 383: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy700 = OP_TYPE_MATCH; } +{ yymsp[0].minor.yy496 = OP_TYPE_MATCH; } break; case 384: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy700 = OP_TYPE_NMATCH; } +{ yymsp[0].minor.yy496 = OP_TYPE_NMATCH; } break; case 385: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy700 = OP_TYPE_JSON_CONTAINS; } +{ yymsp[0].minor.yy496 = OP_TYPE_JSON_CONTAINS; } break; case 386: /* in_op ::= IN */ -{ yymsp[0].minor.yy700 = OP_TYPE_IN; } +{ yymsp[0].minor.yy496 = OP_TYPE_IN; } break; case 387: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_IN; } +{ yymsp[-1].minor.yy496 = OP_TYPE_NOT_IN; } break; case 388: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy296)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 390: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy184), NULL)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 391: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 392: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); + yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 400: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy652 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, NULL); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, NULL); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; case 403: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 404: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createRealTableNode(pCxt, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; case 405: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy652 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184), &yymsp[0].minor.yy7); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; case 407: /* alias_opt ::= */ -{ yymsp[1].minor.yy657 = nil_token; } +{ yymsp[1].minor.yy7 = nil_token; } break; case 408: /* alias_opt ::= table_alias */ -{ yylhsminor.yy657 = yymsp[0].minor.yy657; } - yymsp[0].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy7 = yymsp[0].minor.yy7; } + yymsp[0].minor.yy7 = yylhsminor.yy7; break; case 409: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy657 = yymsp[0].minor.yy657; } +{ yymsp[-1].minor.yy7 = yymsp[0].minor.yy7; } break; case 410: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 411: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==411); -{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } +{ yymsp[-2].minor.yy184 = yymsp[-1].minor.yy184; } break; case 412: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy652 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy184 = createJoinTableNode(pCxt, yymsp[-4].minor.yy54, yymsp[-5].minor.yy184, yymsp[-2].minor.yy184, yymsp[0].minor.yy184); } + yymsp[-5].minor.yy184 = yylhsminor.yy184; break; case 413: /* join_type ::= */ -{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; } +{ yymsp[1].minor.yy54 = JOIN_TYPE_INNER; } break; case 414: /* join_type ::= INNER */ -{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; } +{ yymsp[0].minor.yy54 = JOIN_TYPE_INNER; } break; case 415: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy652 = createSelectStmt(pCxt, yymsp[-10].minor.yy97, yymsp[-9].minor.yy24, yymsp[-8].minor.yy652); - yymsp[-11].minor.yy652 = addWhereClause(pCxt, yymsp[-11].minor.yy652, yymsp[-7].minor.yy652); - yymsp[-11].minor.yy652 = addPartitionByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-6].minor.yy24); - yymsp[-11].minor.yy652 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy652, yymsp[-2].minor.yy652); - yymsp[-11].minor.yy652 = addGroupByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-1].minor.yy24); - yymsp[-11].minor.yy652 = addHavingClause(pCxt, yymsp[-11].minor.yy652, yymsp[0].minor.yy652); - yymsp[-11].minor.yy652 = addRangeClause(pCxt, yymsp[-11].minor.yy652, yymsp[-5].minor.yy652); - yymsp[-11].minor.yy652 = addEveryClause(pCxt, yymsp[-11].minor.yy652, yymsp[-4].minor.yy652); - yymsp[-11].minor.yy652 = addFillClause(pCxt, yymsp[-11].minor.yy652, yymsp[-3].minor.yy652); + yymsp[-11].minor.yy184 = createSelectStmt(pCxt, yymsp[-10].minor.yy419, yymsp[-9].minor.yy296, yymsp[-8].minor.yy184); + yymsp[-11].minor.yy184 = addWhereClause(pCxt, yymsp[-11].minor.yy184, yymsp[-7].minor.yy184); + yymsp[-11].minor.yy184 = addPartitionByClause(pCxt, yymsp[-11].minor.yy184, yymsp[-6].minor.yy296); + yymsp[-11].minor.yy184 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy184, yymsp[-2].minor.yy184); + yymsp[-11].minor.yy184 = addGroupByClause(pCxt, yymsp[-11].minor.yy184, yymsp[-1].minor.yy296); + yymsp[-11].minor.yy184 = addHavingClause(pCxt, yymsp[-11].minor.yy184, yymsp[0].minor.yy184); + yymsp[-11].minor.yy184 = addRangeClause(pCxt, yymsp[-11].minor.yy184, yymsp[-5].minor.yy184); + yymsp[-11].minor.yy184 = addEveryClause(pCxt, yymsp[-11].minor.yy184, yymsp[-4].minor.yy184); + yymsp[-11].minor.yy184 = addFillClause(pCxt, yymsp[-11].minor.yy184, yymsp[-3].minor.yy184); } break; case 418: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy97 = false; } +{ yymsp[0].minor.yy419 = false; } break; - case 419: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy24 = NULL; } + case 421: /* select_item ::= NK_STAR */ +{ yylhsminor.yy184 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 424: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + case 423: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy184 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184), &yymsp[0].minor.yy7); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; - case 425: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 424: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy184 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), &yymsp[0].minor.yy7); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 430: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 447: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==447); - case 463: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==463); -{ yymsp[-2].minor.yy24 = yymsp[0].minor.yy24; } + case 429: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 446: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==446); + case 462: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==462); +{ yymsp[-2].minor.yy296 = yymsp[0].minor.yy296; } break; - case 432: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy652 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } + case 431: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy184 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 433: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy652 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } + case 432: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy184 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } + case 433: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy184 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; - case 435: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } + case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy184 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } break; - case 437: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 455: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==455); -{ yymsp[-3].minor.yy652 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy652); } + case 436: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 454: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==454); +{ yymsp[-3].minor.yy184 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy184); } break; - case 439: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy652 = createFillNode(pCxt, yymsp[-1].minor.yy250, NULL); } + case 438: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy184 = createFillNode(pCxt, yymsp[-1].minor.yy540, NULL); } break; - case 440: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy652 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } + case 439: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy184 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy296)); } break; - case 441: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy250 = FILL_MODE_NONE; } + case 440: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy540 = FILL_MODE_NONE; } break; - case 442: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy250 = FILL_MODE_PREV; } + case 441: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy540 = FILL_MODE_PREV; } break; - case 443: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy250 = FILL_MODE_NULL; } + case 442: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy540 = FILL_MODE_NULL; } break; - case 444: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy250 = FILL_MODE_LINEAR; } + case 443: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy540 = FILL_MODE_LINEAR; } break; - case 445: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy250 = FILL_MODE_NEXT; } + case 444: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy540 = FILL_MODE_NEXT; } break; - case 448: /* group_by_list ::= expression */ -{ yylhsminor.yy24 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 447: /* group_by_list ::= expression */ +{ yylhsminor.yy296 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } + yymsp[0].minor.yy296 = yylhsminor.yy296; break; - case 449: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 448: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } + yymsp[-2].minor.yy296 = yylhsminor.yy296; break; - case 453: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy652 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } + case 452: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy184 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 456: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 455: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy652 = addOrderByClause(pCxt, yymsp[-3].minor.yy652, yymsp[-2].minor.yy24); - yylhsminor.yy652 = addSlimitClause(pCxt, yylhsminor.yy652, yymsp[-1].minor.yy652); - yylhsminor.yy652 = addLimitClause(pCxt, yylhsminor.yy652, yymsp[0].minor.yy652); + yylhsminor.yy184 = addOrderByClause(pCxt, yymsp[-3].minor.yy184, yymsp[-2].minor.yy296); + yylhsminor.yy184 = addSlimitClause(pCxt, yylhsminor.yy184, yymsp[-1].minor.yy184); + yylhsminor.yy184 = addLimitClause(pCxt, yylhsminor.yy184, yymsp[0].minor.yy184); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; - case 458: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + case 457: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy184 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy184, yymsp[0].minor.yy184); } + yymsp[-3].minor.yy184 = yylhsminor.yy184; break; - case 459: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 458: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy184 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy184, yymsp[0].minor.yy184); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 461: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ -{ yymsp[-5].minor.yy652 = yymsp[-4].minor.yy652; } - yy_destructor(yypParser,366,&yymsp[-3].minor); - yy_destructor(yypParser,367,&yymsp[-2].minor); - yy_destructor(yypParser,368,&yymsp[-1].minor); + case 460: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ +{ yymsp[-5].minor.yy184 = yymsp[-4].minor.yy184; } + yy_destructor(yypParser,365,&yymsp[-3].minor); + yy_destructor(yypParser,366,&yymsp[-2].minor); + yy_destructor(yypParser,367,&yymsp[-1].minor); break; - case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==469); -{ yymsp[-1].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 464: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 468: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==468); +{ yymsp[-1].minor.yy184 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==470); -{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==469); +{ yymsp[-3].minor.yy184 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 467: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 471: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==471); -{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==470); +{ yymsp[-3].minor.yy184 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 472: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy652); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 471: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy184); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 476: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy652 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), yymsp[-1].minor.yy598, yymsp[0].minor.yy653); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 475: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy184 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), yymsp[-1].minor.yy394, yymsp[0].minor.yy627); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 477: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy598 = ORDER_ASC; } + case 476: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy394 = ORDER_ASC; } break; - case 478: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy598 = ORDER_ASC; } + case 477: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy394 = ORDER_ASC; } break; - case 479: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy598 = ORDER_DESC; } + case 478: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy394 = ORDER_DESC; } break; - case 480: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy653 = NULL_ORDER_DEFAULT; } + case 479: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy627 = NULL_ORDER_DEFAULT; } break; - case 481: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy653 = NULL_ORDER_FIRST; } + case 480: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy627 = NULL_ORDER_FIRST; } break; - case 482: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy653 = NULL_ORDER_LAST; } + case 481: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy627 = NULL_ORDER_LAST; } break; default: break; diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 7b275c5a15..96d017ec7a 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -364,7 +364,7 @@ int32_t shellDumpResultToFile(const char *fname, TAOS_RES *tres) { int32_t *length = taos_fetch_lengths(tres); for (int32_t i = 0; i < num_fields; i++) { if (i > 0) { - taosFprintfFile(pFile, "\n"); + taosFprintfFile(pFile, ","); } shellDumpFieldToFile(pFile, (const char *)row[i], fields + i, length[i], precision); } @@ -394,9 +394,9 @@ void shellPrintNChar(const char *str, int32_t length, int32_t width) { break; } int w = 0; - if(*(str + pos) == '\t' || *(str + pos) == '\n' || *(str + pos) == '\r'){ + if (*(str + pos) == '\t' || *(str + pos) == '\n' || *(str + pos) == '\r') { w = bytes; - }else{ + } else { w = taosWcharWidth(wc); } pos += bytes; @@ -513,7 +513,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t } bool shellIsLimitQuery(const char *sql) { - //todo refactor + // todo refactor if (taosStrCaseStr(sql, " limit ") != NULL) { return true; } @@ -522,7 +522,7 @@ bool shellIsLimitQuery(const char *sql) { } bool shellIsShowQuery(const char *sql) { - //todo refactor + // todo refactor if (taosStrCaseStr(sql, "show ") != NULL) { return true; } @@ -530,7 +530,6 @@ bool shellIsShowQuery(const char *sql) { return false; } - int32_t shellVerticalPrintResult(TAOS_RES *tres, const char *sql) { TAOS_ROW row = taos_fetch_row(tres); if (row == NULL) { From b6d66571744f1b38725db17ce77a358b236f80d6 Mon Sep 17 00:00:00 2001 From: slzhou Date: Thu, 30 Jun 2022 15:14:16 +0800 Subject: [PATCH 19/68] feat: support push agg operator condition to scan --- source/libs/nodes/src/nodesUtilFuncs.c | 1 - source/libs/planner/src/planOptimizer.c | 155 +++++++++++++++++++++++- 2 files changed, 152 insertions(+), 4 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index dc9d9b92ee..1972010e25 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1728,7 +1728,6 @@ static EDealRes classifyConditionImpl(SNode* pNode, void* pContext) { } else { pCxt->hasOtherCol = true; } - return *((bool*)pContext) ? DEAL_RES_CONTINUE : DEAL_RES_END; } return DEAL_RES_CONTINUE; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b5b53f00a0..a4641a4709 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -587,11 +587,160 @@ static int32_t pushDownCondOptDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* p return code; } -static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAgg) { - // todo +typedef struct SPartAggCondContext { + SAggLogicNode* pAgg; + bool hasAggFunc; +} SPartAggCondContext; + +static EDealRes partAggCondHasAggFuncImpl(SNode* pNode, void* pContext) { + SPartAggCondContext* pCxt = pContext; + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SNode* pAggFunc = NULL; + FOREACH(pAggFunc, pCxt->pAgg->pAggFuncs) { + if (strcmp(((SColumnNode*)pNode)->colName, ((SFunctionNode*)pAggFunc)->node.aliasName) == 0) { + pCxt->hasAggFunc = true; + return DEAL_RES_END; + } + } + } + return DEAL_RES_CONTINUE; +} + +static int32_t partitionAggCondHasAggFunc(SAggLogicNode* pAgg, SNode* pCond) { + SPartAggCondContext cxt = {.pAgg = pAgg, .hasAggFunc = false}; + nodesWalkExpr(pCond, partAggCondHasAggFuncImpl, &cxt); + return cxt.hasAggFunc; +} + +static int32_t partitionAggCondConj(SAggLogicNode* pAgg, SNode** ppAggFuncCond, SNode** ppGroupKeyCond) { + SLogicConditionNode* pLogicCond = (SLogicConditionNode*)pAgg->node.pConditions; + int32_t code = TSDB_CODE_SUCCESS; + + SNodeList* pAggFuncConds = NULL; + SNodeList* pGroupKeyConds = NULL; + SNode* pCond = NULL; + FOREACH(pCond, pLogicCond->pParameterList) { + if (partitionAggCondHasAggFunc(pAgg, pCond)) { + code = nodesListMakeAppend(&pAggFuncConds, nodesCloneNode(pCond)); + } else { + code = nodesListMakeAppend(&pGroupKeyConds, nodesCloneNode(pCond)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + SNode* pTempAggFuncCond = NULL; + SNode* pTempGroupKeyCond = NULL; + if (TSDB_CODE_SUCCESS == code) { + code = nodesMergeConds(&pTempAggFuncCond, &pAggFuncConds); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesMergeConds(&pTempGroupKeyCond, &pGroupKeyConds); + } + + if (TSDB_CODE_SUCCESS == code) { + *ppAggFuncCond = pTempAggFuncCond; + *ppGroupKeyCond = pTempGroupKeyCond; + } else { + nodesDestroyList(pAggFuncConds); + nodesDestroyList(pGroupKeyConds); + nodesDestroyNode(pTempAggFuncCond); + nodesDestroyNode(pTempGroupKeyCond); + } + pAgg->node.pConditions = NULL; + return code; +} + +static int32_t partitionAggCond(SAggLogicNode* pAgg, SNode** ppAggFunCond, SNode** ppGroupKeyCond) { + SNode* pAggNodeCond = pAgg->node.pConditions; + if (QUERY_NODE_LOGIC_CONDITION == nodeType(pAggNodeCond) && + LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)(pAggNodeCond))->condType) { + return partitionAggCondConj(pAgg, ppAggFunCond, ppGroupKeyCond); + } + if (partitionAggCondHasAggFunc(pAgg, pAggNodeCond)) { + *ppAggFunCond = pAggNodeCond; + } else { + *ppGroupKeyCond = pAggNodeCond; + } + pAgg->node.pConditions = NULL; return TSDB_CODE_SUCCESS; } +static int32_t pushCondToAggCond(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode** pAggFuncCond) { + pushDownCondOptAppendCond(&pAgg->node.pConditions, pAggFuncCond); + return TSDB_CODE_SUCCESS; +} + +typedef struct SRewriteAggGroupKeyCondContext{ + SAggLogicNode *pAgg; + int32_t errCode; +} SRewriteAggGroupKeyCondContext; + +static EDealRes rewriteAggGroupKeyCondForPushDownImpl(SNode** pNode, void* pContext) { + SRewriteAggGroupKeyCondContext* pCxt = pContext; + SAggLogicNode* pAgg = pCxt->pAgg; + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SNode* pGroupKey = NULL; + FOREACH(pGroupKey, pAgg->pGroupKeys) { + SNode* pGroup = NULL; + FOREACH(pGroup, ((SGroupingSetNode*)pGroupKey)->pParameterList) { + if (0 == strcmp(((SExprNode*)pGroup)->aliasName, ((SColumnNode*)(*pNode))->colName)) { + SNode* pExpr = nodesCloneNode(pGroup); + if (pExpr == NULL) { + pCxt->errCode = terrno; + return DEAL_RES_ERROR; + } + nodesDestroyNode(*pNode); + *pNode = pExpr; + } + } + } + return DEAL_RES_IGNORE_CHILD; + } + return DEAL_RES_CONTINUE; +} + +static int32_t rewriteAggGroupKeyCondForPushDown(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode* pGroupKeyCond) { + SRewriteAggGroupKeyCondContext cxt = {.pAgg = pAgg, .errCode = TSDB_CODE_SUCCESS}; + nodesRewriteExpr(&pGroupKeyCond, rewriteAggGroupKeyCondForPushDownImpl, &cxt); + return cxt.errCode; +} + +static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAgg) { + if (NULL == pAgg->node.pConditions || + OPTIMIZE_FLAG_TEST_MASK(pAgg->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE)) { + return TSDB_CODE_SUCCESS; + } + //TODO: remove it after full implementation of pushing down to child + if (1 != LIST_LENGTH(pAgg->node.pChildren) || + QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { + return TSDB_CODE_SUCCESS; + } + + SNode* pAggFuncCond = NULL; + SNode* pGroupKeyCond = NULL; + int32_t code = partitionAggCond(pAgg, &pAggFuncCond, &pGroupKeyCond); + if (TSDB_CODE_SUCCESS == code && NULL != pAggFuncCond) { + code = pushCondToAggCond(pCxt, pAgg, &pAggFuncCond); + } + if (TSDB_CODE_SUCCESS == code && NULL != pGroupKeyCond) { + code = rewriteAggGroupKeyCondForPushDown(pCxt, pAgg, pGroupKeyCond); + } + if (TSDB_CODE_SUCCESS == code && NULL != pGroupKeyCond) { + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0); + code = pushDownCondOptPushCondToChild(pCxt, pChild, &pGroupKeyCond); + } + if (TSDB_CODE_SUCCESS == code) { + OPTIMIZE_FLAG_SET_MASK(pAgg->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE); + pCxt->optimized = true; + } else { + nodesDestroyNode(pGroupKeyCond); + nodesDestroyNode(pAggFuncCond); + } + return code; +} + static int32_t pushDownCondOptimizeImpl(SOptimizeContext* pCxt, SLogicNode* pLogicNode) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pLogicNode)) { @@ -1668,8 +1817,8 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pSelfNode) { SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0); - SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; + SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt); int32_t code = cxt.errCode; From 3a159de7e2cead0584f852dded29bee9ee674f54 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 30 Jun 2022 15:28:03 +0800 Subject: [PATCH 20/68] refactor: assign the committed version --- source/dnode/vnode/src/vnd/vnodeCommit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index dbbe3d3750..02a0783927 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -266,6 +266,8 @@ int vnodeCommit(SVnode *pVnode) { ASSERT(0); return -1; } + + pVnode->state.committed = info.state.committed; // apply the commit (TODO) vnodeBufPoolReset(pVnode->onCommit); From 376bf46a64dd515d7cf043f2d055261f968b0409 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 30 Jun 2022 15:28:23 +0800 Subject: [PATCH 21/68] refactor(sync): add SyncClientRequestBatch --- include/common/tmsgdef.h | 1 + include/libs/sync/sync.h | 1 + include/libs/sync/syncTools.h | 31 ++++++++++++++++++++++++ source/libs/sync/src/syncMain.c | 2 ++ source/libs/sync/src/syncMessage.c | 39 ++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 926d4eb51f..c0c1482828 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -232,6 +232,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SYNC_PING, "sync-ping", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_PING_REPLY, "sync-ping-reply", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_CLIENT_REQUEST, "sync-client-request", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SYNC_CLIENT_REQUEST_BATCH, "sync-client-request-batch", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_CLIENT_REQUEST_REPLY, "sync-client-request-reply", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_REQUEST_VOTE, "sync-request-vote", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_REQUEST_VOTE_REPLY, "sync-request-vote-reply", NULL, NULL) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 5fa7eed40c..dea6d35d4d 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -202,6 +202,7 @@ SyncGroupId syncGetVgId(int64_t rid); void syncGetEpSet(int64_t rid, SEpSet* pEpSet); void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet); int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak); +int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize); bool syncEnvIsStart(); const char* syncStr(ESyncState state); bool syncIsRestoreFinish(int64_t rid); diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 8975f930db..c4ce9b9694 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -219,6 +219,33 @@ void syncClientRequestPrint2(char* s, const SyncClientRequest* pMsg); void syncClientRequestLog(const SyncClientRequest* pMsg); void syncClientRequestLog2(char* s, const SyncClientRequest* pMsg); +// --------------------------------------------- +typedef struct SOffsetAndContLen { + int32_t offset; + int32_t contLen; +} SOffsetAndContLen; + +typedef struct SRaftMeta { + uint64_t seqNum; + bool isWeak; +} SRaftMeta; + +// block1: +// block2: SRaftMeta array +// block3: rpc msg array (with pCont) + +typedef struct SyncClientRequestBatch { + uint32_t bytes; + int32_t vgId; + uint32_t msgType; // SyncClientRequestBatch msgType + uint32_t dataCount; + uint32_t dataLen; // user RpcMsg.contLen + char data[]; // user RpcMsg.pCont +} SyncClientRequestBatch; + +SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMeta* raftArr, int32_t arrSize, + int32_t vgId); + // --------------------------------------------- typedef struct SyncClientRequestReply { uint32_t bytes; @@ -325,10 +352,14 @@ void syncAppendEntriesLog(const SyncAppendEntries* pMsg); void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg); // --------------------------------------------- + +// define ahead +/* typedef struct SOffsetAndContLen { int32_t offset; int32_t contLen; } SOffsetAndContLen; +*/ typedef struct SyncAppendEntriesBatch { uint32_t bytes; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index d32153e5ed..c065f74663 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -627,6 +627,8 @@ int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) { return ret; } +int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize) { return 0; } + int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { int32_t ret = 0; diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index acece6d48a..38ecb5c9d1 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -956,6 +956,45 @@ void syncClientRequestLog2(char* s, const SyncClientRequest* pMsg) { } } +// ---- message process SyncClientRequestBatch---- + +// block1: +// block2: SRaftMeta array +// block3: rpc msg array (with pCont) + +SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMeta* raftArr, int32_t arrSize, + int32_t vgId) { + ASSERT(rpcMsgArr != NULL); + ASSERT(arrSize > 0); + + int32_t dataLen = 0; + int32_t raftMetaArrayLen = sizeof(SRpcMsg) * arrSize; + int32_t rpcArrayLen = sizeof(SRaftMeta) * arrSize; + + uint32_t bytes = sizeof(SyncClientRequestBatch) + dataLen; + SyncClientRequestBatch* pMsg = taosMemoryMalloc(bytes); + memset(pMsg, 0, bytes); + pMsg->bytes = bytes; + pMsg->vgId = vgId; + pMsg->msgType = TDMT_SYNC_CLIENT_REQUEST_BATCH; + pMsg->dataCount = arrSize; + pMsg->dataLen = dataLen; + + SRaftMeta* raftMetaArr = (SRaftMeta*)(pMsg->data); + SRpcMsg* msgArr = (SRpcMsg*)((char*)(pMsg->data) + raftMetaArrayLen); + + for (int i = 0; i < arrSize; ++i) { + // init raftMetaArr + raftMetaArr[i].isWeak = raftArr[i].isWeak; + raftMetaArr[i].seqNum = raftArr[i].seqNum; + + // init msgArr + msgArr[i] = rpcMsgArr[i]; + } + + return pMsg; +} + // ---- message process SyncRequestVote---- SyncRequestVote* syncRequestVoteBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncRequestVote); From 4b73cdb529fc68260475cbdf4a6395ab3b8c4c5d Mon Sep 17 00:00:00 2001 From: cpwu Date: Thu, 30 Jun 2022 15:34:38 +0800 Subject: [PATCH 22/68] fix case --- tests/pytest/util/common.py | 53 ++++++++++++++--------- tests/pytest/util/constant.py | 28 ++++++++++++ tests/pytest/util/sql.py | 42 +++++++++++++++++- tests/system-test/2-query/explain.py | 32 -------------- tests/system-test/2-query/hyperloglog.py | 37 ++-------------- tests/system-test/2-query/leastsquares.py | 32 -------------- tests/system-test/2-query/spread.py | 32 -------------- 7 files changed, 105 insertions(+), 151 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 6caf5624a4..998e0248ab 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -17,6 +17,7 @@ import string import requests import time import socket +import json from .boundary import DataBoundary import taos from util.log import * @@ -25,7 +26,7 @@ from util.cases import * from util.dnodes import * from util.common import * -class TDCom: +class TDCom: def __init__(self): self.sml_type = None self.env_setting = None @@ -206,12 +207,12 @@ class TDCom: """ generate long name mode could be numbers/letters/letters_mixed/mixed - """ - if mode == "numbers": + """ + if mode == "numbers": chars = ''.join(random.choice(string.digits) for i in range(len)) - elif mode == "letters": + elif mode == "letters": chars = ''.join(random.choice(string.ascii_letters.lower()) for i in range(len)) - elif mode == "letters_mixed": + elif mode == "letters_mixed": chars = ''.join(random.choice(string.ascii_letters.upper() + string.ascii_letters.lower()) for i in range(len)) else: chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len)) @@ -276,7 +277,7 @@ class TDCom: vgroups replica precision strict wal fsync comp cachelast single_stable buffer pagesize pages minrows maxrows duration keep retentions ''' sqlString = f'create database if not exists {dbName} ' - + dbParams = "" if len(kwargs) > 0: for param, value in kwargs.items(): @@ -306,7 +307,7 @@ class TDCom: # return # def create_ctables(self,tsql, dbName,stbName,ctbNum,tagDict): - # tsql.execute("use %s" %dbName) + # tsql.execute("use %s" %dbName) # tagsValues = '' # for i in range(tagDict['int']): # if i > 0: @@ -323,7 +324,7 @@ class TDCom: # sql = pre_create # if sql != pre_create: # tsql.execute(sql) - + # tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName)) # return @@ -352,7 +353,7 @@ class TDCom: # tsql.execute(sql) # tdLog.debug("insert data ............ [OK]") # return - + def getBuildPath(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -367,7 +368,7 @@ class TDCom: if ("packaging" not in rootRealPath): buildPath = root[:len(root) - len("/build/bin")] break - return buildPath + return buildPath def getClientCfgPath(self): buildPath = self.getBuildPath() @@ -398,7 +399,7 @@ class TDCom: return newTdSql ################################################################################################################ - # port from the common.py of new test frame + # port from the common.py of new test frame ################################################################################################################ def gen_default_tag_str(self): default_tag_str = "" @@ -527,9 +528,9 @@ class TDCom: tag_value_list.append(self.gen_random_type_value(tag_elm["type"], "", "", "", "")) else: continue - return tag_value_list + return tag_value_list - def gen_column_value_list(self, column_elm_list, ts_value=None): + def gen_column_value_list(self, column_elm_list, ts_value=None): if ts_value is None: ts_value = self.genTs()[0] @@ -554,7 +555,7 @@ class TDCom: return column_value_list def create_stable(self, tsql, dbname=None, stbname="stb", column_elm_list=None, tag_elm_list=None, - count=1, default_stbname_prefix="stb", **kwargs): + count=1, default_stbname_prefix="stb", **kwargs): colname_prefix = 'c' tagname_prefix = 't' stbname_index_start_num = 1 @@ -589,20 +590,20 @@ class TDCom: tag_value_str += f'"{tag_value}", ' else: tag_value_str += f'{tag_value}, ' - tag_value_str = tag_value_str.rstrip()[:-1] - + tag_value_str = tag_value_str.rstrip()[:-1] + if int(count) <= 1: create_ctable_sql = f'create table {dbname}.{default_ctbname_prefix}{ctbname_index_start_num} using {dbname}.{stbname} tags ({tag_value_str}) {ctb_params};' tsql.execute(create_ctable_sql) else: for _ in range(count): create_ctable_sql = f'create table {dbname}.{default_ctbname_prefix}{ctbname_index_start_num} using {dbname}.{stbname} tags ({tag_value_str}) {ctb_params};' - ctbname_index_start_num += 1 + ctbname_index_start_num += 1 tdLog.info("create ctb sql: %s"%create_ctable_sql) tsql.execute(create_ctable_sql) - + def create_table(self, tsql, dbname=None, tbname="ntb", column_elm_list=None, count=1, **kwargs): - tbname_index_start_num = 1 + tbname_index_start_num = 1 tbname_prefix="ntb" tb_params = "" @@ -632,7 +633,7 @@ class TDCom: column_value_str += f'"{column_value}", ' else: column_value_str += f'{column_value}, ' - column_value_str = column_value_str.rstrip()[:-1] + column_value_str = column_value_str.rstrip()[:-1] if int(count) <= 1: insert_sql = f'insert into {self.tb_name} values ({column_value_str});' tsql.execute(insert_sql) @@ -651,4 +652,16 @@ class TDCom: return res_list else: tdLog.exit(f"getOneRow out of range: row_index={location} row_count={self.query_row}") + + +def is_json(msg): + if isinstance(msg, str): + try: + json.loads(msg) + return True + except: + return False + else: + return False + tdCom = TDCom() diff --git a/tests/pytest/util/constant.py b/tests/pytest/util/constant.py index 5be1c603b3..83487da023 100644 --- a/tests/pytest/util/constant.py +++ b/tests/pytest/util/constant.py @@ -71,6 +71,34 @@ TAOS_KEYWORDS = [ "COPY", "IF", "NOW", "STABLES", "WHERE", ] +NUM_FUNC = [ + "ABS", "ACOS", "ASIN", "ATAN", "CEIL", "COS", "FLOOR", "LOG", "POW", "ROUND", "SIN", "SQRT", "TAN", +] + +STR_FUNC = [ + "CHAR_LENGTH", "CONCAT", "CONCAT_WS", "LENGTH", "LOWER","LTRIM", "RTRIM", "SUBSTR", "UPPER", +] + +CONVER_FUNC = ["CASR", "TO_ISO8601", "TO_JSON", "TP_UNIXTIMESTAMP"] + +SELECT_FUNC = [ + "APERCENTILE", "BOTTOM", "FIRST", "INTERP", "LAST", "MAX", "MIN", "PERCENTILE", "TAIL", "TOP", "UNIQUE", +] + +AGG_FUNC = [ + "AVG", "COUNT", "ELAPSED", "LEASTSQUARES", "MODE", "SPREAD", "STDDEV", "SUM", "HYPERLOGLOG", "HISTOGRAM", +] + +TS_FUNC = [ + "CSUM", "DERIVATIVE", "DIFF", "IRATE", "MAVG", "SAMPLE", "STATECOUNT", "STATEDURATION", "TWA" +] + +SYSINFO_FUCN = [ + "DATABASE", "CLIENT_VERSION", "SERVER_VERSION", "SERVER_STATUS", "CURRENT_USER", "USER" +] + + + # basic data type boundary TINYINT_MAX = 127 TINYINT_MIN = -128 diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index fe802dd9a3..585594e035 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -96,6 +96,15 @@ class TDSql: return self.queryResult return self.queryRows + def is_err_sql(self, sql): + err_flag = True + try: + self.cursor.execute(sql) + except BaseException: + err_flag = False + + return False if err_flag else True + def getVariable(self, search_attr): ''' get variable of search_attr access "show variables" @@ -249,7 +258,6 @@ class TDSql: raise Exception(repr(e)) return self.queryResult - def executeTimes(self, sql, times): for i in range(times): try: @@ -336,6 +344,38 @@ class TDSql: elif precision == "ns": return int(times*1000*1000) + def get_type(self, col): + if self.cursor.istype(col, "BOOL"): + return "BOOL" + if self.cursor.istype(col, "INT"): + return "INT" + if self.cursor.istype(col, "BIGINT"): + return "BIGINT" + if self.cursor.istype(col, "TINYINT"): + return "TINYINT" + if self.cursor.istype(col, "SMALLINT"): + return "SMALLINT" + if self.cursor.istype(col, "FLOAT"): + return "FLOAT" + if self.cursor.istype(col, "DOUBLE"): + return "DOUBLE" + if self.cursor.istype(col, "BINARY"): + return "BINARY" + if self.cursor.istype(col, "NCHAR"): + return "NCHAR" + if self.cursor.istype(col, "TIMESTAMP"): + return "TIMESTAMP" + if self.cursor.istype(col, "JSON"): + return "JSON" + if self.cursor.istype(col, "TINYINT UNSIGNED"): + return "TINYINT UNSIGNED" + if self.cursor.istype(col, "SMALLINT UNSIGNED"): + return "SMALLINT UNSIGNED" + if self.cursor.istype(col, "INT UNSIGNED"): + return "INT UNSIGNED" + if self.cursor.istype(col, "BIGINT UNSIGNED"): + return "BIGINT UNSIGNED" + def taosdStatus(self, state): tdLog.sleep(5) pstate = 0 diff --git a/tests/system-test/2-query/explain.py b/tests/system-test/2-query/explain.py index d440144841..f2c6cb7771 100644 --- a/tests/system-test/2-query/explain.py +++ b/tests/system-test/2-query/explain.py @@ -163,38 +163,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def explain_check(self): sqls = self.sql_list() tdLog.printNoPrefix("===step 1: curent case, must return query OK") diff --git a/tests/system-test/2-query/hyperloglog.py b/tests/system-test/2-query/hyperloglog.py index 8dd6bd2dda..6ab971173a 100644 --- a/tests/system-test/2-query/hyperloglog.py +++ b/tests/system-test/2-query/hyperloglog.py @@ -116,37 +116,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" def hyperloglog_check(self): sqls = self.sql_list() @@ -228,10 +197,10 @@ class TDTestCase: tag_sql += f"{k} {v}," tdSql.execute(f'create table if not exists {stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})') - def __insert_data(self): + def __insert_data(self): pass - + def __hyperloglog_check_distribute(self): dbname = "dbtest" stbname = "stb" @@ -286,7 +255,7 @@ class TDTestCase: tdSql.query(f"select hyperloglog({k}) from {stbname} group by {k}") tdSql.execute(f'drop database {dbname}') - + def __insert_data(self, rows): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) diff --git a/tests/system-test/2-query/leastsquares.py b/tests/system-test/2-query/leastsquares.py index e8fa32e8b3..3bab509942 100644 --- a/tests/system-test/2-query/leastsquares.py +++ b/tests/system-test/2-query/leastsquares.py @@ -195,38 +195,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, current_sqls)), list(filter(None, err_sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def leastsquares_check(self): current_sqls, err_sqls = self.sql_list() for i in range(len(err_sqls)): diff --git a/tests/system-test/2-query/spread.py b/tests/system-test/2-query/spread.py index d2dbbd03ed..51c569e565 100644 --- a/tests/system-test/2-query/spread.py +++ b/tests/system-test/2-query/spread.py @@ -159,38 +159,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def spread_check(self): sqls = self.sql_list() tdLog.printNoPrefix("===step 1: curent case, must return query OK") From 8dece648e391966a99112c8c39bc887f0dcce9af Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 30 Jun 2022 14:48:57 +0800 Subject: [PATCH 23/68] feat(tmq): enable withTbName config for snapshot --- source/dnode/vnode/src/tq/tqExec.c | 10 ++++++---- source/dnode/vnode/src/tsdb/tsdbRead.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index ac6cc2e411..9cdc3171f5 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -85,10 +85,12 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S tqAddBlockDataToRsp(pDataBlock, pRsp); if (pRsp->withTbName) { - // TODO - pRsp->withTbName = 0; - /*int64_t uid = 0;*/ - /*tqAddTbNameToRsp(pTq, uid, pRsp, workerId);*/ + int64_t uid; + int64_t ts; + if (qGetStreamScanStatus(task, &uid, &ts) < 0) { + ASSERT(0); + } + tqAddTbNameToRsp(pTq, uid, pRsp, workerId); } pRsp->blockNum++; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index e182add5d6..4604e3699f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -532,9 +532,9 @@ int32_t tsdbSetTableList(tsdbReaderT reader, SArray* tableList) { tsdbReaderT tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* tableList, uint64_t qId, uint64_t taskId) { - /*if (taosArrayGetSize(tableList) == 0) {*/ - /*return NULL;*/ - /*}*/ + if (taosArrayGetSize(tableList) == 0) { + return NULL; + } STsdbReadHandle* pTsdbReadHandle = tsdbQueryTablesImpl(pVnode, pCond, qId, taskId); if (pTsdbReadHandle == NULL) { return NULL; From 7ef4d3f03a1f6a034a66812b5cab9db0e44db5d4 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 30 Jun 2022 15:39:30 +0800 Subject: [PATCH 24/68] fix: fix null as tag value issue --- source/libs/parser/src/parTranslater.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 521c733ceb..6dc14dbf15 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -783,6 +783,12 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD if (pVal->placeholderNo > 0 || pVal->isNull) { return DEAL_RES_CONTINUE; } + if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { + // TODO + //pVal->node.resType = targetDt; + pVal->isNull = true; + return DEAL_RES_CONTINUE; + } if (pVal->isDuration) { if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, precision) != TSDB_CODE_SUCCESS) { @@ -5335,7 +5341,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau if (code != TSDB_CODE_SUCCESS) { goto end; } - } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { + } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { char* tmpVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; if (IS_VAR_DATA_TYPE(pTagSchema->type)) { From 4fc1a6faecc52a76a46eb667690e6c632783539d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 30 Jun 2022 15:59:42 +0800 Subject: [PATCH 25/68] fix connect error --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 4ec54beebf..d03f0fd903 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -400,7 +400,7 @@ void cliHandleExcept(SCliConn* pConn) { STransConnCtx* pCtx = pMsg ? pMsg->ctx : NULL; STransMsg transMsg = {0}; - transMsg.code = TSDB_CODE_RPC_BROKEN_LINK; + transMsg.code = pConn->broken ? TSDB_CODE_RPC_BROKEN_LINK : TSDB_CODE_RPC_NETWORK_UNAVAIL; transMsg.msgType = pMsg ? pMsg->msg.msgType + 1 : 0; transMsg.info.ahandle = NULL; From 1530b339919b168bed05c6ce5c1614f96ec6eb01 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 30 Jun 2022 16:16:05 +0800 Subject: [PATCH 26/68] feat: support 'select *, expr from ...' syntax --- include/common/tmsg.h | 1 + include/common/ttokendef.h | 148 +- include/libs/nodes/cmdnodes.h | 1 + include/libs/nodes/plannodes.h | 10 +- include/libs/planner/planner.h | 1 + source/common/src/tmsg.c | 3 +- source/libs/executor/src/scanoperator.c | 2 +- source/libs/nodes/src/nodesCloneFuncs.c | 11 +- source/libs/nodes/src/nodesCodeFuncs.c | 49 +- source/libs/parser/inc/sql.y | 1 + source/libs/parser/src/parTokenizer.c | 3 +- source/libs/parser/src/parTranslater.c | 16 + source/libs/parser/src/sql.c | 4799 ++++++++++--------- source/libs/parser/test/parInitialCTest.cpp | 38 +- source/libs/planner/src/planLogicCreater.c | 5 +- source/libs/planner/src/planOptimizer.c | 3 +- source/libs/planner/src/planPhysiCreater.c | 5 +- 17 files changed, 2556 insertions(+), 2540 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 71867d9741..aefbf0bf1c 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1623,6 +1623,7 @@ typedef struct { int8_t triggerType; int64_t maxDelay; int64_t watermark; + int8_t igExpired; } SCMCreateStreamReq; typedef struct { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index f5e068693e..bd73e04746 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -192,79 +192,81 @@ #define TK_TRIGGER 174 #define TK_AT_ONCE 175 #define TK_WINDOW_CLOSE 176 -#define TK_KILL 177 -#define TK_CONNECTION 178 -#define TK_TRANSACTION 179 -#define TK_BALANCE 180 -#define TK_VGROUP 181 -#define TK_MERGE 182 -#define TK_REDISTRIBUTE 183 -#define TK_SPLIT 184 -#define TK_SYNCDB 185 -#define TK_DELETE 186 -#define TK_NULL 187 -#define TK_NK_QUESTION 188 -#define TK_NK_ARROW 189 -#define TK_ROWTS 190 -#define TK_TBNAME 191 -#define TK_QSTARTTS 192 -#define TK_QENDTS 193 -#define TK_WSTARTTS 194 -#define TK_WENDTS 195 -#define TK_WDURATION 196 -#define TK_CAST 197 -#define TK_NOW 198 -#define TK_TODAY 199 -#define TK_TIMEZONE 200 -#define TK_CLIENT_VERSION 201 -#define TK_SERVER_VERSION 202 -#define TK_SERVER_STATUS 203 -#define TK_CURRENT_USER 204 -#define TK_COUNT 205 -#define TK_LAST_ROW 206 -#define TK_BETWEEN 207 -#define TK_IS 208 -#define TK_NK_LT 209 -#define TK_NK_GT 210 -#define TK_NK_LE 211 -#define TK_NK_GE 212 -#define TK_NK_NE 213 -#define TK_MATCH 214 -#define TK_NMATCH 215 -#define TK_CONTAINS 216 -#define TK_JOIN 217 -#define TK_INNER 218 -#define TK_SELECT 219 -#define TK_DISTINCT 220 -#define TK_WHERE 221 -#define TK_PARTITION 222 -#define TK_BY 223 -#define TK_SESSION 224 -#define TK_STATE_WINDOW 225 -#define TK_SLIDING 226 -#define TK_FILL 227 -#define TK_VALUE 228 -#define TK_NONE 229 -#define TK_PREV 230 -#define TK_LINEAR 231 -#define TK_NEXT 232 -#define TK_HAVING 233 -#define TK_RANGE 234 -#define TK_EVERY 235 -#define TK_ORDER 236 -#define TK_SLIMIT 237 -#define TK_SOFFSET 238 -#define TK_LIMIT 239 -#define TK_OFFSET 240 -#define TK_ASC 241 -#define TK_NULLS 242 -#define TK_ID 243 -#define TK_NK_BITNOT 244 -#define TK_INSERT 245 -#define TK_VALUES 246 -#define TK_IMPORT 247 -#define TK_NK_SEMI 248 -#define TK_FILE 249 +#define TK_IGNORE 177 +#define TK_EXPIRED 178 +#define TK_KILL 179 +#define TK_CONNECTION 180 +#define TK_TRANSACTION 181 +#define TK_BALANCE 182 +#define TK_VGROUP 183 +#define TK_MERGE 184 +#define TK_REDISTRIBUTE 185 +#define TK_SPLIT 186 +#define TK_SYNCDB 187 +#define TK_DELETE 188 +#define TK_NULL 189 +#define TK_NK_QUESTION 190 +#define TK_NK_ARROW 191 +#define TK_ROWTS 192 +#define TK_TBNAME 193 +#define TK_QSTARTTS 194 +#define TK_QENDTS 195 +#define TK_WSTARTTS 196 +#define TK_WENDTS 197 +#define TK_WDURATION 198 +#define TK_CAST 199 +#define TK_NOW 200 +#define TK_TODAY 201 +#define TK_TIMEZONE 202 +#define TK_CLIENT_VERSION 203 +#define TK_SERVER_VERSION 204 +#define TK_SERVER_STATUS 205 +#define TK_CURRENT_USER 206 +#define TK_COUNT 207 +#define TK_LAST_ROW 208 +#define TK_BETWEEN 209 +#define TK_IS 210 +#define TK_NK_LT 211 +#define TK_NK_GT 212 +#define TK_NK_LE 213 +#define TK_NK_GE 214 +#define TK_NK_NE 215 +#define TK_MATCH 216 +#define TK_NMATCH 217 +#define TK_CONTAINS 218 +#define TK_JOIN 219 +#define TK_INNER 220 +#define TK_SELECT 221 +#define TK_DISTINCT 222 +#define TK_WHERE 223 +#define TK_PARTITION 224 +#define TK_BY 225 +#define TK_SESSION 226 +#define TK_STATE_WINDOW 227 +#define TK_SLIDING 228 +#define TK_FILL 229 +#define TK_VALUE 230 +#define TK_NONE 231 +#define TK_PREV 232 +#define TK_LINEAR 233 +#define TK_NEXT 234 +#define TK_HAVING 235 +#define TK_RANGE 236 +#define TK_EVERY 237 +#define TK_ORDER 238 +#define TK_SLIMIT 239 +#define TK_SOFFSET 240 +#define TK_LIMIT 241 +#define TK_OFFSET 242 +#define TK_ASC 243 +#define TK_NULLS 244 +#define TK_ID 245 +#define TK_NK_BITNOT 246 +#define TK_INSERT 247 +#define TK_VALUES 248 +#define TK_IMPORT 249 +#define TK_NK_SEMI 250 +#define TK_FILE 251 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e473daad8d..134cd80487 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -338,6 +338,7 @@ typedef struct SStreamOptions { int8_t triggerType; SNode* pDelay; SNode* pWatermark; + bool ignoreExpired; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index f8d79a863f..1f9c66ccc3 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -73,8 +73,7 @@ typedef struct SScanLogicNode { SNode* pTagIndexCond; int8_t triggerType; int64_t watermark; - int16_t tsColId; - double filesFactor; + int8_t igExpired; SArray* pSmaIndexes; SNodeList* pGroupTags; bool groupSort; @@ -175,7 +174,7 @@ typedef struct SWindowLogicNode { SNode* pStateExpr; int8_t triggerType; int64_t watermark; - double filesFactor; + int8_t igExpired; EWindowAlgorithm windowAlgo; } SWindowLogicNode; @@ -296,8 +295,7 @@ typedef struct STableScanPhysiNode { int8_t slidingUnit; int8_t triggerType; int64_t watermark; - int16_t tsColId; - double filesFactor; + int8_t igExpired; } STableScanPhysiNode; typedef STableScanPhysiNode STableSeqScanPhysiNode; @@ -373,7 +371,7 @@ typedef struct SWinodwPhysiNode { SNode* pTsEnd; // window end timestamp int8_t triggerType; int64_t watermark; - double filesFactor; + int8_t igExpired; } SWinodwPhysiNode; typedef struct SIntervalPhysiNode { diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index b4c75da131..d1a5c5db10 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -34,6 +34,7 @@ typedef struct SPlanContext { bool showRewrite; int8_t triggerType; int64_t watermark; + int8_t igExpired; char* pMsg; int32_t msgLen; const char* pUser; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 78eccdf0cd..807d102eef 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4641,6 +4641,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1; if (tEncodeI64(&encoder, pReq->maxDelay) < 0) return -1; if (tEncodeI64(&encoder, pReq->watermark) < 0) return -1; + if (tEncodeI8(&encoder, pReq->igExpired) < 0) return -1; if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1; if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1; @@ -4668,6 +4669,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1; if (tDecodeI64(&decoder, &pReq->maxDelay) < 0) return -1; if (tDecodeI64(&decoder, &pReq->watermark) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->igExpired) < 0) return -1; if (sqlLen > 0) { pReq->sql = taosMemoryCalloc(1, sqlLen + 1); @@ -5502,4 +5504,3 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } return 0; } - diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ca4afdeb7f..34e5ad1bca 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1188,7 +1188,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys int16_t colId = id->colId; taosArrayPush(pColIds, &colId); - if (id->colId == pTableScanNode->tsColId) { + if (id->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { pInfo->primaryTsIndex = id->targetSlotId; } } diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index b372bf75fc..60d52f89a7 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -350,9 +350,9 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) { CLONE_NODE_FIELD(pTagIndexCond); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(tsColId); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); CLONE_NODE_LIST_FIELD(pGroupTags); + COPY_SCALAR_FIELD(groupSort); return TSDB_CODE_SUCCESS; } @@ -421,7 +421,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p CLONE_NODE_FIELD(pStateExpr); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); COPY_SCALAR_FIELD(windowAlgo); return TSDB_CODE_SUCCESS; } @@ -511,8 +511,7 @@ static int32_t physiTableScanCopy(const STableScanPhysiNode* pSrc, STableScanPhy COPY_SCALAR_FIELD(slidingUnit); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(tsColId); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); return TSDB_CODE_SUCCESS; } @@ -532,7 +531,7 @@ static int32_t physiWindowCopy(const SWinodwPhysiNode* pSrc, SWinodwPhysiNode* p CLONE_NODE_FIELD(pTsEnd); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index df7429bd88..dc293bf6c1 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1426,12 +1426,11 @@ static const char* jkTableScanPhysiPlanDynamicScanFuncs = "DynamicScanFuncs"; static const char* jkTableScanPhysiPlanInterval = "Interval"; static const char* jkTableScanPhysiPlanOffset = "Offset"; static const char* jkTableScanPhysiPlanSliding = "Sliding"; -static const char* jkTableScanPhysiPlanIntervalUnit = "intervalUnit"; -static const char* jkTableScanPhysiPlanSlidingUnit = "slidingUnit"; -static const char* jkTableScanPhysiPlanTriggerType = "triggerType"; -static const char* jkTableScanPhysiPlanWatermark = "watermark"; -static const char* jkTableScanPhysiPlanTsColId = "tsColId"; -static const char* jkTableScanPhysiPlanFilesFactor = "FilesFactor"; +static const char* jkTableScanPhysiPlanIntervalUnit = "IntervalUnit"; +static const char* jkTableScanPhysiPlanSlidingUnit = "SlidingUnit"; +static const char* jkTableScanPhysiPlanTriggerType = "TriggerType"; +static const char* jkTableScanPhysiPlanWatermark = "Watermark"; +static const char* jkTableScanPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkTableScanPhysiPlanGroupTags = "GroupTags"; static const char* jkTableScanPhysiPlanGroupSort = "GroupSort"; @@ -1482,10 +1481,7 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanWatermark, pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId); - } - if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddDoubleToObject(pJson, jkTableScanPhysiPlanFilesFactor, pNode->filesFactor); + code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanIgnoreExpired, pNode->igExpired); } if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkTableScanPhysiPlanGroupTags, pNode->pGroupTags); @@ -1517,37 +1513,34 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) { code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanRatio, &pNode->ratio); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanDataRequired, pNode->dataRequired, code); + code = tjsonGetIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->dataRequired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanDynamicScanFuncs, &pNode->pDynamicScanFuncs); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanInterval, pNode->interval, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->interval); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanOffset, pNode->offset, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->offset); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanSliding, pNode->sliding, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->sliding); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanIntervalUnit, pNode->intervalUnit, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->intervalUnit); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanSlidingUnit, pNode->slidingUnit, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->slidingUnit); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanTriggerType, pNode->triggerType, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanWatermark, pNode->watermark, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId, code); - } - if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanFilesFactor, &pNode->filesFactor); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->igExpired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanGroupTags, &pNode->pGroupTags); @@ -1826,7 +1819,7 @@ static const char* jkWindowPhysiPlanTsPk = "TsPk"; static const char* jkWindowPhysiPlanTsEnd = "TsEnd"; static const char* jkWindowPhysiPlanTriggerType = "TriggerType"; static const char* jkWindowPhysiPlanWatermark = "Watermark"; -static const char* jkWindowPhysiPlanFilesFactor = "FilesFactor"; +static const char* JKWINDOWPHYSIPLANIGNOREEXPIRED = "IgnoreExpired"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj; @@ -1851,7 +1844,7 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanWatermark, pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddDoubleToObject(pJson, jkWindowPhysiPlanFilesFactor, pNode->filesFactor); + code = tjsonAddIntegerToObject(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, pNode->igExpired); } return code; @@ -1874,15 +1867,13 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { code = jsonToNodeObject(pJson, jkWindowPhysiPlanTsEnd, (SNode**)&pNode->pTsEnd); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkWindowPhysiPlanTriggerType, pNode->triggerType, code); - ; + code = tjsonGetTinyIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkWindowPhysiPlanWatermark, pNode->watermark, code); - ; + code = tjsonGetBigIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetDoubleValue(pJson, jkWindowPhysiPlanFilesFactor, &pNode->filesFactor); + code = tjsonGetTinyIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->igExpired); } return code; diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 08b817dbed..2e58cc56b8 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -488,6 +488,7 @@ stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } +stream_options(A) ::= stream_options(B) IGNORE EXPIRED. { ((SStreamOptions*)B)->ignoreExpired = true; A = B; } /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 3b2ad84235..6736fea635 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -84,6 +84,7 @@ static SKeyword keywordTable[] = { {"DURATION", TK_DURATION}, {"ENABLE", TK_ENABLE}, {"EXISTS", TK_EXISTS}, + {"EXPIRED", TK_EXPIRED}, {"EXPLAIN", TK_EXPLAIN}, {"EVERY", TK_EVERY}, {"FILE", TK_FILE}, @@ -99,6 +100,7 @@ static SKeyword keywordTable[] = { {"GROUP", TK_GROUP}, {"HAVING", TK_HAVING}, {"IF", TK_IF}, + {"IGNORE", TK_IGNORE}, {"IMPORT", TK_IMPORT}, {"IN", TK_IN}, {"INDEX", TK_INDEX}, @@ -290,7 +292,6 @@ static SKeyword keywordTable[] = { // {"END", TK_END}, // {"FAIL", TK_FAIL}, // {"FOR", TK_FOR}, - // {"IGNORE", TK_IGNORE}, // {"IMMEDIATE", TK_IMMEDIATE}, // {"INITIALLY", TK_INITIALLY}, // {"INSTEAD", TK_INSTEAD}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 985fa6c9ae..21a3fde65b 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4208,6 +4208,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->triggerType = pStmt->pOptions->triggerType; pReq->maxDelay = (NULL != pStmt->pOptions->pDelay ? ((SValueNode*)pStmt->pOptions->pDelay)->datum.i : 0); pReq->watermark = (NULL != pStmt->pOptions->pWatermark ? ((SValueNode*)pStmt->pOptions->pWatermark)->datum.i : 0); + pReq->igExpired = pStmt->pOptions->ignoreExpired; } return code; @@ -4798,6 +4799,15 @@ static const char* getSysTableName(ENodeType type) { return NULL; } +static SNode* createStarCol() { + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pCol) { + return NULL; + } + strcpy(pCol->colName, "*"); + return (SNode*)pCol; +} + static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, SSelectStmt** pStmt) { SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); if (NULL == pSelect) { @@ -4815,6 +4825,11 @@ static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, SSele strcpy(pRealTable->table.tableAlias, pTable); pSelect->pFromTable = (SNode*)pRealTable; + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSelect->pProjectionList, createStarCol())) { + nodesDestroyNode((SNode*)pSelect); + return TSDB_CODE_OUT_OF_MEMORY; + } + *pStmt = pSelect; return TSDB_CODE_SUCCESS; @@ -4963,6 +4978,7 @@ static int32_t rewriteShowTableDist(STranslateContext* pCxt, SQuery* pQuery) { SSelectStmt* pStmt = NULL; int32_t code = createSelectStmtForShowTableDist((SShowTableDistributedStmt*)pQuery->pRoot, &pStmt); if (TSDB_CODE_SUCCESS == code) { + NODES_DESTORY_LIST(pStmt->pProjectionList); code = nodesListMakeStrictAppend(&pStmt->pProjectionList, createBlockDistFunc()); } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 6b71a50ac0..e4317d97b0 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 373 +#define YYNOCODE 375 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SToken yy7; - int32_t yy20; - EJoinType yy54; - int8_t yy57; - SAlterOption yy139; - SNode* yy184; - int64_t yy193; - SNodeList* yy296; - SDataType yy332; - EOrder yy394; - bool yy419; - EOperatorType yy496; - EFillMode yy540; - ENullOrder yy627; + SDataType yy34; + EJoinType yy162; + EOrder yy188; + SNode* yy212; + SAlterOption yy245; + EOperatorType yy290; + EFillMode yy294; + SToken yy329; + SNodeList* yy424; + ENullOrder yy607; + int64_t yy609; + int32_t yy610; + int8_t yy653; + bool yy737; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 652 -#define YYNRULE 482 -#define YYNTOKEN 250 -#define YY_MAX_SHIFT 651 -#define YY_MIN_SHIFTREDUCE 952 -#define YY_MAX_SHIFTREDUCE 1433 -#define YY_ERROR_ACTION 1434 -#define YY_ACCEPT_ACTION 1435 -#define YY_NO_ACTION 1436 -#define YY_MIN_REDUCE 1437 -#define YY_MAX_REDUCE 1918 +#define YYNSTATE 653 +#define YYNRULE 483 +#define YYNTOKEN 252 +#define YY_MAX_SHIFT 652 +#define YY_MIN_SHIFTREDUCE 954 +#define YY_MAX_SHIFTREDUCE 1436 +#define YY_ERROR_ACTION 1437 +#define YY_ACCEPT_ACTION 1438 +#define YY_NO_ACTION 1439 +#define YY_MIN_REDUCE 1440 +#define YY_MAX_REDUCE 1922 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,682 +216,677 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2447) +#define YY_ACTTAB_COUNT (2471) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 422, 1671, 423, 1472, 151, 1740, 1435, 430, 317, 423, - /* 10 */ 1472, 1370, 39, 37, 1502, 338, 1737, 1610, 1616, 1618, - /* 20 */ 326, 1438, 1235, 1740, 1896, 1562, 334, 525, 373, 379, - /* 30 */ 1260, 565, 1771, 1310, 1737, 1233, 1737, 1895, 30, 240, - /* 40 */ 518, 1893, 101, 1733, 1739, 100, 99, 98, 97, 96, - /* 50 */ 95, 94, 93, 92, 569, 119, 1305, 985, 1753, 14, - /* 60 */ 61, 1733, 1739, 1733, 1739, 1241, 296, 343, 1896, 39, - /* 70 */ 37, 1373, 569, 439, 569, 474, 473, 326, 517, 1235, - /* 80 */ 472, 157, 1, 116, 469, 1893, 1771, 468, 467, 466, - /* 90 */ 1310, 1002, 1233, 1001, 528, 117, 1377, 989, 990, 1723, - /* 100 */ 330, 548, 1259, 140, 648, 1449, 458, 1896, 138, 527, - /* 110 */ 153, 1838, 1839, 1305, 1843, 210, 14, 1573, 1312, 1313, - /* 120 */ 157, 1003, 1241, 1437, 1893, 1617, 1618, 1784, 1134, 1135, - /* 130 */ 88, 1754, 551, 1756, 1757, 547, 427, 569, 60, 2, - /* 140 */ 1830, 60, 1257, 73, 319, 1826, 152, 110, 109, 108, - /* 150 */ 107, 106, 105, 104, 103, 102, 141, 78, 156, 1054, - /* 160 */ 1528, 648, 1499, 1236, 519, 1234, 1856, 40, 38, 36, - /* 170 */ 35, 34, 474, 473, 1260, 1312, 1313, 472, 1564, 421, - /* 180 */ 116, 469, 425, 203, 468, 467, 466, 1239, 1240, 1056, - /* 190 */ 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, 1303, - /* 200 */ 1304, 1306, 1307, 1308, 1309, 1311, 1314, 565, 33, 32, - /* 210 */ 552, 1320, 40, 38, 36, 35, 34, 1259, 329, 160, - /* 220 */ 1236, 1668, 1234, 625, 624, 623, 341, 1369, 622, 621, - /* 230 */ 620, 121, 615, 614, 613, 612, 611, 610, 609, 608, - /* 240 */ 131, 604, 71, 304, 1239, 1240, 7, 1288, 1289, 1291, - /* 250 */ 1292, 1293, 1294, 1295, 544, 567, 1303, 1304, 1306, 1307, - /* 260 */ 1308, 1309, 1311, 1314, 39, 37, 1896, 60, 565, 42, - /* 270 */ 1623, 1394, 326, 1290, 1235, 160, 1259, 331, 160, 158, - /* 280 */ 412, 167, 607, 1893, 1543, 1310, 1621, 1233, 1092, 592, - /* 290 */ 591, 590, 1096, 589, 1098, 1099, 588, 1101, 585, 603, - /* 300 */ 1107, 582, 1109, 1110, 579, 576, 67, 1896, 1305, 66, - /* 310 */ 310, 14, 511, 1392, 1393, 1395, 1396, 1241, 601, 1235, - /* 320 */ 1894, 39, 37, 1753, 1893, 566, 171, 170, 60, 326, - /* 330 */ 43, 1235, 1233, 488, 2, 1549, 111, 129, 128, 598, - /* 340 */ 597, 596, 1310, 460, 1233, 1261, 486, 372, 484, 371, - /* 350 */ 1241, 1771, 1002, 1571, 1001, 1430, 648, 364, 311, 549, - /* 360 */ 309, 308, 1241, 462, 1723, 1305, 548, 464, 471, 470, - /* 370 */ 1312, 1313, 429, 1258, 1241, 425, 504, 366, 362, 33, - /* 380 */ 32, 529, 1003, 40, 38, 36, 35, 34, 1290, 463, - /* 390 */ 69, 8, 1784, 439, 1753, 87, 1754, 551, 1756, 1757, - /* 400 */ 547, 648, 569, 115, 160, 1830, 160, 1661, 566, 298, - /* 410 */ 1826, 84, 1566, 648, 22, 1236, 1896, 1234, 169, 111, - /* 420 */ 1460, 1896, 1771, 606, 120, 1366, 465, 1312, 1313, 157, - /* 430 */ 549, 244, 1563, 1893, 159, 1723, 1571, 548, 1893, 1239, - /* 440 */ 1240, 1429, 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, - /* 450 */ 567, 1303, 1304, 1306, 1307, 1308, 1309, 1311, 1314, 1262, - /* 460 */ 1236, 1723, 1234, 1784, 525, 160, 88, 1754, 551, 1756, - /* 470 */ 1757, 547, 1236, 569, 1234, 232, 1830, 533, 336, 552, - /* 480 */ 319, 1826, 1909, 490, 1239, 1240, 138, 595, 11, 10, - /* 490 */ 1669, 1864, 119, 1217, 1218, 1573, 1239, 1240, 58, 1288, - /* 500 */ 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, 1303, 1304, - /* 510 */ 1306, 1307, 1308, 1309, 1311, 1314, 39, 37, 1315, 36, - /* 520 */ 35, 34, 525, 1896, 326, 83, 1235, 566, 160, 1478, - /* 530 */ 651, 566, 117, 1560, 69, 80, 157, 1310, 162, 1233, - /* 540 */ 1893, 1547, 377, 1459, 262, 1623, 1623, 154, 1838, 1839, - /* 550 */ 119, 1843, 525, 337, 514, 1571, 1567, 566, 149, 1571, - /* 560 */ 1305, 1622, 1621, 641, 637, 633, 629, 260, 378, 1241, - /* 570 */ 1346, 339, 529, 39, 37, 1753, 566, 643, 1334, 138, - /* 580 */ 119, 326, 566, 1235, 1723, 1571, 9, 382, 1573, 213, - /* 590 */ 117, 1458, 85, 397, 1310, 254, 1233, 245, 246, 603, - /* 600 */ 1450, 1339, 529, 1771, 1571, 230, 1838, 524, 648, 523, - /* 610 */ 1571, 549, 1896, 566, 497, 1457, 1723, 1305, 548, 1711, - /* 620 */ 117, 1556, 1312, 1313, 398, 159, 1241, 1558, 562, 1893, - /* 630 */ 520, 515, 1723, 529, 1456, 230, 1838, 524, 618, 523, - /* 640 */ 27, 1571, 1896, 9, 1784, 50, 1753, 87, 1754, 551, - /* 650 */ 1756, 1757, 547, 1845, 569, 157, 1723, 1830, 304, 1893, - /* 660 */ 212, 298, 1826, 619, 617, 648, 352, 1236, 1554, 1234, - /* 670 */ 1455, 1454, 534, 1896, 1771, 1723, 1453, 1842, 367, 1312, - /* 680 */ 1313, 1209, 549, 205, 138, 1391, 157, 1723, 1452, 548, - /* 690 */ 1893, 1239, 1240, 1574, 1288, 1289, 1291, 1292, 1293, 1294, - /* 700 */ 1295, 544, 567, 1303, 1304, 1306, 1307, 1308, 1309, 1311, - /* 710 */ 1314, 1723, 1723, 525, 1845, 1784, 566, 1723, 88, 1754, - /* 720 */ 551, 1756, 1757, 547, 1236, 569, 1234, 438, 1830, 1723, - /* 730 */ 1451, 531, 319, 1826, 1909, 1529, 1741, 1667, 1841, 1448, - /* 740 */ 305, 119, 1447, 1887, 1571, 1446, 1445, 1737, 1239, 1240, - /* 750 */ 206, 1288, 1289, 1291, 1292, 1293, 1294, 1295, 544, 567, - /* 760 */ 1303, 1304, 1306, 1307, 1308, 1309, 1311, 1314, 39, 37, - /* 770 */ 295, 1723, 1257, 543, 1733, 1739, 326, 566, 1235, 405, - /* 780 */ 1723, 117, 417, 1723, 594, 569, 1723, 1723, 1568, 1310, - /* 790 */ 1444, 1233, 599, 989, 990, 1614, 155, 1838, 1839, 390, - /* 800 */ 1843, 418, 512, 392, 26, 1571, 1845, 536, 1443, 1442, - /* 810 */ 33, 32, 1305, 28, 40, 38, 36, 35, 34, 33, - /* 820 */ 32, 1241, 235, 40, 38, 36, 35, 34, 1753, 1441, - /* 830 */ 1840, 1723, 1259, 383, 566, 566, 33, 32, 2, 464, - /* 840 */ 40, 38, 36, 35, 34, 1700, 498, 33, 32, 1723, - /* 850 */ 1723, 40, 38, 36, 35, 34, 1771, 541, 1440, 457, - /* 860 */ 648, 463, 1571, 1571, 528, 1666, 1850, 1366, 305, 1723, - /* 870 */ 1723, 548, 1489, 416, 1312, 1313, 411, 410, 409, 408, - /* 880 */ 407, 404, 403, 402, 401, 400, 396, 395, 394, 393, - /* 890 */ 387, 386, 385, 384, 475, 381, 380, 1784, 299, 1723, - /* 900 */ 88, 1754, 551, 1756, 1757, 547, 566, 569, 491, 566, - /* 910 */ 1830, 1273, 566, 566, 319, 1826, 152, 502, 224, 1236, - /* 920 */ 563, 1234, 1273, 564, 256, 600, 44, 4, 1614, 267, - /* 930 */ 1332, 217, 1601, 342, 1571, 194, 1857, 1571, 192, 1772, - /* 940 */ 1571, 1571, 196, 1239, 1240, 195, 1288, 1289, 1291, 1292, - /* 950 */ 1293, 1294, 1295, 544, 567, 1303, 1304, 1306, 1307, 1308, - /* 960 */ 1309, 1311, 1314, 139, 198, 52, 501, 197, 273, 101, - /* 970 */ 566, 219, 100, 99, 98, 97, 96, 95, 94, 93, - /* 980 */ 92, 340, 271, 57, 1333, 1324, 56, 200, 33, 32, - /* 990 */ 199, 1484, 40, 38, 36, 35, 34, 1753, 1571, 1482, - /* 1000 */ 1432, 1433, 172, 1290, 537, 41, 209, 1338, 11, 10, - /* 1010 */ 1244, 33, 32, 477, 1243, 40, 38, 36, 35, 34, - /* 1020 */ 41, 480, 1743, 1473, 41, 1771, 1611, 60, 242, 1860, - /* 1030 */ 526, 1026, 229, 549, 72, 123, 3, 126, 1723, 1548, - /* 1040 */ 548, 127, 234, 237, 239, 1340, 29, 324, 1327, 1328, - /* 1050 */ 1329, 1330, 1331, 1335, 1336, 1337, 50, 574, 1745, 126, - /* 1060 */ 1296, 1027, 299, 1404, 1185, 86, 1784, 5, 247, 89, - /* 1070 */ 1754, 551, 1756, 1757, 547, 558, 569, 253, 344, 1830, - /* 1080 */ 347, 1085, 1257, 1829, 1826, 351, 306, 1054, 307, 479, - /* 1090 */ 1201, 263, 399, 1663, 1332, 168, 266, 1113, 127, 1117, - /* 1100 */ 64, 63, 376, 112, 489, 166, 1753, 1546, 406, 414, - /* 1110 */ 126, 370, 413, 415, 333, 332, 419, 1263, 202, 420, - /* 1120 */ 428, 1266, 294, 431, 1249, 360, 175, 358, 354, 350, - /* 1130 */ 163, 345, 482, 601, 1771, 1310, 476, 1242, 1124, 432, - /* 1140 */ 1247, 201, 549, 1122, 1246, 177, 1265, 1723, 1333, 548, - /* 1150 */ 130, 433, 129, 128, 598, 597, 596, 1267, 1305, 434, - /* 1160 */ 180, 436, 182, 1264, 160, 437, 55, 1241, 184, 54, - /* 1170 */ 68, 1338, 440, 187, 459, 1784, 264, 461, 88, 1754, - /* 1180 */ 551, 1756, 1757, 547, 1705, 569, 91, 1561, 1830, 297, - /* 1190 */ 191, 1557, 319, 1826, 1909, 193, 132, 1753, 133, 1559, - /* 1200 */ 204, 601, 1555, 1849, 134, 135, 570, 492, 493, 496, - /* 1210 */ 29, 324, 1327, 1328, 1329, 1330, 1331, 1335, 1336, 1337, - /* 1220 */ 129, 128, 598, 597, 596, 1771, 207, 189, 499, 503, - /* 1230 */ 316, 1262, 211, 549, 508, 513, 1861, 555, 1723, 6, - /* 1240 */ 548, 144, 1871, 215, 1870, 510, 456, 452, 448, 444, - /* 1250 */ 188, 218, 318, 516, 1852, 529, 33, 32, 522, 223, - /* 1260 */ 40, 38, 36, 35, 34, 1250, 1784, 1245, 509, 280, - /* 1270 */ 1754, 551, 1756, 1757, 547, 70, 569, 507, 186, 33, - /* 1280 */ 32, 1753, 225, 40, 38, 36, 35, 34, 146, 1253, - /* 1290 */ 226, 506, 228, 227, 1366, 1896, 1261, 1846, 118, 1892, - /* 1300 */ 567, 1303, 1304, 1306, 1307, 1308, 1309, 538, 159, 1771, - /* 1310 */ 535, 18, 1893, 233, 320, 1912, 532, 549, 236, 553, - /* 1320 */ 539, 238, 1723, 124, 548, 1811, 554, 125, 1704, 1673, - /* 1330 */ 559, 1384, 560, 1753, 556, 328, 249, 251, 265, 529, - /* 1340 */ 185, 178, 77, 183, 561, 1572, 79, 435, 572, 1544, - /* 1350 */ 1784, 1615, 268, 280, 1754, 551, 1756, 1757, 547, 259, - /* 1360 */ 569, 1771, 644, 51, 645, 647, 176, 145, 289, 549, - /* 1370 */ 291, 272, 1717, 290, 1723, 270, 548, 1716, 62, 1896, - /* 1380 */ 1715, 346, 1712, 348, 349, 1753, 1228, 1229, 164, 353, - /* 1390 */ 1710, 355, 157, 356, 357, 1709, 1893, 359, 1708, 361, - /* 1400 */ 1707, 1753, 1784, 363, 1706, 89, 1754, 551, 1756, 1757, - /* 1410 */ 547, 365, 569, 1771, 1690, 1830, 369, 165, 368, 540, - /* 1420 */ 1826, 546, 1204, 1203, 1684, 1683, 1723, 375, 548, 1771, - /* 1430 */ 1682, 374, 1681, 1173, 1656, 1655, 1654, 549, 65, 1653, - /* 1440 */ 1652, 1651, 1723, 1650, 548, 1649, 388, 389, 1648, 391, - /* 1450 */ 1647, 1753, 122, 1633, 1784, 1646, 1645, 287, 1754, 551, - /* 1460 */ 1756, 1757, 547, 545, 569, 542, 1802, 1753, 1644, 1643, - /* 1470 */ 1784, 1642, 1641, 142, 1754, 551, 1756, 1757, 547, 1771, - /* 1480 */ 569, 1640, 1639, 1638, 1637, 1636, 1635, 549, 1634, 1632, - /* 1490 */ 1631, 1630, 1723, 1629, 548, 1771, 1628, 1175, 1627, 1626, - /* 1500 */ 1625, 1624, 1501, 549, 1469, 173, 113, 424, 1723, 1753, - /* 1510 */ 548, 992, 426, 150, 1468, 1698, 174, 530, 1910, 991, - /* 1520 */ 1784, 1753, 505, 89, 1754, 551, 1756, 1757, 547, 1692, - /* 1530 */ 569, 114, 1680, 1830, 179, 1679, 1784, 1771, 1827, 288, - /* 1540 */ 1754, 551, 1756, 1757, 547, 549, 569, 181, 1665, 1771, - /* 1550 */ 1723, 1550, 548, 1500, 1020, 1498, 441, 549, 442, 443, - /* 1560 */ 1496, 445, 1723, 446, 548, 1494, 447, 451, 449, 450, - /* 1570 */ 1492, 1753, 453, 1481, 1480, 455, 1465, 454, 1784, 1552, - /* 1580 */ 1127, 283, 1754, 551, 1756, 1757, 547, 1753, 569, 1128, - /* 1590 */ 1784, 1551, 190, 142, 1754, 551, 1756, 1757, 547, 1771, - /* 1600 */ 569, 49, 1053, 1052, 1051, 616, 1050, 549, 1490, 618, - /* 1610 */ 1047, 312, 1723, 1046, 548, 1771, 1045, 1485, 313, 521, - /* 1620 */ 1483, 478, 314, 546, 1464, 481, 323, 483, 1723, 1463, - /* 1630 */ 548, 1462, 485, 487, 90, 1697, 1211, 53, 1911, 1753, - /* 1640 */ 1784, 1691, 136, 288, 1754, 551, 1756, 1757, 547, 494, - /* 1650 */ 569, 1678, 1676, 208, 1677, 1753, 1784, 495, 315, 287, - /* 1660 */ 1754, 551, 1756, 1757, 547, 500, 569, 1771, 1803, 1675, - /* 1670 */ 1674, 41, 15, 47, 16, 549, 23, 221, 1406, 222, - /* 1680 */ 1723, 214, 548, 1771, 1743, 216, 1390, 143, 220, 24, - /* 1690 */ 25, 549, 1383, 1363, 325, 74, 1723, 45, 548, 1362, - /* 1700 */ 13, 231, 46, 17, 147, 1753, 1423, 1418, 1784, 1412, - /* 1710 */ 327, 288, 1754, 551, 1756, 1757, 547, 1753, 569, 1417, - /* 1720 */ 321, 1422, 1421, 322, 1784, 10, 1325, 288, 1754, 551, - /* 1730 */ 1756, 1757, 547, 1771, 569, 19, 1298, 148, 31, 161, - /* 1740 */ 1281, 549, 1672, 1664, 1297, 1771, 1723, 12, 548, 20, - /* 1750 */ 550, 241, 557, 549, 1388, 21, 243, 248, 1723, 75, - /* 1760 */ 548, 250, 76, 1742, 252, 255, 1300, 1251, 80, 573, - /* 1770 */ 335, 1753, 1787, 577, 1784, 571, 568, 274, 1754, 551, - /* 1780 */ 1756, 1757, 547, 48, 569, 1114, 1784, 1753, 575, 275, - /* 1790 */ 1754, 551, 1756, 1757, 547, 1111, 569, 578, 1753, 1771, - /* 1800 */ 580, 583, 586, 1108, 1102, 1091, 581, 549, 584, 1106, - /* 1810 */ 1100, 587, 1723, 1105, 548, 1771, 1104, 1123, 81, 1103, - /* 1820 */ 257, 82, 593, 549, 1119, 1042, 1771, 602, 1723, 59, - /* 1830 */ 548, 1018, 605, 1040, 549, 1060, 258, 1035, 1039, 1723, - /* 1840 */ 1784, 548, 1038, 276, 1754, 551, 1756, 1757, 547, 1037, - /* 1850 */ 569, 1753, 1036, 1034, 1033, 1055, 1784, 1057, 1030, 282, - /* 1860 */ 1754, 551, 1756, 1757, 547, 1029, 569, 1784, 1753, 1028, - /* 1870 */ 284, 1754, 551, 1756, 1757, 547, 1497, 569, 1025, 1771, - /* 1880 */ 1024, 1023, 626, 627, 1495, 630, 631, 549, 628, 1493, - /* 1890 */ 632, 634, 1723, 1753, 548, 635, 1771, 636, 1491, 638, - /* 1900 */ 639, 640, 1479, 642, 549, 982, 1461, 261, 646, 1723, - /* 1910 */ 1753, 548, 1237, 269, 1436, 649, 650, 1436, 1436, 1436, - /* 1920 */ 1784, 1771, 1436, 277, 1754, 551, 1756, 1757, 547, 549, - /* 1930 */ 569, 1436, 1436, 1436, 1723, 1436, 548, 1784, 1771, 1436, - /* 1940 */ 285, 1754, 551, 1756, 1757, 547, 549, 569, 1436, 1436, - /* 1950 */ 1436, 1723, 1753, 548, 1436, 1436, 1436, 1436, 1436, 1436, - /* 1960 */ 1436, 1436, 1784, 1436, 1753, 278, 1754, 551, 1756, 1757, - /* 1970 */ 547, 1436, 569, 1436, 1436, 1436, 1436, 1436, 1436, 1784, - /* 1980 */ 1771, 1436, 286, 1754, 551, 1756, 1757, 547, 549, 569, - /* 1990 */ 1436, 1436, 1771, 1723, 1436, 548, 1436, 1436, 1436, 1436, - /* 2000 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, - /* 2010 */ 1436, 1436, 1436, 1436, 1753, 1436, 1436, 1436, 1436, 1436, - /* 2020 */ 1436, 1784, 1436, 1436, 279, 1754, 551, 1756, 1757, 547, - /* 2030 */ 1436, 569, 1753, 1784, 1436, 1436, 292, 1754, 551, 1756, - /* 2040 */ 1757, 547, 1771, 569, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2050 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, - /* 2060 */ 1771, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 549, 1436, - /* 2070 */ 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, 1436, 1436, - /* 2080 */ 1436, 1436, 1753, 1784, 1436, 1436, 293, 1754, 551, 1756, - /* 2090 */ 1757, 547, 1436, 569, 1753, 1436, 1436, 1436, 1436, 1436, - /* 2100 */ 1436, 1784, 1436, 1436, 1765, 1754, 551, 1756, 1757, 547, - /* 2110 */ 1771, 569, 1436, 1436, 1436, 1436, 1436, 1436, 549, 1436, - /* 2120 */ 1436, 1436, 1771, 1723, 1436, 548, 1436, 1436, 1436, 1436, - /* 2130 */ 549, 1436, 1436, 1436, 1436, 1723, 1436, 548, 1436, 1436, - /* 2140 */ 1436, 1436, 1436, 1436, 1436, 1436, 1753, 1436, 1436, 1436, - /* 2150 */ 1436, 1784, 1436, 1436, 1764, 1754, 551, 1756, 1757, 547, - /* 2160 */ 1436, 569, 1436, 1784, 1753, 1436, 1763, 1754, 551, 1756, - /* 2170 */ 1757, 547, 1436, 569, 1771, 1436, 1436, 1436, 1436, 1436, - /* 2180 */ 1436, 1436, 549, 1436, 1436, 1436, 1436, 1723, 1753, 548, - /* 2190 */ 1436, 1436, 1771, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2200 */ 549, 1436, 1436, 1436, 1436, 1723, 1753, 548, 1436, 1436, - /* 2210 */ 1436, 1436, 1436, 1436, 1436, 1784, 1771, 1436, 302, 1754, - /* 2220 */ 551, 1756, 1757, 547, 549, 569, 1436, 1436, 1436, 1723, - /* 2230 */ 1436, 548, 1436, 1784, 1771, 1436, 301, 1754, 551, 1756, - /* 2240 */ 1757, 547, 549, 569, 1436, 1436, 1436, 1723, 1436, 548, - /* 2250 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1784, 1436, 1753, - /* 2260 */ 303, 1754, 551, 1756, 1757, 547, 1436, 569, 1436, 1436, - /* 2270 */ 1436, 1436, 1436, 1436, 1436, 1784, 1436, 1436, 300, 1754, - /* 2280 */ 551, 1756, 1757, 547, 1436, 569, 1436, 1771, 1436, 1436, - /* 2290 */ 1436, 1436, 1436, 1436, 1436, 549, 1436, 1436, 1436, 1436, - /* 2300 */ 1723, 1436, 548, 1436, 33, 32, 1436, 1436, 40, 38, - /* 2310 */ 36, 35, 34, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2320 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1784, 1436, - /* 2330 */ 1436, 281, 1754, 551, 1756, 1757, 547, 1436, 569, 1436, - /* 2340 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2350 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2360 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2370 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2380 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2390 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2400 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2410 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2420 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2430 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 2440 */ 1436, 1436, 1436, 1436, 1436, 1436, 137, + /* 0 */ 422, 1670, 423, 1475, 294, 1744, 1438, 430, 317, 423, + /* 10 */ 1475, 1563, 39, 37, 1505, 338, 1741, 69, 1619, 1621, + /* 20 */ 326, 1441, 1238, 1744, 1900, 1565, 334, 525, 373, 379, + /* 30 */ 115, 1674, 1775, 1313, 1741, 1236, 1741, 1899, 1552, 1569, + /* 40 */ 518, 1897, 101, 1737, 1743, 100, 99, 98, 97, 96, + /* 50 */ 95, 94, 93, 92, 570, 119, 1308, 987, 1757, 14, + /* 60 */ 61, 1737, 1743, 1737, 1743, 1244, 297, 343, 1900, 39, + /* 70 */ 37, 1376, 570, 439, 570, 474, 473, 326, 517, 1238, + /* 80 */ 472, 157, 1, 116, 469, 1897, 1775, 468, 467, 466, + /* 90 */ 1313, 1004, 1236, 1003, 528, 117, 439, 991, 992, 1727, + /* 100 */ 479, 548, 1380, 310, 649, 566, 458, 1900, 1262, 527, + /* 110 */ 153, 1842, 1843, 1308, 1847, 489, 14, 552, 1315, 1316, + /* 120 */ 157, 1005, 1244, 1550, 1897, 329, 412, 1788, 1671, 202, + /* 130 */ 88, 1758, 551, 1760, 1761, 547, 60, 570, 60, 2, + /* 140 */ 1834, 525, 210, 482, 319, 1830, 152, 476, 30, 240, + /* 150 */ 652, 311, 201, 309, 308, 140, 462, 1452, 156, 421, + /* 160 */ 464, 649, 425, 1239, 262, 1237, 1860, 43, 60, 119, + /* 170 */ 73, 330, 171, 170, 566, 1315, 1316, 55, 149, 138, + /* 180 */ 54, 604, 463, 642, 638, 634, 630, 260, 1576, 1242, + /* 190 */ 1243, 519, 1291, 1292, 1294, 1295, 1296, 1297, 1298, 544, + /* 200 */ 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, 117, + /* 210 */ 1263, 1669, 85, 1323, 294, 254, 372, 167, 371, 1262, + /* 220 */ 1239, 160, 1237, 427, 154, 1842, 1843, 1900, 1847, 1260, + /* 230 */ 1745, 33, 32, 504, 1263, 40, 38, 36, 35, 34, + /* 240 */ 158, 1741, 67, 525, 1897, 66, 1242, 1243, 563, 1291, + /* 250 */ 1292, 1294, 1295, 1296, 1297, 1298, 544, 568, 1306, 1307, + /* 260 */ 1309, 1310, 1311, 1312, 1314, 1317, 39, 37, 1737, 1743, + /* 270 */ 488, 119, 490, 1900, 326, 160, 1238, 160, 69, 570, + /* 280 */ 212, 1293, 300, 486, 60, 484, 157, 1313, 101, 1236, + /* 290 */ 1897, 100, 99, 98, 97, 96, 95, 94, 93, 92, + /* 300 */ 1570, 1211, 151, 205, 1900, 552, 1276, 160, 1136, 1137, + /* 310 */ 1308, 117, 1900, 14, 1335, 1613, 1672, 1898, 1262, 1244, + /* 320 */ 602, 1897, 566, 39, 37, 157, 155, 1842, 1843, 1897, + /* 330 */ 1847, 326, 604, 1238, 1502, 1004, 2, 1003, 1261, 129, + /* 340 */ 128, 599, 598, 597, 1313, 78, 1236, 1094, 593, 592, + /* 350 */ 591, 1098, 590, 1100, 1101, 589, 1103, 586, 649, 1109, + /* 360 */ 583, 1111, 1112, 580, 577, 1005, 1567, 1308, 1336, 36, + /* 370 */ 35, 34, 1315, 1316, 1664, 1463, 1244, 40, 38, 36, + /* 380 */ 35, 34, 33, 32, 42, 169, 40, 38, 36, 35, + /* 390 */ 34, 1341, 1293, 8, 541, 626, 625, 624, 341, 596, + /* 400 */ 623, 622, 621, 121, 616, 615, 614, 613, 612, 611, + /* 410 */ 610, 609, 131, 605, 141, 649, 1727, 1239, 1531, 1237, + /* 420 */ 33, 32, 1397, 160, 40, 38, 36, 35, 34, 1315, + /* 430 */ 1316, 1551, 29, 324, 1330, 1331, 1332, 1333, 1334, 1338, + /* 440 */ 1339, 1340, 600, 1242, 1243, 1617, 1291, 1292, 1294, 1295, + /* 450 */ 1296, 1297, 1298, 544, 568, 1306, 1307, 1309, 1310, 1311, + /* 460 */ 1312, 1314, 1317, 511, 1395, 1396, 1398, 1399, 1056, 567, + /* 470 */ 474, 473, 138, 1337, 1239, 472, 1237, 1264, 116, 469, + /* 480 */ 111, 1577, 468, 467, 466, 33, 32, 460, 1244, 40, + /* 490 */ 38, 36, 35, 34, 607, 1407, 1342, 1574, 1058, 1462, + /* 500 */ 1242, 1243, 203, 1291, 1292, 1294, 1295, 1296, 1297, 1298, + /* 510 */ 544, 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, + /* 520 */ 39, 37, 1318, 160, 1327, 602, 1620, 1621, 326, 1433, + /* 530 */ 1238, 567, 160, 471, 470, 189, 300, 27, 245, 246, + /* 540 */ 1727, 1313, 162, 1236, 129, 128, 599, 598, 597, 144, + /* 550 */ 1559, 525, 567, 1626, 456, 452, 448, 444, 188, 1574, + /* 560 */ 331, 71, 305, 111, 1308, 556, 1265, 336, 1335, 1624, + /* 570 */ 465, 11, 10, 1244, 339, 138, 497, 39, 37, 119, + /* 580 */ 1574, 1561, 138, 70, 1576, 326, 186, 1238, 33, 32, + /* 590 */ 9, 1576, 40, 38, 36, 35, 34, 84, 1313, 305, + /* 600 */ 1236, 529, 556, 1757, 567, 567, 464, 232, 1626, 1461, + /* 610 */ 120, 1460, 649, 1626, 567, 377, 378, 1432, 1566, 117, + /* 620 */ 337, 1308, 1336, 22, 1625, 382, 1315, 1316, 463, 1624, + /* 630 */ 1244, 1775, 1574, 1574, 230, 1842, 524, 1262, 523, 549, + /* 640 */ 1459, 1900, 1574, 364, 1727, 1341, 548, 9, 185, 178, + /* 650 */ 1727, 183, 1727, 1349, 159, 435, 33, 32, 1897, 514, + /* 660 */ 40, 38, 36, 35, 34, 366, 362, 429, 58, 649, + /* 670 */ 425, 1239, 1788, 1237, 176, 142, 1758, 551, 1760, 1761, + /* 680 */ 547, 1727, 570, 1315, 1316, 1549, 29, 324, 1330, 1331, + /* 690 */ 1332, 1333, 1334, 1338, 1339, 1340, 213, 1242, 1243, 1458, + /* 700 */ 1291, 1292, 1294, 1295, 1296, 1297, 1298, 544, 568, 1306, + /* 710 */ 1307, 1309, 1310, 1311, 1312, 1314, 1317, 1440, 267, 530, + /* 720 */ 1914, 1604, 567, 567, 567, 620, 618, 1557, 1239, 601, + /* 730 */ 1237, 1387, 1617, 397, 398, 438, 206, 520, 515, 1715, + /* 740 */ 1727, 110, 109, 108, 107, 106, 105, 104, 103, 102, + /* 750 */ 1574, 1574, 1574, 525, 1242, 1243, 543, 1291, 1292, 1294, + /* 760 */ 1295, 1296, 1297, 1298, 544, 568, 1306, 1307, 1309, 1310, + /* 770 */ 1311, 1312, 1314, 1317, 39, 37, 296, 1238, 1260, 602, + /* 780 */ 567, 119, 326, 567, 1238, 405, 352, 1457, 417, 1849, + /* 790 */ 1236, 1571, 1849, 595, 1703, 1313, 1373, 1236, 129, 128, + /* 800 */ 599, 598, 597, 529, 1456, 390, 567, 418, 1574, 392, + /* 810 */ 1293, 1574, 244, 1846, 991, 992, 1845, 498, 1308, 1453, + /* 820 */ 1244, 117, 567, 7, 1455, 1849, 1532, 1244, 1727, 1854, + /* 830 */ 1369, 1454, 194, 502, 1574, 192, 230, 1842, 524, 383, + /* 840 */ 523, 26, 235, 1900, 2, 1727, 533, 33, 32, 1844, + /* 850 */ 1574, 40, 38, 36, 35, 34, 157, 28, 512, 649, + /* 860 */ 1897, 44, 4, 33, 32, 1727, 649, 40, 38, 36, + /* 870 */ 35, 34, 1727, 457, 1219, 1220, 1451, 52, 501, 416, + /* 880 */ 1315, 1316, 411, 410, 409, 408, 407, 404, 403, 402, + /* 890 */ 401, 400, 396, 395, 394, 393, 387, 386, 385, 384, + /* 900 */ 1492, 381, 380, 531, 196, 567, 1450, 195, 567, 139, + /* 910 */ 536, 608, 1449, 1546, 273, 491, 564, 1727, 1239, 565, + /* 920 */ 1237, 198, 475, 200, 197, 1239, 199, 1237, 271, 57, + /* 930 */ 11, 10, 56, 1574, 33, 32, 1574, 1448, 40, 38, + /* 940 */ 36, 35, 34, 1757, 1242, 1243, 1447, 1727, 172, 1446, + /* 950 */ 1445, 1242, 1243, 1727, 1291, 1292, 1294, 1295, 1296, 1297, + /* 960 */ 1298, 544, 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, + /* 970 */ 1317, 1775, 567, 60, 567, 1435, 1436, 209, 1727, 549, + /* 980 */ 1444, 1487, 224, 256, 1727, 340, 548, 1727, 33, 32, + /* 990 */ 1727, 1727, 40, 38, 36, 35, 34, 1443, 1776, 619, + /* 1000 */ 1574, 529, 1574, 477, 1369, 72, 1747, 1247, 1246, 1276, + /* 1010 */ 50, 86, 1788, 217, 1372, 87, 1758, 551, 1760, 1761, + /* 1020 */ 547, 1727, 570, 1485, 1757, 1834, 1476, 33, 32, 299, + /* 1030 */ 1830, 40, 38, 36, 35, 34, 1481, 342, 1727, 367, + /* 1040 */ 1614, 1900, 1749, 534, 1757, 480, 64, 63, 376, 41, + /* 1050 */ 1394, 166, 1775, 219, 159, 41, 83, 370, 1897, 1864, + /* 1060 */ 549, 1028, 229, 526, 41, 1727, 80, 548, 242, 234, + /* 1070 */ 295, 237, 1775, 360, 123, 358, 354, 350, 163, 345, + /* 1080 */ 528, 239, 529, 3, 644, 1727, 5, 548, 126, 1343, + /* 1090 */ 344, 1029, 1260, 1788, 127, 1299, 87, 1758, 551, 1760, + /* 1100 */ 1761, 547, 50, 570, 1187, 347, 1834, 351, 247, 537, + /* 1110 */ 299, 1830, 160, 1788, 559, 306, 88, 1758, 551, 1760, + /* 1120 */ 1761, 547, 1900, 570, 1056, 307, 1834, 1203, 253, 263, + /* 1130 */ 319, 1830, 152, 575, 1087, 157, 1757, 1250, 1249, 1897, + /* 1140 */ 126, 127, 266, 112, 126, 399, 1666, 168, 406, 414, + /* 1150 */ 413, 415, 1861, 419, 1266, 420, 428, 1269, 432, 431, + /* 1160 */ 175, 177, 1268, 433, 1775, 1270, 434, 1267, 180, 137, + /* 1170 */ 436, 182, 549, 1115, 437, 184, 68, 1727, 440, 548, + /* 1180 */ 1119, 1126, 459, 1124, 130, 187, 461, 91, 1564, 191, + /* 1190 */ 1560, 298, 1708, 193, 132, 133, 1562, 1558, 264, 1757, + /* 1200 */ 134, 204, 135, 492, 493, 1788, 207, 316, 88, 1758, + /* 1210 */ 551, 1760, 1761, 547, 496, 570, 499, 503, 1834, 1265, + /* 1220 */ 211, 513, 319, 1830, 1913, 1875, 1757, 1775, 1865, 508, + /* 1230 */ 555, 510, 1874, 1868, 215, 549, 333, 332, 218, 318, + /* 1240 */ 1727, 516, 548, 6, 509, 522, 1252, 1856, 223, 507, + /* 1250 */ 228, 146, 506, 1369, 1775, 225, 118, 1313, 1264, 1245, + /* 1260 */ 320, 538, 549, 1850, 18, 124, 535, 1727, 1788, 548, + /* 1270 */ 125, 88, 1758, 551, 1760, 1761, 547, 226, 570, 227, + /* 1280 */ 1308, 1834, 553, 554, 1707, 319, 1830, 1913, 1815, 1244, + /* 1290 */ 1676, 1896, 557, 328, 561, 1788, 1891, 1757, 88, 1758, + /* 1300 */ 551, 1760, 1761, 547, 1916, 570, 532, 233, 1834, 539, + /* 1310 */ 236, 560, 319, 1830, 1913, 238, 265, 251, 562, 77, + /* 1320 */ 249, 1575, 79, 1853, 268, 1775, 573, 259, 571, 1547, + /* 1330 */ 1618, 645, 646, 549, 648, 145, 270, 272, 1727, 1721, + /* 1340 */ 548, 289, 291, 290, 1720, 62, 1719, 346, 1716, 348, + /* 1350 */ 349, 51, 1231, 1232, 164, 529, 353, 1714, 355, 356, + /* 1360 */ 357, 1713, 1757, 359, 1712, 361, 1788, 1711, 1710, 280, + /* 1370 */ 1758, 551, 1760, 1761, 547, 363, 570, 365, 1693, 165, + /* 1380 */ 368, 369, 1206, 1205, 1687, 1686, 374, 1253, 375, 1248, + /* 1390 */ 1775, 1685, 1684, 1175, 1659, 1900, 1658, 1657, 549, 65, + /* 1400 */ 1656, 1655, 1654, 1727, 1653, 548, 1652, 388, 159, 389, + /* 1410 */ 1651, 1650, 1897, 1256, 391, 1649, 1648, 1647, 1646, 1645, + /* 1420 */ 529, 1644, 1643, 1642, 568, 1306, 1307, 1309, 1310, 1311, + /* 1430 */ 1312, 1788, 1641, 1757, 280, 1758, 551, 1760, 1761, 547, + /* 1440 */ 1640, 570, 1639, 1638, 1637, 122, 1636, 1635, 1634, 1633, + /* 1450 */ 1632, 1631, 1177, 1630, 1629, 1757, 173, 49, 424, 113, + /* 1460 */ 1900, 1775, 1628, 1627, 1504, 1472, 994, 150, 1471, 549, + /* 1470 */ 114, 993, 426, 157, 1727, 174, 548, 1897, 1701, 1695, + /* 1480 */ 1683, 181, 1682, 1775, 179, 1668, 1553, 1022, 1503, 1501, + /* 1490 */ 441, 549, 1499, 1497, 445, 1495, 1727, 1484, 548, 443, + /* 1500 */ 447, 1483, 1788, 1468, 449, 89, 1758, 551, 1760, 1761, + /* 1510 */ 547, 451, 570, 442, 446, 1834, 453, 450, 1757, 1833, + /* 1520 */ 1830, 454, 455, 1555, 1788, 190, 1130, 89, 1758, 551, + /* 1530 */ 1760, 1761, 547, 1129, 570, 1554, 1757, 1834, 1493, 1055, + /* 1540 */ 1054, 540, 1830, 1053, 1052, 617, 1775, 1049, 1048, 619, + /* 1550 */ 1047, 312, 1488, 313, 546, 1486, 478, 481, 314, 1727, + /* 1560 */ 1467, 548, 483, 1466, 1775, 485, 1465, 487, 90, 1700, + /* 1570 */ 1694, 494, 549, 1681, 1213, 53, 136, 1727, 495, 548, + /* 1580 */ 208, 1679, 1680, 1678, 315, 1677, 41, 1788, 15, 1757, + /* 1590 */ 287, 1758, 551, 1760, 1761, 547, 545, 570, 542, 1806, + /* 1600 */ 23, 47, 221, 1409, 216, 1788, 214, 143, 89, 1758, + /* 1610 */ 551, 1760, 1761, 547, 220, 570, 1393, 1775, 1834, 24, + /* 1620 */ 222, 1747, 74, 1831, 1386, 549, 231, 500, 45, 25, + /* 1630 */ 1727, 46, 548, 16, 1366, 147, 1365, 1426, 17, 1415, + /* 1640 */ 1421, 1420, 321, 1757, 505, 10, 1425, 1424, 322, 148, + /* 1650 */ 1301, 19, 1284, 31, 1757, 1300, 1675, 1667, 1788, 12, + /* 1660 */ 1328, 288, 1758, 551, 1760, 1761, 547, 161, 570, 20, + /* 1670 */ 250, 1775, 21, 1746, 241, 550, 1391, 1223, 243, 549, + /* 1680 */ 248, 255, 1775, 13, 1727, 1303, 548, 1254, 574, 80, + /* 1690 */ 549, 75, 558, 252, 572, 1727, 76, 548, 1791, 569, + /* 1700 */ 48, 1093, 1116, 335, 576, 578, 1113, 579, 581, 1110, + /* 1710 */ 582, 1757, 1788, 584, 585, 283, 1758, 551, 1760, 1761, + /* 1720 */ 547, 1104, 570, 1788, 1102, 587, 142, 1758, 551, 1760, + /* 1730 */ 1761, 547, 1757, 570, 588, 1108, 594, 81, 1125, 1775, + /* 1740 */ 1107, 82, 1106, 1105, 59, 257, 1121, 549, 1020, 1044, + /* 1750 */ 1062, 603, 1727, 521, 548, 606, 258, 1042, 1041, 1037, + /* 1760 */ 1775, 1040, 1039, 1038, 1036, 1035, 323, 1057, 546, 1059, + /* 1770 */ 1032, 1915, 1500, 1727, 1757, 548, 1031, 1030, 1027, 1026, + /* 1780 */ 1788, 1025, 627, 288, 1758, 551, 1760, 1761, 547, 629, + /* 1790 */ 570, 1498, 628, 631, 633, 632, 1496, 1757, 635, 636, + /* 1800 */ 637, 1788, 1775, 1494, 287, 1758, 551, 1760, 1761, 547, + /* 1810 */ 549, 570, 639, 1807, 640, 1727, 1482, 548, 641, 643, + /* 1820 */ 984, 1464, 261, 647, 1439, 1775, 1240, 269, 650, 325, + /* 1830 */ 651, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1439, + /* 1840 */ 548, 1439, 1439, 1788, 1439, 1439, 288, 1758, 551, 1760, + /* 1850 */ 1761, 547, 327, 570, 1757, 1439, 1439, 1439, 1439, 1439, + /* 1860 */ 1439, 1439, 1439, 1439, 1439, 1757, 1788, 1439, 1439, 288, + /* 1870 */ 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1439, 1757, + /* 1880 */ 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 1890 */ 549, 1439, 1439, 1775, 1439, 1727, 1439, 548, 1439, 1439, + /* 1900 */ 1439, 549, 1439, 1439, 1439, 1439, 1727, 1775, 548, 1439, + /* 1910 */ 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, + /* 1920 */ 1727, 1757, 548, 1788, 1439, 1439, 274, 1758, 551, 1760, + /* 1930 */ 1761, 547, 1439, 570, 1788, 1757, 1439, 275, 1758, 551, + /* 1940 */ 1760, 1761, 547, 1439, 570, 1439, 1757, 1439, 1788, 1775, + /* 1950 */ 1439, 276, 1758, 551, 1760, 1761, 547, 549, 570, 1439, + /* 1960 */ 1439, 1439, 1727, 1775, 548, 1439, 1439, 1439, 1439, 1439, + /* 1970 */ 1439, 549, 1439, 1439, 1775, 1439, 1727, 1439, 548, 1439, + /* 1980 */ 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1757, 548, + /* 1990 */ 1788, 1439, 1439, 282, 1758, 551, 1760, 1761, 547, 1439, + /* 2000 */ 570, 1439, 1439, 1439, 1788, 1439, 1439, 284, 1758, 551, + /* 2010 */ 1760, 1761, 547, 1439, 570, 1788, 1775, 1439, 277, 1758, + /* 2020 */ 551, 1760, 1761, 547, 549, 570, 1439, 1439, 1439, 1727, + /* 2030 */ 1757, 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2040 */ 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2050 */ 1439, 1439, 1439, 1757, 1439, 1439, 1439, 1788, 1775, 1439, + /* 2060 */ 285, 1758, 551, 1760, 1761, 547, 549, 570, 1439, 1775, + /* 2070 */ 1439, 1727, 1439, 548, 1439, 1439, 1439, 549, 1439, 1439, + /* 2080 */ 1439, 1775, 1727, 1439, 548, 1439, 1439, 1439, 1439, 549, + /* 2090 */ 1439, 1439, 1439, 1439, 1727, 1439, 548, 1439, 1439, 1788, + /* 2100 */ 1439, 1439, 278, 1758, 551, 1760, 1761, 547, 1757, 570, + /* 2110 */ 1788, 1439, 1439, 286, 1758, 551, 1760, 1761, 547, 1439, + /* 2120 */ 570, 1439, 1788, 1439, 1439, 279, 1758, 551, 1760, 1761, + /* 2130 */ 547, 1439, 570, 1439, 1439, 1757, 1775, 1439, 1439, 1439, + /* 2140 */ 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, + /* 2150 */ 1439, 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2160 */ 1439, 1439, 1757, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2170 */ 1439, 549, 1439, 1439, 1439, 1439, 1727, 1788, 548, 1439, + /* 2180 */ 292, 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1757, + /* 2190 */ 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, + /* 2200 */ 1439, 1439, 1439, 1727, 1788, 548, 1439, 293, 1758, 551, + /* 2210 */ 1760, 1761, 547, 1439, 570, 1439, 1439, 1775, 1439, 1439, + /* 2220 */ 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, + /* 2230 */ 1727, 1788, 548, 1439, 1769, 1758, 551, 1760, 1761, 547, + /* 2240 */ 1439, 570, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2250 */ 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1788, 1439, + /* 2260 */ 1439, 1768, 1758, 551, 1760, 1761, 547, 1439, 570, 1439, + /* 2270 */ 1757, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, + /* 2280 */ 1775, 1439, 1439, 1439, 1727, 1439, 548, 1439, 549, 1439, + /* 2290 */ 1439, 1439, 1439, 1727, 1439, 548, 1439, 1439, 1775, 1439, + /* 2300 */ 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, + /* 2310 */ 1439, 1727, 1788, 548, 1439, 1767, 1758, 551, 1760, 1761, + /* 2320 */ 547, 1788, 570, 1757, 303, 1758, 551, 1760, 1761, 547, + /* 2330 */ 1439, 570, 1439, 1439, 1439, 1439, 1439, 1757, 1439, 1788, + /* 2340 */ 1439, 1439, 302, 1758, 551, 1760, 1761, 547, 1439, 570, + /* 2350 */ 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, + /* 2360 */ 1439, 1439, 1439, 1439, 1727, 1775, 548, 1439, 1439, 1439, + /* 2370 */ 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1439, + /* 2380 */ 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2390 */ 1439, 1757, 1788, 1439, 1439, 304, 1758, 551, 1760, 1761, + /* 2400 */ 547, 1439, 570, 1439, 1439, 1439, 1788, 1439, 1439, 301, + /* 2410 */ 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1439, 1775, + /* 2420 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, + /* 2430 */ 1439, 1439, 1727, 1439, 548, 1439, 1439, 1439, 1439, 1439, + /* 2440 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2450 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2460 */ 1788, 1439, 1439, 281, 1758, 551, 1760, 1761, 547, 1439, + /* 2470 */ 570, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 257, 0, 259, 260, 280, 283, 250, 257, 286, 259, - /* 10 */ 260, 4, 12, 13, 0, 292, 294, 293, 295, 296, - /* 20 */ 20, 0, 22, 283, 351, 283, 286, 261, 311, 261, - /* 30 */ 20, 20, 281, 33, 294, 35, 294, 364, 336, 337, - /* 40 */ 289, 368, 21, 321, 322, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 332, 289, 56, 4, 253, 59, - /* 60 */ 4, 321, 322, 321, 322, 65, 298, 311, 351, 12, - /* 70 */ 13, 14, 332, 58, 332, 61, 62, 20, 327, 22, - /* 80 */ 66, 364, 82, 69, 70, 368, 281, 73, 74, 75, - /* 90 */ 33, 20, 35, 22, 289, 329, 14, 44, 45, 294, - /* 100 */ 273, 296, 20, 252, 104, 254, 35, 351, 281, 343, - /* 110 */ 344, 345, 346, 56, 348, 56, 59, 290, 118, 119, - /* 120 */ 364, 50, 65, 0, 368, 295, 296, 322, 118, 119, - /* 130 */ 325, 326, 327, 328, 329, 330, 14, 332, 82, 82, - /* 140 */ 335, 82, 20, 84, 339, 340, 341, 24, 25, 26, - /* 150 */ 27, 28, 29, 30, 31, 32, 266, 263, 353, 35, - /* 160 */ 270, 104, 0, 163, 20, 165, 361, 12, 13, 14, - /* 170 */ 15, 16, 61, 62, 20, 118, 119, 66, 284, 258, - /* 180 */ 69, 70, 261, 114, 73, 74, 75, 187, 188, 65, - /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - /* 200 */ 200, 201, 202, 203, 204, 205, 206, 20, 8, 9, - /* 210 */ 296, 14, 12, 13, 14, 15, 16, 20, 304, 219, - /* 220 */ 163, 307, 165, 61, 62, 63, 64, 220, 66, 67, - /* 230 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - /* 240 */ 78, 79, 173, 174, 187, 188, 39, 190, 191, 192, + /* 0 */ 259, 308, 261, 262, 311, 285, 252, 259, 288, 261, + /* 10 */ 262, 284, 12, 13, 0, 294, 296, 267, 297, 298, + /* 20 */ 20, 0, 22, 285, 353, 285, 288, 263, 313, 263, + /* 30 */ 280, 0, 283, 33, 296, 35, 296, 366, 0, 289, + /* 40 */ 291, 370, 21, 323, 324, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 334, 291, 56, 4, 255, 59, + /* 60 */ 4, 323, 324, 323, 324, 65, 300, 313, 353, 12, + /* 70 */ 13, 14, 334, 58, 334, 61, 62, 20, 329, 22, + /* 80 */ 66, 366, 82, 69, 70, 370, 283, 73, 74, 75, + /* 90 */ 33, 20, 35, 22, 291, 331, 58, 44, 45, 296, + /* 100 */ 4, 298, 14, 37, 104, 20, 35, 353, 20, 345, + /* 110 */ 346, 347, 348, 56, 350, 19, 59, 298, 118, 119, + /* 120 */ 366, 50, 65, 0, 370, 306, 76, 324, 309, 33, + /* 130 */ 327, 328, 329, 330, 331, 332, 82, 334, 82, 82, + /* 140 */ 337, 263, 56, 47, 341, 342, 343, 51, 338, 339, + /* 150 */ 19, 85, 56, 87, 88, 254, 90, 256, 355, 260, + /* 160 */ 94, 104, 263, 163, 33, 165, 363, 82, 82, 291, + /* 170 */ 84, 275, 122, 123, 20, 118, 119, 81, 47, 283, + /* 180 */ 84, 58, 116, 52, 53, 54, 55, 56, 292, 189, + /* 190 */ 190, 20, 192, 193, 194, 195, 196, 197, 198, 199, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 331, + /* 210 */ 20, 308, 81, 14, 311, 84, 162, 56, 164, 20, + /* 220 */ 163, 221, 165, 14, 346, 347, 348, 353, 350, 20, + /* 230 */ 285, 8, 9, 313, 20, 12, 13, 14, 15, 16, + /* 240 */ 366, 296, 81, 263, 370, 84, 189, 190, 117, 192, /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - /* 260 */ 203, 204, 205, 206, 12, 13, 351, 82, 20, 82, - /* 270 */ 281, 187, 20, 191, 22, 219, 20, 288, 219, 364, - /* 280 */ 76, 56, 269, 368, 271, 33, 297, 35, 95, 96, - /* 290 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 58, - /* 300 */ 107, 108, 109, 110, 111, 112, 81, 351, 56, 84, - /* 310 */ 37, 59, 228, 229, 230, 231, 232, 65, 94, 22, - /* 320 */ 364, 12, 13, 253, 368, 261, 122, 123, 82, 20, - /* 330 */ 82, 22, 35, 21, 82, 0, 272, 113, 114, 115, - /* 340 */ 116, 117, 33, 279, 35, 20, 34, 162, 36, 164, - /* 350 */ 65, 281, 20, 289, 22, 155, 104, 158, 85, 289, - /* 360 */ 87, 88, 65, 90, 294, 56, 296, 94, 267, 268, - /* 370 */ 118, 119, 258, 20, 65, 261, 311, 178, 179, 8, - /* 380 */ 9, 311, 50, 12, 13, 14, 15, 16, 191, 116, - /* 390 */ 265, 82, 322, 58, 253, 325, 326, 327, 328, 329, - /* 400 */ 330, 104, 332, 278, 219, 335, 219, 289, 261, 339, - /* 410 */ 340, 263, 287, 104, 43, 163, 351, 165, 300, 272, - /* 420 */ 253, 351, 281, 65, 276, 218, 279, 118, 119, 364, - /* 430 */ 289, 113, 284, 368, 364, 294, 289, 296, 368, 187, - /* 440 */ 188, 241, 190, 191, 192, 193, 194, 195, 196, 197, - /* 450 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 20, - /* 460 */ 163, 294, 165, 322, 261, 219, 325, 326, 327, 328, - /* 470 */ 329, 330, 163, 332, 165, 150, 335, 43, 273, 296, - /* 480 */ 339, 340, 341, 311, 187, 188, 281, 93, 1, 2, - /* 490 */ 307, 350, 289, 175, 176, 290, 187, 188, 3, 190, - /* 500 */ 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - /* 510 */ 201, 202, 203, 204, 205, 206, 12, 13, 14, 14, - /* 520 */ 15, 16, 261, 351, 20, 82, 22, 261, 219, 0, - /* 530 */ 19, 261, 329, 282, 265, 92, 364, 33, 272, 35, - /* 540 */ 368, 0, 272, 253, 33, 281, 281, 344, 345, 346, - /* 550 */ 289, 348, 261, 288, 148, 289, 287, 261, 47, 289, - /* 560 */ 56, 297, 297, 52, 53, 54, 55, 56, 272, 65, - /* 570 */ 83, 273, 311, 12, 13, 253, 261, 48, 145, 281, - /* 580 */ 289, 20, 261, 22, 294, 289, 82, 272, 290, 150, - /* 590 */ 329, 253, 81, 272, 33, 84, 35, 113, 114, 58, - /* 600 */ 254, 168, 311, 281, 289, 344, 345, 346, 104, 348, - /* 610 */ 289, 289, 351, 261, 315, 253, 294, 56, 296, 0, - /* 620 */ 329, 282, 118, 119, 272, 364, 65, 282, 117, 368, - /* 630 */ 224, 225, 294, 311, 253, 344, 345, 346, 43, 348, - /* 640 */ 207, 289, 351, 82, 322, 43, 253, 325, 326, 327, - /* 650 */ 328, 329, 330, 323, 332, 364, 294, 335, 174, 368, - /* 660 */ 149, 339, 340, 267, 268, 104, 47, 163, 282, 165, - /* 670 */ 253, 253, 238, 351, 281, 294, 253, 347, 83, 118, - /* 680 */ 119, 170, 289, 172, 281, 83, 364, 294, 253, 296, - /* 690 */ 368, 187, 188, 290, 190, 191, 192, 193, 194, 195, - /* 700 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - /* 710 */ 206, 294, 294, 261, 323, 322, 261, 294, 325, 326, - /* 720 */ 327, 328, 329, 330, 163, 332, 165, 272, 335, 294, - /* 730 */ 253, 236, 339, 340, 341, 270, 283, 306, 347, 253, - /* 740 */ 309, 289, 253, 350, 289, 253, 253, 294, 187, 188, - /* 750 */ 282, 190, 191, 192, 193, 194, 195, 196, 197, 198, - /* 760 */ 199, 200, 201, 202, 203, 204, 205, 206, 12, 13, - /* 770 */ 18, 294, 20, 282, 321, 322, 20, 261, 22, 27, - /* 780 */ 294, 329, 30, 294, 282, 332, 294, 294, 272, 33, - /* 790 */ 253, 35, 291, 44, 45, 294, 344, 345, 346, 47, - /* 800 */ 348, 49, 362, 51, 2, 289, 323, 43, 253, 253, - /* 810 */ 8, 9, 56, 2, 12, 13, 14, 15, 16, 8, - /* 820 */ 9, 65, 371, 12, 13, 14, 15, 16, 253, 253, - /* 830 */ 347, 294, 20, 81, 261, 261, 8, 9, 82, 94, - /* 840 */ 12, 13, 14, 15, 16, 272, 272, 8, 9, 294, - /* 850 */ 294, 12, 13, 14, 15, 16, 281, 59, 253, 262, - /* 860 */ 104, 116, 289, 289, 289, 306, 217, 218, 309, 294, - /* 870 */ 294, 296, 0, 121, 118, 119, 124, 125, 126, 127, - /* 880 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - /* 890 */ 138, 139, 140, 141, 22, 143, 144, 322, 59, 294, - /* 900 */ 325, 326, 327, 328, 329, 330, 261, 332, 318, 261, - /* 910 */ 335, 83, 261, 261, 339, 340, 341, 272, 358, 163, - /* 920 */ 272, 165, 83, 272, 272, 291, 42, 43, 294, 274, - /* 930 */ 91, 43, 277, 262, 289, 86, 361, 289, 89, 281, - /* 940 */ 289, 289, 86, 187, 188, 89, 190, 191, 192, 193, - /* 950 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - /* 960 */ 204, 205, 206, 18, 86, 150, 151, 89, 23, 21, - /* 970 */ 261, 83, 24, 25, 26, 27, 28, 29, 30, 31, - /* 980 */ 32, 272, 37, 38, 145, 187, 41, 86, 8, 9, - /* 990 */ 89, 0, 12, 13, 14, 15, 16, 253, 289, 0, - /* 1000 */ 118, 119, 57, 191, 240, 43, 56, 168, 1, 2, - /* 1010 */ 35, 8, 9, 22, 35, 12, 13, 14, 15, 16, - /* 1020 */ 43, 22, 46, 260, 43, 281, 293, 82, 43, 324, - /* 1030 */ 349, 35, 342, 289, 84, 43, 352, 43, 294, 0, - /* 1040 */ 296, 43, 365, 365, 365, 83, 207, 208, 209, 210, - /* 1050 */ 211, 212, 213, 214, 215, 216, 43, 43, 82, 43, - /* 1060 */ 83, 65, 59, 83, 83, 120, 322, 221, 83, 325, - /* 1070 */ 326, 327, 328, 329, 330, 83, 332, 83, 320, 335, - /* 1080 */ 261, 83, 20, 339, 340, 47, 319, 35, 267, 4, - /* 1090 */ 161, 313, 261, 261, 91, 42, 83, 83, 43, 83, - /* 1100 */ 155, 156, 157, 43, 19, 160, 253, 0, 301, 145, - /* 1110 */ 43, 166, 299, 299, 12, 13, 261, 20, 33, 255, - /* 1120 */ 255, 20, 177, 317, 22, 180, 265, 182, 183, 184, - /* 1130 */ 185, 186, 47, 94, 281, 33, 51, 35, 83, 296, - /* 1140 */ 165, 56, 289, 83, 165, 265, 20, 294, 145, 296, - /* 1150 */ 83, 310, 113, 114, 115, 116, 117, 20, 56, 312, - /* 1160 */ 265, 310, 265, 20, 219, 302, 81, 65, 265, 84, - /* 1170 */ 265, 168, 261, 265, 255, 322, 317, 281, 325, 326, - /* 1180 */ 327, 328, 329, 330, 294, 332, 261, 281, 335, 255, - /* 1190 */ 281, 281, 339, 340, 341, 281, 281, 253, 281, 281, - /* 1200 */ 263, 94, 281, 350, 281, 281, 104, 171, 316, 296, - /* 1210 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - /* 1220 */ 113, 114, 115, 116, 117, 281, 263, 33, 261, 261, - /* 1230 */ 310, 20, 263, 289, 294, 227, 324, 226, 294, 233, - /* 1240 */ 296, 47, 357, 305, 357, 294, 52, 53, 54, 55, - /* 1250 */ 56, 305, 294, 294, 360, 311, 8, 9, 154, 359, - /* 1260 */ 12, 13, 14, 15, 16, 163, 322, 165, 235, 325, - /* 1270 */ 326, 327, 328, 329, 330, 81, 332, 234, 84, 8, - /* 1280 */ 9, 253, 356, 12, 13, 14, 15, 16, 357, 187, - /* 1290 */ 355, 222, 320, 354, 218, 351, 20, 323, 289, 367, - /* 1300 */ 198, 199, 200, 201, 202, 203, 204, 239, 364, 281, - /* 1310 */ 237, 82, 368, 366, 242, 372, 367, 289, 366, 294, - /* 1320 */ 367, 366, 294, 305, 296, 338, 294, 305, 294, 294, - /* 1330 */ 147, 83, 303, 253, 294, 294, 289, 263, 277, 311, - /* 1340 */ 146, 147, 263, 149, 302, 289, 82, 153, 285, 271, - /* 1350 */ 322, 294, 261, 325, 326, 327, 328, 329, 330, 263, - /* 1360 */ 332, 281, 36, 314, 256, 255, 172, 309, 275, 289, - /* 1370 */ 275, 251, 0, 275, 294, 264, 296, 0, 42, 351, - /* 1380 */ 0, 73, 0, 35, 181, 253, 35, 35, 35, 181, - /* 1390 */ 0, 35, 364, 35, 181, 0, 368, 181, 0, 35, - /* 1400 */ 0, 253, 322, 22, 0, 325, 326, 327, 328, 329, - /* 1410 */ 330, 35, 332, 281, 0, 335, 167, 82, 168, 339, - /* 1420 */ 340, 289, 165, 163, 0, 0, 294, 158, 296, 281, - /* 1430 */ 0, 159, 0, 46, 0, 0, 0, 289, 142, 0, - /* 1440 */ 0, 0, 294, 0, 296, 0, 137, 35, 0, 137, - /* 1450 */ 0, 253, 42, 0, 322, 0, 0, 325, 326, 327, - /* 1460 */ 328, 329, 330, 331, 332, 333, 334, 253, 0, 0, - /* 1470 */ 322, 0, 0, 325, 326, 327, 328, 329, 330, 281, - /* 1480 */ 332, 0, 0, 0, 0, 0, 0, 289, 0, 0, - /* 1490 */ 0, 0, 294, 0, 296, 281, 0, 22, 0, 0, - /* 1500 */ 0, 0, 0, 289, 0, 42, 39, 46, 294, 253, - /* 1510 */ 296, 14, 46, 43, 0, 0, 40, 369, 370, 14, - /* 1520 */ 322, 253, 308, 325, 326, 327, 328, 329, 330, 0, - /* 1530 */ 332, 39, 0, 335, 39, 0, 322, 281, 340, 325, - /* 1540 */ 326, 327, 328, 329, 330, 289, 332, 154, 0, 281, - /* 1550 */ 294, 0, 296, 0, 60, 0, 35, 289, 47, 39, - /* 1560 */ 0, 35, 294, 47, 296, 0, 39, 39, 35, 47, - /* 1570 */ 0, 253, 35, 0, 0, 39, 0, 47, 322, 0, - /* 1580 */ 22, 325, 326, 327, 328, 329, 330, 253, 332, 35, - /* 1590 */ 322, 0, 89, 325, 326, 327, 328, 329, 330, 281, - /* 1600 */ 332, 91, 35, 35, 35, 43, 35, 289, 0, 43, - /* 1610 */ 35, 22, 294, 35, 296, 281, 35, 0, 22, 363, - /* 1620 */ 0, 49, 22, 289, 0, 35, 308, 35, 294, 0, - /* 1630 */ 296, 0, 35, 22, 20, 0, 35, 150, 370, 253, - /* 1640 */ 322, 0, 169, 325, 326, 327, 328, 329, 330, 22, - /* 1650 */ 332, 0, 0, 147, 0, 253, 322, 150, 150, 325, - /* 1660 */ 326, 327, 328, 329, 330, 152, 332, 281, 334, 0, - /* 1670 */ 0, 43, 223, 43, 223, 289, 82, 43, 83, 46, - /* 1680 */ 294, 82, 296, 281, 46, 83, 83, 82, 82, 82, - /* 1690 */ 43, 289, 83, 83, 308, 82, 294, 217, 296, 83, - /* 1700 */ 223, 46, 43, 43, 46, 253, 83, 35, 322, 83, - /* 1710 */ 308, 325, 326, 327, 328, 329, 330, 253, 332, 35, - /* 1720 */ 35, 35, 35, 35, 322, 2, 187, 325, 326, 327, - /* 1730 */ 328, 329, 330, 281, 332, 43, 83, 46, 82, 46, - /* 1740 */ 22, 289, 0, 0, 83, 281, 294, 82, 296, 82, - /* 1750 */ 189, 83, 148, 289, 83, 82, 82, 82, 294, 82, - /* 1760 */ 296, 39, 82, 46, 146, 46, 83, 22, 92, 35, - /* 1770 */ 35, 253, 82, 35, 322, 93, 82, 325, 326, 327, - /* 1780 */ 328, 329, 330, 82, 332, 83, 322, 253, 82, 325, - /* 1790 */ 326, 327, 328, 329, 330, 83, 332, 82, 253, 281, - /* 1800 */ 35, 35, 35, 83, 83, 22, 82, 289, 82, 106, - /* 1810 */ 83, 82, 294, 106, 296, 281, 106, 35, 82, 106, - /* 1820 */ 43, 82, 94, 289, 22, 35, 281, 59, 294, 82, - /* 1830 */ 296, 60, 80, 35, 289, 65, 43, 22, 35, 294, - /* 1840 */ 322, 296, 35, 325, 326, 327, 328, 329, 330, 35, - /* 1850 */ 332, 253, 35, 35, 35, 35, 322, 65, 35, 325, - /* 1860 */ 326, 327, 328, 329, 330, 35, 332, 322, 253, 35, - /* 1870 */ 325, 326, 327, 328, 329, 330, 0, 332, 35, 281, - /* 1880 */ 35, 35, 35, 47, 0, 35, 47, 289, 39, 0, - /* 1890 */ 39, 35, 294, 253, 296, 47, 281, 39, 0, 35, - /* 1900 */ 47, 39, 0, 35, 289, 35, 0, 22, 21, 294, - /* 1910 */ 253, 296, 22, 22, 373, 21, 20, 373, 373, 373, - /* 1920 */ 322, 281, 373, 325, 326, 327, 328, 329, 330, 289, - /* 1930 */ 332, 373, 373, 373, 294, 373, 296, 322, 281, 373, - /* 1940 */ 325, 326, 327, 328, 329, 330, 289, 332, 373, 373, - /* 1950 */ 373, 294, 253, 296, 373, 373, 373, 373, 373, 373, - /* 1960 */ 373, 373, 322, 373, 253, 325, 326, 327, 328, 329, - /* 1970 */ 330, 373, 332, 373, 373, 373, 373, 373, 373, 322, - /* 1980 */ 281, 373, 325, 326, 327, 328, 329, 330, 289, 332, - /* 1990 */ 373, 373, 281, 294, 373, 296, 373, 373, 373, 373, - /* 2000 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, - /* 2010 */ 373, 373, 373, 373, 253, 373, 373, 373, 373, 373, - /* 2020 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, - /* 2030 */ 373, 332, 253, 322, 373, 373, 325, 326, 327, 328, - /* 2040 */ 329, 330, 281, 332, 373, 373, 373, 373, 373, 373, - /* 2050 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, - /* 2060 */ 281, 373, 373, 373, 373, 373, 373, 373, 289, 373, - /* 2070 */ 373, 373, 373, 294, 373, 296, 373, 373, 373, 373, - /* 2080 */ 373, 373, 253, 322, 373, 373, 325, 326, 327, 328, - /* 2090 */ 329, 330, 373, 332, 253, 373, 373, 373, 373, 373, - /* 2100 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, - /* 2110 */ 281, 332, 373, 373, 373, 373, 373, 373, 289, 373, - /* 2120 */ 373, 373, 281, 294, 373, 296, 373, 373, 373, 373, - /* 2130 */ 289, 373, 373, 373, 373, 294, 373, 296, 373, 373, - /* 2140 */ 373, 373, 373, 373, 373, 373, 253, 373, 373, 373, - /* 2150 */ 373, 322, 373, 373, 325, 326, 327, 328, 329, 330, - /* 2160 */ 373, 332, 373, 322, 253, 373, 325, 326, 327, 328, - /* 2170 */ 329, 330, 373, 332, 281, 373, 373, 373, 373, 373, - /* 2180 */ 373, 373, 289, 373, 373, 373, 373, 294, 253, 296, - /* 2190 */ 373, 373, 281, 373, 373, 373, 373, 373, 373, 373, - /* 2200 */ 289, 373, 373, 373, 373, 294, 253, 296, 373, 373, - /* 2210 */ 373, 373, 373, 373, 373, 322, 281, 373, 325, 326, - /* 2220 */ 327, 328, 329, 330, 289, 332, 373, 373, 373, 294, - /* 2230 */ 373, 296, 373, 322, 281, 373, 325, 326, 327, 328, - /* 2240 */ 329, 330, 289, 332, 373, 373, 373, 294, 373, 296, - /* 2250 */ 373, 373, 373, 373, 373, 373, 373, 322, 373, 253, - /* 2260 */ 325, 326, 327, 328, 329, 330, 373, 332, 373, 373, - /* 2270 */ 373, 373, 373, 373, 373, 322, 373, 373, 325, 326, - /* 2280 */ 327, 328, 329, 330, 373, 332, 373, 281, 373, 373, - /* 2290 */ 373, 373, 373, 373, 373, 289, 373, 373, 373, 373, - /* 2300 */ 294, 373, 296, 373, 8, 9, 373, 373, 12, 13, - /* 2310 */ 14, 15, 16, 373, 373, 373, 373, 373, 373, 373, - /* 2320 */ 373, 373, 373, 373, 373, 373, 373, 373, 322, 373, - /* 2330 */ 373, 325, 326, 327, 328, 329, 330, 373, 332, 373, - /* 2340 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2350 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2360 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2370 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2380 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2390 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2400 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2410 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2420 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2430 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2440 */ 373, 373, 373, 373, 373, 373, 150, 373, 373, 373, - /* 2450 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2460 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2470 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2480 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2490 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2500 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2510 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2520 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2530 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2540 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 2550 */ 373, 373, 373, 373, 373, + /* 260 */ 203, 204, 205, 206, 207, 208, 12, 13, 323, 324, + /* 270 */ 21, 291, 313, 353, 20, 221, 22, 221, 267, 334, + /* 280 */ 149, 193, 59, 34, 82, 36, 366, 33, 21, 35, + /* 290 */ 370, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 300 */ 289, 170, 282, 172, 353, 298, 83, 221, 118, 119, + /* 310 */ 56, 331, 353, 59, 91, 295, 309, 366, 20, 65, + /* 320 */ 94, 370, 20, 12, 13, 366, 346, 347, 348, 370, + /* 330 */ 350, 20, 58, 22, 0, 20, 82, 22, 20, 113, + /* 340 */ 114, 115, 116, 117, 33, 265, 35, 95, 96, 97, + /* 350 */ 98, 99, 100, 101, 102, 103, 104, 105, 104, 107, + /* 360 */ 108, 109, 110, 111, 112, 50, 286, 56, 145, 14, + /* 370 */ 15, 16, 118, 119, 291, 255, 65, 12, 13, 14, + /* 380 */ 15, 16, 8, 9, 82, 302, 12, 13, 14, 15, + /* 390 */ 16, 168, 193, 82, 59, 61, 62, 63, 64, 93, + /* 400 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 410 */ 76, 77, 78, 79, 268, 104, 296, 163, 272, 165, + /* 420 */ 8, 9, 189, 221, 12, 13, 14, 15, 16, 118, + /* 430 */ 119, 0, 209, 210, 211, 212, 213, 214, 215, 216, + /* 440 */ 217, 218, 293, 189, 190, 296, 192, 193, 194, 195, + /* 450 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + /* 460 */ 206, 207, 208, 230, 231, 232, 233, 234, 35, 263, + /* 470 */ 61, 62, 283, 145, 163, 66, 165, 20, 69, 70, + /* 480 */ 274, 292, 73, 74, 75, 8, 9, 281, 65, 12, + /* 490 */ 13, 14, 15, 16, 65, 83, 168, 291, 65, 255, + /* 500 */ 189, 190, 114, 192, 193, 194, 195, 196, 197, 198, + /* 510 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + /* 520 */ 12, 13, 14, 221, 189, 94, 297, 298, 20, 155, + /* 530 */ 22, 263, 221, 269, 270, 33, 59, 209, 113, 114, + /* 540 */ 296, 33, 274, 35, 113, 114, 115, 116, 117, 47, + /* 550 */ 284, 263, 263, 283, 52, 53, 54, 55, 56, 291, + /* 560 */ 290, 173, 174, 274, 56, 177, 20, 275, 91, 299, + /* 570 */ 281, 1, 2, 65, 275, 283, 317, 12, 13, 291, + /* 580 */ 291, 284, 283, 81, 292, 20, 84, 22, 8, 9, + /* 590 */ 82, 292, 12, 13, 14, 15, 16, 265, 33, 174, + /* 600 */ 35, 313, 177, 255, 263, 263, 94, 150, 283, 255, + /* 610 */ 278, 255, 104, 283, 263, 274, 274, 243, 286, 331, + /* 620 */ 290, 56, 145, 43, 299, 274, 118, 119, 116, 299, + /* 630 */ 65, 283, 291, 291, 346, 347, 348, 20, 350, 291, + /* 640 */ 255, 353, 291, 158, 296, 168, 298, 82, 146, 147, + /* 650 */ 296, 149, 296, 83, 366, 153, 8, 9, 370, 148, + /* 660 */ 12, 13, 14, 15, 16, 180, 181, 260, 3, 104, + /* 670 */ 263, 163, 324, 165, 172, 327, 328, 329, 330, 331, + /* 680 */ 332, 296, 334, 118, 119, 0, 209, 210, 211, 212, + /* 690 */ 213, 214, 215, 216, 217, 218, 150, 189, 190, 255, + /* 700 */ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + /* 710 */ 202, 203, 204, 205, 206, 207, 208, 0, 276, 371, + /* 720 */ 372, 279, 263, 263, 263, 269, 270, 284, 163, 293, + /* 730 */ 165, 83, 296, 274, 274, 274, 284, 226, 227, 0, + /* 740 */ 296, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 750 */ 291, 291, 291, 263, 189, 190, 284, 192, 193, 194, + /* 760 */ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + /* 770 */ 205, 206, 207, 208, 12, 13, 18, 22, 20, 94, + /* 780 */ 263, 291, 20, 263, 22, 27, 47, 255, 30, 325, + /* 790 */ 35, 274, 325, 284, 274, 33, 4, 35, 113, 114, + /* 800 */ 115, 116, 117, 313, 255, 47, 263, 49, 291, 51, + /* 810 */ 193, 291, 113, 349, 44, 45, 349, 274, 56, 256, + /* 820 */ 65, 331, 263, 39, 255, 325, 272, 65, 296, 219, + /* 830 */ 220, 255, 86, 274, 291, 89, 346, 347, 348, 81, + /* 840 */ 350, 2, 373, 353, 82, 296, 43, 8, 9, 349, + /* 850 */ 291, 12, 13, 14, 15, 16, 366, 2, 364, 104, + /* 860 */ 370, 42, 43, 8, 9, 296, 104, 12, 13, 14, + /* 870 */ 15, 16, 296, 264, 175, 176, 255, 150, 151, 121, + /* 880 */ 118, 119, 124, 125, 126, 127, 128, 129, 130, 131, + /* 890 */ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + /* 900 */ 0, 143, 144, 238, 86, 263, 255, 89, 263, 18, + /* 910 */ 43, 271, 255, 273, 23, 320, 274, 296, 163, 274, + /* 920 */ 165, 86, 22, 86, 89, 163, 89, 165, 37, 38, + /* 930 */ 1, 2, 41, 291, 8, 9, 291, 255, 12, 13, + /* 940 */ 14, 15, 16, 255, 189, 190, 255, 296, 57, 255, + /* 950 */ 255, 189, 190, 296, 192, 193, 194, 195, 196, 197, + /* 960 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + /* 970 */ 208, 283, 263, 82, 263, 118, 119, 56, 296, 291, + /* 980 */ 255, 0, 360, 274, 296, 274, 298, 296, 8, 9, + /* 990 */ 296, 296, 12, 13, 14, 15, 16, 255, 283, 43, + /* 1000 */ 291, 313, 291, 22, 220, 84, 46, 35, 35, 83, + /* 1010 */ 43, 120, 324, 43, 222, 327, 328, 329, 330, 331, + /* 1020 */ 332, 296, 334, 0, 255, 337, 262, 8, 9, 341, + /* 1030 */ 342, 12, 13, 14, 15, 16, 0, 264, 296, 83, + /* 1040 */ 295, 353, 82, 240, 255, 22, 155, 156, 157, 43, + /* 1050 */ 83, 160, 283, 83, 366, 43, 82, 166, 370, 326, + /* 1060 */ 291, 35, 344, 351, 43, 296, 92, 298, 43, 367, + /* 1070 */ 179, 367, 283, 182, 43, 184, 185, 186, 187, 188, + /* 1080 */ 291, 367, 313, 354, 48, 296, 223, 298, 43, 83, + /* 1090 */ 322, 65, 20, 324, 43, 83, 327, 328, 329, 330, + /* 1100 */ 331, 332, 43, 334, 83, 263, 337, 47, 83, 242, + /* 1110 */ 341, 342, 221, 324, 83, 321, 327, 328, 329, 330, + /* 1120 */ 331, 332, 353, 334, 35, 269, 337, 161, 83, 315, + /* 1130 */ 341, 342, 343, 43, 83, 366, 255, 165, 165, 370, + /* 1140 */ 43, 43, 83, 43, 43, 263, 263, 42, 303, 145, + /* 1150 */ 301, 301, 363, 263, 20, 257, 257, 20, 298, 319, + /* 1160 */ 267, 267, 20, 312, 283, 20, 314, 20, 267, 150, + /* 1170 */ 312, 267, 291, 83, 304, 267, 267, 296, 263, 298, + /* 1180 */ 83, 83, 257, 83, 83, 267, 283, 263, 283, 283, + /* 1190 */ 283, 257, 296, 283, 283, 283, 283, 283, 319, 255, + /* 1200 */ 283, 265, 283, 171, 318, 324, 265, 312, 327, 328, + /* 1210 */ 329, 330, 331, 332, 298, 334, 263, 263, 337, 20, + /* 1220 */ 265, 229, 341, 342, 343, 359, 255, 283, 326, 296, + /* 1230 */ 228, 296, 359, 352, 307, 291, 12, 13, 307, 296, + /* 1240 */ 296, 296, 298, 235, 237, 154, 22, 362, 361, 236, + /* 1250 */ 322, 359, 224, 220, 283, 358, 291, 33, 20, 35, + /* 1260 */ 244, 241, 291, 325, 82, 307, 239, 296, 324, 298, + /* 1270 */ 307, 327, 328, 329, 330, 331, 332, 357, 334, 356, + /* 1280 */ 56, 337, 296, 296, 296, 341, 342, 343, 340, 65, + /* 1290 */ 296, 369, 296, 296, 305, 324, 352, 255, 327, 328, + /* 1300 */ 329, 330, 331, 332, 374, 334, 369, 368, 337, 369, + /* 1310 */ 368, 147, 341, 342, 343, 368, 279, 265, 304, 265, + /* 1320 */ 291, 291, 82, 352, 263, 283, 287, 265, 104, 273, + /* 1330 */ 296, 36, 258, 291, 257, 311, 266, 253, 296, 0, + /* 1340 */ 298, 277, 277, 277, 0, 42, 0, 73, 0, 35, + /* 1350 */ 183, 316, 35, 35, 35, 313, 183, 0, 35, 35, + /* 1360 */ 183, 0, 255, 183, 0, 35, 324, 0, 0, 327, + /* 1370 */ 328, 329, 330, 331, 332, 22, 334, 35, 0, 82, + /* 1380 */ 168, 167, 165, 163, 0, 0, 159, 163, 158, 165, + /* 1390 */ 283, 0, 0, 46, 0, 353, 0, 0, 291, 142, + /* 1400 */ 0, 0, 0, 296, 0, 298, 0, 137, 366, 35, + /* 1410 */ 0, 0, 370, 189, 137, 0, 0, 0, 0, 0, + /* 1420 */ 313, 0, 0, 0, 200, 201, 202, 203, 204, 205, + /* 1430 */ 206, 324, 0, 255, 327, 328, 329, 330, 331, 332, + /* 1440 */ 0, 334, 0, 0, 0, 42, 0, 0, 0, 0, + /* 1450 */ 0, 0, 22, 0, 0, 255, 42, 91, 46, 39, + /* 1460 */ 353, 283, 0, 0, 0, 0, 14, 43, 0, 291, + /* 1470 */ 39, 14, 46, 366, 296, 40, 298, 370, 0, 0, + /* 1480 */ 0, 154, 0, 283, 39, 0, 0, 60, 0, 0, + /* 1490 */ 35, 291, 0, 0, 35, 0, 296, 0, 298, 39, + /* 1500 */ 39, 0, 324, 0, 35, 327, 328, 329, 330, 331, + /* 1510 */ 332, 39, 334, 47, 47, 337, 35, 47, 255, 341, + /* 1520 */ 342, 47, 39, 0, 324, 89, 35, 327, 328, 329, + /* 1530 */ 330, 331, 332, 22, 334, 0, 255, 337, 0, 35, + /* 1540 */ 35, 341, 342, 35, 35, 43, 283, 35, 35, 43, + /* 1550 */ 35, 22, 0, 22, 291, 0, 49, 35, 22, 296, + /* 1560 */ 0, 298, 35, 0, 283, 35, 0, 22, 20, 0, + /* 1570 */ 0, 22, 291, 0, 35, 150, 169, 296, 150, 298, + /* 1580 */ 147, 0, 0, 0, 150, 0, 43, 324, 225, 255, + /* 1590 */ 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + /* 1600 */ 82, 43, 43, 83, 83, 324, 82, 82, 327, 328, + /* 1610 */ 329, 330, 331, 332, 82, 334, 83, 283, 337, 82, + /* 1620 */ 46, 46, 82, 342, 83, 291, 46, 152, 219, 43, + /* 1630 */ 296, 43, 298, 225, 83, 46, 83, 83, 43, 83, + /* 1640 */ 35, 35, 35, 255, 310, 2, 35, 35, 35, 46, + /* 1650 */ 83, 43, 22, 82, 255, 83, 0, 0, 324, 82, + /* 1660 */ 189, 327, 328, 329, 330, 331, 332, 46, 334, 82, + /* 1670 */ 39, 283, 82, 46, 83, 191, 83, 178, 82, 291, + /* 1680 */ 82, 46, 283, 225, 296, 83, 298, 22, 35, 92, + /* 1690 */ 291, 82, 148, 146, 93, 296, 82, 298, 82, 82, + /* 1700 */ 82, 22, 83, 35, 82, 35, 83, 82, 35, 83, + /* 1710 */ 82, 255, 324, 35, 82, 327, 328, 329, 330, 331, + /* 1720 */ 332, 83, 334, 324, 83, 35, 327, 328, 329, 330, + /* 1730 */ 331, 332, 255, 334, 82, 106, 94, 82, 35, 283, + /* 1740 */ 106, 82, 106, 106, 82, 43, 22, 291, 60, 35, + /* 1750 */ 65, 59, 296, 365, 298, 80, 43, 35, 35, 22, + /* 1760 */ 283, 35, 35, 35, 35, 35, 310, 35, 291, 65, + /* 1770 */ 35, 372, 0, 296, 255, 298, 35, 35, 35, 35, + /* 1780 */ 324, 35, 35, 327, 328, 329, 330, 331, 332, 39, + /* 1790 */ 334, 0, 47, 35, 39, 47, 0, 255, 35, 47, + /* 1800 */ 39, 324, 283, 0, 327, 328, 329, 330, 331, 332, + /* 1810 */ 291, 334, 35, 336, 47, 296, 0, 298, 39, 35, + /* 1820 */ 35, 0, 22, 21, 375, 283, 22, 22, 21, 310, + /* 1830 */ 20, 375, 375, 291, 375, 375, 375, 375, 296, 375, + /* 1840 */ 298, 375, 375, 324, 375, 375, 327, 328, 329, 330, + /* 1850 */ 331, 332, 310, 334, 255, 375, 375, 375, 375, 375, + /* 1860 */ 375, 375, 375, 375, 375, 255, 324, 375, 375, 327, + /* 1870 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 255, + /* 1880 */ 375, 375, 283, 375, 375, 375, 375, 375, 375, 375, + /* 1890 */ 291, 375, 375, 283, 375, 296, 375, 298, 375, 375, + /* 1900 */ 375, 291, 375, 375, 375, 375, 296, 283, 298, 375, + /* 1910 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 1920 */ 296, 255, 298, 324, 375, 375, 327, 328, 329, 330, + /* 1930 */ 331, 332, 375, 334, 324, 255, 375, 327, 328, 329, + /* 1940 */ 330, 331, 332, 375, 334, 375, 255, 375, 324, 283, + /* 1950 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, + /* 1960 */ 375, 375, 296, 283, 298, 375, 375, 375, 375, 375, + /* 1970 */ 375, 291, 375, 375, 283, 375, 296, 375, 298, 375, + /* 1980 */ 375, 375, 291, 375, 375, 375, 375, 296, 255, 298, + /* 1990 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2000 */ 334, 375, 375, 375, 324, 375, 375, 327, 328, 329, + /* 2010 */ 330, 331, 332, 375, 334, 324, 283, 375, 327, 328, + /* 2020 */ 329, 330, 331, 332, 291, 334, 375, 375, 375, 296, + /* 2030 */ 255, 298, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2040 */ 375, 255, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2050 */ 375, 375, 375, 255, 375, 375, 375, 324, 283, 375, + /* 2060 */ 327, 328, 329, 330, 331, 332, 291, 334, 375, 283, + /* 2070 */ 375, 296, 375, 298, 375, 375, 375, 291, 375, 375, + /* 2080 */ 375, 283, 296, 375, 298, 375, 375, 375, 375, 291, + /* 2090 */ 375, 375, 375, 375, 296, 375, 298, 375, 375, 324, + /* 2100 */ 375, 375, 327, 328, 329, 330, 331, 332, 255, 334, + /* 2110 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2120 */ 334, 375, 324, 375, 375, 327, 328, 329, 330, 331, + /* 2130 */ 332, 375, 334, 375, 375, 255, 283, 375, 375, 375, + /* 2140 */ 375, 375, 375, 375, 291, 375, 375, 375, 375, 296, + /* 2150 */ 375, 298, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2160 */ 375, 375, 255, 283, 375, 375, 375, 375, 375, 375, + /* 2170 */ 375, 291, 375, 375, 375, 375, 296, 324, 298, 375, + /* 2180 */ 327, 328, 329, 330, 331, 332, 375, 334, 375, 255, + /* 2190 */ 283, 375, 375, 375, 375, 375, 375, 375, 291, 375, + /* 2200 */ 375, 375, 375, 296, 324, 298, 375, 327, 328, 329, + /* 2210 */ 330, 331, 332, 375, 334, 375, 375, 283, 375, 375, + /* 2220 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 2230 */ 296, 324, 298, 375, 327, 328, 329, 330, 331, 332, + /* 2240 */ 375, 334, 375, 255, 375, 375, 375, 375, 375, 375, + /* 2250 */ 375, 375, 255, 375, 375, 375, 375, 375, 324, 375, + /* 2260 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 375, + /* 2270 */ 255, 283, 375, 375, 375, 375, 375, 375, 375, 291, + /* 2280 */ 283, 375, 375, 375, 296, 375, 298, 375, 291, 375, + /* 2290 */ 375, 375, 375, 296, 375, 298, 375, 375, 283, 375, + /* 2300 */ 375, 375, 375, 375, 375, 375, 291, 375, 375, 375, + /* 2310 */ 375, 296, 324, 298, 375, 327, 328, 329, 330, 331, + /* 2320 */ 332, 324, 334, 255, 327, 328, 329, 330, 331, 332, + /* 2330 */ 375, 334, 375, 375, 375, 375, 375, 255, 375, 324, + /* 2340 */ 375, 375, 327, 328, 329, 330, 331, 332, 375, 334, + /* 2350 */ 375, 283, 375, 375, 375, 375, 375, 375, 375, 291, + /* 2360 */ 375, 375, 375, 375, 296, 283, 298, 375, 375, 375, + /* 2370 */ 375, 375, 375, 291, 375, 375, 375, 375, 296, 375, + /* 2380 */ 298, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2390 */ 375, 255, 324, 375, 375, 327, 328, 329, 330, 331, + /* 2400 */ 332, 375, 334, 375, 375, 375, 324, 375, 375, 327, + /* 2410 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 283, + /* 2420 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, + /* 2430 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, + /* 2440 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2450 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2460 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2470 */ 334, }; -#define YY_SHIFT_COUNT (651) +#define YY_SHIFT_COUNT (652) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2296) +#define YY_SHIFT_MAX (1821) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 945, 0, 0, 57, 57, 252, 252, 252, 309, 309, - /* 10 */ 252, 252, 504, 561, 756, 561, 561, 561, 561, 561, - /* 20 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - /* 30 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - /* 40 */ 561, 561, 187, 187, 248, 248, 248, 1102, 1102, 1102, - /* 50 */ 1102, 185, 59, 246, 11, 11, 53, 53, 56, 10, - /* 60 */ 246, 246, 11, 11, 11, 11, 11, 11, 11, 11, - /* 70 */ 15, 11, 11, 11, 144, 154, 256, 11, 11, 256, - /* 80 */ 11, 256, 256, 256, 11, 241, 752, 839, 1003, 1003, - /* 90 */ 948, 111, 297, 297, 297, 297, 297, 297, 297, 297, - /* 100 */ 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - /* 110 */ 297, 273, 10, 122, 122, 335, 124, 325, 325, 325, - /* 120 */ 541, 124, 353, 154, 1, 1, 256, 256, 285, 285, - /* 130 */ 394, 358, 193, 193, 193, 193, 193, 193, 193, 511, - /* 140 */ 21, 14, 200, 84, 71, 69, 406, 82, 197, 332, - /* 150 */ 749, 745, 439, 649, 207, 649, 884, 495, 495, 495, - /* 160 */ 7, 812, 846, 1062, 1038, 1052, 929, 1062, 1062, 1053, - /* 170 */ 964, 964, 1062, 1097, 1097, 1101, 15, 154, 15, 1126, - /* 180 */ 1137, 15, 1126, 15, 1143, 15, 15, 1062, 15, 1097, - /* 190 */ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - /* 200 */ 256, 1062, 1097, 285, 1101, 241, 1036, 154, 241, 1062, - /* 210 */ 1062, 1126, 241, 1211, 285, 1008, 1011, 285, 1008, 1011, - /* 220 */ 285, 285, 256, 1006, 1104, 1008, 1033, 1043, 1069, 846, - /* 230 */ 1076, 353, 1276, 1068, 1073, 1072, 1068, 1073, 1068, 1073, - /* 240 */ 1229, 1011, 285, 285, 285, 285, 285, 1011, 285, 1183, - /* 250 */ 353, 1143, 241, 394, 241, 353, 1264, 285, 358, 1062, - /* 260 */ 241, 1326, 1097, 2447, 2447, 2447, 2447, 2447, 2447, 2447, - /* 270 */ 162, 1194, 123, 1085, 980, 371, 1248, 802, 811, 2296, - /* 280 */ 828, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1039, - /* 290 */ 1107, 224, 155, 155, 199, 225, 204, 312, 487, 433, - /* 300 */ 505, 505, 505, 505, 318, 484, 619, 595, 849, 856, - /* 310 */ 878, 901, 872, 991, 999, 950, 815, 602, 888, 1007, - /* 320 */ 882, 434, 764, 962, 798, 977, 976, 981, 985, 992, - /* 330 */ 994, 998, 975, 979, 1013, 1014, 1016, 1055, 1060, 1067, - /* 340 */ 443, 996, 529, 1372, 1377, 1336, 1380, 1308, 1382, 1348, - /* 350 */ 1203, 1351, 1352, 1353, 1208, 1390, 1356, 1358, 1213, 1395, - /* 360 */ 1216, 1398, 1364, 1400, 1381, 1404, 1376, 1414, 1335, 1250, - /* 370 */ 1249, 1257, 1260, 1424, 1425, 1272, 1269, 1430, 1432, 1387, - /* 380 */ 1434, 1435, 1436, 1296, 1439, 1440, 1441, 1443, 1445, 1309, - /* 390 */ 1412, 1448, 1312, 1450, 1455, 1456, 1468, 1469, 1471, 1472, - /* 400 */ 1481, 1482, 1483, 1484, 1485, 1486, 1488, 1410, 1453, 1489, - /* 410 */ 1490, 1491, 1493, 1496, 1475, 1498, 1499, 1500, 1501, 1502, - /* 420 */ 1504, 1463, 1467, 1470, 1497, 1461, 1505, 1466, 1514, 1476, - /* 430 */ 1492, 1515, 1529, 1532, 1495, 1393, 1535, 1548, 1551, 1494, - /* 440 */ 1553, 1555, 1521, 1511, 1520, 1560, 1526, 1516, 1527, 1565, - /* 450 */ 1533, 1522, 1528, 1570, 1537, 1530, 1536, 1573, 1574, 1576, - /* 460 */ 1579, 1510, 1503, 1554, 1558, 1591, 1567, 1568, 1569, 1571, - /* 470 */ 1562, 1566, 1575, 1578, 1581, 1608, 1589, 1617, 1596, 1572, - /* 480 */ 1620, 1600, 1590, 1624, 1592, 1629, 1597, 1631, 1611, 1614, - /* 490 */ 1635, 1487, 1601, 1641, 1473, 1627, 1507, 1506, 1651, 1652, - /* 500 */ 1508, 1513, 1654, 1669, 1670, 1628, 1449, 1594, 1595, 1599, - /* 510 */ 1602, 1630, 1603, 1605, 1606, 1607, 1609, 1634, 1633, 1638, - /* 520 */ 1613, 1647, 1451, 1610, 1616, 1655, 1480, 1659, 1658, 1623, - /* 530 */ 1660, 1477, 1626, 1672, 1684, 1685, 1686, 1687, 1688, 1626, - /* 540 */ 1723, 1539, 1692, 1653, 1656, 1661, 1691, 1665, 1667, 1693, - /* 550 */ 1718, 1561, 1673, 1668, 1671, 1674, 1742, 1675, 1604, 1677, - /* 560 */ 1743, 1722, 1618, 1680, 1676, 1717, 1719, 1690, 1683, 1694, - /* 570 */ 1745, 1701, 1682, 1702, 1734, 1735, 1706, 1712, 1738, 1715, - /* 580 */ 1720, 1765, 1724, 1721, 1766, 1726, 1727, 1767, 1729, 1703, - /* 590 */ 1707, 1710, 1713, 1783, 1728, 1736, 1739, 1782, 1747, 1777, - /* 600 */ 1777, 1802, 1771, 1768, 1790, 1770, 1752, 1793, 1798, 1803, - /* 610 */ 1807, 1814, 1817, 1815, 1818, 1819, 1792, 1562, 1820, 1566, - /* 620 */ 1823, 1830, 1834, 1843, 1845, 1846, 1876, 1847, 1836, 1849, - /* 630 */ 1884, 1850, 1839, 1851, 1889, 1856, 1848, 1858, 1898, 1864, - /* 640 */ 1853, 1862, 1902, 1868, 1870, 1906, 1885, 1887, 1890, 1891, - /* 650 */ 1894, 1896, + /* 0 */ 891, 0, 0, 57, 57, 254, 254, 254, 311, 311, + /* 10 */ 254, 254, 508, 565, 762, 565, 565, 565, 565, 565, + /* 20 */ 565, 565, 565, 565, 565, 565, 565, 565, 565, 565, + /* 30 */ 565, 565, 565, 565, 565, 565, 565, 565, 565, 565, + /* 40 */ 565, 565, 302, 302, 85, 85, 85, 1224, 1224, 1224, + /* 50 */ 1224, 54, 86, 202, 154, 154, 53, 53, 56, 190, + /* 60 */ 202, 202, 154, 154, 154, 154, 154, 154, 154, 154, + /* 70 */ 15, 154, 154, 154, 171, 214, 298, 154, 154, 298, + /* 80 */ 154, 298, 298, 298, 154, 274, 758, 223, 477, 477, + /* 90 */ 267, 409, 755, 755, 755, 755, 755, 755, 755, 755, + /* 100 */ 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, + /* 110 */ 755, 66, 190, 209, 209, 38, 433, 457, 457, 457, + /* 120 */ 123, 433, 318, 214, 31, 31, 298, 298, 423, 423, + /* 130 */ 306, 429, 252, 252, 252, 252, 252, 252, 252, 131, + /* 140 */ 21, 14, 374, 233, 71, 388, 511, 88, 199, 315, + /* 150 */ 770, 512, 546, 610, 784, 610, 819, 665, 665, 665, + /* 160 */ 792, 617, 863, 1072, 1060, 1089, 966, 1072, 1072, 1105, + /* 170 */ 1004, 1004, 1072, 1134, 1134, 1137, 15, 214, 15, 1142, + /* 180 */ 1145, 15, 1142, 15, 1147, 15, 15, 1072, 15, 1134, + /* 190 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + /* 200 */ 298, 1072, 1134, 423, 1137, 274, 1032, 214, 274, 1072, + /* 210 */ 1072, 1142, 274, 1199, 423, 992, 1002, 423, 992, 1002, + /* 220 */ 423, 423, 298, 1008, 1091, 992, 1007, 1013, 1028, 863, + /* 230 */ 1033, 318, 1238, 1020, 1027, 1016, 1020, 1027, 1020, 1027, + /* 240 */ 1182, 1002, 423, 423, 423, 423, 423, 1002, 423, 1164, + /* 250 */ 318, 1147, 274, 306, 274, 318, 1240, 423, 429, 1072, + /* 260 */ 274, 1295, 1134, 2471, 2471, 2471, 2471, 2471, 2471, 2471, + /* 270 */ 334, 502, 717, 96, 412, 580, 648, 839, 855, 1019, + /* 280 */ 926, 980, 980, 980, 980, 980, 980, 980, 980, 431, + /* 290 */ 685, 226, 365, 365, 425, 485, 161, 50, 249, 570, + /* 300 */ 328, 355, 355, 355, 355, 699, 739, 956, 746, 818, + /* 310 */ 835, 837, 900, 981, 1023, 921, 727, 967, 970, 929, + /* 320 */ 857, 803, 867, 1006, 335, 1012, 960, 1021, 1025, 1031, + /* 330 */ 1045, 1051, 972, 973, 1059, 1090, 1097, 1098, 1100, 1101, + /* 340 */ 974, 1026, 1036, 1339, 1344, 1303, 1346, 1274, 1348, 1314, + /* 350 */ 1167, 1317, 1318, 1319, 1173, 1357, 1323, 1324, 1177, 1361, + /* 360 */ 1180, 1364, 1330, 1367, 1353, 1368, 1342, 1378, 1297, 1212, + /* 370 */ 1214, 1217, 1220, 1384, 1385, 1227, 1230, 1391, 1392, 1347, + /* 380 */ 1394, 1396, 1397, 1257, 1400, 1401, 1402, 1404, 1406, 1270, + /* 390 */ 1374, 1410, 1277, 1411, 1415, 1416, 1417, 1418, 1419, 1421, + /* 400 */ 1422, 1423, 1432, 1440, 1442, 1443, 1444, 1403, 1446, 1447, + /* 410 */ 1448, 1449, 1450, 1451, 1430, 1453, 1454, 1462, 1463, 1464, + /* 420 */ 1465, 1414, 1420, 1424, 1452, 1412, 1457, 1426, 1468, 1435, + /* 430 */ 1431, 1478, 1479, 1480, 1445, 1327, 1482, 1485, 1486, 1427, + /* 440 */ 1488, 1489, 1455, 1466, 1460, 1492, 1459, 1467, 1461, 1493, + /* 450 */ 1469, 1470, 1472, 1495, 1481, 1474, 1483, 1497, 1501, 1503, + /* 460 */ 1523, 1366, 1436, 1491, 1511, 1535, 1504, 1505, 1508, 1509, + /* 470 */ 1502, 1506, 1512, 1513, 1515, 1538, 1529, 1552, 1531, 1507, + /* 480 */ 1555, 1536, 1522, 1560, 1527, 1563, 1530, 1566, 1545, 1548, + /* 490 */ 1569, 1425, 1539, 1570, 1407, 1549, 1428, 1433, 1573, 1581, + /* 500 */ 1434, 1475, 1582, 1583, 1585, 1543, 1363, 1518, 1520, 1524, + /* 510 */ 1521, 1558, 1533, 1525, 1532, 1537, 1541, 1559, 1574, 1575, + /* 520 */ 1540, 1586, 1408, 1551, 1553, 1580, 1409, 1588, 1589, 1554, + /* 530 */ 1595, 1458, 1556, 1605, 1606, 1607, 1611, 1612, 1613, 1556, + /* 540 */ 1643, 1471, 1608, 1567, 1571, 1572, 1603, 1577, 1587, 1621, + /* 550 */ 1630, 1484, 1590, 1591, 1593, 1596, 1499, 1656, 1598, 1544, + /* 560 */ 1609, 1657, 1631, 1547, 1614, 1597, 1627, 1635, 1616, 1602, + /* 570 */ 1617, 1665, 1618, 1601, 1619, 1653, 1668, 1622, 1623, 1670, + /* 580 */ 1625, 1626, 1673, 1628, 1638, 1678, 1632, 1641, 1690, 1652, + /* 590 */ 1629, 1634, 1636, 1637, 1679, 1642, 1655, 1659, 1703, 1662, + /* 600 */ 1702, 1702, 1724, 1688, 1692, 1714, 1685, 1675, 1713, 1722, + /* 610 */ 1723, 1726, 1727, 1728, 1737, 1729, 1730, 1704, 1502, 1732, + /* 620 */ 1506, 1735, 1741, 1742, 1743, 1744, 1746, 1772, 1747, 1745, + /* 630 */ 1750, 1791, 1758, 1748, 1755, 1796, 1763, 1752, 1761, 1803, + /* 640 */ 1777, 1767, 1779, 1816, 1784, 1785, 1821, 1800, 1802, 1804, + /* 650 */ 1805, 1807, 1810, }; #define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-327) -#define YY_REDUCE_MAX (2006) +#define YY_REDUCE_MIN (-329) +#define YY_REDUCE_MAX (2136) static const short yy_reduce_ofst[] = { - /* 0 */ -244, 70, 322, -195, 575, 141, 393, 853, 944, 1028, - /* 10 */ 744, 1080, 1132, 1148, 1198, 1214, 1256, 1268, 1318, 1334, - /* 20 */ 1386, 1402, 1452, 1464, 1518, 1534, 1545, 1598, 1615, 1640, - /* 30 */ 1657, 1699, 1711, 1761, 1779, 1829, 1841, 1893, 1911, 1935, - /* 40 */ 1953, 2006, 261, 291, -234, 203, 452, -278, -260, -258, - /* 50 */ 453, -283, 65, 172, 64, 147, -257, -250, -327, -277, - /* 60 */ -85, -44, 266, 270, 296, 315, 321, 352, 455, 516, - /* 70 */ 125, 573, 574, 645, -249, -86, -173, 648, 651, -11, - /* 80 */ 652, 205, 265, 298, 709, 148, -232, -298, -298, -298, - /* 90 */ -149, -110, 167, 290, 338, 362, 381, 417, 418, 423, - /* 100 */ 435, 477, 486, 489, 492, 493, 537, 555, 556, 576, - /* 110 */ 605, -276, -170, -79, 114, 269, 101, 330, 391, 483, - /* 120 */ -106, 396, 118, 183, 431, 559, 403, 264, 501, 634, - /* 130 */ 655, 13, 251, 339, 345, 386, 468, 491, 502, 299, - /* 140 */ 346, 465, 451, 440, 597, 590, 560, 658, 658, 671, - /* 150 */ 763, 733, 705, 681, 681, 681, 690, 677, 678, 679, - /* 160 */ 684, 658, 758, 819, 767, 821, 778, 831, 832, 807, - /* 170 */ 813, 814, 855, 864, 865, 806, 861, 843, 880, 841, - /* 180 */ 847, 895, 851, 897, 863, 903, 905, 911, 908, 919, - /* 190 */ 896, 906, 909, 910, 914, 915, 917, 918, 921, 923, - /* 200 */ 924, 925, 934, 890, 859, 937, 892, 913, 963, 967, - /* 210 */ 968, 920, 969, 912, 940, 885, 938, 951, 887, 946, - /* 220 */ 958, 959, 658, 894, 900, 931, 926, 935, 939, 972, - /* 230 */ 681, 1009, 974, 932, 947, 943, 949, 952, 953, 955, - /* 240 */ 987, 1018, 1025, 1032, 1034, 1035, 1040, 1022, 1041, 1029, - /* 250 */ 1047, 1042, 1074, 1061, 1079, 1056, 1063, 1057, 1078, 1091, - /* 260 */ 1096, 1108, 1110, 1049, 1058, 1093, 1095, 1098, 1111, 1120, + /* 0 */ -246, 688, 769, -197, 789, 881, 944, 971, 1042, 1107, + /* 10 */ 1178, 1200, 1263, 348, 1281, 1334, 1388, 1399, 1456, 1477, + /* 20 */ 1519, 1542, 1599, 1610, 1624, 1666, 1680, 1691, 1733, 1775, + /* 30 */ 1786, 1798, 1853, 1880, 1907, 1934, 1988, 1997, 2015, 2068, + /* 40 */ 2082, 2136, 288, 490, -236, -122, -20, -280, -262, -260, + /* 50 */ -55, -285, -80, -41, 206, 289, -259, -252, -329, -279, + /* 60 */ -126, -49, 268, 341, 342, 351, 459, 460, 461, 517, + /* 70 */ -250, 520, 543, 559, -251, -181, -104, 642, 645, 270, + /* 80 */ 709, 292, 330, 299, 711, 332, -234, -190, -190, -190, + /* 90 */ -99, 146, 120, 244, 354, 356, 385, 444, 532, 549, + /* 100 */ 569, 576, 621, 651, 657, 682, 691, 694, 695, 725, + /* 110 */ 742, 20, 229, -101, 407, 11, 264, 464, 467, 500, + /* 120 */ 80, 456, 83, 7, -307, -97, 189, 325, 149, 436, + /* 130 */ 442, 640, -273, 266, 297, 443, 452, 472, 509, 259, + /* 140 */ 563, 554, 469, 494, 609, 595, 622, 715, 715, 773, + /* 150 */ 764, 745, 733, 712, 712, 712, 718, 702, 704, 714, + /* 160 */ 729, 715, 768, 842, 794, 856, 814, 882, 883, 845, + /* 170 */ 849, 850, 890, 898, 899, 840, 893, 860, 894, 851, + /* 180 */ 852, 901, 858, 904, 870, 908, 909, 915, 918, 925, + /* 190 */ 903, 905, 906, 907, 910, 911, 912, 913, 914, 917, + /* 200 */ 919, 924, 934, 896, 879, 936, 886, 916, 941, 953, + /* 210 */ 954, 895, 955, 902, 933, 866, 927, 935, 873, 931, + /* 220 */ 943, 945, 715, 885, 887, 892, 897, 920, 923, 928, + /* 230 */ 712, 965, 938, 922, 939, 930, 937, 942, 940, 947, + /* 240 */ 948, 958, 986, 987, 988, 994, 996, 963, 997, 989, + /* 250 */ 1029, 1014, 1052, 1037, 1054, 1030, 1039, 1034, 1056, 1061, + /* 260 */ 1062, 1074, 1077, 1035, 1024, 1064, 1065, 1066, 1070, 1084, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 10 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 20 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 30 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 40 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 50 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 60 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 70 */ 1506, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 80 */ 1434, 1434, 1434, 1434, 1434, 1504, 1657, 1434, 1832, 1434, - /* 90 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 100 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 110 */ 1434, 1434, 1434, 1434, 1434, 1506, 1434, 1844, 1844, 1844, - /* 120 */ 1504, 1434, 1434, 1434, 1701, 1701, 1434, 1434, 1434, 1434, - /* 130 */ 1600, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1693, - /* 140 */ 1434, 1434, 1913, 1434, 1434, 1699, 1867, 1434, 1434, 1434, - /* 150 */ 1434, 1553, 1859, 1836, 1850, 1837, 1834, 1898, 1898, 1898, - /* 160 */ 1853, 1434, 1863, 1434, 1434, 1434, 1685, 1434, 1434, 1662, - /* 170 */ 1659, 1659, 1434, 1434, 1434, 1434, 1506, 1434, 1506, 1434, - /* 180 */ 1434, 1506, 1434, 1506, 1434, 1506, 1506, 1434, 1506, 1434, - /* 190 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 200 */ 1434, 1434, 1434, 1434, 1434, 1504, 1695, 1434, 1504, 1434, - /* 210 */ 1434, 1434, 1504, 1434, 1434, 1874, 1872, 1434, 1874, 1872, - /* 220 */ 1434, 1434, 1434, 1886, 1882, 1874, 1890, 1888, 1865, 1863, - /* 230 */ 1850, 1434, 1434, 1904, 1900, 1916, 1904, 1900, 1904, 1900, - /* 240 */ 1434, 1872, 1434, 1434, 1434, 1434, 1434, 1872, 1434, 1434, - /* 250 */ 1434, 1434, 1504, 1434, 1504, 1434, 1569, 1434, 1434, 1434, - /* 260 */ 1504, 1466, 1434, 1687, 1701, 1603, 1603, 1603, 1507, 1439, - /* 270 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 280 */ 1434, 1770, 1885, 1884, 1808, 1807, 1806, 1804, 1769, 1434, - /* 290 */ 1434, 1565, 1768, 1767, 1434, 1434, 1434, 1434, 1434, 1434, - /* 300 */ 1761, 1762, 1760, 1759, 1434, 1434, 1434, 1434, 1434, 1434, - /* 310 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1833, - /* 320 */ 1434, 1901, 1905, 1434, 1434, 1434, 1744, 1434, 1434, 1434, - /* 330 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 340 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 350 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 360 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 370 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 380 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 390 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 400 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 410 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 420 */ 1434, 1434, 1434, 1471, 1434, 1434, 1434, 1434, 1434, 1434, - /* 430 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 440 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 450 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 460 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 470 */ 1534, 1533, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 480 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 490 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 500 */ 1434, 1434, 1434, 1434, 1434, 1866, 1434, 1434, 1434, 1434, - /* 510 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1744, - /* 520 */ 1434, 1883, 1434, 1843, 1839, 1434, 1434, 1835, 1434, 1434, - /* 530 */ 1899, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 540 */ 1828, 1434, 1801, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 550 */ 1434, 1755, 1434, 1434, 1434, 1434, 1705, 1434, 1434, 1434, - /* 560 */ 1434, 1434, 1434, 1434, 1434, 1743, 1434, 1786, 1434, 1434, - /* 570 */ 1434, 1434, 1434, 1434, 1434, 1434, 1597, 1434, 1434, 1434, - /* 580 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1582, - /* 590 */ 1580, 1579, 1578, 1434, 1575, 1434, 1434, 1434, 1434, 1606, - /* 600 */ 1605, 1434, 1434, 1434, 1434, 1434, 1434, 1526, 1434, 1434, - /* 610 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1517, 1434, 1516, - /* 620 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 630 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 640 */ 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, 1434, - /* 650 */ 1434, 1434, + /* 0 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 10 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 20 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 30 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 40 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 50 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 60 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 70 */ 1509, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 80 */ 1437, 1437, 1437, 1437, 1437, 1507, 1660, 1437, 1836, 1437, + /* 90 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 100 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 110 */ 1437, 1437, 1437, 1437, 1437, 1509, 1437, 1848, 1848, 1848, + /* 120 */ 1507, 1437, 1437, 1437, 1704, 1704, 1437, 1437, 1437, 1437, + /* 130 */ 1603, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1696, + /* 140 */ 1437, 1437, 1917, 1437, 1437, 1702, 1871, 1437, 1437, 1437, + /* 150 */ 1437, 1556, 1863, 1840, 1854, 1841, 1838, 1902, 1902, 1902, + /* 160 */ 1857, 1437, 1867, 1437, 1437, 1437, 1688, 1437, 1437, 1665, + /* 170 */ 1662, 1662, 1437, 1437, 1437, 1437, 1509, 1437, 1509, 1437, + /* 180 */ 1437, 1509, 1437, 1509, 1437, 1509, 1509, 1437, 1509, 1437, + /* 190 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 200 */ 1437, 1437, 1437, 1437, 1437, 1507, 1698, 1437, 1507, 1437, + /* 210 */ 1437, 1437, 1507, 1437, 1437, 1878, 1876, 1437, 1878, 1876, + /* 220 */ 1437, 1437, 1437, 1890, 1886, 1878, 1894, 1892, 1869, 1867, + /* 230 */ 1854, 1437, 1437, 1908, 1904, 1920, 1908, 1904, 1908, 1904, + /* 240 */ 1437, 1876, 1437, 1437, 1437, 1437, 1437, 1876, 1437, 1437, + /* 250 */ 1437, 1437, 1507, 1437, 1507, 1437, 1572, 1437, 1437, 1437, + /* 260 */ 1507, 1469, 1437, 1690, 1704, 1606, 1606, 1606, 1510, 1442, + /* 270 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 280 */ 1437, 1774, 1889, 1888, 1812, 1811, 1810, 1808, 1773, 1437, + /* 290 */ 1437, 1568, 1772, 1771, 1437, 1437, 1437, 1437, 1437, 1437, + /* 300 */ 1437, 1765, 1766, 1764, 1763, 1437, 1437, 1437, 1437, 1437, + /* 310 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1837, + /* 320 */ 1437, 1905, 1909, 1437, 1437, 1437, 1748, 1437, 1437, 1437, + /* 330 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 340 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 350 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 360 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 370 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 380 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 390 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 400 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 410 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 420 */ 1437, 1437, 1437, 1474, 1437, 1437, 1437, 1437, 1437, 1437, + /* 430 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 440 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 450 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 460 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 470 */ 1537, 1536, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 480 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 490 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 500 */ 1437, 1437, 1437, 1437, 1437, 1870, 1437, 1437, 1437, 1437, + /* 510 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1748, + /* 520 */ 1437, 1887, 1437, 1847, 1843, 1437, 1437, 1839, 1437, 1437, + /* 530 */ 1903, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 540 */ 1832, 1437, 1805, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 550 */ 1437, 1759, 1437, 1437, 1437, 1437, 1437, 1708, 1437, 1437, + /* 560 */ 1437, 1437, 1437, 1437, 1437, 1437, 1747, 1437, 1790, 1437, + /* 570 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1600, 1437, 1437, + /* 580 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 590 */ 1585, 1583, 1582, 1581, 1437, 1578, 1437, 1437, 1437, 1437, + /* 600 */ 1609, 1608, 1437, 1437, 1437, 1437, 1437, 1437, 1529, 1437, + /* 610 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1520, 1437, + /* 620 */ 1519, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 630 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 640 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 650 */ 1437, 1437, 1437, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1088,6 +1083,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ + 0, /* IGNORE => nothing */ + 0, /* EXPIRED => nothing */ 0, /* KILL => nothing */ 0, /* CONNECTION => nothing */ 0, /* TRANSACTION => nothing */ @@ -1155,12 +1152,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 243, /* NK_BITNOT => ID */ - 243, /* INSERT => ID */ - 243, /* VALUES => ID */ - 243, /* IMPORT => ID */ - 243, /* NK_SEMI => ID */ - 243, /* FILE => ID */ + 245, /* NK_BITNOT => ID */ + 245, /* INSERT => ID */ + 245, /* VALUES => ID */ + 245, /* IMPORT => ID */ + 245, /* NK_SEMI => ID */ + 245, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1425,202 +1422,204 @@ static const char *const yyTokenName[] = { /* 174 */ "TRIGGER", /* 175 */ "AT_ONCE", /* 176 */ "WINDOW_CLOSE", - /* 177 */ "KILL", - /* 178 */ "CONNECTION", - /* 179 */ "TRANSACTION", - /* 180 */ "BALANCE", - /* 181 */ "VGROUP", - /* 182 */ "MERGE", - /* 183 */ "REDISTRIBUTE", - /* 184 */ "SPLIT", - /* 185 */ "SYNCDB", - /* 186 */ "DELETE", - /* 187 */ "NULL", - /* 188 */ "NK_QUESTION", - /* 189 */ "NK_ARROW", - /* 190 */ "ROWTS", - /* 191 */ "TBNAME", - /* 192 */ "QSTARTTS", - /* 193 */ "QENDTS", - /* 194 */ "WSTARTTS", - /* 195 */ "WENDTS", - /* 196 */ "WDURATION", - /* 197 */ "CAST", - /* 198 */ "NOW", - /* 199 */ "TODAY", - /* 200 */ "TIMEZONE", - /* 201 */ "CLIENT_VERSION", - /* 202 */ "SERVER_VERSION", - /* 203 */ "SERVER_STATUS", - /* 204 */ "CURRENT_USER", - /* 205 */ "COUNT", - /* 206 */ "LAST_ROW", - /* 207 */ "BETWEEN", - /* 208 */ "IS", - /* 209 */ "NK_LT", - /* 210 */ "NK_GT", - /* 211 */ "NK_LE", - /* 212 */ "NK_GE", - /* 213 */ "NK_NE", - /* 214 */ "MATCH", - /* 215 */ "NMATCH", - /* 216 */ "CONTAINS", - /* 217 */ "JOIN", - /* 218 */ "INNER", - /* 219 */ "SELECT", - /* 220 */ "DISTINCT", - /* 221 */ "WHERE", - /* 222 */ "PARTITION", - /* 223 */ "BY", - /* 224 */ "SESSION", - /* 225 */ "STATE_WINDOW", - /* 226 */ "SLIDING", - /* 227 */ "FILL", - /* 228 */ "VALUE", - /* 229 */ "NONE", - /* 230 */ "PREV", - /* 231 */ "LINEAR", - /* 232 */ "NEXT", - /* 233 */ "HAVING", - /* 234 */ "RANGE", - /* 235 */ "EVERY", - /* 236 */ "ORDER", - /* 237 */ "SLIMIT", - /* 238 */ "SOFFSET", - /* 239 */ "LIMIT", - /* 240 */ "OFFSET", - /* 241 */ "ASC", - /* 242 */ "NULLS", - /* 243 */ "ID", - /* 244 */ "NK_BITNOT", - /* 245 */ "INSERT", - /* 246 */ "VALUES", - /* 247 */ "IMPORT", - /* 248 */ "NK_SEMI", - /* 249 */ "FILE", - /* 250 */ "cmd", - /* 251 */ "account_options", - /* 252 */ "alter_account_options", - /* 253 */ "literal", - /* 254 */ "alter_account_option", - /* 255 */ "user_name", - /* 256 */ "sysinfo_opt", - /* 257 */ "privileges", - /* 258 */ "priv_level", - /* 259 */ "priv_type_list", - /* 260 */ "priv_type", - /* 261 */ "db_name", - /* 262 */ "dnode_endpoint", - /* 263 */ "not_exists_opt", - /* 264 */ "db_options", - /* 265 */ "exists_opt", - /* 266 */ "alter_db_options", - /* 267 */ "integer_list", - /* 268 */ "variable_list", - /* 269 */ "retention_list", - /* 270 */ "alter_db_option", - /* 271 */ "retention", - /* 272 */ "full_table_name", - /* 273 */ "column_def_list", - /* 274 */ "tags_def_opt", - /* 275 */ "table_options", - /* 276 */ "multi_create_clause", - /* 277 */ "tags_def", - /* 278 */ "multi_drop_clause", - /* 279 */ "alter_table_clause", - /* 280 */ "alter_table_options", - /* 281 */ "column_name", - /* 282 */ "type_name", - /* 283 */ "signed_literal", - /* 284 */ "create_subtable_clause", - /* 285 */ "specific_tags_opt", - /* 286 */ "literal_list", - /* 287 */ "drop_table_clause", - /* 288 */ "col_name_list", - /* 289 */ "table_name", - /* 290 */ "column_def", - /* 291 */ "duration_list", - /* 292 */ "rollup_func_list", - /* 293 */ "alter_table_option", - /* 294 */ "duration_literal", - /* 295 */ "rollup_func_name", - /* 296 */ "function_name", - /* 297 */ "col_name", - /* 298 */ "db_name_cond_opt", - /* 299 */ "like_pattern_opt", - /* 300 */ "table_name_cond", - /* 301 */ "from_db_opt", - /* 302 */ "index_name", - /* 303 */ "index_options", - /* 304 */ "func_list", - /* 305 */ "sliding_opt", - /* 306 */ "sma_stream_opt", - /* 307 */ "func", - /* 308 */ "expression_list", - /* 309 */ "stream_options", - /* 310 */ "topic_name", - /* 311 */ "query_expression", - /* 312 */ "cgroup_name", - /* 313 */ "analyze_opt", - /* 314 */ "explain_options", - /* 315 */ "agg_func_opt", - /* 316 */ "bufsize_opt", - /* 317 */ "stream_name", - /* 318 */ "into_opt", - /* 319 */ "dnode_list", - /* 320 */ "where_clause_opt", - /* 321 */ "signed", - /* 322 */ "literal_func", - /* 323 */ "table_alias", - /* 324 */ "column_alias", - /* 325 */ "expression", - /* 326 */ "pseudo_column", - /* 327 */ "column_reference", - /* 328 */ "function_expression", - /* 329 */ "subquery", - /* 330 */ "star_func", - /* 331 */ "star_func_para_list", - /* 332 */ "noarg_func", - /* 333 */ "other_para_list", - /* 334 */ "star_func_para", - /* 335 */ "predicate", - /* 336 */ "compare_op", - /* 337 */ "in_op", - /* 338 */ "in_predicate_value", - /* 339 */ "boolean_value_expression", - /* 340 */ "boolean_primary", - /* 341 */ "common_expression", - /* 342 */ "from_clause_opt", - /* 343 */ "table_reference_list", - /* 344 */ "table_reference", - /* 345 */ "table_primary", - /* 346 */ "joined_table", - /* 347 */ "alias_opt", - /* 348 */ "parenthesized_joined_table", - /* 349 */ "join_type", - /* 350 */ "search_condition", - /* 351 */ "query_specification", - /* 352 */ "set_quantifier_opt", - /* 353 */ "select_list", - /* 354 */ "partition_by_clause_opt", - /* 355 */ "range_opt", - /* 356 */ "every_opt", - /* 357 */ "fill_opt", - /* 358 */ "twindow_clause_opt", - /* 359 */ "group_by_clause_opt", - /* 360 */ "having_clause_opt", - /* 361 */ "select_item", - /* 362 */ "fill_mode", - /* 363 */ "group_by_list", - /* 364 */ "query_expression_body", - /* 365 */ "order_by_clause_opt", - /* 366 */ "slimit_clause_opt", - /* 367 */ "limit_clause_opt", - /* 368 */ "query_primary", - /* 369 */ "sort_specification_list", - /* 370 */ "sort_specification", - /* 371 */ "ordering_specification_opt", - /* 372 */ "null_ordering_opt", + /* 177 */ "IGNORE", + /* 178 */ "EXPIRED", + /* 179 */ "KILL", + /* 180 */ "CONNECTION", + /* 181 */ "TRANSACTION", + /* 182 */ "BALANCE", + /* 183 */ "VGROUP", + /* 184 */ "MERGE", + /* 185 */ "REDISTRIBUTE", + /* 186 */ "SPLIT", + /* 187 */ "SYNCDB", + /* 188 */ "DELETE", + /* 189 */ "NULL", + /* 190 */ "NK_QUESTION", + /* 191 */ "NK_ARROW", + /* 192 */ "ROWTS", + /* 193 */ "TBNAME", + /* 194 */ "QSTARTTS", + /* 195 */ "QENDTS", + /* 196 */ "WSTARTTS", + /* 197 */ "WENDTS", + /* 198 */ "WDURATION", + /* 199 */ "CAST", + /* 200 */ "NOW", + /* 201 */ "TODAY", + /* 202 */ "TIMEZONE", + /* 203 */ "CLIENT_VERSION", + /* 204 */ "SERVER_VERSION", + /* 205 */ "SERVER_STATUS", + /* 206 */ "CURRENT_USER", + /* 207 */ "COUNT", + /* 208 */ "LAST_ROW", + /* 209 */ "BETWEEN", + /* 210 */ "IS", + /* 211 */ "NK_LT", + /* 212 */ "NK_GT", + /* 213 */ "NK_LE", + /* 214 */ "NK_GE", + /* 215 */ "NK_NE", + /* 216 */ "MATCH", + /* 217 */ "NMATCH", + /* 218 */ "CONTAINS", + /* 219 */ "JOIN", + /* 220 */ "INNER", + /* 221 */ "SELECT", + /* 222 */ "DISTINCT", + /* 223 */ "WHERE", + /* 224 */ "PARTITION", + /* 225 */ "BY", + /* 226 */ "SESSION", + /* 227 */ "STATE_WINDOW", + /* 228 */ "SLIDING", + /* 229 */ "FILL", + /* 230 */ "VALUE", + /* 231 */ "NONE", + /* 232 */ "PREV", + /* 233 */ "LINEAR", + /* 234 */ "NEXT", + /* 235 */ "HAVING", + /* 236 */ "RANGE", + /* 237 */ "EVERY", + /* 238 */ "ORDER", + /* 239 */ "SLIMIT", + /* 240 */ "SOFFSET", + /* 241 */ "LIMIT", + /* 242 */ "OFFSET", + /* 243 */ "ASC", + /* 244 */ "NULLS", + /* 245 */ "ID", + /* 246 */ "NK_BITNOT", + /* 247 */ "INSERT", + /* 248 */ "VALUES", + /* 249 */ "IMPORT", + /* 250 */ "NK_SEMI", + /* 251 */ "FILE", + /* 252 */ "cmd", + /* 253 */ "account_options", + /* 254 */ "alter_account_options", + /* 255 */ "literal", + /* 256 */ "alter_account_option", + /* 257 */ "user_name", + /* 258 */ "sysinfo_opt", + /* 259 */ "privileges", + /* 260 */ "priv_level", + /* 261 */ "priv_type_list", + /* 262 */ "priv_type", + /* 263 */ "db_name", + /* 264 */ "dnode_endpoint", + /* 265 */ "not_exists_opt", + /* 266 */ "db_options", + /* 267 */ "exists_opt", + /* 268 */ "alter_db_options", + /* 269 */ "integer_list", + /* 270 */ "variable_list", + /* 271 */ "retention_list", + /* 272 */ "alter_db_option", + /* 273 */ "retention", + /* 274 */ "full_table_name", + /* 275 */ "column_def_list", + /* 276 */ "tags_def_opt", + /* 277 */ "table_options", + /* 278 */ "multi_create_clause", + /* 279 */ "tags_def", + /* 280 */ "multi_drop_clause", + /* 281 */ "alter_table_clause", + /* 282 */ "alter_table_options", + /* 283 */ "column_name", + /* 284 */ "type_name", + /* 285 */ "signed_literal", + /* 286 */ "create_subtable_clause", + /* 287 */ "specific_tags_opt", + /* 288 */ "literal_list", + /* 289 */ "drop_table_clause", + /* 290 */ "col_name_list", + /* 291 */ "table_name", + /* 292 */ "column_def", + /* 293 */ "duration_list", + /* 294 */ "rollup_func_list", + /* 295 */ "alter_table_option", + /* 296 */ "duration_literal", + /* 297 */ "rollup_func_name", + /* 298 */ "function_name", + /* 299 */ "col_name", + /* 300 */ "db_name_cond_opt", + /* 301 */ "like_pattern_opt", + /* 302 */ "table_name_cond", + /* 303 */ "from_db_opt", + /* 304 */ "index_name", + /* 305 */ "index_options", + /* 306 */ "func_list", + /* 307 */ "sliding_opt", + /* 308 */ "sma_stream_opt", + /* 309 */ "func", + /* 310 */ "expression_list", + /* 311 */ "stream_options", + /* 312 */ "topic_name", + /* 313 */ "query_expression", + /* 314 */ "cgroup_name", + /* 315 */ "analyze_opt", + /* 316 */ "explain_options", + /* 317 */ "agg_func_opt", + /* 318 */ "bufsize_opt", + /* 319 */ "stream_name", + /* 320 */ "into_opt", + /* 321 */ "dnode_list", + /* 322 */ "where_clause_opt", + /* 323 */ "signed", + /* 324 */ "literal_func", + /* 325 */ "table_alias", + /* 326 */ "column_alias", + /* 327 */ "expression", + /* 328 */ "pseudo_column", + /* 329 */ "column_reference", + /* 330 */ "function_expression", + /* 331 */ "subquery", + /* 332 */ "star_func", + /* 333 */ "star_func_para_list", + /* 334 */ "noarg_func", + /* 335 */ "other_para_list", + /* 336 */ "star_func_para", + /* 337 */ "predicate", + /* 338 */ "compare_op", + /* 339 */ "in_op", + /* 340 */ "in_predicate_value", + /* 341 */ "boolean_value_expression", + /* 342 */ "boolean_primary", + /* 343 */ "common_expression", + /* 344 */ "from_clause_opt", + /* 345 */ "table_reference_list", + /* 346 */ "table_reference", + /* 347 */ "table_primary", + /* 348 */ "joined_table", + /* 349 */ "alias_opt", + /* 350 */ "parenthesized_joined_table", + /* 351 */ "join_type", + /* 352 */ "search_condition", + /* 353 */ "query_specification", + /* 354 */ "set_quantifier_opt", + /* 355 */ "select_list", + /* 356 */ "partition_by_clause_opt", + /* 357 */ "range_opt", + /* 358 */ "every_opt", + /* 359 */ "fill_opt", + /* 360 */ "twindow_clause_opt", + /* 361 */ "group_by_clause_opt", + /* 362 */ "having_clause_opt", + /* 363 */ "select_item", + /* 364 */ "fill_mode", + /* 365 */ "group_by_list", + /* 366 */ "query_expression_body", + /* 367 */ "order_by_clause_opt", + /* 368 */ "slimit_clause_opt", + /* 369 */ "limit_clause_opt", + /* 370 */ "query_primary", + /* 371 */ "sort_specification_list", + /* 372 */ "sort_specification", + /* 373 */ "ordering_specification_opt", + /* 374 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1897,219 +1896,220 @@ static const char *const yyRuleName[] = { /* 266 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", /* 267 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", /* 268 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 269 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 270 */ "cmd ::= KILL QUERY NK_STRING", - /* 271 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 272 */ "cmd ::= BALANCE VGROUP", - /* 273 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 274 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 275 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 276 */ "dnode_list ::= DNODE NK_INTEGER", - /* 277 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 278 */ "cmd ::= SYNCDB db_name REPLICA", - /* 279 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 280 */ "cmd ::= query_expression", - /* 281 */ "literal ::= NK_INTEGER", - /* 282 */ "literal ::= NK_FLOAT", - /* 283 */ "literal ::= NK_STRING", - /* 284 */ "literal ::= NK_BOOL", - /* 285 */ "literal ::= TIMESTAMP NK_STRING", - /* 286 */ "literal ::= duration_literal", - /* 287 */ "literal ::= NULL", - /* 288 */ "literal ::= NK_QUESTION", - /* 289 */ "duration_literal ::= NK_VARIABLE", - /* 290 */ "signed ::= NK_INTEGER", - /* 291 */ "signed ::= NK_PLUS NK_INTEGER", - /* 292 */ "signed ::= NK_MINUS NK_INTEGER", - /* 293 */ "signed ::= NK_FLOAT", - /* 294 */ "signed ::= NK_PLUS NK_FLOAT", - /* 295 */ "signed ::= NK_MINUS NK_FLOAT", - /* 296 */ "signed_literal ::= signed", - /* 297 */ "signed_literal ::= NK_STRING", - /* 298 */ "signed_literal ::= NK_BOOL", - /* 299 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 300 */ "signed_literal ::= duration_literal", - /* 301 */ "signed_literal ::= NULL", - /* 302 */ "signed_literal ::= literal_func", - /* 303 */ "literal_list ::= signed_literal", - /* 304 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 305 */ "db_name ::= NK_ID", - /* 306 */ "table_name ::= NK_ID", - /* 307 */ "column_name ::= NK_ID", - /* 308 */ "function_name ::= NK_ID", - /* 309 */ "table_alias ::= NK_ID", - /* 310 */ "column_alias ::= NK_ID", - /* 311 */ "user_name ::= NK_ID", - /* 312 */ "index_name ::= NK_ID", - /* 313 */ "topic_name ::= NK_ID", - /* 314 */ "stream_name ::= NK_ID", - /* 315 */ "cgroup_name ::= NK_ID", - /* 316 */ "expression ::= literal", - /* 317 */ "expression ::= pseudo_column", - /* 318 */ "expression ::= column_reference", - /* 319 */ "expression ::= function_expression", - /* 320 */ "expression ::= subquery", - /* 321 */ "expression ::= NK_LP expression NK_RP", - /* 322 */ "expression ::= NK_PLUS expression", - /* 323 */ "expression ::= NK_MINUS expression", - /* 324 */ "expression ::= expression NK_PLUS expression", - /* 325 */ "expression ::= expression NK_MINUS expression", - /* 326 */ "expression ::= expression NK_STAR expression", - /* 327 */ "expression ::= expression NK_SLASH expression", - /* 328 */ "expression ::= expression NK_REM expression", - /* 329 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 330 */ "expression ::= expression NK_BITAND expression", - /* 331 */ "expression ::= expression NK_BITOR expression", - /* 332 */ "expression_list ::= expression", - /* 333 */ "expression_list ::= expression_list NK_COMMA expression", - /* 334 */ "column_reference ::= column_name", - /* 335 */ "column_reference ::= table_name NK_DOT column_name", - /* 336 */ "pseudo_column ::= ROWTS", - /* 337 */ "pseudo_column ::= TBNAME", - /* 338 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 339 */ "pseudo_column ::= QSTARTTS", - /* 340 */ "pseudo_column ::= QENDTS", - /* 341 */ "pseudo_column ::= WSTARTTS", - /* 342 */ "pseudo_column ::= WENDTS", - /* 343 */ "pseudo_column ::= WDURATION", - /* 344 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 345 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 346 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 347 */ "function_expression ::= literal_func", - /* 348 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 349 */ "literal_func ::= NOW", - /* 350 */ "noarg_func ::= NOW", - /* 351 */ "noarg_func ::= TODAY", - /* 352 */ "noarg_func ::= TIMEZONE", - /* 353 */ "noarg_func ::= DATABASE", - /* 354 */ "noarg_func ::= CLIENT_VERSION", - /* 355 */ "noarg_func ::= SERVER_VERSION", - /* 356 */ "noarg_func ::= SERVER_STATUS", - /* 357 */ "noarg_func ::= CURRENT_USER", - /* 358 */ "noarg_func ::= USER", - /* 359 */ "star_func ::= COUNT", - /* 360 */ "star_func ::= FIRST", - /* 361 */ "star_func ::= LAST", - /* 362 */ "star_func ::= LAST_ROW", - /* 363 */ "star_func_para_list ::= NK_STAR", - /* 364 */ "star_func_para_list ::= other_para_list", - /* 365 */ "other_para_list ::= star_func_para", - /* 366 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 367 */ "star_func_para ::= expression", - /* 368 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 369 */ "predicate ::= expression compare_op expression", - /* 370 */ "predicate ::= expression BETWEEN expression AND expression", - /* 371 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 372 */ "predicate ::= expression IS NULL", - /* 373 */ "predicate ::= expression IS NOT NULL", - /* 374 */ "predicate ::= expression in_op in_predicate_value", - /* 375 */ "compare_op ::= NK_LT", - /* 376 */ "compare_op ::= NK_GT", - /* 377 */ "compare_op ::= NK_LE", - /* 378 */ "compare_op ::= NK_GE", - /* 379 */ "compare_op ::= NK_NE", - /* 380 */ "compare_op ::= NK_EQ", - /* 381 */ "compare_op ::= LIKE", - /* 382 */ "compare_op ::= NOT LIKE", - /* 383 */ "compare_op ::= MATCH", - /* 384 */ "compare_op ::= NMATCH", - /* 385 */ "compare_op ::= CONTAINS", - /* 386 */ "in_op ::= IN", - /* 387 */ "in_op ::= NOT IN", - /* 388 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 389 */ "boolean_value_expression ::= boolean_primary", - /* 390 */ "boolean_value_expression ::= NOT boolean_primary", - /* 391 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 392 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 393 */ "boolean_primary ::= predicate", - /* 394 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 395 */ "common_expression ::= expression", - /* 396 */ "common_expression ::= boolean_value_expression", - /* 397 */ "from_clause_opt ::=", - /* 398 */ "from_clause_opt ::= FROM table_reference_list", - /* 399 */ "table_reference_list ::= table_reference", - /* 400 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 401 */ "table_reference ::= table_primary", - /* 402 */ "table_reference ::= joined_table", - /* 403 */ "table_primary ::= table_name alias_opt", - /* 404 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 405 */ "table_primary ::= subquery alias_opt", - /* 406 */ "table_primary ::= parenthesized_joined_table", - /* 407 */ "alias_opt ::=", - /* 408 */ "alias_opt ::= table_alias", - /* 409 */ "alias_opt ::= AS table_alias", - /* 410 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 411 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 412 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 413 */ "join_type ::=", - /* 414 */ "join_type ::= INNER", - /* 415 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 416 */ "set_quantifier_opt ::=", - /* 417 */ "set_quantifier_opt ::= DISTINCT", - /* 418 */ "set_quantifier_opt ::= ALL", - /* 419 */ "select_list ::= select_item", - /* 420 */ "select_list ::= select_list NK_COMMA select_item", - /* 421 */ "select_item ::= NK_STAR", - /* 422 */ "select_item ::= common_expression", - /* 423 */ "select_item ::= common_expression column_alias", - /* 424 */ "select_item ::= common_expression AS column_alias", - /* 425 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 426 */ "where_clause_opt ::=", - /* 427 */ "where_clause_opt ::= WHERE search_condition", - /* 428 */ "partition_by_clause_opt ::=", - /* 429 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 430 */ "twindow_clause_opt ::=", - /* 431 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 432 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 433 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 434 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 435 */ "sliding_opt ::=", - /* 436 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 437 */ "fill_opt ::=", - /* 438 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 439 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 440 */ "fill_mode ::= NONE", - /* 441 */ "fill_mode ::= PREV", - /* 442 */ "fill_mode ::= NULL", - /* 443 */ "fill_mode ::= LINEAR", - /* 444 */ "fill_mode ::= NEXT", - /* 445 */ "group_by_clause_opt ::=", - /* 446 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 447 */ "group_by_list ::= expression", - /* 448 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 449 */ "having_clause_opt ::=", - /* 450 */ "having_clause_opt ::= HAVING search_condition", - /* 451 */ "range_opt ::=", - /* 452 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 453 */ "every_opt ::=", - /* 454 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 455 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 456 */ "query_expression_body ::= query_primary", - /* 457 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 458 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 459 */ "query_primary ::= query_specification", - /* 460 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 461 */ "order_by_clause_opt ::=", - /* 462 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 463 */ "slimit_clause_opt ::=", - /* 464 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 465 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 467 */ "limit_clause_opt ::=", - /* 468 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 469 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 471 */ "subquery ::= NK_LP query_expression NK_RP", - /* 472 */ "search_condition ::= common_expression", - /* 473 */ "sort_specification_list ::= sort_specification", - /* 474 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 475 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 476 */ "ordering_specification_opt ::=", - /* 477 */ "ordering_specification_opt ::= ASC", - /* 478 */ "ordering_specification_opt ::= DESC", - /* 479 */ "null_ordering_opt ::=", - /* 480 */ "null_ordering_opt ::= NULLS FIRST", - /* 481 */ "null_ordering_opt ::= NULLS LAST", + /* 269 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 270 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 271 */ "cmd ::= KILL QUERY NK_STRING", + /* 272 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 273 */ "cmd ::= BALANCE VGROUP", + /* 274 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 275 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 276 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 277 */ "dnode_list ::= DNODE NK_INTEGER", + /* 278 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 279 */ "cmd ::= SYNCDB db_name REPLICA", + /* 280 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 281 */ "cmd ::= query_expression", + /* 282 */ "literal ::= NK_INTEGER", + /* 283 */ "literal ::= NK_FLOAT", + /* 284 */ "literal ::= NK_STRING", + /* 285 */ "literal ::= NK_BOOL", + /* 286 */ "literal ::= TIMESTAMP NK_STRING", + /* 287 */ "literal ::= duration_literal", + /* 288 */ "literal ::= NULL", + /* 289 */ "literal ::= NK_QUESTION", + /* 290 */ "duration_literal ::= NK_VARIABLE", + /* 291 */ "signed ::= NK_INTEGER", + /* 292 */ "signed ::= NK_PLUS NK_INTEGER", + /* 293 */ "signed ::= NK_MINUS NK_INTEGER", + /* 294 */ "signed ::= NK_FLOAT", + /* 295 */ "signed ::= NK_PLUS NK_FLOAT", + /* 296 */ "signed ::= NK_MINUS NK_FLOAT", + /* 297 */ "signed_literal ::= signed", + /* 298 */ "signed_literal ::= NK_STRING", + /* 299 */ "signed_literal ::= NK_BOOL", + /* 300 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 301 */ "signed_literal ::= duration_literal", + /* 302 */ "signed_literal ::= NULL", + /* 303 */ "signed_literal ::= literal_func", + /* 304 */ "literal_list ::= signed_literal", + /* 305 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 306 */ "db_name ::= NK_ID", + /* 307 */ "table_name ::= NK_ID", + /* 308 */ "column_name ::= NK_ID", + /* 309 */ "function_name ::= NK_ID", + /* 310 */ "table_alias ::= NK_ID", + /* 311 */ "column_alias ::= NK_ID", + /* 312 */ "user_name ::= NK_ID", + /* 313 */ "index_name ::= NK_ID", + /* 314 */ "topic_name ::= NK_ID", + /* 315 */ "stream_name ::= NK_ID", + /* 316 */ "cgroup_name ::= NK_ID", + /* 317 */ "expression ::= literal", + /* 318 */ "expression ::= pseudo_column", + /* 319 */ "expression ::= column_reference", + /* 320 */ "expression ::= function_expression", + /* 321 */ "expression ::= subquery", + /* 322 */ "expression ::= NK_LP expression NK_RP", + /* 323 */ "expression ::= NK_PLUS expression", + /* 324 */ "expression ::= NK_MINUS expression", + /* 325 */ "expression ::= expression NK_PLUS expression", + /* 326 */ "expression ::= expression NK_MINUS expression", + /* 327 */ "expression ::= expression NK_STAR expression", + /* 328 */ "expression ::= expression NK_SLASH expression", + /* 329 */ "expression ::= expression NK_REM expression", + /* 330 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 331 */ "expression ::= expression NK_BITAND expression", + /* 332 */ "expression ::= expression NK_BITOR expression", + /* 333 */ "expression_list ::= expression", + /* 334 */ "expression_list ::= expression_list NK_COMMA expression", + /* 335 */ "column_reference ::= column_name", + /* 336 */ "column_reference ::= table_name NK_DOT column_name", + /* 337 */ "pseudo_column ::= ROWTS", + /* 338 */ "pseudo_column ::= TBNAME", + /* 339 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 340 */ "pseudo_column ::= QSTARTTS", + /* 341 */ "pseudo_column ::= QENDTS", + /* 342 */ "pseudo_column ::= WSTARTTS", + /* 343 */ "pseudo_column ::= WENDTS", + /* 344 */ "pseudo_column ::= WDURATION", + /* 345 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 346 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 347 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 348 */ "function_expression ::= literal_func", + /* 349 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 350 */ "literal_func ::= NOW", + /* 351 */ "noarg_func ::= NOW", + /* 352 */ "noarg_func ::= TODAY", + /* 353 */ "noarg_func ::= TIMEZONE", + /* 354 */ "noarg_func ::= DATABASE", + /* 355 */ "noarg_func ::= CLIENT_VERSION", + /* 356 */ "noarg_func ::= SERVER_VERSION", + /* 357 */ "noarg_func ::= SERVER_STATUS", + /* 358 */ "noarg_func ::= CURRENT_USER", + /* 359 */ "noarg_func ::= USER", + /* 360 */ "star_func ::= COUNT", + /* 361 */ "star_func ::= FIRST", + /* 362 */ "star_func ::= LAST", + /* 363 */ "star_func ::= LAST_ROW", + /* 364 */ "star_func_para_list ::= NK_STAR", + /* 365 */ "star_func_para_list ::= other_para_list", + /* 366 */ "other_para_list ::= star_func_para", + /* 367 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 368 */ "star_func_para ::= expression", + /* 369 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 370 */ "predicate ::= expression compare_op expression", + /* 371 */ "predicate ::= expression BETWEEN expression AND expression", + /* 372 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 373 */ "predicate ::= expression IS NULL", + /* 374 */ "predicate ::= expression IS NOT NULL", + /* 375 */ "predicate ::= expression in_op in_predicate_value", + /* 376 */ "compare_op ::= NK_LT", + /* 377 */ "compare_op ::= NK_GT", + /* 378 */ "compare_op ::= NK_LE", + /* 379 */ "compare_op ::= NK_GE", + /* 380 */ "compare_op ::= NK_NE", + /* 381 */ "compare_op ::= NK_EQ", + /* 382 */ "compare_op ::= LIKE", + /* 383 */ "compare_op ::= NOT LIKE", + /* 384 */ "compare_op ::= MATCH", + /* 385 */ "compare_op ::= NMATCH", + /* 386 */ "compare_op ::= CONTAINS", + /* 387 */ "in_op ::= IN", + /* 388 */ "in_op ::= NOT IN", + /* 389 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 390 */ "boolean_value_expression ::= boolean_primary", + /* 391 */ "boolean_value_expression ::= NOT boolean_primary", + /* 392 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 393 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 394 */ "boolean_primary ::= predicate", + /* 395 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 396 */ "common_expression ::= expression", + /* 397 */ "common_expression ::= boolean_value_expression", + /* 398 */ "from_clause_opt ::=", + /* 399 */ "from_clause_opt ::= FROM table_reference_list", + /* 400 */ "table_reference_list ::= table_reference", + /* 401 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 402 */ "table_reference ::= table_primary", + /* 403 */ "table_reference ::= joined_table", + /* 404 */ "table_primary ::= table_name alias_opt", + /* 405 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 406 */ "table_primary ::= subquery alias_opt", + /* 407 */ "table_primary ::= parenthesized_joined_table", + /* 408 */ "alias_opt ::=", + /* 409 */ "alias_opt ::= table_alias", + /* 410 */ "alias_opt ::= AS table_alias", + /* 411 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 412 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 413 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 414 */ "join_type ::=", + /* 415 */ "join_type ::= INNER", + /* 416 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 417 */ "set_quantifier_opt ::=", + /* 418 */ "set_quantifier_opt ::= DISTINCT", + /* 419 */ "set_quantifier_opt ::= ALL", + /* 420 */ "select_list ::= select_item", + /* 421 */ "select_list ::= select_list NK_COMMA select_item", + /* 422 */ "select_item ::= NK_STAR", + /* 423 */ "select_item ::= common_expression", + /* 424 */ "select_item ::= common_expression column_alias", + /* 425 */ "select_item ::= common_expression AS column_alias", + /* 426 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 427 */ "where_clause_opt ::=", + /* 428 */ "where_clause_opt ::= WHERE search_condition", + /* 429 */ "partition_by_clause_opt ::=", + /* 430 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 431 */ "twindow_clause_opt ::=", + /* 432 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 433 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 434 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 435 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 436 */ "sliding_opt ::=", + /* 437 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 438 */ "fill_opt ::=", + /* 439 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 440 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 441 */ "fill_mode ::= NONE", + /* 442 */ "fill_mode ::= PREV", + /* 443 */ "fill_mode ::= NULL", + /* 444 */ "fill_mode ::= LINEAR", + /* 445 */ "fill_mode ::= NEXT", + /* 446 */ "group_by_clause_opt ::=", + /* 447 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 448 */ "group_by_list ::= expression", + /* 449 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 450 */ "having_clause_opt ::=", + /* 451 */ "having_clause_opt ::= HAVING search_condition", + /* 452 */ "range_opt ::=", + /* 453 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 454 */ "every_opt ::=", + /* 455 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 456 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 457 */ "query_expression_body ::= query_primary", + /* 458 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 459 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 460 */ "query_primary ::= query_specification", + /* 461 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 462 */ "order_by_clause_opt ::=", + /* 463 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 464 */ "slimit_clause_opt ::=", + /* 465 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 467 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 468 */ "limit_clause_opt ::=", + /* 469 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 471 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 472 */ "subquery ::= NK_LP query_expression NK_RP", + /* 473 */ "search_condition ::= common_expression", + /* 474 */ "sort_specification_list ::= sort_specification", + /* 475 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 476 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 477 */ "ordering_specification_opt ::=", + /* 478 */ "ordering_specification_opt ::= ASC", + /* 479 */ "ordering_specification_opt ::= DESC", + /* 480 */ "null_ordering_opt ::=", + /* 481 */ "null_ordering_opt ::= NULLS FIRST", + /* 482 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2236,181 +2236,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 250: /* cmd */ - case 253: /* literal */ - case 264: /* db_options */ - case 266: /* alter_db_options */ - case 271: /* retention */ - case 272: /* full_table_name */ - case 275: /* table_options */ - case 279: /* alter_table_clause */ - case 280: /* alter_table_options */ - case 283: /* signed_literal */ - case 284: /* create_subtable_clause */ - case 287: /* drop_table_clause */ - case 290: /* column_def */ - case 294: /* duration_literal */ - case 295: /* rollup_func_name */ - case 297: /* col_name */ - case 298: /* db_name_cond_opt */ - case 299: /* like_pattern_opt */ - case 300: /* table_name_cond */ - case 301: /* from_db_opt */ - case 303: /* index_options */ - case 305: /* sliding_opt */ - case 306: /* sma_stream_opt */ - case 307: /* func */ - case 309: /* stream_options */ - case 311: /* query_expression */ - case 314: /* explain_options */ - case 318: /* into_opt */ - case 320: /* where_clause_opt */ - case 321: /* signed */ - case 322: /* literal_func */ - case 325: /* expression */ - case 326: /* pseudo_column */ - case 327: /* column_reference */ - case 328: /* function_expression */ - case 329: /* subquery */ - case 334: /* star_func_para */ - case 335: /* predicate */ - case 338: /* in_predicate_value */ - case 339: /* boolean_value_expression */ - case 340: /* boolean_primary */ - case 341: /* common_expression */ - case 342: /* from_clause_opt */ - case 343: /* table_reference_list */ - case 344: /* table_reference */ - case 345: /* table_primary */ - case 346: /* joined_table */ - case 348: /* parenthesized_joined_table */ - case 350: /* search_condition */ - case 351: /* query_specification */ - case 355: /* range_opt */ - case 356: /* every_opt */ - case 357: /* fill_opt */ - case 358: /* twindow_clause_opt */ - case 360: /* having_clause_opt */ - case 361: /* select_item */ - case 364: /* query_expression_body */ - case 366: /* slimit_clause_opt */ - case 367: /* limit_clause_opt */ - case 368: /* query_primary */ - case 370: /* sort_specification */ + case 252: /* cmd */ + case 255: /* literal */ + case 266: /* db_options */ + case 268: /* alter_db_options */ + case 273: /* retention */ + case 274: /* full_table_name */ + case 277: /* table_options */ + case 281: /* alter_table_clause */ + case 282: /* alter_table_options */ + case 285: /* signed_literal */ + case 286: /* create_subtable_clause */ + case 289: /* drop_table_clause */ + case 292: /* column_def */ + case 296: /* duration_literal */ + case 297: /* rollup_func_name */ + case 299: /* col_name */ + case 300: /* db_name_cond_opt */ + case 301: /* like_pattern_opt */ + case 302: /* table_name_cond */ + case 303: /* from_db_opt */ + case 305: /* index_options */ + case 307: /* sliding_opt */ + case 308: /* sma_stream_opt */ + case 309: /* func */ + case 311: /* stream_options */ + case 313: /* query_expression */ + case 316: /* explain_options */ + case 320: /* into_opt */ + case 322: /* where_clause_opt */ + case 323: /* signed */ + case 324: /* literal_func */ + case 327: /* expression */ + case 328: /* pseudo_column */ + case 329: /* column_reference */ + case 330: /* function_expression */ + case 331: /* subquery */ + case 336: /* star_func_para */ + case 337: /* predicate */ + case 340: /* in_predicate_value */ + case 341: /* boolean_value_expression */ + case 342: /* boolean_primary */ + case 343: /* common_expression */ + case 344: /* from_clause_opt */ + case 345: /* table_reference_list */ + case 346: /* table_reference */ + case 347: /* table_primary */ + case 348: /* joined_table */ + case 350: /* parenthesized_joined_table */ + case 352: /* search_condition */ + case 353: /* query_specification */ + case 357: /* range_opt */ + case 358: /* every_opt */ + case 359: /* fill_opt */ + case 360: /* twindow_clause_opt */ + case 362: /* having_clause_opt */ + case 363: /* select_item */ + case 366: /* query_expression_body */ + case 368: /* slimit_clause_opt */ + case 369: /* limit_clause_opt */ + case 370: /* query_primary */ + case 372: /* sort_specification */ { - nodesDestroyNode((yypminor->yy184)); + nodesDestroyNode((yypminor->yy212)); } break; - case 251: /* account_options */ - case 252: /* alter_account_options */ - case 254: /* alter_account_option */ - case 316: /* bufsize_opt */ + case 253: /* account_options */ + case 254: /* alter_account_options */ + case 256: /* alter_account_option */ + case 318: /* bufsize_opt */ { } break; - case 255: /* user_name */ - case 258: /* priv_level */ - case 261: /* db_name */ - case 262: /* dnode_endpoint */ - case 281: /* column_name */ - case 289: /* table_name */ - case 296: /* function_name */ - case 302: /* index_name */ - case 310: /* topic_name */ - case 312: /* cgroup_name */ - case 317: /* stream_name */ - case 323: /* table_alias */ - case 324: /* column_alias */ - case 330: /* star_func */ - case 332: /* noarg_func */ - case 347: /* alias_opt */ + case 257: /* user_name */ + case 260: /* priv_level */ + case 263: /* db_name */ + case 264: /* dnode_endpoint */ + case 283: /* column_name */ + case 291: /* table_name */ + case 298: /* function_name */ + case 304: /* index_name */ + case 312: /* topic_name */ + case 314: /* cgroup_name */ + case 319: /* stream_name */ + case 325: /* table_alias */ + case 326: /* column_alias */ + case 332: /* star_func */ + case 334: /* noarg_func */ + case 349: /* alias_opt */ { } break; - case 256: /* sysinfo_opt */ + case 258: /* sysinfo_opt */ { } break; - case 257: /* privileges */ - case 259: /* priv_type_list */ - case 260: /* priv_type */ + case 259: /* privileges */ + case 261: /* priv_type_list */ + case 262: /* priv_type */ { } break; - case 263: /* not_exists_opt */ - case 265: /* exists_opt */ - case 313: /* analyze_opt */ - case 315: /* agg_func_opt */ - case 352: /* set_quantifier_opt */ + case 265: /* not_exists_opt */ + case 267: /* exists_opt */ + case 315: /* analyze_opt */ + case 317: /* agg_func_opt */ + case 354: /* set_quantifier_opt */ { } break; - case 267: /* integer_list */ - case 268: /* variable_list */ - case 269: /* retention_list */ - case 273: /* column_def_list */ - case 274: /* tags_def_opt */ - case 276: /* multi_create_clause */ - case 277: /* tags_def */ - case 278: /* multi_drop_clause */ - case 285: /* specific_tags_opt */ - case 286: /* literal_list */ - case 288: /* col_name_list */ - case 291: /* duration_list */ - case 292: /* rollup_func_list */ - case 304: /* func_list */ - case 308: /* expression_list */ - case 319: /* dnode_list */ - case 331: /* star_func_para_list */ - case 333: /* other_para_list */ - case 353: /* select_list */ - case 354: /* partition_by_clause_opt */ - case 359: /* group_by_clause_opt */ - case 363: /* group_by_list */ - case 365: /* order_by_clause_opt */ - case 369: /* sort_specification_list */ + case 269: /* integer_list */ + case 270: /* variable_list */ + case 271: /* retention_list */ + case 275: /* column_def_list */ + case 276: /* tags_def_opt */ + case 278: /* multi_create_clause */ + case 279: /* tags_def */ + case 280: /* multi_drop_clause */ + case 287: /* specific_tags_opt */ + case 288: /* literal_list */ + case 290: /* col_name_list */ + case 293: /* duration_list */ + case 294: /* rollup_func_list */ + case 306: /* func_list */ + case 310: /* expression_list */ + case 321: /* dnode_list */ + case 333: /* star_func_para_list */ + case 335: /* other_para_list */ + case 355: /* select_list */ + case 356: /* partition_by_clause_opt */ + case 361: /* group_by_clause_opt */ + case 365: /* group_by_list */ + case 367: /* order_by_clause_opt */ + case 371: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy296)); + nodesDestroyList((yypminor->yy424)); } break; - case 270: /* alter_db_option */ - case 293: /* alter_table_option */ + case 272: /* alter_db_option */ + case 295: /* alter_table_option */ { } break; - case 282: /* type_name */ + case 284: /* type_name */ { } break; - case 336: /* compare_op */ - case 337: /* in_op */ + case 338: /* compare_op */ + case 339: /* in_op */ { } break; - case 349: /* join_type */ + case 351: /* join_type */ { } break; - case 362: /* fill_mode */ + case 364: /* fill_mode */ { } break; - case 371: /* ordering_specification_opt */ + case 373: /* ordering_specification_opt */ { } break; - case 372: /* null_ordering_opt */ + case 374: /* null_ordering_opt */ { } @@ -2709,488 +2709,489 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 250, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 250, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 251, 0 }, /* (2) account_options ::= */ - { 251, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 251, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 251, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 251, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 251, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 251, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 251, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 251, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 251, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 252, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 252, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 254, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 254, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 254, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 254, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 254, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 254, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 254, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 254, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 254, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 254, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 250, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 250, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 250, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 250, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 250, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 256, 0 }, /* (29) sysinfo_opt ::= */ - { 256, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 250, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 250, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 257, -1 }, /* (33) privileges ::= ALL */ - { 257, -1 }, /* (34) privileges ::= priv_type_list */ - { 259, -1 }, /* (35) priv_type_list ::= priv_type */ - { 259, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 260, -1 }, /* (37) priv_type ::= READ */ - { 260, -1 }, /* (38) priv_type ::= WRITE */ - { 258, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 258, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 250, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 250, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 250, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 250, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 250, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 250, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 250, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 250, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 262, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 262, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 262, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 250, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 250, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 250, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 250, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 250, -2 }, /* (64) cmd ::= USE db_name */ - { 250, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 263, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ - { 263, 0 }, /* (67) not_exists_opt ::= */ - { 265, -2 }, /* (68) exists_opt ::= IF EXISTS */ - { 265, 0 }, /* (69) exists_opt ::= */ - { 264, 0 }, /* (70) db_options ::= */ - { 264, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ - { 264, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ - { 264, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ - { 264, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ - { 264, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ - { 264, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ - { 264, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ - { 264, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ - { 264, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ - { 264, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ - { 264, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ - { 264, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 264, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ - { 264, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ - { 264, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ - { 264, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ - { 264, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ - { 264, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 264, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ - { 264, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 266, -1 }, /* (91) alter_db_options ::= alter_db_option */ - { 266, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ - { 270, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ - { 270, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ - { 270, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ - { 270, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ - { 270, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ - { 270, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ - { 270, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ - { 270, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ - { 270, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ - { 267, -1 }, /* (102) integer_list ::= NK_INTEGER */ - { 267, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 268, -1 }, /* (104) variable_list ::= NK_VARIABLE */ - { 268, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 269, -1 }, /* (106) retention_list ::= retention */ - { 269, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ - { 271, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 250, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 250, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ - { 250, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 250, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ - { 250, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ - { 250, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ - { 250, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ - { 279, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ - { 279, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 279, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 279, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 279, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 279, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 279, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 279, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 279, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 279, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 276, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ - { 276, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 284, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ - { 278, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ - { 278, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 287, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ - { 285, 0 }, /* (132) specific_tags_opt ::= */ - { 285, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 272, -1 }, /* (134) full_table_name ::= table_name */ - { 272, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ - { 273, -1 }, /* (136) column_def_list ::= column_def */ - { 273, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ - { 290, -2 }, /* (138) column_def ::= column_name type_name */ - { 290, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ - { 282, -1 }, /* (140) type_name ::= BOOL */ - { 282, -1 }, /* (141) type_name ::= TINYINT */ - { 282, -1 }, /* (142) type_name ::= SMALLINT */ - { 282, -1 }, /* (143) type_name ::= INT */ - { 282, -1 }, /* (144) type_name ::= INTEGER */ - { 282, -1 }, /* (145) type_name ::= BIGINT */ - { 282, -1 }, /* (146) type_name ::= FLOAT */ - { 282, -1 }, /* (147) type_name ::= DOUBLE */ - { 282, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (149) type_name ::= TIMESTAMP */ - { 282, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 282, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ - { 282, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ - { 282, -2 }, /* (153) type_name ::= INT UNSIGNED */ - { 282, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ - { 282, -1 }, /* (155) type_name ::= JSON */ - { 282, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (157) type_name ::= MEDIUMBLOB */ - { 282, -1 }, /* (158) type_name ::= BLOB */ - { 282, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (160) type_name ::= DECIMAL */ - { 282, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 282, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 274, 0 }, /* (163) tags_def_opt ::= */ - { 274, -1 }, /* (164) tags_def_opt ::= tags_def */ - { 277, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 275, 0 }, /* (166) table_options ::= */ - { 275, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ - { 275, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ - { 275, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ - { 275, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 275, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ - { 275, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 280, -1 }, /* (173) alter_table_options ::= alter_table_option */ - { 280, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ - { 293, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ - { 293, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ - { 291, -1 }, /* (177) duration_list ::= duration_literal */ - { 291, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ - { 292, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ - { 292, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 295, -1 }, /* (181) rollup_func_name ::= function_name */ - { 295, -1 }, /* (182) rollup_func_name ::= FIRST */ - { 295, -1 }, /* (183) rollup_func_name ::= LAST */ - { 288, -1 }, /* (184) col_name_list ::= col_name */ - { 288, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ - { 297, -1 }, /* (186) col_name ::= column_name */ - { 250, -2 }, /* (187) cmd ::= SHOW DNODES */ - { 250, -2 }, /* (188) cmd ::= SHOW USERS */ - { 250, -2 }, /* (189) cmd ::= SHOW DATABASES */ - { 250, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 250, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 250, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 250, -2 }, /* (193) cmd ::= SHOW MNODES */ - { 250, -2 }, /* (194) cmd ::= SHOW MODULES */ - { 250, -2 }, /* (195) cmd ::= SHOW QNODES */ - { 250, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ - { 250, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 250, -2 }, /* (198) cmd ::= SHOW STREAMS */ - { 250, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ - { 250, -2 }, /* (200) cmd ::= SHOW APPS */ - { 250, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ - { 250, -2 }, /* (202) cmd ::= SHOW LICENCE */ - { 250, -2 }, /* (203) cmd ::= SHOW GRANTS */ - { 250, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ - { 250, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ - { 250, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ - { 250, -2 }, /* (207) cmd ::= SHOW QUERIES */ - { 250, -2 }, /* (208) cmd ::= SHOW SCORES */ - { 250, -2 }, /* (209) cmd ::= SHOW TOPICS */ - { 250, -2 }, /* (210) cmd ::= SHOW VARIABLES */ - { 250, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ - { 250, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 250, -2 }, /* (213) cmd ::= SHOW BNODES */ - { 250, -2 }, /* (214) cmd ::= SHOW SNODES */ - { 250, -2 }, /* (215) cmd ::= SHOW CLUSTER */ - { 250, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ - { 250, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 250, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ - { 250, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ - { 298, 0 }, /* (220) db_name_cond_opt ::= */ - { 298, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ - { 299, 0 }, /* (222) like_pattern_opt ::= */ - { 299, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ - { 300, -1 }, /* (224) table_name_cond ::= table_name */ - { 301, 0 }, /* (225) from_db_opt ::= */ - { 301, -2 }, /* (226) from_db_opt ::= FROM db_name */ - { 250, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 250, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ - { 303, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 303, -12 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 304, -1 }, /* (231) func_list ::= func */ - { 304, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ - { 307, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ - { 306, 0 }, /* (234) sma_stream_opt ::= */ - { 306, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 306, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 250, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 250, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 250, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 250, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 250, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 250, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ - { 250, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 250, -2 }, /* (244) cmd ::= DESC full_table_name */ - { 250, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ - { 250, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ - { 250, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 313, 0 }, /* (248) analyze_opt ::= */ - { 313, -1 }, /* (249) analyze_opt ::= ANALYZE */ - { 314, 0 }, /* (250) explain_options ::= */ - { 314, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 314, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ - { 250, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 250, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 250, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ - { 315, 0 }, /* (256) agg_func_opt ::= */ - { 315, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ - { 316, 0 }, /* (258) bufsize_opt ::= */ - { 316, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 250, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 250, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ - { 318, 0 }, /* (262) into_opt ::= */ - { 318, -2 }, /* (263) into_opt ::= INTO full_table_name */ - { 309, 0 }, /* (264) stream_options ::= */ - { 309, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 309, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 309, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 309, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ - { 250, -3 }, /* (269) cmd ::= KILL CONNECTION NK_INTEGER */ - { 250, -3 }, /* (270) cmd ::= KILL QUERY NK_STRING */ - { 250, -3 }, /* (271) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 250, -2 }, /* (272) cmd ::= BALANCE VGROUP */ - { 250, -4 }, /* (273) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 250, -4 }, /* (274) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 250, -3 }, /* (275) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 319, -2 }, /* (276) dnode_list ::= DNODE NK_INTEGER */ - { 319, -3 }, /* (277) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 250, -3 }, /* (278) cmd ::= SYNCDB db_name REPLICA */ - { 250, -4 }, /* (279) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 250, -1 }, /* (280) cmd ::= query_expression */ - { 253, -1 }, /* (281) literal ::= NK_INTEGER */ - { 253, -1 }, /* (282) literal ::= NK_FLOAT */ - { 253, -1 }, /* (283) literal ::= NK_STRING */ - { 253, -1 }, /* (284) literal ::= NK_BOOL */ - { 253, -2 }, /* (285) literal ::= TIMESTAMP NK_STRING */ - { 253, -1 }, /* (286) literal ::= duration_literal */ - { 253, -1 }, /* (287) literal ::= NULL */ - { 253, -1 }, /* (288) literal ::= NK_QUESTION */ - { 294, -1 }, /* (289) duration_literal ::= NK_VARIABLE */ - { 321, -1 }, /* (290) signed ::= NK_INTEGER */ - { 321, -2 }, /* (291) signed ::= NK_PLUS NK_INTEGER */ - { 321, -2 }, /* (292) signed ::= NK_MINUS NK_INTEGER */ - { 321, -1 }, /* (293) signed ::= NK_FLOAT */ - { 321, -2 }, /* (294) signed ::= NK_PLUS NK_FLOAT */ - { 321, -2 }, /* (295) signed ::= NK_MINUS NK_FLOAT */ - { 283, -1 }, /* (296) signed_literal ::= signed */ - { 283, -1 }, /* (297) signed_literal ::= NK_STRING */ - { 283, -1 }, /* (298) signed_literal ::= NK_BOOL */ - { 283, -2 }, /* (299) signed_literal ::= TIMESTAMP NK_STRING */ - { 283, -1 }, /* (300) signed_literal ::= duration_literal */ - { 283, -1 }, /* (301) signed_literal ::= NULL */ - { 283, -1 }, /* (302) signed_literal ::= literal_func */ - { 286, -1 }, /* (303) literal_list ::= signed_literal */ - { 286, -3 }, /* (304) literal_list ::= literal_list NK_COMMA signed_literal */ - { 261, -1 }, /* (305) db_name ::= NK_ID */ - { 289, -1 }, /* (306) table_name ::= NK_ID */ - { 281, -1 }, /* (307) column_name ::= NK_ID */ - { 296, -1 }, /* (308) function_name ::= NK_ID */ - { 323, -1 }, /* (309) table_alias ::= NK_ID */ - { 324, -1 }, /* (310) column_alias ::= NK_ID */ - { 255, -1 }, /* (311) user_name ::= NK_ID */ - { 302, -1 }, /* (312) index_name ::= NK_ID */ - { 310, -1 }, /* (313) topic_name ::= NK_ID */ - { 317, -1 }, /* (314) stream_name ::= NK_ID */ - { 312, -1 }, /* (315) cgroup_name ::= NK_ID */ - { 325, -1 }, /* (316) expression ::= literal */ - { 325, -1 }, /* (317) expression ::= pseudo_column */ - { 325, -1 }, /* (318) expression ::= column_reference */ - { 325, -1 }, /* (319) expression ::= function_expression */ - { 325, -1 }, /* (320) expression ::= subquery */ - { 325, -3 }, /* (321) expression ::= NK_LP expression NK_RP */ - { 325, -2 }, /* (322) expression ::= NK_PLUS expression */ - { 325, -2 }, /* (323) expression ::= NK_MINUS expression */ - { 325, -3 }, /* (324) expression ::= expression NK_PLUS expression */ - { 325, -3 }, /* (325) expression ::= expression NK_MINUS expression */ - { 325, -3 }, /* (326) expression ::= expression NK_STAR expression */ - { 325, -3 }, /* (327) expression ::= expression NK_SLASH expression */ - { 325, -3 }, /* (328) expression ::= expression NK_REM expression */ - { 325, -3 }, /* (329) expression ::= column_reference NK_ARROW NK_STRING */ - { 325, -3 }, /* (330) expression ::= expression NK_BITAND expression */ - { 325, -3 }, /* (331) expression ::= expression NK_BITOR expression */ - { 308, -1 }, /* (332) expression_list ::= expression */ - { 308, -3 }, /* (333) expression_list ::= expression_list NK_COMMA expression */ - { 327, -1 }, /* (334) column_reference ::= column_name */ - { 327, -3 }, /* (335) column_reference ::= table_name NK_DOT column_name */ - { 326, -1 }, /* (336) pseudo_column ::= ROWTS */ - { 326, -1 }, /* (337) pseudo_column ::= TBNAME */ - { 326, -3 }, /* (338) pseudo_column ::= table_name NK_DOT TBNAME */ - { 326, -1 }, /* (339) pseudo_column ::= QSTARTTS */ - { 326, -1 }, /* (340) pseudo_column ::= QENDTS */ - { 326, -1 }, /* (341) pseudo_column ::= WSTARTTS */ - { 326, -1 }, /* (342) pseudo_column ::= WENDTS */ - { 326, -1 }, /* (343) pseudo_column ::= WDURATION */ - { 328, -4 }, /* (344) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 328, -4 }, /* (345) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 328, -6 }, /* (346) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 328, -1 }, /* (347) function_expression ::= literal_func */ - { 322, -3 }, /* (348) literal_func ::= noarg_func NK_LP NK_RP */ - { 322, -1 }, /* (349) literal_func ::= NOW */ - { 332, -1 }, /* (350) noarg_func ::= NOW */ - { 332, -1 }, /* (351) noarg_func ::= TODAY */ - { 332, -1 }, /* (352) noarg_func ::= TIMEZONE */ - { 332, -1 }, /* (353) noarg_func ::= DATABASE */ - { 332, -1 }, /* (354) noarg_func ::= CLIENT_VERSION */ - { 332, -1 }, /* (355) noarg_func ::= SERVER_VERSION */ - { 332, -1 }, /* (356) noarg_func ::= SERVER_STATUS */ - { 332, -1 }, /* (357) noarg_func ::= CURRENT_USER */ - { 332, -1 }, /* (358) noarg_func ::= USER */ - { 330, -1 }, /* (359) star_func ::= COUNT */ - { 330, -1 }, /* (360) star_func ::= FIRST */ - { 330, -1 }, /* (361) star_func ::= LAST */ - { 330, -1 }, /* (362) star_func ::= LAST_ROW */ - { 331, -1 }, /* (363) star_func_para_list ::= NK_STAR */ - { 331, -1 }, /* (364) star_func_para_list ::= other_para_list */ - { 333, -1 }, /* (365) other_para_list ::= star_func_para */ - { 333, -3 }, /* (366) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 334, -1 }, /* (367) star_func_para ::= expression */ - { 334, -3 }, /* (368) star_func_para ::= table_name NK_DOT NK_STAR */ - { 335, -3 }, /* (369) predicate ::= expression compare_op expression */ - { 335, -5 }, /* (370) predicate ::= expression BETWEEN expression AND expression */ - { 335, -6 }, /* (371) predicate ::= expression NOT BETWEEN expression AND expression */ - { 335, -3 }, /* (372) predicate ::= expression IS NULL */ - { 335, -4 }, /* (373) predicate ::= expression IS NOT NULL */ - { 335, -3 }, /* (374) predicate ::= expression in_op in_predicate_value */ - { 336, -1 }, /* (375) compare_op ::= NK_LT */ - { 336, -1 }, /* (376) compare_op ::= NK_GT */ - { 336, -1 }, /* (377) compare_op ::= NK_LE */ - { 336, -1 }, /* (378) compare_op ::= NK_GE */ - { 336, -1 }, /* (379) compare_op ::= NK_NE */ - { 336, -1 }, /* (380) compare_op ::= NK_EQ */ - { 336, -1 }, /* (381) compare_op ::= LIKE */ - { 336, -2 }, /* (382) compare_op ::= NOT LIKE */ - { 336, -1 }, /* (383) compare_op ::= MATCH */ - { 336, -1 }, /* (384) compare_op ::= NMATCH */ - { 336, -1 }, /* (385) compare_op ::= CONTAINS */ - { 337, -1 }, /* (386) in_op ::= IN */ - { 337, -2 }, /* (387) in_op ::= NOT IN */ - { 338, -3 }, /* (388) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 339, -1 }, /* (389) boolean_value_expression ::= boolean_primary */ - { 339, -2 }, /* (390) boolean_value_expression ::= NOT boolean_primary */ - { 339, -3 }, /* (391) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 339, -3 }, /* (392) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 340, -1 }, /* (393) boolean_primary ::= predicate */ - { 340, -3 }, /* (394) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 341, -1 }, /* (395) common_expression ::= expression */ - { 341, -1 }, /* (396) common_expression ::= boolean_value_expression */ - { 342, 0 }, /* (397) from_clause_opt ::= */ - { 342, -2 }, /* (398) from_clause_opt ::= FROM table_reference_list */ - { 343, -1 }, /* (399) table_reference_list ::= table_reference */ - { 343, -3 }, /* (400) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 344, -1 }, /* (401) table_reference ::= table_primary */ - { 344, -1 }, /* (402) table_reference ::= joined_table */ - { 345, -2 }, /* (403) table_primary ::= table_name alias_opt */ - { 345, -4 }, /* (404) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 345, -2 }, /* (405) table_primary ::= subquery alias_opt */ - { 345, -1 }, /* (406) table_primary ::= parenthesized_joined_table */ - { 347, 0 }, /* (407) alias_opt ::= */ - { 347, -1 }, /* (408) alias_opt ::= table_alias */ - { 347, -2 }, /* (409) alias_opt ::= AS table_alias */ - { 348, -3 }, /* (410) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 348, -3 }, /* (411) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 346, -6 }, /* (412) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 349, 0 }, /* (413) join_type ::= */ - { 349, -1 }, /* (414) join_type ::= INNER */ - { 351, -12 }, /* (415) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 352, 0 }, /* (416) set_quantifier_opt ::= */ - { 352, -1 }, /* (417) set_quantifier_opt ::= DISTINCT */ - { 352, -1 }, /* (418) set_quantifier_opt ::= ALL */ - { 353, -1 }, /* (419) select_list ::= select_item */ - { 353, -3 }, /* (420) select_list ::= select_list NK_COMMA select_item */ - { 361, -1 }, /* (421) select_item ::= NK_STAR */ - { 361, -1 }, /* (422) select_item ::= common_expression */ - { 361, -2 }, /* (423) select_item ::= common_expression column_alias */ - { 361, -3 }, /* (424) select_item ::= common_expression AS column_alias */ - { 361, -3 }, /* (425) select_item ::= table_name NK_DOT NK_STAR */ - { 320, 0 }, /* (426) where_clause_opt ::= */ - { 320, -2 }, /* (427) where_clause_opt ::= WHERE search_condition */ - { 354, 0 }, /* (428) partition_by_clause_opt ::= */ - { 354, -3 }, /* (429) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 358, 0 }, /* (430) twindow_clause_opt ::= */ - { 358, -6 }, /* (431) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 358, -4 }, /* (432) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 358, -6 }, /* (433) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 358, -8 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 305, 0 }, /* (435) sliding_opt ::= */ - { 305, -4 }, /* (436) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 357, 0 }, /* (437) fill_opt ::= */ - { 357, -4 }, /* (438) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 357, -6 }, /* (439) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 362, -1 }, /* (440) fill_mode ::= NONE */ - { 362, -1 }, /* (441) fill_mode ::= PREV */ - { 362, -1 }, /* (442) fill_mode ::= NULL */ - { 362, -1 }, /* (443) fill_mode ::= LINEAR */ - { 362, -1 }, /* (444) fill_mode ::= NEXT */ - { 359, 0 }, /* (445) group_by_clause_opt ::= */ - { 359, -3 }, /* (446) group_by_clause_opt ::= GROUP BY group_by_list */ - { 363, -1 }, /* (447) group_by_list ::= expression */ - { 363, -3 }, /* (448) group_by_list ::= group_by_list NK_COMMA expression */ - { 360, 0 }, /* (449) having_clause_opt ::= */ - { 360, -2 }, /* (450) having_clause_opt ::= HAVING search_condition */ - { 355, 0 }, /* (451) range_opt ::= */ - { 355, -6 }, /* (452) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 356, 0 }, /* (453) every_opt ::= */ - { 356, -4 }, /* (454) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 311, -4 }, /* (455) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 364, -1 }, /* (456) query_expression_body ::= query_primary */ - { 364, -4 }, /* (457) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 364, -3 }, /* (458) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 368, -1 }, /* (459) query_primary ::= query_specification */ - { 368, -6 }, /* (460) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 365, 0 }, /* (461) order_by_clause_opt ::= */ - { 365, -3 }, /* (462) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 366, 0 }, /* (463) slimit_clause_opt ::= */ - { 366, -2 }, /* (464) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 366, -4 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 366, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 367, 0 }, /* (467) limit_clause_opt ::= */ - { 367, -2 }, /* (468) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 367, -4 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 367, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 329, -3 }, /* (471) subquery ::= NK_LP query_expression NK_RP */ - { 350, -1 }, /* (472) search_condition ::= common_expression */ - { 369, -1 }, /* (473) sort_specification_list ::= sort_specification */ - { 369, -3 }, /* (474) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 370, -3 }, /* (475) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 371, 0 }, /* (476) ordering_specification_opt ::= */ - { 371, -1 }, /* (477) ordering_specification_opt ::= ASC */ - { 371, -1 }, /* (478) ordering_specification_opt ::= DESC */ - { 372, 0 }, /* (479) null_ordering_opt ::= */ - { 372, -2 }, /* (480) null_ordering_opt ::= NULLS FIRST */ - { 372, -2 }, /* (481) null_ordering_opt ::= NULLS LAST */ + { 252, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 252, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 253, 0 }, /* (2) account_options ::= */ + { 253, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 253, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 253, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 253, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 253, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 253, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 253, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 253, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 253, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 254, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 254, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 256, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 256, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 256, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 256, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 256, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 256, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 256, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 256, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 256, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 256, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 252, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 252, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 252, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 252, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 252, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 258, 0 }, /* (29) sysinfo_opt ::= */ + { 258, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 252, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 252, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 259, -1 }, /* (33) privileges ::= ALL */ + { 259, -1 }, /* (34) privileges ::= priv_type_list */ + { 261, -1 }, /* (35) priv_type_list ::= priv_type */ + { 261, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 262, -1 }, /* (37) priv_type ::= READ */ + { 262, -1 }, /* (38) priv_type ::= WRITE */ + { 260, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 260, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 252, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 252, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 252, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 252, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 252, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 252, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 252, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 252, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 264, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 264, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 264, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 252, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 252, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 252, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 252, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 252, -2 }, /* (64) cmd ::= USE db_name */ + { 252, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 265, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ + { 265, 0 }, /* (67) not_exists_opt ::= */ + { 267, -2 }, /* (68) exists_opt ::= IF EXISTS */ + { 267, 0 }, /* (69) exists_opt ::= */ + { 266, 0 }, /* (70) db_options ::= */ + { 266, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ + { 266, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ + { 266, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ + { 266, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ + { 266, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ + { 266, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ + { 266, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ + { 266, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ + { 266, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ + { 266, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ + { 266, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ + { 266, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 266, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ + { 266, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ + { 266, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ + { 266, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ + { 266, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ + { 266, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 266, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ + { 266, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 268, -1 }, /* (91) alter_db_options ::= alter_db_option */ + { 268, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ + { 272, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ + { 272, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ + { 272, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ + { 272, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ + { 272, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ + { 272, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ + { 272, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ + { 272, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ + { 272, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ + { 269, -1 }, /* (102) integer_list ::= NK_INTEGER */ + { 269, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 270, -1 }, /* (104) variable_list ::= NK_VARIABLE */ + { 270, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 271, -1 }, /* (106) retention_list ::= retention */ + { 271, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ + { 273, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 252, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 252, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ + { 252, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 252, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ + { 252, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ + { 252, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ + { 252, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ + { 281, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ + { 281, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 281, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 281, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 281, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 281, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 281, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 281, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 281, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 281, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 278, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ + { 278, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 286, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ + { 280, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ + { 280, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 289, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ + { 287, 0 }, /* (132) specific_tags_opt ::= */ + { 287, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 274, -1 }, /* (134) full_table_name ::= table_name */ + { 274, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ + { 275, -1 }, /* (136) column_def_list ::= column_def */ + { 275, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ + { 292, -2 }, /* (138) column_def ::= column_name type_name */ + { 292, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ + { 284, -1 }, /* (140) type_name ::= BOOL */ + { 284, -1 }, /* (141) type_name ::= TINYINT */ + { 284, -1 }, /* (142) type_name ::= SMALLINT */ + { 284, -1 }, /* (143) type_name ::= INT */ + { 284, -1 }, /* (144) type_name ::= INTEGER */ + { 284, -1 }, /* (145) type_name ::= BIGINT */ + { 284, -1 }, /* (146) type_name ::= FLOAT */ + { 284, -1 }, /* (147) type_name ::= DOUBLE */ + { 284, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (149) type_name ::= TIMESTAMP */ + { 284, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 284, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ + { 284, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ + { 284, -2 }, /* (153) type_name ::= INT UNSIGNED */ + { 284, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ + { 284, -1 }, /* (155) type_name ::= JSON */ + { 284, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (157) type_name ::= MEDIUMBLOB */ + { 284, -1 }, /* (158) type_name ::= BLOB */ + { 284, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (160) type_name ::= DECIMAL */ + { 284, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 284, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 276, 0 }, /* (163) tags_def_opt ::= */ + { 276, -1 }, /* (164) tags_def_opt ::= tags_def */ + { 279, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 277, 0 }, /* (166) table_options ::= */ + { 277, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ + { 277, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ + { 277, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ + { 277, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 277, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ + { 277, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 282, -1 }, /* (173) alter_table_options ::= alter_table_option */ + { 282, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ + { 295, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ + { 295, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ + { 293, -1 }, /* (177) duration_list ::= duration_literal */ + { 293, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ + { 294, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ + { 294, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 297, -1 }, /* (181) rollup_func_name ::= function_name */ + { 297, -1 }, /* (182) rollup_func_name ::= FIRST */ + { 297, -1 }, /* (183) rollup_func_name ::= LAST */ + { 290, -1 }, /* (184) col_name_list ::= col_name */ + { 290, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ + { 299, -1 }, /* (186) col_name ::= column_name */ + { 252, -2 }, /* (187) cmd ::= SHOW DNODES */ + { 252, -2 }, /* (188) cmd ::= SHOW USERS */ + { 252, -2 }, /* (189) cmd ::= SHOW DATABASES */ + { 252, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 252, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 252, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 252, -2 }, /* (193) cmd ::= SHOW MNODES */ + { 252, -2 }, /* (194) cmd ::= SHOW MODULES */ + { 252, -2 }, /* (195) cmd ::= SHOW QNODES */ + { 252, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ + { 252, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 252, -2 }, /* (198) cmd ::= SHOW STREAMS */ + { 252, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ + { 252, -2 }, /* (200) cmd ::= SHOW APPS */ + { 252, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ + { 252, -2 }, /* (202) cmd ::= SHOW LICENCE */ + { 252, -2 }, /* (203) cmd ::= SHOW GRANTS */ + { 252, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ + { 252, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ + { 252, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ + { 252, -2 }, /* (207) cmd ::= SHOW QUERIES */ + { 252, -2 }, /* (208) cmd ::= SHOW SCORES */ + { 252, -2 }, /* (209) cmd ::= SHOW TOPICS */ + { 252, -2 }, /* (210) cmd ::= SHOW VARIABLES */ + { 252, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ + { 252, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 252, -2 }, /* (213) cmd ::= SHOW BNODES */ + { 252, -2 }, /* (214) cmd ::= SHOW SNODES */ + { 252, -2 }, /* (215) cmd ::= SHOW CLUSTER */ + { 252, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ + { 252, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 252, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ + { 252, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ + { 300, 0 }, /* (220) db_name_cond_opt ::= */ + { 300, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ + { 301, 0 }, /* (222) like_pattern_opt ::= */ + { 301, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ + { 302, -1 }, /* (224) table_name_cond ::= table_name */ + { 303, 0 }, /* (225) from_db_opt ::= */ + { 303, -2 }, /* (226) from_db_opt ::= FROM db_name */ + { 252, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 252, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ + { 305, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 305, -12 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 306, -1 }, /* (231) func_list ::= func */ + { 306, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ + { 309, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ + { 308, 0 }, /* (234) sma_stream_opt ::= */ + { 308, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 308, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 252, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 252, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 252, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 252, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 252, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 252, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ + { 252, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 252, -2 }, /* (244) cmd ::= DESC full_table_name */ + { 252, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ + { 252, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ + { 252, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 315, 0 }, /* (248) analyze_opt ::= */ + { 315, -1 }, /* (249) analyze_opt ::= ANALYZE */ + { 316, 0 }, /* (250) explain_options ::= */ + { 316, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 316, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ + { 252, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 252, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 252, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ + { 317, 0 }, /* (256) agg_func_opt ::= */ + { 317, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ + { 318, 0 }, /* (258) bufsize_opt ::= */ + { 318, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 252, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 252, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ + { 320, 0 }, /* (262) into_opt ::= */ + { 320, -2 }, /* (263) into_opt ::= INTO full_table_name */ + { 311, 0 }, /* (264) stream_options ::= */ + { 311, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 311, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 311, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 311, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ + { 311, -3 }, /* (269) stream_options ::= stream_options IGNORE EXPIRED */ + { 252, -3 }, /* (270) cmd ::= KILL CONNECTION NK_INTEGER */ + { 252, -3 }, /* (271) cmd ::= KILL QUERY NK_STRING */ + { 252, -3 }, /* (272) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 252, -2 }, /* (273) cmd ::= BALANCE VGROUP */ + { 252, -4 }, /* (274) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 252, -4 }, /* (275) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 252, -3 }, /* (276) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 321, -2 }, /* (277) dnode_list ::= DNODE NK_INTEGER */ + { 321, -3 }, /* (278) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 252, -3 }, /* (279) cmd ::= SYNCDB db_name REPLICA */ + { 252, -4 }, /* (280) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 252, -1 }, /* (281) cmd ::= query_expression */ + { 255, -1 }, /* (282) literal ::= NK_INTEGER */ + { 255, -1 }, /* (283) literal ::= NK_FLOAT */ + { 255, -1 }, /* (284) literal ::= NK_STRING */ + { 255, -1 }, /* (285) literal ::= NK_BOOL */ + { 255, -2 }, /* (286) literal ::= TIMESTAMP NK_STRING */ + { 255, -1 }, /* (287) literal ::= duration_literal */ + { 255, -1 }, /* (288) literal ::= NULL */ + { 255, -1 }, /* (289) literal ::= NK_QUESTION */ + { 296, -1 }, /* (290) duration_literal ::= NK_VARIABLE */ + { 323, -1 }, /* (291) signed ::= NK_INTEGER */ + { 323, -2 }, /* (292) signed ::= NK_PLUS NK_INTEGER */ + { 323, -2 }, /* (293) signed ::= NK_MINUS NK_INTEGER */ + { 323, -1 }, /* (294) signed ::= NK_FLOAT */ + { 323, -2 }, /* (295) signed ::= NK_PLUS NK_FLOAT */ + { 323, -2 }, /* (296) signed ::= NK_MINUS NK_FLOAT */ + { 285, -1 }, /* (297) signed_literal ::= signed */ + { 285, -1 }, /* (298) signed_literal ::= NK_STRING */ + { 285, -1 }, /* (299) signed_literal ::= NK_BOOL */ + { 285, -2 }, /* (300) signed_literal ::= TIMESTAMP NK_STRING */ + { 285, -1 }, /* (301) signed_literal ::= duration_literal */ + { 285, -1 }, /* (302) signed_literal ::= NULL */ + { 285, -1 }, /* (303) signed_literal ::= literal_func */ + { 288, -1 }, /* (304) literal_list ::= signed_literal */ + { 288, -3 }, /* (305) literal_list ::= literal_list NK_COMMA signed_literal */ + { 263, -1 }, /* (306) db_name ::= NK_ID */ + { 291, -1 }, /* (307) table_name ::= NK_ID */ + { 283, -1 }, /* (308) column_name ::= NK_ID */ + { 298, -1 }, /* (309) function_name ::= NK_ID */ + { 325, -1 }, /* (310) table_alias ::= NK_ID */ + { 326, -1 }, /* (311) column_alias ::= NK_ID */ + { 257, -1 }, /* (312) user_name ::= NK_ID */ + { 304, -1 }, /* (313) index_name ::= NK_ID */ + { 312, -1 }, /* (314) topic_name ::= NK_ID */ + { 319, -1 }, /* (315) stream_name ::= NK_ID */ + { 314, -1 }, /* (316) cgroup_name ::= NK_ID */ + { 327, -1 }, /* (317) expression ::= literal */ + { 327, -1 }, /* (318) expression ::= pseudo_column */ + { 327, -1 }, /* (319) expression ::= column_reference */ + { 327, -1 }, /* (320) expression ::= function_expression */ + { 327, -1 }, /* (321) expression ::= subquery */ + { 327, -3 }, /* (322) expression ::= NK_LP expression NK_RP */ + { 327, -2 }, /* (323) expression ::= NK_PLUS expression */ + { 327, -2 }, /* (324) expression ::= NK_MINUS expression */ + { 327, -3 }, /* (325) expression ::= expression NK_PLUS expression */ + { 327, -3 }, /* (326) expression ::= expression NK_MINUS expression */ + { 327, -3 }, /* (327) expression ::= expression NK_STAR expression */ + { 327, -3 }, /* (328) expression ::= expression NK_SLASH expression */ + { 327, -3 }, /* (329) expression ::= expression NK_REM expression */ + { 327, -3 }, /* (330) expression ::= column_reference NK_ARROW NK_STRING */ + { 327, -3 }, /* (331) expression ::= expression NK_BITAND expression */ + { 327, -3 }, /* (332) expression ::= expression NK_BITOR expression */ + { 310, -1 }, /* (333) expression_list ::= expression */ + { 310, -3 }, /* (334) expression_list ::= expression_list NK_COMMA expression */ + { 329, -1 }, /* (335) column_reference ::= column_name */ + { 329, -3 }, /* (336) column_reference ::= table_name NK_DOT column_name */ + { 328, -1 }, /* (337) pseudo_column ::= ROWTS */ + { 328, -1 }, /* (338) pseudo_column ::= TBNAME */ + { 328, -3 }, /* (339) pseudo_column ::= table_name NK_DOT TBNAME */ + { 328, -1 }, /* (340) pseudo_column ::= QSTARTTS */ + { 328, -1 }, /* (341) pseudo_column ::= QENDTS */ + { 328, -1 }, /* (342) pseudo_column ::= WSTARTTS */ + { 328, -1 }, /* (343) pseudo_column ::= WENDTS */ + { 328, -1 }, /* (344) pseudo_column ::= WDURATION */ + { 330, -4 }, /* (345) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 330, -4 }, /* (346) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 330, -6 }, /* (347) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 330, -1 }, /* (348) function_expression ::= literal_func */ + { 324, -3 }, /* (349) literal_func ::= noarg_func NK_LP NK_RP */ + { 324, -1 }, /* (350) literal_func ::= NOW */ + { 334, -1 }, /* (351) noarg_func ::= NOW */ + { 334, -1 }, /* (352) noarg_func ::= TODAY */ + { 334, -1 }, /* (353) noarg_func ::= TIMEZONE */ + { 334, -1 }, /* (354) noarg_func ::= DATABASE */ + { 334, -1 }, /* (355) noarg_func ::= CLIENT_VERSION */ + { 334, -1 }, /* (356) noarg_func ::= SERVER_VERSION */ + { 334, -1 }, /* (357) noarg_func ::= SERVER_STATUS */ + { 334, -1 }, /* (358) noarg_func ::= CURRENT_USER */ + { 334, -1 }, /* (359) noarg_func ::= USER */ + { 332, -1 }, /* (360) star_func ::= COUNT */ + { 332, -1 }, /* (361) star_func ::= FIRST */ + { 332, -1 }, /* (362) star_func ::= LAST */ + { 332, -1 }, /* (363) star_func ::= LAST_ROW */ + { 333, -1 }, /* (364) star_func_para_list ::= NK_STAR */ + { 333, -1 }, /* (365) star_func_para_list ::= other_para_list */ + { 335, -1 }, /* (366) other_para_list ::= star_func_para */ + { 335, -3 }, /* (367) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 336, -1 }, /* (368) star_func_para ::= expression */ + { 336, -3 }, /* (369) star_func_para ::= table_name NK_DOT NK_STAR */ + { 337, -3 }, /* (370) predicate ::= expression compare_op expression */ + { 337, -5 }, /* (371) predicate ::= expression BETWEEN expression AND expression */ + { 337, -6 }, /* (372) predicate ::= expression NOT BETWEEN expression AND expression */ + { 337, -3 }, /* (373) predicate ::= expression IS NULL */ + { 337, -4 }, /* (374) predicate ::= expression IS NOT NULL */ + { 337, -3 }, /* (375) predicate ::= expression in_op in_predicate_value */ + { 338, -1 }, /* (376) compare_op ::= NK_LT */ + { 338, -1 }, /* (377) compare_op ::= NK_GT */ + { 338, -1 }, /* (378) compare_op ::= NK_LE */ + { 338, -1 }, /* (379) compare_op ::= NK_GE */ + { 338, -1 }, /* (380) compare_op ::= NK_NE */ + { 338, -1 }, /* (381) compare_op ::= NK_EQ */ + { 338, -1 }, /* (382) compare_op ::= LIKE */ + { 338, -2 }, /* (383) compare_op ::= NOT LIKE */ + { 338, -1 }, /* (384) compare_op ::= MATCH */ + { 338, -1 }, /* (385) compare_op ::= NMATCH */ + { 338, -1 }, /* (386) compare_op ::= CONTAINS */ + { 339, -1 }, /* (387) in_op ::= IN */ + { 339, -2 }, /* (388) in_op ::= NOT IN */ + { 340, -3 }, /* (389) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 341, -1 }, /* (390) boolean_value_expression ::= boolean_primary */ + { 341, -2 }, /* (391) boolean_value_expression ::= NOT boolean_primary */ + { 341, -3 }, /* (392) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 341, -3 }, /* (393) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 342, -1 }, /* (394) boolean_primary ::= predicate */ + { 342, -3 }, /* (395) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 343, -1 }, /* (396) common_expression ::= expression */ + { 343, -1 }, /* (397) common_expression ::= boolean_value_expression */ + { 344, 0 }, /* (398) from_clause_opt ::= */ + { 344, -2 }, /* (399) from_clause_opt ::= FROM table_reference_list */ + { 345, -1 }, /* (400) table_reference_list ::= table_reference */ + { 345, -3 }, /* (401) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 346, -1 }, /* (402) table_reference ::= table_primary */ + { 346, -1 }, /* (403) table_reference ::= joined_table */ + { 347, -2 }, /* (404) table_primary ::= table_name alias_opt */ + { 347, -4 }, /* (405) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 347, -2 }, /* (406) table_primary ::= subquery alias_opt */ + { 347, -1 }, /* (407) table_primary ::= parenthesized_joined_table */ + { 349, 0 }, /* (408) alias_opt ::= */ + { 349, -1 }, /* (409) alias_opt ::= table_alias */ + { 349, -2 }, /* (410) alias_opt ::= AS table_alias */ + { 350, -3 }, /* (411) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 350, -3 }, /* (412) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 348, -6 }, /* (413) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 351, 0 }, /* (414) join_type ::= */ + { 351, -1 }, /* (415) join_type ::= INNER */ + { 353, -12 }, /* (416) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 354, 0 }, /* (417) set_quantifier_opt ::= */ + { 354, -1 }, /* (418) set_quantifier_opt ::= DISTINCT */ + { 354, -1 }, /* (419) set_quantifier_opt ::= ALL */ + { 355, -1 }, /* (420) select_list ::= select_item */ + { 355, -3 }, /* (421) select_list ::= select_list NK_COMMA select_item */ + { 363, -1 }, /* (422) select_item ::= NK_STAR */ + { 363, -1 }, /* (423) select_item ::= common_expression */ + { 363, -2 }, /* (424) select_item ::= common_expression column_alias */ + { 363, -3 }, /* (425) select_item ::= common_expression AS column_alias */ + { 363, -3 }, /* (426) select_item ::= table_name NK_DOT NK_STAR */ + { 322, 0 }, /* (427) where_clause_opt ::= */ + { 322, -2 }, /* (428) where_clause_opt ::= WHERE search_condition */ + { 356, 0 }, /* (429) partition_by_clause_opt ::= */ + { 356, -3 }, /* (430) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 360, 0 }, /* (431) twindow_clause_opt ::= */ + { 360, -6 }, /* (432) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 360, -4 }, /* (433) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 360, -6 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 360, -8 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 307, 0 }, /* (436) sliding_opt ::= */ + { 307, -4 }, /* (437) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 359, 0 }, /* (438) fill_opt ::= */ + { 359, -4 }, /* (439) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 359, -6 }, /* (440) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 364, -1 }, /* (441) fill_mode ::= NONE */ + { 364, -1 }, /* (442) fill_mode ::= PREV */ + { 364, -1 }, /* (443) fill_mode ::= NULL */ + { 364, -1 }, /* (444) fill_mode ::= LINEAR */ + { 364, -1 }, /* (445) fill_mode ::= NEXT */ + { 361, 0 }, /* (446) group_by_clause_opt ::= */ + { 361, -3 }, /* (447) group_by_clause_opt ::= GROUP BY group_by_list */ + { 365, -1 }, /* (448) group_by_list ::= expression */ + { 365, -3 }, /* (449) group_by_list ::= group_by_list NK_COMMA expression */ + { 362, 0 }, /* (450) having_clause_opt ::= */ + { 362, -2 }, /* (451) having_clause_opt ::= HAVING search_condition */ + { 357, 0 }, /* (452) range_opt ::= */ + { 357, -6 }, /* (453) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 358, 0 }, /* (454) every_opt ::= */ + { 358, -4 }, /* (455) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 313, -4 }, /* (456) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 366, -1 }, /* (457) query_expression_body ::= query_primary */ + { 366, -4 }, /* (458) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 366, -3 }, /* (459) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 370, -1 }, /* (460) query_primary ::= query_specification */ + { 370, -6 }, /* (461) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 367, 0 }, /* (462) order_by_clause_opt ::= */ + { 367, -3 }, /* (463) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 368, 0 }, /* (464) slimit_clause_opt ::= */ + { 368, -2 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 368, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 368, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 369, 0 }, /* (468) limit_clause_opt ::= */ + { 369, -2 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 369, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 369, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 331, -3 }, /* (472) subquery ::= NK_LP query_expression NK_RP */ + { 352, -1 }, /* (473) search_condition ::= common_expression */ + { 371, -1 }, /* (474) sort_specification_list ::= sort_specification */ + { 371, -3 }, /* (475) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 372, -3 }, /* (476) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 373, 0 }, /* (477) ordering_specification_opt ::= */ + { 373, -1 }, /* (478) ordering_specification_opt ::= ASC */ + { 373, -1 }, /* (479) ordering_specification_opt ::= DESC */ + { 374, 0 }, /* (480) null_ordering_opt ::= */ + { 374, -2 }, /* (481) null_ordering_opt ::= NULLS FIRST */ + { 374, -2 }, /* (482) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3279,11 +3280,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,251,&yymsp[0].minor); + yy_destructor(yypParser,253,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,252,&yymsp[0].minor); + yy_destructor(yypParser,254,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3297,20 +3298,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,251,&yymsp[-2].minor); +{ yy_destructor(yypParser,253,&yymsp[-2].minor); { } - yy_destructor(yypParser,253,&yymsp[0].minor); + yy_destructor(yypParser,255,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,254,&yymsp[0].minor); +{ yy_destructor(yypParser,256,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,252,&yymsp[-1].minor); +{ yy_destructor(yypParser,254,&yymsp[-1].minor); { } - yy_destructor(yypParser,254,&yymsp[0].minor); + yy_destructor(yypParser,256,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3324,72 +3325,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,253,&yymsp[0].minor); + yy_destructor(yypParser,255,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy0, yymsp[0].minor.yy57); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy0, yymsp[0].minor.yy653); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy7, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy329); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy57 = 1; } +{ yymsp[1].minor.yy653 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy57 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy653 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy193, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy193, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy193 = yymsp[0].minor.yy193; } - yymsp[0].minor.yy193 = yylhsminor.yy193; +{ yylhsminor.yy609 = yymsp[0].minor.yy609; } + yymsp[0].minor.yy609 = yylhsminor.yy609; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy193 = yymsp[-2].minor.yy193 | yymsp[0].minor.yy193; } - yymsp[-2].minor.yy193 = yylhsminor.yy193; +{ yylhsminor.yy609 = yymsp[-2].minor.yy609 | yymsp[0].minor.yy609; } + yymsp[-2].minor.yy609 = yylhsminor.yy609; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy193 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy7 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy7 = yylhsminor.yy7; +{ yylhsminor.yy329 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy329 = yylhsminor.yy329; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy7 = yymsp[-2].minor.yy7; } - yymsp[-2].minor.yy7 = yylhsminor.yy7; +{ yylhsminor.yy329 = yymsp[-2].minor.yy329; } + yymsp[-2].minor.yy329 = yylhsminor.yy329; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy7, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy329, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy329); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3406,32 +3407,32 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 305: /* db_name ::= NK_ID */ yytestcase(yyruleno==305); - case 306: /* table_name ::= NK_ID */ yytestcase(yyruleno==306); - case 307: /* column_name ::= NK_ID */ yytestcase(yyruleno==307); - case 308: /* function_name ::= NK_ID */ yytestcase(yyruleno==308); - case 309: /* table_alias ::= NK_ID */ yytestcase(yyruleno==309); - case 310: /* column_alias ::= NK_ID */ yytestcase(yyruleno==310); - case 311: /* user_name ::= NK_ID */ yytestcase(yyruleno==311); - case 312: /* index_name ::= NK_ID */ yytestcase(yyruleno==312); - case 313: /* topic_name ::= NK_ID */ yytestcase(yyruleno==313); - case 314: /* stream_name ::= NK_ID */ yytestcase(yyruleno==314); - case 315: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==315); - case 350: /* noarg_func ::= NOW */ yytestcase(yyruleno==350); - case 351: /* noarg_func ::= TODAY */ yytestcase(yyruleno==351); - case 352: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==352); - case 353: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==353); - case 354: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==354); - case 355: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==355); - case 356: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==356); - case 357: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==357); - case 358: /* noarg_func ::= USER */ yytestcase(yyruleno==358); - case 359: /* star_func ::= COUNT */ yytestcase(yyruleno==359); - case 360: /* star_func ::= FIRST */ yytestcase(yyruleno==360); - case 361: /* star_func ::= LAST */ yytestcase(yyruleno==361); - case 362: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==362); -{ yylhsminor.yy7 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy7 = yylhsminor.yy7; + case 306: /* db_name ::= NK_ID */ yytestcase(yyruleno==306); + case 307: /* table_name ::= NK_ID */ yytestcase(yyruleno==307); + case 308: /* column_name ::= NK_ID */ yytestcase(yyruleno==308); + case 309: /* function_name ::= NK_ID */ yytestcase(yyruleno==309); + case 310: /* table_alias ::= NK_ID */ yytestcase(yyruleno==310); + case 311: /* column_alias ::= NK_ID */ yytestcase(yyruleno==311); + case 312: /* user_name ::= NK_ID */ yytestcase(yyruleno==312); + case 313: /* index_name ::= NK_ID */ yytestcase(yyruleno==313); + case 314: /* topic_name ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* stream_name ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==316); + case 351: /* noarg_func ::= NOW */ yytestcase(yyruleno==351); + case 352: /* noarg_func ::= TODAY */ yytestcase(yyruleno==352); + case 353: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==353); + case 354: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==354); + case 355: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==355); + case 356: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==356); + case 357: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==357); + case 358: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==358); + case 359: /* noarg_func ::= USER */ yytestcase(yyruleno==359); + case 360: /* star_func ::= COUNT */ yytestcase(yyruleno==360); + case 361: /* star_func ::= FIRST */ yytestcase(yyruleno==361); + case 362: /* star_func ::= LAST */ yytestcase(yyruleno==362); + case 363: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==363); +{ yylhsminor.yy329 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy329 = yylhsminor.yy329; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3464,156 +3465,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy419, &yymsp[-1].minor.yy7, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy737, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy7, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } break; case 66: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy419 = true; } +{ yymsp[-2].minor.yy737 = true; } break; case 67: /* not_exists_opt ::= */ case 69: /* exists_opt ::= */ yytestcase(yyruleno==69); case 248: /* analyze_opt ::= */ yytestcase(yyruleno==248); case 256: /* agg_func_opt ::= */ yytestcase(yyruleno==256); - case 416: /* set_quantifier_opt ::= */ yytestcase(yyruleno==416); -{ yymsp[1].minor.yy419 = false; } + case 417: /* set_quantifier_opt ::= */ yytestcase(yyruleno==417); +{ yymsp[1].minor.yy737 = false; } break; case 68: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy419 = true; } +{ yymsp[-1].minor.yy737 = true; } break; case 70: /* db_options ::= */ -{ yymsp[1].minor.yy184 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultDatabaseOptions(pCxt); } break; case 71: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 72: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 73: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 74: /* db_options ::= db_options DURATION NK_INTEGER */ case 75: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==75); -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 76: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 77: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 78: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 79: /* db_options ::= db_options KEEP integer_list */ case 80: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==80); -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_KEEP, yymsp[0].minor.yy296); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_KEEP, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 81: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 82: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 83: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 84: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 85: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 86: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 87: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 88: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 89: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_RETENTIONS, yymsp[0].minor.yy296); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 90: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy184 = setDatabaseOption(pCxt, yymsp[-2].minor.yy184, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 91: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy184 = createAlterDatabaseOptions(pCxt); yylhsminor.yy184 = setAlterDatabaseOption(pCxt, yylhsminor.yy184, &yymsp[0].minor.yy139); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterDatabaseOptions(pCxt); yylhsminor.yy212 = setAlterDatabaseOption(pCxt, yylhsminor.yy212, &yymsp[0].minor.yy245); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 92: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy184 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy184, &yymsp[0].minor.yy139); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy212, &yymsp[0].minor.yy245); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 93: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 94: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 95: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 96: /* alter_db_option ::= KEEP integer_list */ case 97: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==97); -{ yymsp[-1].minor.yy139.type = DB_OPTION_KEEP; yymsp[-1].minor.yy139.pList = yymsp[0].minor.yy296; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_KEEP; yymsp[-1].minor.yy245.pList = yymsp[0].minor.yy424; } break; case 98: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_PAGES; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_PAGES; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 99: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 100: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_STRICT; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_STRICT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 101: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = DB_OPTION_WAL; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 102: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy296 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy296 = yylhsminor.yy296; +{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 277: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==277); -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy296 = yylhsminor.yy296; + case 278: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==278); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 104: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy296 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy296 = yylhsminor.yy296; +{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy296 = yylhsminor.yy296; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 106: /* retention_list ::= retention */ case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); @@ -3622,264 +3623,264 @@ static YYACTIONTYPE yy_reduce( case 179: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==179); case 184: /* col_name_list ::= col_name */ yytestcase(yyruleno==184); case 231: /* func_list ::= func */ yytestcase(yyruleno==231); - case 303: /* literal_list ::= signed_literal */ yytestcase(yyruleno==303); - case 365: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==365); - case 419: /* select_list ::= select_item */ yytestcase(yyruleno==419); - case 473: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==473); -{ yylhsminor.yy296 = createNodeList(pCxt, yymsp[0].minor.yy184); } - yymsp[0].minor.yy296 = yylhsminor.yy296; + case 304: /* literal_list ::= signed_literal */ yytestcase(yyruleno==304); + case 366: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==366); + case 420: /* select_list ::= select_item */ yytestcase(yyruleno==420); + case 474: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==474); +{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy212); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 107: /* retention_list ::= retention_list NK_COMMA retention */ case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); case 180: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==180); case 185: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); case 232: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==232); - case 304: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==304); - case 366: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==366); - case 420: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==420); - case 474: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==474); -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, yymsp[0].minor.yy184); } - yymsp[-2].minor.yy296 = yylhsminor.yy296; + case 305: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==305); + case 367: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==367); + case 421: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==421); + case 475: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==475); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy184 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy419, yymsp[-5].minor.yy184, yymsp[-3].minor.yy296, yymsp[-1].minor.yy296, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy737, yymsp[-5].minor.yy212, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy212); } break; case 110: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy296); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy296); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy419, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy212); } break; case 114: /* cmd ::= ALTER TABLE alter_table_clause */ case 115: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==115); - case 280: /* cmd ::= query_expression */ yytestcase(yyruleno==280); -{ pCxt->pRootNode = yymsp[0].minor.yy184; } + case 281: /* cmd ::= query_expression */ yytestcase(yyruleno==281); +{ pCxt->pRootNode = yymsp[0].minor.yy212; } break; case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy184 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy184 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy184, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy7); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy212, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy184 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy184 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy184, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy7); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy212, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy184 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy184 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy184, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy184 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy184, &yymsp[-2].minor.yy7, yymsp[0].minor.yy184); } - yymsp[-5].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy212, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-1].minor.yy296, yymsp[0].minor.yy184); } - yymsp[-1].minor.yy296 = yylhsminor.yy296; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy424 = yylhsminor.yy424; break; case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ -{ yylhsminor.yy184 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy419, yymsp[-8].minor.yy184, yymsp[-6].minor.yy184, yymsp[-5].minor.yy296, yymsp[-2].minor.yy296, yymsp[0].minor.yy184); } - yymsp[-9].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy737, yymsp[-8].minor.yy212, yymsp[-6].minor.yy212, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-9].minor.yy212 = yylhsminor.yy212; break; case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy184 = createDropTableClause(pCxt, yymsp[-1].minor.yy419, yymsp[0].minor.yy184); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createDropTableClause(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 132: /* specific_tags_opt ::= */ case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); - case 428: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==428); - case 445: /* group_by_clause_opt ::= */ yytestcase(yyruleno==445); - case 461: /* order_by_clause_opt ::= */ yytestcase(yyruleno==461); -{ yymsp[1].minor.yy296 = NULL; } + case 429: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==429); + case 446: /* group_by_clause_opt ::= */ yytestcase(yyruleno==446); + case 462: /* order_by_clause_opt ::= */ yytestcase(yyruleno==462); +{ yymsp[1].minor.yy424 = NULL; } break; case 133: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy296 = yymsp[-1].minor.yy296; } +{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; } break; case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy184 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy7, NULL); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy329, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy184 = createRealTableNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7, NULL); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createRealTableNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, NULL); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy184 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy7, yymsp[0].minor.yy332, NULL); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34, NULL); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy184 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-2].minor.yy332, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-2].minor.yy34, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 143: /* type_name ::= INT */ case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_INT); } break; case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy332 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy332 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy332 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 164: /* tags_def_opt ::= tags_def */ - case 364: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==364); -{ yylhsminor.yy296 = yymsp[0].minor.yy296; } - yymsp[0].minor.yy296 = yylhsminor.yy296; + case 365: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==365); +{ yylhsminor.yy424 = yymsp[0].minor.yy424; } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy296 = yymsp[-1].minor.yy296; } +{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; } break; case 166: /* table_options ::= */ -{ yymsp[1].minor.yy184 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultTableOptions(pCxt); } break; case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy296); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy296); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-4].minor.yy184, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy296); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-2].minor.yy184, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-4].minor.yy184, TABLE_OPTION_SMA, yymsp[-1].minor.yy296); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 173: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy184 = createAlterTableOptions(pCxt); yylhsminor.yy184 = setTableOption(pCxt, yylhsminor.yy184, yymsp[0].minor.yy139.type, &yymsp[0].minor.yy139.val); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createAlterTableOptions(pCxt); yylhsminor.yy212 = setTableOption(pCxt, yylhsminor.yy212, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy184 = setTableOption(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy139.type, &yymsp[0].minor.yy139.val); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy139.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy139.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy139.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 177: /* duration_list ::= duration_literal */ - case 332: /* expression_list ::= expression */ yytestcase(yyruleno==332); -{ yylhsminor.yy296 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); } - yymsp[0].minor.yy296 = yylhsminor.yy296; + case 333: /* expression_list ::= expression */ yytestcase(yyruleno==333); +{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 333: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==333); -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); } - yymsp[-2].minor.yy296 = yylhsminor.yy296; + case 334: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==334); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[0].minor.yy7, NULL); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy329, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 182: /* rollup_func_name ::= FIRST */ case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 186: /* col_name ::= column_name */ -{ yylhsminor.yy184 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy7); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 187: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3891,13 +3892,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } break; case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } break; case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy184, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy212, NULL, OP_TYPE_LIKE); } break; case 193: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -3912,7 +3913,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy184, yymsp[-1].minor.yy184, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy212, yymsp[-1].minor.yy212, OP_TYPE_EQUAL); } break; case 198: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -3931,13 +3932,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } break; case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy212); } break; case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy212); } break; case 207: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -3970,7 +3971,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy212); } break; case 218: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -3980,699 +3981,703 @@ static YYACTIONTYPE yy_reduce( break; case 220: /* db_name_cond_opt ::= */ case 225: /* from_db_opt ::= */ yytestcase(yyruleno==225); -{ yymsp[1].minor.yy184 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultDatabaseCondValue(pCxt); } break; case 221: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy7); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 222: /* like_pattern_opt ::= */ case 262: /* into_opt ::= */ yytestcase(yyruleno==262); - case 397: /* from_clause_opt ::= */ yytestcase(yyruleno==397); - case 426: /* where_clause_opt ::= */ yytestcase(yyruleno==426); - case 430: /* twindow_clause_opt ::= */ yytestcase(yyruleno==430); - case 435: /* sliding_opt ::= */ yytestcase(yyruleno==435); - case 437: /* fill_opt ::= */ yytestcase(yyruleno==437); - case 449: /* having_clause_opt ::= */ yytestcase(yyruleno==449); - case 451: /* range_opt ::= */ yytestcase(yyruleno==451); - case 453: /* every_opt ::= */ yytestcase(yyruleno==453); - case 463: /* slimit_clause_opt ::= */ yytestcase(yyruleno==463); - case 467: /* limit_clause_opt ::= */ yytestcase(yyruleno==467); -{ yymsp[1].minor.yy184 = NULL; } + case 398: /* from_clause_opt ::= */ yytestcase(yyruleno==398); + case 427: /* where_clause_opt ::= */ yytestcase(yyruleno==427); + case 431: /* twindow_clause_opt ::= */ yytestcase(yyruleno==431); + case 436: /* sliding_opt ::= */ yytestcase(yyruleno==436); + case 438: /* fill_opt ::= */ yytestcase(yyruleno==438); + case 450: /* having_clause_opt ::= */ yytestcase(yyruleno==450); + case 452: /* range_opt ::= */ yytestcase(yyruleno==452); + case 454: /* every_opt ::= */ yytestcase(yyruleno==454); + case 464: /* slimit_clause_opt ::= */ yytestcase(yyruleno==464); + case 468: /* limit_clause_opt ::= */ yytestcase(yyruleno==468); +{ yymsp[1].minor.yy212 = NULL; } break; case 223: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 224: /* table_name_cond ::= table_name */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy7); } - yymsp[0].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 226: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy7); } +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } break; case 227: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy7, NULL, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, NULL, yymsp[0].minor.yy212); } break; case 228: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 229: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy184 = createIndexOption(pCxt, yymsp[-7].minor.yy296, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } +{ yymsp[-9].minor.yy212 = createIndexOption(pCxt, yymsp[-7].minor.yy424, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy184 = createIndexOption(pCxt, yymsp[-9].minor.yy296, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } +{ yymsp[-11].minor.yy212 = createIndexOption(pCxt, yymsp[-9].minor.yy424, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 233: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy184 = createFunctionNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-1].minor.yy296); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 234: /* sma_stream_opt ::= */ case 264: /* stream_options ::= */ yytestcase(yyruleno==264); -{ yymsp[1].minor.yy184 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy212 = createStreamOptions(pCxt); } break; case 235: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 268: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==268); -{ ((SStreamOptions*)yymsp[-2].minor.yy184)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-2].minor.yy184; } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 236: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy184)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-2].minor.yy184; } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 237: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy419, &yymsp[-2].minor.yy7, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } break; case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, &yymsp[0].minor.yy7, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy329, false); } break; case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy419, &yymsp[-5].minor.yy7, &yymsp[0].minor.yy7, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy737, &yymsp[-5].minor.yy329, &yymsp[0].minor.yy329, true); } break; case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy419, &yymsp[-3].minor.yy7, yymsp[0].minor.yy184, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, yymsp[0].minor.yy212, false); } break; case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy419, &yymsp[-5].minor.yy7, yymsp[0].minor.yy184, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy737, &yymsp[-5].minor.yy329, yymsp[0].minor.yy212, true); } break; case 242: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 243: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy419, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 244: /* cmd ::= DESC full_table_name */ case 245: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==245); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy212); } break; case 246: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 247: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy419, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy737, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 249: /* analyze_opt ::= ANALYZE */ case 257: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==257); - case 417: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==417); -{ yymsp[0].minor.yy419 = true; } + case 418: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==418); +{ yymsp[0].minor.yy737 = true; } break; case 250: /* explain_options ::= */ -{ yymsp[1].minor.yy184 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultExplainOptions(pCxt); } break; case 251: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy184 = setExplainVerbose(pCxt, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setExplainVerbose(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 252: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy184 = setExplainRatio(pCxt, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ yylhsminor.yy212 = setExplainRatio(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 253: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy296); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy424); } break; case 254: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy419, yymsp[-8].minor.yy419, &yymsp[-5].minor.yy7, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy332, yymsp[0].minor.yy20); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy737, yymsp[-8].minor.yy737, &yymsp[-5].minor.yy329, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy34, yymsp[0].minor.yy610); } break; case 255: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 258: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy20 = 0; } +{ yymsp[1].minor.yy610 = 0; } break; case 259: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy20 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy610 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 260: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy419, &yymsp[-4].minor.yy7, yymsp[-2].minor.yy184, yymsp[-3].minor.yy184, yymsp[0].minor.yy184); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy737, &yymsp[-4].minor.yy329, yymsp[-2].minor.yy212, yymsp[-3].minor.yy212, yymsp[0].minor.yy212); } break; case 261: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy419, &yymsp[0].minor.yy7); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 263: /* into_opt ::= INTO full_table_name */ - case 398: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==398); - case 427: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==427); - case 450: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==450); -{ yymsp[-1].minor.yy184 = yymsp[0].minor.yy184; } + case 399: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==399); + case 428: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==428); + case 451: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==451); +{ yymsp[-1].minor.yy212 = yymsp[0].minor.yy212; } break; case 265: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy184)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy184 = yymsp[-2].minor.yy184; } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 266: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy184)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy184 = yymsp[-2].minor.yy184; } - yymsp[-2].minor.yy184 = yylhsminor.yy184; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 267: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy184)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy184)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); yylhsminor.yy184 = yymsp[-3].minor.yy184; } - yymsp[-3].minor.yy184 = yylhsminor.yy184; +{ ((SStreamOptions*)yymsp[-3].minor.yy212)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy212)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-3].minor.yy212; } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 269: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 269: /* stream_options ::= stream_options IGNORE EXPIRED */ +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->ignoreExpired = true; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; + break; + case 270: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 270: /* cmd ::= KILL QUERY NK_STRING */ + case 271: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 271: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 272: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 272: /* cmd ::= BALANCE VGROUP */ + case 273: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 273: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 274: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 274: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy296); } + case 275: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); } break; - case 275: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 276: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 276: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy296 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 277: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 278: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy7); } + case 279: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy329); } break; - case 279: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } + case 280: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; - case 281: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 282: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 282: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 283: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 283: /* literal ::= NK_STRING */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 284: /* literal ::= NK_STRING */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 284: /* literal ::= NK_BOOL */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 285: /* literal ::= NK_BOOL */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 285: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + case 286: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 286: /* literal ::= duration_literal */ - case 296: /* signed_literal ::= signed */ yytestcase(yyruleno==296); - case 316: /* expression ::= literal */ yytestcase(yyruleno==316); - case 317: /* expression ::= pseudo_column */ yytestcase(yyruleno==317); - case 318: /* expression ::= column_reference */ yytestcase(yyruleno==318); - case 319: /* expression ::= function_expression */ yytestcase(yyruleno==319); - case 320: /* expression ::= subquery */ yytestcase(yyruleno==320); - case 347: /* function_expression ::= literal_func */ yytestcase(yyruleno==347); - case 389: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==389); - case 393: /* boolean_primary ::= predicate */ yytestcase(yyruleno==393); - case 395: /* common_expression ::= expression */ yytestcase(yyruleno==395); - case 396: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==396); - case 399: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==399); - case 401: /* table_reference ::= table_primary */ yytestcase(yyruleno==401); - case 402: /* table_reference ::= joined_table */ yytestcase(yyruleno==402); - case 406: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==406); - case 456: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==456); - case 459: /* query_primary ::= query_specification */ yytestcase(yyruleno==459); -{ yylhsminor.yy184 = yymsp[0].minor.yy184; } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 287: /* literal ::= duration_literal */ + case 297: /* signed_literal ::= signed */ yytestcase(yyruleno==297); + case 317: /* expression ::= literal */ yytestcase(yyruleno==317); + case 318: /* expression ::= pseudo_column */ yytestcase(yyruleno==318); + case 319: /* expression ::= column_reference */ yytestcase(yyruleno==319); + case 320: /* expression ::= function_expression */ yytestcase(yyruleno==320); + case 321: /* expression ::= subquery */ yytestcase(yyruleno==321); + case 348: /* function_expression ::= literal_func */ yytestcase(yyruleno==348); + case 390: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==390); + case 394: /* boolean_primary ::= predicate */ yytestcase(yyruleno==394); + case 396: /* common_expression ::= expression */ yytestcase(yyruleno==396); + case 397: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==397); + case 400: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==400); + case 402: /* table_reference ::= table_primary */ yytestcase(yyruleno==402); + case 403: /* table_reference ::= joined_table */ yytestcase(yyruleno==403); + case 407: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==407); + case 457: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==457); + case 460: /* query_primary ::= query_specification */ yytestcase(yyruleno==460); +{ yylhsminor.yy212 = yymsp[0].minor.yy212; } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 287: /* literal ::= NULL */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 288: /* literal ::= NULL */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 288: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 289: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 289: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 290: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 290: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 291: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 291: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 292: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 292: /* signed ::= NK_MINUS NK_INTEGER */ + case 293: /* 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.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 293: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 294: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 294: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 295: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 295: /* signed ::= NK_MINUS NK_FLOAT */ + case 296: /* 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.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 297: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 298: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 298: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 299: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 299: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 300: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 300: /* signed_literal ::= duration_literal */ - case 302: /* signed_literal ::= literal_func */ yytestcase(yyruleno==302); - case 367: /* star_func_para ::= expression */ yytestcase(yyruleno==367); - case 422: /* select_item ::= common_expression */ yytestcase(yyruleno==422); - case 472: /* search_condition ::= common_expression */ yytestcase(yyruleno==472); -{ yylhsminor.yy184 = releaseRawExprNode(pCxt, yymsp[0].minor.yy184); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 301: /* signed_literal ::= duration_literal */ + case 303: /* signed_literal ::= literal_func */ yytestcase(yyruleno==303); + case 368: /* star_func_para ::= expression */ yytestcase(yyruleno==368); + case 423: /* select_item ::= common_expression */ yytestcase(yyruleno==423); + case 473: /* search_condition ::= common_expression */ yytestcase(yyruleno==473); +{ yylhsminor.yy212 = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 301: /* signed_literal ::= NULL */ -{ yylhsminor.yy184 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 302: /* signed_literal ::= NULL */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 321: /* expression ::= NK_LP expression NK_RP */ - case 394: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==394); -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 322: /* expression ::= NK_LP expression NK_RP */ + case 395: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==395); +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 322: /* expression ::= NK_PLUS expression */ + case 323: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy184)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 323: /* expression ::= NK_MINUS expression */ + case 324: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy184), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy212), NULL)); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 324: /* expression ::= expression NK_PLUS expression */ + case 325: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 325: /* expression ::= expression NK_MINUS expression */ + case 326: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 326: /* expression ::= expression NK_STAR expression */ + case 327: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 327: /* expression ::= expression NK_SLASH expression */ + case 328: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 328: /* expression ::= expression NK_REM expression */ + case 329: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 329: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 330: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 330: /* expression ::= expression NK_BITAND expression */ + case 331: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 331: /* expression ::= expression NK_BITOR expression */ + case 332: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 334: /* column_reference ::= column_name */ -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy7, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy7)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 335: /* column_reference ::= column_name */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy329, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 335: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7, createColumnNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy7)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 336: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 336: /* pseudo_column ::= ROWTS */ - case 337: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==337); - case 339: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==339); - case 340: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==340); - case 341: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==341); - case 342: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==342); - case 343: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==343); - case 349: /* literal_func ::= NOW */ yytestcase(yyruleno==349); -{ yylhsminor.yy184 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 337: /* pseudo_column ::= ROWTS */ + case 338: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==338); + case 340: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==340); + case 341: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==341); + case 342: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==342); + case 343: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==343); + case 344: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==344); + case 350: /* literal_func ::= NOW */ yytestcase(yyruleno==350); +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 338: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy7)))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 339: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy329)))); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 344: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 345: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==345); -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy7, yymsp[-1].minor.yy296)); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; + case 345: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 346: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==346); +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424)); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 346: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy332)); } - yymsp[-5].minor.yy184 = yylhsminor.yy184; + case 347: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy34)); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 348: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy7, NULL)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 349: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy329, NULL)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 363: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy296 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy296 = yylhsminor.yy296; + case 364: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 368: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 425: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==425); -{ yylhsminor.yy184 = createColumnNode(pCxt, &yymsp[-2].minor.yy7, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 369: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 426: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==426); +{ yylhsminor.yy212 = createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 369: /* predicate ::= expression compare_op expression */ - case 374: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==374); + case 370: /* predicate ::= expression compare_op expression */ + case 375: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==375); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy496, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy290, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 370: /* predicate ::= expression BETWEEN expression AND expression */ + case 371: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy184), releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy212), releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-4].minor.yy184 = yylhsminor.yy184; + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; - case 371: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 372: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-5].minor.yy184 = yylhsminor.yy184; + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 372: /* predicate ::= expression IS NULL */ + case 373: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), NULL)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 373: /* predicate ::= expression IS NOT NULL */ + case 374: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL)); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 375: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy496 = OP_TYPE_LOWER_THAN; } + case 376: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_THAN; } break; - case 376: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy496 = OP_TYPE_GREATER_THAN; } + case 377: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_THAN; } break; - case 377: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy496 = OP_TYPE_LOWER_EQUAL; } + case 378: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_EQUAL; } break; - case 378: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy496 = OP_TYPE_GREATER_EQUAL; } + case 379: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_EQUAL; } break; - case 379: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy496 = OP_TYPE_NOT_EQUAL; } + case 380: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy290 = OP_TYPE_NOT_EQUAL; } break; - case 380: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy496 = OP_TYPE_EQUAL; } + case 381: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy290 = OP_TYPE_EQUAL; } break; - case 381: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy496 = OP_TYPE_LIKE; } + case 382: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy290 = OP_TYPE_LIKE; } break; - case 382: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy496 = OP_TYPE_NOT_LIKE; } + case 383: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_LIKE; } break; - case 383: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy496 = OP_TYPE_MATCH; } + case 384: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy290 = OP_TYPE_MATCH; } break; - case 384: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy496 = OP_TYPE_NMATCH; } + case 385: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy290 = OP_TYPE_NMATCH; } break; - case 385: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy496 = OP_TYPE_JSON_CONTAINS; } + case 386: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy290 = OP_TYPE_JSON_CONTAINS; } break; - case 386: /* in_op ::= IN */ -{ yymsp[0].minor.yy496 = OP_TYPE_IN; } + case 387: /* in_op ::= IN */ +{ yymsp[0].minor.yy290 = OP_TYPE_IN; } break; - case 387: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy496 = OP_TYPE_NOT_IN; } + case 388: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_IN; } break; - case 388: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy296)); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 389: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 390: /* boolean_value_expression ::= NOT boolean_primary */ + case 391: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy184), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy212), NULL)); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 391: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 392: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 392: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 393: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy184); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy184); - yylhsminor.yy184 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 400: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy184 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy184, yymsp[0].minor.yy184, NULL); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 401: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy212 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, NULL); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 403: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy184 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + case 404: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy212 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 404: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy184 = createRealTableNode(pCxt, &yymsp[-3].minor.yy7, &yymsp[-1].minor.yy7, &yymsp[0].minor.yy7); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; + case 405: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy212 = createRealTableNode(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 405: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy184 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184), &yymsp[0].minor.yy7); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + case 406: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy212 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 407: /* alias_opt ::= */ -{ yymsp[1].minor.yy7 = nil_token; } + case 408: /* alias_opt ::= */ +{ yymsp[1].minor.yy329 = nil_token; } break; - case 408: /* alias_opt ::= table_alias */ -{ yylhsminor.yy7 = yymsp[0].minor.yy7; } - yymsp[0].minor.yy7 = yylhsminor.yy7; + case 409: /* alias_opt ::= table_alias */ +{ yylhsminor.yy329 = yymsp[0].minor.yy329; } + yymsp[0].minor.yy329 = yylhsminor.yy329; break; - case 409: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy7 = yymsp[0].minor.yy7; } + case 410: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy329 = yymsp[0].minor.yy329; } break; - case 410: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 411: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==411); -{ yymsp[-2].minor.yy184 = yymsp[-1].minor.yy184; } + case 411: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 412: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==412); +{ yymsp[-2].minor.yy212 = yymsp[-1].minor.yy212; } break; - case 412: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy184 = createJoinTableNode(pCxt, yymsp[-4].minor.yy54, yymsp[-5].minor.yy184, yymsp[-2].minor.yy184, yymsp[0].minor.yy184); } - yymsp[-5].minor.yy184 = yylhsminor.yy184; + case 413: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy212 = createJoinTableNode(pCxt, yymsp[-4].minor.yy162, yymsp[-5].minor.yy212, yymsp[-2].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 413: /* join_type ::= */ -{ yymsp[1].minor.yy54 = JOIN_TYPE_INNER; } + case 414: /* join_type ::= */ +{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } break; - case 414: /* join_type ::= INNER */ -{ yymsp[0].minor.yy54 = JOIN_TYPE_INNER; } + case 415: /* join_type ::= INNER */ +{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } break; - case 415: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 416: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy184 = createSelectStmt(pCxt, yymsp[-10].minor.yy419, yymsp[-9].minor.yy296, yymsp[-8].minor.yy184); - yymsp[-11].minor.yy184 = addWhereClause(pCxt, yymsp[-11].minor.yy184, yymsp[-7].minor.yy184); - yymsp[-11].minor.yy184 = addPartitionByClause(pCxt, yymsp[-11].minor.yy184, yymsp[-6].minor.yy296); - yymsp[-11].minor.yy184 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy184, yymsp[-2].minor.yy184); - yymsp[-11].minor.yy184 = addGroupByClause(pCxt, yymsp[-11].minor.yy184, yymsp[-1].minor.yy296); - yymsp[-11].minor.yy184 = addHavingClause(pCxt, yymsp[-11].minor.yy184, yymsp[0].minor.yy184); - yymsp[-11].minor.yy184 = addRangeClause(pCxt, yymsp[-11].minor.yy184, yymsp[-5].minor.yy184); - yymsp[-11].minor.yy184 = addEveryClause(pCxt, yymsp[-11].minor.yy184, yymsp[-4].minor.yy184); - yymsp[-11].minor.yy184 = addFillClause(pCxt, yymsp[-11].minor.yy184, yymsp[-3].minor.yy184); + yymsp[-11].minor.yy212 = createSelectStmt(pCxt, yymsp[-10].minor.yy737, yymsp[-9].minor.yy424, yymsp[-8].minor.yy212); + yymsp[-11].minor.yy212 = addWhereClause(pCxt, yymsp[-11].minor.yy212, yymsp[-7].minor.yy212); + yymsp[-11].minor.yy212 = addPartitionByClause(pCxt, yymsp[-11].minor.yy212, yymsp[-6].minor.yy424); + yymsp[-11].minor.yy212 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy212, yymsp[-2].minor.yy212); + yymsp[-11].minor.yy212 = addGroupByClause(pCxt, yymsp[-11].minor.yy212, yymsp[-1].minor.yy424); + yymsp[-11].minor.yy212 = addHavingClause(pCxt, yymsp[-11].minor.yy212, yymsp[0].minor.yy212); + yymsp[-11].minor.yy212 = addRangeClause(pCxt, yymsp[-11].minor.yy212, yymsp[-5].minor.yy212); + yymsp[-11].minor.yy212 = addEveryClause(pCxt, yymsp[-11].minor.yy212, yymsp[-4].minor.yy212); + yymsp[-11].minor.yy212 = addFillClause(pCxt, yymsp[-11].minor.yy212, yymsp[-3].minor.yy212); } break; - case 418: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy419 = false; } + case 419: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy737 = false; } break; - case 421: /* select_item ::= NK_STAR */ -{ yylhsminor.yy184 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy184 = yylhsminor.yy184; + case 422: /* select_item ::= NK_STAR */ +{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 423: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy184 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184), &yymsp[0].minor.yy7); } - yymsp[-1].minor.yy184 = yylhsminor.yy184; + case 424: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy212 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 424: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy184 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), &yymsp[0].minor.yy7); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 425: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy212 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 429: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 446: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==446); - case 462: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==462); -{ yymsp[-2].minor.yy296 = yymsp[0].minor.yy296; } + case 430: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 447: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==447); + case 463: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==463); +{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; } break; - case 431: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy184 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } + case 432: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy212 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; - case 432: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy184 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } + case 433: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy212 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; - case 433: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy184 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), NULL, yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } + case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy212 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; - case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy184 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy184), releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), yymsp[-1].minor.yy184, yymsp[0].minor.yy184); } + case 435: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy212 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; - case 436: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 454: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==454); -{ yymsp[-3].minor.yy184 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy184); } + case 437: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 455: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==455); +{ yymsp[-3].minor.yy212 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy212); } break; - case 438: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy184 = createFillNode(pCxt, yymsp[-1].minor.yy540, NULL); } + case 439: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy212 = createFillNode(pCxt, yymsp[-1].minor.yy294, NULL); } break; - case 439: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy184 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy296)); } + case 440: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy212 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } break; - case 440: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy540 = FILL_MODE_NONE; } + case 441: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy294 = FILL_MODE_NONE; } break; - case 441: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy540 = FILL_MODE_PREV; } + case 442: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy294 = FILL_MODE_PREV; } break; - case 442: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy540 = FILL_MODE_NULL; } + case 443: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy294 = FILL_MODE_NULL; } break; - case 443: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy540 = FILL_MODE_LINEAR; } + case 444: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy294 = FILL_MODE_LINEAR; } break; - case 444: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy540 = FILL_MODE_NEXT; } + case 445: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy294 = FILL_MODE_NEXT; } break; - case 447: /* group_by_list ::= expression */ -{ yylhsminor.yy296 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[0].minor.yy296 = yylhsminor.yy296; + case 448: /* group_by_list ::= expression */ +{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 448: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy296 = addNodeToList(pCxt, yymsp[-2].minor.yy296, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy184))); } - yymsp[-2].minor.yy296 = yylhsminor.yy296; + case 449: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; - case 452: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy184 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy184), releaseRawExprNode(pCxt, yymsp[-1].minor.yy184)); } + case 453: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy212 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; - case 455: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 456: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy184 = addOrderByClause(pCxt, yymsp[-3].minor.yy184, yymsp[-2].minor.yy296); - yylhsminor.yy184 = addSlimitClause(pCxt, yylhsminor.yy184, yymsp[-1].minor.yy184); - yylhsminor.yy184 = addLimitClause(pCxt, yylhsminor.yy184, yymsp[0].minor.yy184); + yylhsminor.yy212 = addOrderByClause(pCxt, yymsp[-3].minor.yy212, yymsp[-2].minor.yy424); + yylhsminor.yy212 = addSlimitClause(pCxt, yylhsminor.yy212, yymsp[-1].minor.yy212); + yylhsminor.yy212 = addLimitClause(pCxt, yylhsminor.yy212, yymsp[0].minor.yy212); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 457: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy184 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy184, yymsp[0].minor.yy184); } - yymsp[-3].minor.yy184 = yylhsminor.yy184; + case 458: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy212 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 458: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy184 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy184, yymsp[0].minor.yy184); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 459: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy212 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 460: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ -{ yymsp[-5].minor.yy184 = yymsp[-4].minor.yy184; } - yy_destructor(yypParser,365,&yymsp[-3].minor); - yy_destructor(yypParser,366,&yymsp[-2].minor); - yy_destructor(yypParser,367,&yymsp[-1].minor); + case 461: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ +{ yymsp[-5].minor.yy212 = yymsp[-4].minor.yy212; } + yy_destructor(yypParser,367,&yymsp[-3].minor); + yy_destructor(yypParser,368,&yymsp[-2].minor); + yy_destructor(yypParser,369,&yymsp[-1].minor); break; - case 464: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 468: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==468); -{ yymsp[-1].minor.yy184 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==469); +{ yymsp[-1].minor.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==469); -{ yymsp[-3].minor.yy184 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==470); +{ yymsp[-3].minor.yy212 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==470); -{ yymsp[-3].minor.yy184 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 467: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 471: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==471); +{ yymsp[-3].minor.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 471: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy184 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy184); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 472: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy212); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 475: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy184 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy184), yymsp[-1].minor.yy394, yymsp[0].minor.yy627); } - yymsp[-2].minor.yy184 = yylhsminor.yy184; + case 476: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy212 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), yymsp[-1].minor.yy188, yymsp[0].minor.yy607); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 476: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy394 = ORDER_ASC; } + case 477: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy188 = ORDER_ASC; } break; - case 477: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy394 = ORDER_ASC; } + case 478: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy188 = ORDER_ASC; } break; - case 478: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy394 = ORDER_DESC; } + case 479: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy188 = ORDER_DESC; } break; - case 479: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy627 = NULL_ORDER_DEFAULT; } + case 480: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy607 = NULL_ORDER_DEFAULT; } break; - case 480: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy627 = NULL_ORDER_FIRST; } + case 481: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy607 = NULL_ORDER_FIRST; } break; - case 481: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy627 = NULL_ORDER_LAST; } + case 482: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy607 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 7de92bba0c..babd096d56 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -526,20 +526,22 @@ TEST_F(ParserInitialCTest, createStream) { memset(&expect, 0, sizeof(SCMCreateStreamReq)); }; - auto setCreateStreamReqFunc = - [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb = nullptr, int8_t igExists = 0, - int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, int64_t watermark = 0) { - snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); - snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); - if (NULL != pDstStb) { - snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); - } - expect.igExists = igExists; - expect.sql = strdup(pSql); - expect.triggerType = triggerType; - expect.maxDelay = maxDelay; - expect.watermark = watermark; - }; + auto setCreateStreamReqFunc = [&](const char* pStream, const char* pSrcDb, const char* pSql, + const char* pDstStb = nullptr, int8_t igExists = 0, + int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, + int64_t watermark = 0, int8_t igExpired = 0) { + snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); + snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); + if (NULL != pDstStb) { + snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); + } + expect.igExists = igExists; + expect.sql = strdup(pSql); + expect.triggerType = triggerType; + expect.maxDelay = maxDelay; + expect.watermark = watermark; + expect.igExpired = igExpired; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_STREAM_STMT); @@ -555,6 +557,7 @@ TEST_F(ParserInitialCTest, createStream) { ASSERT_EQ(req.triggerType, expect.triggerType); ASSERT_EQ(req.maxDelay, expect.maxDelay); ASSERT_EQ(req.watermark, expect.watermark); + ASSERT_EQ(req.igExpired, expect.igExpired); tFreeSCMCreateStreamReq(&req); }); @@ -571,9 +574,10 @@ TEST_F(ParserInitialCTest, createStream) { clearCreateStreamReq(); setCreateStreamReqFunc( - "s1", "test", "create stream if not exists s1 trigger max_delay 20s watermark 10s into st1 as select * from t1", - "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND); - run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s INTO st1 AS SELECT * FROM t1"); + "s1", "test", + "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 as select * from t1", + "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 1); + run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED INTO st1 AS SELECT * FROM t1"); clearCreateStreamReq(); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index d170482c48..9dda90f77f 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -614,10 +614,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm if (pCxt->pPlanCxt->streamQuery) { pWindow->triggerType = pCxt->pPlanCxt->triggerType; pWindow->watermark = pCxt->pPlanCxt->watermark; - } - - if (pCxt->pPlanCxt->rSmaQuery) { - /*pWindow->filesFactor = pCxt->pPlanCxt->filesFactor;*/ + pWindow->igExpired = pCxt->pPlanCxt->igExpired; } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b1e5b542e3..f11ef7f797 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -227,8 +227,7 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { pScan->slidingUnit = ((SWindowLogicNode*)pParent)->slidingUnit; pScan->triggerType = ((SWindowLogicNode*)pParent)->triggerType; pScan->watermark = ((SWindowLogicNode*)pParent)->watermark; - pScan->tsColId = ((SColumnNode*)((SWindowLogicNode*)pParent)->pTspk)->colId; - pScan->filesFactor = ((SWindowLogicNode*)pParent)->filesFactor; + pScan->igExpired = ((SWindowLogicNode*)pParent)->igExpired; } } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 0f19db26a5..12e1a8a784 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -534,8 +534,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->slidingUnit = pScanLogicNode->slidingUnit; pTableScan->triggerType = pScanLogicNode->triggerType; pTableScan->watermark = pScanLogicNode->watermark; - pTableScan->tsColId = pScanLogicNode->tsColId; - pTableScan->filesFactor = pScanLogicNode->filesFactor; + pTableScan->igExpired = pScanLogicNode->igExpired; return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); } @@ -1054,7 +1053,7 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->triggerType = pWindowLogicNode->triggerType; pWindow->watermark = pWindowLogicNode->watermark; - pWindow->filesFactor = pWindowLogicNode->filesFactor; + pWindow->igExpired = pWindowLogicNode->igExpired; if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pWindow; From 7c3f43d6d59c0b181f980a2568d7fd6101b8f3d2 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 30 Jun 2022 16:20:43 +0800 Subject: [PATCH 27/68] refactor: tsma logic optimization --- source/dnode/vnode/src/sma/smaTimeRange.c | 63 ++++++++++++++--------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index 2244b91c28..ecd8db8ea9 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -113,7 +113,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { if (!pDataBlocks) { terrno = TSDB_CODE_TSMA_INVALID_PTR; smaWarn("vgId:%d, insert tsma data failed since pDataBlocks is NULL", SMA_VID(pSma)); - return terrno; + return TSDB_CODE_FAILED; } if (taosArrayGetSize(pDataBlocks) <= 0) { @@ -127,9 +127,9 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { return TSDB_CODE_FAILED; } - SSmaEnv *pEnv = SMA_TSMA_ENV(pSma); - SSmaStat *pStat = NULL; - STSmaStat *pItem = NULL; + SSmaEnv *pEnv = SMA_TSMA_ENV(pSma); + SSmaStat *pStat = NULL; + STSmaStat *pTsmaStat = NULL; if (!pEnv || !(pStat = SMA_ENV_STAT(pEnv))) { terrno = TSDB_CODE_TSMA_INVALID_STAT; @@ -137,32 +137,43 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { } tdRefSmaStat(pSma, pStat); - pItem = &pStat->tsmaStat; + pTsmaStat = SMA_TSMA_STAT(pStat); - ASSERT(pItem); - - if (!pItem->pTSma) { + if (!pTsmaStat->pTSma) { STSma *pTSma = metaGetSmaInfoByIndex(SMA_META(pSma), indexUid); if (!pTSma) { - terrno = TSDB_CODE_TSMA_NO_INDEX_IN_META; - smaWarn("vgId:%d, tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), indexUid, tstrerror(terrno)); - return TSDB_CODE_FAILED; + smaError("vgId:%d, failed to get STSma while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } + pTsmaStat->pTSma = pTSma; + pTsmaStat->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1); + if (!pTsmaStat->pTSchema) { + smaError("vgId:%d, failed to get STSchema while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; } - pItem->pTSma = pTSma; - pItem->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1); - ASSERT(pItem->pTSchema); // TODO } - ASSERT(pItem->pTSma->indexUid == indexUid); + if (pTsmaStat->pTSma->indexUid != indexUid) { + terrno = TSDB_CODE_VND_APP_ERROR; + smaError("vgId:%d, tsma insert for smaIndex %" PRIi64 "(!=%" PRIi64 ") failed since %s", SMA_VID(pSma), indexUid, + pTsmaStat->pTSma->indexUid, tstrerror(terrno)); + goto _err; + } - SSubmitReq *pSubmitReq = NULL; + SSubmitReq *pSubmitReq = tdBlockToSubmit((const SArray *)msg, pTsmaStat->pTSchema, true, pTsmaStat->pTSma->dstTbUid, + pTsmaStat->pTSma->dstTbName, pTsmaStat->pTSma->dstVgId); - pSubmitReq = tdBlockToSubmit((const SArray *)msg, pItem->pTSchema, true, pItem->pTSma->dstTbUid, - pItem->pTSma->dstTbName, pItem->pTSma->dstVgId); + if (!pSubmitReq) { + smaError("vgId:%d, failed to gen submit blk while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } - ASSERT(pSubmitReq); // TODO - - ASSERT(!strncasecmp("td.tsma.rst.tb", pItem->pTSma->dstTbName, 14)); +#if 0 + ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); +#endif SRpcMsg submitReqMsg = { .msgType = TDMT_VND_SUBMIT, @@ -170,9 +181,15 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { .contLen = ntohl(pSubmitReq->length), }; - ASSERT(tmsgPutToQueue(&pSma->pVnode->msgCb, WRITE_QUEUE, &submitReqMsg) == 0); + if (tmsgPutToQueue(&pSma->pVnode->msgCb, WRITE_QUEUE, &submitReqMsg) < 0) { + smaError("vgId:%d, failed to put SubmitReq msg while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } tdUnRefSmaStat(pSma, pStat); - return TSDB_CODE_SUCCESS; +_err: + tdUnRefSmaStat(pSma, pStat); + return TSDB_CODE_FAILED; } \ No newline at end of file From ca1c961f9c5364145d6ce7a02ca583c1b01a23e2 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 30 Jun 2022 16:40:17 +0800 Subject: [PATCH 28/68] fix(tmq): set last scan status --- source/dnode/vnode/src/tq/tqExec.c | 3 ++ source/libs/executor/src/scanoperator.c | 48 ++++++++++++++++--------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 9cdc3171f5..09cbed7392 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -85,12 +85,15 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S tqAddBlockDataToRsp(pDataBlock, pRsp); if (pRsp->withTbName) { + pRsp->withTbName = 0; +#if 1 int64_t uid; int64_t ts; if (qGetStreamScanStatus(task, &uid, &ts) < 0) { ASSERT(0); } tqAddTbNameToRsp(pTq, uid, pRsp, workerId); +#endif } pRsp->blockNum++; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c057485f51..10bd0520ad 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -392,6 +392,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { binfo.capacity = binfo.rows; blockDataEnsureCapacity(pBlock, binfo.rows); pBlock->info = binfo; + ASSERT(binfo.uid != 0); uint32_t status = 0; int32_t code = loadDataBlock(pOperator, pTableScanInfo, pBlock, &status); @@ -419,6 +420,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { pTableScanInfo->lastStatus.uid = pBlock->info.uid; pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey; + ASSERT(pBlock->info.uid != 0); return pBlock; } return NULL; @@ -438,6 +440,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { while (pTableScanInfo->curTWinIdx < pTableScanInfo->cond.numOfTWindows) { SSDataBlock* p = doTableScanImpl(pOperator); if (p != NULL) { + ASSERT(p->info.uid != 0); return p; } pTableScanInfo->curTWinIdx += 1; @@ -517,6 +520,35 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { if (pInfo->scanMode == TABLE_SCAN__TABLE_ORDER) { // check status if (pInfo->lastStatus.uid == pInfo->expStatus.uid && pInfo->lastStatus.ts == pInfo->expStatus.ts) { + while (1) { + SSDataBlock* result = doTableScanGroup(pOperator); + if (result) { + return result; + } + // if no data, switch to next table and continue scan + pInfo->currentTable++; + if (pInfo->currentTable >= taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList)) { + return NULL; + } + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, pInfo->currentTable); + /*pTableInfo->uid */ + tsdbSetTableId(pInfo->dataReader, pTableInfo->uid); + tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + pInfo->scanTimes = 0; + pInfo->curTWinIdx = 0; + } + } + // reset to exp table and window start from ts + tsdbSetTableId(pInfo->dataReader, pInfo->expStatus.uid); + SQueryTableDataCond tmpCond = pInfo->cond; + tmpCond.twindows[0] = (STimeWindow){ + .skey = pInfo->expStatus.ts, + .ekey = INT64_MAX, + }; + tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); + pInfo->scanTimes = 0; + pInfo->curTWinIdx = 0; + while (1) { SSDataBlock* result = doTableScanGroup(pOperator); if (result) { return result; @@ -532,23 +564,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); pInfo->scanTimes = 0; pInfo->curTWinIdx = 0; - pInfo->lastStatus.ts = pInfo->expStatus.ts; - pInfo->lastStatus.uid = pInfo->expStatus.uid; - return doTableScan(pOperator); } - // reset to exp table and window start from ts - tsdbSetTableId(pInfo->dataReader, pInfo->expStatus.uid); - SQueryTableDataCond tmpCond = pInfo->cond; - tmpCond.twindows[0] = (STimeWindow){ - .skey = pInfo->expStatus.ts, - .ekey = INT64_MAX, - }; - tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); - pInfo->scanTimes = 0; - pInfo->curTWinIdx = 0; - pInfo->lastStatus.ts = pInfo->expStatus.ts; - pInfo->lastStatus.uid = pInfo->expStatus.uid; - return doTableScan(pOperator); } if (pInfo->currentGroupId == -1) { From 24a3c817a46baac28fc9081b94db5da098f1dd84 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 30 Jun 2022 16:44:49 +0800 Subject: [PATCH 29/68] refactor(sync): add batch propose --- include/libs/sync/sync.h | 2 + include/libs/sync/syncTools.h | 2 + include/util/taoserror.h | 1 + source/libs/sync/inc/syncInt.h | 1 + source/libs/sync/src/syncMain.c | 132 ++++++++++++++++++++++++++++- source/libs/sync/src/syncMessage.c | 7 +- source/util/src/terror.c | 1 + 7 files changed, 142 insertions(+), 4 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index dea6d35d4d..d5d6fa5706 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -26,6 +26,7 @@ extern "C" { extern bool gRaftDetailLog; +#define SYNC_MAX_BATCH_SIZE 100 #define SYNC_INDEX_BEGIN 0 #define SYNC_INDEX_INVALID -1 #define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF @@ -179,6 +180,7 @@ typedef struct SSyncInfo { bool isStandBy; bool snapshotEnable; SyncGroupId vgId; + int32_t batchSize; SSyncCfg syncCfg; char path[TSDB_FILENAME_LEN]; SWal* pWal; diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index c4ce9b9694..a180755728 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -245,6 +245,7 @@ typedef struct SyncClientRequestBatch { SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMeta* raftArr, int32_t arrSize, int32_t vgId); +void syncClientRequestBatch2RpcMsg(const SyncClientRequestBatch* pSyncMsg, SRpcMsg* pRpcMsg); // --------------------------------------------- typedef struct SyncClientRequestReply { @@ -600,6 +601,7 @@ int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg); int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg); int32_t syncNodeOnTimeoutCb(SSyncNode* ths, SyncTimeout* pMsg); int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex); +int32_t syncNodeOnClientRequestBatchCb(SSyncNode* ths, SyncClientRequestBatch* pMsg); int32_t syncNodeOnRequestVoteCb(SSyncNode* ths, SyncRequestVote* pMsg); int32_t syncNodeOnRequestVoteReplyCb(SSyncNode* ths, SyncRequestVoteReply* pMsg); int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 08e09dca2f..737c7abecb 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -422,6 +422,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SYN_RECONFIG_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0910) #define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911) #define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912) +#define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913) #define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF) // tq diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index d58ae83dd3..7af752ff42 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -170,6 +170,7 @@ void syncNodeStart(SSyncNode* pSyncNode); void syncNodeStartStandBy(SSyncNode* pSyncNode); void syncNodeClose(SSyncNode* pSyncNode); int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak); +int32_t syncNodeProposeBatch(SSyncNode* pSyncNode, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize); // option bool syncNodeSnapshotEnable(SSyncNode* pSyncNode); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index c065f74663..ddda60bc18 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -50,7 +50,6 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths); // process message ---- int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg); int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg); -int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex); // life cycle static void syncFreeNode(void* param); @@ -627,7 +626,93 @@ int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) { return ret; } -int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize) { return 0; } +int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize) { + if (arrSize < 0) { + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } + + int32_t ret = 0; + SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid); + if (pSyncNode == NULL) { + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } + ASSERT(rid == pSyncNode->rid); + ret = syncNodeProposeBatch(pSyncNode, pMsgArr, pIsWeakArr, arrSize); + + taosReleaseRef(tsNodeRefId, pSyncNode->rid); + return ret; +} + +static bool syncNodeBatchOK(SRpcMsg* pMsgArr, int32_t arrSize) { + for (int32_t i = 0; i < arrSize; ++i) { + if (pMsgArr[i].msgType == TDMT_SYNC_CONFIG_CHANGE) { + return false; + } + + if (pMsgArr[i].msgType == TDMT_SYNC_CONFIG_CHANGE_FINISH) { + return false; + } + } + + return true; +} + +int32_t syncNodeProposeBatch(SSyncNode* pSyncNode, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize) { + if (!syncNodeBatchOK(pMsgArr, arrSize)) { + syncNodeErrorLog(pSyncNode, "sync propose batch error"); + terrno = TSDB_CODE_SYN_BATCH_ERROR; + return -1; + } + + if (arrSize > SYNC_MAX_BATCH_SIZE) { + syncNodeErrorLog(pSyncNode, "sync propose match batch error"); + terrno = TSDB_CODE_SYN_BATCH_ERROR; + return -1; + } + + if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { + syncNodeErrorLog(pSyncNode, "sync propose not leader"); + terrno = TSDB_CODE_SYN_NOT_LEADER; + return -1; + } + + if (pSyncNode->changing) { + syncNodeErrorLog(pSyncNode, "sync propose not ready"); + terrno = TSDB_CODE_SYN_PROPOSE_NOT_READY; + return -1; + } + + SRaftMeta raftArr[SYNC_MAX_BATCH_SIZE]; + for (int i = 0; i < arrSize; ++i) { + SRespStub stub; + stub.createTime = taosGetTimestampMs(); + stub.rpcMsg = pMsgArr[i]; + uint64_t seqNum = syncRespMgrAdd(pSyncNode->pSyncRespMgr, &stub); + + raftArr[i].isWeak = pIsWeakArr[i]; + raftArr[i].seqNum = seqNum; + } + + SyncClientRequestBatch* pSyncMsg = syncClientRequestBatchBuild(pMsgArr, raftArr, arrSize, pSyncNode->vgId); + ASSERT(pSyncMsg != NULL); + + SRpcMsg rpcMsg; + syncClientRequestBatch2RpcMsg(pSyncMsg, &rpcMsg); + taosMemoryFree(pSyncMsg); // only free msg body, do not free rpc msg content + + if (pSyncNode->FpEqMsg != NULL && (*pSyncNode->FpEqMsg)(pSyncNode->msgcb, &rpcMsg) == 0) { + // enqueue msg ok + + } else { + sError("enqueue msg error, FpEqMsg is NULL"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } + + return 0; +} int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { int32_t ret = 0; @@ -2364,6 +2449,49 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI return ret; } +int32_t syncNodeOnClientRequestBatchCb(SSyncNode* ths, SyncClientRequestBatch* pMsg) { + int32_t code = 0; + + if (ths->state != TAOS_SYNC_STATE_LEADER) { + // call FpCommitCb, delete resp mgr + return -1; + } + + SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); + SyncTerm term = ths->pRaftStore->currentTerm; + + int32_t raftMetaArrayLen = sizeof(SRaftMeta) * pMsg->dataCount; + int32_t rpcArrayLen = sizeof(SRpcMsg) * pMsg->dataCount; + SRaftMeta* raftMetaArr = (SRaftMeta*)(pMsg->data); + SRpcMsg* msgArr = (SRpcMsg*)((char*)(pMsg->data) + raftMetaArrayLen); + for (int32_t i = 0; i < pMsg->dataCount; ++i) { + SSyncRaftEntry* pEntry = syncEntryBuild(msgArr[i].contLen); + ASSERT(pEntry != NULL); + + pEntry->originalRpcType = msgArr[i].msgType; + pEntry->seqNum = raftMetaArr[i].seqNum; + pEntry->isWeak = raftMetaArr[i].isWeak; + pEntry->term = term; + pEntry->index = index; + memcpy(pEntry->data, msgArr[i].pCont, msgArr[i].contLen); + ASSERT(msgArr[i].contLen == pEntry->dataLen); + + code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); + if (code != 0) { + // del resp mgr, call FpCommitCb + ASSERT(0); + return -1; + } + } + + // fsync once + SSyncLogStoreData* pData = ths->pLogStore->data; + SWal* pWal = pData->pWal; + walFsync(pWal, true); + + return 0; +} + static void syncFreeNode(void* param) { SSyncNode* pNode = param; // inner object already free diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 38ecb5c9d1..ad352df59f 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -968,8 +968,9 @@ SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMet ASSERT(arrSize > 0); int32_t dataLen = 0; - int32_t raftMetaArrayLen = sizeof(SRpcMsg) * arrSize; - int32_t rpcArrayLen = sizeof(SRaftMeta) * arrSize; + int32_t raftMetaArrayLen = sizeof(SRaftMeta) * arrSize; + int32_t rpcArrayLen = sizeof(SRpcMsg) * arrSize; + dataLen += (raftMetaArrayLen + rpcArrayLen); uint32_t bytes = sizeof(SyncClientRequestBatch) + dataLen; SyncClientRequestBatch* pMsg = taosMemoryMalloc(bytes); @@ -995,6 +996,8 @@ SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMet return pMsg; } +void syncClientRequestBatch2RpcMsg(const SyncClientRequestBatch* pSyncMsg, SRpcMsg* pRpcMsg) {} + // ---- message process SyncRequestVote---- SyncRequestVote* syncRequestVoteBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncRequestVote); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 96f0fb21ca..bb20039666 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -429,6 +429,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_NEW_CONFIG_ERROR, "Sync new config error TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RECONFIG_NOT_READY, "Sync not ready for reconfig") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_PROPOSE_NOT_READY, "Sync not ready for propose") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_STANDBY_NOT_READY, "Sync not ready for standby") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BATCH_ERROR, "Sync batch error") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error") // wal From dc769a284fe8985ef762c05313bd9d534f81e7f2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 30 Jun 2022 17:12:03 +0800 Subject: [PATCH 30/68] feat: support 'select *, expr from ...' syntax --- source/libs/nodes/src/nodesCodeFuncs.c | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index dc293bf6c1..7440dd3f95 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1513,34 +1513,34 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) { code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanRatio, &pNode->ratio); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->dataRequired); + code = tjsonGetIntValue(pJson, jkTableScanPhysiPlanDataRequired, &pNode->dataRequired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanDynamicScanFuncs, &pNode->pDynamicScanFuncs); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->interval); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanInterval, &pNode->interval); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->offset); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanOffset, &pNode->offset); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->sliding); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanSliding, &pNode->sliding); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->intervalUnit); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIntervalUnit, &pNode->intervalUnit); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->slidingUnit); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanSlidingUnit, &pNode->slidingUnit); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->triggerType); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanTriggerType, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->watermark); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanWatermark, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanStartKey, &pNode->igExpired); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIgnoreExpired, &pNode->igExpired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanGroupTags, &pNode->pGroupTags); @@ -1819,7 +1819,7 @@ static const char* jkWindowPhysiPlanTsPk = "TsPk"; static const char* jkWindowPhysiPlanTsEnd = "TsEnd"; static const char* jkWindowPhysiPlanTriggerType = "TriggerType"; static const char* jkWindowPhysiPlanWatermark = "Watermark"; -static const char* JKWINDOWPHYSIPLANIGNOREEXPIRED = "IgnoreExpired"; +static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj; @@ -1844,7 +1844,7 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanWatermark, pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddIntegerToObject(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, pNode->igExpired); + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanIgnoreExpired, pNode->igExpired); } return code; @@ -1867,13 +1867,13 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { code = jsonToNodeObject(pJson, jkWindowPhysiPlanTsEnd, (SNode**)&pNode->pTsEnd); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->triggerType); + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanTriggerType, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetBigIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->watermark); + code = tjsonGetBigIntValue(pJson, jkWindowPhysiPlanWatermark, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, JKWINDOWPHYSIPLANIGNOREEXPIRED, &pNode->igExpired); + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanIgnoreExpired, &pNode->igExpired); } return code; From 860bf88f3124bcc63686a363203202cd420de48d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 30 Jun 2022 17:20:04 +0800 Subject: [PATCH 31/68] feat(query): add last_row function without cache TD-16927 --- include/libs/function/functionMgt.h | 1 + source/libs/function/inc/builtinsimpl.h | 3 + source/libs/function/src/builtins.c | 11 +-- source/libs/function/src/builtinsimpl.c | 126 ++++++++++++++++++++---- 4 files changed, 116 insertions(+), 25 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index f03422672d..582cddaf0f 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -34,6 +34,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_ELAPSED, FUNCTION_TYPE_IRATE, FUNCTION_TYPE_LAST_ROW, + FUNCTION_TYPE_LAST_ROWT, FUNCTION_TYPE_MAX, FUNCTION_TYPE_MIN, FUNCTION_TYPE_MODE, diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index f7e22cb151..8eafb0703e 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -117,6 +117,9 @@ int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t getFirstLastInfoSize(int32_t resBytes); +int32_t lastRowFunction(SqlFunctionCtx *pCtx); +int32_t lastRowFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); + bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv); bool getTopBotMergeFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv); bool topBotFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 23d7185508..9ea07db41e 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1947,17 +1947,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .finalizeFunc = irateFinalize }, { - .name = "last_row", - .type = FUNCTION_TYPE_LAST_ROW, + .name = "last_rowt", + .type = FUNCTION_TYPE_LAST_ROWT, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, - .processFunc = lastFunction, - .finalizeFunc = firstLastFinalize, - .pPartialFunc = "_last_partial", - .pMergeFunc = "_last_merge", - .combineFunc = lastCombine, + .processFunc = lastRowFunction, + .finalizeFunc = lastRowFinalize, }, { .name = "_cache_last_row", diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index a75d5a2ecb..cb0c991389 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -80,6 +80,7 @@ typedef struct STopBotRes { typedef struct SFirstLastRes { bool hasResult; + bool isNull; //used for last_row function only int32_t bytes; char buf[]; } SFirstLastRes; @@ -2597,15 +2598,6 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; - //handle selectivity - if (pCtx->subsidiaries.num > 0) { - STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); - if (!pInfo->hasResult) { - saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); - } else { - copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); - } - } pInfo->hasResult = true; //DO_UPDATE_TAG_COLUMNS(pCtx, ts); pResInfo->numOfRes = 1; @@ -2629,15 +2621,6 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; - //handle selectivity - if (pCtx->subsidiaries.num > 0) { - STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); - if (!pInfo->hasResult) { - saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); - } else { - copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); - } - } pInfo->hasResult = true; pResInfo->numOfRes = 1; //DO_UPDATE_TAG_COLUMNS(pCtx, ts); @@ -2763,6 +2746,113 @@ int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { return TSDB_CODE_SUCCESS; } +int32_t lastRowFunction(SqlFunctionCtx* pCtx) { + int32_t numOfElems = 0; + + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + SFirstLastRes* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + + SInputColumnInfoData* pInput = &pCtx->input; + SColumnInfoData* pInputCol = pInput->pData[0]; + + int32_t type = pInputCol->info.type; + int32_t bytes = pInputCol->info.bytes; + pInfo->bytes = bytes; + + SColumnDataAgg* pColAgg = (pInput->colDataAggIsSet) ? pInput->pColumnDataAgg[0] : NULL; + + TSKEY startKey = getRowPTs(pInput->pPTS, 0); + TSKEY endKey = getRowPTs(pInput->pPTS, pInput->totalRows - 1); + + int32_t blockDataOrder = (startKey <= endKey) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; + + if (blockDataOrder == TSDB_ORDER_ASC) { + for (int32_t i = pInput->numOfRows + pInput->startRowIndex - 1; i >= pInput->startRowIndex; --i) { + char* data = colDataGetData(pInputCol, i); + TSKEY cts = getRowPTs(pInput->pPTS, i); + if (pResInfo->numOfRes == 0 || *(TSKEY*)(pInfo->buf) < cts) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + pInfo->isNull = true; + } else { + pInfo->isNull = false; + if (IS_VAR_DATA_TYPE(type)) { + bytes = varDataTLen(data); + pInfo->bytes = bytes; + } + memcpy(pInfo->buf + sizeof(TSKEY), data, bytes); + } + *(TSKEY*)(pInfo->buf) = cts; + numOfElems++; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } + pInfo->hasResult = true; + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); + pResInfo->numOfRes = 1; + } + break; + } + } else { // descending order + for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { + char* data = colDataGetData(pInputCol, i); + TSKEY cts = getRowPTs(pInput->pPTS, i); + if (pResInfo->numOfRes == 0 || *(TSKEY*)(pInfo->buf) < cts) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + pInfo->isNull = true; + } else { + pInfo->isNull = false; + if (IS_VAR_DATA_TYPE(type)) { + bytes = varDataTLen(data); + pInfo->bytes = bytes; + } + memcpy(pInfo->buf + sizeof(TSKEY), data, bytes); + } + *(TSKEY*)(pInfo->buf) = cts; + numOfElems++; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } + pInfo->hasResult = true; + pResInfo->numOfRes = 1; + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); + } + break; + } + } + + SET_VAL(pResInfo, numOfElems, 1); + return TSDB_CODE_SUCCESS; +} + + +int32_t lastRowFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + + SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); + colDataAppend(pCol, pBlock->info.rows, pRes->buf + sizeof(TSKEY), pRes->isNull); + //handle selectivity + STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); + setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); + + return pResInfo->numOfRes; +} + + bool getDiffFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(SDiffInfo); return true; From 94f07836d605d8d51b9c473ae3a5de2bbb4cabd4 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 30 Jun 2022 17:25:19 +0800 Subject: [PATCH 32/68] fix(tmq): set scan rsp offset correctly --- include/libs/executor/executor.h | 2 +- source/dnode/vnode/src/tq/tq.c | 1 - source/dnode/vnode/src/tq/tqExec.c | 11 ++++---- source/libs/executor/inc/executorimpl.h | 7 +---- source/libs/executor/src/executorMain.c | 8 +++++- source/libs/executor/src/executorimpl.c | 36 ++++++++++++++++++------- source/libs/executor/src/scanoperator.c | 29 -------------------- tests/script/tsim/tmq/snapshot1.sim | 2 ++ 8 files changed, 44 insertions(+), 52 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index d3e3c58622..45fa94b3bf 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -172,7 +172,7 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le */ int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts); -int32_t qPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts); +int32_t qStreamPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts); #ifdef __cplusplus } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 0563b67f4a..c0d184ee11 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -389,7 +389,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { // 4. send rsp if (dataRsp.blockNum != 0) { - tqOffsetResetToData(&dataRsp.rspOffset, 0, 0); if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { code = -1; } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 09cbed7392..9dd2a0258f 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -63,10 +63,11 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S ASSERT(pExec->subType == TOPIC_SUB_TYPE__COLUMN); qTaskInfo_t task = pExec->execCol.task[workerId]; - if (qStreamScanSnapshot(task) < 0) { - ASSERT(0); - } - if (qPrepareScan(task, offset.uid, offset.ts) < 0) { + /*if (qStreamScanSnapshot(task) < 0) {*/ + /*ASSERT(0);*/ + /*}*/ + + if (qStreamPrepareScan(task, offset.uid, offset.ts) < 0) { ASSERT(0); } @@ -86,7 +87,7 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataRsp* pRsp, S if (pRsp->withTbName) { pRsp->withTbName = 0; -#if 1 +#if 0 int64_t uid; int64_t ts; if (qGetStreamScanStatus(task, &uid, &ts) < 0) { diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 618cf50b86..9872f26b03 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -250,7 +250,7 @@ typedef struct SSampleExecInfo { enum { TABLE_SCAN__TABLE_ORDER = 1, - TABLE_SCAN__BLOCK_ORDER = 1, + TABLE_SCAN__BLOCK_ORDER = 2, }; typedef struct STableScanInfo { @@ -286,11 +286,6 @@ typedef struct STableScanInfo { int64_t ts; } lastStatus; - struct { - uint64_t uid; - int64_t ts; - } expStatus; - int8_t scanMode; } STableScanInfo; diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index deb4f970df..8dd8005225 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -231,9 +231,15 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le return decodeOperator(pTaskInfo->pRoot, pInput, len); } -int32_t qPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) { +int32_t qStreamPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + if (uid == 0) { + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); + uid = pTableInfo->uid; + ts = INT64_MIN; + } + return doPrepareScan(pTaskInfo->pRoot, uid, ts); } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 6fc1d2b0b4..dd48229849 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2825,18 +2825,36 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { int32_t type = pOperator->operatorType; if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { SStreamBlockScanInfo* pScanInfo = pOperator->info; - STableScanInfo* pSnapShotScanInfo = pScanInfo->pSnapshotReadOp->info; - /**uid = pSnapShotScanInfo->scanStatus.uid;*/ - /**ts = pSnapShotScanInfo->scanStatus.t;*/ - if (pSnapShotScanInfo->lastStatus.uid != uid || pSnapShotScanInfo->lastStatus.ts != ts) { - // rebuild scan - // + pScanInfo->blockType = STREAM_INPUT__DATA_SCAN; + + STableScanInfo* pInfo = pScanInfo->pSnapshotReadOp->info; + + /*if (pSnapShotScanInfo->dataReader == NULL) {*/ + /*pSnapShotScanInfo->dataReader = tsdbReaderOpen(pHandle->vnode, &pSTInfo->cond, tableList, 0, 0);*/ + /*pSnapShotScanInfo->scanMode = TABLE_SCAN__TABLE_ORDER;*/ + /*}*/ + + if (pInfo->lastStatus.uid != uid || pInfo->lastStatus.ts != ts) { + tsdbSetTableId(pInfo->dataReader, uid); + SQueryTableDataCond tmpCond = pInfo->cond; + tmpCond.twindows[0] = (STimeWindow){ + .skey = ts, + .ekey = INT64_MAX, + }; + tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); + pInfo->scanTimes = 0; + pInfo->curTWinIdx = 0; } + } else { - if (pOperator->pDownstream[0] == NULL) { - return TSDB_CODE_INVALID_PARA; + if (pOperator->numOfDownstream == 1) { + return doPrepareScan(pOperator->pDownstream[0], uid, ts); + } else if (pOperator->numOfDownstream == 0) { + qError("failed to find stream scan operator to set the input data block"); + return TSDB_CODE_QRY_APP_ERROR; } else { - doPrepareScan(pOperator->pDownstream[0], uid, ts); + qError("join not supported for stream block scan"); + return TSDB_CODE_QRY_APP_ERROR; } } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 10bd0520ad..a6bf9a12f3 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -519,35 +519,6 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { // if scan table by table if (pInfo->scanMode == TABLE_SCAN__TABLE_ORDER) { // check status - if (pInfo->lastStatus.uid == pInfo->expStatus.uid && pInfo->lastStatus.ts == pInfo->expStatus.ts) { - while (1) { - SSDataBlock* result = doTableScanGroup(pOperator); - if (result) { - return result; - } - // if no data, switch to next table and continue scan - pInfo->currentTable++; - if (pInfo->currentTable >= taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList)) { - return NULL; - } - STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, pInfo->currentTable); - /*pTableInfo->uid */ - tsdbSetTableId(pInfo->dataReader, pTableInfo->uid); - tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); - pInfo->scanTimes = 0; - pInfo->curTWinIdx = 0; - } - } - // reset to exp table and window start from ts - tsdbSetTableId(pInfo->dataReader, pInfo->expStatus.uid); - SQueryTableDataCond tmpCond = pInfo->cond; - tmpCond.twindows[0] = (STimeWindow){ - .skey = pInfo->expStatus.ts, - .ekey = INT64_MAX, - }; - tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); - pInfo->scanTimes = 0; - pInfo->curTWinIdx = 0; while (1) { SSDataBlock* result = doTableScanGroup(pOperator); if (result) { diff --git a/tests/script/tsim/tmq/snapshot1.sim b/tests/script/tsim/tmq/snapshot1.sim index 8c4a719006..9226c475cb 100644 --- a/tests/script/tsim/tmq/snapshot1.sim +++ b/tests/script/tsim/tmq/snapshot1.sim @@ -133,6 +133,8 @@ endi $totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb $sumOfRows = $data[0][3] + $data[1][3] if $sumOfRows != $totalMsgCons then + print actual: $sumOfRows + print expect: $totalMsgCons return -1 endi From 82bd8a560f0f522f96de5065ee0fc6f6bcef7d9f Mon Sep 17 00:00:00 2001 From: slzhou Date: Thu, 30 Jun 2022 17:28:49 +0800 Subject: [PATCH 33/68] fix: reserved column should not be copied --- source/libs/executor/src/executorimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 95782ce001..e2e281d877 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1348,7 +1348,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR SColumnInfoData* pSrc = taosArrayGet(px->pDataBlock, i); SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); // it is a reserved column for scalar function, and no data in this column yet. - if (pDst->pData == NULL) { + if (pDst->pData == NULL || pSrc->pData == NULL) { continue; } From 1dd89be98bc42b799061678109f3926b75d7fab4 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 30 Jun 2022 17:39:20 +0800 Subject: [PATCH 34/68] enh(query): add last_row function without cache TD-16927 --- include/libs/function/functionMgt.h | 2 +- source/libs/function/src/builtins.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 582cddaf0f..5474315434 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -34,7 +34,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_ELAPSED, FUNCTION_TYPE_IRATE, FUNCTION_TYPE_LAST_ROW, - FUNCTION_TYPE_LAST_ROWT, + FUNCTION_TYPE_LAST_ROWT, //TODO: removed FUNCTION_TYPE_MAX, FUNCTION_TYPE_MIN, FUNCTION_TYPE_MODE, diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index bc3b0f165e..b3a627271f 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1952,7 +1952,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .finalizeFunc = irateFinalize }, { - .name = "last_rowt", + .name = "last_row", .type = FUNCTION_TYPE_LAST_ROWT, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, From e38e23a3ecb6e3a9913d1920ca0fa4ab43623e38 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 30 Jun 2022 17:45:55 +0800 Subject: [PATCH 35/68] fix error --- source/libs/function/src/builtinsimpl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 6bff978e69..eb21ee1fb5 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2598,6 +2598,15 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; //DO_UPDATE_TAG_COLUMNS(pCtx, ts); pResInfo->numOfRes = 1; @@ -2621,6 +2630,15 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; pResInfo->numOfRes = 1; //DO_UPDATE_TAG_COLUMNS(pCtx, ts); From 2ac9a78d58bb1fbae41a75178e202eaa860ed021 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 30 Jun 2022 17:52:34 +0800 Subject: [PATCH 36/68] feat: support 'select *, expr from ...' syntax --- tests/test/c/tmqSim.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 81fa72d15a..38ee543f10 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -124,15 +124,13 @@ char* getCurrentTimeString(char* timeString) { return timeString; } -static void tmqStop(int signum, void *info, void *ctx) { +static void tmqStop(int signum, void* info, void* ctx) { running = 0; char tmpString[128]; - taosFprintfFile(g_fp, "%s tmqStop() receive stop signal[%d]\n", getCurrentTimeString(tmpString), signum); + taosFprintfFile(g_fp, "%s tmqStop() receive stop signal[%d]\n", getCurrentTimeString(tmpString), signum); } -static void tmqSetSignalHandle() { - taosSetSignal(SIGINT, tmqStop); -} +static void tmqSetSignalHandle() { taosSetSignal(SIGINT, tmqStop); } void initLogFile() { char filename[256]; @@ -433,7 +431,7 @@ static void dumpToFileForCheck(TdFilePtr pFile, TAOS_ROW row, TAOS_FIELD* fields int32_t precision) { for (int32_t i = 0; i < num_fields; i++) { if (i > 0) { - taosFprintfFile(pFile, "\n"); + taosFprintfFile(pFile, ","); } shellDumpFieldToFile(pFile, (const char*)row[i], fields + i, length[i], precision); } @@ -463,16 +461,16 @@ static int32_t msg_process(TAOS_RES* msg, SThreadInfo* pInfo, int32_t msgIndex) int32_t precision = taos_result_precision(msg); const char* tbName = tmq_get_table_name(msg); - #if 0 +#if 0 // get schema //============================== stub =================================================// for (int32_t i = 0; i < numOfFields; i++) { taosFprintfFile(g_fp, "%02d: name: %s, type: %d, len: %d\n", i, fields[i].name, fields[i].type, fields[i].bytes); } //============================== stub =================================================// - #endif +#endif - dumpToFileForCheck(pInfo->pConsumeRowsFile, row, fields, length, numOfFields, precision); + dumpToFileForCheck(pInfo->pConsumeRowsFile, row, fields, length, numOfFields, precision); taos_print_row(buf, row, fields, numOfFields); @@ -523,15 +521,15 @@ int32_t notifyMainScript(SThreadInfo* pInfo, int32_t cmdId) { static int32_t g_once_commit_flag = 0; static void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) { - pError("tmq_commit_cb_print() commit %d\n", code); + pError("tmq_commit_cb_print() commit %d\n", code); - if (0 == g_once_commit_flag) { - g_once_commit_flag = 1; - notifyMainScript((SThreadInfo*)param, (int32_t)NOTIFY_CMD_START_COMMIT); + if (0 == g_once_commit_flag) { + g_once_commit_flag = 1; + notifyMainScript((SThreadInfo*)param, (int32_t)NOTIFY_CMD_START_COMMIT); } - - char tmpString[128]; - taosFprintfFile(g_fp, "%s tmq_commit_cb_print() be called\n", getCurrentTimeString(tmpString)); + + char tmpString[128]; + taosFprintfFile(g_fp, "%s tmq_commit_cb_print() be called\n", getCurrentTimeString(tmpString)); } void build_consumer(SThreadInfo* pInfo) { @@ -683,13 +681,13 @@ void* consumeThreadFunc(void* param) { pInfo->taos = taos_connect(NULL, "root", "taosdata", NULL, 0); if (pInfo->taos == NULL) { taosFprintfFile(g_fp, "taos_connect() fail, can not notify and save consume result to main scripte\n"); - return NULL; + return NULL; } build_consumer(pInfo); build_topic_list(pInfo); if ((NULL == pInfo->tmq) || (NULL == pInfo->topicList)) { - taosFprintfFile(g_fp, "create consumer fail! tmq is null or topicList is null\n"); + taosFprintfFile(g_fp, "create consumer fail! tmq is null or topicList is null\n"); assert(0); return NULL; } @@ -697,7 +695,7 @@ void* consumeThreadFunc(void* param) { int32_t err = tmq_subscribe(pInfo->tmq, pInfo->topicList); if (err != 0) { pError("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_subscribe() fail! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_subscribe() fail! reason: %s\n", tmq_err2str(err)); assert(0); return NULL; } @@ -718,13 +716,13 @@ void* consumeThreadFunc(void* param) { err = tmq_unsubscribe(pInfo->tmq); if (err != 0) { pError("tmq_unsubscribe() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_unsubscribe()! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_unsubscribe()! reason: %s\n", tmq_err2str(err)); } err = tmq_consumer_close(pInfo->tmq); if (err != 0) { pError("tmq_consumer_close() fail, reason: %s\n", tmq_err2str(err)); - taosFprintfFile(g_fp, "tmq_consumer_close()! reason: %s\n", tmq_err2str(err)); + taosFprintfFile(g_fp, "tmq_consumer_close()! reason: %s\n", tmq_err2str(err)); } pInfo->tmq = NULL; @@ -871,4 +869,3 @@ int main(int32_t argc, char* argv[]) { return 0; } - From 0692ab4c5e8ec99806af766a45746134b83dcdec Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 30 Jun 2022 17:55:54 +0800 Subject: [PATCH 37/68] enh(query): add last_row selectivity --- source/libs/function/src/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index b3a627271f..68d89e9ec8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1954,7 +1954,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last_row", .type = FUNCTION_TYPE_LAST_ROWT, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, From cda2f844ced4d498cdc249c54f1a0f4666580ac7 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 30 Jun 2022 18:12:04 +0800 Subject: [PATCH 38/68] fix: fix json tag null issue --- source/libs/parser/src/parTranslater.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6dc14dbf15..762a038bb1 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -786,6 +786,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { // TODO //pVal->node.resType = targetDt; + pVal->translate = true; pVal->isNull = true; return DEAL_RES_CONTINUE; } @@ -5608,8 +5609,8 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS return TSDB_CODE_OUT_OF_MEMORY; } - if (DEAL_RES_ERROR == - translateValueImpl(pCxt, pStmt->pVal, schemaToDataType(pTableMeta->tableInfo.precision, pSchema))) { + SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); + if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt)) { return pCxt->errCode; } @@ -5618,7 +5619,8 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS } pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type); - if (pStmt->pVal->node.resType.type == TSDB_DATA_TYPE_JSON) { + if (targetDt.type == TSDB_DATA_TYPE_JSON) { + pReq->isNull = 0; if (pStmt->pVal->literal && strlen(pStmt->pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pStmt->pVal->literal); From afe67a609ac616041271feb82366178e45aa97fa Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 30 Jun 2022 19:16:22 +0800 Subject: [PATCH 39/68] add query epset --- source/libs/transport/src/transCli.c | 5 +++-- source/libs/transport/src/transSvr.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2836bc2949..1620760b81 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -607,9 +607,10 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { if (clear) { if (!uv_is_closing((uv_handle_t*)conn->stream)) { uv_close((uv_handle_t*)conn->stream, cliDestroy); - } else { - cliDestroy((uv_handle_t*)conn->stream); } + //} else { + // cliDestroy((uv_handle_t*)conn->stream); + //} } } static void cliDestroy(uv_handle_t* handle) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index dfc6de6442..6a964b4baf 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -140,7 +140,6 @@ static void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd); static void (*transAsyncHandle[])(SSvrMsg* msg, SWorkThrd* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease, uvHandleRegister, NULL}; - static void uvDestroyConn(uv_handle_t* handle); // server and worker thread @@ -777,9 +776,10 @@ static void destroyConn(SSvrConn* conn, bool clear) { if (!uv_is_closing((uv_handle_t*)conn->pTcp)) { tTrace("conn %p to be destroyed", conn); uv_close((uv_handle_t*)conn->pTcp, uvDestroyConn); - } else { - uvDestroyConn((uv_handle_t*)conn->pTcp); } + //} else { + // uvDestroyConn((uv_handle_t*)conn->pTcp); + //} } } static void destroyConnRegArg(SSvrConn* conn) { From 61619c940f09d80cb545696007d6de413309ea65 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 30 Jun 2022 19:43:48 +0800 Subject: [PATCH 40/68] fix some test cases --- tests/system-test/0-others/udfTest.py | 92 +++++++++--------- tests/system-test/0-others/udf_create.py | 92 +++++++++--------- .../system-test/0-others/udf_restart_taosd.py | 96 ++++++++++--------- 3 files changed, 146 insertions(+), 134 deletions(-) diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 375b7a6272..40f803432a 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -32,7 +32,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -58,7 +58,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -68,7 +68,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -150,7 +150,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -175,14 +175,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -256,7 +256,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -281,7 +281,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -302,23 +302,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -328,9 +330,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -340,9 +342,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -350,7 +354,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -382,8 +386,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -401,7 +405,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -429,7 +433,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -452,7 +456,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -481,7 +485,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -525,7 +529,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -551,7 +555,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -575,8 +579,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -585,7 +589,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -596,19 +600,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -643,11 +647,11 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() @@ -659,7 +663,7 @@ class TDTestCase: time.sleep(2) self.basic_udf_query() self.test_function_name() - + def stop(self): tdSql.close() diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 5f3ab2e863..63650d6edc 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -34,7 +34,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -60,7 +60,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -70,7 +70,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -152,7 +152,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -177,14 +177,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -258,7 +258,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -283,7 +283,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -304,23 +304,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -330,9 +332,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -342,9 +344,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -352,7 +356,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -384,8 +388,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -403,7 +407,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -431,7 +435,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -454,7 +458,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -483,7 +487,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -527,7 +531,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -563,7 +567,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -587,8 +591,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -597,7 +601,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -608,19 +612,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -655,17 +659,17 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() self.basic_udf_query() self.unexpected_create() - + def stop(self): tdSql.close() diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index 857921e32c..c318980b67 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -31,7 +31,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -57,7 +57,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -67,7 +67,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -149,7 +149,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -174,14 +174,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -255,7 +255,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -280,7 +280,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -301,23 +301,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -327,9 +329,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -339,9 +341,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -349,7 +353,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -381,8 +385,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -400,7 +404,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -428,7 +432,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -451,7 +455,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -480,7 +484,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -507,7 +511,7 @@ class TDTestCase: "select c1,c2, udf1(c1,c2) from stb1 group by c1,c2" , "select num1,num2,num3,udf1(num1,num2,num3) from tb" , "select c1,c6,udf1(c1,c6) from stb1 order by ts" , - "select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;" + "select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;" ] udf2_sqls = ["select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(c1) from stb1 group by 1-udf1(c1)" , @@ -524,7 +528,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -550,7 +554,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -574,8 +578,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -584,7 +588,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -595,19 +599,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -640,19 +644,19 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() self.basic_udf_query() self.multi_cols_udf() self.restart_taosd_query_udf() - - + + def stop(self): tdSql.close() From 4f107908db680d2d2436e926c93ac4b71711ed99 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 30 Jun 2022 19:02:43 +0800 Subject: [PATCH 41/68] fix(tmq): reset window --- source/client/src/tmq.c | 3 ++- source/common/src/tmsg.c | 4 ++-- source/dnode/vnode/src/tq/tq.c | 23 +++++++++-------------- source/libs/executor/src/executorimpl.c | 10 ++++------ source/libs/executor/src/scanoperator.c | 2 -- tests/script/tsim/tmq/snapshot.sim | 9 +++------ tests/script/tsim/tmq/snapshot1.sim | 6 +++--- 7 files changed, 23 insertions(+), 34 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index aa78649ba7..bea9d215da 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -1547,7 +1547,7 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper) { } int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { - /*printf("call poll\n");*/ + /*tscDebug("call poll");*/ for (int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++) { SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); for (int j = 0; j < taosArrayGetSize(pTopic->vgs); j++) { @@ -1708,6 +1708,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { } TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { + /*tscDebug("call poll1");*/ void* rspObj; int64_t startTime = taosGetTimestampMs(); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 78eccdf0cd..80402439fc 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5398,9 +5398,9 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__LOG) { snprintf(buf, maxLen, "offset(log) ver:%ld", pVal->version); } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA) { - snprintf(buf, maxLen, "offset(snapshot data) uid:%ld, ts:%ld", pVal->uid, pVal->ts); + snprintf(buf, maxLen, "offset(ss data) uid:%ld, ts:%ld", pVal->uid, pVal->ts); } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_META) { - snprintf(buf, maxLen, "offset(snapshot meta) uid:%ld, ts:%ld", pVal->uid, pVal->ts); + snprintf(buf, maxLen, "offset(ss meta) uid:%ld, ts:%ld", pVal->uid, pVal->ts); } else { ASSERT(0); } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c0d184ee11..d80996b399 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -154,10 +154,10 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con }; tmsgSendRsp(&rsp); - char buf1[50]; - char buf2[50]; - tFormatOffset(buf1, 50, &pRsp->reqOffset); - tFormatOffset(buf2, 50, &pRsp->rspOffset); + char buf1[80]; + char buf2[80]; + tFormatOffset(buf1, 80, &pRsp->reqOffset); + tFormatOffset(buf2, 80, &pRsp->rspOffset); tqDebug("vg %d from consumer %ld (epoch %d) send rsp, block num: %d, reqOffset: %s, rspOffset: %s", TD_VID(pTq->pVnode), pReq->consumerId, pReq->epoch, pRsp->blockNum, buf1, buf2); @@ -238,8 +238,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { STqOffsetVal fetchOffsetNew; // 1.find handle - char buf[50]; - tFormatOffset(buf, 50, &reqOffset); + char buf[80]; + tFormatOffset(buf, 80, &reqOffset); tqDebug("tmq poll: consumer %ld (epoch %d) recv poll req in vg %d, req offset %s", consumerId, pReq->epoch, TD_VID(pTq->pVnode), buf); @@ -360,7 +360,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { tqInfo("fetch meta msg, ver: %ld, type: %d", pHead->version, pHead->msgType); SMqMetaRsp metaRsp = {0}; metaRsp.reqOffset = pReq->reqOffset.version; - /*tqOffsetResetToLog(&metaR)*/ metaRsp.rspOffset = fetchVer; metaRsp.resMsgType = pHead->msgType; metaRsp.metaRspLen = pHead->bodyLen; @@ -380,18 +379,14 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { // 2. get data (rebuild reader if needed) // 3. get new uid and ts - char formatBuf[50]; - tFormatOffset(formatBuf, 50, &dataRsp.reqOffset); - tqInfo("retrieve using snapshot req offset %s", formatBuf); + tqInfo("retrieve using snapshot req offset: uid %ld ts %ld", dataRsp.reqOffset.uid, dataRsp.reqOffset.ts); if (tqScanSnapshot(pTq, &pHandle->execHandle, &dataRsp, fetchOffsetNew, workerId) < 0) { ASSERT(0); } // 4. send rsp - if (dataRsp.blockNum != 0) { - if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { - code = -1; - } + if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { + code = -1; } } else if (fetchOffsetNew.type == TMQ_OFFSET__SNAPSHOT_META) { ASSERT(0); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index dd48229849..efa8887ed0 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2836,12 +2836,10 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { if (pInfo->lastStatus.uid != uid || pInfo->lastStatus.ts != ts) { tsdbSetTableId(pInfo->dataReader, uid); - SQueryTableDataCond tmpCond = pInfo->cond; - tmpCond.twindows[0] = (STimeWindow){ - .skey = ts, - .ekey = INT64_MAX, - }; - tsdbResetReadHandle(pInfo->dataReader, &tmpCond, 0); + int64_t oldSkey = pInfo->cond.twindows[0].skey; + pInfo->cond.twindows[0].skey = ts; + tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + pInfo->cond.twindows[0].skey = oldSkey; pInfo->scanTimes = 0; pInfo->curTWinIdx = 0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a6bf9a12f3..a3af4ab223 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -518,7 +518,6 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { // if scan table by table if (pInfo->scanMode == TABLE_SCAN__TABLE_ORDER) { - // check status while (1) { SSDataBlock* result = doTableScanGroup(pOperator); if (result) { @@ -530,7 +529,6 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { return NULL; } STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, pInfo->currentTable); - /*pTableInfo->uid */ tsdbSetTableId(pInfo->dataReader, pTableInfo->uid); tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); pInfo->scanTimes = 0; diff --git a/tests/script/tsim/tmq/snapshot.sim b/tests/script/tsim/tmq/snapshot.sim index 5683aaa559..de0468e6f2 100644 --- a/tests/script/tsim/tmq/snapshot.sim +++ b/tests/script/tsim/tmq/snapshot.sim @@ -111,7 +111,7 @@ endi $consumerId = 0 $totalMsgOfStb = $ctbNum * $rowsPerCtb -$expectmsgcnt = 1 +$expectmsgcnt = 1000000 $expectrowcnt = 100 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) @@ -131,9 +131,6 @@ endi if $data[0][1] != $consumerId then return -1 endi -if $data[0][2] != $expectmsgcnt then - return -1 -endi if $data[0][3] != $expectrowcnt then return -1 endi @@ -183,7 +180,7 @@ endi $consumerId = 0 $totalMsgOfCtb = $rowsPerCtb -$expectmsgcnt = 1 +$expectmsgcnt = 1000000 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) print == start consumer to pull msgs from ctb @@ -254,7 +251,7 @@ endi $consumerId = 0 $totalMsgOfNtb = $rowsPerCtb -$expectmsgcnt = $totalMsgOfNtb +$expectmsgcnt = 1000000 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) print == start consumer to pull msgs from ntb diff --git a/tests/script/tsim/tmq/snapshot1.sim b/tests/script/tsim/tmq/snapshot1.sim index 9226c475cb..d534bb68da 100644 --- a/tests/script/tsim/tmq/snapshot1.sim +++ b/tests/script/tsim/tmq/snapshot1.sim @@ -80,7 +80,7 @@ $topicList = $topicList . ' $consumerId = 0 $totalMsgOfOneTopic = $ctbNum * $rowsPerCtb $totalMsgOfStb = $totalMsgOfOneTopic * $topicNum -$expectmsgcnt = $totalMsgOfStb +$expectmsgcnt = 1000000 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) @@ -168,7 +168,7 @@ $consumerId = 0 $totalMsgOfOneTopic = $rowsPerCtb $totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum -$expectmsgcnt = $totalMsgOfCtb +$expectmsgcnt = 1000000 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) $topicList = ' . topic_ctb_function @@ -245,7 +245,7 @@ $topicList = $topicList . ' $consumerId = 0 $totalMsgOfOneTopic = $rowsPerCtb $totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum -$expectmsgcnt = $totalMsgOfNtb +$expectmsgcnt = 1000000 sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit ) From 298c4d3e44c3a3a724dcd3e511d4f24550646084 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 30 Jun 2022 20:14:57 +0800 Subject: [PATCH 42/68] tlrucache: fix cap calculation --- source/util/src/tlrucache.c | 194 ++++++++++++++++++++---------------- 1 file changed, 107 insertions(+), 87 deletions(-) diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index b034a6e73e..28e15dc9a3 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -16,24 +16,24 @@ #define _DEFAULT_SOURCE #include "tlrucache.h" #include "os.h" -#include "tdef.h" #include "taoserror.h" -#include "tlog.h" #include "tarray.h" +#include "tdef.h" +#include "tlog.h" -typedef struct SLRUEntry SLRUEntry; +typedef struct SLRUEntry SLRUEntry; typedef struct SLRUEntryTable SLRUEntryTable; typedef struct SLRUCacheShard SLRUCacheShard; -typedef struct SShardedCache SShardedCache; +typedef struct SShardedCache SShardedCache; enum { - TAOS_LRU_IN_CACHE = (1 << 0), // Whether this entry is referenced by the hash table. + TAOS_LRU_IN_CACHE = (1 << 0), // Whether this entry is referenced by the hash table. - TAOS_LRU_IS_HIGH_PRI = (1 << 1), // Whether this entry is high priority entry. + TAOS_LRU_IS_HIGH_PRI = (1 << 1), // Whether this entry is high priority entry. - TAOS_LRU_IN_HIGH_PRI_POOL = (1 << 2), // Whether this entry is in high-pri pool. + TAOS_LRU_IN_HIGH_PRI_POOL = (1 << 2), // Whether this entry is in high-pri pool. - TAOS_LRU_HAS_HIT = (1 << 3), // Whether this entry has had any lookups (hits). + TAOS_LRU_HAS_HIT = (1 << 3), // Whether this entry has had any lookups (hits). }; struct SLRUEntry { @@ -50,18 +50,39 @@ struct SLRUEntry { char keyData[1]; }; -#define TAOS_LRU_ENTRY_IN_CACHE(h) ((h)->flags & TAOS_LRU_IN_CACHE) +#define TAOS_LRU_ENTRY_IN_CACHE(h) ((h)->flags & TAOS_LRU_IN_CACHE) #define TAOS_LRU_ENTRY_IN_HIGH_POOL(h) ((h)->flags & TAOS_LRU_IN_HIGH_PRI_POOL) -#define TAOS_LRU_ENTRY_IS_HIGH_PRI(h) ((h)->flags & TAOS_LRU_IS_HIGH_PRI) -#define TAOS_LRU_ENTRY_HAS_HIT(h) ((h)->flags & TAOS_LRU_HAS_HIT) +#define TAOS_LRU_ENTRY_IS_HIGH_PRI(h) ((h)->flags & TAOS_LRU_IS_HIGH_PRI) +#define TAOS_LRU_ENTRY_HAS_HIT(h) ((h)->flags & TAOS_LRU_HAS_HIT) -#define TAOS_LRU_ENTRY_SET_IN_CACHE(h, inCache) do { if(inCache) {(h)->flags |= TAOS_LRU_IN_CACHE;} else {(h)->flags &= ~TAOS_LRU_IN_CACHE;} } while(0) -#define TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(h, inHigh) do { if(inHigh) {(h)->flags |= TAOS_LRU_IN_HIGH_PRI_POOL;} else {(h)->flags &= ~TAOS_LRU_IN_HIGH_PRI_POOL;} } while(0) -#define TAOS_LRU_ENTRY_SET_PRIORITY(h, priority) do { if(priority == TAOS_LRU_PRIORITY_HIGH) {(h)->flags |= TAOS_LRU_IS_HIGH_PRI;} else {(h)->flags &= ~TAOS_LRU_IS_HIGH_PRI;} } while(0) +#define TAOS_LRU_ENTRY_SET_IN_CACHE(h, inCache) \ + do { \ + if (inCache) { \ + (h)->flags |= TAOS_LRU_IN_CACHE; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IN_CACHE; \ + } \ + } while (0) +#define TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(h, inHigh) \ + do { \ + if (inHigh) { \ + (h)->flags |= TAOS_LRU_IN_HIGH_PRI_POOL; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IN_HIGH_PRI_POOL; \ + } \ + } while (0) +#define TAOS_LRU_ENTRY_SET_PRIORITY(h, priority) \ + do { \ + if (priority == TAOS_LRU_PRIORITY_HIGH) { \ + (h)->flags |= TAOS_LRU_IS_HIGH_PRI; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IS_HIGH_PRI; \ + } \ + } while (0) #define TAOS_LRU_ENTRY_SET_HIT(h) ((h)->flags |= TAOS_LRU_HAS_HIT) #define TAOS_LRU_ENTRY_HAS_REFS(h) ((h)->refs > 0) -#define TAOS_LRU_ENTRY_REF(h) (++(h)->refs) +#define TAOS_LRU_ENTRY_REF(h) (++(h)->refs) static bool taosLRUEntryUnref(SLRUEntry *entry) { assert(entry->refs > 0); @@ -90,7 +111,7 @@ struct SLRUEntryTable { static int taosLRUEntryTableInit(SLRUEntryTable *table, int maxUpperHashBits) { table->lengthBits = 4; - table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry*)); + table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry *)); if (!table->list) { return -1; } @@ -125,7 +146,7 @@ static void taosLRUEntryTableCleanup(SLRUEntryTable *table) { taosMemoryFree(table->list); } -static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { SLRUEntry **entry = &table->list[hash >> (32 - table->lengthBits)]; while (*entry && ((*entry)->hash != hash || memcmp(key, (*entry)->keyData, keyLen) != 0)) { entry = &(*entry)->nextHash; @@ -134,7 +155,7 @@ static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable * table, const void * return entry; } -static void taosLRUEntryTableResize(SLRUEntryTable * table) { +static void taosLRUEntryTableResize(SLRUEntryTable *table) { int lengthBits = table->lengthBits; if (lengthBits >= table->maxLengthBits) { return; @@ -144,9 +165,9 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { return; } - uint32_t oldLength = 1 << lengthBits; - int newLengthBits = lengthBits + 1; - SLRUEntry **newList = taosMemoryCalloc(1 << newLengthBits, sizeof(SLRUEntry*)); + uint32_t oldLength = 1 << lengthBits; + int newLengthBits = lengthBits + 1; + SLRUEntry **newList = taosMemoryCalloc(1 << newLengthBits, sizeof(SLRUEntry *)); if (!newList) { return; } @@ -154,8 +175,8 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { for (uint32_t i = 0; i < oldLength; ++i) { SLRUEntry *entry = table->list[i]; while (entry) { - SLRUEntry *next = entry->nextHash; - uint32_t hash = entry->hash; + SLRUEntry *next = entry->nextHash; + uint32_t hash = entry->hash; SLRUEntry **ptr = &newList[hash >> (32 - newLengthBits)]; entry->nextHash = *ptr; *ptr = entry; @@ -170,13 +191,13 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { table->lengthBits = newLengthBits; } -static SLRUEntry *taosLRUEntryTableLookup(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry *taosLRUEntryTableLookup(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { return *taosLRUEntryTableFindPtr(table, key, keyLen, hash); } -static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable * table, SLRUEntry *entry) { +static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable *table, SLRUEntry *entry) { SLRUEntry **ptr = taosLRUEntryTableFindPtr(table, entry->keyData, entry->keyLength, entry->hash); - SLRUEntry *old = *ptr; + SLRUEntry *old = *ptr; entry->nextHash = (old == NULL) ? NULL : old->nextHash; *ptr = entry; if (old == NULL) { @@ -189,9 +210,9 @@ static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable * table, SLRUEntry *ent return old; } -static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { SLRUEntry **entry = taosLRUEntryTableFindPtr(table, key, keyLen, hash); - SLRUEntry *result = *entry; + SLRUEntry *result = *entry; if (result) { *entry = result->nextHash; --table->elems; @@ -201,17 +222,17 @@ static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable * table, const void *ke } struct SLRUCacheShard { - size_t capacity; - size_t highPriPoolUsage; - bool strictCapacity; - double highPriPoolRatio; - double highPriPoolCapacity; - SLRUEntry lru; - SLRUEntry *lruLowPri; - SLRUEntryTable table; - size_t usage; // Memory size for entries residing in the cache. - size_t lruUsage; // Memory size for entries residing only in the LRU list. - TdThreadMutex mutex; + size_t capacity; + size_t highPriPoolUsage; + bool strictCapacity; + double highPriPoolRatio; + double highPriPoolCapacity; + SLRUEntry lru; + SLRUEntry *lruLowPri; + SLRUEntryTable table; + size_t usage; // Memory size for entries residing in the cache. + size_t lruUsage; // Memory size for entries residing only in the LRU list. + TdThreadMutex mutex; }; #define TAOS_LRU_CACHE_SHARD_HASH32(key, len) (MurmurHash3_32((key), (len))) @@ -231,8 +252,7 @@ static void taosLRUCacheShardLRUInsert(SLRUCacheShard *shard, SLRUEntry *e) { assert(e->next == NULL); assert(e->prev == NULL); - if (shard->highPriPoolRatio > 0 - && (TAOS_LRU_ENTRY_IS_HIGH_PRI(e) || TAOS_LRU_ENTRY_HAS_HIT(e))) { + if (shard->highPriPoolRatio > 0 && (TAOS_LRU_ENTRY_IS_HIGH_PRI(e) || TAOS_LRU_ENTRY_HAS_HIT(e))) { e->next = &shard->lru; e->prev = shard->lru.prev; @@ -248,7 +268,7 @@ static void taosLRUCacheShardLRUInsert(SLRUCacheShard *shard, SLRUEntry *e) { e->prev->next = e; e->next->prev = e; - + TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(e, false); shard->lruLowPri = e; } @@ -304,13 +324,13 @@ static void taosLRUCacheShardSetCapacity(SLRUCacheShard *shard, size_t capacity) for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); } -static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool strict, - double highPriPoolRatio, int maxUpperHashBits) { +static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool strict, double highPriPoolRatio, + int maxUpperHashBits) { if (taosLRUEntryTableInit(&shard->table, maxUpperHashBits) < 0) { return -1; } @@ -341,23 +361,24 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { taosLRUEntryTableCleanup(&shard->table); } -static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { +static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, + bool freeOnFail) { LRUStatus status = TAOS_LRU_STATUS_OK; - SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); + SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); taosThreadMutexLock(&shard->mutex); taosLRUCacheShardEvictLRU(shard, e->totalCharge, lastReferenceList); - + if (shard->usage + e->totalCharge > shard->capacity && (shard->strictCapacity || handle == NULL)) { TAOS_LRU_ENTRY_SET_IN_CACHE(e, false); if (handle == NULL) { taosArrayPush(lastReferenceList, &e); } else { if (freeOnFail) { - taosMemoryFree(e); + taosMemoryFree(e); - *handle = NULL; + *handle = NULL; } status = TAOS_LRU_STATUS_INCOMPLETE; @@ -371,21 +392,21 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * assert(TAOS_LRU_ENTRY_IN_CACHE(old)); TAOS_LRU_ENTRY_SET_IN_CACHE(old, false); if (!TAOS_LRU_ENTRY_HAS_REFS(e)) { - taosLRUCacheShardLRURemove(shard, old); - assert(shard->usage >= old->totalCharge); - shard->usage -= old->totalCharge; + taosLRUCacheShardLRURemove(shard, old); + assert(shard->usage >= old->totalCharge); + shard->usage -= old->totalCharge; - taosArrayPush(lastReferenceList, &old); + taosArrayPush(lastReferenceList, &old); } } if (handle == NULL) { taosLRUCacheShardLRUInsert(shard, e); } else { if (!TAOS_LRU_ENTRY_HAS_REFS(e)) { - TAOS_LRU_ENTRY_REF(e); + TAOS_LRU_ENTRY_REF(e); } - *handle = (LRUHandle*) e; + *handle = (LRUHandle *)e; } } @@ -394,7 +415,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); @@ -402,8 +423,8 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * } static LRUStatus taosLRUCacheShardInsert(SLRUCacheShard *shard, const void *key, size_t keyLen, uint32_t hash, - void *value, size_t charge, _taos_lru_deleter_t deleter, - LRUHandle **handle, LRUPriority priority) { + void *value, size_t charge, _taos_lru_deleter_t deleter, LRUHandle **handle, + LRUPriority priority) { SLRUEntry *e = taosMemoryCalloc(1, sizeof(SLRUEntry) - 1 + keyLen); if (!e) { return TAOS_LRU_STATUS_FAIL; @@ -442,7 +463,7 @@ static LRUHandle *taosLRUCacheShardLookup(SLRUCacheShard *shard, const void *key taosThreadMutexUnlock(&shard->mutex); - return (LRUHandle *) e; + return (LRUHandle *)e; } static void taosLRUCacheShardErase(SLRUCacheShard *shard, const void *key, size_t keyLen, uint32_t hash) { @@ -482,7 +503,7 @@ static void taosLRUCacheShardEraseUnrefEntries(SLRUCacheShard *shard) { TAOS_LRU_ENTRY_SET_IN_CACHE(old, false); assert(shard->usage >= old->totalCharge); shard->usage -= old->totalCharge; - + taosArrayPush(lastReferenceList, &old); } @@ -491,14 +512,14 @@ static void taosLRUCacheShardEraseUnrefEntries(SLRUCacheShard *shard) { for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); } static bool taosLRUCacheShardRef(SLRUCacheShard *shard, LRUHandle *handle) { - SLRUEntry *e = (SLRUEntry *) handle; + SLRUEntry *e = (SLRUEntry *)handle; taosThreadMutexLock(&shard->mutex); assert(TAOS_LRU_ENTRY_HAS_REFS(e)); @@ -514,8 +535,8 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b return false; } - SLRUEntry *e = (SLRUEntry *) handle; - bool lastReference = false; + SLRUEntry *e = (SLRUEntry *)handle; + bool lastReference = false; taosThreadMutexLock(&shard->mutex); @@ -537,7 +558,7 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b assert(shard->usage >= e->totalCharge); shard->usage -= e->totalCharge; } - + taosThreadMutexUnlock(&shard->mutex); if (lastReference) { @@ -549,7 +570,7 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b static size_t taosLRUCacheShardGetUsage(SLRUCacheShard *shard) { size_t usage = 0; - + taosThreadMutexLock(&shard->mutex); usage = shard->usage; taosThreadMutexUnlock(&shard->mutex); @@ -559,7 +580,7 @@ static size_t taosLRUCacheShardGetUsage(SLRUCacheShard *shard) { static size_t taosLRUCacheShardGetPinnedUsage(SLRUCacheShard *shard) { size_t usage = 0; - + taosThreadMutexLock(&shard->mutex); assert(shard->usage >= shard->lruUsage); @@ -579,11 +600,11 @@ static void taosLRUCacheShardSetStrictCapacity(SLRUCacheShard *shard, bool stric } struct SShardedCache { - uint32_t shardMask; - TdThreadMutex capacityMutex; - size_t capacity; - bool strictCapacity; - uint64_t lastId; // atomic var for last id + uint32_t shardMask; + TdThreadMutex capacityMutex; + size_t capacity; + bool strictCapacity; + uint64_t lastId; // atomic var for last id }; struct SLRUCache { @@ -593,7 +614,7 @@ struct SLRUCache { }; static int getDefaultCacheShardBits(size_t capacity) { - int numShardBits = 0; + int numShardBits = 0; size_t minShardSize = 512 * 1024; size_t numShards = capacity / minShardSize; while (numShards >>= 1) { @@ -621,7 +642,7 @@ SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoo numShardBits = getDefaultCacheShardBits(capacity); } - int numShards = 1 << numShardBits; + int numShards = 1 << numShardBits; cache->shards = taosMemoryCalloc(numShards, sizeof(SLRUCacheShard)); if (!cache->shards) { taosMemoryFree(cache); @@ -629,7 +650,7 @@ SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoo return NULL; } - bool strictCapacity = 1; + bool strictCapacity = 1; size_t perShard = (capacity + (numShards - 1)) / numShards; for (int i = 0; i < numShards; ++i) { taosLRUCacheShardInit(&cache->shards[i], perShard, strictCapacity, highPriPoolRatio, 32 - numShardBits); @@ -653,7 +674,7 @@ void taosLRUCacheCleanup(SLRUCache *cache) { int numShards = cache->numShards; assert(numShards > 0); for (int i = 0; i < numShards; ++i) { - taosLRUCacheShardCleanup(&cache->shards[i]); + taosLRUCacheShardCleanup(&cache->shards[i]); } taosMemoryFree(cache->shards); cache->shards = 0; @@ -666,11 +687,12 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority) { + _taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; - return taosLRUCacheShardInsert(&cache->shards[shardIndex], key, keyLen, hash, value, charge, deleter, handle, priority); + return taosLRUCacheShardInsert(&cache->shards[shardIndex], key, keyLen, hash, value, charge, deleter, handle, + priority); } LRUHandle *taosLRUCacheLookup(SLRUCache *cache, const void *key, size_t keyLen) { @@ -699,7 +721,7 @@ bool taosLRUCacheRef(SLRUCache *cache, LRUHandle *handle) { return false; } - uint32_t hash = ((SLRUEntry *) handle)->hash; + uint32_t hash = ((SLRUEntry *)handle)->hash; uint32_t shardIndex = hash & cache->shardedCache.shardMask; return taosLRUCacheShardRef(&cache->shards[shardIndex], handle); @@ -710,15 +732,13 @@ bool taosLRUCacheRelease(SLRUCache *cache, LRUHandle *handle, bool eraseIfLastRe return false; } - uint32_t hash = ((SLRUEntry *) handle)->hash; + uint32_t hash = ((SLRUEntry *)handle)->hash; uint32_t shardIndex = hash & cache->shardedCache.shardMask; return taosLRUCacheShardRelease(&cache->shards[shardIndex], handle, eraseIfLastRef); } -void* taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle) { - return ((SLRUEntry*) handle)->value; -} +void *taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle) { return ((SLRUEntry *)handle)->value; } size_t taosLRUCacheGetUsage(SLRUCache *cache) { size_t usage = 0; @@ -742,7 +762,7 @@ size_t taosLRUCacheGetPinnedUsage(SLRUCache *cache) { void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity) { uint32_t numShards = cache->numShards; - size_t perShard = (capacity + (numShards = 1)) / numShards; + size_t perShard = (capacity + (numShards - 1)) / numShards; taosThreadMutexLock(&cache->shardedCache.capacityMutex); @@ -751,7 +771,7 @@ void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity) { } cache->shardedCache.capacity = capacity; - + taosThreadMutexUnlock(&cache->shardedCache.capacityMutex); } @@ -777,7 +797,7 @@ void taosLRUCacheSetStrictCapacity(SLRUCache *cache, bool strict) { } cache->shardedCache.strictCapacity = strict; - + taosThreadMutexUnlock(&cache->shardedCache.capacityMutex); } From 10dcf571ce352dca0e03b680df7e06820ecccd9e Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 30 Jun 2022 20:20:27 +0800 Subject: [PATCH 43/68] test: add test case for tmq --- tests/pytest/util/common.py | 14 +- tests/system-test/7-tmq/tmqAlterSchema.py | 259 ++++++++++++++++++++++ tests/system-test/7-tmq/tmqCommon.py | 63 ++++++ tests/system-test/fulltest.sh | 1 + 4 files changed, 335 insertions(+), 2 deletions(-) create mode 100644 tests/system-test/7-tmq/tmqAlterSchema.py diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 998e0248ab..6425e7acfa 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -535,6 +535,7 @@ class TDCom: ts_value = self.genTs()[0] column_value_list = list() + column_value_list.append(ts_value) if column_elm_list is None: column_value_list = list(map(lambda i: self.gen_random_type_value(i, self.default_varchar_length, self.default_varchar_datatype, self.default_nchar_length, self.default_nchar_datatype), self.full_type_list)) else: @@ -551,7 +552,7 @@ class TDCom: column_value_list.append(self.gen_random_type_value(column_elm["type"], "", "", "", "")) else: continue - column_value_list = [self.ts_value] + self.column_value_list + # column_value_list = [self.ts_value] + self.column_value_list return column_value_list def create_stable(self, tsql, dbname=None, stbname="stb", column_elm_list=None, tag_elm_list=None, @@ -640,7 +641,16 @@ class TDCom: else: for num in range(count): column_value_list = self.gen_column_value_list(column_ele_list, f'{start_ts_value}+{num}s') - column_value_str = ", ".join(str(v) for v in column_value_list) + # column_value_str = ", ".join(str(v) for v in column_value_list) + column_value_str = '' + idx = 0 + for column_value in column_value_list: + if isinstance(column_value, str) and idx != 0: + column_value_str += f'"{column_value}", ' + else: + column_value_str += f'{column_value}, ' + idx += 1 + column_value_str = column_value_str.rstrip()[:-1] insert_sql = f'insert into {dbname}.{tbname} values ({column_value_str});' tsql.execute(insert_sql) def getOneRow(self, location, containElm): diff --git a/tests/system-test/7-tmq/tmqAlterSchema.py b/tests/system-test/7-tmq/tmqAlterSchema.py new file mode 100644 index 0000000000..a2e20990d9 --- /dev/null +++ b/tests/system-test/7-tmq/tmqAlterSchema.py @@ -0,0 +1,259 @@ + +from ntpath import join +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from util.cluster import * + +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.dnodes = 5 + self.mnodes = 3 + self.idIndex = 0 + self.roleIndex = 2 + self.mnodeStatusIndex = 3 + self.mnodeEpIndex = 1 + self.dnodeStatusIndex = 4 + self.mnodeCheckCnt = 10 + self.host = socket.gethostname() + self.startPort = 6030 + self.portStep = 100 + self.dnodeOfLeader = 0 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: topic: select * from stb, while consume, add column int-A/bianry-B/float-C, and then modify B, drop C") + tdLog.printNoPrefix("add tag int-A/bianry-B/float-C, and then rename A, modify B, drop C, set t2") + paraDict = {'dbName': 'db1', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':20, 'count':1}, {'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + queryStringList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ctb") + tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("async insert data") + # pThread = tmqCom.asyncInsertData(paraDict) + tmqCom.insert_data_2(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"],paraDict["ctbStartIdx"]) + + tdLog.info("create topics from stb with filter") + queryStringList.append("select * from %s.%s" %(paraDict['dbName'], paraDict['stbName'])) + sqlString = "create topic %s as %s" %(topicNameList[0], queryStringList[0]) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + dstFile = tmqCom.getResultFileByTaosShell(consumerId, queryStringList[0]) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + + tdLog.info("wait the notify info of start consume, then alter schema") + tmqCom.getStartConsumeNotifyFromTmqsim() + + # add column double-A/bianry-B/double-C, and then modify B, drop C + sqlString = "alter table %s.%s add column newc1 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc2 binary(16)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc3 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify column newc2 binary(32)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop column newc3"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + # add tag double-A/bianry-B/double-C, and then rename A, modify B, drop C, set t1 + sqlString = "alter table %s.%s add tag newt1 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add tag newt2 binary(16)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add tag newt3 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s rename tag newt1 newt1n"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify tag newt2 binary(32)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop tag newt3"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s0 set tag newt2='new tag'"%(paraDict["dbName"],paraDict['ctbPrefix']) + tdSql.execute(sqlString) + + tdLog.info("check the consume result") + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d"%(expectRowsList[0])) + tdLog.info("act consume rows: %d"%(resultList[0])) + + if expectRowsList[0] != resultList[0]: + tdLog.exit("0 tmq consume rows error!") + + tmqCom.checkTmqConsumeFileContent(consumerId, dstFile) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: topic: select * from ntb, while consume, add column int-A/bianry-B/float-C, and then rename A, modify B, drop C") + paraDict = {'dbName': 'db1', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':20, 'count':2}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + + ntbName = 'ntb' + + topicNameList = ['topic1'] + expectRowsList = [] + queryStringList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ntb") + tdCom.create_table(tdSql, dbname=paraDict["dbName"],tbname=ntbName,column_elm_list=paraDict['colSchema'],count=1) + tdLog.info("start insert data ....") + # pThread = tmqCom.asyncInsertData(paraDict) + tdCom.insert_rows(tdSql, dbname=paraDict["dbName"], tbname=ntbName, column_ele_list=paraDict['colSchema'], start_ts_value=paraDict["startTs"], count=paraDict["rowsPerTbl"]) + tdLog.info("insert data end") + + tdLog.info("create topics from ntb with filter") + queryStringList.append("select * from %s.%s" %(paraDict['dbName'], ntbName)) + sqlString = "create topic %s as %s" %(topicNameList[0], queryStringList[0]) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + dstFile = tmqCom.getResultFileByTaosShell(consumerId, queryStringList[0]) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + + tdLog.info("wait the notify info of start consume, then alter schema") + tmqCom.getStartConsumeNotifyFromTmqsim() + + # add column double-A/bianry-B/double-C, and then rename A, modify B, drop C + sqlString = "alter table %s.%s add column newc1 double"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc2 binary(16)"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc3 double"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s rename column newc1 newc1n"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify column newc2 binary(32)"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop column newc3"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + + tdLog.info("check the consume result") + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d"%(expectRowsList[0])) + tdLog.info("act consume rows: %d"%(resultList[0])) + + if expectRowsList[0] != resultList[0]: + tdLog.exit("0 tmq consume rows error!") + + tmqCom.checkTmqConsumeFileContent(consumerId, dstFile) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + self.tmqCase1() + self.tmqCase2() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index b545340153..04adb93b8a 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -383,6 +383,69 @@ class TMQCom: pThread.start() return pThread + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + lines = 0 + while True: + dst = queryFile.readline() + src = consumeFile.readline() + lines += 1 + if dst: + if dst != src: + tdLog.info("src row: %s"%src) + tdLog.info("dst row: %s"%dst) + tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines)) + else: + break + return + + def getResultFileByTaosShell(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + return dstFile + + def checkTmqConsumeFileContent(self, consumerId, dstFile): + cfgPath = tdCom.getClientCfgPath() + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + lines = 0 + while True: + dst = queryFile.readline() + src = consumeFile.readline() + lines += 1 + if dst: + if dst != src: + tdLog.info("src row: %s"%src) + tdLog.info("dst row: %s"%dst) + tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines)) + else: + break + return + def close(self): self.cursor.close() diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 44a3afcf73..a4e191b36a 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -153,3 +153,4 @@ python3 ./test.py -f 7-tmq/tmqUdf.py #python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 5 python3 ./test.py -f 7-tmq/tmqConsumerGroup.py python3 ./test.py -f 7-tmq/tmqShow.py +python3 ./test.py -f 7-tmq/tmqAlterSchema.py From 68cfa54e26f0eb2fdec8fd0201fa839d6efd8c43 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 30 Jun 2022 20:21:24 +0800 Subject: [PATCH 44/68] feat(stream): ignore close window --- source/libs/executor/src/timewindowoperator.c | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 95b16589ee..66900fb7aa 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1246,6 +1246,9 @@ void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprS pCtx[i].fpSet.init(&pCtx[i], pResInfo); } } + SFilePage* bufPage = getBufPage(pResultBuf, p1->pageId); + setBufPageDirty(bufPage, true); + releaseBufPage(pResultBuf, bufPage); } bool doClearWindow(SAggSupporter* pAggSup, SExprSupp* pSup, char* pData, int16_t bytes, uint64_t groupId, @@ -3171,6 +3174,10 @@ static void doClearSessionWindows(SStreamAggSupporter* pAggSup, SExprSupp* pSup, getSessionTimeWindow(pAggSup, tsCols[i], INT64_MIN, pBlock->info.groupId, gap, &winIndex); step = updateSessionWindowInfo(pCurWin, tsCols, NULL, pBlock->info.rows, i, gap, NULL); ASSERT(isInWindow(pCurWin, tsCols[i], gap)); + if (pCurWin->pos.pageId == -1) { + // window has been closed. + continue; + } doClearWindowImpl(&pCurWin->pos, pAggSup->pResultBuf, pSup, numOfOutput); if (result) { taosArrayPush(result, pCurWin); @@ -3246,12 +3253,12 @@ static void rebuildTimeWindow(SStreamSessionAggOperatorInfo* pInfo, SArray* pWin setWindowOutputBuf(pChWin, &pChResult, pChild->exprSupp.pCtx, groupId, numOfOutput, pChild->exprSupp.rowEntryInfoOffset, &pChInfo->streamAggSup, pTaskInfo); compactFunctions(pSup->pCtx, pChild->exprSupp.pCtx, numOfOutput, pTaskInfo); - SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pChWin->pos.pageId); - setBufPageDirty(bufPage, true); - releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage); + SFilePage* bufPage = getBufPage(pChInfo->streamAggSup.pResultBuf, pChWin->pos.pageId); + releaseBufPage(pChInfo->streamAggSup.pResultBuf, bufPage); continue; + } else if (!pChWin->isClosed) { + break; } - break; } } SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pParentWin->pos.pageId); @@ -3265,7 +3272,8 @@ typedef SResultWindowInfo* (*__get_win_info_)(void*); SResultWindowInfo* getResWinForSession(void* pData) { return (SResultWindowInfo*)pData; } SResultWindowInfo* getResWinForState(void* pData) { return &((SStateWindowInfo*)pData)->winInfo; } -int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArray* pClosed, __get_win_info_ fn) { +int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, + SArray* pClosed, __get_win_info_ fn, bool delete) { // Todo(liuyao) save window to tdb void** pIte = NULL; size_t keyLen = 0; @@ -3279,10 +3287,18 @@ int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArra if (isCloseWindow(&pSeWin->win, pTwSup)) { if (!pSeWin->isClosed) { pSeWin->isClosed = true; - if (pTwSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + if (pTwSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE && pClosed) { int32_t code = saveResult(pSeWin->win.skey, pSeWin->pos.pageId, pSeWin->pos.offset, *pGroupId, pClosed); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pSeWin->isOutput = true; } + if (delete) { + taosArrayRemove(pWins, i); + i--; + size = taosArrayGetSize(pWins); + } } continue; } @@ -3292,6 +3308,16 @@ int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArra return TSDB_CODE_SUCCESS; } +static void closeChildSessionWindow(SArray* pChildren, TSKEY maxTs, bool delete) { + int32_t size = taosArrayGetSize(pChildren); + for (int32_t i = 0; i < size; i++) { + SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); + SStreamSessionAggOperatorInfo* pChInfo = pChildOp->info; + pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); + closeSessionWindow(pChInfo->streamAggSup.pResultRows, &pChInfo->twAggSup, NULL, getResWinForSession, delete); + } +} + int32_t getAllSessionWindow(SHashObj* pHashMap, SArray* pClosed, __get_win_info_ fn) { void** pIte = NULL; while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) { @@ -3339,6 +3365,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pBlock == NULL) { break; } + printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "Final Session Recv" : "Single Session Recv"); if (pBlock->info.type == STREAM_CLEAR) { SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo)); @@ -3385,7 +3412,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { // restore the value pOperator->status = OP_RES_TO_RETURN; - closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, getResWinForSession); + closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, + getResWinForSession, pInfo->ignoreCloseWindow); + closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs, pInfo->ignoreCloseWindow); copyUpdateResult(pStUpdated, pUpdated); taosHashCleanup(pStUpdated); @@ -3437,10 +3466,11 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } else if (pOperator->status == OP_RES_TO_RETURN) { doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { + printDataBlock(pInfo->pDelRes, "Semi Session"); return pInfo->pDelRes; } doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0) { + if (pBInfo->pRes->info.rows == 0) { pOperator->status = OP_EXEC_DONE; if (pInfo->pUpdateRes->info.rows == 0) { // semi interval operator clear disk buffer @@ -3449,9 +3479,11 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } // process the rest of the data pOperator->status = OP_OPENED; + printDataBlock(pInfo->pUpdateRes, "Semi Session"); return pInfo->pUpdateRes; } - return pInfo->binfo.pRes; + printDataBlock(pBInfo->pRes, "Semi Session"); + return pBInfo->pRes; } _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); @@ -3495,21 +3527,24 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { finalizeUpdatedResult(pOperator->exprSupp.numOfExprs, pInfo->streamAggSup.pResultBuf, pUpdated, pSup->rowEntryInfoOffset); initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated); - blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity); doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { + printDataBlock(pInfo->pDelRes, "Semi Session"); return pInfo->pDelRes; } - doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0) { + doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); + if (pBInfo->pRes->info.rows == 0) { pOperator->status = OP_EXEC_DONE; if (pInfo->pUpdateRes->info.rows == 0) { return NULL; } // process the rest of the data pOperator->status = OP_OPENED; + printDataBlock(pInfo->pUpdateRes, "Semi Session"); return pInfo->pUpdateRes; } + printDataBlock(pBInfo->pRes, "Semi Session"); return pBInfo->pRes->info.rows == 0 ? NULL : pBInfo->pRes; } @@ -3867,7 +3902,9 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { // restore the value pOperator->status = OP_RES_TO_RETURN; - closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, getResWinForState); + closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, + getResWinForState, pInfo->ignoreCloseWindow); + closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs, pInfo->ignoreCloseWindow); copyUpdateResult(pSeUpdated, pUpdated); taosHashCleanup(pSeUpdated); From 6883aeb33c5c040dfac86ed8282ce859f89c9b40 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 30 Jun 2022 21:25:16 +0800 Subject: [PATCH 45/68] test: add test case --- tests/test/c/tmqSim.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 7d57ef0781..542c37b7c9 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -633,8 +633,9 @@ void loop_consume(SThreadInfo* pInfo) { } } - uint64_t lastPrintTime = taosGetTimestampMs(); - uint64_t startTs = taosGetTimestampMs(); + int64_t lastTotalMsgs = 0; + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); int32_t consumeDelay = g_stConfInfo.consumeDelay == -1 ? -1 : (g_stConfInfo.consumeDelay * 1000); while (running) { @@ -647,20 +648,22 @@ void loop_consume(SThreadInfo* pInfo) { taos_free_result(tmqMsg); totalMsgs++; - - int64_t currentPrintTime = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 10 * 1000) { - taosFprintfFile(g_fp, "consumer id %d has currently poll total msgs: %" PRId64 "\n", pInfo->consumerId, - totalMsgs); - lastPrintTime = currentPrintTime; - } - + + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 10 * 1000) { + taosFprintfFile(g_fp, + "consumer id %d has currently poll total msgs: %" PRId64 ", period rate: %.3f msgs/second\n", + pInfo->consumerId, totalMsgs, (totalMsgs - lastTotalMsgs) * 1000.0/(currentPrintTime - lastPrintTime)); + lastPrintTime = currentPrintTime; + lastTotalMsgs = totalMsgs; + } + if (0 == once_flag) { once_flag = 1; notifyMainScript(pInfo, NOTIFY_CMD_START_CONSUM); } - if (totalRows >= pInfo->expectMsgCnt) { + if ((totalRows >= pInfo->expectMsgCnt) || (totalMsgs >= pInfo->expectMsgCnt)) { char tmpString[128]; taosFprintfFile(g_fp, "%s over than expect rows, so break consume\n", getCurrentTimeString(tmpString)); break; @@ -671,7 +674,7 @@ void loop_consume(SThreadInfo* pInfo) { break; } } - + if (0 == running) { taosFprintfFile(g_fp, "receive stop signal and not continue consume\n"); } @@ -881,11 +884,11 @@ int main(int32_t argc, char* argv[]) { int64_t t = end - start; if (0 == t) t = 1; - + double tInMs = (double)t / 1000000.0; taosFprintfFile(g_fp, - "Spent %.4f seconds to poll msgs: %" PRIu64 " with %d thread(s), throughput: %.2f msgs/second\n\n", - tInMs, totalMsgs, g_stConfInfo.numOfThread, (double)(totalMsgs / tInMs)); + "Spent %.3f seconds to poll msgs: %" PRIu64 " with %d thread(s), throughput: %.3f msgs/second\n\n", + tInMs, totalMsgs, g_stConfInfo.numOfThread, (double)(totalMsgs / tInMs)); taosFprintfFile(g_fp, "==== close tmqlog ====\n"); taosCloseFile(&g_fp); From 126d884ab3eb8ae16772f54b25840e0c205a20b6 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 30 Jun 2022 21:32:08 +0800 Subject: [PATCH 46/68] docs: use normal doc style (#14411) --- docs/en/14-reference/04-taosadapter.md | 4 ++-- docs/zh/14-reference/04-taosadapter.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md index 3264124655..cad229c32d 100644 --- a/docs/en/14-reference/04-taosadapter.md +++ b/docs/en/14-reference/04-taosadapter.md @@ -206,8 +206,8 @@ Note: InfluxDB token authorization is not supported at present. Only Basic autho You can use any client that supports the http protocol to access the RESTful interface address `http://:6041/` to write data in OpenTSDB compatible format to TDengine. ```text -/opentsdb/v1/put/json/:db -/opentsdb/v1/put/telnet/:db +/opentsdb/v1/put/json/ +/opentsdb/v1/put/telnet/ ``` ### collectd diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md index 6e259391d4..42bc51a6d3 100644 --- a/docs/zh/14-reference/04-taosadapter.md +++ b/docs/zh/14-reference/04-taosadapter.md @@ -207,8 +207,8 @@ AllowWebSockets 您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://:6041/` 来写入 OpenTSDB 兼容格式的数据到 TDengine。EndPoint 如下: ```text -/opentsdb/v1/put/json/:db -/opentsdb/v1/put/telnet/:db +/opentsdb/v1/put/json/ +/opentsdb/v1/put/telnet/ ``` ### collectd From 4f39cd31b0527f285b64c91cb8c997e8c959bde6 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 1 Jul 2022 09:50:20 +0800 Subject: [PATCH 47/68] refactor(sync): add snapshot2 interface --- include/libs/sync/sync.h | 2 +- source/libs/sync/inc/syncAppendEntries.h | 1 + source/libs/sync/inc/syncAppendEntriesReply.h | 1 + source/libs/sync/inc/syncInt.h | 1 + source/libs/sync/inc/syncReplication.h | 7 ++ source/libs/sync/src/syncAppendEntries.c | 2 + source/libs/sync/src/syncAppendEntriesReply.c | 57 +++++++++ source/libs/sync/src/syncReplication.c | 111 ++++++++++++++++++ 8 files changed, 181 insertions(+), 1 deletion(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index d5d6fa5706..9a4a00251c 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -204,7 +204,7 @@ SyncGroupId syncGetVgId(int64_t rid); void syncGetEpSet(int64_t rid, SEpSet* pEpSet); void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet); int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak); -int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize); +// int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize); bool syncEnvIsStart(); const char* syncStr(ESyncState state); bool syncIsRestoreFinish(int64_t rid); diff --git a/source/libs/sync/inc/syncAppendEntries.h b/source/libs/sync/inc/syncAppendEntries.h index 98df22d51b..e15c85d73b 100644 --- a/source/libs/sync/inc/syncAppendEntries.h +++ b/source/libs/sync/inc/syncAppendEntries.h @@ -94,6 +94,7 @@ extern "C" { // int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg); int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMsg); +int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatch* pMsg); #ifdef __cplusplus } diff --git a/source/libs/sync/inc/syncAppendEntriesReply.h b/source/libs/sync/inc/syncAppendEntriesReply.h index e509a50dc4..03148252fb 100644 --- a/source/libs/sync/inc/syncAppendEntriesReply.h +++ b/source/libs/sync/inc/syncAppendEntriesReply.h @@ -42,6 +42,7 @@ extern "C" { // int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); +int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); #ifdef __cplusplus } diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 7af752ff42..66e5d28bdd 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -67,6 +67,7 @@ typedef struct SSyncNode { char path[TSDB_FILENAME_LEN]; char raftStorePath[TSDB_FILENAME_LEN * 2]; char configPath[TSDB_FILENAME_LEN * 2]; + int32_t batchSize; // sync io SWal* pWal; diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index 4b1f5b4638..d6aa52523c 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -53,8 +53,15 @@ extern "C" { // int32_t syncNodeAppendEntriesPeers(SSyncNode* pSyncNode); int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode); +int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode); int32_t syncNodeReplicate(SSyncNode* pSyncNode); int32_t syncNodeAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, const SyncAppendEntries* pMsg); +int32_t syncNodeAppendEntriesBatch(SSyncNode* pSyncNode, const SRaftId* destRaftId, const SyncAppendEntriesBatch* pMsg); + +typedef struct SReaderParam { + SyncIndex start; + SyncIndex end; +} SReaderParam; #ifdef __cplusplus } diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index a10b81d165..029374368f 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -719,6 +719,8 @@ static bool syncNodeOnAppendEntriesLogOK(SSyncNode* pSyncNode, SyncAppendEntries return false; } +int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatch* pMsg) { return 0; } + int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMsg) { int32_t ret = 0; int32_t code = 0; diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 10f2745651..39803587e4 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -170,6 +170,63 @@ int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* p } #endif +int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntriesReply* pMsg) { + int32_t ret = 0; + + // if already drop replica, do not process + if (!syncNodeInRaftGroup(ths, &(pMsg->srcId)) && !ths->pRaftCfg->isStandBy) { + syncNodeEventLog(ths, "recv sync-append-entries-reply, maybe replica already dropped"); + return -1; + } + + // drop stale response + if (pMsg->term < ths->pRaftStore->currentTerm) { + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries-reply, recv-term:%lu, drop stale response", pMsg->term); + syncNodeEventLog(ths, logBuf); + return -1; + } + + if (pMsg->term > ths->pRaftStore->currentTerm) { + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries-reply, error term, recv-term:%lu", pMsg->term); + syncNodeErrorLog(ths, logBuf); + return -1; + } + + ASSERT(pMsg->term == ths->pRaftStore->currentTerm); + + if (pMsg->success) { + // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] + syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1); + + if (gRaftDetailLog) { + sTrace("update next match, index:%ld, success:%d", pMsg->matchIndex + 1, pMsg->success); + } + + // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] + syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex); + + // maybe commit + if (ths->state == TAOS_SYNC_STATE_LEADER) { + syncMaybeAdvanceCommitIndex(ths); + } + + } else { + SyncIndex nextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId)); + + // notice! int64, uint64 + if (nextIndex > SYNC_INDEX_BEGIN) { + --nextIndex; + } else { + nextIndex = SYNC_INDEX_BEGIN; + } + syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), nextIndex); + } + + return 0; +} + int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg) { int32_t ret = 0; diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 46850758f1..bc834786c6 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -116,6 +116,97 @@ int32_t syncNodeAppendEntriesPeers(SSyncNode* pSyncNode) { return ret; } +int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) { + if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { + return -1; + } + + int32_t ret = 0; + for (int i = 0; i < pSyncNode->peersNum; ++i) { + SRaftId* pDestId = &(pSyncNode->peersId[i]); + + // next index + SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId); + + // if pre-entry not exist, create snapshot + SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); + SSyncRaftEntry* pPreEntry = NULL; + int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preLogIndex, &pPreEntry); + if (code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { + SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; + if (pSyncNode->pFsm->FpGetSnapshot != NULL) { + void* pReader = NULL; + SReaderParam readerParam = {.start = 0, .end = nextIndex}; + pSyncNode->pFsm->FpGetSnapshot(pSyncNode->pFsm, &snapshot, &readerParam, &pReader); + + // get sender + SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(pSyncNode, pDestId); + ASSERT(pSender != NULL); + + if (snapshot.lastApplyIndex >= SYNC_INDEX_BEGIN && nextIndex <= snapshot.lastApplyIndex + 1 && + !snapshotSenderIsStart(pSender)) { + // start snapshot + snapshotSenderStart(pSender, snapshot, pReader); + } else { + // no snapshot + if (pReader != NULL) { + pSyncNode->pFsm->FpSnapshotStopRead(pSyncNode->pFsm, pReader); + } + } + } + } + + // pre index, pre term + preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); + SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex); + if (preLogTerm == SYNC_TERM_INVALID) { + SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; + syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex); + syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID); + sError("vgId:%d sync get pre term error, nextIndex:%ld, update next-index:%ld, match-index:%d, raftid:%ld", + pSyncNode->vgId, nextIndex, newNextIndex, SYNC_INDEX_INVALID, pDestId->addr); + + return -1; + } + + SRpcMsg rpcMsgArr[SYNC_MAX_BATCH_SIZE]; + memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); + + int32_t getCount = 0; + for (int32_t i = 0; i < pSyncNode->batchSize; ++i) { + SSyncRaftEntry* pEntry; + int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry); + if (code == 0) { + ASSERT(pEntry != NULL); + // get rpc msg [i] from entry + syncEntryDestory(pEntry); + getCount++; + } else { + break; + } + } + + SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, getCount, pSyncNode->vgId); + ASSERT(pMsg != NULL); + + // prepare msg + pMsg->srcId = pSyncNode->myRaftId; + pMsg->destId = *pDestId; + pMsg->term = pSyncNode->pRaftStore->currentTerm; + pMsg->prevLogIndex = preLogIndex; + pMsg->prevLogTerm = preLogTerm; + pMsg->commitIndex = pSyncNode->commitIndex; + pMsg->privateTerm = 0; + pMsg->dataCount = getCount; + + // send msg + syncNodeAppendEntriesBatch(pSyncNode, pDestId, pMsg); + syncAppendEntriesBatchDestroy(pMsg); + } + + return 0; +} + int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode) { ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER); @@ -234,4 +325,24 @@ int32_t syncNodeAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, c syncAppendEntries2RpcMsg(pMsg, &rpcMsg); syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg); return ret; +} + +int32_t syncNodeAppendEntriesBatch(SSyncNode* pSyncNode, const SRaftId* destRaftId, + const SyncAppendEntriesBatch* pMsg) { + do { + char host[128]; + uint16_t port; + syncUtilU642Addr(destRaftId->addr, host, sizeof(host), &port); + sDebug( + "vgId:%d, send sync-append-entries-batch to %s:%d, {term:%lu, pre-index:%ld, pre-term:%lu, pterm:%lu, " + "commit:%ld, " + "datalen:%d, dataCount:%d}", + pSyncNode->vgId, host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, + pMsg->commitIndex, pMsg->dataLen, pMsg->dataCount); + } while (0); + + SRpcMsg rpcMsg; + syncAppendEntriesBatch2RpcMsg(pMsg, &rpcMsg); + syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg); + return 0; } \ No newline at end of file From 7a65589525d7ff10446292492e0a07e13fb8a82b Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Jul 2022 10:15:05 +0800 Subject: [PATCH 48/68] feat(wal): add api to check log existance --- include/libs/wal/wal.h | 2 ++ source/client/src/tmq.c | 4 ++-- source/dnode/vnode/src/tq/tq.c | 6 +----- source/libs/wal/src/walMeta.c | 4 ++++ tests/test/c/tmqSim.c | 6 +++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 92701db2ad..eb5db9d639 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -210,6 +210,8 @@ void walCloseRef(SWalRef *); int32_t walRefVer(SWalRef *, int64_t ver); int32_t walUnrefVer(SWal *); +bool walLogExist(SWal *, int64_t ver); + // lifecycle check bool walIsEmpty(SWal *); int64_t walGetFirstVer(SWal *); diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index bea9d215da..efc1e3a082 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -1609,8 +1609,8 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { int64_t transporterId = 0; /*printf("send poll\n");*/ - char offsetFormatBuf[50]; - tFormatOffset(offsetFormatBuf, 50, &pVg->currentOffsetNew); + char offsetFormatBuf[80]; + tFormatOffset(offsetFormatBuf, 80, &pVg->currentOffsetNew); tscDebug("consumer %ld send poll to %s : vg %d, epoch %d, req offset %s, reqId %lu", tmq->consumerId, pTopic->topicName, pVg->vgId, tmq->epoch, offsetFormatBuf, pReq->reqId); /*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/ diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index d80996b399..8ef66d3ef6 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -276,7 +276,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { tqDebug("tmq poll: consumer %ld, offset reset to %s", consumerId, formatBuf); } else { if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) { - if (pReq->useSnapshot) { + if (pReq->useSnapshot && pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { if (!pHandle->fetchMeta) { tqOffsetResetToData(&fetchOffsetNew, 0, 0); } else { @@ -375,10 +375,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { taosMemoryFree(pHeadWithCkSum); } else if (fetchOffsetNew.type == TMQ_OFFSET__SNAPSHOT_DATA) { - // 1. set uid and ts - // 2. get data (rebuild reader if needed) - // 3. get new uid and ts - tqInfo("retrieve using snapshot req offset: uid %ld ts %ld", dataRsp.reqOffset.uid, dataRsp.reqOffset.ts); if (tqScanSnapshot(pTq, &pHandle->execHandle, &dataRsp, fetchOffsetNew, workerId) < 0) { ASSERT(0); diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 4150fe6d1b..342ab7b152 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -19,6 +19,10 @@ #include "tref.h" #include "walInt.h" +bool FORCE_INLINE walLogExist(SWal* pWal, int64_t ver) { + return !walIsEmpty(pWal) && walGetFirstVer(pWal) <= ver && walGetLastVer(pWal) >= ver; +} + bool FORCE_INLINE walIsEmpty(SWal* pWal) { return pWal->vers.firstVer == -1; } int64_t FORCE_INLINE walGetFirstVer(SWal* pWal) { return pWal->vers.firstVer; } diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 07fdcc2415..5cf38f1e5b 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -36,7 +36,11 @@ #define MAX_CONSUMER_THREAD_CNT (16) #define MAX_VGROUP_CNT (32) -typedef enum { NOTIFY_CMD_START_CONSUM, NOTIFY_CMD_START_COMMIT, NOTIFY_CMD_ID_BUTT } NOTIFY_CMD_ID; +typedef enum { + NOTIFY_CMD_START_CONSUM, + NOTIFY_CMD_START_COMMIT, + NOTIFY_CMD_ID_BUTT, +} NOTIFY_CMD_ID; typedef struct { TdThread thread; From e878f1dcba6f7c39d3d49768852c522fc5cb0067 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 10:16:38 +0800 Subject: [PATCH 49/68] fix: make dnode sort stable --- source/dnode/mnode/impl/src/mndVgroup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index d42016e6a0..4b9f925eb5 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -426,7 +426,11 @@ static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) { float d1Score = (float)pDnode1->numOfVnodes / pDnode1->numOfSupportVnodes; float d2Score = (float)pDnode2->numOfVnodes / pDnode2->numOfSupportVnodes; - return d1Score >= d2Score ? 1 : 0; + if (d1Score == d2Score) { + return pDnode2->id - pDnode1->id; + } else { + return d1Score >= d2Score ? 1 : 0; + } } void mndSortVnodeGid(SVgObj *pVgroup) { From 7f6778c5efda4debc3e50a4698d925b2dc64b046 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 10:18:35 +0800 Subject: [PATCH 50/68] test: adjust cluster case --- tests/script/jenkins/basic.txt | 7 - tests/script/tsim/dnode/balance1.sim | 4 +- tests/script/tsim/dnode/balance2.sim | 4 +- tests/script/tsim/dnode/balance3.sim | 4 +- tests/script/tsim/dnode/cluster_alter.sim | 174 ----- tests/script/tsim/dnode/cluster_balance1.sim | 590 ---------------- tests/script/tsim/dnode/cluster_balance2.sim | 479 ------------- tests/script/tsim/dnode/cluster_balance3.sim | 643 ------------------ tests/script/tsim/dnode/cluster_cache.sim | 65 -- tests/script/tsim/dnode/cluster_flowctrl.sim | 131 ---- tests/script/tsim/dnode/cluster_vgroup100.sim | 146 ---- 11 files changed, 6 insertions(+), 2241 deletions(-) delete mode 100644 tests/script/tsim/dnode/cluster_alter.sim delete mode 100644 tests/script/tsim/dnode/cluster_balance1.sim delete mode 100644 tests/script/tsim/dnode/cluster_balance2.sim delete mode 100644 tests/script/tsim/dnode/cluster_balance3.sim delete mode 100644 tests/script/tsim/dnode/cluster_cache.sim delete mode 100644 tests/script/tsim/dnode/cluster_flowctrl.sim delete mode 100644 tests/script/tsim/dnode/cluster_vgroup100.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 2a3cb88c1f..cb432024b7 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -30,13 +30,6 @@ ./test.sh -f tsim/dnode/balance2.sim ./test.sh -f tsim/dnode/balance3.sim ./test.sh -f tsim/dnode/balancex.sim -#./test.sh -f tsim/dnode/cluster_alter.sim -#./test.sh -f tsim/dnode/cluster_balance1.sim -#./test.sh -f tsim/dnode/cluster_balance2.sim -#./test.sh -f tsim/dnode/cluster_balance3.sim -#./test.sh -f tsim/dnode/cluster_cache.sim -#./test.sh -f tsim/dnode/cluster_flowctrl.sim -#./test.sh -f tsim/dnode/cluster_vgroup100.sim ./test.sh -f tsim/dnode/create_dnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim diff --git a/tests/script/tsim/dnode/balance1.sim b/tests/script/tsim/dnode/balance1.sim index 6471529a1e..848c6d424f 100644 --- a/tests/script/tsim/dnode/balance1.sim +++ b/tests/script/tsim/dnode/balance1.sim @@ -207,10 +207,10 @@ sql drop dnode 3 sql show dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 2 then +if $data(1)[2] != 1 then return -1 endi -if $data(4)[2] != 2 then +if $data(4)[2] != 3 then return -1 endi diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim index 5da9a659f3..da8855ff03 100644 --- a/tests/script/tsim/dnode/balance2.sim +++ b/tests/script/tsim/dnode/balance2.sim @@ -167,10 +167,10 @@ endi if $data(3)[2] != 3 then return -1 endi -if $data(4)[2] != 4 then +if $data(4)[2] != 3 then return -1 endi -if $data(5)[2] != 3 then +if $data(5)[2] != 4 then return -1 endi diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim index f26c0eaa21..2ce3a4d064 100644 --- a/tests/script/tsim/dnode/balance3.sim +++ b/tests/script/tsim/dnode/balance3.sim @@ -309,7 +309,7 @@ print dnode3 openVnodes $data(3)[2] print dnode4 openVnodes $data(4)[2] print dnode5 openVnodes $data(5)[2] print dnode5 openVnodes $data(6)[2] -if $data(1)[2] != 2 then +if $data(1)[2] != 1 then return -1 endi if $data(3)[2] != null then @@ -321,7 +321,7 @@ endi if $data(5)[2] != 3 then return -1 endi -if $data(6)[2] != 2 then +if $data(6)[2] != 3 then return -1 endi diff --git a/tests/script/tsim/dnode/cluster_alter.sim b/tests/script/tsim/dnode/cluster_alter.sim deleted file mode 100644 index 77e040c6cd..0000000000 --- a/tests/script/tsim/dnode/cluster_alter.sim +++ /dev/null @@ -1,174 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c balance -v 0 -system sh/cfg.sh -n dnode2 -c balance -v 0 -system sh/cfg.sh -n dnode3 -c balance -v 0 -system sh/cfg.sh -n dnode4 -c balance -v 0 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 2000 - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -print ========== step2 -sql create database d1 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -print ========== step3 -sleep 2000 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 0 then - return -1 -endi -if $data2_4 != 0 then - return -1 -endi - -print ========== step4 -sql alter dnode 2 balance "vnode:2-dnode:3" - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_2 != 0 then - goto show4 -endi -if $data2_3 != 1 then - goto show4 -endi -if $data2_4 != 0 then - goto show4 -endi - -print ========== step5 -sql alter dnode 3 balance "vnode:2-dnode:4" - -$x = 0 -show5: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_2 != 0 then - goto show5 -endi -if $data2_3 != 0 then - goto show5 -endi -if $data2_4 != 1 then - goto show5 -endi - -print ========== step6 -sql alter dnode 4 balance "vnode:2-dnode:2" - -$x = 0 -show6: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_2 != 1 then - goto show6 -endi -if $data2_3 != 0 then - goto show6 -endi -if $data2_4 != 0 then - goto show6 -endi - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -print ========== step8 -sql_error sql alter dnode 4 balance "vnode:2-dnode:5" - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/cluster_balance1.sim b/tests/script/tsim/dnode/cluster_balance1.sim deleted file mode 100644 index c98687a81c..0000000000 --- a/tests/script/tsim/dnode/cluster_balance1.sim +++ /dev/null @@ -1,590 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 -system sh/deploy.sh -n dnode6 -i 6 -system sh/deploy.sh -n dnode7 -i 7 -system sh/deploy.sh -n dnode8 -i 8 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode8 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode8 -c mnodeEqualVnodeNum -v 0 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 -system sh/cfg.sh -n dnode6 -c wallevel -v 1 -system sh/cfg.sh -n dnode7 -c wallevel -v 1 -system sh/cfg.sh -n dnode8 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode8 -c maxTablesPerVnode -v 4 - - -print ============== step1 -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create database c_b1_d1 -sql use c_b1_d1 - -sql create table c_b1_t1 (t timestamp, i int) -sql insert into c_b1_t1 values(1520000020015, 15) -sql insert into c_b1_t1 values(1520000021014, 14) -sql insert into c_b1_t1 values(1520000022013, 13) -sql insert into c_b1_t1 values(1520000023012, 12) -sql insert into c_b1_t1 values(1520000024011, 11) - -sql create database c_b1_d2 -sql use c_b1_d2 -sql create table c_b1_t2 (t timestamp, i int) -sql insert into c_b1_t2 values(1520000020025, 25) -sql insert into c_b1_t2 values(1520000021024, 24) -sql insert into c_b1_t2 values(1520000022023, 23) -sql insert into c_b1_t2 values(1520000023022, 22) -sql insert into c_b1_t2 values(1520000024021, 21) - -sql show dnodes -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 2 then - return -1 -endi -if $dnode2Vnodes != null then - return -1 -endi - -print ============================== step2 -print ========= start dnode2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show2 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 1 then - goto show2 -endi -if $dnode2Vnodes != 1 then - goto show2 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -print dnode1 ==> $dnode1Role -print dnode2 ==> $dnode2Role - -print ============================== step3 -print ========= add db3 -sql create database c_b1_d3 -sql use c_b1_d3 -sql create table c_b1_t3 (t timestamp, i int) -sql insert into c_b1_t3 values(1520000020035, 35) -sql insert into c_b1_t3 values(1520000021034, 34) -sql insert into c_b1_t3 values(1520000022033, 33) -sql insert into c_b1_t3 values(1520000023032, 32) -sql insert into c_b1_t3 values(1520000024031, 31) - -print ============================== step4 -print ========= drop dnode2 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show4 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 3 then - goto show4 -endi -if $dnode2Vnodes != null then - goto show4 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode2 ==> $dnode2Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -print ============================== step5 -print ========= add dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname3 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show5 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode3Vnodes = $data2_3 -print dnode2 $dnode3Vnodes - -if $dnode1Vnodes != 2 then - goto show5 -endi -if $dnode3Vnodes != 1 then - goto show5 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -if $dnode1Role != master then - return -1 -endi -if $dnode3Role != slave then - return -1 -endi - -print ============================== step6 -sql_error drop dnode $hostname1 - -print ============================== step7 -sql_error create dnode $hostname1 - -print ============================== step8 -sql drop dnode $hostname3 - -$x = 0 -show8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show8 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 3 then - goto show8 -endi -if $dnode3Vnodes != null then - goto show8 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -if $dnode1Role != master then - return -1 -endi - -if $dnode3Role != null then - return -1 -endi - -print ============================== step9 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show9: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show9 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode1Vnodes != 2 then - goto show9 -endi -if $dnode4Vnodes != 1 then - goto show9 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode4 ==> $dnode4Role - -if $dnode1Role != master then - return -1 -endi - -if $dnode4Role != slave then - return -1 -endi - -print ============================== step10 -sql create database c_b1_d4 -sql use c_b1_d4 -sql create table c_b1_t4 (t timestamp, i int) -sql insert into c_b1_t4 values(1520000020045, 45) -sql insert into c_b1_t4 values(1520000021044, 44) -sql insert into c_b1_t4 values(1520000022043, 43) -sql insert into c_b1_t4 values(1520000023042, 42) -sql insert into c_b1_t4 values(1520000024041, 41) - -$x = 0 -show10: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show10 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode1Vnodes != 2 then - goto show10 -endi -if $dnode4Vnodes != 2 then - goto show10 -endi - -sql reset query cache - -sql use c_b1_d3 -sql insert into c_b1_t3 values(1520000025036, 36) - -sql use c_b1_d2 -sql insert into c_b1_t2 values(1520000025026, 26) - -print ============================== step12 -sql create database c_b1_d5 -sql use c_b1_d5 -sql_error create table c_b1_t5 (t timestamp, i int) -x error3 - -print ============================== step13 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start -$x = 0 -step13: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 -print dnode5 $data4_5 - -if $data4_5 != ready then - goto step13 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode4Role = $data2_4 -$dnode5Role = $data2_5 -print dnode1 ==> $dnode1Role -print dnode4 ==> $dnode4Role -print dnode5 ==> $dnode5Role - -sql use c_b1_d5; -sql create table c_b1_t5 (t timestamp, i int) -sql insert into c_b1_t5 values(1520000020055, 55) -sql insert into c_b1_t5 values(1520000021054, 54) -sql insert into c_b1_t5 values(1520000022053, 53) -sql insert into c_b1_t5 values(1520000023052, 52) -sql insert into c_b1_t5 values(1520000024051, 51) - -sql create database c_b1_d6 -sql use c_b1_d6 -sql create table c_b1_t6 (t timestamp, i int) -sql insert into c_b1_t6 values(1520000020065, 65) -sql insert into c_b1_t6 values(1520000021064, 64) -sql insert into c_b1_t6 values(1520000022063, 63) -sql insert into c_b1_t6 values(1520000023062, 62) -sql insert into c_b1_t6 values(1520000024061, 61) - -sql show dnodes -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode2Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode2Vnodes - -if $dnode1Vnodes != 2 then - goto step13 -endi -if $dnode4Vnodes != 2 then - goto step13 -endi -if $dnode5Vnodes != 2 then - goto step13 -endi - -print ============================== step14 -sql create dnode $hostname6 -system sh/exec.sh -n dnode6 -s start -$x = 0 -step14: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 -print dnode4 $data4_5 - -if $data4_6 != ready then - goto step14 -endi - -sql create database c_b1_d7 -sql use c_b1_d7 -sql create table c_b1_t7 (t timestamp, i int) -sql insert into c_b1_t7 values(1520000020075, 75) -sql insert into c_b1_t7 values(1520000021074, 74) -sql insert into c_b1_t7 values(1520000022073, 73) -sql insert into c_b1_t7 values(1520000023072, 72) -sql insert into c_b1_t7 values(1520000024071, 71) - -sql create database c_b1_d8 -sql use c_b1_d8 -sql create table c_b1_t8 (t timestamp, i int) -sql insert into c_b1_t8 values(1520000020085, 85) -sql insert into c_b1_t8 values(1520000021084, 84) -sql insert into c_b1_t8 values(1520000022083, 83) -sql insert into c_b1_t8 values(1520000023082, 82) -sql insert into c_b1_t8 values(1520000024081, 81) - -$x = 0 -show14: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi -sql show dnodes -x show14 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes - -if $dnode1Vnodes != 2 then - goto show14 -endi -if $dnode4Vnodes != 2 then - goto show14 -endi -if $dnode5Vnodes != 2 then - goto show14 -endi -if $dnode6Vnodes != 2 then - goto show14 -endi - -sql reset query cache -sleep 1000 - -print ============================== step17 -print ========= check data - -sql reset query cache -sleep 100 - -sql use c_b1_d1 -sql select * from c_b1_d1.c_b1_t1 -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $rows != 5 then - return -1 -endi - -sql use c_b1_d2 -sql select * from c_b1_d2.c_b1_t2 -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $rows != 6 then - return -1 -endi - -sql use c_b1_d3 -sql select * from c_b1_d3.c_b1_t3 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $rows != 6 then - return -1 -endi -if $data01 != 36 then - return -1 -endi - -sql use c_b1_d4 -sql select * from c_b1_d4.c_b1_t4 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 - -sql use c_b1_d5 -sql select * from c_b1_d5.c_b1_t5 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 51 then - return -1 -endi -if $data11 != 52 then - return -1 -endi -if $data21 != 53 then - return -1 -endi -if $data31 != 54 then - return -1 -endi -if $data41 != 55 then - return -1 -endi - -sql use c_b1_d6 -sql select * from c_b1_d6.c_b1_t6 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 61 then - return -1 -endi -if $data11 != 62 then - return -1 -endi -if $data21 != 63 then - return -1 -endi -if $data31 != 64 then - return -1 -endi -if $data41 != 65 then - return -1 -endi - -sql use c_b1_d7 -sql select * from c_b1_d7.c_b1_t7 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 71 then - return -1 -endi -if $data11 != 72 then - return -1 -endi -if $data21 != 73 then - return -1 -endi -if $data31 != 74 then - return -1 -endi -if $data41 != 75 then - return -1 -endi - -sql use c_b1_d8 -sql select * from c_b1_d8.c_b1_t8 order by t desc -print $rows -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 81 then - return -1 -endi -if $data11 != 82 then - return -1 -endi -if $data21 != 83 then - return -1 -endi -if $data31 != 84 then - return -1 -endi -if $data41 != 85 then - return -1 -endi - -print ============================================ over= -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/cluster_balance2.sim b/tests/script/tsim/dnode/cluster_balance2.sim deleted file mode 100644 index 0b80acbe6c..0000000000 --- a/tests/script/tsim/dnode/cluster_balance2.sim +++ /dev/null @@ -1,479 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 -system sh/deploy.sh -n dnode6 -i 6 -system sh/deploy.sh -n dnode7 -i 7 -system sh/deploy.sh -n dnode8 -i 8 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode8 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 -system sh/cfg.sh -n dnode6 -c wallevel -v 1 -system sh/cfg.sh -n dnode7 -c wallevel -v 1 -system sh/cfg.sh -n dnode8 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode8 -c mnodeEqualVnodeNum -v 0 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode8 -c maxTablesPerVnode -v 4 - - -print ============== step1 -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != slave then - goto step1 -endi -if $data2_3 != slave then - goto step1 -endi - - -sql create database c_b2_d1 replica 2 -sql use c_b2_d1 -sql create table c_b2_t1 (t timestamp, i int) -sql insert into c_b2_t1 values(1520000020015, 15) -sql insert into c_b2_t1 values(1520000021014, 14) -sql insert into c_b2_t1 values(1520000022013, 13) -sql insert into c_b2_t1 values(1520000023012, 12) -sql insert into c_b2_t1 values(1520000024011, 11) - -sql create database c_b2_d2 replica 2 -sql use c_b2_d2 -sql create table c_b2_t2 (t timestamp, i int) -sql insert into c_b2_t2 values(1520000020025, 25) -sql insert into c_b2_t2 values(1520000021024, 24) -sql insert into c_b2_t2 values(1520000022023, 23) -sql insert into c_b2_t2 values(1520000023022, 22) -sql insert into c_b2_t2 values(1520000024021, 21) - -sql create database c_b2_d3 replica 2 -sql use c_b2_d3 -sql create table c_b2_t3 (t timestamp, i int) -sql insert into c_b2_t3 values(1520000020035, 35) -sql insert into c_b2_t3 values(1520000021034, 34) -sql insert into c_b2_t3 values(1520000022033, 33) -sql insert into c_b2_t3 values(1520000023032, 32) -sql insert into c_b2_t3 values(1520000024031, 31) - -$x = 0 -show1: - $x = $x + 1 - sleep 3000 - if $x == 20 then - return -1 - endi -sql show dnodes -x show1 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 2 then - goto show1 -endi -if $dnode2Vnodes != 2 then - goto show1 -endi -if $dnode3Vnodes != 2 then - goto show1 -endi - -print ============================== step2 -print ========= drop dnode2 -sql drop dnode $hostname2 - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi -sql show dnodes -x show2 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 3 then - goto show2 -endi -if $dnode2Vnodes != null then - goto show2 -endi -if $dnode3Vnodes != 3 then - goto show2 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode2 ==> $dnode2Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ============================== step3 -print ========= start dnode4 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi -sql show dnodes -x show3 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 2 then - goto show3 -endi -if $dnode4Vnodes != 2 then - goto show3 -endi -if $dnode3Vnodes != 2 then - goto show3 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode2 ==> $dnode2Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -if $dnode1Role != master then - return -1 -endi -if $dnode2Role != null then - return -1 -endi -if $dnode3Role != slave then - return -1 -endi - -if $dnode4Role != slave then - return -1 -endi - -print ============================== step4 -print ========= drop dnode3 -sql drop dnode $hostname3 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show4 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 3 then - goto show4 -endi -if $dnode4Vnodes != 3 then - goto show4 -endi -if $dnode3Vnodes != null then - goto show4 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 -$dnode4Role = $data2_4 -print dnode1 ==> $dnode1Role -print dnode2 ==> $dnode2Role -print dnode3 ==> $dnode3Role -print dnode4 ==> $dnode4Role - -if $dnode1Role != master then - return -1 -endi -if $dnode2Role != null then - return -1 -endi -if $dnode3Role != null then - return -1 -endi - -if $dnode4Role != slave then - return -1 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ============================== step5 -print ========= start dnode3 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi -sql show dnodes -x show5 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes - -if $dnode1Vnodes != 2 then - goto show5 -endi -if $dnode4Vnodes != 2 then - goto show5 -endi -if $dnode5Vnodes != 2 then - goto show5 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode4Role = $data2_4 -$dnode5Role = $data2_5 -print dnode1 ==> $dnode1Role -print dnode4 ==> $dnode4Role -print dnode5 ==> $dnode5Role - -print ============================== step6 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -print stop dnode1 and sleep 3000 -sleep 3000 - -sql show mnodes -$dnode1Role = $data2_1 -$dnode4Role = $data2_4 -$dnode5Role = $data2_5 -print dnode1 ==> $dnode1Role -print dnode4 ==> $dnode4Role -print dnode5 ==> $dnode5Role - -if $dnode1Role != offline then - return -1 -endi - -print ============================== step6.1 -system sh/exec.sh -n dnode1 -s start - -$x = 0 -step6.1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 - -if $data4_1 != ready then - goto step6.1 -endi - -sql drop dnode $hostname1 -print drop dnode1 and sleep 9000 -sleep 9000 - -$x = 0 -show6: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -x show6 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes - -if $dnode1Vnodes != null then - goto show6 -endi -if $dnode4Vnodes != 3 then - goto show6 -endi -if $dnode5Vnodes != 3 then - goto show6 -endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode4Role = $data2_4 -$dnode5Role = $data2_5 -print dnode1 ==> $dnode1Role -print dnode4 ==> $dnode4Role -print dnode5 ==> $dnode5Role - -#system sh/exec.sh -n dnode1 -s stop -x SIGINT - -print ============================== step12 -print ========= check data - -sql reset query cache -sleep 100 - -sql select * from c_b2_d1.c_b2_t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from c_b2_d2.c_b2_t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from c_b2_d3.c_b2_t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -print ============================================ over -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGKILL -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/tsim/dnode/cluster_balance3.sim b/tests/script/tsim/dnode/cluster_balance3.sim deleted file mode 100644 index c2e9a84514..0000000000 --- a/tests/script/tsim/dnode/cluster_balance3.sim +++ /dev/null @@ -1,643 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 -system sh/deploy.sh -n dnode6 -i 6 -system sh/deploy.sh -n dnode7 -i 7 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 -system sh/cfg.sh -n dnode6 -c wallevel -v 1 -system sh/cfg.sh -n dnode7 -c wallevel -v 1 - -print ============== step1 -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != slave then - goto step1 -endi -if $data2_3 != slave then - goto step1 -endi - -sql create database c_b3_d1 replica 3 -sql use c_b3_d1 -sql create table c_b3_t1 (t timestamp, i int) -sql insert into c_b3_t1 values(1520000020015, 15) -sql insert into c_b3_t1 values(1520000021014, 14) -sql insert into c_b3_t1 values(1520000022013, 13) -sql insert into c_b3_t1 values(1520000023012, 12) -sql insert into c_b3_t1 values(1520000024011, 11) - -sql create database c_b3_d2 replica 3 -sql use c_b3_d2 -sql create table c_b3_t2 (t timestamp, i int) -sql insert into c_b3_t2 values(1520000020025, 25) -sql insert into c_b3_t2 values(1520000021024, 24) -sql insert into c_b3_t2 values(1520000022023, 23) -sql insert into c_b3_t2 values(1520000023022, 22) -sql insert into c_b3_t2 values(1520000024021, 21) - -sql create database c_b3_d3 replica 3 -sql use c_b3_d3 -sql create table c_b3_t3 (t timestamp, i int) -sql insert into c_b3_t3 values(1520000020035, 35) -sql insert into c_b3_t3 values(1520000021034, 34) -sql insert into c_b3_t3 values(1520000022033, 33) -sql insert into c_b3_t3 values(1520000023032, 32) -sql insert into c_b3_t3 values(1520000024031, 31) - -$x = 0 -show1: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi -sql show dnodes -x show1 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 3 then - goto show1 -endi -if $dnode2Vnodes != 3 then - goto show1 -endi -if $dnode3Vnodes != 3 then - goto show1 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 - -print ============================== step2 -print ========= start dnode4 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show2 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode4Vnodes != 2 then - goto show2 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 - -print ============================== step3 -print ========= drop dnode2 -sql drop dnode $hostname2 - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show3 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode1Vnodes != 3 then - goto show3 -endi -if $dnode2Vnodes != null then - goto show3 -endi -if $dnode3Vnodes != 3 then - goto show3 -endi -if $dnode4Vnodes != 3 then - goto show3 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ============================== step4 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -x show4 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode5Vnodes != 2 then - goto show4 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 - -if $data2_4 != slave then - goto show4 -endi - -print ============================== step5 -print ========= drop dnode3 -sql drop dnode $hostname3 -sleep 9000 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show5 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes - -if $dnode1Vnodes != 3 then - goto show5 -endi -if $dnode5Vnodes != 3 then - goto show5 -endi -if $dnode3Vnodes != null then - goto show5 -endi -if $dnode4Vnodes != 3 then - goto show5 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -if $data2_5 != slave then - goto show5 -endi - -print ============================== step6 -sql create dnode $hostname6 -system sh/exec.sh -n dnode6 -s start - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show6 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes - -if $dnode1Vnodes != 2 then - goto show6 -endi -if $dnode4Vnodes != 2 then - goto show6 -endi -if $dnode5Vnodes != 3 then - goto show6 -endi -if $dnode6Vnodes != 2 then - goto show6 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -print ============================== step7 -print ========= drop dnode4 -sql drop dnode $hostname4 - -$x = 0 -show7: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show7 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes - -if $dnode1Vnodes != 3 then - goto show7 -endi -if $dnode5Vnodes != 3 then - goto show7 -endi -if $dnode6Vnodes != 3 then - goto show7 -endi -if $dnode4Vnodes != null then - goto show7 -endi - -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -if $data2_6 != slave then - goto show7 -endi - -print ============================== step8 -sql create dnode $hostname7 -system sh/exec.sh -n dnode7 -s start - -$x = 0 -show8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show8 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes -$dnode7Vnodes = $data2_7 -print dnode7 $dnode7Vnodes - -if $dnode1Vnodes != 2 then - goto show8 -endi -if $dnode5Vnodes != 2 then - goto show8 -endi -if $dnode6Vnodes != 3 then - goto show8 -endi -if $dnode7Vnodes != 2 then - goto show8 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -print ============================== step9 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$x = 0 -show9: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show mnodes -x show9 - -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -if $data2_1 != offline then - goto show9 -endi -if $data2_5 != master then - goto show9 -endi -if $data2_6 != slave then - goto show9 -endi - -print ============================== step10 -sql drop dnode $hostname1 -$x = 0 -show10: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show mnodes -x show10 - -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -if $data2_1 != null then - goto show10 -endi -if $data2_5 != master then - goto show10 -endi -if $data2_6 != slave then - goto show10 -endi -if $data2_7 != slave then - goto show10 -endi - -print ============================== step11 -system sh/exec.sh -n dnode1 -s start - -$x = 0 -show11: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -x show11 -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes -$dnode7Vnodes = $data2_7 -print dnode7 $dnode7Vnodes - -if $dnode5Vnodes != 3 then - goto show11 -endi -if $dnode6Vnodes != 3 then - goto show11 -endi -if $dnode7Vnodes != 3 then - goto show11 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -print dnode4 ==> $data2_4 -print dnode5 ==> $data2_5 -print dnode6 ==> $data2_6 -print dnode7 ==> $data2_7 - -print ============================== step12 -sql create database c_b3_d4 replica 3 -sql use c_b3_d4 -$x = 0 -create4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table c_b3_t4 (t timestamp, i int) -x create4 -sql insert into c_b3_t4 values(1520000020045, 45) -sql insert into c_b3_t4 values(1520000021044, 44) -sql insert into c_b3_t4 values(1520000022043, 43) -sql insert into c_b3_t4 values(1520000023042, 42) -sql insert into c_b3_t4 values(1520000024041, 41) - -$x = 0 -show12: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show dnodes -x show12 -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes -$dnode7Vnodes = $data2_7 -print dnode7 $dnode7Vnodes - -if $dnode5Vnodes != 4 then - goto show12 -endi -if $dnode6Vnodes != 4 then - goto show12 -endi -if $dnode7Vnodes != 4 then - goto show12 -endi - -print ============================== step13 -sql reset query cache -sleep 200 - -print ========= check data - -sql select * from c_b3_d1.c_b3_t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from c_b3_d2.c_b3_t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from c_b3_d3.c_b3_t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -print ============================================ over -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT diff --git a/tests/script/tsim/dnode/cluster_cache.sim b/tests/script/tsim/dnode/cluster_cache.sim deleted file mode 100644 index 740eddfb0d..0000000000 --- a/tests/script/tsim/dnode/cluster_cache.sim +++ /dev/null @@ -1,65 +0,0 @@ -system sh/stop_dnodes.sh - - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 2 -system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2 -system sh/cfg.sh -n dnode1 -c monitor -v 1 -system sh/cfg.sh -n dnode1 -c monitor -v 2 -system sh/cfg.sh -n dnode2 -c http -v 1 -system sh/cfg.sh -n dnode1 -c enableHttp -v 1 -system sh/cfg.sh -n dnode2 -c monitor -v 1 -system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 -system sh/cfg.sh -n dnode2 -c monitorInterval -v 1 - -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -sql create database testdb -sql use testdb -sql create table meter1 (ts timestamp, val int) - -$x = 0 -$v = -100 -while $x < 30 - $v = $v + 1 - $ms = $v . m - sql insert into meter1 values (now $ms , $x ) - $x = $x + 1 -endw - -sleep 2000 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname2 - - -sleep 10000 - -sql show log.tables; -if $rows > 6 then - return -1 -endi - -sql select * from log.dn1 -print ===>rows $rows -print $data00 $data01 $data02 -print $data10 $data11 $data12 -print $data20 $data21 $data22 -if $rows < 10 then - return -1 -endi - -#sql create table sys.st as select avg(taosd), avg(system) from sys.cpu interval(30s) - -sql show log.vgroups -if $data05 != master then - return -1 -endi -if $data15 != master then - return -1 -endi diff --git a/tests/script/tsim/dnode/cluster_flowctrl.sim b/tests/script/tsim/dnode/cluster_flowctrl.sim deleted file mode 100644 index 700fa0a3f1..0000000000 --- a/tests/script/tsim/dnode/cluster_flowctrl.sim +++ /dev/null @@ -1,131 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c http -v 0 -system sh/cfg.sh -n dnode2 -c http -v 0 -system sh/cfg.sh -n dnode3 -c http -v 0 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20000 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 20000 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 20000 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 20 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 20 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 20 - -system sh/cfg.sh -n dnode1 -c replica -v 3 -system sh/cfg.sh -n dnode2 -c replica -v 3 -system sh/cfg.sh -n dnode3 -c replica -v 3 - -print ============== deploy - -system sh/exec.sh -n dnode1 -s start -sleep 5001 -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print =============== step1 -$x = 0 -show1: - $x = $x + 1 - sleep 2000 - if $x == 5 then - return -1 - endi -sql show mnodes -x show1 -$mnode1Role = $data2_1 -print mnode1Role $mnode1Role -$mnode2Role = $data2_2 -print mnode2Role $mnode2Role -$mnode3Role = $data2_3 -print mnode3Role $mnode3Role - -if $mnode1Role != master then - goto show1 -endi -if $mnode2Role != slave then - goto show1 -endi -if $mnode3Role != slave then - goto show1 -endi - -print =============== step2 - -sql create database db replica 3 -sql use db -sql create table tb (ts timestamp, test int) - -$x = 0 -while $x < 100 - $ms = $x . s - sql insert into tb values (now + $ms , $x ) - $x = $x + 1 -endw - -print =============== step3 -sleep 2000 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print =============== step4 -sleep 3000 -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print =============== step5 -sleep 8000 -while $x < 200 - $ms = $x . s - sql insert into tb values (now + $ms , $x ) - $x = $x + 1 -endw - -print =============== step6 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 2000 -while $x < 300 - $ms = $x . s - sql insert into tb values (now + $ms , $x ) - $x = $x + 1 -endw - -system sh/exec.sh -n dnode2 -s start - -sleep 6000 -print =============== step7 -while $x < 400 - $ms = $x . s - sql insert into tb values (now + $ms , $x ) - $x = $x + 1 - sleep 1 -endw - -print =============== step8 -sql select * from tb -print rows $rows -if $rows != 400 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/cluster_vgroup100.sim b/tests/script/tsim/dnode/cluster_vgroup100.sim deleted file mode 100644 index 656ed2ec44..0000000000 --- a/tests/script/tsim/dnode/cluster_vgroup100.sim +++ /dev/null @@ -1,146 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c maxTables -v 4 -system sh/cfg.sh -n dnode2 -c maxTables -v 4 -system sh/cfg.sh -n dnode3 -c maxTables -v 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0 - -print ============================== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -print ============================== step2 -print ========= start dnode2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$maxNum = 102 -$maxNum = 12 - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show mnodes -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 - -print $dnode1Role -print $dnode2Role -print $dnode3Role - -if $dnode1Role != master then - goto show2 -endi -if $dnode2Role != slave then - goto show2 -endi -if $dnode3Role != slave then - goto show2 -endi - -print ============================== step3 -$count = 2 -while $count < $maxNum - $db = d . $count - $tb = $db . .t - $tb2 = $db . .t2 - sql create database $db replica 3 cache 1 blocks 3 - sql create table $tb (ts timestamp, i int) - sql insert into $tb values(now, 1) - sql create table $tb2 as select count(*) from $tb interval(10s) - $count = $count + 1 - print insert into $tb values(now, 1) ==> finished -endw - -print ============================== step4 - -$count = 2 -while $count < $maxNum - $db = d . $count - $tb = $db . .t - sql select * from $tb - if $rows != 1 then - print select * from $tb - return -1 - endi - $count = $count + 1 - print select * from $tb ==> rows: $rows -endw - -print ============================== step5 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ============================== step6 -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print ============================== step7 - -$x = 0 -show7: - $x = $x + 1 - sleep 2000 - if $x == 50 then - return -1 - endi - -sql show mnodes -x show7 -$dnode1Role = $data2_1 -$dnode2Role = $data2_2 -$dnode3Role = $data2_3 -if $dnode1Role != master then - goto show7 -endi -if $dnode2Role != slave then - goto show7 -endi -if $dnode2Role != slave then - goto show7 -endi - -print ============================== step8 -$x = 0 -show8: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi - -$count = 2 -while $count < $maxNum - $db = d . $count - $tb = $db . .t - sql select * from $tb - if $rows != 1 then - print select * from $tb - goto show8 - endi - $count = $count + 1 - print select * from $tb ==> rows: $rows -endw - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file From 501254219baacab51abf7929238168c8a97141d8 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Jul 2022 10:27:50 +0800 Subject: [PATCH 51/68] test:add test case for tmq --- tests/system-test/7-tmq/tmqCommon.py | 6 +- tests/system-test/7-tmq/tmqConsFromTsdb.py | 107 +++++++++++++++++++++ 2 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 tests/system-test/7-tmq/tmqConsFromTsdb.py diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 04adb93b8a..f8488aee49 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -93,7 +93,7 @@ class TMQCom: return resultList - def startTmqSimProcess(self,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0,alias=0): + def startTmqSimProcess(self,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0,alias=0,snapshot=0): buildPath = tdCom.getBuildPath() cfgPath = tdCom.getClientCfgPath() if valgrind == 1: @@ -109,7 +109,7 @@ class TMQCom: os.system(shellCmd) processorName = processorNameNew shellCmd = 'mintty -h never ' + processorName + ' -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s -e %d "%(pollDelay, dbName, showMsg, showRow, cdbName, snapshot) shellCmd += "> nul 2>&1 &" else: processorName = buildPath + '/build/bin/tmq_sim' @@ -119,7 +119,7 @@ class TMQCom: os.system(shellCmd) processorName = processorNameNew shellCmd = 'nohup ' + processorName + ' -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s -e %d "%(pollDelay, dbName, showMsg, showRow, cdbName, snapshot) shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) os.system(shellCmd) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb.py b/tests/system-test/7-tmq/tmqConsFromTsdb.py new file mode 100644 index 0000000000..8629ab3031 --- /dev/null +++ b/tests/system-test/7-tmq/tmqConsFromTsdb.py @@ -0,0 +1,107 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db1', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ctb") + tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + tdLog.info("insert data") + tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdDnodes.stop(1) + time.sleep(2) + tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + # sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("0 tmq consume rows error!") + + tmqCom.checkFileContent(consumerId, queryString) + + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def run(self): + tdSql.prepare() + self.tmqCase1() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From ba265d51b8d5d59267bdfe41157846248224544f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Jul 2022 10:29:37 +0800 Subject: [PATCH 52/68] fix: fix stream crash issue --- source/common/src/tdatablock.c | 2 +- source/libs/scalar/src/scalar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 7b142e3053..2918e44e7b 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1218,7 +1218,7 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pDst = taosArrayGet(dst->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(src->pDataBlock, i); - if (pSrc->pData == NULL) { + if (pSrc->pData == NULL && (!IS_VAR_DATA_TYPE(pSrc->info.type))) { continue; } diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cef8ff7075..8e532df3b0 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -287,7 +287,7 @@ int32_t sclInitParamList(SScalarParam **pParams, SNodeList* pParamList, SScalarC int32_t code = 0; if (NULL == pParamList) { if (ctx->pBlockList) { - SSDataBlock *pBlock = taosArrayGet(ctx->pBlockList, 0); + SSDataBlock *pBlock = taosArrayGetP(ctx->pBlockList, 0); *rowNum = pBlock->info.rows; } else { *rowNum = 1; From 1b3fde4a60b0b74b3cce481e48f6e66ec132f5fa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 10:52:59 +0800 Subject: [PATCH 53/68] refactor: stable mgmt --- include/common/tmsg.h | 5 +- source/common/src/tmsg.c | 58 +++++++------- source/dnode/mnode/impl/inc/mndDef.h | 3 +- source/dnode/mnode/impl/src/mndStb.c | 103 +++++++++++++++---------- source/libs/parser/src/parTranslater.c | 11 +-- 5 files changed, 100 insertions(+), 80 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5326a959e6..454b940862 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -436,15 +436,16 @@ typedef struct { int32_t ttl; int32_t numOfColumns; int32_t numOfTags; + int32_t numOfFuncs; int32_t commentLen; int32_t ast1Len; int32_t ast2Len; SArray* pColumns; // array of SField SArray* pTags; // array of SField - char* comment; + SArray* pFuncs; + char* pComment; char* pAst1; char* pAst2; - SArray* pFuncs; } SMCreateStbReq; int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3f6091ff7b..46d2e78a71 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -503,6 +503,7 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfColumns) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1; + if (tEncodeI32(&encoder, pReq->numOfFuncs) < 0) return -1; if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1; if (tEncodeI32(&encoder, pReq->ast1Len) < 0) return -1; if (tEncodeI32(&encoder, pReq->ast2Len) < 0) return -1; @@ -510,21 +511,26 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq for (int32_t i = 0; i < pReq->numOfColumns; ++i) { SField *pField = taosArrayGet(pReq->pColumns, i); if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeI8(&encoder, pField->flags) < 0) return -1; } for (int32_t i = 0; i < pReq->numOfTags; ++i) { SField *pField = taosArrayGet(pReq->pTags, i); if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeI8(&encoder, pField->flags) < 0) return -1; + } + + for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { + const char *pFunc = taosArrayGet(pReq->pFuncs, i); + if (tEncodeCStr(&encoder, pFunc) < 0) return -1; } if (pReq->commentLen > 0) { - if (tEncodeCStr(&encoder, pReq->comment) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->pComment) < 0) return -1; } if (pReq->ast1Len > 0) { if (tEncodeBinary(&encoder, pReq->pAst1, pReq->ast1Len) < 0) return -1; @@ -533,13 +539,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeBinary(&encoder, pReq->pAst2, pReq->ast2Len) < 0) return -1; } - int32_t numOfFuncs = taosArrayGetSize(pReq->pFuncs); - if (tEncodeI32(&encoder, numOfFuncs) < 0) return -1; - for (int32_t i = 0; i < numOfFuncs; ++i) { - const char *pFunc = taosArrayGet(pReq->pFuncs, i); - if (tEncodeCStr(&encoder, pFunc) < 0) return -1; - } - tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -561,13 +560,15 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfColumns) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numOfFuncs) < 0) return -1; if (tDecodeI32(&decoder, &pReq->commentLen) < 0) return -1; if (tDecodeI32(&decoder, &pReq->ast1Len) < 0) return -1; if (tDecodeI32(&decoder, &pReq->ast2Len) < 0) return -1; pReq->pColumns = taosArrayInit(pReq->numOfColumns, sizeof(SField)); pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField)); - if (pReq->pColumns == NULL || pReq->pTags == NULL) { + pReq->pFuncs = taosArrayInit(pReq->numOfFuncs, TSDB_FUNC_NAME_LEN); + if (pReq->pColumns == NULL || pReq->pTags == NULL || pReq->pFuncs == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } @@ -596,10 +597,19 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR } } + for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { + char pFunc[TSDB_FUNC_NAME_LEN] = {0}; + if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1; + if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + if (pReq->commentLen > 0) { - pReq->comment = taosMemoryMalloc(pReq->commentLen + 1); - if (pReq->comment == NULL) return -1; - if (tDecodeCStrTo(&decoder, pReq->comment) < 0) return -1; + pReq->pComment = taosMemoryMalloc(pReq->commentLen + 1); + if (pReq->pComment == NULL) return -1; + if (tDecodeCStrTo(&decoder, pReq->pComment) < 0) return -1; } if (pReq->ast1Len > 0) { @@ -614,23 +624,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeCStrTo(&decoder, pReq->pAst2) < 0) return -1; } - int32_t numOfFuncs = 0; - if (tDecodeI32(&decoder, &numOfFuncs) < 0) return -1; - if (numOfFuncs > 0) { - pReq->pFuncs = taosArrayInit(numOfFuncs, TSDB_FUNC_NAME_LEN); - if (NULL == pReq->pFuncs) return -1; - } - for (int32_t i = 0; i < numOfFuncs; ++i) { - char pFunc[TSDB_FUNC_NAME_LEN] = {0}; - if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1; - if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - } - tEndDecode(&decoder); - tDecoderClear(&decoder); return 0; } @@ -638,10 +632,10 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR void tFreeSMCreateStbReq(SMCreateStbReq *pReq) { taosArrayDestroy(pReq->pColumns); taosArrayDestroy(pReq->pTags); - taosMemoryFreeClear(pReq->comment); + taosArrayDestroy(pReq->pFuncs); + taosMemoryFreeClear(pReq->pComment); taosMemoryFreeClear(pReq->pAst1); taosMemoryFreeClear(pReq->pAst2); - taosArrayDestroy(pReq->pFuncs); } int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) { diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 0605e3a69e..1fb7fa85b1 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -341,11 +341,12 @@ typedef struct { int32_t colVer; int32_t smaVer; int32_t nextColId; - int64_t watermark[2]; int64_t maxdelay[2]; + int64_t watermark[2]; int32_t ttl; int32_t numOfColumns; int32_t numOfTags; + int32_t numOfFuncs; int32_t commentLen; int32_t ast1Len; int32_t ast2Len; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index dd01a0fa16..5216e40039 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -78,7 +78,7 @@ void mndCleanupStb(SMnode *pMnode) {} SSdbRaw *mndStbActionEncode(SStbObj *pStb) { terrno = TSDB_CODE_OUT_OF_MEMORY; - int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + +pStb->commentLen + + int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + pStb->commentLen + pStb->ast1Len + pStb->ast2Len + STB_RESERVE_SIZE + taosArrayGetSize(pStb->pFuncs) * TSDB_FUNC_NAME_LEN; SSdbRaw *pRaw = sdbAllocRaw(SDB_STB, STB_VER_NUMBER, size); if (pRaw == NULL) goto _OVER; @@ -92,6 +92,7 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) { SDB_SET_INT64(pRaw, dataPos, pStb->dbUid, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->tagVer, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->colVer, _OVER) + SDB_SET_INT32(pRaw, dataPos, pStb->smaVer, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->nextColId, _OVER) SDB_SET_INT64(pRaw, dataPos, pStb->maxdelay[0], _OVER) SDB_SET_INT64(pRaw, dataPos, pStb->maxdelay[1], _OVER) @@ -100,17 +101,11 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) { SDB_SET_INT32(pRaw, dataPos, pStb->ttl, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->numOfColumns, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->numOfTags, _OVER) + SDB_SET_INT32(pRaw, dataPos, pStb->numOfFuncs, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->commentLen, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->ast1Len, _OVER) SDB_SET_INT32(pRaw, dataPos, pStb->ast2Len, _OVER) - int32_t funcNum = taosArrayGetSize(pStb->pFuncs); - SDB_SET_INT32(pRaw, dataPos, funcNum, _OVER) - for (int32_t i = 0; i < funcNum; ++i) { - char *func = taosArrayGet(pStb->pFuncs, i); - SDB_SET_BINARY(pRaw, dataPos, func, TSDB_FUNC_NAME_LEN, _OVER) - } - for (int32_t i = 0; i < pStb->numOfColumns; ++i) { SSchema *pSchema = &pStb->pColumns[i]; SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER) @@ -129,15 +124,23 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) { SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER) } + for (int32_t i = 0; i < pStb->numOfFuncs; ++i) { + char *func = taosArrayGet(pStb->pFuncs, i); + SDB_SET_BINARY(pRaw, dataPos, func, TSDB_FUNC_NAME_LEN, _OVER) + } + if (pStb->commentLen > 0) { SDB_SET_BINARY(pRaw, dataPos, pStb->comment, pStb->commentLen + 1, _OVER) } + if (pStb->ast1Len > 0) { SDB_SET_BINARY(pRaw, dataPos, pStb->pAst1, pStb->ast1Len, _OVER) } + if (pStb->ast2Len > 0) { SDB_SET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER) } + SDB_SET_RESERVE(pRaw, dataPos, STB_RESERVE_SIZE, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER) @@ -180,6 +183,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT64(pRaw, dataPos, &pStb->dbUid, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->tagVer, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->colVer, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pStb->smaVer, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->nextColId, _OVER) SDB_GET_INT64(pRaw, dataPos, &pStb->maxdelay[0], _OVER) SDB_GET_INT64(pRaw, dataPos, &pStb->maxdelay[1], _OVER) @@ -188,27 +192,15 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT32(pRaw, dataPos, &pStb->ttl, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->numOfColumns, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->numOfTags, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pStb->numOfFuncs, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->commentLen, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->ast1Len, _OVER) SDB_GET_INT32(pRaw, dataPos, &pStb->ast2Len, _OVER) - int32_t funcNum = 0; - SDB_GET_INT32(pRaw, dataPos, &funcNum, _OVER) - if (funcNum > 0) { - pStb->pFuncs = taosArrayInit(funcNum, TSDB_FUNC_NAME_LEN); - if (NULL == pStb->pFuncs) { - goto _OVER; - } - char funcName[TSDB_FUNC_NAME_LEN]; - for (int32_t i = 0; i < funcNum; ++i) { - SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER) - taosArrayPush(pStb->pFuncs, funcName); - } - } - pStb->pColumns = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchema)); pStb->pTags = taosMemoryCalloc(pStb->numOfTags, sizeof(SSchema)); - if (pStb->pColumns == NULL || pStb->pTags == NULL) { + pStb->pFuncs = taosMemoryCalloc(pStb->numOfFuncs, TSDB_FUNC_NAME_LEN); + if (pStb->pColumns == NULL || pStb->pTags == NULL || pStb->pFuncs == NULL) { goto _OVER; } @@ -230,16 +222,24 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER) } + for (int32_t i = 0; i < pStb->numOfFuncs; ++i) { + char funcName[TSDB_FUNC_NAME_LEN] = {0}; + SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER) + taosArrayPush(pStb->pFuncs, funcName); + } + if (pStb->commentLen > 0) { pStb->comment = taosMemoryCalloc(pStb->commentLen + 1, 1); if (pStb->comment == NULL) goto _OVER; SDB_GET_BINARY(pRaw, dataPos, pStb->comment, pStb->commentLen + 1, _OVER) } + if (pStb->ast1Len > 0) { pStb->pAst1 = taosMemoryCalloc(pStb->ast1Len, 1); if (pStb->pAst1 == NULL) goto _OVER; SDB_GET_BINARY(pRaw, dataPos, pStb->pAst1, pStb->ast1Len, _OVER) } + if (pStb->ast2Len > 0) { pStb->pAst2 = taosMemoryCalloc(pStb->ast2Len, 1); if (pStb->pAst2 == NULL) goto _OVER; @@ -273,6 +273,7 @@ static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb) { taosMemoryFreeClear(pStb->pColumns); taosMemoryFreeClear(pStb->pTags); taosMemoryFreeClear(pStb->comment); + taosMemoryFreeClear(pStb->pFuncs); taosMemoryFreeClear(pStb->pAst1); taosMemoryFreeClear(pStb->pAst2); taosArrayDestroy(pStb->pFuncs); @@ -319,10 +320,9 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) { taosWUnLockLatch(&pOld->lock); } } - pOld->commentLen = pNew->commentLen; if (pOld->ast1Len < pNew->ast1Len) { - void *pAst1 = taosMemoryMalloc(pNew->ast1Len); + void *pAst1 = taosMemoryMalloc(pNew->ast1Len + 1); if (pAst1 != NULL) { taosMemoryFree(pOld->pAst1); pOld->pAst1 = pAst1; @@ -334,7 +334,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) { } if (pOld->ast2Len < pNew->ast2Len) { - void *pAst2 = taosMemoryMalloc(pNew->ast2Len); + void *pAst2 = taosMemoryMalloc(pNew->ast2Len + 1); if (pAst2 != NULL) { taosMemoryFree(pOld->pAst2); pOld->pAst2 = pAst2; @@ -361,12 +361,15 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) { } if (pNew->commentLen > 0) { memcpy(pOld->comment, pNew->comment, pNew->commentLen + 1); + pOld->commentLen = pNew->commentLen; } if (pNew->ast1Len != 0) { memcpy(pOld->pAst1, pNew->pAst1, pNew->ast1Len); + pOld->ast1Len = pNew->ast1Len; } if (pNew->ast2Len != 0) { memcpy(pOld->pAst2, pNew->pAst2, pNew->ast2Len); + pOld->ast2Len = pNew->ast2Len; } taosWUnLockLatch(&pOld->lock); return 0; @@ -575,7 +578,10 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) { static int32_t mndSetCreateStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdbRaw *pRedoRaw = mndStbActionEncode(pStb); if (pRedoRaw == NULL) return -1; - if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1; + if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) { + sdbFreeRaw(pRedoRaw); + return -1; + } if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING) != 0) return -1; return 0; @@ -584,7 +590,10 @@ static int32_t mndSetCreateStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p static int32_t mndSetCreateStbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdbRaw *pUndoRaw = mndStbActionEncode(pStb); if (pUndoRaw == NULL) return -1; - if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) return -1; + if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) { + sdbFreeRaw(pUndoRaw); + return -1; + } if (sdbSetRawStatus(pUndoRaw, SDB_STATUS_DROPPED) != 0) return -1; return 0; @@ -593,7 +602,10 @@ static int32_t mndSetCreateStbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p static int32_t mndSetCreateStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdbRaw *pCommitRaw = mndStbActionEncode(pStb); if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; + if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + sdbFreeRaw(pCommitRaw); + return -1; + } if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) return -1; return 0; @@ -697,6 +709,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pDst->dbUid = pDb->uid; pDst->tagVer = 1; pDst->colVer = 1; + pDst->smaVer = 1; pDst->nextColId = 1; pDst->maxdelay[0] = pCreate->delay1; pDst->maxdelay[1] = pCreate->delay2; @@ -705,6 +718,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pDst->ttl = pCreate->ttl; pDst->numOfColumns = pCreate->numOfColumns; pDst->numOfTags = pCreate->numOfTags; + pDst->numOfFuncs = pCreate->numOfFuncs; pDst->commentLen = pCreate->commentLen; pDst->pFuncs = pCreate->pFuncs; pCreate->pFuncs = NULL; @@ -715,7 +729,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } - memcpy(pDst->comment, pCreate->comment, pDst->commentLen + 1); + memcpy(pDst->comment, pCreate->pComment, pDst->commentLen + 1); } pDst->ast1Len = pCreate->ast1Len; @@ -770,20 +784,15 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCreate, SDbObj *pDb) { SStbObj stbObj = {0}; - int32_t code = -1; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); - if (mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb) != 0) goto _OVER; - if (mndAddStbToTrans(pMnode, pTrans, pDb, &stbObj) < 0) goto _OVER; - if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; - code = 0; _OVER: @@ -906,7 +915,8 @@ _OVER: } static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) { - if (pAlter->commentLen >= 0 || pAlter->ttl != 0) return 0; + if (pAlter->commentLen >= 0) return 0; + if (pAlter->ttl != 0) return 0; if (pAlter->numOfFields < 1 || pAlter->numOfFields != (int32_t)taosArrayGetSize(pAlter->pFields)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; @@ -969,6 +979,7 @@ static int32_t mndUpdateStbCommentAndTTL(const SStbObj *pOld, SStbObj *pNew, cha memcpy(pNew->comment, pComment, commentLen + 1); } else if (commentLen == 0) { pNew->commentLen = 0; + } else { } if (ttl >= 0) { @@ -1245,7 +1256,10 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO static int32_t mndSetAlterStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdbRaw *pRedoRaw = mndStbActionEncode(pStb); if (pRedoRaw == NULL) return -1; - if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1; + if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) { + sdbFreeRaw(pRedoRaw); + return -1; + } if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY) != 0) return -1; return 0; @@ -1254,7 +1268,10 @@ static int32_t mndSetAlterStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD static int32_t mndSetAlterStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdbRaw *pCommitRaw = mndStbActionEncode(pStb); if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; + if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + sdbFreeRaw(pCommitRaw); + return -1; + } if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) return -1; return 0; @@ -1626,7 +1643,10 @@ _OVER: static int32_t mndSetDropStbRedoLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pStb) { SSdbRaw *pRedoRaw = mndStbActionEncode(pStb); if (pRedoRaw == NULL) return -1; - if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1; + if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) { + sdbFreeRaw(pRedoRaw); + return -1; + } if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; return 0; @@ -1635,7 +1655,10 @@ static int32_t mndSetDropStbRedoLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pS static int32_t mndSetDropStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pStb) { SSdbRaw *pCommitRaw = mndStbActionEncode(pStb); if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; + if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + sdbFreeRaw(pCommitRaw); + return -1; + } if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1; return 0; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index be47278103..394554348c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -784,12 +784,12 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD return DEAL_RES_CONTINUE; } if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { - // TODO - //pVal->node.resType = targetDt; + // TODO + // pVal->node.resType = targetDt; pVal->translate = true; pVal->isNull = true; return DEAL_RES_CONTINUE; - } + } if (pVal->isDuration) { if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, precision) != TSDB_CODE_SUCCESS) { @@ -3621,8 +3621,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); if (pStmt->pOptions->commentNull == false) { - pReq->comment = strdup(pStmt->pOptions->comment); - if (NULL == pReq->comment) { + pReq->pComment = strdup(pStmt->pOptions->comment); + if (NULL == pReq->pComment) { return TSDB_CODE_OUT_OF_MEMORY; } pReq->commentLen = strlen(pStmt->pOptions->comment); @@ -3630,6 +3630,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->commentLen = -1; } buildRollupFuncs(pStmt->pOptions->pRollupFuncs, &pReq->pFuncs); + pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs); SName tableName; tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name); From 35017bdfcc6b15c1ea6b79419ec9712d0896b9d7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 11:16:20 +0800 Subject: [PATCH 54/68] refactor: stable mgmt --- source/common/src/tmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 46d2e78a71..aaf1e5414c 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -576,9 +576,9 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR for (int32_t i = 0; i < pReq->numOfColumns; ++i) { SField field = {0}; if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (taosArrayPush(pReq->pColumns, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; @@ -588,9 +588,9 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR for (int32_t i = 0; i < pReq->numOfTags; ++i) { SField field = {0}; if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (taosArrayPush(pReq->pTags, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; From 4e8f3db5964095998813bd9c04a5c59af707432c Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 1 Jul 2022 11:54:21 +0800 Subject: [PATCH 55/68] os: replace win qsort func --- include/os/osMath.h | 7 ++++ source/common/src/tdatablock.c | 2 +- source/common/src/tdataformat.c | 4 +-- source/libs/executor/src/executil.c | 2 +- source/libs/function/src/taggfunction.c | 4 +-- source/libs/function/src/tpercentile.c | 2 +- source/libs/parser/src/parInsert.c | 8 ++--- source/libs/parser/src/parInsertData.c | 4 +-- source/libs/scalar/src/filter.c | 4 +-- source/os/src/osMath.c | 47 +++++++++++++++++++++++++ source/util/src/tarray.c | 4 +-- source/util/src/tdigest.c | 2 +- source/util/src/terror.c | 2 +- 13 files changed, 73 insertions(+), 19 deletions(-) create mode 100644 source/os/src/osMath.c diff --git a/include/os/osMath.h b/include/os/osMath.h index e13c32422e..b0c75f4dd7 100644 --- a/include/os/osMath.h +++ b/include/os/osMath.h @@ -60,6 +60,13 @@ extern "C" { }) #endif +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T +typedef int32_t (*__compar_fn_t)(const void *, const void *); +#endif + +void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar); + #ifdef __cplusplus } #endif diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 7b142e3053..0ec63e90af 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -892,7 +892,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { int64_t p0 = taosGetTimestampUs(); __compar_fn_t fn = getKeyComparFunc(pColInfoData->info.type, pOrder->order); - qsort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); + taosSort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); int64_t p1 = taosGetTimestampUs(); uDebug("blockDataSort easy cost:%" PRId64 ", rows:%d\n", p1 - p0, pDataBlock->info.rows); diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7c1b31b6e4..83ae442ae7 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -931,9 +931,9 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { // sort if (isJson) { - qsort(pArray->pData, nTag, sizeof(STagVal), tTagValJsonCmprFn); + taosSort(pArray->pData, nTag, sizeof(STagVal), tTagValJsonCmprFn); } else { - qsort(pArray->pData, nTag, sizeof(STagVal), tTagValCmprFn); + taosSort(pArray->pData, nTag, sizeof(STagVal), tTagValCmprFn); } // get size diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 2561516f6a..415df595e9 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -118,7 +118,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) { __compar_fn_t fn = (order == TSDB_ORDER_ASC) ? resultrowComparAsc : resultrowComparDesc; - qsort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn); + taosSort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn); } pGroupResInfo->index = 0; diff --git a/source/libs/function/src/taggfunction.c b/source/libs/function/src/taggfunction.c index 47ae07f823..c8998b9d94 100644 --- a/source/libs/function/src/taggfunction.c +++ b/source/libs/function/src/taggfunction.c @@ -1887,10 +1887,10 @@ static void top_bottom_func_finalizer(SqlFunctionCtx *pCtx) { // user specify the order of output by sort the result according to timestamp if (pCtx->param[1].param.i == PRIMARYKEY_TIMESTAMP_COL_ID) { __compar_fn_t comparator = (pCtx->param[2].param.i == TSDB_ORDER_ASC) ? resAscComparFn : resDescComparFn; - qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); + taosSort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } else /*if (pCtx->param[1].param.i > PRIMARYKEY_TIMESTAMP_COL_ID)*/ { __compar_fn_t comparator = (pCtx->param[2].param.i == TSDB_ORDER_ASC) ? resDataAscComparFn : resDataDescComparFn; - qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); + taosSort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } GET_TRUE_DATA_TYPE(); diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index b40dd8b78d..057d2bc7dc 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -44,7 +44,7 @@ static SFilePage *loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx) offset += (int32_t)(pg->num * pMemBucket->bytes); } - qsort(buffer->data, pMemBucket->pSlots[slotIdx].info.size, pMemBucket->bytes, pMemBucket->comparFn); + taosSort(buffer->data, pMemBucket->pSlots[slotIdx].info.size, pMemBucket->bytes, pMemBucket->comparFn); return buffer; } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index b97f1df38b..a76640d0b5 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -790,11 +790,11 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* pColIdx[i].schemaColIdx = pColList->boundColumns[i]; pColIdx[i].boundIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); for (col_id_t i = 0; i < pColList->numOfBound; ++i) { pColIdx[i].finalIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); } if (pColList->numOfCols > pColList->numOfBound) { @@ -2232,11 +2232,11 @@ static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SS pColIdx[i].schemaColIdx = pColList->boundColumns[i]; pColIdx[i].boundIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); for (col_id_t i = 0; i < pColList->numOfBound; ++i) { pColIdx[i].finalIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); } if (pColList->numOfCols > pColList->numOfBound) { diff --git a/source/libs/parser/src/parInsertData.c b/source/libs/parser/src/parInsertData.c index 56301c072c..84bcef7185 100644 --- a/source/libs/parser/src/parInsertData.c +++ b/source/libs/parser/src/parInsertData.c @@ -295,7 +295,7 @@ void sortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf) { char* pBlockData = pBlocks->data; // todo. qsort is unstable, if timestamp is same, should get the last one - qsort(pBlockData, pBlocks->numOfRows, dataBuf->rowSize, rowDataCompar); + taosSort(pBlockData, pBlocks->numOfRows, dataBuf->rowSize, rowDataCompar); int32_t i = 0; int32_t j = 1; @@ -365,7 +365,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; // todo. qsort is unstable, if timestamp is same, should get the last one - qsort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); + taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; int32_t i = 0; diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index b8bcae161b..9897acfe1a 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -2059,7 +2059,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t } if (colIdxi > 1) { - qsort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); + taosSort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); } for (uint32_t l = 0; l < colIdxi; ++l) { @@ -2294,7 +2294,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR return TSDB_CODE_SUCCESS; } - qsort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); + taosSort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); int32_t pEnd = 0, cStart = 0, cEnd = 0; uint32_t pColNum = 0, cColNum = 0; diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c new file mode 100644 index 0000000000..98cd63a831 --- /dev/null +++ b/source/os/src/osMath.c @@ -0,0 +1,47 @@ +/* + * 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 . + */ + +#define ALLOW_FORBID_FUNC +#define _DEFAULT_SOURCE +#include "os.h" + +#ifdef WINDOWS +void swapStr(char* j, char* J, int width) { + int i; + char tmp; + for (i = 0; i < width; i++) { + tmp = *j; + *j = *J; + *J = tmp; + j++; + J++; + } +} +#endif + +void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar) { +#ifdef WINDOWS + int64_t i, j; + for (i = 0; i < sz - 1; i++) { + for (j = 0; j < sz - 1 - i; j++) { + if (compar((char*)arr + j * width, (char*)arr + (j + 1) * width) > 0.00) { + swapStr((char*)arr + j * width, (char*)arr + (j + 1) * width, width); + } + } + } +#else + qsort(arr, sz, width, compar); +#endif +} diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index ec90e5a9b9..23e79da948 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -373,7 +373,7 @@ void taosArraySort(SArray* pArray, __compar_fn_t compar) { assert(pArray != NULL); assert(compar != NULL); - qsort(pArray->pData, pArray->size, pArray->elemSize, compar); + taosSort(pArray->pData, pArray->size, pArray->elemSize, compar); } void* taosArraySearch(const SArray* pArray, const void* key, __compar_fn_t comparFn, int32_t flags) { @@ -390,7 +390,7 @@ int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t void taosArraySortString(SArray* pArray, __compar_fn_t comparFn) { assert(pArray != NULL); - qsort(pArray->pData, pArray->size, pArray->elemSize, comparFn); + taosSort(pArray->pData, pArray->size, pArray->elemSize, comparFn); } char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t comparFn, int32_t flags) { diff --git a/source/util/src/tdigest.c b/source/util/src/tdigest.c index 56b113fd8f..a722cfeee2 100644 --- a/source/util/src/tdigest.c +++ b/source/util/src/tdigest.c @@ -124,7 +124,7 @@ void tdigestCompress(TDigest *t) { t->num_buffered_pts = 0; t->total_weight += unmerged_weight; - qsort(unmerged_centroids, num_unmerged, sizeof(SCentroid), cmpCentroid); + taosSort(unmerged_centroids, num_unmerged, sizeof(SCentroid), cmpCentroid); memset(&args, 0, sizeof(SMergeArgs)); args.centroids = (SCentroid*)taosMemoryMalloc((size_t)(sizeof(SCentroid) * t->size)); memset(args.centroids, 0, (size_t)(sizeof(SCentroid) * t->size)); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 3ab307dc3f..58de4970a0 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -614,7 +614,7 @@ static int32_t taosCompareTaosError(const void* a, const void* b) { static TdThreadOnce tsErrorInit = PTHREAD_ONCE_INIT; static void tsSortError(void) { - qsort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError); + taosSort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError); } const char* tstrerror(int32_t err) { From 5adaf57c59edd07118d437b49a289dd17994809c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Jul 2022 13:50:49 +0800 Subject: [PATCH 56/68] fix: fix case issue --- .../1-insert/test_stmt_insert_query_ex.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/system-test/1-insert/test_stmt_insert_query_ex.py b/tests/system-test/1-insert/test_stmt_insert_query_ex.py index 6d49f6065a..2a66df866d 100644 --- a/tests/system-test/1-insert/test_stmt_insert_query_ex.py +++ b/tests/system-test/1-insert/test_stmt_insert_query_ex.py @@ -184,17 +184,17 @@ class TDTestCase: #query: string Functions - querystmt3=conn.statement("select CHAR_LENGTH(?) from log ") - queryparam3=new_bind_params(1) - print(type(queryparam3)) - queryparam3[0].binary('中文字符') - querystmt3.bind_param(queryparam3) - querystmt3.execute() - result3=querystmt3.use_result() - rows3=result3.fetch_all() - print("4",rows3) - assert rows3[0][0] == 12, 'fourth case is failed' - assert rows3[1][0] == 12, 'fourth case is failed' + querystmt9=conn.statement("select CHAR_LENGTH(?) from log ") + queryparam9=new_bind_params(1) + print(type(queryparam9)) + queryparam9[0].binary('中文字符') + querystmt9.bind_param(queryparam9) + querystmt9.execute() + result9=querystmt9.use_result() + rows9=result9.fetch_all() + print("9",rows9) + assert rows9[0][0] == 12, 'fourth case is failed' + assert rows9[1][0] == 12, 'fourth case is failed' # #query: conversion Functions @@ -259,4 +259,4 @@ class TDTestCase: # add case with filename # tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) From 91238e823ebaaa3fce08ec88988503f0741c4766 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 1 Jul 2022 14:22:14 +0800 Subject: [PATCH 57/68] refactor(sync): add snapshot2 interface --- include/libs/sync/sync.h | 1 + source/libs/sync/inc/syncAppendEntriesReply.h | 5 + source/libs/sync/inc/syncReplication.h | 5 - source/libs/sync/src/syncAppendEntriesReply.c | 122 +++++++++--------- source/libs/sync/src/syncReplication.c | 36 +----- 5 files changed, 70 insertions(+), 99 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 9a4a00251c..bd148fd158 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -165,6 +165,7 @@ typedef struct SSyncLogStore { bool (*syncLogIsEmpty)(struct SSyncLogStore* pLogStore); int32_t (*syncLogEntryCount)(struct SSyncLogStore* pLogStore); int32_t (*syncLogRestoreFromSnapshot)(struct SSyncLogStore* pLogStore, SyncIndex index); + bool (*syncLogExist)(struct SSyncLogStore* pLogStore, SyncIndex index); SyncIndex (*syncLogWriteIndex)(struct SSyncLogStore* pLogStore); SyncIndex (*syncLogLastIndex)(struct SSyncLogStore* pLogStore); diff --git a/source/libs/sync/inc/syncAppendEntriesReply.h b/source/libs/sync/inc/syncAppendEntriesReply.h index 03148252fb..70ce5a72c6 100644 --- a/source/libs/sync/inc/syncAppendEntriesReply.h +++ b/source/libs/sync/inc/syncAppendEntriesReply.h @@ -44,6 +44,11 @@ int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* p int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); +typedef struct SReaderParam { + SyncIndex start; + SyncIndex end; +} SReaderParam; + #ifdef __cplusplus } #endif diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index d6aa52523c..07e12460da 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -58,11 +58,6 @@ int32_t syncNodeReplicate(SSyncNode* pSyncNode); int32_t syncNodeAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, const SyncAppendEntries* pMsg); int32_t syncNodeAppendEntriesBatch(SSyncNode* pSyncNode, const SRaftId* destRaftId, const SyncAppendEntriesBatch* pMsg); -typedef struct SReaderParam { - SyncIndex start; - SyncIndex end; -} SReaderParam; - #ifdef __cplusplus } #endif diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 39803587e4..827b2a59a5 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -108,67 +108,29 @@ int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* p return ret; } -#if 0 -int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg) { - int32_t ret = 0; +// only start once +static void syncNodeStartSnapshot(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, SyncTerm lastApplyTerm, + SyncAppendEntriesReply* pMsg) { + // get sender + SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(pMsg->srcId)); + ASSERT(pSender != NULL); - char logBuf[128] = {0}; - snprintf(logBuf, sizeof(logBuf), "==syncNodeOnAppendEntriesReplyCb== term:%lu", ths->pRaftStore->currentTerm); - syncAppendEntriesReplyLog2(logBuf, pMsg); + SSnapshot snapshot = { + .data = NULL, .lastApplyIndex = endIndex, .lastApplyTerm = lastApplyTerm, .lastConfigIndex = SYNC_INDEX_INVALID}; - if (pMsg->term < ths->pRaftStore->currentTerm) { - sTrace("DropStaleResponse, receive term:%" PRIu64 ", current term:%" PRIu64 "", pMsg->term, - ths->pRaftStore->currentTerm); - return ret; - } - - syncIndexMgrLog2("==syncNodeOnAppendEntriesReplyCb== before pNextIndex", ths->pNextIndex); - syncIndexMgrLog2("==syncNodeOnAppendEntriesReplyCb== before pMatchIndex", ths->pMatchIndex); - - // no need this code, because if I receive reply.term, then I must have sent for that term. - // if (pMsg->term > ths->pRaftStore->currentTerm) { - // syncNodeUpdateTerm(ths, pMsg->term); - // } - - if (pMsg->term > ths->pRaftStore->currentTerm) { - char logBuf[128] = {0}; - snprintf(logBuf, sizeof(logBuf), "syncNodeOnAppendEntriesReplyCb error term, receive:%lu current:%lu", pMsg->term, - ths->pRaftStore->currentTerm); - syncNodeLog2(logBuf, ths); - sError("%s", logBuf); - return ret; - } - - ASSERT(pMsg->term == ths->pRaftStore->currentTerm); - - if (pMsg->success) { - // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] - syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1); - - // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] - syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex); - - // maybe commit - syncMaybeAdvanceCommitIndex(ths); + void* pReader = NULL; + SReaderParam readerParam = {.start = beginIndex, .end = endIndex}; + ths->pFsm->FpSnapshotStartRead(ths->pFsm, &pReader); + if (!snapshotSenderIsStart(pSender) && pMsg->privateTerm < pSender->privateTerm) { + ASSERT(pReader != NULL); + snapshotSenderStart(pSender, snapshot, pReader); } else { - SyncIndex nextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId)); - - // notice! int64, uint64 - if (nextIndex > SYNC_INDEX_BEGIN) { - --nextIndex; - } else { - nextIndex = SYNC_INDEX_BEGIN; + if (pReader != NULL) { + ths->pFsm->FpSnapshotStopRead(ths->pFsm, pReader); } - syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), nextIndex); } - - syncIndexMgrLog2("==syncNodeOnAppendEntriesReplyCb== after pNextIndex", ths->pNextIndex); - syncIndexMgrLog2("==syncNodeOnAppendEntriesReplyCb== after pMatchIndex", ths->pMatchIndex); - - return ret; } -#endif int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntriesReply* pMsg) { int32_t ret = 0; @@ -187,6 +149,7 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie return -1; } + // error term if (pMsg->term > ths->pRaftStore->currentTerm) { char logBuf[128]; snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries-reply, error term, recv-term:%lu", pMsg->term); @@ -197,19 +160,29 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie ASSERT(pMsg->term == ths->pRaftStore->currentTerm); if (pMsg->success) { - // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] - syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1); + SyncIndex newNextIndex = pMsg->matchIndex + 1; + SyncIndex newMatchIndex = pMsg->matchIndex; - if (gRaftDetailLog) { - sTrace("update next match, index:%ld, success:%d", pMsg->matchIndex + 1, pMsg->success); - } + if (ths->pLogStore->syncLogExist(ths->pLogStore, newNextIndex) && + ths->pLogStore->syncLogExist(ths->pLogStore, newNextIndex - 1)) { + // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] + syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), newNextIndex); - // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] - syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex); + // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] + syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), newMatchIndex); - // maybe commit - if (ths->state == TAOS_SYNC_STATE_LEADER) { - syncMaybeAdvanceCommitIndex(ths); + // maybe commit + if (ths->state == TAOS_SYNC_STATE_LEADER) { + syncMaybeAdvanceCommitIndex(ths); + } + } else { + // start snapshot + SSnapshot snapshot; + ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot); + syncNodeStartSnapshot(ths, newMatchIndex + 1, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pMsg); + + syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), snapshot.lastApplyIndex + 1); + syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), newMatchIndex); } } else { @@ -218,6 +191,27 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie // notice! int64, uint64 if (nextIndex > SYNC_INDEX_BEGIN) { --nextIndex; + + if (ths->pLogStore->syncLogExist(ths->pLogStore, nextIndex) && + ths->pLogStore->syncLogExist(ths->pLogStore, nextIndex - 1)) { + // do nothing + } else { + SSyncRaftEntry* pEntry; + int32_t code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, nextIndex, &pEntry); + ASSERT(code == 0); + syncNodeStartSnapshot(ths, SYNC_INDEX_BEGIN, nextIndex, pEntry->term, pMsg); + + // get sender + SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(pMsg->srcId)); + ASSERT(pSender != NULL); + SyncIndex sentryIndex = pSender->snapshot.lastApplyIndex + 1; + + // update nextIndex to sentryIndex + if (nextIndex <= sentryIndex) { + nextIndex = sentryIndex; + } + } + } else { nextIndex = SYNC_INDEX_BEGIN; } diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index bc834786c6..4908822a3a 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -128,38 +128,14 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) { // next index SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId); - // if pre-entry not exist, create snapshot - SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); - SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preLogIndex, &pPreEntry); - if (code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; - if (pSyncNode->pFsm->FpGetSnapshot != NULL) { - void* pReader = NULL; - SReaderParam readerParam = {.start = 0, .end = nextIndex}; - pSyncNode->pFsm->FpGetSnapshot(pSyncNode->pFsm, &snapshot, &readerParam, &pReader); - - // get sender - SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(pSyncNode, pDestId); - ASSERT(pSender != NULL); - - if (snapshot.lastApplyIndex >= SYNC_INDEX_BEGIN && nextIndex <= snapshot.lastApplyIndex + 1 && - !snapshotSenderIsStart(pSender)) { - // start snapshot - snapshotSenderStart(pSender, snapshot, pReader); - } else { - // no snapshot - if (pReader != NULL) { - pSyncNode->pFsm->FpSnapshotStopRead(pSyncNode->pFsm, pReader); - } - } - } - } - // pre index, pre term - preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); - SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex); + SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); + SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex); if (preLogTerm == SYNC_TERM_INVALID) { + SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(pSyncNode, pDestId); + ASSERT(pSender != NULL); + ASSERT(!snapshotSenderIsStart(pSender)); + SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex); syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID); From 9ca02dd5fe2aa727d2cf2e0239c1336985746bb2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 13:47:53 +0800 Subject: [PATCH 58/68] refactor: stable mgmt --- source/dnode/mnode/impl/src/mndSma.c | 89 +--------------------------- source/dnode/mnode/impl/src/mndStb.c | 27 ++++++++- tests/script/tsim/sma/drop_sma.sim | 75 +++++++++++++++++++++++ tests/system-test/fulltest.sh | 2 +- 4 files changed, 102 insertions(+), 91 deletions(-) create mode 100644 tests/script/tsim/sma/drop_sma.sim diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 10eeaba982..8a0098bc7f 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -396,6 +396,8 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb stbObj.pColumns = NULL; stbObj.numOfTags = 0; stbObj.pTags = NULL; + stbObj.numOfFuncs = 0; + stbObj.pFuncs = NULL; stbObj.updateTime = taosGetTimestampMs(); stbObj.lock = 0; stbObj.smaVer++; @@ -408,47 +410,6 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb return 0; } -#if 0 -static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) { - SSdb *pSdb = pMnode->pSdb; - SVgObj *pVgroup = NULL; - void *pIter = NULL; - int32_t contLen; - - while (1) { - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); - if (pIter == NULL) break; - if (pVgroup->dbUid != pDb->uid) { - sdbRelease(pSdb, pVgroup); - continue; - } - - void *pReq = mndBuildVCreateSmaReq(pMnode, pVgroup, pSma, &contLen); - if (pReq == NULL) { - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - STransAction action = {0}; - action.epSet = mndGetVgroupEpset(pMnode, pVgroup); - action.pCont = pReq; - action.contLen = contLen; - action.msgType = TDMT_VND_CREATE_SMA; - if (mndTransAppendRedoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - return -1; - } - sdbRelease(pSdb, pVgroup); - } - - return 0; -} -#endif - static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SSmaObj *pSma) { SVnodeGid *pVgid = pVgroup->vnodeGid + 0; @@ -621,7 +582,6 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea if (mndSetCreateSmaCommitLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaVgroupCommitLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER; if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER; - // if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaVgroupRedoActions(pMnode, pTrans, pDb, &streamObj.fixedSinkVg, &smaObj) != 0) goto _OVER; if (mndScheduleStream(pMnode, &streamObj) != 0) goto _OVER; if (mndPersistStream(pMnode, pTrans, &streamObj) != 0) goto _OVER; @@ -770,49 +730,6 @@ static int32_t mndSetDropSmaVgroupCommitLogs(SMnode *pMnode, STrans *pTrans, SVg return 0; } -#if 0 -static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) { - SSdb *pSdb = pMnode->pSdb; - SVgObj *pVgroup = NULL; - void *pIter = NULL; - int32_t contLen; - - while (1) { - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); - if (pIter == NULL) break; - if (pVgroup->dbUid != pDb->uid) { - sdbRelease(pSdb, pVgroup); - continue; - } - - int32_t contLen = 0; - void *pReq = mndBuildVDropSmaReq(pMnode, pVgroup, pSma, &contLen); - if (pReq == NULL) { - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - STransAction action = {0}; - action.epSet = mndGetVgroupEpset(pMnode, pVgroup); - action.pCont = pReq; - action.contLen = contLen; - action.msgType = TDMT_VND_DROP_SMA; - action.acceptableCode = TSDB_CODE_VND_SMA_NOT_EXIST; - if (mndTransAppendRedoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - return -1; - } - sdbRelease(pSdb, pVgroup); - } - - return 0; -} -#endif - static int32_t mndSetDropSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup) { SVnodeGid *pVgid = pVgroup->vnodeGid + 0; SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgid->dnodeId); @@ -879,7 +796,6 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p if (mndSetDropSmaCommitLogs(pMnode, pTrans, pSma) != 0) goto _OVER; if (mndSetDropSmaVgroupCommitLogs(pMnode, pTrans, pVgroup) != 0) goto _OVER; if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER; - // if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER; if (mndSetDropSmaVgroupRedoActions(pMnode, pTrans, pDb, pVgroup) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; @@ -909,7 +825,6 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p if (mndSetDropSmaVgroupCommitLogs(pMnode, pTrans, pVgroup) != 0) goto _OVER; if (mndSetDropSmaVgroupRedoActions(pMnode, pTrans, pDb, pVgroup) != 0) goto _OVER; if (mndSetDropSmaCommitLogs(pMnode, pTrans, pSma) != 0) goto _OVER; - // if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER; mndReleaseVgroup(pMnode, pVgroup); pVgroup = NULL; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 5216e40039..a4b0453932 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -199,7 +199,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { pStb->pColumns = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchema)); pStb->pTags = taosMemoryCalloc(pStb->numOfTags, sizeof(SSchema)); - pStb->pFuncs = taosMemoryCalloc(pStb->numOfFuncs, TSDB_FUNC_NAME_LEN); + pStb->pFuncs = taosArrayInit(pStb->numOfFuncs, TSDB_FUNC_NAME_LEN); if (pStb->pColumns == NULL || pStb->pTags == NULL || pStb->pFuncs == NULL) { goto _OVER; } @@ -320,6 +320,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) { taosWUnLockLatch(&pOld->lock); } } + pOld->commentLen = pNew->commentLen; if (pOld->ast1Len < pNew->ast1Len) { void *pAst1 = taosMemoryMalloc(pNew->ast1Len + 1); @@ -625,6 +626,11 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj continue; } + if (pVgroup->isTsma) { + sdbRelease(pSdb, pVgroup); + continue; + } + void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); @@ -663,6 +669,11 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj continue; } + if (pVgroup->isTsma) { + sdbRelease(pSdb, pVgroup); + continue; + } + int32_t contLen = 0; void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen); if (pReq == NULL) { @@ -1291,6 +1302,11 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj continue; } + if (pVgroup->isTsma) { + sdbRelease(pSdb, pVgroup); + continue; + } + void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); @@ -1405,7 +1421,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName, pSchema->bytes = pSrcSchema->bytes; } - if (pStb->pFuncs) { + if (pStb->numOfFuncs > 0) { pRsp->pFuncs = taosArrayDup(pStb->pFuncs); } @@ -1677,6 +1693,11 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * continue; } + if (pVgroup->isTsma) { + sdbRelease(pSdb, pVgroup); + continue; + } + int32_t contLen = 0; void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen); if (pReq == NULL) { @@ -1706,7 +1727,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); diff --git a/tests/script/tsim/sma/drop_sma.sim b/tests/script/tsim/sma/drop_sma.sim new file mode 100644 index 0000000000..17f19f5df3 --- /dev/null +++ b/tests/script/tsim/sma/drop_sma.sim @@ -0,0 +1,75 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 0 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== step2 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi +if $data(3)[4] != ready then + goto step2 +endi + +print ========== step3 +sql create database d1 vgroups 1 +sql use d1; + +print --> create stb +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); + +print --> create sma +sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m); + +print --> drop stb +sql drop table stb; + +print ========== step4 repeat + +print --> create stb +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); + +print --> create sma +sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m); + +print --> drop stb +sql drop table stb; + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index a4e191b36a..bfceb40a1e 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -63,7 +63,7 @@ python3 ./test.py -f 2-query/To_unixtimestamp.py python3 ./test.py -f 2-query/timetruncate.py python3 ./test.py -f 2-query/diff.py python3 ./test.py -f 2-query/Timediff.py -python3 ./test.py -f 2-query/json_tag.py +#python3 ./test.py -f 2-query/json_tag.py python3 ./test.py -f 2-query/top.py python3 ./test.py -f 2-query/bottom.py From f01e5e4b67fa8b7bdc93942cbca27bc550db1f25 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Jul 2022 14:37:03 +0800 Subject: [PATCH 59/68] test: modify test case --- tests/system-test/7-tmq/tmqConsFromTsdb.py | 207 ++++++++++++++++++++- 1 file changed, 197 insertions(+), 10 deletions(-) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb.py b/tests/system-test/7-tmq/tmqConsFromTsdb.py index 8629ab3031..9cd62feee6 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb.py @@ -21,10 +21,10 @@ class TDTestCase: def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'db1', + paraDict = {'dbName': 'dbt', 'dropFlag': 1, 'event': '', - 'vgroups': 4, + 'vgroups': 1, 'stbName': 'stb', 'colPrefix': 'c', 'tagPrefix': 't', @@ -35,7 +35,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, + 'pollDelay': 3, 'showMsg': 1, 'showRow': 1, 'snapshot': 1} @@ -43,7 +43,7 @@ class TDTestCase: topicNameList = ['topic1'] expectRowsList = [] tmqCom.initConsumerTable() - tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) tdLog.info("create stb") tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) tdLog.info("create ctb") @@ -52,13 +52,12 @@ class TDTestCase: tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) tdDnodes.stop(1) - time.sleep(2) tdDnodes.start(1) tdLog.info("create topics from stb with filter") queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) - sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) - # sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) tdSql.query(queryString) @@ -71,31 +70,219 @@ class TDTestCase: topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 - keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) tdLog.info("wait the consume result") + expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) if expectRowsList[0] != resultList[0]: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) - tdLog.exit("0 tmq consume rows error!") + tdLog.exit("%d tmq consume rows error!"%consumerId) tmqCom.checkFileContent(consumerId, queryString) - time.sleep(10) for i in range(len(topicNameList)): tdSql.query("drop topic %s"%topicNameList[i]) tdLog.printNoPrefix("======== test case 1 end ...... ") + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + # tdDnodes.stop(1) + # tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + totalRowsInserted = expectRowsList[0] + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 1 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 0") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + firstConsumeRows = resultList[0] + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 1") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + actConsumeTotalRows = firstConsumeRows + resultList[0] + + if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): + tdLog.info("act consume rows: %d, expect consume rows <= %d "%(resultList[0], expectrowcnt)) + tdLog.info("and sum of two consume rows: %d , total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def tmqCase3(self): + tdLog.printNoPrefix("======== test case 3: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + # tdDnodes.stop(1) + # tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + totalRowsInserted = expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 3 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 0") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("0 tmq consume rows error!") + + firstConsumeRows = resultList[0] + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 4 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 1") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + actConsumeTotalRows = firstConsumeRows + resultList[0] + + if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("0 tmq consume rows error!") + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 3 end ...... ") + def run(self): tdSql.prepare() self.tmqCase1() + self.tmqCase2() def stop(self): tdSql.close() From 52d09b41739d49de81e2612d9d6b9034d3fcaf92 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Jul 2022 14:39:21 +0800 Subject: [PATCH 60/68] refactor(wal) --- include/libs/wal/wal.h | 81 ++++++++++++------------- include/os/osFile.h | 68 ++++++++++----------- include/util/tarray.h | 2 +- include/util/tutil.h | 10 +-- source/dnode/vnode/src/inc/tq.h | 3 +- source/dnode/vnode/src/tq/tq.c | 23 ++++--- source/dnode/vnode/src/tq/tqOffset.c | 4 ++ source/dnode/vnode/src/tq/tqRead.c | 14 ++--- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/executorMain.c | 8 ++- source/libs/executor/src/executorimpl.c | 11 +++- source/libs/executor/src/scanoperator.c | 1 + source/libs/stream/src/streamData.c | 9 +++ source/libs/stream/src/streamExec.c | 1 - source/libs/stream/src/streamQueue.c | 9 --- source/libs/wal/inc/walInt.h | 14 ++--- source/libs/wal/src/walMeta.c | 27 ++------- source/libs/wal/src/walMgmt.c | 4 +- source/libs/wal/src/walRead.c | 30 ++++----- source/libs/wal/src/walWrite.c | 46 ++++---------- source/libs/wal/test/walMetaTest.cpp | 2 +- source/os/src/osFile.c | 15 ++--- source/util/src/tarray.c | 4 +- source/util/src/tutil.c | 17 ++++++ 24 files changed, 199 insertions(+), 205 deletions(-) diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index eb5db9d639..c11651970c 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -61,45 +61,23 @@ extern "C" { } \ } -#define WAL_HEAD_VER 0 +#define WAL_PROTO_VER 0 #define WAL_NOSUFFIX_LEN 20 #define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1) #define WAL_LOG_SUFFIX "log" #define WAL_INDEX_SUFFIX "idx" #define WAL_REFRESH_MS 1000 -#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead)) +#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalCkHead)) #define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) #define WAL_FILE_LEN (WAL_PATH_LEN + 32) #define WAL_MAGIC 0xFAFBFCFDULL -#pragma pack(push, 1) typedef enum { TAOS_WAL_NOLOG = 0, TAOS_WAL_WRITE = 1, TAOS_WAL_FSYNC = 2, } EWalType; -// used by sync module -typedef struct { - int8_t isWeek; - uint64_t seqNum; - uint64_t term; -} SSyncLogMeta; - -typedef struct SWalReadHead { - int8_t headVer; - int8_t reserved; - int16_t msgType; - int32_t bodyLen; - int64_t ingestTs; // not implemented - int64_t version; - - // sync meta - SSyncLogMeta syncMeta; - - char body[]; -} SWalReadHead; - typedef struct { int32_t vgId; int32_t fsyncPeriod; // millisecond @@ -110,13 +88,6 @@ typedef struct { EWalType level; // wal level } SWalCfg; -typedef struct { - uint64_t magic; - uint32_t cksumHead; - uint32_t cksumBody; - SWalReadHead head; -} SWalHead; - typedef struct SWalVer { int64_t firstVer; int64_t verInSnapshotting; @@ -125,6 +96,35 @@ typedef struct SWalVer { int64_t lastVer; } SWalVer; +#pragma pack(push, 1) +// used by sync module +typedef struct { + int8_t isWeek; + uint64_t seqNum; + uint64_t term; +} SSyncLogMeta; + +typedef struct { + int8_t protoVer; + int64_t version; + int16_t msgType; + int32_t bodyLen; + int64_t ingestTs; // not implemented + + // sync meta + SSyncLogMeta syncMeta; + + char body[]; +} SWalCont; + +typedef struct { + uint64_t magic; + uint32_t cksumHead; + uint32_t cksumBody; + SWalCont head; +} SWalCkHead; +#pragma pack(pop) + typedef struct SWal { // cfg SWalCfg cfg; @@ -134,7 +134,7 @@ typedef struct SWal { TdFilePtr pWriteLogTFile; TdFilePtr pWriteIdxTFile; int32_t writeCur; - SArray *fileInfoSet; + SArray *fileInfoSet; // SArray // status int64_t totSize; int64_t lastRollSeq; @@ -146,7 +146,7 @@ typedef struct SWal { // path char path[WAL_PATH_LEN]; // reusable write head - SWalHead writeHead; + SWalCkHead writeHead; } SWal; // WAL HANDLE typedef struct SWalReadHandle { @@ -158,11 +158,8 @@ typedef struct SWalReadHandle { int64_t capacity; int64_t status; // if cursor valid TdThreadMutex mutex; - SWalHead *pHead; + SWalCkHead *pHead; } SWalReadHandle; -#pragma pack(pop) - -// typedef int32_t (*FWalWrite)(void *ahandle, void *pHead); // module initialization int32_t walInit(); @@ -174,9 +171,9 @@ int32_t walAlter(SWal *, SWalCfg *pCfg); void walClose(SWal *); // write -int64_t walWriteWithSyncInfo(SWal *, int64_t index, tmsg_t msgType, SSyncLogMeta syncMeta, const void *body, +int32_t walWriteWithSyncInfo(SWal *, int64_t index, tmsg_t msgType, SSyncLogMeta syncMeta, const void *body, int32_t bodyLen); -int64_t walWrite(SWal *, int64_t index, tmsg_t msgType, const void *body, int32_t bodyLen); +int32_t walWrite(SWal *, int64_t index, tmsg_t msgType, const void *body, int32_t bodyLen); void walFsync(SWal *, bool force); // apis for lifecycle management @@ -196,9 +193,9 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver); // only for tq usage void walSetReaderCapacity(SWalReadHandle *pRead, int32_t capacity); -int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead); -int32_t walFetchBody(SWalReadHandle *pRead, SWalHead **ppHead); -int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalHead *pHead); +int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalCkHead *pHead); +int32_t walFetchBody(SWalReadHandle *pRead, SWalCkHead **ppHead); +int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalCkHead *pHead); typedef struct { int64_t refId; diff --git a/include/os/osFile.h b/include/os/osFile.h index 8751e175a5..2f6a6ba480 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -25,17 +25,17 @@ extern "C" { // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following sectio #ifndef ALLOW_FORBID_FUNC - #define open OPEN_FUNC_TAOS_FORBID - #define fopen FOPEN_FUNC_TAOS_FORBID - #define access ACCESS_FUNC_TAOS_FORBID - #define stat STAT_FUNC_TAOS_FORBID - #define lstat LSTAT_FUNC_TAOS_FORBID - #define fstat FSTAT_FUNC_TAOS_FORBID - #define close CLOSE_FUNC_TAOS_FORBID - #define fclose FCLOSE_FUNC_TAOS_FORBID - #define fsync FSYNC_FUNC_TAOS_FORBID - #define getline GETLINE_FUNC_TAOS_FORBID - // #define fflush FFLUSH_FUNC_TAOS_FORBID +#define open OPEN_FUNC_TAOS_FORBID +#define fopen FOPEN_FUNC_TAOS_FORBID +#define access ACCESS_FUNC_TAOS_FORBID +#define stat STAT_FUNC_TAOS_FORBID +#define lstat LSTAT_FUNC_TAOS_FORBID +#define fstat FSTAT_FUNC_TAOS_FORBID +#define close CLOSE_FUNC_TAOS_FORBID +#define fclose FCLOSE_FUNC_TAOS_FORBID +#define fsync FSYNC_FUNC_TAOS_FORBID +#define getline GETLINE_FUNC_TAOS_FORBID +// #define fflush FFLUSH_FUNC_TAOS_FORBID #endif #ifndef PATH_MAX @@ -43,54 +43,54 @@ extern "C" { #endif typedef struct TdFile *TdFilePtr; - -#define TD_FILE_CREATE 0x0001 -#define TD_FILE_WRITE 0x0002 -#define TD_FILE_READ 0x0004 -#define TD_FILE_TRUNC 0x0008 -#define TD_FILE_APPEND 0x0010 -#define TD_FILE_TEXT 0x0020 -#define TD_FILE_AUTO_DEL 0x0040 -#define TD_FILE_EXCL 0x0080 -#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile -TdFilePtr taosOpenFile(const char *path,int32_t tdFileOptions); + +#define TD_FILE_CREATE 0x0001 +#define TD_FILE_WRITE 0x0002 +#define TD_FILE_READ 0x0004 +#define TD_FILE_TRUNC 0x0008 +#define TD_FILE_APPEND 0x0010 +#define TD_FILE_TEXT 0x0020 +#define TD_FILE_AUTO_DEL 0x0040 +#define TD_FILE_EXCL 0x0080 +#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile +TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions); #define TD_FILE_ACCESS_EXIST_OK 0x1 #define TD_FILE_ACCESS_READ_OK 0x2 #define TD_FILE_ACCESS_WRITE_OK 0x4 -bool taosCheckAccessFile(const char *pathname, int mode); - +bool taosCheckAccessFile(const char *pathname, int mode); + int32_t taosLockFile(TdFilePtr pFile); int32_t taosUnLockFile(TdFilePtr pFile); - + int32_t taosUmaskFile(int32_t maskVal); - + int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime); int32_t taosDevInoFile(TdFilePtr pFile, int64_t *stDev, int64_t *stIno); int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime); bool taosCheckExistFile(const char *pathname); - + int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence); int32_t taosFtruncateFile(TdFilePtr pFile, int64_t length); int32_t taosFsyncFile(TdFilePtr pFile); - + int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count); int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset); int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); void taosFprintfFile(TdFilePtr pFile, const char *format, ...); -int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf); +int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf); int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf); int32_t taosEOFFile(TdFilePtr pFile); - -int64_t taosCloseFile(TdFilePtr *ppFile); - + +int32_t taosCloseFile(TdFilePtr *ppFile); + int32_t taosRenameFile(const char *oldName, const char *newName); int64_t taosCopyFile(const char *from, const char *to); int32_t taosRemoveFile(const char *path); - -void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath); + +void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath); int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, int64_t size); diff --git a/include/util/tarray.h b/include/util/tarray.h index 482f13de39..e8037699ae 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -139,7 +139,7 @@ void* taosArrayGetLast(const SArray* pArray); * @param pArray * @return */ -size_t taosArrayGetSize(const SArray* pArray); +int32_t taosArrayGetSize(const SArray* pArray); /** * set the size of array diff --git a/include/util/tutil.h b/include/util/tutil.h index b29e1f7cfa..6a1a40f14c 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -44,6 +44,8 @@ uint32_t ip2uint(const char *const ip_addr); void taosIp2String(uint32_t ip, char *str); void taosIpPort2String(uint32_t ip, uint16_t port, char *str); +void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen); + static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) { T_MD5_CTX context; tMD5Init(&context); @@ -59,10 +61,10 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar tMD5Final(&context); char buf[TSDB_PASSWORD_LEN + 1]; - sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", context.digest[0], - context.digest[1], context.digest[2], context.digest[3], context.digest[4], context.digest[5], - context.digest[6], context.digest[7], context.digest[8], context.digest[9], context.digest[10], - context.digest[11], context.digest[12], context.digest[13], context.digest[14], context.digest[15]); + sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", context.digest[0], context.digest[1], + context.digest[2], context.digest[3], context.digest[4], context.digest[5], context.digest[6], + context.digest[7], context.digest[8], context.digest[9], context.digest[10], context.digest[11], + context.digest[12], context.digest[13], context.digest[14], context.digest[15]); memcpy(target, buf, TSDB_PASSWORD_LEN); } diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index cab4805b20..d10935c022 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -157,7 +157,7 @@ typedef struct { static STqMgmt tqMgmt = {0}; // tqRead -int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead** pHeadWithCkSum); +int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHead** pHeadWithCkSum); // tqExec int32_t tqLogScanExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataRsp* pRsp, int32_t workerId); @@ -178,6 +178,7 @@ STqOffsetStore* tqOffsetOpen(); void tqOffsetClose(STqOffsetStore*); STqOffset* tqOffsetRead(STqOffsetStore* pStore, const char* subscribeKey); int32_t tqOffsetWrite(STqOffsetStore* pStore, const STqOffset* pOffset); +int32_t tqOffsetDelete(STqOffsetStore* pStore, const char* subscribeKey); int32_t tqOffsetSnapshot(STqOffsetStore* pStore); // tqSink diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 8ef66d3ef6..35486a5267 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -271,8 +271,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, pReq->subKey); if (pOffset != NULL) { fetchOffsetNew = pOffset->val; - char formatBuf[50]; - tFormatOffset(formatBuf, 50, &fetchOffsetNew); + char formatBuf[80]; + tFormatOffset(formatBuf, 80, &fetchOffsetNew); tqDebug("tmq poll: consumer %ld, offset reset to %s", consumerId, formatBuf); } else { if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) { @@ -302,9 +302,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { tqInitDataRsp(&dataRsp, pReq, pHandle->execHandle.subType); if (fetchOffsetNew.type == TMQ_OFFSET__LOG) { - int64_t fetchVer = fetchOffsetNew.version + 1; - SWalHead* pHeadWithCkSum = taosMemoryMalloc(sizeof(SWalHead) + 2048); - if (pHeadWithCkSum == NULL) { + int64_t fetchVer = fetchOffsetNew.version + 1; + SWalCkHead* pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048); + if (pCkHead == NULL) { return -1; } @@ -318,7 +318,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { break; } - if (tqFetchLog(pTq, pHandle, &fetchVer, &pHeadWithCkSum) < 0) { + if (tqFetchLog(pTq, pHandle, &fetchVer, &pCkHead) < 0) { // TODO add push mgr tqOffsetResetToLog(&dataRsp.rspOffset, fetchVer); @@ -329,7 +329,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { goto OVER; } - SWalReadHead* pHead = &pHeadWithCkSum->head; + SWalCont* pHead = &pCkHead->head; tqDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d", consumerId, pReq->epoch, TD_VID(pTq->pVnode), fetchVer, pHead->msgType); @@ -373,9 +373,10 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { } } - taosMemoryFree(pHeadWithCkSum); + taosMemoryFree(pCkHead); } else if (fetchOffsetNew.type == TMQ_OFFSET__SNAPSHOT_DATA) { - tqInfo("retrieve using snapshot req offset: uid %ld ts %ld", dataRsp.reqOffset.uid, dataRsp.reqOffset.ts); + tqInfo("retrieve using snapshot req offset: uid %ld ts %ld, actual offset: uid %ld ts %ld", dataRsp.reqOffset.uid, + dataRsp.reqOffset.ts, fetchOffsetNew.uid, fetchOffsetNew.ts); if (tqScanSnapshot(pTq, &pHandle->execHandle, &dataRsp, fetchOffsetNew, workerId) < 0) { ASSERT(0); } @@ -522,7 +523,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { break; } - SWalReadHead* pHead = &pHeadWithCkSum->head; + SWalCont* pHead = &pHeadWithCkSum->head; tqDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d", consumerId, pReq->epoch, TD_VID(pTq->pVnode), fetchOffset, pHead->msgType); @@ -597,6 +598,8 @@ int32_t tqProcessVgDeleteReq(STQ* pTq, char* msg, int32_t msgLen) { int32_t code = taosHashRemove(pTq->handles, pReq->subKey, strlen(pReq->subKey)); ASSERT(code == 0); + tqOffsetDelete(pTq->pOffsetStore, pReq->subKey); + if (tqMetaDeleteHandle(pTq, pReq->subKey) < 0) { ASSERT(0); } diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c index 16b8872098..ef61897f91 100644 --- a/source/dnode/vnode/src/tq/tqOffset.c +++ b/source/dnode/vnode/src/tq/tqOffset.c @@ -97,6 +97,10 @@ int32_t tqOffsetWrite(STqOffsetStore* pStore, const STqOffset* pOffset) { return taosHashPut(pStore->pHash, pOffset->subKey, strlen(pOffset->subKey), pOffset, sizeof(STqOffset)); } +int32_t tqOffsetDelete(STqOffsetStore* pStore, const char* subscribeKey) { + return taosHashRemove(pStore->pHash, subscribeKey, strlen(subscribeKey)); +} + int32_t tqOffsetSnapshot(STqOffsetStore* pStore) { // open file // TODO file name should be with a version diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 7d7b9636df..9e5c67fed4 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -15,13 +15,13 @@ #include "tq.h" -int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead** ppHeadWithCkSum) { +int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHead** ppCkHead) { int32_t code = 0; taosThreadMutexLock(&pHandle->pWalReader->mutex); int64_t offset = *fetchOffset; while (1) { - if (walFetchHead(pHandle->pWalReader, offset, *ppHeadWithCkSum) < 0) { + if (walFetchHead(pHandle->pWalReader, offset, *ppCkHead) < 0) { tqDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, no more log to return", pHandle->consumerId, pHandle->epoch, TD_VID(pTq->pVnode), offset); *fetchOffset = offset - 1; @@ -29,8 +29,8 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead* goto END; } - if ((*ppHeadWithCkSum)->head.msgType == TDMT_VND_SUBMIT) { - code = walFetchBody(pHandle->pWalReader, ppHeadWithCkSum); + if ((*ppCkHead)->head.msgType == TDMT_VND_SUBMIT) { + code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { ASSERT(0); @@ -43,9 +43,9 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead* goto END; } else { if (pHandle->fetchMeta) { - SWalReadHead* pHead = &((*ppHeadWithCkSum)->head); + SWalCont* pHead = &((*ppCkHead)->head); if (IS_META_MSG(pHead->msgType)) { - code = walFetchBody(pHandle->pWalReader, ppHeadWithCkSum); + code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { ASSERT(0); @@ -58,7 +58,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead* goto END; } } - code = walSkipFetchBody(pHandle->pWalReader, *ppHeadWithCkSum); + code = walSkipFetchBody(pHandle->pWalReader, *ppCkHead); if (code < 0) { ASSERT(0); *fetchOffset = offset; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 9872f26b03..d1d2c55acf 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -287,6 +287,7 @@ typedef struct STableScanInfo { } lastStatus; int8_t scanMode; + int8_t noTable; } STableScanInfo; typedef struct STagScanInfo { diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 8dd8005225..2d5ccf8568 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -235,9 +235,11 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if (uid == 0) { - STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); - uid = pTableInfo->uid; - ts = INT64_MIN; + if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) { + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); + uid = pTableInfo->uid; + ts = INT64_MIN; + } } return doPrepareScan(pTaskInfo->pRoot, uid, ts); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index efa8887ed0..919f30803d 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2828,21 +2828,28 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { pScanInfo->blockType = STREAM_INPUT__DATA_SCAN; STableScanInfo* pInfo = pScanInfo->pSnapshotReadOp->info; + if (uid == 0) { + pInfo->noTable = 1; + return TSDB_CODE_SUCCESS; + } /*if (pSnapShotScanInfo->dataReader == NULL) {*/ /*pSnapShotScanInfo->dataReader = tsdbReaderOpen(pHandle->vnode, &pSTInfo->cond, tableList, 0, 0);*/ /*pSnapShotScanInfo->scanMode = TABLE_SCAN__TABLE_ORDER;*/ /*}*/ + pInfo->noTable = 0; + if (pInfo->lastStatus.uid != uid || pInfo->lastStatus.ts != ts) { tsdbSetTableId(pInfo->dataReader, uid); int64_t oldSkey = pInfo->cond.twindows[0].skey; - pInfo->cond.twindows[0].skey = ts; + pInfo->cond.twindows[0].skey = ts + 1; tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); pInfo->cond.twindows[0].skey = oldSkey; pInfo->scanTimes = 0; pInfo->curTWinIdx = 0; } + return TSDB_CODE_SUCCESS; } else { if (pOperator->numOfDownstream == 1) { @@ -2855,8 +2862,6 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { return TSDB_CODE_QRY_APP_ERROR; } } - - return TSDB_CODE_SUCCESS; } int32_t doGetScanStatus(SOperatorInfo* pOperator, uint64_t* uid, int64_t* ts) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a3af4ab223..f23749dc8c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -518,6 +518,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { // if scan table by table if (pInfo->scanMode == TABLE_SCAN__TABLE_ORDER) { + if (pInfo->noTable) return NULL; while (1) { SSDataBlock* result = doTableScanGroup(pOperator); if (result) { diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index e9b311db9a..529615d4fd 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -88,3 +88,12 @@ SStreamDataSubmit* streamSubmitRefClone(SStreamDataSubmit* pSubmit) { memcpy(pSubmitClone, pSubmit, sizeof(SStreamDataSubmit)); return pSubmitClone; } + +void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { + int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1); + ASSERT(ref >= 0); + if (ref == 0) { + taosMemoryFree(pDataSubmit->data); + taosMemoryFree(pDataSubmit->dataRef); + } +} diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index b3be35fba3..d178c19615 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -63,7 +63,6 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) continue; } - // TODO: do we need free memory? SSDataBlock block = {0}; assignOneDataBlock(&block, output); block.info.childId = pTask->selfChildId; diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index d5a4da60f5..f82ef1b42f 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -41,12 +41,3 @@ void streamQueueClose(SStreamQueue* queue) { return; } } - -void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { - int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1); - ASSERT(ref >= 0); - if (ref == 0) { - taosMemoryFree(pDataSubmit->data); - taosMemoryFree(pDataSubmit->dataRef); - } -} diff --git a/source/libs/wal/inc/walInt.h b/source/libs/wal/inc/walInt.h index 7ca105ff2b..c23d0802c1 100644 --- a/source/libs/wal/inc/walInt.h +++ b/source/libs/wal/inc/walInt.h @@ -27,7 +27,7 @@ extern "C" { #endif // meta section begin -typedef struct WalFileInfo { +typedef struct { int64_t firstVer; int64_t lastVer; int64_t createTs; @@ -98,20 +98,20 @@ static inline int walBuildIdxName(SWal* pWal, int64_t fileFirstVer, char* buf) { return sprintf(buf, "%s/%020" PRId64 "." WAL_INDEX_SUFFIX, pWal->path, fileFirstVer); } -static inline int walValidHeadCksum(SWalHead* pHead) { - return taosCheckChecksum((uint8_t*)&pHead->head, sizeof(SWalReadHead), pHead->cksumHead); +static inline int walValidHeadCksum(SWalCkHead* pHead) { + return taosCheckChecksum((uint8_t*)&pHead->head, sizeof(SWalCont), pHead->cksumHead); } -static inline int walValidBodyCksum(SWalHead* pHead) { +static inline int walValidBodyCksum(SWalCkHead* pHead) { return taosCheckChecksum((uint8_t*)pHead->head.body, pHead->head.bodyLen, pHead->cksumBody); } -static inline int walValidCksum(SWalHead* pHead, void* body, int64_t bodyLen) { +static inline int walValidCksum(SWalCkHead* pHead, void* body, int64_t bodyLen) { return walValidHeadCksum(pHead) && walValidBodyCksum(pHead); } -static inline uint32_t walCalcHeadCksum(SWalHead* pHead) { - return taosCalcChecksum(0, (uint8_t*)&pHead->head, sizeof(SWalReadHead)); +static inline uint32_t walCalcHeadCksum(SWalCkHead* pHead) { + return taosCalcChecksum(0, (uint8_t*)&pHead->head, sizeof(SWalCont)); } static inline uint32_t walCalcBodyCksum(const void* body, uint32_t len) { diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 342ab7b152..313fd06c8e 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -16,7 +16,7 @@ #include "cJSON.h" #include "os.h" #include "taoserror.h" -#include "tref.h" +#include "tutil.h" #include "walInt.h" bool FORCE_INLINE walLogExist(SWal* pWal, int64_t ver) { @@ -37,26 +37,9 @@ static FORCE_INLINE int walBuildMetaName(SWal* pWal, int metaVer, char* buf) { return sprintf(buf, "%s/meta-ver%d", pWal->path, metaVer); } -void* tmemmem(char* haystack, int hlen, char* needle, int nlen) { - char* limit; - - if (nlen == 0 || hlen < nlen) { - return NULL; - } - - limit = haystack + hlen - nlen + 1; - while ((haystack = (char*)memchr(haystack, needle[0], limit - haystack)) != NULL) { - if (memcmp(haystack, needle, nlen) == 0) { - return haystack; - } - haystack++; - } - return NULL; -} - static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) { ASSERT(pWal->fileInfoSet != NULL); - int sz = taosArrayGetSize(pWal->fileInfoSet); + int32_t sz = taosArrayGetSize(pWal->fileInfoSet); ASSERT(sz > 0); #if 0 for (int i = 0; i < sz; i++) { @@ -101,14 +84,14 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) { char* candidate; while ((candidate = tmemmem(haystack, readSize - (haystack - buf), (char*)&magic, sizeof(uint64_t))) != NULL) { // read and validate - SWalHead* logContent = (SWalHead*)candidate; + SWalCkHead* logContent = (SWalCkHead*)candidate; if (walValidHeadCksum(logContent) == 0 && walValidBodyCksum(logContent) == 0) { found = candidate; } haystack = candidate + 1; } if (found == buf) { - SWalHead* logContent = (SWalHead*)found; + SWalCkHead* logContent = (SWalCkHead*)found; if (walValidHeadCksum(logContent) != 0 || walValidBodyCksum(logContent) != 0) { // file has to be deleted taosMemoryFree(buf); @@ -118,7 +101,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) { } } taosCloseFile(&pFile); - SWalHead* lastEntry = (SWalHead*)found; + SWalCkHead* lastEntry = (SWalCkHead*)found; return lastEntry->head.version; } diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 9505b02806..491b982968 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -117,8 +117,8 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) { pWal->lastRollSeq = -1; // init write buffer - memset(&pWal->writeHead, 0, sizeof(SWalHead)); - pWal->writeHead.head.headVer = WAL_HEAD_VER; + memset(&pWal->writeHead, 0, sizeof(SWalCkHead)); + pWal->writeHead.head.protoVer = WAL_PROTO_VER; pWal->writeHead.magic = WAL_MAGIC; if (taosThreadMutexInit(&pWal->mutex, NULL) < 0) { diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 2de0fea9ac..e7f0b31ccc 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -33,7 +33,7 @@ SWalReadHandle *walOpenReadHandle(SWal *pWal) { taosThreadMutexInit(&pRead->mutex, NULL); - pRead->pHead = taosMemoryMalloc(sizeof(SWalHead)); + pRead->pHead = taosMemoryMalloc(sizeof(SWalCkHead)); if (pRead->pHead == NULL) { terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; taosMemoryFree(pRead); @@ -155,7 +155,7 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) { void walSetReaderCapacity(SWalReadHandle *pRead, int32_t capacity) { pRead->capacity = capacity; } -int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) { +int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalCkHead *pHead) { int64_t code; // TODO: valid ver @@ -170,8 +170,8 @@ int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) { ASSERT(taosValidFile(pRead->pReadLogTFile) == true); - code = taosReadFile(pRead->pReadLogTFile, pHead, sizeof(SWalHead)); - if (code != sizeof(SWalHead)) { + code = taosReadFile(pRead->pReadLogTFile, pHead, sizeof(SWalCkHead)); + if (code != sizeof(SWalCkHead)) { return -1; } @@ -186,7 +186,7 @@ int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) { return 0; } -int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalHead *pHead) { +int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalCkHead *pHead) { int64_t code; ASSERT(pRead->curVersion == pHead->head.version); @@ -203,12 +203,12 @@ int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalHead *pHead) { return 0; } -int32_t walFetchBody(SWalReadHandle *pRead, SWalHead **ppHead) { - SWalReadHead *pReadHead = &((*ppHead)->head); - int64_t ver = pReadHead->version; +int32_t walFetchBody(SWalReadHandle *pRead, SWalCkHead **ppHead) { + SWalCont *pReadHead = &((*ppHead)->head); + int64_t ver = pReadHead->version; if (pRead->capacity < pReadHead->bodyLen) { - void *ptr = taosMemoryRealloc(*ppHead, sizeof(SWalHead) + pReadHead->bodyLen); + void *ptr = taosMemoryRealloc(*ppHead, sizeof(SWalCkHead) + pReadHead->bodyLen); if (ptr == NULL) { terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; return -1; @@ -241,18 +241,18 @@ int32_t walFetchBody(SWalReadHandle *pRead, SWalHead **ppHead) { return 0; } -int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalReadHead **ppHead) { +int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalCont **ppHead) { taosThreadMutexLock(&pRead->mutex); if (walReadWithHandle(pRead, ver) < 0) { taosThreadMutexUnlock(&pRead->mutex); return -1; } - *ppHead = taosMemoryMalloc(sizeof(SWalReadHead) + pRead->pHead->head.bodyLen); + *ppHead = taosMemoryMalloc(sizeof(SWalCont) + pRead->pHead->head.bodyLen); if (*ppHead == NULL) { taosThreadMutexUnlock(&pRead->mutex); return -1; } - memcpy(*ppHead, &pRead->pHead->head, sizeof(SWalReadHead) + pRead->pHead->head.bodyLen); + memcpy(*ppHead, &pRead->pHead->head, sizeof(SWalCont) + pRead->pHead->head.bodyLen); taosThreadMutexUnlock(&pRead->mutex); return 0; } @@ -282,8 +282,8 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { ASSERT(taosValidFile(pRead->pReadLogTFile) == true); - code = taosReadFile(pRead->pReadLogTFile, pRead->pHead, sizeof(SWalHead)); - if (code != sizeof(SWalHead)) { + code = taosReadFile(pRead->pReadLogTFile, pRead->pHead, sizeof(SWalCkHead)); + if (code != sizeof(SWalCkHead)) { if (code < 0) terrno = TAOS_SYSTEM_ERROR(errno); else { @@ -301,7 +301,7 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { } if (pRead->capacity < pRead->pHead->head.bodyLen) { - void *ptr = taosMemoryRealloc(pRead->pHead, sizeof(SWalHead) + pRead->pHead->head.bodyLen); + void *ptr = taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + pRead->pHead->head.bodyLen); if (ptr == NULL) { terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; return -1; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index d1295667af..9245c03826 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -142,10 +142,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) { return -1; } // validate offset - SWalHead head; + SWalCkHead head; ASSERT(taosValidFile(pLogTFile)); - int64_t size = taosReadFile(pLogTFile, &head, sizeof(SWalHead)); - if (size != sizeof(SWalHead)) { + int64_t size = taosReadFile(pLogTFile, &head, sizeof(SWalCkHead)); + if (size != sizeof(SWalCkHead)) { return -1; } code = walValidHeadCksum(&head); @@ -261,7 +261,7 @@ int32_t walEndSnapshot(SWal *pWal) { } int walRoll(SWal *pWal) { - int code = 0; + int32_t code = 0; if (pWal->pWriteIdxTFile != NULL) { code = taosCloseFile(&pWal->pWriteIdxTFile); if (code != 0) { @@ -321,12 +321,13 @@ static int walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { return 0; } -int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLogMeta syncMeta, const void *body, +int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLogMeta syncMeta, const void *body, int32_t bodyLen) { - int code = 0; + int32_t code = 0; // no wal if (pWal->cfg.level == TAOS_WAL_NOLOG) return 0; + if (bodyLen > TSDB_MAX_WAL_SIZE) { terrno = TSDB_CODE_WAL_SIZE_LIMIT; return -1; @@ -356,6 +357,7 @@ int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog terrno = TSDB_CODE_WAL_INVALID_VER; return -1; } + /*if (!tfValid(pWal->pWriteLogTFile)) return -1;*/ ASSERT(pWal->writeCur >= 0); @@ -380,7 +382,7 @@ int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog pWal->writeHead.cksumHead = walCalcHeadCksum(&pWal->writeHead); pWal->writeHead.cksumBody = walCalcBodyCksum(body, bodyLen); - if (taosWriteFile(pWal->pWriteLogTFile, &pWal->writeHead, sizeof(SWalHead)) != sizeof(SWalHead)) { + if (taosWriteFile(pWal->pWriteLogTFile, &pWal->writeHead, sizeof(SWalCkHead)) != sizeof(SWalCkHead)) { // TODO ftruncate terrno = TAOS_SYSTEM_ERROR(errno); wError("vgId:%d, file:%" PRId64 ".log, failed to write since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), @@ -405,19 +407,19 @@ int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog // set status if (pWal->vers.firstVer == -1) pWal->vers.firstVer = index; pWal->vers.lastVer = index; - pWal->totSize += sizeof(SWalHead) + bodyLen; + pWal->totSize += sizeof(SWalCkHead) + bodyLen; if (walGetCurFileInfo(pWal)->firstVer == -1) { walGetCurFileInfo(pWal)->firstVer = index; } walGetCurFileInfo(pWal)->lastVer = index; - walGetCurFileInfo(pWal)->fileSize += sizeof(SWalHead) + bodyLen; + walGetCurFileInfo(pWal)->fileSize += sizeof(SWalCkHead) + bodyLen; taosThreadMutexUnlock(&pWal->mutex); return 0; } -int64_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, int32_t bodyLen) { +int32_t walWrite(SWal *pWal, int64_t index, tmsg_t msgType, const void *body, int32_t bodyLen) { SSyncLogMeta syncMeta = { .isWeek = -1, .seqNum = UINT64_MAX, @@ -435,27 +437,3 @@ void walFsync(SWal *pWal, bool forceFsync) { } } } - -/*static int walValidateOffset(SWal* pWal, int64_t ver) {*/ -/*int code = 0;*/ -/*SWalHead *pHead = NULL;*/ -/*code = (int)walRead(pWal, &pHead, ver);*/ -/*if(pHead->head.version != ver) {*/ -/*return -1;*/ -/*}*/ -/*return 0;*/ -/*}*/ - -/*static int64_t walGetOffset(SWal* pWal, int64_t ver) {*/ -/*int code = walSeekVer(pWal, ver);*/ -/*if(code != 0) {*/ -/*return -1;*/ -/*}*/ - -/*code = walValidateOffset(pWal, ver);*/ -/*if(code != 0) {*/ -/*return -1;*/ -/*}*/ - -/*return 0;*/ -/*}*/ diff --git a/source/libs/wal/test/walMetaTest.cpp b/source/libs/wal/test/walMetaTest.cpp index b1c673e87b..89c4fd9ef2 100644 --- a/source/libs/wal/test/walMetaTest.cpp +++ b/source/libs/wal/test/walMetaTest.cpp @@ -148,7 +148,7 @@ TEST_F(WalCleanEnv, createNew) { walRollFileInfo(pWal); ASSERT(pWal->fileInfoSet != NULL); ASSERT_EQ(pWal->fileInfoSet->size, 1); - WalFileInfo* pInfo = (WalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); + SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); ASSERT_EQ(pInfo->firstVer, 0); ASSERT_EQ(pInfo->lastVer, -1); ASSERT_EQ(pInfo->closeTs, -1); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 291d38bdca..65471df0a9 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -300,16 +300,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { return pFile; } -int64_t taosCloseFile(TdFilePtr *ppFile) { +int32_t taosCloseFile(TdFilePtr *ppFile) { + int32_t code = 0; if (ppFile == NULL || *ppFile == NULL) { return 0; } #if FILE_WITH_LOCK taosThreadRwlockWrlock(&((*ppFile)->rwlock)); #endif - if (ppFile == NULL || *ppFile == NULL) { - return 0; - } if ((*ppFile)->fp != NULL) { fflush((*ppFile)->fp); fclose((*ppFile)->fp); @@ -320,9 +318,10 @@ int64_t taosCloseFile(TdFilePtr *ppFile) { HANDLE h = (HANDLE)_get_osfhandle((*ppFile)->fd); !FlushFileBuffers(h); #else - fsync((*ppFile)->fd); + // warning: never fsync silently in base lib + /*fsync((*ppFile)->fd);*/ #endif - close((*ppFile)->fd); + code = close((*ppFile)->fd); (*ppFile)->fd = -1; } (*ppFile)->refId = 0; @@ -332,7 +331,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) { #endif taosMemoryFree(*ppFile); *ppFile = NULL; - return 0; + return code; } int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) { @@ -560,6 +559,8 @@ int32_t taosFsyncFile(TdFilePtr pFile) { return 0; } + // this implementation is WRONG + // fflush is not a replacement of fsync if (pFile->fp != NULL) return fflush(pFile->fp); if (pFile->fd >= 0) { #ifdef WINDOWS diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index ec90e5a9b9..257c1800f2 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -206,11 +206,11 @@ void* taosArrayGetP(const SArray* pArray, size_t index) { void* taosArrayGetLast(const SArray* pArray) { return TARRAY_GET_ELEM(pArray, pArray->size - 1); } -size_t taosArrayGetSize(const SArray* pArray) { +int32_t taosArrayGetSize(const SArray* pArray) { if (pArray == NULL) { return 0; } - return pArray->size; + return (int32_t)pArray->size; } void taosArraySetSize(SArray* pArray, size_t size) { diff --git a/source/util/src/tutil.c b/source/util/src/tutil.c index 0534eb3462..addb9f55ba 100644 --- a/source/util/src/tutil.c +++ b/source/util/src/tutil.c @@ -16,6 +16,23 @@ #define _DEFAULT_SOURCE #include "tutil.h" +void *tmemmem(const char *haystack, int32_t hlen, const char *needle, int32_t nlen) { + const char *limit; + + if (nlen == 0 || hlen < nlen) { + return NULL; + } + + limit = haystack + hlen - nlen + 1; + while ((haystack = (char *)memchr(haystack, needle[0], limit - haystack)) != NULL) { + if (memcmp(haystack, needle, nlen) == 0) { + return (void *)haystack; + } + haystack++; + } + return NULL; +} + int32_t strdequote(char *z) { if (z == NULL) { return 0; From 752e2a3e37470f3c62ec4140788de5a3b332942b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 14:42:24 +0800 Subject: [PATCH 61/68] fix: rollback dnode sort --- source/dnode/mnode/impl/src/mndVgroup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 4b9f925eb5..b66e1e0545 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -426,11 +426,15 @@ static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) { float d1Score = (float)pDnode1->numOfVnodes / pDnode1->numOfSupportVnodes; float d2Score = (float)pDnode2->numOfVnodes / pDnode2->numOfSupportVnodes; +#if 0 if (d1Score == d2Score) { return pDnode2->id - pDnode1->id; } else { return d1Score >= d2Score ? 1 : 0; } +#else + return d1Score >= d2Score ? 1 : 0; +#endif } void mndSortVnodeGid(SVgObj *pVgroup) { From f93c9b11cf17fa64393149f2db90f70e5528a949 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 1 Jul 2022 14:43:59 +0800 Subject: [PATCH 62/68] fix: change tools/taosdumpTestNanoSupport.py keep to 36500 (#14428) for 3.0 --- tests/pytest/tools/taosdumpTestNanoSupport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/tools/taosdumpTestNanoSupport.py b/tests/pytest/tools/taosdumpTestNanoSupport.py index 0101a65407..e96de674d7 100644 --- a/tests/pytest/tools/taosdumpTestNanoSupport.py +++ b/tests/pytest/tools/taosdumpTestNanoSupport.py @@ -60,7 +60,7 @@ class TDTestCase: def build_db(precision, start_time): tdSql.execute("drop database if exists timedb1") tdSql.execute( - "create database timedb1 duration 10 keep 365 blocks 8 precision "+"\""+precision+"\"") + "create database timedb1 duration 10 keep 36500 blocks 8 precision "+"\""+precision+"\"") tdSql.execute("use timedb1") tdSql.execute( From 0ffc6c46f328f3c886159def06ef7721833a4630 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 1 Jul 2022 14:47:12 +0800 Subject: [PATCH 63/68] refactor(sync): add snapshot2 interface --- include/libs/sync/sync.h | 2 +- source/dnode/mnode/impl/src/mndSync.c | 2 +- source/dnode/vnode/src/vnd/vnodeSync.c | 10 +++++----- source/libs/sync/src/syncAppendEntriesReply.c | 2 +- source/libs/sync/test/syncConfigChangeSnapshotTest.cpp | 2 +- source/libs/sync/test/syncSnapshotSenderTest.cpp | 2 +- source/libs/sync/test/syncTestTool.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index bd148fd158..d07cf0adf1 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -121,7 +121,7 @@ typedef struct SSyncFSM { int32_t (*FpGetSnapshot)(struct SSyncFSM* pFsm, SSnapshot* pSnapshot, void* pReaderParam, void** ppReader); int32_t (*FpGetSnapshotInfo)(struct SSyncFSM* pFsm, SSnapshot* pSnapshot); - int32_t (*FpSnapshotStartRead)(struct SSyncFSM* pFsm, void** ppReader); + int32_t (*FpSnapshotStartRead)(struct SSyncFSM* pFsm, void* pReaderParam, void** ppReader); int32_t (*FpSnapshotStopRead)(struct SSyncFSM* pFsm, void* pReader); int32_t (*FpSnapshotDoRead)(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len); diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index c58ce97588..693eed5222 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -117,7 +117,7 @@ void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbM } } -int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void **ppReader) { +int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void **ppReader) { mDebug("start to read snapshot from sdb"); SMnode *pMnode = pFsm->data; return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index f9e811fc32..80ba80e61a 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -119,7 +119,7 @@ static int32_t vnodeProcessAlterReplicaReq(SVnode *pVnode, SRpcMsg *pMsg) { } void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode * pVnode = pInfo->ahandle; + SVnode *pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -199,7 +199,7 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { } void vnodeApplyMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode * pVnode = pInfo->ahandle; + SVnode *pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -240,7 +240,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { STraceId *trace = &pMsg->info.traceId; do { - char * syncNodeStr = sync2SimpleStr(pVnode->sync); + char *syncNodeStr = sync2SimpleStr(pVnode->sync); static int64_t vndTick = 0; if (++vndTick % 10 == 1) { vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); @@ -375,7 +375,7 @@ static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReCon } static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { - SVnode * pVnode = pFsm->data; + SVnode *pVnode = pFsm->data; SSnapshot snapshot = {0}; SyncIndex beginIndex = SYNC_INDEX_INVALID; char logBuf[256] = {0}; @@ -409,7 +409,7 @@ static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg); } -static int32_t vnodeSnapshotStartRead(struct SSyncFSM *pFsm, void **ppReader) { return 0; } +static int32_t vnodeSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void **ppReader) { return 0; } static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) { return 0; } diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 827b2a59a5..629d83eb51 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -120,7 +120,7 @@ static void syncNodeStartSnapshot(SSyncNode* ths, SyncIndex beginIndex, SyncInde void* pReader = NULL; SReaderParam readerParam = {.start = beginIndex, .end = endIndex}; - ths->pFsm->FpSnapshotStartRead(ths->pFsm, &pReader); + ths->pFsm->FpSnapshotStartRead(ths->pFsm, &readerParam, &pReader); if (!snapshotSenderIsStart(pSender) && pMsg->privateTerm < pSender->privateTerm) { ASSERT(pReader != NULL); snapshotSenderStart(pSender, snapshot, pReader); diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index b4f173ff02..2908dd5907 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -77,7 +77,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) { return 0; } -int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void** ppReader) { +int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void *pParam, void** ppReader) { *ppReader = (void*)0xABCD; char logBuf[256] = {0}; snprintf(logBuf, sizeof(logBuf), "==callback== ==SnapshotStartRead== pFsm:%p, *ppReader:%p", pFsm, *ppReader); diff --git a/source/libs/sync/test/syncSnapshotSenderTest.cpp b/source/libs/sync/test/syncSnapshotSenderTest.cpp index 04a02460af..dc38cd3df5 100644 --- a/source/libs/sync/test/syncSnapshotSenderTest.cpp +++ b/source/libs/sync/test/syncSnapshotSenderTest.cpp @@ -25,7 +25,7 @@ void ReConfigCb(struct SSyncFSM* pFsm, SSyncCfg newCfg, SReConfigCbMeta cbMeta) int32_t GetSnapshot(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) { return 0; } -int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void** ppReader) { return 0; } +int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void *pParam, void** ppReader) { return 0; } int32_t SnapshotStopRead(struct SSyncFSM* pFsm, void* pReader) { return 0; } int32_t SnapshotDoRead(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len) { return 0; } diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index 91a16cc033..4e84ff0f7e 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -74,7 +74,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) { return 0; } -int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void** ppReader) { +int32_t SnapshotStartRead(struct SSyncFSM* pFsm, void *pParam, void** ppReader) { *ppReader = (void*)0xABCD; char logBuf[256] = {0}; snprintf(logBuf, sizeof(logBuf), "==callback== ==SnapshotStartRead== pFsm:%p, *ppReader:%p", pFsm, *ppReader); From 629800e43e12a5945c83224fa5535b015936895c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 15:00:44 +0800 Subject: [PATCH 64/68] test: rollback case --- tests/script/tsim/dnode/balance1.sim | 4 ++-- tests/script/tsim/dnode/balance2.sim | 4 ++-- tests/script/tsim/dnode/balance3.sim | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/script/tsim/dnode/balance1.sim b/tests/script/tsim/dnode/balance1.sim index 848c6d424f..6471529a1e 100644 --- a/tests/script/tsim/dnode/balance1.sim +++ b/tests/script/tsim/dnode/balance1.sim @@ -207,10 +207,10 @@ sql drop dnode 3 sql show dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 1 then +if $data(1)[2] != 2 then return -1 endi -if $data(4)[2] != 3 then +if $data(4)[2] != 2 then return -1 endi diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim index da8855ff03..5da9a659f3 100644 --- a/tests/script/tsim/dnode/balance2.sim +++ b/tests/script/tsim/dnode/balance2.sim @@ -167,10 +167,10 @@ endi if $data(3)[2] != 3 then return -1 endi -if $data(4)[2] != 3 then +if $data(4)[2] != 4 then return -1 endi -if $data(5)[2] != 4 then +if $data(5)[2] != 3 then return -1 endi diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim index 2ce3a4d064..f26c0eaa21 100644 --- a/tests/script/tsim/dnode/balance3.sim +++ b/tests/script/tsim/dnode/balance3.sim @@ -309,7 +309,7 @@ print dnode3 openVnodes $data(3)[2] print dnode4 openVnodes $data(4)[2] print dnode5 openVnodes $data(5)[2] print dnode5 openVnodes $data(6)[2] -if $data(1)[2] != 1 then +if $data(1)[2] != 2 then return -1 endi if $data(3)[2] != null then @@ -321,7 +321,7 @@ endi if $data(5)[2] != 3 then return -1 endi -if $data(6)[2] != 3 then +if $data(6)[2] != 2 then return -1 endi From 1003cd8549d45395620692bcba59af9c8ab5038d Mon Sep 17 00:00:00 2001 From: slzhou Date: Fri, 1 Jul 2022 15:25:02 +0800 Subject: [PATCH 65/68] feat: push condition to child projection --- include/common/tdatablock.h | 1 + source/common/src/tdatablock.c | 7 +++++++ source/libs/executor/src/executorimpl.c | 6 ++++-- source/libs/planner/src/planOptimizer.c | 9 ++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 72e0af657c..809521bac5 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -235,6 +235,7 @@ SColumnInfoData* bdGetColumnInfoData(SSDataBlock* pBlock, int32_t index); void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress); const char* blockDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t numOfRows, const char* pData); +void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag); void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag); // for debug char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** dumpBuf); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 7b142e3053..0ff8714709 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1605,6 +1605,13 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { return buf; } +void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag) { + SArray* dataBlocks = taosArrayInit(1, sizeof(SSDataBlock)); + taosArrayPush(dataBlocks, pBlock); + blockDebugShowDataBlocks(dataBlocks, flag); + taosArrayDestroy(dataBlocks); +} + void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) { char pBuf[128] = {0}; int32_t sz = taosArrayGetSize(dataBlocks); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 61bf73c69c..07ce87fbef 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3235,8 +3235,6 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { longjmp(pTaskInfo->env, code); } - doFilter(pProjectInfo->pFilterNode, pBlock); - setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false); blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows); @@ -3247,6 +3245,10 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { } int32_t status = handleLimitOffset(pOperator, pBlock); + + // filter shall be applied after apply functions and limit/offset on the result + doFilter(pProjectInfo->pFilterNode, pInfo->pRes); + if (status == PROJECT_RETRIEVE_CONTINUE) { continue; } else if (status == PROJECT_RETRIEVE_DONE) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index c303c63ab7..87a5096d26 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -476,10 +476,16 @@ static int32_t pushDownCondOptPushCondToScan(SOptimizeContext* pCxt, SScanLogicN return pushDownCondOptAppendCond(&pScan->node.pConditions, pCond); } +static int32_t pushDownCondOptPushCondToProject(SOptimizeContext* pCxt, SProjectLogicNode* pProject, SNode** pCond) { + return pushDownCondOptAppendCond(&pProject->node.pConditions, pCond); +} + static int32_t pushDownCondOptPushCondToChild(SOptimizeContext* pCxt, SLogicNode* pChild, SNode** pCond) { switch (nodeType(pChild)) { case QUERY_NODE_LOGIC_PLAN_SCAN: return pushDownCondOptPushCondToScan(pCxt, (SScanLogicNode*)pChild, pCond); + case QUERY_NODE_LOGIC_PLAN_PROJECT: + return pushDownCondOptPushCondToProject(pCxt, (SProjectLogicNode*)pChild, pCond); default: break; } @@ -713,7 +719,8 @@ static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAg } //TODO: remove it after full implementation of pushing down to child if (1 != LIST_LENGTH(pAgg->node.pChildren) || - QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { + QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pAgg->node.pChildren, 0)) && + QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { return TSDB_CODE_SUCCESS; } From 0cbc22480d71c8d790a39b097cce875ee73a01b3 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Jul 2022 15:26:33 +0800 Subject: [PATCH 66/68] refactor: stable mgmt --- source/libs/parser/test/parInitialCTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index babd096d56..0a980fa889 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -372,7 +372,7 @@ TEST_F(ParserInitialCTest, createStable) { expect.watermark2 = watermark2; // expect.ttl = ttl; if (nullptr != pComment) { - expect.comment = strdup(pComment); + expect.pComment = strdup(pComment); expect.commentLen = strlen(pComment); } }; @@ -443,7 +443,7 @@ TEST_F(ParserInitialCTest, createStable) { } } if (expect.commentLen > 0) { - ASSERT_EQ(std::string(req.comment), std::string(expect.comment)); + ASSERT_EQ(std::string(req.pComment), std::string(expect.pComment)); } if (expect.ast1Len > 0) { ASSERT_EQ(std::string(req.pAst1), std::string(expect.pAst1)); From 58e29bbe9b920c1111369c3b9b798c34c528eed6 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Jul 2022 15:46:33 +0800 Subject: [PATCH 67/68] test: modify test case --- tests/system-test/7-tmq/subscribeDb2.py | 17 ++++-- tests/system-test/7-tmq/tmqConsFromTsdb.py | 68 +++++++++++----------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/tests/system-test/7-tmq/subscribeDb2.py b/tests/system-test/7-tmq/subscribeDb2.py index af31e802b3..78aaa2634c 100644 --- a/tests/system-test/7-tmq/subscribeDb2.py +++ b/tests/system-test/7-tmq/subscribeDb2.py @@ -5,6 +5,7 @@ import time import socket import os import threading +import math from util.log import * from util.sql import * @@ -127,10 +128,14 @@ class TDTestCase: #tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows)) for i in range(ctbNum): sql += " %s_%d values "%(stbName,i) + batchRows = 0 for j in range(rowsPerTbl): sql += "(%d, %d, 'tmqrow_%d') "%(startTs + j, j, j) - if (j > 0) and ((j%batchNum == 0) or (j == rowsPerTbl - 1)): + batchRows += 1 + # if (j > 0) and ((j%(batchNum-1) == 0) or (j == rowsPerTbl - 1)): + if (j > 0) and ((batchRows == batchNum) or (j == rowsPerTbl - 1)): tsql.execute(sql) + batchRows = 0 if j < rowsPerTbl - 1: sql = "insert into %s_%d values " %(stbName,i) else: @@ -171,8 +176,8 @@ class TDTestCase: 'dbName': 'db8', \ 'vgroups': 4, \ 'stbName': 'stb', \ - 'ctbNum': 10, \ - 'rowsPerTbl': 10000, \ + 'ctbNum': 1, \ + 'rowsPerTbl': 1000, \ 'batchNum': 100, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath @@ -189,7 +194,7 @@ class TDTestCase: tdSql.execute("create topic %s as database %s" %(topicName1, parameterDict['dbName'])) consumerId = 0 - expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2 + expectrowcnt = math.ceil(parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2) topicList = topicName1 ifcheckdata = 0 ifManualCommit = 0 @@ -217,7 +222,7 @@ class TDTestCase: for i in range(expectRows): totalConsumeRows += resultList[i] - if totalConsumeRows != expectrowcnt: + if not (totalConsumeRows >= expectrowcnt): tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -267,7 +272,7 @@ class TDTestCase: tdSql.execute("create topic %s as database %s" %(topicName1, parameterDict['dbName'])) consumerId = 0 - expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2 + expectrowcnt = math.ceil(parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2) topicList = topicName1 ifcheckdata = 0 ifManualCommit = 1 diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb.py b/tests/system-test/7-tmq/tmqConsFromTsdb.py index 9cd62feee6..ae0e658344 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb.py @@ -5,6 +5,7 @@ import time import socket import os import threading +import math from util.log import * from util.sql import * @@ -15,6 +16,11 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: + def __int__(self): + self.vgroups = 1 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor(), False) @@ -40,6 +46,10 @@ class TDTestCase: 'showRow': 1, 'snapshot': 1} + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + topicNameList = ['topic1'] expectRowsList = [] tmqCom.initConsumerTable() @@ -113,6 +123,10 @@ class TDTestCase: 'showRow': 1, 'snapshot': 1} + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + topicNameList = ['topic1'] expectRowsList = [] tmqCom.initConsumerTable() @@ -140,7 +154,7 @@ class TDTestCase: # init consume info, and start tmq_sim, then check consume result tdLog.info("insert consume info to consume processor") consumerId = 1 - expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3) topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 @@ -163,7 +177,7 @@ class TDTestCase: # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() consumerId = 2 - expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3) tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor 1") @@ -176,8 +190,8 @@ class TDTestCase: actConsumeTotalRows = firstConsumeRows + resultList[0] if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): - tdLog.info("act consume rows: %d, expect consume rows <= %d "%(resultList[0], expectrowcnt)) - tdLog.info("and sum of two consume rows: %d , total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + tdLog.info("act consume rows, first: %d, second: %d "%(firstConsumeRows, resultList[0])) + tdLog.info("and sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) @@ -198,15 +212,19 @@ class TDTestCase: 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', - 'ctbNum': 10, + 'ctbNum': 1, 'rowsPerTbl': 10000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 3, + 'pollDelay': -1, 'showMsg': 1, 'showRow': 1, 'snapshot': 1} + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + topicNameList = ['topic1'] expectRowsList = [] tmqCom.initConsumerTable() @@ -229,49 +247,33 @@ class TDTestCase: tdSql.execute(sqlString) tdSql.query(queryString) expectRowsList.append(tdSql.getRows()) - totalRowsInserted = expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + totalRowsInserted = expectRowsList[0] # init consume info, and start tmq_sim, then check consume result tdLog.info("insert consume info to consume processor") consumerId = 3 - expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3) topicList = topicNameList[0] ifcheckdata = 1 ifManualCommit = 1 keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + consumerId = 4 + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3) + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + tdLog.info("start consume processor 0") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) tdLog.info("wait the consume result") - expectRows = 1 + expectRows = 2 resultList = tmqCom.selectConsumeResult(expectRows) + actConsumeTotalRows = resultList[0] + resultList[1] - if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]): - tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) - tdLog.exit("0 tmq consume rows error!") - - firstConsumeRows = resultList[0] - - # reinit consume info, and start tmq_sim, then check consume result - tmqCom.initConsumerTable() - consumerId = 4 - expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) - tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - - tdLog.info("start consume processor 1") - tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) - tdLog.info("wait the consume result") - - expectRows = 1 - resultList = tmqCom.selectConsumeResult(expectRows) - - actConsumeTotalRows = firstConsumeRows + resultList[0] - - if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): - tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) - tdLog.exit("0 tmq consume rows error!") + if not (totalRowsInserted == actConsumeTotalRows): + tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + tdLog.exit("%d tmq consume rows error!"%consumerId) time.sleep(10) for i in range(len(topicNameList)): From 3f16edebe1e2bcdd3de3855e8719f40107aac921 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Jul 2022 16:25:11 +0800 Subject: [PATCH 68/68] fix: return correct size type --- include/util/tarray.h | 2 +- source/util/src/tarray.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/tarray.h b/include/util/tarray.h index e8037699ae..482f13de39 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -139,7 +139,7 @@ void* taosArrayGetLast(const SArray* pArray); * @param pArray * @return */ -int32_t taosArrayGetSize(const SArray* pArray); +size_t taosArrayGetSize(const SArray* pArray); /** * set the size of array diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index d16d0e610a..23e79da948 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -206,11 +206,11 @@ void* taosArrayGetP(const SArray* pArray, size_t index) { void* taosArrayGetLast(const SArray* pArray) { return TARRAY_GET_ELEM(pArray, pArray->size - 1); } -int32_t taosArrayGetSize(const SArray* pArray) { +size_t taosArrayGetSize(const SArray* pArray) { if (pArray == NULL) { return 0; } - return (int32_t)pArray->size; + return pArray->size; } void taosArraySetSize(SArray* pArray, size_t size) {