From a657413fa6f30f2f6c862a98a4ca4de1af854d8e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Jul 2022 11:10:35 +0800 Subject: [PATCH 01/63] enh: kill query --- source/client/src/clientEnv.c | 19 ++++++- source/libs/scheduler/src/schJob.c | 6 +- tests/script/api/stopquery.c | 91 ++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index a234311569..fefabf6539 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -153,7 +153,13 @@ void destroyAppInst(SAppInstInfo *pAppInfo) { } void destroyTscObj(void *pObj) { + if (NULL == pObj) { + return; + } + STscObj *pTscObj = pObj; + int64_t tscId = pTscObj->id; + tscDebug("begin to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey); @@ -168,6 +174,8 @@ void destroyTscObj(void *pObj) { } taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFreeClear(pTscObj); + + tscDebug("end to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); } void *createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo) { @@ -261,9 +269,14 @@ int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, ri int32_t removeRequest(int64_t rid) { return taosRemoveRef(clientReqRefPool, rid); } void doDestroyRequest(void *p) { - assert(p != NULL); + if (NULL == p) { + return; + } + SRequestObj *pRequest = (SRequestObj *)p; - + int64_t reqId = pRequest->self; + tscDebug("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest); + taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); if (pRequest->body.queryJob != 0) { @@ -285,6 +298,8 @@ void doDestroyRequest(void *p) { deregisterRequest(pRequest); } taosMemoryFreeClear(pRequest); + + tscDebug("end to destroy request %" PRIx64 " p:%p", reqId, pRequest); } void destroyRequest(SRequestObj *pRequest) { diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 425ea242fd..5d5dc745d0 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1495,6 +1495,8 @@ void schFreeJobImpl(void *job) { uint64_t queryId = pJob->queryId; int64_t refId = pJob->refId; + qDebug("QID:0x%" PRIx64 " begin to free sch job, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); + if (pJob->status == JOB_TASK_STATUS_EXECUTING) { schCancelJob(pJob); } @@ -1535,12 +1537,12 @@ void schFreeJobImpl(void *job) { taosMemoryFreeClear(pJob->resData); taosMemoryFree(pJob); - qDebug("QID:0x%" PRIx64 " sch job freed, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); - int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); if (jobNum == 0) { schCloseJobRef(); } + + qDebug("QID:0x%" PRIx64 " sch job freed, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); } int32_t schLaunchStaticExplainJob(SSchedulerReq *pReq, SSchJob *pJob, bool sync) { diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index 4c7964c983..72fe4c406a 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -156,6 +156,28 @@ void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) { } } +void sqKillFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + taos_kill_query(qParam->taos); + + *qParam->end = 1; +} + +void sqKillQueryCb(void *param, TAOS_RES *pRes, int code) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (code == 0 && pRes) { + if (qParam->fetch) { + taos_fetch_rows_a(pRes, sqKillFetchCb, param); + } else { + taos_kill_query(qParam->taos); + *qParam->end = 1; + } + } else { + sqExit("select", taos_errstr(pRes)); + } +} + + int sqSyncStopQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { @@ -391,6 +413,69 @@ int sqConSyncCloseQuery(bool fetch) { CASE_LEAVE(); } +int sqSyncKillQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + TAOS_RES* pRes = taos_query(taos, sql); + code = taos_errno(pRes); + if (code) { + sqExit("taos_query", taos_errstr(pRes)); + } + + if (fetch) { + taos_fetch_row(pRes); + } + + taos_kill_query(taos); + + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqAsyncKillQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + + int32_t qEnd = 0; + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + param.end = &qEnd; + taos_query_a(taos, sql, sqKillQueryCb, ¶m); + while (0 == qEnd) { + usleep(5000); + } + + taos_close(taos); + } + CASE_LEAVE(); +} + + void sqRunAllCase(void) { /* sqSyncStopQuery(false); @@ -409,8 +494,14 @@ void sqRunAllCase(void) { sqAsyncCloseQuery(true); */ sqConSyncCloseQuery(false); +/* sqConSyncCloseQuery(true); + sqSyncKillQuery(false); + sqSyncKillQuery(true); + sqAsyncKillQuery(false); + sqAsyncKillQuery(true); +*/ } From 3f8efa106ac1327028eaba711a7443d700cc47fb Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Jul 2022 11:27:30 +0800 Subject: [PATCH 02/63] fix brokenlink 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 a239e6bbcb..33765b1f96 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1068,7 +1068,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { if (retry) { pMsg->sent = 0; pCtx->retryCnt += 1; - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK) { cliCompareAndSwap(&pCtx->retryLimit, TRANS_RETRY_COUNT_LIMIT, EPSET_GET_SIZE(&pCtx->epSet) * 3); if (pCtx->retryCnt < pCtx->retryLimit) { transUnrefCliHandle(pConn); From b2be5169ab69781909f384cbf8d5b446afef0a75 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Jul 2022 15:11:24 +0800 Subject: [PATCH 03/63] add inst ref --- include/libs/transport/trpc.h | 15 ++++++----- source/libs/transport/inc/transComm.h | 21 ++++++++------- source/libs/transport/src/trans.c | 14 +++++----- source/libs/transport/src/transCli.c | 35 +++++++++++++++--------- source/libs/transport/src/transComm.c | 30 ++++++++++++--------- source/libs/transport/src/transSvr.c | 38 +++++++++++++-------------- 6 files changed, 89 insertions(+), 64 deletions(-) diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h index 8471aa8286..48550b890a 100644 --- a/include/libs/transport/trpc.h +++ b/include/libs/transport/trpc.h @@ -110,12 +110,15 @@ typedef struct { } SRpcCtx; int32_t rpcInit(); -void rpcCleanup(); -void * rpcOpen(const SRpcInit *pRpc); -void rpcClose(void *); -void * rpcMallocCont(int32_t contLen); -void rpcFreeCont(void *pCont); -void * rpcReallocCont(void *ptr, int32_t contLen); + +void rpcCleanup(); +void *rpcOpen(const SRpcInit *pRpc); + +void rpcClose(void *); +void rpcCloseImpl(void *); +void *rpcMallocCont(int32_t contLen); +void rpcFreeCont(void *pCont); +void *rpcReallocCont(void *ptr, int32_t contLen); // Because taosd supports multi-process mode // These functions should not be used on the server side diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index b06d541b75..f699df6883 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -253,7 +253,7 @@ int transAsyncSend(SAsyncPool* pool, queue* mq); do { \ if (id > 0) { \ tTrace("handle step1"); \ - SExHandle* exh2 = transAcquireExHandle(id); \ + SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), id); \ if (exh2 == NULL || id != exh2->refId) { \ tTrace("handle %p except, may already freed, ignore msg, ref1: %" PRIu64 ", ref2 : %" PRIu64 "", exh1, \ exh2 ? exh2->refId : 0, id); \ @@ -261,7 +261,7 @@ int transAsyncSend(SAsyncPool* pool, queue* mq); } \ } else if (id == 0) { \ tTrace("handle step2"); \ - SExHandle* exh2 = transAcquireExHandle(id); \ + SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), id); \ if (exh2 == NULL || id == exh2->refId) { \ tTrace("handle %p except, may already freed, ignore msg, ref1: %" PRIu64 ", ref2 : %" PRIu64 "", exh1, id, \ exh2 ? exh2->refId : 0); \ @@ -391,13 +391,16 @@ void transThreadOnce(); void transInit(); void transCleanup(); -int32_t transOpenExHandleMgt(int size); -void transCloseExHandleMgt(); -int64_t transAddExHandle(void* p); -int32_t transRemoveExHandle(int64_t refId); -SExHandle* transAcquireExHandle(int64_t refId); -int32_t transReleaseExHandle(int64_t refId); -void transDestoryExHandle(void* handle); +int32_t transOpenRefMgt(int size, void (*func)(void*)); +void transCloseRefMgt(int32_t refMgt); +int64_t transAddExHandle(int32_t refMgt, void* p); +int32_t transRemoveExHandle(int32_t refMgt, int64_t refId); +void* transAcquireExHandle(int32_t refMgt, int64_t refId); +int32_t transReleaseExHandle(int32_t refMgt, int64_t refId); +void transDestoryExHandle(void* handle); + +int32_t transGetRefMgt(); +int32_t transGetInstMgt(); #ifdef __cplusplus } diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index 936cfe870d..c970440d47 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -76,16 +76,19 @@ void* rpcOpen(const SRpcInit* pInit) { if (pInit->user) { memcpy(pRpc->user, pInit->user, strlen(pInit->user)); } - return pRpc; + int64_t refId = taosAddRef(transGetInstMgt(), pRpc); + return (void*)refId; } void rpcClose(void* arg) { tInfo("start to close rpc"); + taosRemoveRef(transGetInstMgt(), (int64_t)arg); + tInfo("finish to close rpc"); + return; +} +void rpcCloseImpl(void* arg) { SRpcInfo* pRpc = (SRpcInfo*)arg; (*taosCloseHandle[pRpc->connType])(pRpc->tcphandle); taosMemoryFree(pRpc); - tInfo("finish to close rpc"); - - return; } void* rpcMallocCont(int32_t contLen) { @@ -140,11 +143,10 @@ void rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) { transSendRecv(shandle, pEpSet, pMsg, pRsp); } -void rpcSendResponse(const SRpcMsg* pMsg) { transSendResponse(pMsg); } +void rpcSendResponse(const SRpcMsg* pMsg) { transSendResponse(pMsg); } int32_t rpcGetConnInfo(void* thandle, SRpcConnInfo* pInfo) { return 0; } - void rpcRefHandle(void* handle, int8_t type) { assert(type == TAOS_CONN_SERVER || type == TAOS_CONN_CLIENT); (*taosRefHandle[type])(handle); diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 33765b1f96..bda40cbc2a 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -501,13 +501,13 @@ static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port) { } static void allocConnRef(SCliConn* conn, bool update) { if (update) { - transRemoveExHandle(conn->refId); + transRemoveExHandle(transGetRefMgt(), conn->refId); conn->refId = -1; } SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); exh->handle = conn; exh->pThrd = conn->hostThrd; - exh->refId = transAddExHandle(exh); + exh->refId = transAddExHandle(transGetRefMgt(), exh); conn->refId = exh->refId; } static void addConnToPool(void* pool, SCliConn* conn) { @@ -601,7 +601,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); QUEUE_REMOVE(&conn->conn); QUEUE_INIT(&conn->conn); - transRemoveExHandle(conn->refId); + transRemoveExHandle(transGetRefMgt(), conn->refId); conn->refId = -1; if (clear) { @@ -619,7 +619,7 @@ static void cliDestroy(uv_handle_t* handle) { } SCliConn* conn = handle->data; - transRemoveExHandle(conn->refId); + transRemoveExHandle(transGetRefMgt(), conn->refId); taosMemoryFree(conn->ip); conn->stream->data = NULL; taosMemoryFree(conn->stream); @@ -747,7 +747,7 @@ static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd) { } static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) { int64_t refId = (int64_t)(pMsg->msg.info.handle); - SExHandle* exh = transAcquireExHandle(refId); + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); if (exh == NULL) { tDebug("%" PRId64 " already release", refId); } @@ -773,7 +773,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) { SCliConn* conn = NULL; int64_t refId = (int64_t)(pMsg->msg.info.handle); if (refId != 0) { - SExHandle* exh = transAcquireExHandle(refId); + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); if (exh == NULL) { *ignore = true; destroyCmsg(pMsg); @@ -781,7 +781,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) { // assert(0); } else { conn = exh->handle; - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); } return conn; }; @@ -1154,12 +1154,12 @@ void transUnrefCliHandle(void* handle) { } SCliThrd* transGetWorkThrdFromHandle(int64_t handle) { SCliThrd* pThrd = NULL; - SExHandle* exh = transAcquireExHandle(handle); + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle); if (exh == NULL) { return NULL; } pThrd = exh->pThrd; - transReleaseExHandle(handle); + transReleaseExHandle(transGetRefMgt(), handle); return pThrd; } SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle) { @@ -1186,10 +1186,13 @@ void transReleaseCliHandle(void* handle) { } void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { - STrans* pTransInst = (STrans*)shandle; + STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); + if (pTransInst == NULL) return; + SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); if (pThrd == NULL) { transFreeMsg(pReq->pCont); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return; } @@ -1215,14 +1218,18 @@ void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra tGTrace("%s send request at thread:%08" PRId64 ", dst: %s:%d, app:%p", transLabel(pTransInst), pThrd->pid, EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); ASSERT(transAsyncSend(pThrd->asyncPool, &(cliMsg->q)) == 0); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return; } void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp) { - STrans* pTransInst = (STrans*)shandle; + STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); + if (pTransInst == NULL) return; + SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); if (pThrd == NULL) { transFreeMsg(pReq->pCont); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return; } tsem_t* sem = taosMemoryCalloc(1, sizeof(tsem_t)); @@ -1252,13 +1259,16 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM tsem_wait(sem); tsem_destroy(sem); taosMemoryFree(sem); + + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return; } /* * **/ void transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { - STrans* pTransInst = shandle; + STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); + if (pTransInst == NULL) return; SCvtAddr cvtAddr = {0}; if (ip != NULL && fqdn != NULL) { @@ -1279,5 +1289,6 @@ void transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { transAsyncSend(thrd->asyncPool, &(cliMsg->q)); } + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); } #endif diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 85a45ec921..676985b31c 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -19,6 +19,7 @@ static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; static int32_t refMgt; +int32_t instMgt; int transAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey) { T_MD5_CTX context; @@ -481,44 +482,49 @@ bool transEpSetIsEqual(SEpSet* a, SEpSet* b) { } static void transInitEnv() { - refMgt = transOpenExHandleMgt(50000); + refMgt = transOpenRefMgt(50000, transDestoryExHandle); + instMgt = taosOpenRef(50, rpcCloseImpl); uv_os_setenv("UV_TCP_SINGLE_ACCEPT", "1"); } static void transDestroyEnv() { - // close ref - transCloseExHandleMgt(refMgt); + transCloseRefMgt(refMgt); + transCloseRefMgt(instMgt); } void transInit() { // init env taosThreadOnce(&transModuleInit, transInitEnv); } + +int32_t transGetRefMgt() { return refMgt; } +int32_t transGetInstMgt() { return instMgt; } + void transCleanup() { // clean env transDestroyEnv(); } -int32_t transOpenExHandleMgt(int size) { +int32_t transOpenRefMgt(int size, void (*func)(void*)) { // added into once later - return taosOpenRef(size, transDestoryExHandle); + return taosOpenRef(size, func); } -void transCloseExHandleMgt() { +void transCloseRefMgt(int32_t mgt) { // close ref - taosCloseRef(refMgt); + taosCloseRef(mgt); } -int64_t transAddExHandle(void* p) { +int64_t transAddExHandle(int32_t refMgt, void* p) { // acquire extern handle return taosAddRef(refMgt, p); } -int32_t transRemoveExHandle(int64_t refId) { +int32_t transRemoveExHandle(int32_t refMgt, int64_t refId) { // acquire extern handle return taosRemoveRef(refMgt, refId); } -SExHandle* transAcquireExHandle(int64_t refId) { +void* transAcquireExHandle(int32_t refMgt, int64_t refId) { // acquire extern handle - return (SExHandle*)taosAcquireRef(refMgt, refId); + return (void*)taosAcquireRef(refMgt, refId); } -int32_t transReleaseExHandle(int64_t refId) { +int32_t transReleaseExHandle(int32_t refMgt, int64_t refId) { // release extern handle return taosReleaseRef(refMgt, refId); } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index d32156dd0d..da1a37917f 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -261,7 +261,7 @@ static void uvHandleReq(SSvrConn* pConn) { // 2. once send out data, cli conn released to conn pool immediately // 3. not mixed with persist transMsg.info.ahandle = (void*)pHead->ahandle; - transMsg.info.handle = (void*)transAcquireExHandle(pConn->refId); + transMsg.info.handle = (void*)transAcquireExHandle(transGetRefMgt(), pConn->refId); transMsg.info.refId = pConn->refId; transMsg.info.traceId = pHead->traceId; @@ -279,7 +279,7 @@ static void uvHandleReq(SSvrConn* pConn) { pConnInfo->clientPort = ntohs(pConn->addr.sin_port); tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user)); - transReleaseExHandle(pConn->refId); + transReleaseExHandle(transGetRefMgt(), pConn->refId); STrans* pTransInst = pConn->pTransInst; (*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL); @@ -507,15 +507,15 @@ void uvWorkerAsyncCb(uv_async_t* handle) { SExHandle* exh1 = transMsg.info.handle; int64_t refId = transMsg.info.refId; - SExHandle* exh2 = transAcquireExHandle(refId); + SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), refId); if (exh2 == NULL || exh1 != exh2) { tTrace("handle except msg %p, ignore it", exh1); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); destroySmsg(msg); continue; } msg->pConn = exh1->handle; - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); (*transAsyncHandle[msg->type])(msg, pThrd); } } @@ -757,8 +757,8 @@ static SSvrConn* createConn(void* hThrd) { SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); exh->handle = pConn; exh->pThrd = pThrd; - exh->refId = transAddExHandle(exh); - transAcquireExHandle(exh->refId); + exh->refId = transAddExHandle(transGetRefMgt(), exh); + transAcquireExHandle(transGetRefMgt(), exh->refId); pConn->refId = exh->refId; transRefSrvHandle(pConn); @@ -789,14 +789,14 @@ static void destroyConnRegArg(SSvrConn* conn) { } } static int reallocConnRef(SSvrConn* conn) { - transReleaseExHandle(conn->refId); - transRemoveExHandle(conn->refId); + transReleaseExHandle(transGetRefMgt(), conn->refId); + transRemoveExHandle(transGetRefMgt(), conn->refId); // avoid app continue to send msg on invalid handle SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); exh->handle = conn; exh->pThrd = conn->hostThrd; - exh->refId = transAddExHandle(exh); - transAcquireExHandle(exh->refId); + exh->refId = transAddExHandle(transGetRefMgt(), exh); + transAcquireExHandle(transGetRefMgt(), exh->refId); conn->refId = exh->refId; return 0; @@ -808,8 +808,8 @@ static void uvDestroyConn(uv_handle_t* handle) { } SWorkThrd* thrd = conn->hostThrd; - transReleaseExHandle(conn->refId); - transRemoveExHandle(conn->refId); + transReleaseExHandle(transGetRefMgt(), conn->refId); + transRemoveExHandle(transGetRefMgt(), conn->refId); tDebug("%s conn %p destroy", transLabel(thrd->pTransInst), conn); transQueueDestroy(&conn->srvMsgs); @@ -1045,11 +1045,11 @@ void transReleaseSrvHandle(void* handle) { tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return1: tTrace("handle %p failed to send to release handle", exh); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return2: tTrace("handle %p failed to send to release handle", exh); @@ -1074,12 +1074,12 @@ void transSendResponse(const STransMsg* msg) { STraceId* trace = (STraceId*)&msg->info.traceId; tGTrace("conn %p start to send resp (1/2)", exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return1: tTrace("handle %p failed to send resp", exh); rpcFreeCont(msg->pCont); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return2: tTrace("handle %p failed to send resp", exh); @@ -1103,13 +1103,13 @@ void transRegisterMsg(const STransMsg* msg) { tTrace("%s conn %p start to register brokenlink callback", transLabel(pThrd->pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return1: tTrace("handle %p failed to register brokenlink", exh); rpcFreeCont(msg->pCont); - transReleaseExHandle(refId); + transReleaseExHandle(transGetRefMgt(), refId); return; _return2: tTrace("handle %p failed to register brokenlink", exh); From 817a319a2ef31e4392d9bc7f80982a4c03ab9e55 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Jul 2022 21:01:35 +0800 Subject: [PATCH 04/63] enh: kill query --- include/libs/scheduler/scheduler.h | 2 +- source/client/inc/clientInt.h | 3 +- source/client/src/clientEnv.c | 44 ++-- source/client/src/clientImpl.c | 13 +- source/client/src/clientMain.c | 8 +- source/libs/scheduler/src/schJob.c | 17 +- source/libs/scheduler/src/schRemote.c | 6 +- source/libs/scheduler/src/scheduler.c | 23 +- source/libs/scheduler/test/schedulerTests.cpp | 10 +- tests/script/api/stopquery.c | 202 +++++++++++++++--- 10 files changed, 238 insertions(+), 90 deletions(-) diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index be3d16ab0d..1c73b2c2c8 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -130,7 +130,7 @@ void schedulerStopQueryHb(void *pTrans); * Free the query job * @param pJob */ -void schedulerFreeJob(int64_t job, int32_t errCode); +void schedulerFreeJob(int64_t* job, int32_t errCode); void schedulerDestroy(void); diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 53292ed46a..737fee5125 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -337,7 +337,8 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp); SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key); void appHbMgrCleanup(void); void hbRemoveAppHbMrg(SAppHbMgr **pAppHbMgr); -void closeAllRequests(SHashObj *pRequests); +void destroyAllRequests(SHashObj *pRequests); +void stopAllRequests(SHashObj *pRequests); // conn level int hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index fefabf6539..9e72e5fe35 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -121,17 +121,37 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { return pDnodeConn; } -void closeAllRequests(SHashObj *pRequests) { +void destroyAllRequests(SHashObj *pRequests) { void *pIter = taosHashIterate(pRequests, NULL); while (pIter != NULL) { int64_t *rid = pIter; - removeRequest(*rid); + SRequestObj *pRequest = acquireRequest(*rid); + if (pRequest) { + destroyRequest(pRequest); + releaseRequest(*rid); + } pIter = taosHashIterate(pRequests, pIter); } } +void stopAllRequests(SHashObj *pRequests) { + void *pIter = taosHashIterate(pRequests, NULL); + while (pIter != NULL) { + int64_t *rid = pIter; + + SRequestObj *pRequest = acquireRequest(*rid); + if (pRequest) { + taos_stop_query(pRequest); + releaseRequest(*rid); + } + + pIter = taosHashIterate(pRequests, pIter); + } +} + + void destroyAppInst(SAppInstInfo *pAppInfo) { tscDebug("destroy app inst mgr %p", pAppInfo); @@ -159,12 +179,12 @@ void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; int64_t tscId = pTscObj->id; - tscDebug("begin to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); + tscTrace("begin to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey); int64_t connNum = atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); - closeAllRequests(pTscObj->pRequests); + destroyAllRequests(pTscObj->pRequests); schedulerStopQueryHb(pTscObj->pAppInfo->pTransporter); tscDebug("connObj 0x%" PRIx64 " p:%p destroyed, remain inst totalConn:%" PRId64, pTscObj->id, pTscObj, pTscObj->pAppInfo->numOfConns); @@ -173,9 +193,9 @@ void destroyTscObj(void *pObj) { destroyAppInst(pTscObj->pAppInfo); } taosThreadMutexDestroy(&pTscObj->mutex); - taosMemoryFreeClear(pTscObj); + taosMemoryFree(pTscObj); - tscDebug("end to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); + tscTrace("end to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); } void *createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo) { @@ -275,13 +295,11 @@ void doDestroyRequest(void *p) { SRequestObj *pRequest = (SRequestObj *)p; int64_t reqId = pRequest->self; - tscDebug("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest); + tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest); taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - } + schedulerFreeJob(&pRequest->body.queryJob, 0); taosMemoryFreeClear(pRequest->msgBuf); taosMemoryFreeClear(pRequest->sqlstr); @@ -297,9 +315,9 @@ void doDestroyRequest(void *p) { if (pRequest->self) { deregisterRequest(pRequest); } - taosMemoryFreeClear(pRequest); + taosMemoryFree(pRequest); - tscDebug("end to destroy request %" PRIx64 " p:%p", reqId, pRequest); + tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest); } void destroyRequest(SRequestObj *pRequest) { @@ -307,6 +325,8 @@ void destroyRequest(SRequestObj *pRequest) { return; } + taos_stop_query(pRequest); + removeRequest(pRequest->self); } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b6009ebbda..26fb81a48d 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -645,9 +645,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList pRequest->body.resInfo.execRes = res.res; if (code != TSDB_CODE_SUCCESS) { - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - } + schedulerFreeJob(&pRequest->body.queryJob, 0); pRequest->code = code; terrno = code; @@ -658,9 +656,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList TDMT_VND_CREATE_TABLE == pRequest->type) { pRequest->body.resInfo.numOfRows = res.numOfRows; - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - } + schedulerFreeJob(&pRequest->body.queryJob, 0); } pRequest->code = res.code; @@ -791,10 +787,7 @@ void schedulerExecCb(SQueryResult* pResult, void* param, int32_t code) { TDMT_VND_CREATE_TABLE == pRequest->type) { pRequest->body.resInfo.numOfRows = pResult->numOfRows; - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - pRequest->body.queryJob = 0; - } + schedulerFreeJob(&pRequest->body.queryJob, 0); } tscDebug("0x%" PRIx64 " enter scheduler exec cb, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index d8a9ce581a..d824ef998f 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -196,10 +196,10 @@ void taos_kill_query(TAOS *taos) { if (NULL == taos) { return; } - int64_t rid = *(int64_t*)taos; + int64_t rid = *(int64_t*)taos; STscObj* pTscObj = acquireTscObj(rid); - closeAllRequests(pTscObj->pRequests); + stopAllRequests(pTscObj->pRequests); releaseTscObj(rid); } @@ -480,9 +480,7 @@ void taos_stop_query(TAOS_RES *res) { return; } - if (pRequest->body.queryJob) { - schedulerFreeJob(pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED); - } + schedulerFreeJob(&pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED); tscDebug("request %" PRIx64 " killed", pRequest->requestId); } diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 5d5dc745d0..c75787665d 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -184,9 +184,7 @@ FORCE_INLINE bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus) { } if ((*pJob->chkKillFp)(pJob->chkKillParam)) { - schUpdateJobStatus(pJob, JOB_TASK_STATUS_DROPPING); schUpdateJobErrCode(pJob, TSDB_CODE_TSC_QUERY_KILLED); - return true; } @@ -811,14 +809,6 @@ int32_t schMoveTaskToExecList(SSchJob *pJob, SSchTask *pTask, bool *moved) { */ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bool *needRetry) { - int8_t status = 0; - - if (schJobNeedToStop(pJob, &status)) { - *needRetry = false; - SCH_TASK_DLOG("task no more retry cause of job status, job status:%s", jobTaskStatusStr(status)); - return TSDB_CODE_SUCCESS; - } - if (TSDB_CODE_SCH_TIMEOUT_ERROR == errCode) { pTask->maxExecTimes++; if (pTask->timeoutUsec < SCH_MAX_TASK_TIMEOUT_USEC) { @@ -1277,7 +1267,7 @@ 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", + qDebug("QID:0x%" 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); @@ -1689,11 +1679,6 @@ _return: int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, 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->execId + 1) >= pTask->maxExecTimes) { SCH_TASK_DLOG("task no more retry since reach max try times, execId:%d", pTask->execId); diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 69e41d3111..fd51bf9511 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -401,12 +401,16 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { goto _return; } - code = schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode); + schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode); pMsg->pData = NULL; _return: if (pTask) { + if (code) { + schProcessOnTaskFailure(pJob, pTask, code); + } + SCH_UNLOCK_TASK(pTask); } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 74ddc89b40..e2389c2a75 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -225,26 +225,33 @@ void schedulerStopQueryHb(void *pTrans) { schCleanClusterHb(pTrans); } -void schedulerFreeJob(int64_t job, int32_t errCode) { - SSchJob *pJob = schAcquireJob(job); +void schedulerFreeJob(int64_t* job, int32_t errCode) { + if (0 == *job) { + return; + } + + SSchJob *pJob = schAcquireJob(*job); if (NULL == pJob) { - qError("acquire job from jobRef list failed, may be dropped, jobId:0x%" PRIx64, job); + qError("acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *job); + *job = 0; return; } int32_t code = schProcessOnJobDropped(pJob, errCode); if (TSDB_CODE_SCH_JOB_IS_DROPPING == code) { - SCH_JOB_DLOG("sch job is already dropping, refId:0x%" PRIx64, job); + SCH_JOB_DLOG("sch job is already dropping, refId:0x%" PRIx64, *job); + *job = 0; return; } - SCH_JOB_DLOG("start to remove job from jobRef list, refId:0x%" PRIx64, job); + SCH_JOB_DLOG("start to remove job from jobRef list, refId:0x%" PRIx64, *job); - if (taosRemoveRef(schMgmt.jobRef, job)) { - SCH_JOB_ELOG("remove job from job list failed, refId:0x%" PRIx64, job); + if (taosRemoveRef(schMgmt.jobRef, *job)) { + SCH_JOB_ELOG("remove job from job list failed, refId:0x%" PRIx64, *job); } - schReleaseJob(job); + schReleaseJob(*job); + *job = 0; } void schedulerDestroy(void) { diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index 098699744d..7fe6cc22bf 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -457,7 +457,7 @@ void schtFreeQueryJob(int32_t freeThread) { int64_t job = queryJobRefId; if (job && atomic_val_compare_exchange_64(&queryJobRefId, job, 0)) { - schedulerFreeJob(job, 0); + schedulerFreeJob(&job, 0); if (freeThread) { if (++freeNum % schtTestPrintNum == 0) { printf("FreeNum:%d\n", freeNum); @@ -724,7 +724,7 @@ TEST(queryTest, normalCase) { schReleaseJob(job); - schedulerFreeJob(job, 0); + schedulerFreeJob(&job, 0); schtFreeQueryDag(&dag); @@ -828,7 +828,7 @@ TEST(queryTest, readyFirstCase) { schReleaseJob(job); - schedulerFreeJob(job, 0); + schedulerFreeJob(&job, 0); schtFreeQueryDag(&dag); @@ -940,7 +940,7 @@ TEST(queryTest, flowCtrlCase) { schReleaseJob(job); - schedulerFreeJob(job, 0); + schedulerFreeJob(&job, 0); schtFreeQueryDag(&dag); @@ -994,7 +994,7 @@ TEST(insertTest, normalCase) { ASSERT_EQ(code, 0); ASSERT_EQ(res.numOfRows, 20); - schedulerFreeJob(insertJobRefId, 0); + schedulerFreeJob(&insertJobRefId, 0); schedulerDestroy(); } diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c index 72fe4c406a..0f27fdf9f9 100644 --- a/tests/script/api/stopquery.c +++ b/tests/script/api/stopquery.c @@ -52,6 +52,7 @@ typedef struct { typedef struct SSP_CB_PARAM { TAOS *taos; bool fetch; + bool free; int32_t *end; } SSP_CB_PARAM; @@ -177,8 +178,37 @@ void sqKillQueryCb(void *param, TAOS_RES *pRes, int code) { } } +void sqAsyncFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (numOfRows > 0) { + taos_fetch_rows_a(pRes, sqAsyncFetchCb, param); + } else { + *qParam->end = 1; + if (qParam->free) { + taos_free_result(pRes); + } + } +} -int sqSyncStopQuery(bool fetch) { + +void sqAsyncQueryCb(void *param, TAOS_RES *pRes, int code) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (code == 0 && pRes) { + if (qParam->fetch) { + taos_fetch_rows_a(pRes, sqAsyncFetchCb, param); + } else { + if (qParam->free) { + taos_free_result(pRes); + } + *qParam->end = 1; + } + } else { + sqExit("select", taos_errstr(pRes)); + } +} + + +int sqStopSyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -211,7 +241,7 @@ int sqSyncStopQuery(bool fetch) { CASE_LEAVE(); } -int sqAsyncStopQuery(bool fetch) { +int sqStopAsyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -241,7 +271,7 @@ int sqAsyncStopQuery(bool fetch) { CASE_LEAVE(); } -int sqSyncFreeQuery(bool fetch) { +int sqFreeSyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -272,7 +302,7 @@ int sqSyncFreeQuery(bool fetch) { CASE_LEAVE(); } -int sqAsyncFreeQuery(bool fetch) { +int sqFreeAsyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -302,7 +332,7 @@ int sqAsyncFreeQuery(bool fetch) { CASE_LEAVE(); } -int sqSyncCloseQuery(bool fetch) { +int sqCloseSyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -332,7 +362,7 @@ int sqSyncCloseQuery(bool fetch) { CASE_LEAVE(); } -int sqAsyncCloseQuery(bool fetch) { +int sqCloseAsyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -382,9 +412,39 @@ void *syncQueryThreadFp(void *arg) { taos_fetch_row(pRes); } - taos_free_result(pRes); + if (qParam->free) { + taos_free_result(pRes); + } } +void *asyncQueryThreadFp(void *arg) { + SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + qParam->taos = taos; + + sprintf(sql, "reset query cache"); + sqExecSQLE(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQLE(taos, sql); + + sprintf(sql, "select * from %s", tbName); + + int32_t qEnd = 0; + SSP_CB_PARAM param = {0}; + param.fetch = qParam->fetch; + param.end = &qEnd; + taos_query_a(taos, sql, sqAsyncQueryCb, ¶m); + while (0 == qEnd) { + usleep(5000); + } +} + + void *closeThreadFp(void *arg) { SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; while (true) { @@ -398,7 +458,22 @@ void *closeThreadFp(void *arg) { } -int sqConSyncCloseQuery(bool fetch) { + +void *killThreadFp(void *arg) { + SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; + while (true) { + if (qParam->taos) { + usleep(rand() % 10000); + taos_kill_query(qParam->taos); + break; + } + usleep(1); + } +} + + + +int sqConCloseSyncQuery(bool fetch) { CASE_ENTER(); pthread_t qid, cid; for (int32_t i = 0; i < runTimes; ++i) { @@ -413,7 +488,23 @@ int sqConSyncCloseQuery(bool fetch) { CASE_LEAVE(); } -int sqSyncKillQuery(bool fetch) { +int sqConCloseAsyncQuery(bool fetch) { + CASE_ENTER(); + pthread_t qid, cid; + for (int32_t i = 0; i < runTimes; ++i) { + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + pthread_create(&qid, NULL, asyncQueryThreadFp, (void*)¶m); + pthread_create(&cid, NULL, closeThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + CASE_LEAVE(); +} + + +int sqKillSyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -445,7 +536,7 @@ int sqSyncKillQuery(bool fetch) { CASE_LEAVE(); } -int sqAsyncKillQuery(bool fetch) { +int sqKillAsyncQuery(bool fetch) { CASE_ENTER(); for (int32_t i = 0; i < runTimes; ++i) { char sql[1024] = {0}; @@ -465,6 +556,7 @@ int sqAsyncKillQuery(bool fetch) { SSP_CB_PARAM param = {0}; param.fetch = fetch; param.end = &qEnd; + param.taos = taos; taos_query_a(taos, sql, sqKillQueryCb, ¶m); while (0 == qEnd) { usleep(5000); @@ -475,33 +567,81 @@ int sqAsyncKillQuery(bool fetch) { CASE_LEAVE(); } +int sqConKillSyncQuery(bool fetch) { + CASE_ENTER(); + pthread_t qid, cid; + for (int32_t i = 0; i < runTimes; ++i) { + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + pthread_create(&qid, NULL, syncQueryThreadFp, (void*)¶m); + pthread_create(&cid, NULL, killThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + CASE_LEAVE(); +} + +int sqConKillAsyncQuery(bool fetch) { + CASE_ENTER(); + pthread_t qid, cid; + for (int32_t i = 0; i < runTimes; ++i) { + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + pthread_create(&qid, NULL, asyncQueryThreadFp, (void*)¶m); + pthread_create(&cid, NULL, killThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + CASE_LEAVE(); +} + + void sqRunAllCase(void) { /* - sqSyncStopQuery(false); - sqSyncStopQuery(true); - sqAsyncStopQuery(false); - sqAsyncStopQuery(true); + sqStopSyncQuery(false); + sqStopSyncQuery(true); + sqStopAsyncQuery(false); + sqStopAsyncQuery(true); - sqSyncFreeQuery(false); - sqSyncFreeQuery(true); - sqAsyncFreeQuery(false); - sqAsyncFreeQuery(true); + sqFreeSyncQuery(false); + sqFreeSyncQuery(true); + sqFreeAsyncQuery(false); + sqFreeAsyncQuery(true); - sqSyncCloseQuery(false); - sqSyncCloseQuery(true); - sqAsyncCloseQuery(false); - sqAsyncCloseQuery(true); -*/ - sqConSyncCloseQuery(false); -/* - sqConSyncCloseQuery(true); - - sqSyncKillQuery(false); - sqSyncKillQuery(true); - sqAsyncKillQuery(false); - sqAsyncKillQuery(true); + sqCloseSyncQuery(false); + sqCloseSyncQuery(true); + sqCloseAsyncQuery(false); + sqCloseAsyncQuery(true); + + sqConCloseSyncQuery(false); + sqConCloseSyncQuery(true); + sqConCloseAsyncQuery(false); + sqConCloseAsyncQuery(true); */ + +#if 0 + + sqKillSyncQuery(false); + sqKillSyncQuery(true); + sqKillAsyncQuery(false); + sqKillAsyncQuery(true); +#endif + + //sqConKillSyncQuery(false); + sqConKillSyncQuery(true); +#if 0 + sqConKillAsyncQuery(false); + sqConKillAsyncQuery(true); +#endif + + int32_t l = 5; + while (l) { + printf("%d\n", l--); + sleep(1); + } } From 09eceed6b403a80a0fb87b2571f23c3efe0647f3 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Jul 2022 21:03:50 +0800 Subject: [PATCH 05/63] fix transport quit fix --- source/libs/transport/inc/transportInt.h | 2 +- source/libs/transport/src/trans.c | 8 ++++++-- source/libs/transport/src/transCli.c | 10 ++++++---- source/libs/transport/src/transComm.c | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/source/libs/transport/inc/transportInt.h b/source/libs/transport/inc/transportInt.h index 462debb247..5fb2980ceb 100644 --- a/source/libs/transport/inc/transportInt.h +++ b/source/libs/transport/inc/transportInt.h @@ -57,7 +57,7 @@ typedef struct { void* parent; void* tcphandle; // returned handle from TCP initialization - int32_t refMgt; + int64_t refId; TdThreadMutex mutex; } SRpcInfo; diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index c970440d47..48e7d7c91d 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -76,12 +76,16 @@ void* rpcOpen(const SRpcInit* pInit) { if (pInit->user) { memcpy(pRpc->user, pInit->user, strlen(pInit->user)); } - int64_t refId = taosAddRef(transGetInstMgt(), pRpc); + + int64_t refId = transAddExHandle(transGetInstMgt(), pRpc); + transAcquireExHandle(transGetInstMgt(), refId); + pRpc->refId = refId; return (void*)refId; } void rpcClose(void* arg) { tInfo("start to close rpc"); - taosRemoveRef(transGetInstMgt(), (int64_t)arg); + transRemoveExHandle(transGetInstMgt(), (int64_t)arg); + transReleaseExHandle(transGetInstMgt(), (int64_t)arg); tInfo("finish to close rpc"); return; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index bda40cbc2a..f948461c40 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -47,6 +47,7 @@ typedef struct SCliMsg { queue q; STransMsgType type; + int64_t refId; uint64_t st; int sent; //(0: no send, 1: alread sent) } SCliMsg; @@ -606,11 +607,9 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { if (clear) { if (!uv_is_closing((uv_handle_t*)conn->stream)) { + uv_read_stop(conn->stream); uv_close((uv_handle_t*)conn->stream, cliDestroy); } - //} else { - // cliDestroy((uv_handle_t*)conn->stream); - //} } } static void cliDestroy(uv_handle_t* handle) { @@ -635,7 +634,6 @@ static bool cliHandleNoResp(SCliConn* conn) { SCliMsg* pMsg = transQueueGet(&conn->cliMsgs, 0); if (REQUEST_NO_RESP(&pMsg->msg)) { transQueuePop(&conn->cliMsgs); - // taosArrayRemove(msgs, 0); destroyCmsg(pMsg); res = true; } @@ -979,6 +977,7 @@ void cliSendQuit(SCliThrd* thrd) { } void cliWalkCb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) { + uv_read_stop((uv_stream_t*)handle); uv_close(handle, cliDestroy); } } @@ -1213,6 +1212,7 @@ void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra cliMsg->msg = *pReq; cliMsg->st = taosGetTimestampUs(); cliMsg->type = Normal; + cliMsg->refId = (int64_t)shandle; STraceId* trace = &pReq->info.traceId; tGTrace("%s send request at thread:%08" PRId64 ", dst: %s:%d, app:%p", transLabel(pTransInst), pThrd->pid, @@ -1250,6 +1250,7 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM cliMsg->msg = *pReq; cliMsg->st = taosGetTimestampUs(); cliMsg->type = Normal; + cliMsg->refId = (int64_t)shandle; STraceId* trace = &pReq->info.traceId; tGTrace("%s send request at thread:%08" PRId64 ", dst: %s:%d, app:%p", transLabel(pTransInst), pThrd->pid, @@ -1283,6 +1284,7 @@ void transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg)); cliMsg->ctx = pCtx; cliMsg->type = Update; + cliMsg->refId = (int64_t)shandle; SCliThrd* thrd = ((SCliObj*)pTransInst->tcphandle)->pThreadObj[i]; tDebug("%s update epset at thread:%08" PRId64 "", pTransInst->label, thrd->pid); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 676985b31c..6172f4ad5b 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -19,7 +19,7 @@ static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; static int32_t refMgt; -int32_t instMgt; +static int32_t instMgt; int transAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey) { T_MD5_CTX context; From 2a114a6b830472714222c4fc4e4e869e83cf3037 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 1 Jul 2022 21:06:08 +0800 Subject: [PATCH 06/63] fix: a problem of group by tbname --- source/libs/nodes/src/nodesUtilFuncs.c | 14 +++++++++++--- source/libs/planner/src/planOptimizer.c | 4 ++-- source/libs/planner/test/planOptimizeTest.cpp | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index eb59bd7f6a..6d368e0226 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -19,8 +19,8 @@ #include "querynodes.h" #include "taos.h" #include "taoserror.h" -#include "thash.h" #include "tdatablock.h" +#include "thash.h" static SNode* makeNode(ENodeType type, size_t size) { SNode* p = taosMemoryCalloc(1, size); @@ -1497,13 +1497,18 @@ typedef struct SCollectFuncsCxt { int32_t errCode; FFuncClassifier classifier; SNodeList* pFuncs; + SHashObj* pAliasName; } SCollectFuncsCxt; static EDealRes collectFuncs(SNode* pNode, void* pContext) { SCollectFuncsCxt* pCxt = (SCollectFuncsCxt*)pContext; if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId) && !(((SExprNode*)pNode)->orderAlias)) { - pCxt->errCode = nodesListStrictAppend(pCxt->pFuncs, nodesCloneNode(pNode)); + SExprNode* pExpr = (SExprNode*)pNode; + if (NULL == taosHashGet(pCxt->pAliasName, pExpr->aliasName, strlen(pExpr->aliasName))) { + pCxt->errCode = nodesListStrictAppend(pCxt->pFuncs, nodesCloneNode(pNode)); + taosHashPut(pCxt->pAliasName, pExpr->aliasName, strlen(pExpr->aliasName), &pExpr, POINTER_BYTES); + } return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); } return DEAL_RES_CONTINUE; @@ -1515,7 +1520,10 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, ESqlClause clause, FFuncClassifi } SCollectFuncsCxt cxt = { - .errCode = TSDB_CODE_SUCCESS, .classifier = classifier, .pFuncs = (NULL == *pFuncs ? nodesMakeList() : *pFuncs)}; + .errCode = TSDB_CODE_SUCCESS, + .classifier = classifier, + .pFuncs = (NULL == *pFuncs ? nodesMakeList() : *pFuncs), + .pAliasName = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, false)}; if (NULL == cxt.pFuncs) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index fb27602c21..6b960d71ab 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -720,7 +720,7 @@ 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_PROJECT != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { + QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { return TSDB_CODE_SUCCESS; } @@ -1251,7 +1251,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) { } strcpy(pFunc->functionName, pFuncName); - if (QUERY_NODE_COLUMN == nodeType(pNode)) { + if (QUERY_NODE_COLUMN == nodeType(pNode) && COLUMN_TYPE_TBNAME != ((SColumnNode*)pNode)->colType) { SColumnNode* pCol = (SColumnNode*)pNode; partTagsSetAlias(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), pCol->tableAlias, pCol->colName); } else { diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 6a9a711dac..3994db0902 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -68,6 +68,8 @@ TEST_F(PlanOptimizeTest, PartitionTags) { run("SELECT SUM(c1), tag1 FROM st1 GROUP BY tag1"); run("SELECT SUM(c1), tag1 + 10 FROM st1 GROUP BY tag1 + 10"); + + run("SELECT SUM(c1), tbname FROM st1 GROUP BY tbname"); } TEST_F(PlanOptimizeTest, eliminateProjection) { From 246b3e245df804f4bcf3ccf36c8c10891fafc1ff Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 2 Jul 2022 11:31:35 +0800 Subject: [PATCH 07/63] fix: a problem of group by tbname --- source/libs/nodes/src/nodesUtilFuncs.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 6d368e0226..bf4eac3698 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1529,17 +1529,18 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, ESqlClause clause, FFuncClassifi } *pFuncs = NULL; nodesWalkSelectStmt(pSelect, clause, collectFuncs, &cxt); - if (TSDB_CODE_SUCCESS != cxt.errCode) { - nodesDestroyList(cxt.pFuncs); - return cxt.errCode; - } - if (LIST_LENGTH(cxt.pFuncs) > 0) { - *pFuncs = cxt.pFuncs; + if (TSDB_CODE_SUCCESS == cxt.errCode) { + if (LIST_LENGTH(cxt.pFuncs) > 0) { + *pFuncs = cxt.pFuncs; + } else { + nodesDestroyList(cxt.pFuncs); + } } else { nodesDestroyList(cxt.pFuncs); } + taosHashCleanup(cxt.pAliasName); - return TSDB_CODE_SUCCESS; + return cxt.errCode; } typedef struct SCollectSpecialNodesCxt { From 086ec29ca03ed09fbaa0195467deefa1707ec6c9 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Sat, 2 Jul 2022 14:41:54 +0800 Subject: [PATCH 08/63] refactor(sync): add SyncClientRequestBatch --- include/libs/sync/syncTools.h | 53 ++++--- source/libs/sync/inc/syncRaftEntry.h | 9 +- source/libs/sync/inc/syncSnapshot.h | 14 +- source/libs/sync/src/syncAppendEntries.c | 15 +- source/libs/sync/src/syncMessage.c | 140 +++++++++++++++++- source/libs/sync/src/syncRaftEntry.c | 16 ++ source/libs/sync/src/syncReplication.c | 3 +- source/libs/sync/src/syncSnapshot.c | 10 +- source/libs/sync/test/CMakeLists.txt | 14 ++ .../sync/test/syncAppendEntriesBatchTest.cpp | 5 +- .../sync/test/syncClientRequestBatchTest.cpp | 125 ++++++++++++++++ .../test/syncConfigChangeSnapshotTest.cpp | 2 +- .../libs/sync/test/syncSnapshotSenderTest.cpp | 2 +- source/libs/sync/test/syncTestTool.cpp | 2 +- source/libs/transport/inc/transComm.h | 16 +- 15 files changed, 366 insertions(+), 60 deletions(-) create mode 100644 source/libs/sync/test/syncClientRequestBatchTest.cpp diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 745c63d5b3..8b658c8776 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -191,12 +191,12 @@ void syncTimeoutLog2(char* s, const SyncTimeout* pMsg); typedef struct SyncClientRequest { uint32_t bytes; int32_t vgId; - uint32_t msgType; // SyncClientRequest msgType - uint32_t originalRpcType; // user RpcMsg msgType + uint32_t msgType; // TDMT_SYNC_CLIENT_REQUEST + uint32_t originalRpcType; // origin RpcMsg msgType uint64_t seqNum; bool isWeak; - uint32_t dataLen; // user RpcMsg.contLen - char data[]; // user RpcMsg.pCont + uint32_t dataLen; // origin RpcMsg.contLen + char data[]; // origin RpcMsg.pCont } SyncClientRequest; SyncClientRequest* syncClientRequestBuild(uint32_t dataLen); @@ -220,11 +220,6 @@ 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; @@ -232,20 +227,33 @@ typedef struct SRaftMeta { // block1: // block2: SRaftMeta array -// block3: rpc msg array (with pCont) +// block3: rpc msg array (with pCont pointer) typedef struct SyncClientRequestBatch { uint32_t bytes; int32_t vgId; - uint32_t msgType; // SyncClientRequestBatch msgType + uint32_t msgType; // TDMT_SYNC_CLIENT_REQUEST_BATCH uint32_t dataCount; - uint32_t dataLen; // user RpcMsg.contLen - char data[]; // user RpcMsg.pCont + uint32_t dataLen; + char data[]; // block2, block3 } SyncClientRequestBatch; SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMeta* raftArr, int32_t arrSize, int32_t vgId); void syncClientRequestBatch2RpcMsg(const SyncClientRequestBatch* pSyncMsg, SRpcMsg* pRpcMsg); +void syncClientRequestBatchDestroy(SyncClientRequestBatch* pMsg); +void syncClientRequestBatchDestroyDeep(SyncClientRequestBatch* pMsg); +SRaftMeta* syncClientRequestBatchMetaArr(const SyncClientRequestBatch* pSyncMsg); +SRpcMsg* syncClientRequestBatchRpcMsgArr(const SyncClientRequestBatch* pSyncMsg); +SyncClientRequestBatch* syncClientRequestBatchFromRpcMsg(const SRpcMsg* pRpcMsg); +cJSON* syncClientRequestBatch2Json(const SyncClientRequestBatch* pMsg); +char* syncClientRequestBatch2Str(const SyncClientRequestBatch* pMsg); + +// for debug ---------------------- +void syncClientRequestBatchPrint(const SyncClientRequestBatch* pMsg); +void syncClientRequestBatchPrint2(char* s, const SyncClientRequestBatch* pMsg); +void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg); +void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg); // --------------------------------------------- typedef struct SyncClientRequestReply { @@ -318,12 +326,15 @@ void syncRequestVoteReplyLog(const SyncRequestVoteReply* pMsg); void syncRequestVoteReplyLog2(char* s, const SyncRequestVoteReply* pMsg); // --------------------------------------------- +// data: entry + typedef struct SyncAppendEntries { uint32_t bytes; int32_t vgId; uint32_t msgType; SRaftId srcId; SRaftId destId; + // private data SyncTerm term; SyncIndex prevLogIndex; @@ -354,18 +365,14 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg); // --------------------------------------------- -// define ahead -/* typedef struct SOffsetAndContLen { int32_t offset; int32_t contLen; } SOffsetAndContLen; -*/ -// block1: SOffsetAndContLen -// block2: SOffsetAndContLen Array -// block3: SRpcMsg Array -// block4: SRpcMsg pCont Array +// data: +// block1: SOffsetAndContLen Array +// block2: entry Array typedef struct SyncAppendEntriesBatch { uint32_t bytes; @@ -382,10 +389,12 @@ typedef struct SyncAppendEntriesBatch { SyncTerm privateTerm; int32_t dataCount; uint32_t dataLen; - char data[]; + char data[]; // block1, block2 } SyncAppendEntriesBatch; -SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId); +// SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId); + +SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, 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); diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index 37f18a6388..82d5c0a6ea 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -29,19 +29,20 @@ extern "C" { typedef struct SSyncRaftEntry { uint32_t bytes; - uint32_t msgType; // SyncClientRequest msgType - uint32_t originalRpcType; // user RpcMsg msgType + uint32_t msgType; // TDMT_SYNC_CLIENT_REQUEST + uint32_t originalRpcType; // origin RpcMsg msgType uint64_t seqNum; bool isWeak; SyncTerm term; SyncIndex index; - uint32_t dataLen; // user RpcMsg.contLen - char data[]; // user RpcMsg.pCont + uint32_t dataLen; // origin RpcMsg.contLen + char data[]; // origin RpcMsg.pCont } SSyncRaftEntry; SSyncRaftEntry* syncEntryBuild(uint32_t dataLen); SSyncRaftEntry* syncEntryBuild2(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index); // step 4 SSyncRaftEntry* syncEntryBuild3(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index); +SSyncRaftEntry* syncEntryBuild4(SRpcMsg* pOriginalMsg, SyncTerm term, SyncIndex index); SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId); void syncEntryDestory(SSyncRaftEntry* pEntry); char* syncEntrySerialize(const SSyncRaftEntry* pEntry, uint32_t* len); // step 5 diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 6801e7212a..bb076ed2a1 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 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(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/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index be48227d40..c244b32cea 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -694,6 +694,8 @@ static int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry) { return 0; } +static bool syncNodeOnAppendEntriesBatchLogOK(SSyncNode* pSyncNode, SyncAppendEntriesBatch* pMsg) { return true; } + // really pre log match // prevLogIndex == -1 static bool syncNodeOnAppendEntriesLogOK(SSyncNode* pSyncNode, SyncAppendEntries* pMsg) { @@ -844,8 +846,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc } while (0); // calculate logOK here, before will coredump, due to fake match - // bool logOK = syncNodeOnAppendEntriesLogOK(ths, pMsg); - bool logOK = true; + bool logOK = syncNodeOnAppendEntriesBatchLogOK(ths, pMsg); // not match // @@ -866,8 +867,9 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc if (condition) { char logBuf[128]; - snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries, not match, pre-index:%ld, pre-term:%lu, datalen:%d", - pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->dataLen); + snprintf(logBuf, sizeof(logBuf), + "recv sync-append-entries-batch, not match, pre-index:%ld, pre-term:%lu, datalen:%d", pMsg->prevLogIndex, + pMsg->prevLogTerm, pMsg->dataLen); syncNodeEventLog(ths, logBuf); // prepare response msg @@ -914,7 +916,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc if (hasExtraEntries) { // make log same, rollback deleted entries - // code = syncNodeMakeLogSame(ths, pMsg); + code = syncNodeMakeLogSame2(ths, pMsg); ASSERT(code == 0); } @@ -926,7 +928,8 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc // append entry batch for (int32_t i = 0; i < retArrSize; ++i) { - SSyncRaftEntry* pAppendEntry = syncEntryBuild(1234); + // SSyncRaftEntry* pAppendEntry = syncEntryBuild4(&rpcMsgArr[i], ); + SSyncRaftEntry* pAppendEntry; code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); if (code != 0) { return -1; diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index ad352df59f..664f4c8b73 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -996,7 +996,135 @@ SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg* rpcMsgArr, SRaftMet return pMsg; } -void syncClientRequestBatch2RpcMsg(const SyncClientRequestBatch* pSyncMsg, SRpcMsg* pRpcMsg) {} +void syncClientRequestBatch2RpcMsg(const SyncClientRequestBatch* pSyncMsg, SRpcMsg* pRpcMsg) { + memset(pRpcMsg, 0, sizeof(*pRpcMsg)); + pRpcMsg->msgType = pSyncMsg->msgType; + pRpcMsg->contLen = pSyncMsg->bytes; + pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); + memcpy(pRpcMsg->pCont, pSyncMsg, pRpcMsg->contLen); +} + +void syncClientRequestBatchDestroy(SyncClientRequestBatch* pMsg) { + if (pMsg != NULL) { + taosMemoryFree(pMsg); + } +} + +void syncClientRequestBatchDestroyDeep(SyncClientRequestBatch* pMsg) { + if (pMsg != NULL) { + int32_t arrSize = pMsg->dataCount; + int32_t raftMetaArrayLen = sizeof(SRaftMeta) * arrSize; + SRpcMsg* msgArr = (SRpcMsg*)((char*)(pMsg->data) + raftMetaArrayLen); + for (int i = 0; i < arrSize; ++i) { + if (msgArr[i].pCont != NULL) { + rpcFreeCont(msgArr[i].pCont); + } + } + + taosMemoryFree(pMsg); + } +} + +SRaftMeta* syncClientRequestBatchMetaArr(const SyncClientRequestBatch* pSyncMsg) { + SRaftMeta* raftMetaArr = (SRaftMeta*)(pSyncMsg->data); + return raftMetaArr; +} + +SRpcMsg* syncClientRequestBatchRpcMsgArr(const SyncClientRequestBatch* pSyncMsg) { + int32_t arrSize = pSyncMsg->dataCount; + int32_t raftMetaArrayLen = sizeof(SRaftMeta) * arrSize; + SRpcMsg* msgArr = (SRpcMsg*)((char*)(pSyncMsg->data) + raftMetaArrayLen); + return msgArr; +} + +SyncClientRequestBatch* syncClientRequestBatchFromRpcMsg(const SRpcMsg* pRpcMsg) { + SyncClientRequestBatch* pSyncMsg = taosMemoryMalloc(pRpcMsg->contLen); + ASSERT(pSyncMsg != NULL); + memcpy(pSyncMsg, pRpcMsg->pCont, pRpcMsg->contLen); + ASSERT(pRpcMsg->contLen == pSyncMsg->bytes); + + return pSyncMsg; +} + +cJSON* syncClientRequestBatch2Json(const SyncClientRequestBatch* 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_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); + cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); + + SRaftMeta* metaArr = syncClientRequestBatchMetaArr(pMsg); + SRpcMsg* msgArr = syncClientRequestBatchRpcMsgArr(pMsg); + + cJSON* pMetaArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pMeta = cJSON_CreateObject(); + cJSON_AddNumberToObject(pMeta, "seqNum", metaArr[i].seqNum); + cJSON_AddNumberToObject(pMeta, "isWeak", metaArr[i].isWeak); + cJSON_AddItemToArray(pMetaArr, pMeta); + } + + cJSON* pMsgArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "msgArr", pMsgArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pRpcMsgJson = syncRpcMsg2Json(&msgArr[i]); + 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, "SyncClientRequestBatch", pRoot); + return pJson; +} + +char* syncClientRequestBatch2Str(const SyncClientRequestBatch* pMsg) { + cJSON* pJson = syncClientRequestBatch2Json(pMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncClientRequestBatchPrint(const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + printf("syncClientRequestBatchPrint | len:%lu | %s \n", strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchPrint2(char* s, const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + printf("syncClientRequestBatchPrint2 | len:%lu | %s | %s \n", strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + sTrace("syncClientRequestBatchLog | len:%lu | %s", strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncClientRequestBatch2Str(pMsg); + sTraceLong("syncClientRequestBatchLog2 | len:%lu | %s | %s", strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} // ---- message process SyncRequestVote---- SyncRequestVote* syncRequestVoteBuild(int32_t vgId) { @@ -1475,6 +1603,7 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg) { // block3: SRpcMsg Array // block4: SRpcMsg pCont Array +/* SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId) { ASSERT(rpcMsgArr != NULL); ASSERT(arrSize > 0); @@ -1521,6 +1650,15 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t return pMsg; } +*/ + +// block1: SOffsetAndContLen +// block2: SOffsetAndContLen Array +// block3: entry Array + +SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId) { + return NULL; +} void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg) { if (pMsg != NULL) { diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 225360630c..0ee4684ea8 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -50,6 +50,22 @@ SSyncRaftEntry* syncEntryBuild3(SyncClientRequest* pMsg, SyncTerm term, SyncInde return pEntry; } +SSyncRaftEntry* syncEntryBuild4(SRpcMsg* pOriginalMsg, SyncTerm term, SyncIndex index) { + SSyncRaftEntry* pEntry = syncEntryBuild(pOriginalMsg->contLen); + ASSERT(pEntry != NULL); + + pEntry->msgType = TDMT_SYNC_CLIENT_REQUEST; + pEntry->originalRpcType = pOriginalMsg->msgType; + pEntry->seqNum = 0; + pEntry->isWeak = 0; + pEntry->term = term; + pEntry->index = index; + pEntry->dataLen = pOriginalMsg->contLen; + memcpy(pEntry->data, pOriginalMsg->pCont, pOriginalMsg->contLen); + + return pEntry; +} + SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) { // init rpcMsg SMsgHead head; diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 4908822a3a..673cdca68d 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -162,7 +162,8 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) { } } - SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, getCount, pSyncNode->vgId); + // SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, getCount, pSyncNode->vgId); + SyncAppendEntriesBatch* pMsg = NULL; ASSERT(pMsg != NULL); // prepare msg diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 4466cccbbc..dbab187f0e 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -353,14 +353,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]; @@ -612,7 +612,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); @@ -645,14 +645,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 c549b78399..37d9707cfd 100644 --- a/source/libs/sync/test/CMakeLists.txt +++ b/source/libs/sync/test/CMakeLists.txt @@ -24,6 +24,7 @@ add_executable(syncAppendEntriesTest "") add_executable(syncAppendEntriesBatchTest "") add_executable(syncAppendEntriesReplyTest "") add_executable(syncClientRequestTest "") +add_executable(syncClientRequestBatchTest "") add_executable(syncTimeoutTest "") add_executable(syncPingTest "") add_executable(syncPingReplyTest "") @@ -159,6 +160,10 @@ target_sources(syncClientRequestTest PRIVATE "syncClientRequestTest.cpp" ) +target_sources(syncClientRequestBatchTest + PRIVATE + "syncClientRequestBatchTest.cpp" +) target_sources(syncTimeoutTest PRIVATE "syncTimeoutTest.cpp" @@ -407,6 +412,11 @@ target_include_directories(syncClientRequestTest "${TD_SOURCE_DIR}/include/libs/sync" "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) +target_include_directories(syncClientRequestBatchTest + PUBLIC + "${TD_SOURCE_DIR}/include/libs/sync" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" +) target_include_directories(syncTimeoutTest PUBLIC "${TD_SOURCE_DIR}/include/libs/sync" @@ -658,6 +668,10 @@ target_link_libraries(syncClientRequestTest sync gtest_main ) +target_link_libraries(syncClientRequestBatchTest + sync + gtest_main +) target_link_libraries(syncTimeoutTest sync gtest_main diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp index 8784ddd637..b9000269e6 100644 --- a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -15,6 +15,7 @@ void logTest() { sFatal("--- sync log test: fatal"); } +/* SRpcMsg *createRpcMsg(int32_t i, int32_t dataLen) { SRpcMsg *pRpcMsg = (SRpcMsg *)taosMemoryMalloc(sizeof(SRpcMsg)); memset(pRpcMsg, 0, sizeof(SRpcMsg)); @@ -67,7 +68,6 @@ void test1() { syncAppendEntriesBatchDestroy(pMsg); } -/* void test2() { SyncAppendEntries *pMsg = createMsg(); uint32_t len = pMsg->bytes; @@ -126,9 +126,8 @@ int main() { sDebugFlag = DEBUG_DEBUG + DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; logTest(); - test1(); - /* + test1(); test2(); test3(); test4(); diff --git a/source/libs/sync/test/syncClientRequestBatchTest.cpp b/source/libs/sync/test/syncClientRequestBatchTest.cpp new file mode 100644 index 0000000000..ae74baeda4 --- /dev/null +++ b/source/libs/sync/test/syncClientRequestBatchTest.cpp @@ -0,0 +1,125 @@ +#include +#include +#include "syncIO.h" +#include "syncInt.h" +#include "syncMessage.h" +#include "syncUtil.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) { + SyncPing *pSyncMsg = syncPingBuild(20); + snprintf(pSyncMsg->data, pSyncMsg->dataLen, "value_%d", i); + + SRpcMsg *pRpcMsg = (SRpcMsg *)taosMemoryMalloc(sizeof(SRpcMsg)); + memset(pRpcMsg, 0, sizeof(SRpcMsg)); + pRpcMsg->code = 10 * i; + syncPing2RpcMsg(pSyncMsg, pRpcMsg); + + syncPingDestroy(pSyncMsg); + return pRpcMsg; +} + +SyncClientRequestBatch *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); + } + + SRaftMeta raftArr[5]; + memset(raftArr, 0, sizeof(raftArr)); + for (int32_t i = 0; i < 5; ++i) { + raftArr[i].seqNum = i * 10; + raftArr[i].isWeak = i % 2; + } + + SyncClientRequestBatch *pMsg = syncClientRequestBatchBuild(rpcMsgArr, raftArr, 5, 1234); + return pMsg; +} + +void test1() { + SyncClientRequestBatch *pMsg = createMsg(); + syncClientRequestBatchLog2((char *)"==test1==", pMsg); + syncClientRequestBatchDestroyDeep(pMsg); +} + +/* +void test2() { + SyncClientRequest *pMsg = createMsg(); + uint32_t len = pMsg->bytes; + char * serialized = (char *)taosMemoryMalloc(len); + syncClientRequestSerialize(pMsg, serialized, len); + SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen); + syncClientRequestDeserialize(serialized, len, pMsg2); + syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2); + + taosMemoryFree(serialized); + syncClientRequestDestroy(pMsg); + syncClientRequestDestroy(pMsg2); +} + +void test3() { + SyncClientRequest *pMsg = createMsg(); + uint32_t len; + char * serialized = syncClientRequestSerialize2(pMsg, &len); + SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len); + syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2); + + taosMemoryFree(serialized); + syncClientRequestDestroy(pMsg); + syncClientRequestDestroy(pMsg2); +} + +void test4() { + SyncClientRequest *pMsg = createMsg(); + SRpcMsg rpcMsg; + syncClientRequest2RpcMsg(pMsg, &rpcMsg); + SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(rpcMsg.contLen); + syncClientRequestFromRpcMsg(&rpcMsg, pMsg2); + syncClientRequestLog2((char *)"test4: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg ", pMsg2); + + rpcFreeCont(rpcMsg.pCont); + syncClientRequestDestroy(pMsg); + syncClientRequestDestroy(pMsg2); +} + +void test5() { + SyncClientRequest *pMsg = createMsg(); + SRpcMsg rpcMsg; + syncClientRequest2RpcMsg(pMsg, &rpcMsg); + SyncClientRequest *pMsg2 = syncClientRequestFromRpcMsg2(&rpcMsg); + syncClientRequestLog2((char *)"test5: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg2 ", pMsg2); + + rpcFreeCont(rpcMsg.pCont); + syncClientRequestDestroy(pMsg); + syncClientRequestDestroy(pMsg2); +} +*/ + +int main() { + gRaftDetailLog = true; + tsAsyncLog = 0; + sDebugFlag = DEBUG_DEBUG + DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; + logTest(); + + test1(); + + /* +test2(); +test3(); +test4(); +test5(); +*/ + + return 0; +} diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index 2908dd5907..b603d48b8b 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 *pParam, 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 dc38cd3df5..8d1f83b3b1 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 *pParam, 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 4e84ff0f7e..f7a4d91594 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 *pParam, 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/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index b06d541b75..21e7f7c7af 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -96,8 +96,8 @@ typedef void* queue[2]; #define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field)))) #define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit -#define TRANS_RETRY_INTERVAL 15 // ms retry interval -#define TRANS_CONN_TIMEOUT 3 // connect timeout +#define TRANS_RETRY_INTERVAL 200 // ms retry interval +#define TRANS_CONN_TIMEOUT 3 // connect timeout typedef SRpcMsg STransMsg; typedef SRpcCtx STransCtx; @@ -180,18 +180,18 @@ typedef enum { Normal, Quit, Release, Register, Update } STransMsgType; typedef enum { ConnNormal, ConnAcquire, ConnRelease, ConnBroken, ConnInPool } ConnStatus; #define container_of(ptr, type, member) ((type*)((char*)(ptr)-offsetof(type, member))) -#define RPC_RESERVE_SIZE (sizeof(STranConnCtx)) +#define RPC_RESERVE_SIZE (sizeof(STranConnCtx)) #define rpcIsReq(type) (type & 1U) #define TRANS_RESERVE_SIZE (sizeof(STranConnCtx)) -#define TRANS_MSG_OVERHEAD (sizeof(STransMsgHead)) -#define transHeadFromCont(cont) ((STransMsgHead*)((char*)cont - sizeof(STransMsgHead))) -#define transContFromHead(msg) (msg + sizeof(STransMsgHead)) +#define TRANS_MSG_OVERHEAD (sizeof(STransMsgHead)) +#define transHeadFromCont(cont) ((STransMsgHead*)((char*)cont - sizeof(STransMsgHead))) +#define transContFromHead(msg) (msg + sizeof(STransMsgHead)) #define transMsgLenFromCont(contLen) (contLen + sizeof(STransMsgHead)) -#define transContLenFromMsg(msgLen) (msgLen - sizeof(STransMsgHead)); -#define transIsReq(type) (type & 1U) +#define transContLenFromMsg(msgLen) (msgLen - sizeof(STransMsgHead)); +#define transIsReq(type) (type & 1U) #define transLabel(trans) ((STrans*)trans)->label From 4fc500c91c3f097c6fb90ad6a3f3721f6455b5d9 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Sat, 2 Jul 2022 16:01:47 +0800 Subject: [PATCH 09/63] refactor(sync): add SyncAppendEntriesBatch --- include/libs/sync/syncTools.h | 3 +- source/libs/sync/src/syncMessage.c | 64 +++++++------------ .../sync/test/syncAppendEntriesBatchTest.cpp | 55 ++++++++-------- 3 files changed, 53 insertions(+), 69 deletions(-) diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 8b658c8776..97f2748420 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -392,9 +392,8 @@ typedef struct SyncAppendEntriesBatch { char data[]; // block1, block2 } SyncAppendEntriesBatch; -// SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId); - SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId); +SOffsetAndContLen* syncAppendEntriesBatchMetaTableArray(SyncAppendEntriesBatch* pMsg); void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg); void syncAppendEntriesBatchSerialize(const SyncAppendEntriesBatch* pMsg, char* buf, uint32_t bufLen); void syncAppendEntriesBatchDeserialize(const char* buf, uint32_t len, SyncAppendEntriesBatch* pMsg); diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 664f4c8b73..10e6231a70 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -15,6 +15,7 @@ #include "syncMessage.h" #include "syncRaftCfg.h" +#include "syncRaftEntry.h" #include "syncUtil.h" #include "tcoding.h" @@ -1600,22 +1601,20 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg) { // block1: SOffsetAndContLen // block2: SOffsetAndContLen Array -// block3: SRpcMsg Array -// block4: SRpcMsg pCont Array +// block3: entry Array -/* -SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t arrSize, int32_t vgId) { - ASSERT(rpcMsgArr != NULL); +SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId) { + ASSERT(entryPArr != 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; + int32_t entryArrayLen = 0; for (int i = 0; i < arrSize; ++i) { // SRpcMsg pCont - contArrayLen += rpcMsgArr[i].contLen; + SSyncRaftEntry* pEntry = entryPArr[i]; + entryArrayLen += pEntry->bytes; } - dataLen += (metaArrayLen + rpcArrayLen + contArrayLen); + dataLen += (metaArrayLen + entryArrayLen); uint32_t bytes = sizeof(SyncAppendEntriesBatch) + dataLen; SyncAppendEntriesBatch* pMsg = taosMemoryMalloc(bytes); @@ -1627,37 +1626,28 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SRpcMsg* rpcMsgArr, int32_t 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 + // init meta if (i == 0) { - metaArr[i].offset = metaArrayLen + rpcArrayLen; - metaArr[i].contLen = rpcMsgArr[i].contLen; + metaArr[i].offset = metaArrayLen; + metaArr[i].contLen = entryPArr[i]->bytes; } else { metaArr[i].offset = metaArr[i - 1].offset + metaArr[i - 1].contLen; - metaArr[i].contLen = rpcMsgArr[i].contLen; + metaArr[i].contLen = entryPArr[i]->bytes; } - // 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); + // init entry array + ASSERT(metaArr[i].contLen == entryPArr[i]->bytes); + memcpy(pData + metaArr[i].offset, entryPArr[i], metaArr[i].contLen); } return pMsg; } -*/ -// block1: SOffsetAndContLen -// block2: SOffsetAndContLen Array -// block3: entry Array - -SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId) { - return NULL; +SOffsetAndContLen* syncAppendEntriesBatchMetaTableArray(SyncAppendEntriesBatch* pMsg) { + return (SOffsetAndContLen*)(pMsg->data); } void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg) { @@ -1772,16 +1762,12 @@ cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) { 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; + int32_t entryArrayLen = pMsg->dataLen - metaArrayLen; cJSON_AddNumberToObject(pRoot, "metaArrayLen", metaArrayLen); - cJSON_AddNumberToObject(pRoot, "rpcArrayLen", rpcArrayLen); - cJSON_AddNumberToObject(pRoot, "contArrayLen", contArrayLen); + cJSON_AddNumberToObject(pRoot, "entryArrayLen", entryArrayLen); 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); @@ -1792,14 +1778,12 @@ cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) { cJSON_AddItemToArray(pMetaArr, pMeta); } - cJSON* pMsgArr = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "msgArr", pMsgArr); + cJSON* pEntryArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "entryArr", pEntryArr); 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); + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); + cJSON* pEntryJson = syncEntry2Json(pEntry); + cJSON_AddItemToArray(pEntryArr, pEntryJson); } char* s; diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp index b9000269e6..515d580b35 100644 --- a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -3,6 +3,7 @@ #include "syncIO.h" #include "syncInt.h" #include "syncMessage.h" +#include "syncRaftEntry.h" #include "syncUtil.h" #include "trpc.h" @@ -15,31 +16,29 @@ void logTest() { 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; +SSyncRaftEntry *createEntry(int i) { + SSyncRaftEntry *pEntry = syncEntryBuild(20); + assert(pEntry != NULL); + pEntry->msgType = 1; + pEntry->originalRpcType = 2; + pEntry->seqNum = 3; + pEntry->isWeak = true; + pEntry->term = 100; + pEntry->index = 200; + snprintf(pEntry->data, pEntry->dataLen, "value_%d", i); + return pEntry; } SyncAppendEntriesBatch *createMsg() { - SRpcMsg rpcMsgArr[5]; - memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); + SSyncRaftEntry *entryPArr[5]; + memset(entryPArr, 0, sizeof(entryPArr)); for (int32_t i = 0; i < 5; ++i) { - SRpcMsg *pRpcMsg = createRpcMsg(i, 20); - rpcMsgArr[i] = *pRpcMsg; - taosMemoryFree(pRpcMsg); + SSyncRaftEntry *pEntry = createEntry(i); + entryPArr[i] = pEntry; } - SyncAppendEntriesBatch *pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, 5, 1234); + SyncAppendEntriesBatch *pMsg = syncAppendEntriesBatchBuild(entryPArr, 5, 1234); pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234); pMsg->srcId.vgId = 100; pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678); @@ -53,21 +52,22 @@ SyncAppendEntriesBatch *createMsg() { void test1() { SyncAppendEntriesBatch *pMsg = createMsg(); - syncAppendEntriesBatchLog2((char *)"test1:", pMsg); + syncAppendEntriesBatchLog2((char *)"==test1==", pMsg); - SRpcMsg rpcMsgArr[5]; - int32_t retArrSize; - syncAppendEntriesBatch2RpcMsgArray(pMsg, rpcMsgArr, 5, &retArrSize); +/* + SOffsetAndContLen *metaArr = syncAppendEntriesBatchMetaTableArray(pMsg); + int32_t retArrSize = pMsg->dataCount; 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); + SSyncRaftEntry *pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); + ASSERT(pEntry->bytes == metaArr[i].contLen); + syncEntryPrint(pEntry); } +*/ syncAppendEntriesBatchDestroy(pMsg); } +/* void test2() { SyncAppendEntries *pMsg = createMsg(); uint32_t len = pMsg->bytes; @@ -126,8 +126,9 @@ int main() { sDebugFlag = DEBUG_DEBUG + DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; logTest(); + test1(); + /* - test1(); test2(); test3(); test4(); From e4de1da8d33b6d8a4b5878558b715070aa3b9489 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 2 Jul 2022 17:00:57 +0800 Subject: [PATCH 10/63] add task queue --- source/client/inc/clientInt.h | 28 ++++++++------ source/client/src/clientEnv.c | 24 +++++++++--- source/client/src/clientImpl.c | 42 +++++++++++++++++--- source/client/src/clientMain.c | 70 ++++++++++++++++------------------ 4 files changed, 103 insertions(+), 61 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 53292ed46a..82a9d0f489 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -65,7 +65,7 @@ enum { typedef struct SAppInstInfo SAppInstInfo; typedef struct { - char* key; + char* key; // statistics int32_t reportCnt; int32_t connKeyCnt; @@ -177,14 +177,14 @@ typedef struct SReqResultInfo { } SReqResultInfo; typedef struct SRequestSendRecvBody { - tsem_t rspSem; // not used now - __taos_async_fn_t queryFp; - __taos_async_fn_t fetchFp; - void* param; - SDataBuf requestMsg; - int64_t queryJob; // query job, created according to sql query DAG. - int32_t subplanNum; - SReqResultInfo resInfo; + tsem_t rspSem; // not used now + __taos_async_fn_t queryFp; + __taos_async_fn_t fetchFp; + void* param; + SDataBuf requestMsg; + int64_t queryJob; // query job, created according to sql query DAG. + int32_t subplanNum; + SReqResultInfo resInfo; } SRequestSendRecvBody; typedef struct { @@ -284,6 +284,7 @@ static FORCE_INLINE SReqResultInfo* tscGetCurResInfo(TAOS_RES* res) { extern SAppInfo appInfo; extern int32_t clientReqRefPool; extern int32_t clientConnRefPool; +extern void* tscQhandle; __async_send_cb_fn_t getMsgRspHandle(int32_t msgType); @@ -301,7 +302,7 @@ void destroyRequest(SRequestObj* pRequest); SRequestObj* acquireRequest(int64_t rid); int32_t releaseRequest(int64_t rid); int32_t removeRequest(int64_t rid); -void doDestroyRequest(void *p); +void doDestroyRequest(void* p); char* getDbOfConnection(STscObj* pObj); void setConnectionDB(STscObj* pTscObj, const char* db); @@ -336,8 +337,8 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp); // cluster level SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key); void appHbMgrCleanup(void); -void hbRemoveAppHbMrg(SAppHbMgr **pAppHbMgr); -void closeAllRequests(SHashObj *pRequests); +void hbRemoveAppHbMrg(SAppHbMgr** pAppHbMgr); +void closeAllRequests(SHashObj* pRequests); // conn level int hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType); @@ -356,6 +357,9 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList); // todo move to clie int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog); // todo move to xxx bool qnodeRequired(SRequestObj* pRequest); +void initTscQhandle(); +void cleanupTscQhandle(); + #ifdef __cplusplus } #endif diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index fefabf6539..f58b942fad 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -25,6 +25,7 @@ #include "tmsg.h" #include "tref.h" #include "trpc.h" +#include "tsched.h" #include "ttime.h" #define TSC_VAR_NOT_RELEASE 1 @@ -34,9 +35,20 @@ SAppInfo appInfo; int32_t clientReqRefPool = -1; int32_t clientConnRefPool = -1; +void *tscQhandle = NULL; + static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; volatile int32_t tscInitRes = 0; +void initTscQhandle() { + // init handle + tscQhandle = taosInitScheduler(4096, 5, "tsc"); +} + +void cleanupTscQhandle() { + // destroy handle + taosCleanUpScheduler(tscQhandle); +} static int32_t registerRequest(SRequestObj *pRequest) { STscObj *pTscObj = acquireTscObj(pRequest->pTscObj->id); if (NULL == pTscObj) { @@ -156,9 +168,9 @@ void destroyTscObj(void *pObj) { if (NULL == pObj) { return; } - + STscObj *pTscObj = pObj; - int64_t tscId = pTscObj->id; + int64_t tscId = pTscObj->id; tscDebug("begin to destroy tscObj %" PRIx64 " p:%p", tscId, pTscObj); SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; @@ -272,11 +284,11 @@ void doDestroyRequest(void *p) { if (NULL == p) { return; } - + SRequestObj *pRequest = (SRequestObj *)p; - int64_t reqId = pRequest->self; + int64_t reqId = pRequest->self; tscDebug("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest); - + taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); if (pRequest->body.queryJob != 0) { @@ -314,7 +326,7 @@ void taos_init_imp(void) { // In the APIs of other program language, taos_cleanup is not available yet. // So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning. atexit(taos_cleanup); - + initTscQhandle(); errno = TSDB_CODE_SUCCESS; taosSeedRand(taosGetTimestampSec()); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b6009ebbda..178ed63fb4 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -25,6 +25,7 @@ #include "tmsgtype.h" #include "tpagedbuf.h" #include "tref.h" +#include "tsched.h" static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet); static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest); @@ -56,14 +57,14 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i } bool chkRequestKilled(void* param) { - bool killed = false; + bool killed = false; SRequestObj* pRequest = acquireRequest((int64_t)param); if (NULL == pRequest || pRequest->killed) { killed = true; } releaseRequest((int64_t)param); - + return killed; } @@ -769,7 +770,7 @@ 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; @@ -1236,7 +1237,16 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, } } -void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { +typedef struct SchedArg { + SRpcMsg msg; + SEpSet* pEpset; +} SchedArg; + +void doProcessMsgFromServer(SSchedMsg* schedMsg) { + SchedArg* arg = (SchedArg*)schedMsg->ahandle; + SRpcMsg* pMsg = &arg->msg; + SEpSet* pEpSet = arg->pEpset; + SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; assert(pMsg->info.ahandle != NULL); STscObj* pTscObj = NULL; @@ -1269,7 +1279,8 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { updateTargetEpSet(pSendInfo, pTscObj, pMsg, pEpSet); - SDataBuf buf = {.msgType = pMsg->msgType, .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); @@ -1284,6 +1295,25 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { pSendInfo->fp(pSendInfo->param, &buf, pMsg->code); rpcFreeCont(pMsg->pCont); destroySendMsgInfo(pSendInfo); + + taosMemoryFree(arg); +} + +void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { + SSchedMsg schedMsg = {0}; + + SEpSet* tEpSet = pEpSet != NULL ? taosMemoryCalloc(1, sizeof(SEpSet)) : NULL; + if (tEpSet != NULL) { + *tEpSet = *pEpSet; + } + + SchedArg* arg = taosMemoryCalloc(1, sizeof(SchedArg)); + arg->msg = *pMsg; + arg->pEpset = tEpSet; + + schedMsg.fp = doProcessMsgFromServer; + schedMsg.ahandle = arg; + taosScheduleTask(tscQhandle, &schedMsg); } TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, const char* db, uint16_t port) { @@ -1412,7 +1442,7 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU pParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); tsem_init(&pParam->sem, 0, 0); } - + // convert ucs4 to native multi-bytes string pResultInfo->convertUcs4 = convertUcs4; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index d8a9ce581a..dcfe65f6be 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -47,11 +47,9 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) { atomic_store_32(&lock, 0); return ret; } - // this function may be called by user or system, or by both simultaneously. void taos_cleanup(void) { - tscInfo("start to cleanup client environment"); - + tscInfo("start to cleanup client environment"); if (atomic_val_compare_exchange_32(&sentinel, TSC_VAR_NOT_RELEASE, TSC_VAR_RELEASED) != TSC_VAR_NOT_RELEASE) { return; } @@ -74,8 +72,8 @@ void taos_cleanup(void) { catalogDestroy(); schedulerDestroy(); + cleanupTscQhandle(); rpcCleanup(); - tscInfo("all local resources released"); taosCleanupCfg(); taosCloseLog(); @@ -108,7 +106,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha if (pObj) { int64_t *rid = taosMemoryCalloc(1, sizeof(int64_t)); *rid = pObj->id; - return (TAOS*)rid; + return (TAOS *)rid; } return NULL; @@ -196,9 +194,9 @@ void taos_kill_query(TAOS *taos) { if (NULL == taos) { return; } - int64_t rid = *(int64_t*)taos; - - STscObj* pTscObj = acquireTscObj(rid); + int64_t rid = *(int64_t *)taos; + + STscObj *pTscObj = acquireTscObj(rid); closeAllRequests(pTscObj->pRequests); releaseTscObj(rid); } @@ -244,7 +242,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { #endif } else if (TD_RES_TMQ(res)) { - SMqRspObj *msg = ((SMqRspObj *)res); + SMqRspObj * msg = ((SMqRspObj *)res); SReqResultInfo *pResultInfo; if (msg->resIter == -1) { pResultInfo = tmqGetNextResInfo(res, true); @@ -420,7 +418,7 @@ int taos_affected_rows(TAOS_RES *res) { return 0; } - SRequestObj *pRequest = (SRequestObj *)res; + SRequestObj * pRequest = (SRequestObj *)res; SReqResultInfo *pResInfo = &pRequest->body.resInfo; return pResInfo->numOfRows; } @@ -606,7 +604,7 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) { } SReqResultInfo *pResInfo = tscGetCurResInfo(res); - TAOS_FIELD *pField = &pResInfo->userFields[columnIndex]; + TAOS_FIELD * pField = &pResInfo->userFields[columnIndex]; if (!IS_VAR_DATA_TYPE(pField->type)) { return 0; } @@ -650,8 +648,8 @@ const char *taos_get_server_info(TAOS *taos) { typedef struct SqlParseWrapper { SParseContext *pCtx; SCatalogReq catalogReq; - SRequestObj *pRequest; - SQuery *pQuery; + SRequestObj * pRequest; + SQuery * pQuery; } SqlParseWrapper; static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) { @@ -672,8 +670,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { tscDebug("enter meta callback, code %s", tstrerror(code)); SqlParseWrapper *pWrapper = (SqlParseWrapper *)param; - SQuery *pQuery = pWrapper->pQuery; - SRequestObj *pRequest = pWrapper->pRequest; + SQuery * pQuery = pWrapper->pQuery; + SRequestObj * pRequest = pWrapper->pRequest; if (code == TSDB_CODE_SUCCESS) { code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery); @@ -722,31 +720,29 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) { return TSDB_CODE_OUT_OF_MEMORY; } - **pCxt = (SParseContext){ - .requestId = pRequest->requestId, - .requestRid = pRequest->self, - .acctId = pTscObj->acctId, - .db = pRequest->pDb, - .topicQuery = false, - .pSql = pRequest->sqlstr, - .sqlLen = pRequest->sqlLen, - .pMsg = pRequest->msgBuf, - .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, - .pTransporter = pTscObj->pAppInfo->pTransporter, - .pStmtCb = NULL, - .pUser = pTscObj->user, - .schemalessType = pTscObj->schemalessType, - .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)), - .async = true, - .svrVer = pTscObj->sVer, - .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes) - }; + **pCxt = (SParseContext){.requestId = pRequest->requestId, + .requestRid = pRequest->self, + .acctId = pTscObj->acctId, + .db = pRequest->pDb, + .topicQuery = false, + .pSql = pRequest->sqlstr, + .sqlLen = pRequest->sqlLen, + .pMsg = pRequest->msgBuf, + .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, + .pTransporter = pTscObj->pAppInfo->pTransporter, + .pStmtCb = NULL, + .pUser = pTscObj->user, + .schemalessType = pTscObj->schemalessType, + .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)), + .async = true, + .svrVer = pTscObj->sVer, + .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)}; return TSDB_CODE_SUCCESS; } void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { SParseContext *pCxt = NULL; - STscObj *pTscObj = pRequest->pTscObj; + STscObj * pTscObj = pRequest->pTscObj; int32_t code = 0; if (pRequest->retry++ > REQUEST_TOTAL_EXEC_TIMES) { @@ -911,10 +907,10 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { return terrno; } - int64_t rid = *(int64_t*)taos; + int64_t rid = *(int64_t *)taos; const int32_t MAX_TABLE_NAME_LENGTH = 12 * 1024 * 1024; // 12MB list int32_t code = 0; - SRequestObj *pRequest = NULL; + SRequestObj * pRequest = NULL; SCatalogReq catalogReq = {0}; if (NULL == tableNameList) { From 988cffcce622ee533e2349605a42c6d0e513cec6 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 2 Jul 2022 18:19:10 +0800 Subject: [PATCH 11/63] fix: some problems of parser and planner --- include/libs/nodes/nodes.h | 5 +- include/libs/scalar/scalar.h | 2 + include/util/taoserror.h | 1 + source/libs/parser/inc/parAst.h | 1 + source/libs/parser/inc/parUtil.h | 1 + source/libs/parser/inc/sql.y | 4 +- source/libs/parser/src/parAstCreater.c | 5 + source/libs/parser/src/parInsert.c | 98 +- source/libs/parser/src/parTranslater.c | 284 ++-- source/libs/parser/src/parUtil.c | 10 +- source/libs/parser/src/sql.c | 1362 ++++++++++---------- source/libs/planner/src/planOptimizer.c | 2 + source/libs/planner/src/planSpliter.c | 4 + source/libs/planner/test/planSetOpTest.cpp | 10 +- 14 files changed, 978 insertions(+), 811 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 2153f59bf8..a8637228e4 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -22,8 +22,8 @@ extern "C" { #include "tdef.h" -#define nodeType(nodeptr) (((const SNode*)(nodeptr))->type) -#define setNodeType(nodeptr, type) (((SNode*)(nodeptr))->type = (type)) +#define nodeType(nodeptr) (((const SNode*)(nodeptr))->type) +#define setNodeType(nodeptr, nodetype) (((SNode*)(nodeptr))->type = (nodetype)) #define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0) @@ -118,6 +118,7 @@ typedef enum ENodeType { QUERY_NODE_DROP_TABLE_STMT, QUERY_NODE_DROP_SUPER_TABLE_STMT, QUERY_NODE_ALTER_TABLE_STMT, + QUERY_NODE_ALTER_SUPER_TABLE_STMT, QUERY_NODE_CREATE_USER_STMT, QUERY_NODE_ALTER_USER_STMT, QUERY_NODE_DROP_USER_STMT, diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 555274599a..aaebffa118 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -25,6 +25,8 @@ extern "C" { typedef struct SFilterInfo SFilterInfo; +int32_t scalarGetOperatorResultType(SDataType left, SDataType right, EOperatorType op, SDataType* pRes); + /* pNode will be freed in API; *pRes need to freed in caller diff --git a/include/util/taoserror.h b/include/util/taoserror.h index b871452828..2763cf1408 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -578,6 +578,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x265C) #define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D) #define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E) +#define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F) //planner #define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700) diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 4585a59612..0c9156fc4c 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -154,6 +154,7 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName); SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal); +SNode* setAlterSuperTableType(SNode* pStmt); SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index e829c9266f..896e2bc239 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -53,6 +53,7 @@ typedef struct SParseMetaCache { } SParseMetaCache; int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...); +int32_t generateSyntaxErrMsgExt(SMsgBuf* pBuf, int32_t errCode, const char* pFormat, ...); int32_t buildInvalidOperationMsg(SMsgBuf* pMsgBuf, const char* msg); int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char* sourceStr); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 2e58cc56b8..19b327f8c6 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -232,7 +232,7 @@ cmd ::= DROP TABLE multi_drop_clause(A). cmd ::= DROP STABLE exists_opt(A) full_table_name(B). { pCxt->pRootNode = createDropSuperTableStmt(pCxt, A, B); } cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; } -cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode = A; } +cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode = setAlterSuperTableType(A); } alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); } alter_table_clause(A) ::= @@ -259,7 +259,7 @@ multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). create_subtable_clause(A) ::= not_exists_opt(B) full_table_name(C) USING full_table_name(D) - specific_tags_opt(E) TAGS NK_LP literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); } + specific_tags_opt(E) TAGS NK_LP expression_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); } %type multi_drop_clause { SNodeList* } %destructor multi_drop_clause { nodesDestroyList($$); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 59fbeded60..c85c44f09b 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1127,6 +1127,11 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken return createAlterTableStmtFinalize(pRealTable, pStmt); } +SNode* setAlterSuperTableType(SNode* pStmt) { + setNodeType(pStmt, QUERY_NODE_ALTER_SUPER_TABLE_STMT); + return pStmt; +} + SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, false)) { diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index a76640d0b5..38d488bf10 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -48,6 +48,12 @@ pSql += sToken.n; \ } while (TK_NK_SPACE == sToken.type) +typedef struct SInsertParseBaseContext { + SParseContext* pComCxt; + char* pSql; + SMsgBuf msg; +} SInsertParseBaseContext; + typedef struct SInsertParseContext { SParseContext* pComCxt; // input char* pSql; // input @@ -1105,6 +1111,32 @@ static int32_t storeTableMeta(SInsertParseContext* pCxt, SHashObj* pHash, SName* return taosHashPut(pHash, pName, len, &pBackup, POINTER_BYTES); } +static int32_t skipParentheses(SInsertParseSyntaxCxt* pCxt) { + SToken sToken; + int32_t expectRightParenthesis = 1; + while (1) { + NEXT_TOKEN(pCxt->pSql, sToken); + if (TK_NK_LP == sToken.type) { + ++expectRightParenthesis; + } else if (TK_NK_RP == sToken.type && 0 == --expectRightParenthesis) { + break; + } + if (0 == sToken.n) { + return buildSyntaxErrMsg(&pCxt->msg, ") expected", NULL); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t skipBoundColumns(SInsertParseSyntaxCxt* pCxt) { return skipParentheses(pCxt); } + +static int32_t ignoreBoundColumns(SInsertParseContext* pCxt) { + SInsertParseSyntaxCxt cxt = {.pComCxt = pCxt->pComCxt, .pSql = pCxt->pSql, .msg = pCxt->msg, .pMetaCache = NULL}; + int32_t code = skipBoundColumns(&cxt); + pCxt->pSql = cxt.pSql; + return code; +} + static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt); // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) @@ -1453,8 +1485,25 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { tNameGetFullDbName(&name, dbFName); CHECK_CODE(taosHashPut(pCxt->pDbFNameHashObj, dbFName, strlen(dbFName), dbFName, sizeof(dbFName))); + bool existedUsing = false; // USING clause if (TK_USING == sToken.type) { + existedUsing = true; + CHECK_CODE(parseUsingClause(pCxt, &name, tbFName)); + NEXT_TOKEN(pCxt->pSql, sToken); + autoCreateTbl = true; + } + + char* pBoundColsStart = NULL; + if (TK_NK_LP == sToken.type) { + // pSql -> field1_name, ...) + pBoundColsStart = pCxt->pSql; + CHECK_CODE(ignoreBoundColumns(pCxt)); + // CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta))); + NEXT_TOKEN(pCxt->pSql, sToken); + } + + if (TK_USING == sToken.type && !existedUsing) { CHECK_CODE(parseUsingClause(pCxt, &name, tbFName)); NEXT_TOKEN(pCxt->pSql, sToken); autoCreateTbl = true; @@ -1467,10 +1516,11 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL, &pCxt->createTblReq)); - if (TK_NK_LP == sToken.type) { - // pSql -> field1_name, ...) + if (NULL != pBoundColsStart) { + char* pCurrPos = pCxt->pSql; + pCxt->pSql = pBoundColsStart; CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta))); - NEXT_TOKEN(pCxt->pSql, sToken); + pCxt->pSql = pCurrPos; } if (TK_VALUES == sToken.type) { @@ -1610,25 +1660,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache return code; } -static int32_t skipParentheses(SInsertParseSyntaxCxt* pCxt) { - SToken sToken; - int32_t expectRightParenthesis = 1; - while (1) { - NEXT_TOKEN(pCxt->pSql, sToken); - if (TK_NK_LP == sToken.type) { - ++expectRightParenthesis; - } else if (TK_NK_RP == sToken.type && 0 == --expectRightParenthesis) { - break; - } - if (0 == sToken.n) { - return buildSyntaxErrMsg(&pCxt->msg, ") expected", NULL); - } - } - return TSDB_CODE_SUCCESS; -} - -static int32_t skipBoundColumns(SInsertParseSyntaxCxt* pCxt) { return skipParentheses(pCxt); } - // pSql -> (field1_value, ...) [(field1_value2, ...) ...] static int32_t skipValuesClause(SInsertParseSyntaxCxt* pCxt) { int32_t numOfRows = 0; @@ -1717,8 +1748,25 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) { SToken tbnameToken = sToken; NEXT_TOKEN(pCxt->pSql, sToken); + bool existedUsing = false; // USING clause if (TK_USING == sToken.type) { + existedUsing = true; + CHECK_CODE(collectAutoCreateTableMetaKey(pCxt, &tbnameToken)); + NEXT_TOKEN(pCxt->pSql, sToken); + CHECK_CODE(collectTableMetaKey(pCxt, &sToken)); + CHECK_CODE(skipUsingClause(pCxt)); + NEXT_TOKEN(pCxt->pSql, sToken); + } + + if (TK_NK_LP == sToken.type) { + // pSql -> field1_name, ...) + CHECK_CODE(skipBoundColumns(pCxt)); + NEXT_TOKEN(pCxt->pSql, sToken); + } + + if (TK_USING == sToken.type && !existedUsing) { + existedUsing = true; CHECK_CODE(collectAutoCreateTableMetaKey(pCxt, &tbnameToken)); NEXT_TOKEN(pCxt->pSql, sToken); CHECK_CODE(collectTableMetaKey(pCxt, &sToken)); @@ -1728,12 +1776,6 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) { CHECK_CODE(collectTableMetaKey(pCxt, &tbnameToken)); } - if (TK_NK_LP == sToken.type) { - // pSql -> field1_name, ...) - CHECK_CODE(skipBoundColumns(pCxt)); - NEXT_TOKEN(pCxt->pSql, sToken); - } - if (TK_VALUES == sToken.type) { // pSql -> (field1_value, ...) [(field1_value2, ...) ...] CHECK_CODE(skipValuesClause(pCxt)); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2b5993b800..72a0046044 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1248,6 +1248,22 @@ static int32_t translateForbidGroupByFunc(STranslateContext* pCxt, SFunctionNode return TSDB_CODE_SUCCESS; } +static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* pFunc) { + if (!fmIsRepeatScanFunc(pFunc->funcId)) { + return TSDB_CODE_SUCCESS; + } + if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { + SNode* pTable = ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable; + if (QUERY_NODE_REAL_TABLE == nodeType(pTable) && + (TSDB_CHILD_TABLE == ((SRealTableNode*)pTable)->pMeta->tableType || + TSDB_NORMAL_TABLE == ((SRealTableNode*)pTable)->pMeta->tableType)) { + return TSDB_CODE_SUCCESS; + } + } + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, + "%s is only supported in single table query", pFunc->functionName); +} + static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) { if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) { SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt; @@ -1370,6 +1386,9 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p if (TSDB_CODE_SUCCESS == code) { code = translateForbidGroupByFunc(pCxt, pFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = translateRepeatScanFunc(pCxt, pFunc); + } if (TSDB_CODE_SUCCESS == code) { setFuncClassification(pCxt->pCurrStmt, pFunc); } @@ -3743,12 +3762,24 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* return TSDB_CODE_SUCCESS; } -static SSchema* getColSchema(STableMeta* pTableMeta, const char* pTagName) { +static SSchema* getColSchema(STableMeta* pTableMeta, const char* pColName) { int32_t numOfFields = getNumOfTags(pTableMeta) + getNumOfColumns(pTableMeta); for (int32_t i = 0; i < numOfFields; ++i) { - SSchema* pTagSchema = pTableMeta->schema + i; - if (0 == strcmp(pTagName, pTagSchema->name)) { - return pTagSchema; + SSchema* pSchema = pTableMeta->schema + i; + if (0 == strcmp(pColName, pSchema->name)) { + return pSchema; + } + } + return NULL; +} + +static SSchema* getTagSchema(STableMeta* pTableMeta, const char* pTagName) { + int32_t numOfTags = getNumOfTags(pTableMeta); + SSchema* pTagsSchema = getTableTagSchema(pTableMeta); + for (int32_t i = 0; i < numOfTags; ++i) { + SSchema* pSchema = pTagsSchema + i; + if (0 == strcmp(pTagName, pSchema->name)) { + return pSchema; } } return NULL; @@ -3756,19 +3787,24 @@ static SSchema* getColSchema(STableMeta* pTableMeta, const char* pTagName) { static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) { if (TSDB_ALTER_TABLE_UPDATE_TAG_VAL == pStmt->alterType || TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME == pStmt->alterType) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, + "Set tag value only available for child table"); } if (TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES == pStmt->alterType || TSDB_ALTER_TABLE_UPDATE_TAG_BYTES == pStmt->alterType) { STableMeta* pTableMeta = NULL; int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); if (TSDB_CODE_SUCCESS == code) { + if (TSDB_SUPER_TABLE != pTableMeta->tableType) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Table is not super table"); + } + SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); if (NULL == pSchema) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type || pSchema->bytes >= calcTypeBytes(pStmt->dataType)) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL); } } return code; @@ -4455,6 +4491,7 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { code = translateDropSuperTable(pCxt, (SDropSuperTableStmt*)pNode); break; case QUERY_NODE_ALTER_TABLE_STMT: + case QUERY_NODE_ALTER_SUPER_TABLE_STMT: code = translateAlterSuperTable(pCxt, (SAlterTableStmt*)pNode); break; case QUERY_NODE_CREATE_USER_STMT: @@ -5222,31 +5259,81 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S } } -static int32_t createValueFromFunction(STranslateContext* pCxt, SFunctionNode* pFunc, SValueNode** pVal) { - int32_t code = getFuncInfo(pCxt, pFunc); - if (TSDB_CODE_SUCCESS == code) { - code = scalarCalculateConstants((SNode*)pFunc, (SNode**)pVal); - } - return code; -} +// static int32_t createValueFromFunction(STranslateContext* pCxt, SFunctionNode* pFunc, SValueNode** pVal) { +// int32_t code = getFuncInfo(pCxt, pFunc); +// if (TSDB_CODE_SUCCESS == code) { +// code = scalarCalculateConstants((SNode*)pFunc, (SNode**)pVal); +// } +// return code; +// } static SDataType schemaToDataType(uint8_t precision, SSchema* pSchema) { SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes, .precision = precision, .scale = 0}; return dt; } -static int32_t translateTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode, - SValueNode** pVal) { - if (QUERY_NODE_FUNCTION == nodeType(pNode)) { - return createValueFromFunction(pCxt, (SFunctionNode*)pNode, pVal); - } else if (QUERY_NODE_VALUE == nodeType(pNode)) { - return (DEAL_RES_ERROR == translateValueImpl(pCxt, (SValueNode*)pNode, schemaToDataType(precision, pSchema)) - ? pCxt->errCode - : TSDB_CODE_SUCCESS); - } else { - // return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName); - return TSDB_CODE_FAILED; +// static int32_t createValueFromExpr(STranslateContext* pCxt, SNode* pNode, SValueNode** pVal) { +// SNode* pExpr = nodesCloneNode(pNode); +// if (NULL == pExpr) { +// return TSDB_CODE_OUT_OF_MEMORY; +// } + +// SNode* pNew = NULL; +// int32_t code = translateExpr(pCxt, &pExpr); +// if (TSDB_CODE_SUCCESS == code) { +// code = scalarCalculateConstants(pExpr, &pNew); +// } +// if (TSDB_CODE_SUCCESS == code) { +// pExpr = pNew; +// if (QUERY_NODE_VALUE != nodeType(pExpr)) { +// code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName); +// } +// } + +// if (TSDB_CODE_SUCCESS == code) { +// *pVal = pExpr; +// } else { +// nodesDestroyNode(pExpr); +// } +// return code; +// } + +static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SDataType dt, SNode** pCast) { + SNode* pExpr = nodesCloneNode(pNode); + if (NULL == pExpr) { + return TSDB_CODE_OUT_OF_MEMORY; } + int32_t code = createCastFunc(pCxt, pExpr, dt, pCast); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode(pExpr); + } + return code; +} + +static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode, + SValueNode** pVal) { + SNode* pCast = NULL; + int32_t code = createCastFuncForTag(pCxt, pNode, schemaToDataType(precision, pSchema), &pCast); + if (TSDB_CODE_SUCCESS == code) { + code = translateExpr(pCxt, &pCast); + } + SNode* pNew = NULL; + if (TSDB_CODE_SUCCESS == code) { + code = scalarCalculateConstants(pCast, &pNew); + } + if (TSDB_CODE_SUCCESS == code) { + pCast = pNew; + if (QUERY_NODE_VALUE != nodeType(pCast)) { + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName); + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pVal = (SValueNode*)pCast; + } else { + nodesDestroyNode(pCast); + } + return code; } static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray, @@ -5285,56 +5372,45 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla if (NULL == pTagArray) { return TSDB_CODE_OUT_OF_MEMORY; } - int32_t code = TSDB_CODE_SUCCESS; - SSchema* pTagSchema = getTableTagSchema(pSuperTableMeta); - SNode * pTag = NULL, *pNode = NULL; - bool isJson = false; + + int32_t code = TSDB_CODE_SUCCESS; + + bool isJson = false; + SNodeList* pVals = NULL; + SNode * pTag = NULL, *pNode = NULL; FORBOTH(pTag, pStmt->pSpecificTags, pNode, pStmt->pValsOfTags) { SColumnNode* pCol = (SColumnNode*)pTag; - SSchema* pSchema = NULL; - for (int32_t i = 0; i < numOfTags; ++i) { - if (0 == strcmp(pCol->colName, pTagSchema[i].name)) { - pSchema = pTagSchema + i; - break; - } - } + SSchema* pSchema = getTagSchema(pSuperTableMeta, pCol->colName); if (NULL == pSchema) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, pCol->colName); - goto end; } SValueNode* pVal = NULL; - code = translateTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pSchema, pNode, &pVal); - if (TSDB_CODE_SUCCESS != code) { - goto end; + if (TSDB_CODE_SUCCESS == code) { + code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pSchema, pNode, &pVal); } - - if (NULL == pVal) { - pVal = (SValueNode*)pNode; - } else { - REPLACE_LIST2_NODE(pVal); - } - - if (pSchema->type == TSDB_DATA_TYPE_JSON) { - isJson = true; - code = buildJsonTagVal(pCxt, pSchema, pVal, pTagArray, ppTag); - } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { - code = buildNormalTagVal(pCxt, pSchema, pVal, pTagArray); - } - } - - if (!isJson) code = tTagNew(pTagArray, 1, false, ppTag); - -end: - if (isJson) { - for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { - STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); - if (IS_VAR_DATA_TYPE(p->type)) { - taosMemoryFree(p->pData); + if (TSDB_CODE_SUCCESS == code) { + if (pSchema->type == TSDB_DATA_TYPE_JSON) { + isJson = true; + code = buildJsonTagVal(pCxt, pSchema, pVal, pTagArray, ppTag); + } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { + code = buildNormalTagVal(pCxt, pSchema, pVal, pTagArray); } } + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeAppend(&pVals, (SNode*)pVal); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } } + + if (TSDB_CODE_SUCCESS == code && !isJson) { + code = tTagNew(pTagArray, 1, false, ppTag); + } + + nodesDestroyList(pVals); taosArrayDestroy(pTagArray); - return TSDB_CODE_SUCCESS; + return code; } static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, @@ -5343,64 +5419,52 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TAGS_NOT_MATCHED); } - SSchema* pTagSchemas = getTableTagSchema(pSuperTableMeta); - SNode* pNode; - int32_t code = TSDB_CODE_SUCCESS; - int32_t index = 0; - SArray* pTagArray = taosArrayInit(LIST_LENGTH(pStmt->pValsOfTags), sizeof(STagVal)); - if (!pTagArray) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_TSC_OUT_OF_MEMORY); + SArray* pTagArray = taosArrayInit(LIST_LENGTH(pStmt->pValsOfTags), sizeof(STagVal)); + if (NULL == pTagArray) { + return TSDB_CODE_OUT_OF_MEMORY; } - bool isJson = false; + int32_t code = TSDB_CODE_SUCCESS; + + bool isJson = false; + int32_t index = 0; + SSchema* pTagSchemas = getTableTagSchema(pSuperTableMeta); + SNodeList* pVals = NULL; + SNode* pNode; FOREACH(pNode, pStmt->pValsOfTags) { SValueNode* pVal = NULL; SSchema* pTagSchema = pTagSchemas + index; - code = translateTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pTagSchema, pNode, &pVal); + code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pTagSchema, pNode, &pVal); + if (TSDB_CODE_SUCCESS == code) { + if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { + isJson = true; + code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag); + } 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)) { + val.pData = varDataVal(tmpVal); + val.nData = varDataLen(tmpVal); + } else { + memcpy(&val.i64, tmpVal, pTagSchema->bytes); + } + taosArrayPush(pTagArray, &val); + } + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeAppend(&pVals, (SNode*)pVal); + } if (TSDB_CODE_SUCCESS != code) { - goto end; - } - if (NULL == pVal) { - pVal = (SValueNode*)pNode; - } else { - REPLACE_NODE(pVal); - } - if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { - if (pVal->literal && strlen(pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { - code = buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pVal->literal); - goto end; - } - - isJson = true; - code = parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - } 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)) { - val.pData = varDataVal(tmpVal); - val.nData = varDataLen(tmpVal); - } else { - memcpy(&val.i64, tmpVal, pTagSchema->bytes); - } - taosArrayPush(pTagArray, &val); + break; } ++index; } - if (!isJson) code = tTagNew(pTagArray, 1, false, ppTag); -end: - if (isJson) { - for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { - STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); - if (IS_VAR_DATA_TYPE(p->type)) { - taosMemoryFree(p->pData); - } - } + if (TSDB_CODE_SUCCESS == code && !isJson) { + code = tTagNew(pTagArray, 1, false, ppTag); } + nodesDestroyList(pVals); taosArrayDestroy(pTagArray); return code; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 168e51a2bb..69917ad7f9 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -215,13 +215,21 @@ int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...) { return errCode; } +int32_t generateSyntaxErrMsgExt(SMsgBuf* pBuf, int32_t errCode, const char* pFormat, ...) { + va_list vArgList; + va_start(vArgList, pFormat); + vsnprintf(pBuf->buf, pBuf->len, pFormat, vArgList); + va_end(vArgList); + return errCode; +} + int32_t buildInvalidOperationMsg(SMsgBuf* pBuf, const char* msg) { strncpy(pBuf->buf, msg, pBuf->len); return TSDB_CODE_TSC_INVALID_OPERATION; } int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char* sourceStr) { - if(pBuf == NULL) return TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + if (pBuf == NULL) return TSDB_CODE_TSC_SQL_SYNTAX_ERROR; const char* msgFormat1 = "syntax error near \'%s\'"; const char* msgFormat2 = "syntax error near \'%s\' (%s)"; const char* msgFormat3 = "%s"; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index e4317d97b0..fe6e36bf5b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -216,609 +216,635 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2471) +#define YY_ACTTAB_COUNT (2609) static const YYACTIONTYPE yy_action[] = { - /* 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, + /* 0 */ 422, 1563, 423, 1475, 1900, 430, 1438, 423, 1475, 69, + /* 10 */ 69, 379, 40, 38, 1744, 141, 1775, 1899, 541, 1531, + /* 20 */ 333, 1897, 1238, 115, 534, 1741, 41, 39, 37, 36, + /* 30 */ 35, 1570, 1569, 1313, 101, 1236, 1565, 100, 99, 98, + /* 40 */ 97, 96, 95, 94, 93, 92, 120, 1741, 297, 544, + /* 50 */ 1745, 1737, 1743, 322, 338, 1757, 1308, 1619, 1621, 14, + /* 60 */ 544, 1741, 533, 562, 439, 1244, 343, 546, 1263, 40, + /* 70 */ 38, 1376, 541, 1737, 1743, 1552, 1900, 333, 140, 1238, + /* 80 */ 1452, 167, 1, 1775, 544, 562, 118, 1737, 1743, 158, + /* 90 */ 1313, 569, 1236, 1897, 373, 464, 1727, 1900, 568, 562, + /* 100 */ 120, 245, 1842, 540, 649, 539, 67, 1900, 1900, 66, + /* 110 */ 1898, 44, 546, 1308, 1897, 1056, 14, 463, 1315, 1316, + /* 120 */ 157, 159, 1244, 1788, 1897, 1897, 1263, 87, 1758, 571, + /* 130 */ 1760, 1761, 567, 439, 562, 1900, 60, 1834, 1380, 2, + /* 140 */ 118, 300, 1830, 541, 1262, 1058, 43, 1262, 157, 151, + /* 150 */ 652, 210, 1897, 1900, 543, 153, 1842, 1843, 1004, 1847, + /* 160 */ 1003, 649, 1613, 1239, 262, 1237, 159, 31, 255, 987, + /* 170 */ 1897, 120, 535, 458, 320, 1315, 1316, 60, 149, 73, + /* 180 */ 604, 203, 138, 642, 638, 634, 630, 260, 1005, 1242, + /* 190 */ 1243, 1576, 1291, 1292, 1294, 1295, 1296, 1297, 1298, 564, + /* 200 */ 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, 991, + /* 210 */ 992, 118, 85, 1323, 421, 225, 372, 425, 371, 1262, + /* 220 */ 1239, 160, 1237, 412, 1136, 1137, 154, 1842, 1843, 1261, + /* 230 */ 1847, 34, 33, 310, 505, 41, 39, 37, 36, 35, + /* 240 */ 71, 299, 319, 541, 507, 1671, 1242, 1243, 514, 1291, + /* 250 */ 1292, 1294, 1295, 1296, 1297, 1298, 564, 560, 1306, 1307, + /* 260 */ 1309, 1310, 1311, 1312, 1314, 1317, 40, 38, 1440, 171, + /* 270 */ 170, 120, 1626, 1674, 333, 160, 1238, 216, 217, 321, + /* 280 */ 212, 311, 301, 309, 308, 160, 462, 1313, 1624, 1236, + /* 290 */ 464, 530, 110, 109, 108, 107, 106, 105, 104, 103, + /* 300 */ 102, 1211, 1463, 205, 517, 429, 1276, 517, 425, 517, + /* 310 */ 1308, 118, 463, 14, 1335, 111, 160, 1293, 111, 1244, + /* 320 */ 162, 61, 460, 40, 38, 465, 155, 1842, 1843, 60, + /* 330 */ 1847, 333, 1574, 1238, 1502, 1574, 2, 1574, 299, 427, + /* 340 */ 1462, 507, 1244, 1727, 1313, 1260, 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, + /* 360 */ 583, 1111, 1112, 580, 577, 1550, 517, 1308, 1336, 536, + /* 370 */ 531, 600, 1315, 1316, 1617, 1461, 1244, 377, 37, 36, + /* 380 */ 35, 1727, 34, 33, 1620, 1621, 41, 39, 37, 36, + /* 390 */ 35, 1341, 1293, 8, 1574, 626, 625, 624, 341, 60, /* 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, + /* 410 */ 610, 609, 131, 605, 596, 649, 1727, 1239, 1849, 1237, + /* 420 */ 34, 33, 1397, 604, 41, 39, 37, 36, 35, 1315, + /* 430 */ 1316, 1551, 30, 331, 1330, 1331, 1332, 1333, 1334, 1338, + /* 440 */ 1339, 1340, 1846, 1242, 1243, 607, 1291, 1292, 1294, 1295, + /* 450 */ 1296, 1297, 1298, 564, 560, 1306, 1307, 1309, 1310, 1311, + /* 460 */ 1312, 1314, 1317, 527, 1395, 1396, 1398, 1399, 160, 517, + /* 470 */ 474, 473, 471, 470, 1239, 472, 1237, 1559, 116, 469, + /* 480 */ 378, 84, 468, 467, 466, 34, 33, 11, 10, 41, + /* 490 */ 39, 37, 36, 35, 117, 1407, 1004, 1574, 1003, 209, + /* 500 */ 1242, 1243, 1566, 1291, 1292, 1294, 1295, 1296, 1297, 1298, + /* 510 */ 564, 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, + /* 520 */ 40, 38, 1318, 336, 479, 602, 1005, 72, 333, 1433, + /* 530 */ 1238, 138, 160, 1505, 504, 189, 301, 1561, 160, 489, + /* 540 */ 1576, 1313, 339, 1236, 129, 128, 599, 598, 597, 144, + /* 550 */ 138, 517, 497, 202, 456, 452, 448, 444, 188, 1576, + /* 560 */ 77, 517, 382, 517, 1308, 620, 618, 482, 1335, 1349, + /* 570 */ 490, 476, 397, 1244, 398, 1900, 201, 40, 38, 1574, + /* 580 */ 1626, 1567, 517, 70, 58, 333, 186, 1238, 157, 1574, + /* 590 */ 9, 1574, 1897, 438, 474, 473, 1625, 364, 1313, 472, + /* 600 */ 1236, 55, 116, 469, 54, 517, 468, 467, 466, 7, + /* 610 */ 1574, 1900, 649, 1670, 517, 294, 1571, 1432, 517, 366, + /* 620 */ 362, 1308, 1336, 1373, 157, 1703, 1315, 1316, 1897, 498, + /* 630 */ 1244, 34, 33, 1574, 1460, 41, 39, 37, 36, 35, + /* 640 */ 991, 992, 1574, 1626, 1459, 1341, 1574, 9, 185, 178, + /* 650 */ 337, 183, 1849, 1264, 517, 435, 34, 33, 1458, 1624, + /* 660 */ 41, 39, 37, 36, 35, 502, 23, 1664, 517, 649, + /* 670 */ 1669, 1239, 294, 1237, 176, 1727, 1845, 215, 169, 515, + /* 680 */ 1457, 550, 1574, 1315, 1316, 1727, 30, 331, 1330, 1331, + /* 690 */ 1332, 1333, 1334, 1338, 1339, 1340, 1574, 1242, 1243, 1727, + /* 700 */ 1291, 1292, 1294, 1295, 1296, 1297, 1298, 564, 560, 1306, + /* 710 */ 1307, 1309, 1310, 1311, 1312, 1314, 1317, 1441, 34, 33, + /* 720 */ 488, 1727, 41, 39, 37, 36, 35, 1849, 1239, 601, + /* 730 */ 1237, 1387, 1617, 486, 267, 484, 1456, 1604, 101, 1219, + /* 740 */ 1220, 100, 99, 98, 97, 96, 95, 94, 93, 92, + /* 750 */ 608, 1844, 1546, 541, 1242, 1243, 1715, 1291, 1292, 1294, + /* 760 */ 1295, 1296, 1297, 1298, 564, 560, 1306, 1307, 1309, 1310, + /* 770 */ 1311, 1312, 1314, 1317, 40, 38, 296, 1727, 1260, 553, + /* 780 */ 517, 120, 333, 247, 1238, 405, 1453, 1455, 417, 517, + /* 790 */ 1369, 516, 602, 1276, 1454, 1313, 1265, 1236, 1557, 505, + /* 800 */ 256, 1337, 546, 352, 1451, 390, 1262, 418, 1574, 392, + /* 810 */ 1672, 129, 128, 599, 598, 597, 1247, 1574, 1308, 548, + /* 820 */ 517, 118, 1854, 1369, 1342, 45, 4, 1244, 1727, 52, + /* 830 */ 501, 340, 1450, 138, 1449, 1727, 245, 1842, 540, 383, + /* 840 */ 539, 1372, 1577, 1900, 2, 1727, 34, 33, 1574, 528, + /* 850 */ 41, 39, 37, 36, 35, 194, 157, 206, 192, 1448, + /* 860 */ 1897, 1238, 1447, 34, 33, 28, 649, 41, 39, 37, + /* 870 */ 36, 35, 1446, 1727, 1236, 1727, 563, 1246, 551, 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, + /* 900 */ 1727, 381, 380, 1727, 1244, 27, 1445, 11, 10, 139, + /* 910 */ 619, 34, 33, 1727, 273, 41, 39, 37, 36, 35, + /* 920 */ 1549, 196, 1435, 1436, 195, 1239, 227, 1237, 271, 57, + /* 930 */ 1444, 1492, 56, 1443, 198, 200, 42, 197, 199, 558, + /* 940 */ 1532, 1747, 214, 649, 1757, 595, 1250, 1727, 172, 250, + /* 950 */ 367, 1242, 1243, 475, 1291, 1292, 1294, 1295, 1296, 1297, + /* 960 */ 1298, 564, 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, + /* 970 */ 1317, 1727, 1775, 60, 1727, 123, 1187, 1749, 554, 1293, + /* 980 */ 569, 491, 218, 29, 1487, 1727, 1485, 568, 137, 34, + /* 990 */ 33, 457, 126, 41, 39, 37, 36, 35, 127, 50, + /* 1000 */ 231, 546, 1239, 42, 1237, 42, 477, 1249, 480, 42, + /* 1010 */ 239, 86, 1788, 575, 602, 510, 87, 1758, 571, 1760, + /* 1020 */ 1761, 567, 1757, 562, 1481, 1776, 1834, 342, 1242, 1243, + /* 1030 */ 300, 1830, 224, 129, 128, 599, 598, 597, 1087, 1394, + /* 1040 */ 234, 126, 1900, 1343, 127, 1299, 64, 63, 376, 266, + /* 1050 */ 1775, 166, 112, 1115, 83, 157, 1028, 370, 545, 1897, + /* 1060 */ 1476, 1614, 126, 1727, 80, 568, 1864, 542, 244, 1327, + /* 1070 */ 295, 249, 644, 360, 252, 358, 354, 350, 163, 345, + /* 1080 */ 254, 1119, 3, 1757, 1126, 5, 1029, 1260, 347, 344, + /* 1090 */ 1788, 351, 1124, 306, 88, 1758, 571, 1760, 1761, 567, + /* 1100 */ 1757, 562, 130, 1056, 1834, 307, 1203, 263, 326, 1830, + /* 1110 */ 152, 1775, 160, 399, 1666, 168, 406, 413, 414, 545, + /* 1120 */ 415, 419, 156, 1266, 1727, 420, 568, 428, 1775, 1269, + /* 1130 */ 1860, 175, 431, 177, 1268, 432, 569, 433, 1270, 180, + /* 1140 */ 434, 1727, 436, 568, 182, 1267, 184, 437, 68, 440, + /* 1150 */ 187, 1788, 461, 1757, 459, 88, 1758, 571, 1760, 1761, + /* 1160 */ 567, 1564, 562, 492, 264, 1834, 124, 191, 1788, 326, + /* 1170 */ 1830, 152, 88, 1758, 571, 1760, 1761, 567, 298, 562, + /* 1180 */ 91, 1775, 1834, 1560, 193, 132, 326, 1830, 1913, 569, + /* 1190 */ 133, 1861, 1562, 1558, 1727, 134, 568, 1868, 135, 324, + /* 1200 */ 323, 1708, 204, 207, 493, 499, 496, 503, 1757, 1252, + /* 1210 */ 525, 211, 506, 511, 1707, 316, 512, 220, 1676, 508, + /* 1220 */ 1313, 1788, 1245, 318, 222, 88, 1758, 571, 1760, 1761, + /* 1230 */ 567, 125, 562, 513, 76, 1834, 1775, 265, 1575, 326, + /* 1240 */ 1830, 1913, 1265, 1308, 569, 1865, 521, 529, 1875, 1727, + /* 1250 */ 1891, 568, 1244, 1874, 1856, 229, 538, 523, 233, 524, + /* 1260 */ 325, 532, 6, 522, 520, 519, 1369, 119, 1264, 552, + /* 1270 */ 555, 19, 1757, 146, 238, 243, 1788, 1850, 327, 78, + /* 1280 */ 88, 1758, 571, 1760, 1761, 567, 1757, 562, 240, 242, + /* 1290 */ 1834, 526, 241, 248, 326, 1830, 1913, 1896, 1757, 573, + /* 1300 */ 1775, 1618, 268, 549, 645, 1853, 1547, 251, 569, 556, + /* 1310 */ 1916, 253, 259, 1727, 1775, 568, 646, 1815, 648, 51, + /* 1320 */ 145, 270, 569, 272, 1721, 281, 1775, 1727, 291, 568, + /* 1330 */ 290, 1720, 62, 1719, 569, 346, 1716, 348, 349, 1727, + /* 1340 */ 1788, 568, 1231, 546, 284, 1758, 571, 1760, 1761, 567, + /* 1350 */ 1253, 562, 1248, 1232, 1788, 546, 164, 353, 280, 1758, + /* 1360 */ 571, 1760, 1761, 567, 1714, 562, 1788, 1757, 357, 355, + /* 1370 */ 280, 1758, 571, 1760, 1761, 567, 1256, 562, 356, 1713, + /* 1380 */ 1712, 359, 537, 361, 1900, 1711, 1710, 560, 1306, 1307, + /* 1390 */ 1309, 1310, 1311, 1312, 363, 1775, 1900, 159, 365, 1693, + /* 1400 */ 368, 1897, 165, 569, 369, 1206, 1205, 1687, 1727, 157, + /* 1410 */ 568, 1686, 374, 1897, 375, 1685, 1684, 1175, 1659, 1658, + /* 1420 */ 1657, 65, 1656, 1655, 1757, 1654, 1653, 1652, 388, 389, + /* 1430 */ 1651, 391, 1650, 1649, 1648, 1788, 1647, 1646, 1645, 89, + /* 1440 */ 1758, 571, 1760, 1761, 567, 1757, 562, 1644, 1643, 1834, + /* 1450 */ 1642, 1641, 1775, 1833, 1830, 1640, 1639, 1638, 1637, 122, + /* 1460 */ 569, 1636, 1635, 1634, 1633, 1727, 1632, 568, 1631, 1630, + /* 1470 */ 1629, 1177, 1628, 1775, 150, 424, 1471, 173, 113, 994, + /* 1480 */ 174, 566, 1627, 1504, 1472, 993, 1727, 426, 568, 1701, + /* 1490 */ 1695, 114, 1788, 179, 181, 1682, 89, 1758, 571, 1760, + /* 1500 */ 1761, 567, 1683, 562, 1668, 1757, 1834, 1553, 1503, 1501, + /* 1510 */ 557, 1830, 441, 1788, 443, 1499, 1497, 288, 1758, 571, + /* 1520 */ 1760, 1761, 567, 565, 562, 559, 1806, 1022, 442, 445, + /* 1530 */ 447, 449, 446, 1775, 450, 1495, 451, 455, 453, 454, + /* 1540 */ 1484, 569, 1483, 1468, 1555, 1130, 1727, 1129, 568, 190, + /* 1550 */ 49, 1554, 1055, 1054, 1053, 1052, 617, 619, 1049, 1048, + /* 1560 */ 1493, 1757, 1047, 312, 1488, 1486, 481, 313, 314, 1467, + /* 1570 */ 478, 483, 1466, 1788, 485, 1465, 487, 142, 1758, 571, + /* 1580 */ 1760, 1761, 567, 1757, 562, 1700, 90, 1213, 1694, 1775, + /* 1590 */ 136, 1681, 53, 494, 495, 1679, 315, 569, 1680, 1678, + /* 1600 */ 208, 1677, 1727, 1675, 568, 213, 1223, 1667, 15, 221, + /* 1610 */ 219, 1775, 74, 226, 75, 16, 317, 42, 1254, 569, + /* 1620 */ 1409, 547, 1914, 48, 1727, 500, 568, 509, 17, 1788, + /* 1630 */ 80, 24, 223, 89, 1758, 571, 1760, 1761, 567, 228, + /* 1640 */ 562, 230, 1391, 1834, 1757, 232, 237, 236, 1831, 13, + /* 1650 */ 143, 1788, 1747, 26, 246, 289, 1758, 571, 1760, 1761, + /* 1660 */ 567, 235, 562, 25, 1757, 1393, 1386, 1366, 79, 47, + /* 1670 */ 1365, 1746, 1775, 147, 18, 1426, 1415, 518, 1421, 10, + /* 1680 */ 569, 1420, 328, 1425, 1424, 1727, 329, 568, 1328, 1284, + /* 1690 */ 572, 1791, 1775, 20, 1303, 561, 32, 46, 1301, 1300, + /* 1700 */ 569, 148, 161, 12, 21, 1727, 22, 568, 574, 335, + /* 1710 */ 578, 1116, 1788, 1113, 576, 579, 289, 1758, 571, 1760, + /* 1720 */ 1761, 567, 1110, 562, 570, 581, 584, 582, 587, 1757, + /* 1730 */ 1093, 594, 1788, 1125, 1121, 1104, 142, 1758, 571, 1760, + /* 1740 */ 1761, 567, 585, 562, 1102, 588, 1108, 1107, 1757, 1020, + /* 1750 */ 81, 82, 59, 257, 603, 1044, 606, 1775, 258, 1106, + /* 1760 */ 1105, 1062, 330, 1042, 1041, 569, 1040, 1039, 1038, 1037, + /* 1770 */ 1727, 1036, 568, 1035, 1059, 1057, 1775, 1032, 1031, 1030, + /* 1780 */ 1027, 1915, 1500, 1026, 566, 1025, 627, 1498, 628, 1727, + /* 1790 */ 631, 568, 629, 632, 1496, 633, 635, 1788, 637, 636, + /* 1800 */ 1494, 289, 1758, 571, 1760, 1761, 567, 639, 562, 640, + /* 1810 */ 641, 1482, 643, 984, 1464, 261, 1788, 1757, 647, 650, + /* 1820 */ 288, 1758, 571, 1760, 1761, 567, 1240, 562, 269, 1807, + /* 1830 */ 651, 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, + /* 1840 */ 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, + /* 1850 */ 332, 1439, 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, + /* 1860 */ 568, 1775, 1439, 1439, 1439, 1439, 334, 1439, 1439, 569, + /* 1870 */ 1439, 1439, 1439, 1439, 1727, 1757, 568, 1439, 1439, 1439, + /* 1880 */ 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, 1439, 289, + /* 1890 */ 1758, 571, 1760, 1761, 567, 1439, 562, 1439, 1439, 1757, + /* 1900 */ 1439, 1788, 1439, 1775, 1439, 289, 1758, 571, 1760, 1761, + /* 1910 */ 567, 569, 562, 1439, 1439, 1439, 1727, 1439, 568, 1439, + /* 1920 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, + /* 1930 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, + /* 1940 */ 1727, 1757, 568, 1788, 1439, 1439, 1439, 274, 1758, 571, + /* 1950 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1439, 1439, 1439, + /* 1960 */ 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1775, + /* 1970 */ 1439, 275, 1758, 571, 1760, 1761, 567, 569, 562, 1439, + /* 1980 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1775, + /* 1990 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, + /* 2000 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1788, + /* 2010 */ 1439, 1439, 1439, 276, 1758, 571, 1760, 1761, 567, 1439, + /* 2020 */ 562, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, + /* 2030 */ 1439, 1439, 1439, 283, 1758, 571, 1760, 1761, 567, 1439, + /* 2040 */ 562, 1439, 1439, 1439, 1439, 1757, 1439, 1439, 1439, 1775, + /* 2050 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, + /* 2060 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1439, + /* 2070 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2080 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1788, + /* 2090 */ 1439, 1439, 1439, 285, 1758, 571, 1760, 1761, 567, 1439, + /* 2100 */ 562, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2110 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 277, 1758, 571, + /* 2120 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1775, + /* 2130 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, + /* 2140 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1439, + /* 2150 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2160 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1757, 568, 1788, + /* 2170 */ 1439, 1439, 1439, 286, 1758, 571, 1760, 1761, 567, 1439, + /* 2180 */ 562, 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2190 */ 1439, 1439, 1439, 1788, 1439, 1775, 1439, 278, 1758, 571, + /* 2200 */ 1760, 1761, 567, 569, 562, 1439, 1439, 1439, 1727, 1439, + /* 2210 */ 568, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, + /* 2220 */ 1439, 1439, 1439, 1439, 1727, 1757, 568, 1439, 1439, 1439, + /* 2230 */ 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, 1439, 287, + /* 2240 */ 1758, 571, 1760, 1761, 567, 1757, 562, 1439, 1439, 1439, + /* 2250 */ 1439, 1788, 1439, 1775, 1439, 279, 1758, 571, 1760, 1761, + /* 2260 */ 567, 569, 562, 1439, 1439, 1439, 1727, 1439, 568, 1439, + /* 2270 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2280 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, + /* 2290 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 292, 1758, 571, + /* 2300 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1439, + /* 2310 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 293, 1758, 571, + /* 2320 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1439, 1439, 1757, + /* 2330 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2340 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, + /* 2350 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, + /* 2360 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, + /* 2370 */ 1727, 1439, 568, 1788, 1439, 1439, 1439, 1769, 1758, 571, + /* 2380 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1439, + /* 2390 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, + /* 2400 */ 1439, 1768, 1758, 571, 1760, 1761, 567, 1439, 562, 1757, + /* 2410 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2420 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, + /* 2430 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, + /* 2440 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, + /* 2450 */ 1727, 1757, 568, 1788, 1439, 1439, 1439, 1767, 1758, 571, + /* 2460 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1757, 1439, 1439, + /* 2470 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1775, + /* 2480 */ 1439, 304, 1758, 571, 1760, 1761, 567, 569, 562, 1439, + /* 2490 */ 1439, 1439, 1727, 1439, 568, 1775, 1439, 1439, 1439, 1439, + /* 2500 */ 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, 1727, 1757, + /* 2510 */ 568, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, + /* 2520 */ 1439, 1439, 1439, 303, 1758, 571, 1760, 1761, 567, 1757, + /* 2530 */ 562, 1439, 1439, 1439, 1439, 1788, 1439, 1775, 1439, 305, + /* 2540 */ 1758, 571, 1760, 1761, 567, 569, 562, 1439, 1439, 1439, + /* 2550 */ 1727, 1439, 568, 1439, 1439, 1439, 1439, 1775, 1439, 1439, + /* 2560 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, + /* 2570 */ 1727, 1439, 568, 1439, 1439, 1439, 1439, 1788, 1439, 1439, + /* 2580 */ 1439, 302, 1758, 571, 1760, 1761, 567, 1439, 562, 1439, + /* 2590 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, + /* 2600 */ 1439, 282, 1758, 571, 1760, 1761, 567, 1439, 562, }; static const YYCODETYPE yy_lookahead[] = { - /* 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, + /* 0 */ 259, 284, 261, 262, 353, 259, 252, 261, 262, 267, + /* 10 */ 267, 263, 12, 13, 285, 268, 283, 366, 263, 272, + /* 20 */ 20, 370, 22, 280, 291, 296, 12, 13, 14, 15, + /* 30 */ 16, 289, 289, 33, 21, 35, 285, 24, 25, 26, + /* 40 */ 27, 28, 29, 30, 31, 32, 291, 296, 300, 20, + /* 50 */ 285, 322, 323, 324, 294, 255, 56, 297, 298, 59, + /* 60 */ 20, 296, 329, 334, 58, 65, 312, 312, 20, 12, + /* 70 */ 13, 14, 263, 322, 323, 0, 353, 20, 254, 22, + /* 80 */ 256, 56, 82, 283, 20, 334, 331, 322, 323, 366, + /* 90 */ 33, 291, 35, 370, 312, 94, 296, 353, 298, 334, + /* 100 */ 291, 346, 347, 348, 104, 350, 81, 353, 353, 84, + /* 110 */ 366, 82, 312, 56, 370, 35, 59, 116, 118, 119, + /* 120 */ 366, 366, 65, 323, 370, 370, 20, 327, 328, 329, + /* 130 */ 330, 331, 332, 58, 334, 353, 82, 337, 14, 82, + /* 140 */ 331, 341, 342, 263, 20, 65, 82, 20, 366, 282, + /* 150 */ 19, 56, 370, 353, 345, 346, 347, 348, 20, 350, + /* 160 */ 22, 104, 295, 163, 33, 165, 366, 338, 339, 4, + /* 170 */ 370, 291, 20, 35, 275, 118, 119, 82, 47, 84, + /* 180 */ 58, 114, 283, 52, 53, 54, 55, 56, 50, 189, + /* 190 */ 190, 292, 192, 193, 194, 195, 196, 197, 198, 199, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 44, + /* 210 */ 45, 331, 81, 14, 260, 84, 162, 263, 164, 20, + /* 220 */ 163, 221, 165, 76, 118, 119, 346, 347, 348, 20, + /* 230 */ 350, 8, 9, 37, 298, 12, 13, 14, 15, 16, + /* 240 */ 173, 174, 306, 263, 177, 309, 189, 190, 117, 192, /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - /* 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, + /* 260 */ 203, 204, 205, 206, 207, 208, 12, 13, 0, 122, + /* 270 */ 123, 291, 283, 0, 20, 221, 22, 113, 114, 290, + /* 280 */ 149, 85, 59, 87, 88, 221, 90, 33, 299, 35, + /* 290 */ 94, 148, 24, 25, 26, 27, 28, 29, 30, 31, + /* 300 */ 32, 170, 255, 172, 263, 260, 83, 263, 263, 263, + /* 310 */ 56, 331, 116, 59, 91, 274, 221, 193, 274, 65, + /* 320 */ 274, 4, 281, 12, 13, 281, 346, 347, 348, 82, + /* 330 */ 350, 20, 291, 22, 0, 291, 82, 291, 174, 14, + /* 340 */ 255, 177, 65, 296, 33, 20, 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, + /* 360 */ 108, 109, 110, 111, 112, 0, 263, 56, 145, 226, + /* 370 */ 227, 293, 118, 119, 296, 255, 65, 274, 14, 15, + /* 380 */ 16, 296, 8, 9, 297, 298, 12, 13, 14, 15, + /* 390 */ 16, 168, 193, 82, 291, 61, 62, 63, 64, 82, /* 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, + /* 410 */ 76, 77, 78, 79, 93, 104, 296, 163, 325, 165, + /* 420 */ 8, 9, 189, 58, 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, + /* 440 */ 217, 218, 349, 189, 190, 65, 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, + /* 460 */ 206, 207, 208, 230, 231, 232, 233, 234, 221, 263, + /* 470 */ 61, 62, 269, 270, 163, 66, 165, 284, 69, 70, + /* 480 */ 274, 265, 73, 74, 75, 8, 9, 1, 2, 12, + /* 490 */ 13, 14, 15, 16, 278, 83, 20, 291, 22, 56, + /* 500 */ 189, 190, 286, 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, + /* 520 */ 12, 13, 14, 275, 4, 94, 50, 84, 20, 155, + /* 530 */ 22, 283, 221, 0, 312, 33, 59, 284, 221, 19, + /* 540 */ 292, 33, 275, 35, 113, 114, 115, 116, 117, 47, + /* 550 */ 283, 263, 316, 33, 52, 53, 54, 55, 56, 292, + /* 560 */ 265, 263, 274, 263, 56, 269, 270, 47, 91, 83, + /* 570 */ 312, 51, 274, 65, 274, 353, 56, 12, 13, 291, + /* 580 */ 283, 286, 263, 81, 3, 20, 84, 22, 366, 291, + /* 590 */ 82, 291, 370, 274, 61, 62, 299, 158, 33, 66, + /* 600 */ 35, 81, 69, 70, 84, 263, 73, 74, 75, 39, + /* 610 */ 291, 353, 104, 308, 263, 310, 274, 243, 263, 180, + /* 620 */ 181, 56, 145, 4, 366, 274, 118, 119, 370, 274, + /* 630 */ 65, 8, 9, 291, 255, 12, 13, 14, 15, 16, + /* 640 */ 44, 45, 291, 283, 255, 168, 291, 82, 146, 147, + /* 650 */ 290, 149, 325, 20, 263, 153, 8, 9, 255, 299, + /* 660 */ 12, 13, 14, 15, 16, 274, 43, 291, 263, 104, + /* 670 */ 308, 163, 310, 165, 172, 296, 349, 113, 302, 274, + /* 680 */ 255, 43, 291, 118, 119, 296, 209, 210, 211, 212, + /* 690 */ 213, 214, 215, 216, 217, 218, 291, 189, 190, 296, /* 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, + /* 710 */ 202, 203, 204, 205, 206, 207, 208, 0, 8, 9, + /* 720 */ 21, 296, 12, 13, 14, 15, 16, 325, 163, 293, + /* 730 */ 165, 83, 296, 34, 276, 36, 255, 279, 21, 175, + /* 740 */ 176, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 750 */ 271, 349, 273, 263, 189, 190, 0, 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, + /* 770 */ 205, 206, 207, 208, 12, 13, 18, 296, 20, 43, + /* 780 */ 263, 291, 20, 150, 22, 27, 256, 255, 30, 263, + /* 790 */ 220, 274, 94, 83, 255, 33, 20, 35, 284, 298, + /* 800 */ 274, 145, 312, 47, 255, 47, 20, 49, 291, 51, + /* 810 */ 309, 113, 114, 115, 116, 117, 35, 291, 56, 238, + /* 820 */ 263, 331, 219, 220, 168, 42, 43, 65, 296, 150, + /* 830 */ 151, 274, 255, 283, 255, 296, 346, 347, 348, 81, + /* 840 */ 350, 222, 292, 353, 82, 296, 8, 9, 291, 364, + /* 850 */ 12, 13, 14, 15, 16, 86, 366, 284, 89, 255, + /* 860 */ 370, 22, 255, 8, 9, 209, 104, 12, 13, 14, + /* 870 */ 15, 16, 255, 296, 35, 296, 284, 35, 240, 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, + /* 900 */ 296, 143, 144, 296, 65, 2, 255, 1, 2, 18, + /* 910 */ 43, 8, 9, 296, 23, 12, 13, 14, 15, 16, + /* 920 */ 0, 86, 118, 119, 89, 163, 150, 165, 37, 38, + /* 930 */ 255, 0, 41, 255, 86, 86, 43, 89, 89, 59, + /* 940 */ 272, 46, 43, 104, 255, 284, 165, 296, 57, 373, + /* 950 */ 83, 189, 190, 22, 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, + /* 970 */ 208, 296, 283, 82, 296, 43, 83, 82, 242, 193, + /* 980 */ 291, 319, 83, 2, 0, 296, 0, 298, 150, 8, + /* 990 */ 9, 264, 43, 12, 13, 14, 15, 16, 43, 43, + /* 1000 */ 43, 312, 163, 43, 165, 43, 22, 165, 22, 43, + /* 1010 */ 360, 120, 323, 43, 94, 83, 327, 328, 329, 330, + /* 1020 */ 331, 332, 255, 334, 0, 283, 337, 264, 189, 190, + /* 1030 */ 341, 342, 83, 113, 114, 115, 116, 117, 83, 83, + /* 1040 */ 83, 43, 353, 83, 43, 83, 155, 156, 157, 83, + /* 1050 */ 283, 160, 43, 83, 82, 366, 35, 166, 291, 370, + /* 1060 */ 262, 295, 43, 296, 92, 298, 326, 351, 344, 189, + /* 1070 */ 179, 367, 48, 182, 367, 184, 185, 186, 187, 188, + /* 1080 */ 367, 83, 354, 255, 83, 223, 65, 20, 263, 321, + /* 1090 */ 323, 47, 83, 320, 327, 328, 329, 330, 331, 332, + /* 1100 */ 255, 334, 83, 35, 337, 269, 161, 314, 341, 342, + /* 1110 */ 343, 283, 221, 263, 263, 42, 303, 301, 145, 291, + /* 1120 */ 301, 263, 355, 20, 296, 257, 298, 257, 283, 20, + /* 1130 */ 363, 267, 318, 267, 20, 298, 291, 311, 20, 267, + /* 1140 */ 313, 296, 311, 298, 267, 20, 267, 304, 267, 263, + /* 1150 */ 267, 323, 283, 255, 257, 327, 328, 329, 330, 331, + /* 1160 */ 332, 283, 334, 171, 318, 337, 307, 283, 323, 341, + /* 1170 */ 342, 343, 327, 328, 329, 330, 331, 332, 257, 334, + /* 1180 */ 263, 283, 337, 283, 283, 283, 341, 342, 343, 291, + /* 1190 */ 283, 363, 283, 283, 296, 283, 298, 352, 283, 12, + /* 1200 */ 13, 296, 265, 265, 317, 263, 298, 263, 255, 22, + /* 1210 */ 228, 265, 296, 147, 296, 311, 305, 291, 296, 296, + /* 1220 */ 33, 323, 35, 296, 265, 327, 328, 329, 330, 331, + /* 1230 */ 332, 307, 334, 304, 265, 337, 283, 279, 291, 341, + /* 1240 */ 342, 343, 20, 56, 291, 326, 296, 229, 359, 296, + /* 1250 */ 352, 298, 65, 359, 362, 307, 154, 296, 307, 296, + /* 1260 */ 296, 296, 235, 237, 236, 224, 220, 291, 20, 239, + /* 1270 */ 241, 82, 255, 359, 361, 321, 323, 325, 244, 82, + /* 1280 */ 327, 328, 329, 330, 331, 332, 255, 334, 358, 356, + /* 1290 */ 337, 104, 357, 368, 341, 342, 343, 369, 255, 287, + /* 1300 */ 283, 296, 263, 369, 36, 352, 273, 368, 291, 369, + /* 1310 */ 374, 368, 265, 296, 283, 298, 258, 340, 257, 315, + /* 1320 */ 310, 266, 291, 253, 0, 277, 283, 296, 277, 298, + /* 1330 */ 277, 0, 42, 0, 291, 73, 0, 35, 183, 296, + /* 1340 */ 323, 298, 35, 312, 327, 328, 329, 330, 331, 332, + /* 1350 */ 163, 334, 165, 35, 323, 312, 35, 183, 327, 328, + /* 1360 */ 329, 330, 331, 332, 0, 334, 323, 255, 183, 35, + /* 1370 */ 327, 328, 329, 330, 331, 332, 189, 334, 35, 0, + /* 1380 */ 0, 183, 365, 35, 353, 0, 0, 200, 201, 202, + /* 1390 */ 203, 204, 205, 206, 22, 283, 353, 366, 35, 0, + /* 1400 */ 168, 370, 82, 291, 167, 165, 163, 0, 296, 366, + /* 1410 */ 298, 0, 159, 370, 158, 0, 0, 46, 0, 0, + /* 1420 */ 0, 142, 0, 0, 255, 0, 0, 0, 137, 35, + /* 1430 */ 0, 137, 0, 0, 0, 323, 0, 0, 0, 327, + /* 1440 */ 328, 329, 330, 331, 332, 255, 334, 0, 0, 337, + /* 1450 */ 0, 0, 283, 341, 342, 0, 0, 0, 0, 42, + /* 1460 */ 291, 0, 0, 0, 0, 296, 0, 298, 0, 0, + /* 1470 */ 0, 22, 0, 283, 43, 46, 0, 42, 39, 14, + /* 1480 */ 40, 291, 0, 0, 0, 14, 296, 46, 298, 0, + /* 1490 */ 0, 39, 323, 39, 154, 0, 327, 328, 329, 330, + /* 1500 */ 331, 332, 0, 334, 0, 255, 337, 0, 0, 0, + /* 1510 */ 341, 342, 35, 323, 39, 0, 0, 327, 328, 329, + /* 1520 */ 330, 331, 332, 333, 334, 335, 336, 60, 47, 35, + /* 1530 */ 39, 35, 47, 283, 47, 0, 39, 39, 35, 47, + /* 1540 */ 0, 291, 0, 0, 0, 35, 296, 22, 298, 89, + /* 1550 */ 91, 0, 35, 35, 35, 35, 43, 43, 35, 35, + /* 1560 */ 0, 255, 35, 22, 0, 0, 35, 22, 22, 0, + /* 1570 */ 49, 35, 0, 323, 35, 0, 22, 327, 328, 329, + /* 1580 */ 330, 331, 332, 255, 334, 0, 20, 35, 0, 283, + /* 1590 */ 169, 0, 150, 22, 150, 0, 150, 291, 0, 0, + /* 1600 */ 147, 0, 296, 0, 298, 83, 178, 0, 82, 39, + /* 1610 */ 82, 283, 82, 46, 82, 225, 288, 43, 22, 291, + /* 1620 */ 83, 371, 372, 43, 296, 152, 298, 148, 225, 323, + /* 1630 */ 92, 82, 146, 327, 328, 329, 330, 331, 332, 82, + /* 1640 */ 334, 83, 83, 337, 255, 82, 46, 43, 342, 225, + /* 1650 */ 82, 323, 46, 43, 46, 327, 328, 329, 330, 331, + /* 1660 */ 332, 82, 334, 82, 255, 83, 83, 83, 82, 43, + /* 1670 */ 83, 46, 283, 46, 43, 83, 83, 288, 35, 2, + /* 1680 */ 291, 35, 35, 35, 35, 296, 35, 298, 189, 22, + /* 1690 */ 93, 82, 283, 43, 83, 82, 82, 219, 83, 83, + /* 1700 */ 291, 46, 46, 82, 82, 296, 82, 298, 35, 35, + /* 1710 */ 35, 83, 323, 83, 82, 82, 327, 328, 329, 330, + /* 1720 */ 331, 332, 83, 334, 191, 35, 35, 82, 35, 255, + /* 1730 */ 22, 94, 323, 35, 22, 83, 327, 328, 329, 330, + /* 1740 */ 331, 332, 82, 334, 83, 82, 106, 106, 255, 60, + /* 1750 */ 82, 82, 82, 43, 59, 35, 80, 283, 43, 106, + /* 1760 */ 106, 65, 288, 35, 35, 291, 35, 35, 35, 22, + /* 1770 */ 296, 35, 298, 35, 65, 35, 283, 35, 35, 35, + /* 1780 */ 35, 372, 0, 35, 291, 35, 35, 0, 47, 296, + /* 1790 */ 35, 298, 39, 47, 0, 39, 35, 323, 39, 47, + /* 1800 */ 0, 327, 328, 329, 330, 331, 332, 35, 334, 47, + /* 1810 */ 39, 0, 35, 35, 0, 22, 323, 255, 21, 21, + /* 1820 */ 327, 328, 329, 330, 331, 332, 22, 334, 22, 336, + /* 1830 */ 20, 375, 375, 255, 375, 375, 375, 375, 375, 375, + /* 1840 */ 375, 375, 375, 375, 375, 283, 375, 375, 375, 375, + /* 1850 */ 288, 375, 375, 291, 375, 375, 375, 375, 296, 375, + /* 1860 */ 298, 283, 375, 375, 375, 375, 288, 375, 375, 291, + /* 1870 */ 375, 375, 375, 375, 296, 255, 298, 375, 375, 375, + /* 1880 */ 375, 375, 375, 375, 375, 323, 375, 375, 375, 327, + /* 1890 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 255, + /* 1900 */ 375, 323, 375, 283, 375, 327, 328, 329, 330, 331, + /* 1910 */ 332, 291, 334, 375, 375, 375, 296, 375, 298, 375, + /* 1920 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, + /* 1930 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 1940 */ 296, 255, 298, 323, 375, 375, 375, 327, 328, 329, + /* 1950 */ 330, 331, 332, 375, 334, 375, 375, 375, 375, 375, + /* 1960 */ 375, 255, 375, 375, 375, 375, 375, 323, 375, 283, + /* 1970 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, + /* 1980 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 283, + /* 1990 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, + /* 2000 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 323, + /* 2010 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2020 */ 334, 255, 375, 375, 375, 375, 375, 375, 375, 323, + /* 2030 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2040 */ 334, 375, 375, 375, 375, 255, 375, 375, 375, 283, + /* 2050 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, + /* 2060 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, + /* 2070 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, + /* 2080 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 323, + /* 2090 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2100 */ 334, 255, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2110 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, + /* 2120 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 283, + /* 2130 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, + /* 2140 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, + /* 2150 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, + /* 2160 */ 375, 291, 375, 375, 375, 375, 296, 255, 298, 323, + /* 2170 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2180 */ 334, 375, 375, 255, 375, 375, 375, 375, 375, 375, + /* 2190 */ 375, 375, 375, 323, 375, 283, 375, 327, 328, 329, + /* 2200 */ 330, 331, 332, 291, 334, 375, 375, 375, 296, 375, + /* 2210 */ 298, 283, 375, 375, 375, 375, 375, 375, 375, 291, + /* 2220 */ 375, 375, 375, 375, 296, 255, 298, 375, 375, 375, + /* 2230 */ 375, 375, 375, 375, 375, 323, 375, 375, 375, 327, + /* 2240 */ 328, 329, 330, 331, 332, 255, 334, 375, 375, 375, + /* 2250 */ 375, 323, 375, 283, 375, 327, 328, 329, 330, 331, + /* 2260 */ 332, 291, 334, 375, 375, 375, 296, 375, 298, 375, + /* 2270 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, + /* 2280 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, + /* 2290 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, + /* 2300 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 375, + /* 2310 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, + /* 2320 */ 330, 331, 332, 375, 334, 375, 375, 375, 375, 255, + /* 2330 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, + /* 2340 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, + /* 2350 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, + /* 2360 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 2370 */ 296, 375, 298, 323, 375, 375, 375, 327, 328, 329, + /* 2380 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 375, + /* 2390 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 375, + /* 2400 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 255, + /* 2410 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, + /* 2420 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, + /* 2430 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, + /* 2440 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 2450 */ 296, 255, 298, 323, 375, 375, 375, 327, 328, 329, + /* 2460 */ 330, 331, 332, 375, 334, 375, 375, 255, 375, 375, + /* 2470 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 283, + /* 2480 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, + /* 2490 */ 375, 375, 296, 375, 298, 283, 375, 375, 375, 375, + /* 2500 */ 375, 375, 375, 291, 375, 375, 375, 375, 296, 255, + /* 2510 */ 298, 375, 375, 375, 375, 375, 375, 375, 375, 323, + /* 2520 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 255, + /* 2530 */ 334, 375, 375, 375, 375, 323, 375, 283, 375, 327, + /* 2540 */ 328, 329, 330, 331, 332, 291, 334, 375, 375, 375, + /* 2550 */ 296, 375, 298, 375, 375, 375, 375, 283, 375, 375, + /* 2560 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 2570 */ 296, 375, 298, 375, 375, 375, 375, 323, 375, 375, + /* 2580 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 375, + /* 2590 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 375, + /* 2600 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, }; #define YY_SHIFT_COUNT (652) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1821) +#define YY_SHIFT_MAX (1814) static const unsigned short int yy_shift_ofst[] = { /* 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, + /* 40 */ 565, 565, 565, 64, 64, 29, 29, 29, 1187, 1187, + /* 50 */ 1187, 54, 95, 247, 40, 40, 165, 165, 317, 106, + /* 60 */ 247, 247, 40, 40, 40, 40, 40, 40, 40, 40, + /* 70 */ 6, 40, 40, 40, 48, 127, 40, 40, 127, 152, + /* 80 */ 40, 127, 127, 127, 40, 122, 758, 223, 477, 477, + /* 90 */ 13, 409, 839, 839, 839, 839, 839, 839, 839, 839, + /* 100 */ 839, 839, 839, 839, 839, 839, 839, 839, 839, 839, + /* 110 */ 839, 196, 106, 325, 325, 75, 80, 365, 633, 633, + /* 120 */ 633, 80, 209, 48, 273, 273, 127, 127, 277, 277, + /* 130 */ 321, 380, 252, 252, 252, 252, 252, 252, 252, 131, + /* 140 */ 717, 533, 374, 233, 138, 67, 143, 124, 199, 476, + /* 150 */ 596, 1, 776, 603, 570, 603, 783, 581, 581, 581, + /* 160 */ 619, 786, 862, 1067, 1044, 1068, 945, 1067, 1067, 1073, + /* 170 */ 973, 973, 1067, 1103, 1103, 1109, 6, 48, 6, 1114, + /* 180 */ 1118, 6, 1114, 6, 1125, 6, 6, 1067, 6, 1103, + /* 190 */ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + /* 200 */ 127, 1067, 1103, 277, 1109, 122, 992, 48, 122, 1067, + /* 210 */ 1067, 1114, 122, 982, 277, 277, 277, 277, 982, 277, + /* 220 */ 1066, 209, 1125, 122, 321, 122, 209, 1222, 277, 1018, + /* 230 */ 982, 277, 277, 1018, 982, 277, 277, 127, 1027, 1102, + /* 240 */ 1018, 1026, 1028, 1041, 862, 1046, 209, 1248, 1029, 1030, + /* 250 */ 1034, 1029, 1030, 1029, 1030, 1189, 1197, 277, 380, 1067, + /* 260 */ 122, 1268, 1103, 2609, 2609, 2609, 2609, 2609, 2609, 2609, + /* 270 */ 334, 502, 268, 520, 412, 623, 648, 903, 981, 838, + /* 280 */ 710, 431, 855, 855, 855, 855, 855, 855, 855, 855, + /* 290 */ 920, 698, 14, 14, 164, 439, 25, 147, 699, 564, + /* 300 */ 486, 656, 364, 364, 364, 364, 756, 867, 769, 835, + /* 310 */ 848, 849, 931, 984, 986, 443, 679, 893, 899, 932, + /* 320 */ 949, 955, 956, 781, 842, 957, 906, 804, 638, 736, + /* 330 */ 960, 880, 962, 895, 966, 970, 998, 1001, 1009, 1019, + /* 340 */ 972, 1021, 1024, 1324, 1331, 1290, 1333, 1262, 1336, 1302, + /* 350 */ 1155, 1307, 1318, 1321, 1174, 1364, 1334, 1343, 1185, 1379, + /* 360 */ 1198, 1380, 1348, 1385, 1372, 1386, 1363, 1399, 1320, 1232, + /* 370 */ 1237, 1240, 1243, 1407, 1411, 1253, 1256, 1415, 1416, 1371, + /* 380 */ 1418, 1419, 1420, 1279, 1422, 1423, 1425, 1426, 1427, 1291, + /* 390 */ 1394, 1430, 1294, 1432, 1433, 1434, 1436, 1437, 1438, 1447, + /* 400 */ 1448, 1450, 1451, 1455, 1456, 1457, 1458, 1417, 1461, 1462, + /* 410 */ 1463, 1464, 1466, 1468, 1449, 1469, 1470, 1472, 1482, 1483, + /* 420 */ 1484, 1435, 1439, 1431, 1465, 1429, 1471, 1441, 1476, 1440, + /* 430 */ 1452, 1489, 1490, 1502, 1454, 1340, 1495, 1504, 1507, 1467, + /* 440 */ 1508, 1509, 1477, 1481, 1475, 1515, 1494, 1485, 1491, 1516, + /* 450 */ 1496, 1487, 1497, 1535, 1503, 1492, 1498, 1540, 1542, 1543, + /* 460 */ 1544, 1459, 1460, 1510, 1525, 1551, 1517, 1518, 1519, 1520, + /* 470 */ 1513, 1514, 1523, 1524, 1527, 1560, 1541, 1564, 1545, 1521, + /* 480 */ 1565, 1546, 1531, 1569, 1536, 1572, 1539, 1575, 1554, 1566, + /* 490 */ 1585, 1442, 1552, 1588, 1421, 1571, 1444, 1453, 1591, 1595, + /* 500 */ 1446, 1473, 1598, 1599, 1601, 1526, 1522, 1428, 1603, 1528, + /* 510 */ 1479, 1530, 1607, 1570, 1486, 1532, 1538, 1567, 1574, 1390, + /* 520 */ 1549, 1537, 1557, 1558, 1559, 1563, 1596, 1580, 1582, 1568, + /* 530 */ 1579, 1581, 1583, 1604, 1600, 1606, 1586, 1610, 1403, 1584, + /* 540 */ 1587, 1608, 1478, 1626, 1625, 1627, 1592, 1631, 1424, 1593, + /* 550 */ 1643, 1646, 1647, 1648, 1649, 1651, 1593, 1677, 1499, 1650, + /* 560 */ 1609, 1611, 1613, 1615, 1614, 1616, 1655, 1621, 1622, 1656, + /* 570 */ 1667, 1533, 1624, 1597, 1628, 1673, 1674, 1632, 1630, 1675, + /* 580 */ 1633, 1639, 1690, 1645, 1652, 1691, 1660, 1661, 1693, 1663, + /* 590 */ 1640, 1641, 1653, 1654, 1708, 1637, 1668, 1669, 1698, 1670, + /* 600 */ 1710, 1710, 1712, 1689, 1695, 1720, 1696, 1676, 1715, 1728, + /* 610 */ 1729, 1731, 1732, 1733, 1747, 1736, 1738, 1709, 1513, 1740, + /* 620 */ 1514, 1742, 1743, 1744, 1745, 1748, 1750, 1782, 1751, 1741, + /* 630 */ 1753, 1787, 1755, 1746, 1756, 1794, 1761, 1752, 1759, 1800, + /* 640 */ 1772, 1762, 1771, 1811, 1777, 1778, 1814, 1793, 1797, 1804, + /* 650 */ 1806, 1798, 1810, }; #define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-329) -#define YY_REDUCE_MAX (2136) +#define YY_REDUCE_MIN (-349) +#define YY_REDUCE_MAX (2274) static const short yy_reduce_ofst[] = { - /* 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, + /* 0 */ -246, -200, 689, 767, 828, 845, 898, 953, 1031, 1043, + /* 10 */ 1112, 1169, 1190, 1250, 1306, 1328, 1389, 1017, 1409, 1474, + /* 20 */ 1493, 1562, 1578, 1620, 1644, 1686, 1706, 1766, 1790, 1846, + /* 30 */ 1870, 1912, 1928, 1970, 1990, 2050, 2074, 2130, 2154, 2196, + /* 40 */ 2212, 2254, 2274, -245, 490, -191, -120, -20, -271, -249, + /* 50 */ -235, -218, 222, 258, 41, 44, -259, -254, -349, -240, + /* 60 */ -277, -256, 46, 103, 206, 288, 298, 300, 319, 342, + /* 70 */ -257, 351, 355, 391, -64, -101, 405, 517, -11, -267, + /* 80 */ 526, 248, 360, 267, 557, 216, -252, -171, -171, -171, + /* 90 */ -176, -253, 47, 85, 120, 379, 389, 403, 425, 481, + /* 100 */ 532, 539, 549, 577, 579, 604, 607, 617, 651, 675, + /* 110 */ 678, -133, 87, -46, 45, -258, 203, 295, 93, 327, + /* 120 */ 402, 296, 376, 501, 305, 362, 550, 297, 78, 436, + /* 130 */ 458, 479, -283, 193, 253, 514, 573, 592, 661, 236, + /* 140 */ 530, 668, 576, 485, 727, 662, 650, 742, 742, 763, + /* 150 */ 798, 766, 740, 716, 716, 716, 724, 704, 707, 713, + /* 160 */ 728, 742, 768, 825, 773, 836, 793, 850, 851, 813, + /* 170 */ 816, 819, 858, 868, 870, 814, 864, 837, 866, 826, + /* 180 */ 827, 872, 831, 877, 843, 879, 881, 886, 883, 897, + /* 190 */ 869, 878, 884, 900, 901, 902, 907, 909, 910, 912, + /* 200 */ 915, 917, 921, 905, 846, 937, 887, 908, 938, 942, + /* 210 */ 944, 904, 946, 859, 916, 918, 922, 923, 924, 927, + /* 220 */ 911, 926, 929, 959, 958, 969, 947, 919, 950, 889, + /* 230 */ 948, 961, 963, 894, 951, 964, 965, 742, 892, 913, + /* 240 */ 914, 930, 935, 933, 954, 716, 976, 952, 928, 925, + /* 250 */ 936, 934, 939, 940, 943, 977, 1012, 1005, 1033, 1039, + /* 260 */ 1047, 1058, 1061, 1004, 1010, 1048, 1051, 1053, 1055, 1070, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, @@ -832,8 +858,8 @@ static const YYACTIONTYPE yy_default[] = { /* 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, + /* 110 */ 1437, 1437, 1437, 1437, 1437, 1509, 1437, 1507, 1848, 1848, + /* 120 */ 1848, 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, @@ -842,19 +868,19 @@ static const YYACTIONTYPE yy_default[] = { /* 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, + /* 210 */ 1437, 1437, 1507, 1876, 1437, 1437, 1437, 1437, 1876, 1437, + /* 220 */ 1437, 1437, 1437, 1507, 1437, 1507, 1437, 1437, 1437, 1878, + /* 230 */ 1876, 1437, 1437, 1878, 1876, 1437, 1437, 1437, 1890, 1886, + /* 240 */ 1878, 1894, 1892, 1869, 1867, 1854, 1437, 1437, 1908, 1904, + /* 250 */ 1920, 1908, 1904, 1908, 1904, 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, + /* 280 */ 1437, 1437, 1774, 1889, 1888, 1812, 1811, 1810, 1808, 1773, /* 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, + /* 300 */ 1437, 1437, 1765, 1766, 1764, 1763, 1437, 1437, 1437, 1437, + /* 310 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 320 */ 1437, 1437, 1437, 1437, 1437, 1437, 1837, 1437, 1905, 1909, + /* 330 */ 1437, 1437, 1437, 1748, 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, @@ -871,14 +897,14 @@ static const YYACTIONTYPE yy_default[] = { /* 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, + /* 500 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1708, 1437, + /* 510 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1870, 1437, + /* 520 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 530 */ 1437, 1437, 1437, 1437, 1437, 1748, 1437, 1887, 1437, 1847, + /* 540 */ 1843, 1437, 1437, 1839, 1747, 1437, 1437, 1903, 1437, 1437, + /* 550 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1832, 1437, 1805, + /* 560 */ 1790, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 570 */ 1437, 1759, 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, @@ -1533,7 +1559,7 @@ static const char *const yyTokenName[] = { /* 285 */ "signed_literal", /* 286 */ "create_subtable_clause", /* 287 */ "specific_tags_opt", - /* 288 */ "literal_list", + /* 288 */ "expression_list", /* 289 */ "drop_table_clause", /* 290 */ "col_name_list", /* 291 */ "table_name", @@ -1555,21 +1581,21 @@ static const char *const yyTokenName[] = { /* 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", + /* 310 */ "stream_options", + /* 311 */ "topic_name", + /* 312 */ "query_expression", + /* 313 */ "cgroup_name", + /* 314 */ "analyze_opt", + /* 315 */ "explain_options", + /* 316 */ "agg_func_opt", + /* 317 */ "bufsize_opt", + /* 318 */ "stream_name", + /* 319 */ "into_opt", + /* 320 */ "dnode_list", + /* 321 */ "where_clause_opt", + /* 322 */ "signed", + /* 323 */ "literal_func", + /* 324 */ "literal_list", /* 325 */ "table_alias", /* 326 */ "column_alias", /* 327 */ "expression", @@ -1755,7 +1781,7 @@ static const char *const yyRuleName[] = { /* 125 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", /* 126 */ "multi_create_clause ::= create_subtable_clause", /* 127 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 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", + /* 128 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options", /* 129 */ "multi_drop_clause ::= drop_table_clause", /* 130 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", /* 131 */ "drop_table_clause ::= exists_opt full_table_name", @@ -2260,13 +2286,13 @@ static void yy_destructor( 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 310: /* stream_options */ + case 312: /* query_expression */ + case 315: /* explain_options */ + case 319: /* into_opt */ + case 321: /* where_clause_opt */ + case 322: /* signed */ + case 323: /* literal_func */ case 327: /* expression */ case 328: /* pseudo_column */ case 329: /* column_reference */ @@ -2304,7 +2330,7 @@ static void yy_destructor( case 253: /* account_options */ case 254: /* alter_account_options */ case 256: /* alter_account_option */ - case 318: /* bufsize_opt */ + case 317: /* bufsize_opt */ { } @@ -2317,9 +2343,9 @@ static void yy_destructor( 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 311: /* topic_name */ + case 313: /* cgroup_name */ + case 318: /* stream_name */ case 325: /* table_alias */ case 326: /* column_alias */ case 332: /* star_func */ @@ -2343,8 +2369,8 @@ static void yy_destructor( break; case 265: /* not_exists_opt */ case 267: /* exists_opt */ - case 315: /* analyze_opt */ - case 317: /* agg_func_opt */ + case 314: /* analyze_opt */ + case 316: /* agg_func_opt */ case 354: /* set_quantifier_opt */ { @@ -2359,13 +2385,13 @@ static void yy_destructor( case 279: /* tags_def */ case 280: /* multi_drop_clause */ case 287: /* specific_tags_opt */ - case 288: /* literal_list */ + case 288: /* expression_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 320: /* dnode_list */ + case 324: /* literal_list */ case 333: /* star_func_para_list */ case 335: /* other_para_list */ case 355: /* select_list */ @@ -2837,7 +2863,7 @@ static const struct { { 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 */ + { 286, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_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 */ @@ -2957,28 +2983,28 @@ static const struct { { 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 */ + { 314, 0 }, /* (248) analyze_opt ::= */ + { 314, -1 }, /* (249) analyze_opt ::= ANALYZE */ + { 315, 0 }, /* (250) explain_options ::= */ + { 315, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 315, -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 */ + { 316, 0 }, /* (256) agg_func_opt ::= */ + { 316, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ + { 317, 0 }, /* (258) bufsize_opt ::= */ + { 317, -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 */ + { 319, 0 }, /* (262) into_opt ::= */ + { 319, -2 }, /* (263) into_opt ::= INTO full_table_name */ + { 310, 0 }, /* (264) stream_options ::= */ + { 310, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 310, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 310, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 310, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ + { 310, -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 */ @@ -2986,8 +3012,8 @@ static const struct { { 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 */ + { 320, -2 }, /* (277) dnode_list ::= DNODE NK_INTEGER */ + { 320, -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 */ @@ -3000,12 +3026,12 @@ static const struct { { 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 */ + { 322, -1 }, /* (291) signed ::= NK_INTEGER */ + { 322, -2 }, /* (292) signed ::= NK_PLUS NK_INTEGER */ + { 322, -2 }, /* (293) signed ::= NK_MINUS NK_INTEGER */ + { 322, -1 }, /* (294) signed ::= NK_FLOAT */ + { 322, -2 }, /* (295) signed ::= NK_PLUS NK_FLOAT */ + { 322, -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 */ @@ -3013,8 +3039,8 @@ static const struct { { 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 */ + { 324, -1 }, /* (304) literal_list ::= signed_literal */ + { 324, -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 */ @@ -3023,9 +3049,9 @@ static const struct { { 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 */ + { 311, -1 }, /* (314) topic_name ::= NK_ID */ + { 318, -1 }, /* (315) stream_name ::= NK_ID */ + { 313, -1 }, /* (316) cgroup_name ::= NK_ID */ { 327, -1 }, /* (317) expression ::= literal */ { 327, -1 }, /* (318) expression ::= pseudo_column */ { 327, -1 }, /* (319) expression ::= column_reference */ @@ -3042,8 +3068,8 @@ static const struct { { 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 */ + { 288, -1 }, /* (333) expression_list ::= expression */ + { 288, -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 */ @@ -3058,8 +3084,8 @@ static const struct { { 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 */ + { 323, -3 }, /* (349) literal_func ::= noarg_func NK_LP NK_RP */ + { 323, -1 }, /* (350) literal_func ::= NOW */ { 334, -1 }, /* (351) noarg_func ::= NOW */ { 334, -1 }, /* (352) noarg_func ::= TODAY */ { 334, -1 }, /* (353) noarg_func ::= TIMEZONE */ @@ -3136,8 +3162,8 @@ static const struct { { 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 */ + { 321, 0 }, /* (427) where_clause_opt ::= */ + { 321, -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 ::= */ @@ -3165,7 +3191,7 @@ static const struct { { 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 */ + { 312, -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 */ @@ -3660,10 +3686,12 @@ static YYACTIONTYPE yy_reduce( { 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 281: /* cmd ::= query_expression */ yytestcase(yyruleno==281); { pCxt->pRootNode = yymsp[0].minor.yy212; } break; + case 115: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy212); } + break; case 116: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy212 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } yymsp[-1].minor.yy212 = yylhsminor.yy212; @@ -3709,7 +3737,7 @@ static YYACTIONTYPE yy_reduce( { 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 */ + case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options */ { 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; diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 6b960d71ab..88930b6269 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1868,6 +1868,8 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { pCxt->errCode = terrno; return DEAL_RES_ERROR; } + snprintf(((SExprNode*)pExpr)->aliasName, sizeof(((SExprNode*)pExpr)->aliasName), "%s", + ((SExprNode*)*pNode)->aliasName); nodesDestroyNode(*pNode); *pNode = pExpr; } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 60c04c2c30..38cca34c11 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -986,6 +986,10 @@ static bool unionIsChildSubplan(SLogicNode* pLogicNode, int32_t groupId) { return ((SExchangeLogicNode*)pLogicNode)->srcGroupId == groupId; } + if (QUERY_NODE_LOGIC_PLAN_MERGE == nodeType(pLogicNode)) { + return ((SMergeLogicNode*)pLogicNode)->srcGroupId == groupId; + } + SNode* pChild; FOREACH(pChild, pLogicNode->pChildren) { bool isChild = unionIsChildSubplan((SLogicNode*)pChild, groupId); diff --git a/source/libs/planner/test/planSetOpTest.cpp b/source/libs/planner/test/planSetOpTest.cpp index 62e017052e..de6d7466b8 100644 --- a/source/libs/planner/test/planSetOpTest.cpp +++ b/source/libs/planner/test/planSetOpTest.cpp @@ -97,7 +97,15 @@ TEST_F(PlanSetOpTest, unionSubquery) { run("SELECT * FROM (SELECT c1, c2 FROM t1 UNION SELECT c1, c2 FROM t1)"); } -TEST_F(PlanSetOpTest, bug001) { +TEST_F(PlanSetOpTest, unionWithSubquery) { + useDb("root", "test"); + + run("SELECT c1 FROM (SELECT c1 FROM st1) UNION SELECT c2 FROM (SELECT c1 AS c2 FROM st2)"); + + run("SELECT c1 FROM (SELECT c1 FROM st1 ORDER BY c2) UNION SELECT c1 FROM (SELECT c1 FROM st2)"); +} + +TEST_F(PlanSetOpTest, unionDataTypeConversion) { useDb("root", "test"); run("SELECT c2 FROM t1 WHERE c1 IS NOT NULL GROUP BY c2 " From 1d13c712c7b4ccc6ed042838d50cb582a87b0467 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 2 Jul 2022 19:49:38 +0800 Subject: [PATCH 12/63] fix: some problems of parser and planner --- source/libs/parser/src/parTranslater.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 72a0046044..caf70d2ec7 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5303,7 +5303,10 @@ static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SData if (NULL == pExpr) { return TSDB_CODE_OUT_OF_MEMORY; } - int32_t code = createCastFunc(pCxt, pExpr, dt, pCast); + int32_t code = translateExpr(pCxt, &pExpr); + if (TSDB_CODE_SUCCESS == code) { + code = createCastFunc(pCxt, pExpr, dt, pCast); + } if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode(pExpr); } @@ -5314,10 +5317,7 @@ static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* SValueNode** pVal) { SNode* pCast = NULL; int32_t code = createCastFuncForTag(pCxt, pNode, schemaToDataType(precision, pSchema), &pCast); - if (TSDB_CODE_SUCCESS == code) { - code = translateExpr(pCxt, &pCast); - } - SNode* pNew = NULL; + SNode* pNew = NULL; if (TSDB_CODE_SUCCESS == code) { code = scalarCalculateConstants(pCast, &pNew); } From 79a7b4a253189881302de6dc8aa58cdb7309f250 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Mon, 4 Jul 2022 10:46:03 +0800 Subject: [PATCH 13/63] ci: add mac build test to ci --- Jenkinsfile2 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 920eb0c01d..32e9b11520 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -127,6 +127,25 @@ def pre_test(){ ''' return 1 } +def pre_test_build_mac() { + sh ''' + hostname + date + ''' + sh ''' + cd ${WK} + rm -rf debug + mkdir debug + ''' + sh ''' + cd ${WK}/debug + cmake .. + make -j8 + ''' + sh ''' + date + ''' +} def pre_test_win(){ bat ''' hostname @@ -334,6 +353,17 @@ pipeline { } } } + stage('mac test') { + agent{label " Mac_catalina "} + steps { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + timeout(time: 20, unit: 'MINUTES'){ + pre_test() + pre_test_build_mac() + } + } + } + } stage('linux test') { agent{label " worker03 || slave215 || slave217 || slave219 "} options { skipDefaultCheckout() } From 47438695497fb48a52d643a8138f384924145740 Mon Sep 17 00:00:00 2001 From: cpwu Date: Mon, 4 Jul 2022 10:49:34 +0800 Subject: [PATCH 14/63] add sma case to CI --- tests/system-test/1-insert/block_wise.py | 442 ++++++++++++++++++ .../system-test/1-insert/create_retentions.py | 92 ++-- tests/system-test/1-insert/time_range_wise.py | 27 +- tests/system-test/fulltest.sh | 16 +- 4 files changed, 499 insertions(+), 78 deletions(-) create mode 100644 tests/system-test/1-insert/block_wise.py diff --git a/tests/system-test/1-insert/block_wise.py b/tests/system-test/1-insert/block_wise.py new file mode 100644 index 0000000000..6c779c64d7 --- /dev/null +++ b/tests/system-test/1-insert/block_wise.py @@ -0,0 +1,442 @@ +import datetime +import re + +from dataclasses import dataclass, field +from typing import List, Any, Tuple +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.constant import * + +PRIMARY_COL = "ts" + +INT_COL = "c_int" +BINT_COL = "c_bint" +SINT_COL = "c_sint" +TINT_COL = "c_tint" +FLOAT_COL = "c_float" +DOUBLE_COL = "c_double" +BOOL_COL = "c_bool" +TINT_UN_COL = "c_utint" +SINT_UN_COL = "c_usint" +BINT_UN_COL = "c_ubint" +INT_UN_COL = "c_uint" +BINARY_COL = "c_binary" +NCHAR_COL = "c_nchar" +TS_COL = "c_ts" + +NUM_COL = [INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, ] +CHAR_COL = [BINARY_COL, NCHAR_COL, ] +BOOLEAN_COL = [BOOL_COL, ] +TS_TYPE_COL = [TS_COL, ] + +INT_TAG = "t_int" + +ALL_COL = [PRIMARY_COL, INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BINARY_COL, NCHAR_COL, BOOL_COL, TS_COL] +TAG_COL = [INT_TAG] + +# insert data args: +TIME_STEP = 10000 +NOW = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) + +# init db/table +DBNAME = "db" +STBNAME = "stb1" +CTBNAME = "ct1" +NTBNAME = "nt1" + + +@dataclass +class DataSet: + ts_data : List[int] = field(default_factory=list) + int_data : List[int] = field(default_factory=list) + bint_data : List[int] = field(default_factory=list) + sint_data : List[int] = field(default_factory=list) + tint_data : List[int] = field(default_factory=list) + int_un_data : List[int] = field(default_factory=list) + bint_un_data: List[int] = field(default_factory=list) + sint_un_data: List[int] = field(default_factory=list) + tint_un_data: List[int] = field(default_factory=list) + float_data : List[float] = field(default_factory=list) + double_data : List[float] = field(default_factory=list) + bool_data : List[int] = field(default_factory=list) + binary_data : List[str] = field(default_factory=list) + nchar_data : List[str] = field(default_factory=list) + + +@dataclass +class BSMAschema: + creation : str = "CREATE" + tb_type : str = "stable" + tbname : str = STBNAME + cols : Tuple[str] = None + tags : Tuple[str] = None + sma_flag : str = "SMA" + sma_cols : Tuple[str] = None + create_tabel_sql : str = None + other : Any = None + + drop : str = "DROP" + drop_flag : str = "INDEX" + querySmaOptimize : int = 1 + show : str = "SHOW" + show_msg : str = "INDEXES" + show_oper : str = "FROM" + dbname : str = None + rollup_db : bool = False + + def __post_init__(self): + if isinstance(self.other, dict): + for k,v in self.other.items(): + + if k.lower() == "tbname" and isinstance(v, str) and not self.tbname: + self.tbname = v + del self.other[k] + + if k.lower() == "cols" and (isinstance(v, tuple) or isinstance(v, list)) and not self.cols: + self.cols = v + del self.other[k] + + if k.lower() == "tags" and (isinstance(v, tuple) or isinstance(v, list)) and not self.tags: + self.tags = v + del self.other[k] + + if k.lower() == "sma_flag" and isinstance(v, str) and not self.sma_flag: + self.sma_flag = v + del self.other[k] + + if k.lower() == "sma_cols" and (isinstance(v, tuple) or isinstance(v, list)) and not self.sma_cols: + self.sma_cols = v + del self.other[k] + + if k.lower() == "create_tabel_sql" and isinstance(v, str) and not self.create_tabel_sql: + self.create_tabel_sql = v + del self.other[k] + + # bSma show and drop operator is not completed + if k.lower() == "drop_flag" and isinstance(v, str) and not self.drop_flag: + self.drop_flag = v + del self.other[k] + + if k.lower() == "show_msg" and isinstance(v, str) and not self.show_msg: + self.show_msg = v + del self.other[k] + + if k.lower() == "dbname" and isinstance(v, str) and not self.dbname: + self.dbname = v + del self.other[k] + + if k.lower() == "show_oper" and isinstance(v, str) and not self.show_oper: + self.show_oper = v + del self.other[k] + + if k.lower() == "rollup_db" and isinstance(v, bool) and not self.rollup_db: + self.rollup_db = v + del self.other[k] + + + +# from ...pytest.util.sql import * +# from ...pytest.util.constant import * + +class TDTestCase: + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + self.precision = "ms" + self.sma_count = 0 + self.sma_created_index = [] + + def __create_sma_index(self, sma:BSMAschema): + if sma.create_tabel_sql: + sql = sma.create_tabel_sql + else: + sql = f"{sma.creation} {sma.tb_type} {sma.tbname} ({', '.join(sma.cols)}) " + + if sma.tb_type == "stable" or (sma.tb_type=="table" and sma.tags): + sql = f"{sma.creation} {sma.tb_type} {sma.tbname} ({', '.join(sma.cols)}) tags ({', '.join(sma.tags)}) " + + + if sma.sma_flag: + sql += sma.sma_flag + if sma.sma_cols: + sql += f"({', '.join(sma.sma_cols)})" + + if isinstance(sma.other, dict): + for k,v in sma.other.items(): + if isinstance(v,tuple) or isinstance(v, list): + sql += f" {k} ({' '.join(v)})" + else: + sql += f" {k} {v}" + if isinstance(sma.other, tuple) or isinstance(sma.other, list): + sql += " ".join(sma.other) + if isinstance(sma.other, int) or isinstance(sma.other, float) or isinstance(sma.other, str): + sql += f" {sma.other}" + + return sql + + def __get_bsma_table_col_tag_str(self, sql:str): + p = re.compile(r"[(](.*)[)]", re.S) + + if "tags" in (col_str := sql): + col_str = re.findall(p, sql.split("tags")[0])[0].split(",") + if (tag_str := re.findall(p, sql.split("tags")[1])[0].split(",") ): + col_str.extend(tag_str) + + return col_str + + def __get_bsma_col_tag_names(self, col_tags:list): + return [ col_tag.strip().split(" ")[0] for col_tag in col_tags ] + + @property + def __get_db_tbname(self): + tb_list = [] + tdSql.query("show tables") + for row in tdSql.queryResult: + tb_list.append(row[0]) + tdSql.query("show tables") + for row in tdSql.queryResult: + tb_list.append(row[0]) + + return tb_list + + def __bsma_create_check(self, sma:BSMAschema): + if not sma.creation: + return False + if not sma.create_tabel_sql and (not sma.tbname or not sma.tb_type or not sma.cols): + return False + if not sma.create_tabel_sql and (sma.tb_type == "stable" and not sma.tags): + return False + if not sma.sma_flag or not isinstance(sma.sma_flag, str) or sma.sma_flag.upper() != "SMA": + return False + if sma.tbname in self.__get_db_tbname: + return False + + if sma.create_tabel_sql: + col_tag_list = self.__get_bsma_col_tag_names(self.__get_bsma_table_col_tag_str(sma.create_tabel_sql)) + else: + col_str = list(sma.cols) + if sma.tags: + col_str.extend(list(sma.tags)) + col_tag_list = self.__get_bsma_col_tag_names(col_str) + if not sma.sma_cols: + return False + for col in sma.sma_cols: + if col not in col_tag_list: + return False + + return True + + def bsma_create_check(self, sma:BSMAschema): + if self.__bsma_create_check(sma): + tdSql.query(self.__create_sma_index(sma)) + tdLog.info(f"current sql: {self.__create_sma_index(sma)}") + + else: + tdSql.error(self.__create_sma_index(sma)) + + + def __sma_drop_check(self, sma:BSMAschema): + pass + + def sma_drop_check(self, sma:BSMAschema): + pass + + def __show_sma_index(self, sma:BSMAschema): + pass + + def __sma_show_check(self, sma:BSMAschema): + pass + + def sma_show_check(self, sma:BSMAschema): + pass + + @property + def __create_sma_sql(self): + err_sqls = [] + cur_sqls = [] + # err_set + ### case 1: required fields check + err_sqls.append( BSMAschema(creation="", tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_cols=(PRIMARY_COL, INT_COL ) ) ) + err_sqls.append( BSMAschema(tbname="", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_cols=(PRIMARY_COL, INT_COL ) ) ) + err_sqls.append( BSMAschema(tbname="stb2", cols=(), tags=(f"{INT_TAG} int",), sma_cols=(PRIMARY_COL, INT_COL ) ) ) + err_sqls.append( BSMAschema(tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(), sma_cols=(PRIMARY_COL, INT_COL ) ) ) + err_sqls.append( BSMAschema(tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_flag="", sma_cols=(PRIMARY_COL, INT_COL ) ) ) + err_sqls.append( BSMAschema(tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_cols=() ) ) + ### case 2: + err_sqls.append( BSMAschema(tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_cols=({BINT_COL}) ) ) + + # current_set + cur_sqls.append( BSMAschema(tbname="stb2", cols=(f"{PRIMARY_COL} timestamp", f"{INT_COL} int"), tags=(f"{INT_TAG} int",), sma_cols=(PRIMARY_COL, INT_COL ) ) ) + + return err_sqls, cur_sqls + + def test_create_sma(self): + err_sqls , cur_sqls = self.__create_sma_sql + for err_sql in err_sqls: + self.bsma_create_check(err_sql) + for cur_sql in cur_sqls: + self.bsma_create_check(cur_sql) + + @property + def __drop_sma_sql(self): + err_sqls = [] + cur_sqls = [] + # err_set + ## case 1: required fields check + return err_sqls, cur_sqls + + def test_drop_sma(self): + err_sqls , cur_sqls = self.__drop_sma_sql + for err_sql in err_sqls: + self.sma_drop_check(err_sql) + for cur_sql in cur_sqls: + self.sma_drop_check(cur_sql) + + def all_test(self): + self.test_create_sma() + + def __create_tb(self): + tdLog.printNoPrefix("==========step: create table") + create_stb_sql = f'''create table {STBNAME}( + ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, + {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, + {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, + {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, + {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned + ) tags ({INT_TAG} int) + ''' + create_ntb_sql = f'''create table {NTBNAME}( + ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, + {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, + {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, + {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, + {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned + ) + ''' + tdSql.execute(create_stb_sql) + tdSql.execute(create_ntb_sql) + + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + def __data_set(self, rows): + data_set = DataSet() + + for i in range(rows): + data_set.ts_data.append(NOW + 1 * (rows - i)) + data_set.int_data.append(rows - i) + data_set.bint_data.append(11111 * (rows - i)) + data_set.sint_data.append(111 * (rows - i) % 32767) + data_set.tint_data.append(11 * (rows - i) % 127) + data_set.int_un_data.append(rows - i) + data_set.bint_un_data.append(11111 * (rows - i)) + data_set.sint_un_data.append(111 * (rows - i) % 32767) + data_set.tint_un_data.append(11 * (rows - i) % 127) + data_set.float_data.append(1.11 * (rows - i)) + data_set.double_data.append(1100.0011 * (rows - i)) + data_set.bool_data.append((rows - i) % 2) + data_set.binary_data.append(f'binary{(rows - i)}') + data_set.nchar_data.append(f'nchar_测试_{(rows - i)}') + + return data_set + + def __insert_data(self): + tdLog.printNoPrefix("==========step: start inser data into tables now.....") + data = self.__data_set(rows=self.rows) + + # now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) + null_data = '''null, null, null, null, null, null, null, null, null, null, null, null, null, null''' + zero_data = "0, 0, 0, 0, 0, 0, 0, 'binary_0', 'nchar_0', 0, 0, 0, 0, 0" + + for i in range(self.rows): + row_data = f''' + {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]}, + {data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.tint_un_data[i]}, + {data.sint_un_data[i]}, {data.int_un_data[i]}, {data.bint_un_data[i]} + ''' + neg_row_data = f''' + {-1 * data.int_data[i]}, {-1 * data.bint_data[i]}, {-1 * data.sint_data[i]}, {-1 * data.tint_data[i]}, {-1 * data.float_data[i]}, {-1 * data.double_data[i]}, + {data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {1 * data.tint_un_data[i]}, + {1 * data.sint_un_data[i]}, {1 * data.int_un_data[i]}, {1 * data.bint_un_data[i]} + ''' + + tdSql.execute( + f"insert into ct1 values ( {NOW - i * TIME_STEP}, {row_data} )") + tdSql.execute( + f"insert into ct2 values ( {NOW - i * int(TIME_STEP * 0.6)}, {neg_row_data} )") + tdSql.execute( + f"insert into ct4 values ( {NOW - i * int(TIME_STEP * 0.8) }, {row_data} )") + tdSql.execute( + f"insert into {NTBNAME} values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )") + + tdSql.execute( + f"insert into ct2 values ( {NOW + int(TIME_STEP * 0.6)}, {null_data} )") + tdSql.execute( + f"insert into ct2 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.6)}, {null_data} )") + tdSql.execute( + f"insert into ct2 values ( {NOW - self.rows * int(TIME_STEP * 0.29) }, {null_data} )") + + tdSql.execute( + f"insert into ct4 values ( {NOW + int(TIME_STEP * 0.8)}, {null_data} )") + tdSql.execute( + f"insert into ct4 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.8)}, {null_data} )") + tdSql.execute( + f"insert into ct4 values ( {NOW - self.rows * int(TIME_STEP * 0.39)}, {null_data} )") + + tdSql.execute( + f"insert into {NTBNAME} values ( {NOW + int(TIME_STEP * 1.2)}, {null_data} )") + tdSql.execute( + f"insert into {NTBNAME} values ( {NOW - (self.rows + 1) * int(TIME_STEP * 1.2)}, {null_data} )") + tdSql.execute( + f"insert into {NTBNAME} values ( {NOW - self.rows * int(TIME_STEP * 0.59)}, {null_data} )") + + def run(self): + self.rows = 10 + + tdLog.printNoPrefix("==========step0:all check") + + tdLog.printNoPrefix("==========step1:create table in normal database") + tdSql.prepare() + self.__create_tb() + self.__insert_data() + self.all_test() + + # drop databases, create same name db、stb and sma index + tdSql.prepare() + self.__create_tb() + self.__insert_data() + self.all_test() + + tdLog.printNoPrefix("==========step2:create table in rollup database") + tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") + tdSql.execute("use db3") + tdSql.query(f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL})") + + tdSql.execute("drop database if exists db1 ") + tdSql.execute("drop database if exists db2 ") + + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.printNoPrefix("==========step4:after wal, all check again ") + tdSql.prepare() + self.__create_tb() + self.__insert_data() + self.all_test() + + # drop databases, create same name db、stb and sma index + tdSql.prepare() + self.__create_tb() + self.__insert_data() + self.all_test() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/1-insert/create_retentions.py b/tests/system-test/1-insert/create_retentions.py index 4b37eeb9a5..db902d0031 100644 --- a/tests/system-test/1-insert/create_retentions.py +++ b/tests/system-test/1-insert/create_retentions.py @@ -1,6 +1,6 @@ import datetime -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import List from util.log import * from util.sql import * @@ -36,36 +36,20 @@ NOW = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) @dataclass class DataSet: - ts_data : List[int] = None - int_data : List[int] = None - bint_data : List[int] = None - sint_data : List[int] = None - tint_data : List[int] = None - int_un_data : List[int] = None - bint_un_data : List[int] = None - sint_un_data : List[int] = None - tint_un_data : List[int] = None - float_data : List[float] = None - double_data : List[float] = None - bool_data : List[int] = None - binary_data : List[str] = None - nchar_data : List[str] = None - - def __post_init__(self): - self.ts_data = [] - self.int_data = [] - self.bint_data = [] - self.sint_data = [] - self.tint_data = [] - self.int_un_data = [] - self.bint_un_data = [] - self.sint_un_data = [] - self.tint_un_data = [] - self.float_data = [] - self.double_data = [] - self.bool_data = [] - self.binary_data = [] - self.nchar_data = [] + ts_data : List[int] = field(default_factory=list) + int_data : List[int] = field(default_factory=list) + bint_data : List[int] = field(default_factory=list) + sint_data : List[int] = field(default_factory=list) + tint_data : List[int] = field(default_factory=list) + int_un_data : List[int] = field(default_factory=list) + bint_un_data: List[int] = field(default_factory=list) + sint_un_data: List[int] = field(default_factory=list) + tint_un_data: List[int] = field(default_factory=list) + float_data : List[float] = field(default_factory=list) + double_data : List[float] = field(default_factory=list) + bool_data : List[int] = field(default_factory=list) + binary_data : List[str] = field(default_factory=list) + nchar_data : List[str] = field(default_factory=list) class TDTestCase: @@ -107,15 +91,15 @@ class TDTestCase: f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(count) watermark 1min", f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay -1s", f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) watermark -1m", - # f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 1m ", - # f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) max_delay 1m ", + f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 1m ", + f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) max_delay 1m ", f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} binary(16)) tags (tag1 int) rollup(avg) watermark 1s", - f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) tags (tag1 int) rollup(avg) max_delay 1m", - # f"create table ntb_1 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) rollup(avg) watermark 1s max_delay 1s", - # f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) tags (tag1 int) " , - # f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " , - # f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int) " , - # f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) " , + f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) rollup(avg) max_delay 1m", + # f"create table ntb_1 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) rollup(avg) watermark 1s max_delay 1s", + f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) " , + f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " , + f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int) " , + f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) " , # watermark, max_delay: [0, 900000], [ms, s, m, ?] f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay 1u", @@ -136,8 +120,9 @@ class TDTestCase: f"create stable stb2 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) watermark 5s max_delay 1m", f"create stable stb3 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(max) watermark 5s max_delay 1m", f"create stable stb4 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(sum) watermark 5s max_delay 1m", - # f"create stable stb5 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(last) watermark 5s max_delay 1m", - # f"create stable stb6 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m", + f"create stable stb5 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(last) watermark 5s max_delay 1m", + f"create stable stb6 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m", + f"create stable stb7 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL})", ] def test_create_stb(self): @@ -150,7 +135,7 @@ class TDTestCase: # assert "rollup" in tdSql.description tdSql.checkRows(len(self.create_stable_sql_current)) - # tdSql.execute("use db") # because db is a noraml database, not a rollup database, should not be able to create a rollup database + tdSql.execute("use db") # because db is a noraml database, not a rollup database, should not be able to create a rollup stable # tdSql.error(f"create stable nor_db_rollup_stb ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 5s max_delay 1m") @@ -210,20 +195,6 @@ class TDTestCase: data_set.binary_data.append(f'binary{(rows - i)}') data_set.nchar_data.append(f'nchar_测试_{(rows - i)}') - # neg_data_set.ts_data.append(-1 * i) - # neg_data_set.int_data.append(-i) - # neg_data_set.bint_data.append(-11111 * i) - # neg_data_set.sint_data.append(-111 * i % 32767) - # neg_data_set.tint_data.append(-11 * i % 127) - # neg_data_set.int_un_data.append(-i) - # neg_data_set.bint_un_data.append(-11111 * i) - # neg_data_set.sint_un_data.append(-111 * i % 32767) - # neg_data_set.tint_un_data.append(-11 * i % 127) - # neg_data_set.float_data.append(-1.11 * i) - # neg_data_set.double_data.append(-1100.0011 * i) - # neg_data_set.binary_data.append(f'binary{i}') - # neg_data_set.nchar_data.append(f'nchar_测试_{i}') - return data_set def __insert_data(self): @@ -279,9 +250,14 @@ class TDTestCase: tdLog.printNoPrefix("==========step2:create table in rollup database") tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") + + tdSql.execute("drop database if exists db1 ") + tdSql.execute("drop database if exists db2 ") + tdSql.execute("use db3") - self.__create_tb() - self.__insert_data() + # self.__create_tb() + # self.__insert_data() + self.all_test() tdSql.execute("drop database if exists db1 ") tdSql.execute("drop database if exists db2 ") diff --git a/tests/system-test/1-insert/time_range_wise.py b/tests/system-test/1-insert/time_range_wise.py index d4434987a6..a620a4b51a 100644 --- a/tests/system-test/1-insert/time_range_wise.py +++ b/tests/system-test/1-insert/time_range_wise.py @@ -325,7 +325,7 @@ class TDTestCase: def __sma_create_check(self, sma:SMAschema): if self.updatecfgDict["querySmaOptimize"] == 0: return False - # # TODO: if database is a rollup-db, can not create sma index + # TODO: if database is a rollup-db, can not create sma index # tdSql.query("select database()") # if sma.rollup_db : # return False @@ -493,8 +493,8 @@ class TDTestCase: err_sqls , cur_sqls = self.__drop_sma_sql for err_sql in err_sqls: self.sma_drop_check(err_sql) - # for cur_sql in cur_sqls: - # self.sma_drop_check(cur_sql) + for cur_sql in cur_sqls: + self.sma_drop_check(cur_sql) def all_test(self): self.test_create_sma() @@ -605,24 +605,23 @@ class TDTestCase: tdLog.printNoPrefix("==========step1:create table in normal database") tdSql.prepare() self.__create_tb() - # self.__insert_data() + self.__insert_data() self.all_test() # drop databases, create same name db、stb and sma index - # tdSql.prepare() - # self.__create_tb() - # self.__insert_data() - # self.all_test() - - - - return + tdSql.prepare() + self.__create_tb() + self.__insert_data() + self.all_test() tdLog.printNoPrefix("==========step2:create table in rollup database") tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") tdSql.execute("use db3") - self.__create_tb() - self.__insert_data() + # self.__create_tb() + tdSql.execute(f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL}) ") + self.all_test() + + # self.__insert_data() tdSql.execute("drop database if exists db1 ") tdSql.execute("drop database if exists db2 ") diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 4e76ee66f4..16b5c81281 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -23,6 +23,10 @@ python3 ./test.py -f 1-insert/alter_stable.py python3 ./test.py -f 1-insert/alter_table.py python3 ./test.py -f 1-insert/insertWithMoreVgroup.py python3 ./test.py -f 1-insert/table_comment.py +python3 ./test.py -f 1-insert/time_range_wise.py +python3 ./test.py -f 1-insert/block_wise.py +python3 ./test.py -f 1-insert/create_retentions.py + #python3 ./test.py -f 1-insert/table_param_ttl.py python3 ./test.py -f 2-query/between.py python3 ./test.py -f 2-query/distinct.py @@ -113,19 +117,19 @@ python3 ./test.py -f 2-query/twa.py python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/function_null.py -python3 ./test.py -f 2-query/queryQnode.py +python3 ./test.py -f 2-query/queryQnode.py -python3 ./test.py -f 6-cluster/5dnode1mnode.py +python3 ./test.py -f 6-cluster/5dnode1mnode.py python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 # python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py # python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 # python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 From e22736051ba714f29e5c3791b75c478123af4500 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 4 Jul 2022 11:30:38 +0800 Subject: [PATCH 15/63] test: add test case for tmq --- .../7-tmq/tmqConsFromTsdb1-mutilVg.py | 241 ++++++++++++++++++ tests/system-test/fulltest.sh | 1 + 2 files changed, 242 insertions(+) create mode 100644 tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py new file mode 100644 index 0000000000..dd8a0ad33a --- /dev/null +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py @@ -0,0 +1,241 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +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): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdDnodes.stop(1) + tdDnodes.start(1) + return + + 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': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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 = 3 + 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 = 2 + resultList = tmqCom.selectConsumeResult(expectRows) + actConsumeTotalRows = resultList[0] + resultList[1] + + 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)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 3 end ...... ") + + def tmqCase4(self): + tdLog.printNoPrefix("======== test case 4: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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 = 5 + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) + 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 commit notify") + tmqCom.getStartCommitNotifyFromTmqsim() + + tdLog.info("pkill consume processor") + tdCom.killProcessor("tmq_sim") + + # time.sleep(10) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 6 + 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 = resultList[0] + + if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted): + tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) + tdLog.info("and second consume rows should be between 0 and %d"%(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 4 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase3() + self.tmqCase4() + + 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/fulltest.sh b/tests/system-test/fulltest.sh index 8f5791f1c5..1cbf7b8944 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -158,3 +158,4 @@ python3 ./test.py -f 7-tmq/tmqAlterSchema.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py From 71ab6565622f51d6380cadfe9907ea47e4602989 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 11:45:27 +0800 Subject: [PATCH 16/63] fix: some problems of parser and planner --- source/libs/parser/src/parAstParser.c | 6 +++++ source/libs/parser/test/parInitialATest.cpp | 30 ++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 80ca411e0e..9cc822ee38 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -247,6 +247,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl return code; } +static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) { + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromUseDatabase(SCollectMetaKeyCxt* pCxt, SUseDatabaseStmt* pStmt) { return reserveDbVgVersionInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); } @@ -483,6 +487,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt); case QUERY_NODE_ALTER_TABLE_STMT: return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt); + case QUERY_NODE_ALTER_SUPER_TABLE_STMT: + return collectMetaKeyFromAlterStable(pCxt, (SAlterTableStmt*)pStmt); case QUERY_NODE_USE_DATABASE_STMT: return collectMetaKeyFromUseDatabase(pCxt, (SUseDatabaseStmt*)pStmt); case QUERY_NODE_CREATE_INDEX_STMT: diff --git a/source/libs/parser/test/parInitialATest.cpp b/source/libs/parser/test/parInitialATest.cpp index ee9dae2a01..9148f8f28d 100644 --- a/source/libs/parser/test/parInitialATest.cpp +++ b/source/libs/parser/test/parInitialATest.cpp @@ -77,8 +77,6 @@ TEST_F(ParserInitialATest, alterLocal) { clearAlterLocal(); } -// todo ALTER stable - /* * ALTER TABLE [db_name.]tb_name alter_table_clause * @@ -157,7 +155,7 @@ TEST_F(ParserInitialATest, alterSTable) { }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { - ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_TABLE_STMT); + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_SUPER_TABLE_STMT); SMAlterStbReq req = {0}; ASSERT_EQ(tDeserializeSMAlterStbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.name), std::string(expect.name)); @@ -181,44 +179,44 @@ TEST_F(ParserInitialATest, alterSTable) { }); // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, nullptr, 10); - // run("ALTER TABLE st1 TTL 10"); + // run("ALTER STABLE st1 TTL 10"); // clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test"); - run("ALTER TABLE st1 COMMENT 'test'"); + run("ALTER STABLE st1 COMMENT 'test'"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_COLUMN, 1, "cc1", TSDB_DATA_TYPE_BIGINT); - run("ALTER TABLE st1 ADD COLUMN cc1 BIGINT"); + run("ALTER STABLE st1 ADD COLUMN cc1 BIGINT"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_COLUMN, 1, "c1"); - run("ALTER TABLE st1 DROP COLUMN c1"); + run("ALTER STABLE st1 DROP COLUMN c1"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, 1, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); - run("ALTER TABLE st1 MODIFY COLUMN c2 VARCHAR(30)"); + run("ALTER STABLE st1 MODIFY COLUMN c2 VARCHAR(30)"); clearAlterStbReq(); // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, 2, "c1", 0, 0, "cc1"); - // run("ALTER TABLE st1 RENAME COLUMN c1 cc1"); + // run("ALTER STABLE st1 RENAME COLUMN c1 cc1"); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_TAG, 1, "tag11", TSDB_DATA_TYPE_BIGINT); - run("ALTER TABLE st1 ADD TAG tag11 BIGINT"); + run("ALTER STABLE st1 ADD TAG tag11 BIGINT"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_TAG, 1, "tag1"); - run("ALTER TABLE st1 DROP TAG tag1"); + run("ALTER STABLE st1 DROP TAG tag1"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, 1, "tag2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); - run("ALTER TABLE st1 MODIFY TAG tag2 VARCHAR(30)"); + run("ALTER STABLE st1 MODIFY TAG tag2 VARCHAR(30)"); clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_NAME, 2, "tag1", 0, 0, "tag11"); - run("ALTER TABLE st1 RENAME TAG tag1 tag11"); + run("ALTER STABLE st1 RENAME TAG tag1 tag11"); clearAlterStbReq(); // todo @@ -228,11 +226,11 @@ TEST_F(ParserInitialATest, alterSTable) { TEST_F(ParserInitialATest, alterSTableSemanticCheck) { useDb("root", "test"); - run("ALTER TABLE st1 RENAME COLUMN c1 cc1", TSDB_CODE_PAR_INVALID_ALTER_TABLE); + run("ALTER STABLE st1 RENAME COLUMN c1 cc1", TSDB_CODE_PAR_INVALID_ALTER_TABLE); - run("ALTER TABLE st1 MODIFY COLUMN c2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); + run("ALTER STABLE st1 MODIFY COLUMN c2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); - run("ALTER TABLE st1 MODIFY TAG tag2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); + run("ALTER STABLE st1 MODIFY TAG tag2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); } TEST_F(ParserInitialATest, alterTable) { From e05e7ffa0c2987967fbd2915462ae1127ff138ea Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 4 Jul 2022 13:16:08 +0800 Subject: [PATCH 17/63] test: modify poll delay --- tests/system-test/7-tmq/tmqConsFromTsdb1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1.py b/tests/system-test/7-tmq/tmqConsFromTsdb1.py index af06c774d6..a183eda1c7 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1.py @@ -85,7 +85,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 1} From 856806bb22915515b7c1753efb46b54bd7e74f54 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 13:33:49 +0800 Subject: [PATCH 18/63] refactor(sync): add snapshot2 interface --- include/libs/sync/sync.h | 2 +- include/libs/sync/syncTools.h | 2 - source/libs/sync/inc/syncReplication.h | 1 + source/libs/sync/src/syncAppendEntries.c | 127 +++++++++++++----- source/libs/sync/src/syncAppendEntriesReply.c | 13 +- source/libs/sync/src/syncMessage.c | 27 ---- source/libs/sync/src/syncRaftLog.c | 9 ++ source/libs/sync/src/syncReplication.c | 23 ++-- 8 files changed, 125 insertions(+), 79 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index d07cf0adf1..90e5420a03 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -205,7 +205,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/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 97f2748420..b310f603d1 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -404,8 +404,6 @@ void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, 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); diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index 07e12460da..dad7d9b5ec 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -54,6 +54,7 @@ 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); diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index c244b32cea..c923ee3d1d 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -628,8 +628,6 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) { #endif -static int32_t syncNodeMakeLogSame2(SSyncNode* ths, SyncAppendEntriesBatch* pMsg) { return 0; } - static int32_t syncNodeMakeLogSame(SSyncNode* ths, SyncAppendEntries* pMsg) { int32_t code; @@ -675,6 +673,51 @@ static int32_t syncNodeMakeLogSame(SSyncNode* ths, SyncAppendEntries* pMsg) { return code; } +static int32_t syncNodeDoMakeLogSame(SSyncNode* ths, SyncIndex FromIndex) { + int32_t code; + + SyncIndex delBegin = FromIndex; + SyncIndex delEnd = ths->pLogStore->syncLogLastIndex(ths->pLogStore); + + // invert roll back! + for (SyncIndex index = delEnd; index >= delBegin; --index) { + if (ths->pFsm->FpRollBackCb != NULL) { + SSyncRaftEntry* pRollBackEntry; + code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, index, &pRollBackEntry); + ASSERT(code == 0); + ASSERT(pRollBackEntry != NULL); + + if (syncUtilUserRollback(pRollBackEntry->msgType)) { + SRpcMsg rpcMsg; + syncEntry2OriginalRpc(pRollBackEntry, &rpcMsg); + + SFsmCbMeta cbMeta = {0}; + cbMeta.index = pRollBackEntry->index; + cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); + cbMeta.isWeak = pRollBackEntry->isWeak; + cbMeta.code = 0; + cbMeta.state = ths->state; + cbMeta.seqNum = pRollBackEntry->seqNum; + ths->pFsm->FpRollBackCb(ths->pFsm, &rpcMsg, cbMeta); + rpcFreeCont(rpcMsg.pCont); + } + + syncEntryDestory(pRollBackEntry); + } + } + + // delete confict entries + code = ths->pLogStore->syncLogTruncate(ths->pLogStore, delBegin); + ASSERT(code == 0); + + char eventLog[128]; + snprintf(eventLog, sizeof(eventLog), "log truncate, from %ld to %ld", delBegin, delEnd); + syncNodeEventLog(ths, eventLog); + logStoreSimpleLog2("after syncNodeMakeLogSame", ths->pLogStore); + + return code; +} + static int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry) { SRpcMsg rpcMsg; syncEntry2OriginalRpc(pEntry, &rpcMsg); @@ -694,7 +737,30 @@ static int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry) { return 0; } -static bool syncNodeOnAppendEntriesBatchLogOK(SSyncNode* pSyncNode, SyncAppendEntriesBatch* pMsg) { return true; } +static bool syncNodeOnAppendEntriesBatchLogOK(SSyncNode* pSyncNode, SyncAppendEntriesBatch* pMsg) { + if (pMsg->prevLogIndex == SYNC_INDEX_INVALID) { + return true; + } + + SyncIndex myLastIndex = syncNodeGetLastIndex(pSyncNode); + if (pMsg->prevLogIndex > myLastIndex) { + sDebug("vgId:%d sync log not ok, preindex:%ld", pSyncNode->vgId, pMsg->prevLogIndex); + return false; + } + + SyncTerm myPreLogTerm = syncNodeGetPreTerm(pSyncNode, pMsg->prevLogIndex + 1); + if (myPreLogTerm == SYNC_TERM_INVALID) { + sDebug("vgId:%d sync log not ok2, preindex:%ld", pSyncNode->vgId, pMsg->prevLogIndex); + return false; + } + + if (pMsg->prevLogIndex <= myLastIndex && pMsg->prevLogTerm == myPreLogTerm) { + return true; + } + + sDebug("vgId:%d sync log not ok3, preindex:%ld", pSyncNode->vgId, pMsg->prevLogIndex); + return false; +} // really pre log match // prevLogIndex == -1 @@ -769,7 +835,6 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc // operation: // if hasAppendEntries && pMsg->prevLogIndex == ths->commitIndex, append entry // match my-commit-index or my-commit-index + 1 - // no operation on log do { bool condition = (pMsg->term == ths->pRaftStore->currentTerm) && (ths->state == TAOS_SYNC_STATE_FOLLOWER) && (pMsg->prevLogIndex <= ths->commitIndex); @@ -782,14 +847,11 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc syncNodeEventLog(ths, logBuf); } while (0); - SyncIndex matchIndex = ths->commitIndex; - bool hasAppendEntries = pMsg->dataLen > 0; - if (hasAppendEntries && pMsg->prevLogIndex == ths->commitIndex) { - SRpcMsg rpcMsgArr[SYNC_MAX_BATCH_SIZE]; - memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); - int32_t retArrSize = 0; - syncAppendEntriesBatch2RpcMsgArray(pMsg, rpcMsgArr, SYNC_MAX_BATCH_SIZE, &retArrSize); + SyncIndex matchIndex = ths->commitIndex; + bool hasAppendEntries = pMsg->dataLen > 0; + SOffsetAndContLen* metaTableArr = syncAppendEntriesBatchMetaTableArray(pMsg); + if (hasAppendEntries && pMsg->prevLogIndex == ths->commitIndex) { // make log same do { SyncIndex logLastIndex = ths->pLogStore->syncLogLastIndex(ths->pLogStore); @@ -797,15 +859,15 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc if (hasExtraEntries) { // make log same, rollback deleted entries - code = syncNodeMakeLogSame2(ths, pMsg); + code = syncNodeDoMakeLogSame(ths, pMsg->prevLogIndex + 1); ASSERT(code == 0); } } while (0); // append entry batch - for (int32_t i = 0; i < retArrSize; ++i) { - SSyncRaftEntry* pAppendEntry = syncEntryBuild(1234); + for (int32_t i = 0; i < pMsg->dataCount; ++i) { + SSyncRaftEntry* pAppendEntry = (SSyncRaftEntry*)(pMsg->data + metaTableArr[i].offset); code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); if (code != 0) { return -1; @@ -823,7 +885,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc walFsync(pWal, true); // update match index - matchIndex = pMsg->prevLogIndex + retArrSize; + matchIndex = pMsg->prevLogIndex + pMsg->dataCount; } // prepare response msg @@ -841,7 +903,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg); syncAppendEntriesReplyDestroy(pReply); - return ret; + return 0; } } while (0); @@ -887,7 +949,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg); syncAppendEntriesReplyDestroy(pReply); - return ret; + return 0; } } while (0); @@ -907,29 +969,26 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc bool hasExtraEntries = myLastIndex > pMsg->prevLogIndex; // has entries in SyncAppendEntries msg - bool hasAppendEntries = pMsg->dataLen > 0; + bool hasAppendEntries = pMsg->dataLen > 0; + SOffsetAndContLen* metaTableArr = syncAppendEntriesBatchMetaTableArray(pMsg); - char logBuf[128]; - snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries, match, pre-index:%ld, pre-term:%lu, datalen:%d", - pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->dataLen); - syncNodeEventLog(ths, logBuf); + do { + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries, match, pre-index:%ld, pre-term:%lu, datalen:%d", + pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->dataLen); + syncNodeEventLog(ths, logBuf); + } while (0); if (hasExtraEntries) { // make log same, rollback deleted entries - code = syncNodeMakeLogSame2(ths, pMsg); + code = syncNodeDoMakeLogSame(ths, pMsg->prevLogIndex + 1); ASSERT(code == 0); } - int32_t retArrSize = 0; if (hasAppendEntries) { - SRpcMsg rpcMsgArr[SYNC_MAX_BATCH_SIZE]; - memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); - syncAppendEntriesBatch2RpcMsgArray(pMsg, rpcMsgArr, SYNC_MAX_BATCH_SIZE, &retArrSize); - // append entry batch - for (int32_t i = 0; i < retArrSize; ++i) { - // SSyncRaftEntry* pAppendEntry = syncEntryBuild4(&rpcMsgArr[i], ); - SSyncRaftEntry* pAppendEntry; + for (int32_t i = 0; i < pMsg->dataCount; ++i) { + SSyncRaftEntry* pAppendEntry = (SSyncRaftEntry*)(pMsg->data + metaTableArr[i].offset); code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); if (code != 0) { return -1; @@ -954,7 +1013,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc pReply->term = ths->pRaftStore->currentTerm; pReply->privateTerm = ths->pNewNodeReceiver->privateTerm; pReply->success = true; - pReply->matchIndex = hasAppendEntries ? pMsg->prevLogIndex + retArrSize : pMsg->prevLogIndex; + pReply->matchIndex = hasAppendEntries ? pMsg->prevLogIndex + pMsg->dataCount : pMsg->prevLogIndex; // send response SRpcMsg rpcMsg; @@ -994,11 +1053,11 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc ASSERT(code == 0); } } - return ret; + return 0; } } while (0); - return ret; + return 0; } int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMsg) { diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 629d83eb51..95015d3973 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -165,23 +165,22 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie if (ths->pLogStore->syncLogExist(ths->pLogStore, newNextIndex) && ths->pLogStore->syncLogExist(ths->pLogStore, newNextIndex - 1)) { - // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] + // update next-index, match-index syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), newNextIndex); - - // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), newMatchIndex); // 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); + SSnapshot oldSnapshot; + ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &oldSnapshot); + syncNodeStartSnapshot(ths, newMatchIndex + 1, oldSnapshot.lastApplyIndex, oldSnapshot.lastApplyTerm, pMsg); - syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), snapshot.lastApplyIndex + 1); + syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), oldSnapshot.lastApplyIndex + 1); syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), newMatchIndex); } diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 10e6231a70..8cbb5981aa 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -1807,33 +1807,6 @@ char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg) { 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); diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index a026892629..83495e7486 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -32,6 +32,7 @@ static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore); static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry); static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry); static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIndex); +static bool raftLogExist(struct SSyncLogStore* pLogStore, SyncIndex index); // private function static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry); @@ -83,6 +84,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { pLogStore->syncLogGetEntry = raftLogGetEntry; pLogStore->syncLogTruncate = raftLogTruncate; pLogStore->syncLogWriteIndex = raftLogWriteIndex; + pLogStore->syncLogExist = raftLogExist; return pLogStore; } @@ -168,6 +170,13 @@ static SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore) { return lastVer + 1; } +static bool raftLogExist(struct SSyncLogStore* pLogStore, SyncIndex index) { + SSyncLogStoreData* pData = pLogStore->data; + SWal* pWal = pData->pWal; + bool b = walLogExist(pWal, index); + return b; +} + // if success, return last term // if not log, return 0 // if error, return SYNC_TERM_INVALID diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 673cdca68d..bcca44130a 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -145,27 +145,34 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) { return -1; } - SRpcMsg rpcMsgArr[SYNC_MAX_BATCH_SIZE]; - memset(rpcMsgArr, 0, sizeof(rpcMsgArr)); + SSyncRaftEntry* entryPArr[SYNC_MAX_BATCH_SIZE]; + memset(entryPArr, 0, sizeof(entryPArr)); - int32_t getCount = 0; + int32_t getCount = 0; + SyncIndex getEntryIndex = nextIndex; for (int32_t i = 0; i < pSyncNode->batchSize; ++i) { SSyncRaftEntry* pEntry; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry); + int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, getEntryIndex, &pEntry); if (code == 0) { ASSERT(pEntry != NULL); - // get rpc msg [i] from entry - syncEntryDestory(pEntry); + entryPArr[i] = pEntry; getCount++; } else { break; } } - // SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchBuild(rpcMsgArr, getCount, pSyncNode->vgId); - SyncAppendEntriesBatch* pMsg = NULL; + SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchBuild(entryPArr, getCount, pSyncNode->vgId); ASSERT(pMsg != NULL); + for (int32_t i = 0; i < pSyncNode->batchSize; ++i) { + SSyncRaftEntry* pEntry = entryPArr[i]; + if (pEntry != NULL) { + syncEntryDestory(pEntry); + entryPArr[i] = NULL; + } + } + // prepare msg pMsg->srcId = pSyncNode->myRaftId; pMsg->destId = *pDestId; From ac62159bd27e3010963d61928bbb967fdc5d2990 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 4 Jul 2022 14:01:58 +0800 Subject: [PATCH 19/63] enh: code and test case optimization --- source/dnode/vnode/src/sma/smaRollup.c | 5 ++--- tests/script/tsim/insert/update0.sim | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 9899440833..4e1b2db44a 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -915,9 +915,9 @@ static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem * return TSDB_CODE_SUCCESS; } - if (pItem->type == 1) { + if (pItem->type == TSDB_RETENTION_L1) { qTaskInfo = pRSmaInfo->items[0].taskInfo; - } else if (pItem->type == 2) { + } else if (pItem->type == TSDB_RETENTION_L2) { qTaskInfo = pRSmaInfo->items[1].taskInfo; } else { ASSERT(0); @@ -1233,7 +1233,6 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { } else { smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, SMA_VID(pRSmaStat->pSma), atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); - ASSERT(0); } atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); taosReleaseRef(smaMgmt.smaRef, pRSmaStat->refId); diff --git a/tests/script/tsim/insert/update0.sim b/tests/script/tsim/insert/update0.sim index ed74188bcb..41a389b6e8 100644 --- a/tests/script/tsim/insert/update0.sim +++ b/tests/script/tsim/insert/update0.sim @@ -8,8 +8,8 @@ print =============== create database sql create database d0 keep 365000d,365000d,365000d sql use d0 -print =============== create super table and register rsma -sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min); +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)); sql show stables if $rows != 1 then From 30380b374416d8ec8ac7d7037026a62e1ff5aeb0 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Jul 2022 14:03:09 +0800 Subject: [PATCH 20/63] fix invalid read/write --- source/dnode/mgmt/node_mgmt/src/dmProc.c | 20 +++++++++---------- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/libs/transport/src/transSvr.c | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/source/dnode/mgmt/node_mgmt/src/dmProc.c b/source/dnode/mgmt/node_mgmt/src/dmProc.c index 72878d0d85..cbf13924d7 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmProc.c +++ b/source/dnode/mgmt/node_mgmt/src/dmProc.c @@ -87,8 +87,8 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) { static void dmCleanupProcQueue(SProcQueue *queue) {} static inline int32_t dmPushToProcQueue(SProc *proc, SProcQueue *queue, SRpcMsg *pMsg, EProcFuncType ftype) { - const void *pHead = pMsg; - const void *pBody = pMsg->pCont; + const void * pHead = pMsg; + const void * pBody = pMsg->pCont; const int16_t rawHeadLen = sizeof(SRpcMsg); const int32_t rawBodyLen = pMsg->contLen; const int16_t headLen = CEIL8(rawHeadLen); @@ -257,7 +257,7 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) { proc->wrapper = pWrapper; proc->name = pWrapper->name; - SShm *shm = &proc->shm; + SShm * shm = &proc->shm; int32_t cstart = 0; int32_t csize = CEIL8(shm->size / 2); int32_t pstart = csize; @@ -281,13 +281,13 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) { } static void *dmConsumChildQueue(void *param) { - SProc *proc = param; + SProc * proc = param; SMgmtWrapper *pWrapper = proc->wrapper; - SProcQueue *queue = proc->cqueue; + SProcQueue * queue = proc->cqueue; int32_t numOfMsgs = 0; int32_t code = 0; EProcFuncType ftype = DND_FUNC_REQ; - SRpcMsg *pMsg = NULL; + SRpcMsg * pMsg = NULL; dDebug("node:%s, start to consume from cqueue", proc->name); do { @@ -324,13 +324,13 @@ static void *dmConsumChildQueue(void *param) { } static void *dmConsumParentQueue(void *param) { - SProc *proc = param; + SProc * proc = param; SMgmtWrapper *pWrapper = proc->wrapper; - SProcQueue *queue = proc->pqueue; + SProcQueue * queue = proc->pqueue; int32_t numOfMsgs = 0; int32_t code = 0; EProcFuncType ftype = DND_FUNC_REQ; - SRpcMsg *pMsg = NULL; + SRpcMsg * pMsg = NULL; dDebug("node:%s, start to consume from pqueue", proc->name); do { @@ -353,7 +353,7 @@ static void *dmConsumParentQueue(void *param) { rpcRegisterBrokenLinkArg(pMsg); } else if (ftype == DND_FUNC_RELEASE) { dmRemoveProcRpcHandle(proc, pMsg->info.handle); - rpcReleaseHandle(pMsg->info.handle, (int8_t)pMsg->code); + rpcReleaseHandle(&pMsg->info, TAOS_CONN_SERVER); } else { dError("node:%s, invalid ftype:%d from pqueue", proc->name, ftype); rpcFreeCont(pMsg->pCont); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 35d478177a..df3c9c4e88 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -245,7 +245,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { SRpcMsg msg = {.code = type, .info = *pHandle}; dmPutToProcPQueue(&pWrapper->proc, &msg, DND_FUNC_RELEASE); } else { - rpcReleaseHandle(pHandle->handle, type); + rpcReleaseHandle(pHandle, type); } } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index d32156dd0d..4f33c8cdc1 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1029,8 +1029,9 @@ void transUnrefSrvHandle(void* handle) { } void transReleaseSrvHandle(void* handle) { - SExHandle* exh = handle; - int64_t refId = exh->refId; + SRpcHandleInfo* info = handle; + SExHandle* exh = info->handle; + int64_t refId = info->refId; ASYNC_CHECK_HANDLE(exh, refId); From a5d3b7033abe6f439337d30dd7a96dd2e33ee5c2 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 14:18:06 +0800 Subject: [PATCH 21/63] refactor(sync): add snapshot writer param --- include/libs/sync/sync.h | 7 ++- include/libs/sync/syncTools.h | 7 ++- source/dnode/mnode/impl/src/mndSync.c | 2 +- source/dnode/vnode/src/vnd/vnodeSync.c | 2 +- source/libs/sync/inc/syncAppendEntriesReply.h | 5 -- source/libs/sync/inc/syncSnapshot.h | 57 ++++++++++--------- source/libs/sync/src/syncAppendEntriesReply.c | 9 +-- source/libs/sync/src/syncMessage.c | 3 + source/libs/sync/src/syncSnapshot.c | 22 ++++--- .../test/syncConfigChangeSnapshotTest.cpp | 2 +- .../sync/test/syncSnapshotReceiverTest.cpp | 2 +- source/libs/sync/test/syncTestTool.cpp | 2 +- 12 files changed, 67 insertions(+), 53 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 90e5420a03..d4df039394 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -96,6 +96,11 @@ typedef struct SReConfigCbMeta { } SReConfigCbMeta; +typedef struct SSnapshotParam { + SyncIndex start; + SyncIndex end; +} SSnapshotParam; + typedef struct SSnapshot { void* data; SyncIndex lastApplyIndex; @@ -125,7 +130,7 @@ typedef struct SSyncFSM { int32_t (*FpSnapshotStopRead)(struct SSyncFSM* pFsm, void* pReader); int32_t (*FpSnapshotDoRead)(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len); - int32_t (*FpSnapshotStartWrite)(struct SSyncFSM* pFsm, void** ppWriter); + int32_t (*FpSnapshotStartWrite)(struct SSyncFSM* pFsm, void* pWriterParam, void** ppWriter); int32_t (*FpSnapshotStopWrite)(struct SSyncFSM* pFsm, void* pWriter, bool isApply); int32_t (*FpSnapshotDoWrite)(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_t len); diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index b310f603d1..0340bf026b 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -483,9 +483,10 @@ typedef struct SyncSnapshotSend { SRaftId destId; SyncTerm term; - SyncIndex lastIndex; // lastIndex of snapshot - SyncTerm lastTerm; // lastTerm of snapshot - SyncIndex lastConfigIndex; + SyncIndex beginIndex; // snapshot.beginIndex + SyncIndex lastIndex; // snapshot.lastIndex + SyncTerm lastTerm; // snapshot.lastTerm + SyncIndex lastConfigIndex; // snapshot.lastConfigIndex SSyncCfg lastConfig; SyncTerm privateTerm; int32_t seq; diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 693eed5222..971cecf63a 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -134,7 +134,7 @@ int32_t mndSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, in return sdbDoRead(pMnode->pSdb, pReader, ppBuf, len); } -int32_t mndSnapshotStartWrite(struct SSyncFSM *pFsm, void **ppWriter) { +int32_t mndSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWriter) { mInfo("start to apply snapshot to sdb"); SMnode *pMnode = pFsm->data; return sdbStartWrite(pMnode->pSdb, (SSdbIter **)ppWriter); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 80ba80e61a..8af7e8c9b3 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -415,7 +415,7 @@ static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) { ret static int32_t vnodeSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) { return 0; } -static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void **ppWriter) { return 0; } +static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWriter) { return 0; } static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply) { return 0; } diff --git a/source/libs/sync/inc/syncAppendEntriesReply.h b/source/libs/sync/inc/syncAppendEntriesReply.h index 70ce5a72c6..03148252fb 100644 --- a/source/libs/sync/inc/syncAppendEntriesReply.h +++ b/source/libs/sync/inc/syncAppendEntriesReply.h @@ -44,11 +44,6 @@ 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/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index bb076ed2a1..3df9c243e7 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -37,44 +37,47 @@ extern "C" { //--------------------------------------------------- typedef struct SSyncSnapshotSender { - bool start; - int32_t seq; - int32_t ack; - void * pReader; - void * pCurrentBlock; - int32_t blockLen; - SSnapshot snapshot; - SSyncCfg lastConfig; - int64_t sendingMS; - SSyncNode *pSyncNode; - int32_t replicaIndex; - SyncTerm term; - SyncTerm privateTerm; - bool finish; + bool start; + int32_t seq; + int32_t ack; + void *pReader; + void *pCurrentBlock; + int32_t blockLen; + SSnapshotParam snapshotParam; + SSnapshot snapshot; + SSyncCfg lastConfig; + int64_t sendingMS; + SSyncNode *pSyncNode; + int32_t replicaIndex; + SyncTerm term; + SyncTerm privateTerm; + bool finish; } SSyncSnapshotSender; SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex); void snapshotSenderDestroy(SSyncSnapshotSender *pSender); bool snapshotSenderIsStart(SSyncSnapshotSender *pSender); -int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, void *pReader); +int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapshotParam, SSnapshot snapshot, + void *pReader); int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); 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; - SyncTerm term; - SyncTerm privateTerm; - SSnapshot snapshot; - SRaftId fromId; - SSyncNode *pSyncNode; + bool start; + int32_t ack; + void *pWriter; + SyncTerm term; + SyncTerm privateTerm; + SSnapshotParam snapshotParam; + SSnapshot snapshot; + SRaftId fromId; + SSyncNode *pSyncNode; } SSyncSnapshotReceiver; @@ -85,8 +88,8 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(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/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 95015d3973..f3206e9ccc 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -118,12 +118,12 @@ static void syncNodeStartSnapshot(SSyncNode* ths, SyncIndex beginIndex, SyncInde SSnapshot snapshot = { .data = NULL, .lastApplyIndex = endIndex, .lastApplyTerm = lastApplyTerm, .lastConfigIndex = SYNC_INDEX_INVALID}; - void* pReader = NULL; - SReaderParam readerParam = {.start = beginIndex, .end = endIndex}; + void* pReader = NULL; + SSnapshotParam readerParam = {.start = beginIndex, .end = endIndex}; ths->pFsm->FpSnapshotStartRead(ths->pFsm, &readerParam, &pReader); if (!snapshotSenderIsStart(pSender) && pMsg->privateTerm < pSender->privateTerm) { ASSERT(pReader != NULL); - snapshotSenderStart(pSender, snapshot, pReader); + snapshotSenderStart(pSender, readerParam, snapshot, pReader); } else { if (pReader != NULL) { @@ -300,7 +300,8 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries !snapshotSenderIsStart(pSender) && pMsg->privateTerm < pSender->privateTerm) { // has snapshot ASSERT(pReader != NULL); - snapshotSenderStart(pSender, snapshot, pReader); + SSnapshotParam readerParam = {.start = 0, .end = snapshot.lastApplyIndex}; + snapshotSenderStart(pSender, readerParam, snapshot, pReader); } else { // no snapshot diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 8cbb5981aa..e53b9d5e36 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -2254,6 +2254,9 @@ cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) { snprintf(u64buf, sizeof(u64buf), "%lu", pMsg->privateTerm); cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + snprintf(u64buf, sizeof(u64buf), "%ld", pMsg->beginIndex); + cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); + snprintf(u64buf, sizeof(u64buf), "%ld", pMsg->lastIndex); cJSON_AddStringToObject(pRoot, "lastIndex", u64buf); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index dbab187f0e..cefe676f90 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -80,13 +80,15 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; } // begin send snapshot by snapshot, pReader -int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, void *pReader) { +int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapshotParam, SSnapshot snapshot, + void *pReader) { ASSERT(!snapshotSenderIsStart(pSender)); - // init snapshot and reader + // init snapshot, parm, reader ASSERT(pSender->pReader == NULL); pSender->pReader = pReader; pSender->snapshot = snapshot; + pSender->snapshotParam = snapshotParam; // init current block if (pSender->pCurrentBlock != NULL) { @@ -162,6 +164,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, vo pMsg->srcId = pSender->pSyncNode->myRaftId; pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; + pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; pMsg->lastTerm = pSender->snapshot.lastApplyTerm; pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; @@ -353,14 +356,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]; @@ -439,10 +442,13 @@ static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncTerm p pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex; pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm; pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex; + pReceiver->snapshotParam.start = pBeginMsg->beginIndex; + pReceiver->snapshotParam.end = pBeginMsg->lastIndex; // write data ASSERT(pReceiver->pWriter == NULL); - int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, &(pReceiver->pWriter)); + int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, + &(pReceiver->snapshotParam), &(pReceiver->pWriter)); ASSERT(ret == 0); // event log @@ -612,7 +618,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); @@ -645,14 +651,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/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index b603d48b8b..01f321cbd4 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -114,7 +114,7 @@ int32_t SnapshotDoRead(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32 return 0; } -int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void** ppWriter) { +int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void *pParam, void** ppWriter) { *ppWriter = (void*)0xCDEF; char logBuf[256] = {0}; snprintf(logBuf, sizeof(logBuf), "==callback== ==SnapshotStartWrite== pFsm:%p, *ppWriter:%p", pFsm, *ppWriter); diff --git a/source/libs/sync/test/syncSnapshotReceiverTest.cpp b/source/libs/sync/test/syncSnapshotReceiverTest.cpp index 208a96daa4..b4bf08dd40 100644 --- a/source/libs/sync/test/syncSnapshotReceiverTest.cpp +++ b/source/libs/sync/test/syncSnapshotReceiverTest.cpp @@ -29,7 +29,7 @@ int32_t SnapshotStartRead(struct SSyncFSM* pFsm, 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; } -int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void** ppWriter) { return 0; } +int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void *pParam, void** ppWriter) { return 0; } int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply) { return 0; } int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_t len) { return 0; } diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index f7a4d91594..505260e978 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -111,7 +111,7 @@ int32_t SnapshotDoRead(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32 return 0; } -int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void** ppWriter) { +int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void *pParam, void** ppWriter) { *ppWriter = (void*)0xCDEF; char logBuf[256] = {0}; From d4f1614242dd8a5f3dc2a93b3082cc65b74fb8e4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Jul 2022 14:28:50 +0800 Subject: [PATCH 22/63] fix invalid read/write --- source/libs/transport/src/transCli.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c140de24d8..a21e97d049 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -262,13 +262,17 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) { #define REQUEST_PERSIS_HANDLE(msg) ((msg)->info.persistHandle == 1) #define REQUEST_RELEASE_HANDLE(cmsg) ((cmsg)->type == Release) +#define EPSET_IS_VALID(epSet) ((epSet) != NULL && (epSet)->numOfEps != 0) #define EPSET_GET_SIZE(epSet) (epSet)->numOfEps #define EPSET_GET_INUSE_IP(epSet) ((epSet)->eps[(epSet)->inUse].fqdn) #define EPSET_GET_INUSE_PORT(epSet) ((epSet)->eps[(epSet)->inUse].port) -#define EPSET_FORWARD_INUSE(epSet) \ - do { \ - (epSet)->inUse = (++((epSet)->inUse)) % ((epSet)->numOfEps); \ +#define EPSET_FORWARD_INUSE(epSet) \ + do { \ + if ((epSet)->numOfEps != 0) { \ + (epSet)->inUse = (++((epSet)->inUse)) % ((epSet)->numOfEps); \ + } \ } while (0) + #define EPSET_DEBUG_STR(epSet, tbuf) \ do { \ int len = snprintf(tbuf, sizeof(tbuf), "epset:{"); \ @@ -512,7 +516,6 @@ static void allocConnRef(SCliConn* conn, bool update) { } static void addConnToPool(void* pool, SCliConn* conn) { if (conn->status == ConnInPool) { - // assert(0); return; } SCliThrd* thrd = conn->hostThrd; @@ -668,7 +671,6 @@ static void cliSendCb(uv_write_t* req, int status) { void cliSend(SCliConn* pConn) { CONN_HANDLE_BROKEN(pConn); - // assert(taosArrayGetSize(pConn->cliMsgs) > 0); assert(!transQueueEmpty(&pConn->cliMsgs)); SCliMsg* pCliMsg = NULL; @@ -810,6 +812,11 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { STrans* pTransInst = pThrd->pTransInst; cliMayCvtFqdnToIp(&pCtx->epSet, &pThrd->cvtAddr); + if (!EPSET_IS_VALID(&pCtx->epSet)) { + destroyCmsg(pMsg); + tError("invalid epset"); + return; + } bool ignore = false; SCliConn* conn = cliGetConn(pMsg, pThrd, &ignore); @@ -1077,12 +1084,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } else { cliCompareAndSwap(&pCtx->retryLimit, TRANS_RETRY_COUNT_LIMIT, TRANS_RETRY_COUNT_LIMIT); if (pCtx->retryCnt < pCtx->retryLimit) { - addConnToPool(pThrd->pool, pConn); if (pResp->contLen == 0) { EPSET_FORWARD_INUSE(&pCtx->epSet); } else { - tDeserializeSEpSet(pResp->pCont, pResp->contLen, &pCtx->epSet); + if (tDeserializeSEpSet(pResp->pCont, pResp->contLen, &pCtx->epSet) < 0) { + tError("%s conn %p failed to deserialize epset", CONN_GET_INST_LABEL(pConn)); + } } + addConnToPool(pThrd->pool, pConn); transFreeMsg(pResp->pCont); cliSchedMsgToNextNode(pMsg, pThrd); return -1; From 89e4be84fe349341b6a1fe258957994123252103 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 14:39:36 +0800 Subject: [PATCH 23/63] fix(query): add histogram function parameter check TD-16972 --- source/libs/function/src/builtins.c | 179 ++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index e016771bc9..4d5ed5e20a 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -18,6 +18,7 @@ #include "querynodes.h" #include "scalar.h" #include "taoserror.h" +#include "cJSON.h" static int32_t buildFuncErrMsg(char* pErrBuf, int32_t len, int32_t errCode, const char* pFormat, ...) { va_list vArgList; @@ -796,6 +797,165 @@ static int32_t translateLeastSQR(SFunctionNode* pFunc, char* pErrBuf, int32_t le return TSDB_CODE_SUCCESS; } +typedef enum { UNKNOWN_BIN = 0, USER_INPUT_BIN, LINEAR_BIN, LOG_BIN } EHistoBinType; + +static int8_t validateHistogramBinType(char* binTypeStr) { + int8_t binType; + if (strcasecmp(binTypeStr, "user_input") == 0) { + binType = USER_INPUT_BIN; + } else if (strcasecmp(binTypeStr, "linear_bin") == 0) { + binType = LINEAR_BIN; + } else if (strcasecmp(binTypeStr, "log_bin") == 0) { + binType = LOG_BIN; + } else { + binType = UNKNOWN_BIN; + } + + return binType; +} + +static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* errMsg, int32_t msgLen) { + const char *msg1 = "HISTOGRAM function requires four parameters"; + const char *msg3 = "HISTOGRAM function invalid format for binDesc parameter"; + const char *msg4 = "HISTOGRAM function binDesc parameter \"count\" should be in range [1, 1000]"; + const char *msg5 = "HISTOGRAM function bin/parameter should be in range [-DBL_MAX, DBL_MAX]"; + const char *msg6 = "HISTOGRAM function binDesc parameter \"width\" cannot be 0"; + const char *msg7 = "HISTOGRAM function binDesc parameter \"start\" cannot be 0 with \"log_bin\" type"; + const char *msg8 = "HISTOGRAM function binDesc parameter \"factor\" cannot be negative or equal to 0/1"; + + cJSON* binDesc = cJSON_Parse(binDescStr); + int32_t numOfBins; + double* intervals; + if (cJSON_IsObject(binDesc)) { /* linaer/log bins */ + int32_t numOfParams = cJSON_GetArraySize(binDesc); + int32_t startIndex; + if (numOfParams != 4) { + snprintf(errMsg, msgLen, "%s", msg1); + return false; + } + + cJSON* start = cJSON_GetObjectItem(binDesc, "start"); + cJSON* factor = cJSON_GetObjectItem(binDesc, "factor"); + cJSON* width = cJSON_GetObjectItem(binDesc, "width"); + cJSON* count = cJSON_GetObjectItem(binDesc, "count"); + cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity"); + + if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { + snprintf(errMsg, msgLen, "%s", msg3); + return false; + } + + if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 + snprintf(errMsg, msgLen, "%s", msg4); + return false; + } + + if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || + (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { + snprintf(errMsg, msgLen, "%s", msg5); + return false; + } + + int32_t counter = (int32_t)count->valueint; + if (infinity->valueint == false) { + startIndex = 0; + numOfBins = counter + 1; + } else { + startIndex = 1; + numOfBins = counter + 3; + } + + intervals = taosMemoryCalloc(numOfBins, sizeof(double)); + if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) { + // linear bin process + if (width->valuedouble == 0) { + snprintf(errMsg, msgLen, "%s", msg6); + taosMemoryFree(intervals); + return false; + } + for (int i = 0; i < counter + 1; ++i) { + intervals[startIndex] = start->valuedouble + i * width->valuedouble; + if (isinf(intervals[startIndex])) { + snprintf(errMsg, msgLen, "%s", msg5); + taosMemoryFree(intervals); + return false; + } + startIndex++; + } + } else if (cJSON_IsNumber(factor) && width == NULL && binType == LOG_BIN) { + // log bin process + if (start->valuedouble == 0) { + snprintf(errMsg, msgLen, "%s", msg7); + taosMemoryFree(intervals); + return false; + } + if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) { + snprintf(errMsg, msgLen, "%s", msg8); + taosMemoryFree(intervals); + return false; + } + for (int i = 0; i < counter + 1; ++i) { + intervals[startIndex] = start->valuedouble * pow(factor->valuedouble, i * 1.0); + if (isinf(intervals[startIndex])) { + snprintf(errMsg, msgLen, "%s", msg5); + taosMemoryFree(intervals); + return false; + } + startIndex++; + } + } else { + snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + return false; + } + + if (infinity->valueint == true) { + intervals[0] = -INFINITY; + intervals[numOfBins - 1] = INFINITY; + // in case of desc bin orders, -inf/inf should be swapped + ASSERT(numOfBins >= 4); + if (intervals[1] > intervals[numOfBins - 2]) { + TSWAP(intervals[0], intervals[numOfBins - 1]); + } + } + } else if (cJSON_IsArray(binDesc)) { /* user input bins */ + if (binType != USER_INPUT_BIN) { + snprintf(errMsg, msgLen, "%s", msg3); + return false; + } + numOfBins = cJSON_GetArraySize(binDesc); + intervals = taosMemoryCalloc(numOfBins, sizeof(double)); + cJSON* bin = binDesc->child; + if (bin == NULL) { + snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + return false; + } + int i = 0; + while (bin) { + intervals[i] = bin->valuedouble; + if (!cJSON_IsNumber(bin)) { + snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + return false; + } + if (i != 0 && intervals[i] <= intervals[i - 1]) { + snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + return false; + } + bin = bin->next; + i++; + } + } else { + snprintf(errMsg, msgLen, "%s", msg3); + return false; + } + + taosMemoryFree(intervals); + return true; +} + static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); if (4 != numOfParams) { @@ -814,6 +974,8 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + int8_t binType; + char* binDesc; for (int32_t i = 1; i < numOfParams; ++i) { SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); if (QUERY_NODE_VALUE != nodeType(pParamNode)) { @@ -824,6 +986,23 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l pValue->notReserved = true; + if (i == 1) { + binType = validateHistogramBinType(varDataVal(pValue->datum.p)); + if (binType == UNKNOWN_BIN) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "HISTOGRAM function binType parameter should be " + "\"user_input\", \"log_bin\" or \"linear_bin\""); + } + } + + if (i == 2) { + char errMsg[64] = {0}; + binDesc = varDataVal(pValue->datum.p); + if (!validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); + } + } + if (i == 3 && pValue->datum.i != 1 && pValue->datum.i != 0) { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "HISTOGRAM function normalized parameter should be 0/1"); From 831ef7de2376e404b7f84f5761e850e49c97f866 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 14:46:08 +0800 Subject: [PATCH 24/63] fix: some problems of parser and planner --- source/libs/parser/src/parInsert.c | 4 +- source/libs/parser/src/parTranslater.c | 156 ++++++++++++------------- tests/system-test/2-query/json_tag.py | 2 +- 3 files changed, 80 insertions(+), 82 deletions(-) diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 38d488bf10..a286531588 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1503,11 +1503,11 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { NEXT_TOKEN(pCxt->pSql, sToken); } - if (TK_USING == sToken.type && !existedUsing) { + if (TK_USING == sToken.type) { CHECK_CODE(parseUsingClause(pCxt, &name, tbFName)); NEXT_TOKEN(pCxt->pSql, sToken); autoCreateTbl = true; - } else { + } else if (!existedUsing) { CHECK_CODE(getTableMeta(pCxt, &name, dbFName)); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index caf70d2ec7..403f0635bd 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -121,8 +121,8 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pName->dbname, - pName->tname); + parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, + tstrerror(code), pName->dbname, pName->tname); } return code; } @@ -150,8 +150,8 @@ static int32_t getTableCfg(STranslateContext* pCxt, const SName* pName, STableCf } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogRefreshGetTableCfg error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pName->dbname, - pName->tname); + parserError("0x%" PRIx64 " catalogRefreshGetTableCfg error, code:%s, dbName:%s, tbName:%s", + pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; } @@ -173,8 +173,8 @@ static int32_t refreshGetTableMeta(STranslateContext* pCxt, const char* pDbName, code = catalogRefreshGetTableMeta(pParCxt->pCatalog, &conn, &name, pMeta, false); } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogRefreshGetTableMeta error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pDbName, - pTableName); + parserError("0x%" PRIx64 " catalogRefreshGetTableMeta error, code:%s, dbName:%s, tbName:%s", + pCxt->pParseCxt->requestId, tstrerror(code), pDbName, pTableName); } return code; } @@ -196,7 +196,8 @@ static int32_t getDBVgInfoImpl(STranslateContext* pCxt, const SName* pName, SArr } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogGetDBVgInfo error, code:%s, dbFName:%s", tstrerror(code), fullDbName); + parserError("0x%" PRIx64 " catalogGetDBVgInfo error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, + tstrerror(code), fullDbName); } return code; } @@ -227,8 +228,8 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pName->dbname, - pName->tname); + parserError("0x%" PRIx64 " catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", + pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } return code; } @@ -251,7 +252,8 @@ static int32_t getDBVgVersion(STranslateContext* pCxt, const char* pDbFName, int } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogGetDBVgVersion error, code:%s, dbFName:%s", tstrerror(code), pDbFName); + parserError("0x%" PRIx64 " catalogGetDBVgVersion error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, + tstrerror(code), pDbFName); } return code; } @@ -276,7 +278,8 @@ static int32_t getDBCfg(STranslateContext* pCxt, const char* pDbName, SDbCfgInfo } } if (TSDB_CODE_SUCCESS != code) { - parserError("catalogGetDBCfg error, code:%s, dbFName:%s", tstrerror(code), dbFname); + parserError("0x%" PRIx64 " catalogGetDBCfg error, code:%s, dbFName:%s", pCxt->pParseCxt->requestId, tstrerror(code), + dbFname); } return code; } @@ -303,6 +306,10 @@ static int32_t getUdfInfo(STranslateContext* pCxt, SFunctionNode* pFunc) { pFunc->udfBufSize = funcInfo.bufSize; tFreeSFuncInfo(&funcInfo); } + if (TSDB_CODE_SUCCESS != code) { + parserError("0x%" PRIx64 " catalogGetUdfInfo error, code:%s, funcName:%s", pCxt->pParseCxt->requestId, + tstrerror(code), pFunc->functionName); + } return code; } @@ -323,7 +330,8 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray code = catalogGetTableIndex(pParCxt->pCatalog, &conn, pName, pIndexes); } if (TSDB_CODE_SUCCESS != code) { - parserError("getTableIndex error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pName->dbname, pName->tname); + parserError("0x%" PRIx64 " getTableIndex error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, + tstrerror(code), pName->dbname, pName->tname); } return code; } @@ -341,7 +349,7 @@ static int32_t getDnodeList(STranslateContext* pCxt, SArray** pDnodes) { code = catalogGetDnodeList(pParCxt->pCatalog, &conn, pDnodes); } if (TSDB_CODE_SUCCESS != code) { - parserError("getDnodeList error, code:%s", tstrerror(code)); + parserError("0x%" PRIx64 " getDnodeList error, code:%s", pCxt->pParseCxt->requestId, tstrerror(code)); } return code; } @@ -707,7 +715,7 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { - if (isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { + if (NULL == pCxt->pCurrStmt || isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName); } @@ -3790,24 +3798,45 @@ static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pS return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Set tag value only available for child table"); } + + if (pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_OPTIONS && -1 != pStmt->pOptions->ttl) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); + } + + if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); + } + + if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_COLUMN) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON); + } + + STableMeta* pTableMeta = NULL; + int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + + SSchema* pTagsSchema = getTableTagSchema(pTableMeta); + if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && + (pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG || + pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_TAG_BYTES)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); + } + if (TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES == pStmt->alterType || TSDB_ALTER_TABLE_UPDATE_TAG_BYTES == pStmt->alterType) { - STableMeta* pTableMeta = NULL; - int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); - if (TSDB_CODE_SUCCESS == code) { - if (TSDB_SUPER_TABLE != pTableMeta->tableType) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Table is not super table"); - } - - SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); - if (NULL == pSchema) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); - } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type || - pSchema->bytes >= calcTypeBytes(pStmt->dataType)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL); - } + if (TSDB_SUPER_TABLE != pTableMeta->tableType) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Table is not super table"); + } + + SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); + if (NULL == pSchema) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); + } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type || + pSchema->bytes >= calcTypeBytes(pStmt->dataType)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL); } - return code; } return TSDB_CODE_SUCCESS; } @@ -5259,45 +5288,11 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S } } -// static int32_t createValueFromFunction(STranslateContext* pCxt, SFunctionNode* pFunc, SValueNode** pVal) { -// int32_t code = getFuncInfo(pCxt, pFunc); -// if (TSDB_CODE_SUCCESS == code) { -// code = scalarCalculateConstants((SNode*)pFunc, (SNode**)pVal); -// } -// return code; -// } - static SDataType schemaToDataType(uint8_t precision, SSchema* pSchema) { SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes, .precision = precision, .scale = 0}; return dt; } -// static int32_t createValueFromExpr(STranslateContext* pCxt, SNode* pNode, SValueNode** pVal) { -// SNode* pExpr = nodesCloneNode(pNode); -// if (NULL == pExpr) { -// return TSDB_CODE_OUT_OF_MEMORY; -// } - -// SNode* pNew = NULL; -// int32_t code = translateExpr(pCxt, &pExpr); -// if (TSDB_CODE_SUCCESS == code) { -// code = scalarCalculateConstants(pExpr, &pNew); -// } -// if (TSDB_CODE_SUCCESS == code) { -// pExpr = pNew; -// if (QUERY_NODE_VALUE != nodeType(pExpr)) { -// code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName); -// } -// } - -// if (TSDB_CODE_SUCCESS == code) { -// *pVal = pExpr; -// } else { -// nodesDestroyNode(pExpr); -// } -// return code; -// } - static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SDataType dt, SNode** pCast) { SNode* pExpr = nodesCloneNode(pNode); if (NULL == pExpr) { @@ -5313,10 +5308,9 @@ static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SData return code; } -static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode, - SValueNode** pVal) { +static int32_t createTagValFromExpr(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) { SNode* pCast = NULL; - int32_t code = createCastFuncForTag(pCxt, pNode, schemaToDataType(precision, pSchema), &pCast); + int32_t code = createCastFuncForTag(pCxt, pNode, targetDt, &pCast); SNode* pNew = NULL; if (TSDB_CODE_SUCCESS == code) { code = scalarCalculateConstants(pCast, &pNew); @@ -5336,6 +5330,23 @@ static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* return code; } +static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) { + *pVal = (SValueNode*)nodesCloneNode(pNode); + if (NULL == *pVal) { + return TSDB_CODE_OUT_OF_MEMORY; + } + return DEAL_RES_ERROR == translateValueImpl(pCxt, *pVal, targetDt) ? pCxt->errCode : TSDB_CODE_SUCCESS; +} + +static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode, + SValueNode** pVal) { + if (QUERY_NODE_VALUE == nodeType(pNode)) { + return createTagValFromVal(pCxt, schemaToDataType(precision, pSchema), pNode, pVal); + } else { + return createTagValFromExpr(pCxt, schemaToDataType(precision, pSchema), pNode, pVal); + } +} + static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray, STag** ppTag) { if (pVal->literal && strlen(pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { @@ -5962,15 +5973,6 @@ static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* p } if (TSDB_SUPER_TABLE == pTableMeta->tableType) { - SSchema* pTagsSchema = getTableTagSchema(pTableMeta); - if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && - (pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG || - pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_TAG_BYTES)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); - } - if (pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_OPTIONS && -1 != pStmt->pOptions->ttl) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); - } return TSDB_CODE_SUCCESS; } else if (TSDB_CHILD_TABLE != pTableMeta->tableType && TSDB_NORMAL_TABLE != pTableMeta->tableType) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); @@ -5993,10 +5995,6 @@ static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* p static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { SAlterTableStmt* pStmt = (SAlterTableStmt*)pQuery->pRoot; - if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); - } - if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_COLUMN) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON); } diff --git a/tests/system-test/2-query/json_tag.py b/tests/system-test/2-query/json_tag.py index c18d1dab0e..84aab3d624 100644 --- a/tests/system-test/2-query/json_tag.py +++ b/tests/system-test/2-query/json_tag.py @@ -566,7 +566,7 @@ class TDTestCase: tdSql.checkRows(3) tdSql.query("select bottom(dataint,100) from jsons1 where jtag->'tag1'>1") tdSql.checkRows(3) - tdSql.query("select percentile(dataint,20) from jsons1 where jtag->'tag1'>1") + #tdSql.query("select percentile(dataint,20) from jsons1 where jtag->'tag1'>1") tdSql.query("select apercentile(dataint, 50) from jsons1 where jtag->'tag1'>1") tdSql.checkData(0, 0, 1.5) # tdSql.query("select last_row(dataint) from jsons1 where jtag->'tag1'>1") From 684621159a4a3445a9afd86ff5dc6ca5f2d71267 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 14:46:58 +0800 Subject: [PATCH 25/63] extend error msg buffer size --- source/libs/function/src/builtins.c | 2 +- source/libs/function/src/functionMgt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 4d5ed5e20a..ff958fad85 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -996,7 +996,7 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l } if (i == 2) { - char errMsg[64] = {0}; + char errMsg[128] = {0}; binDesc = varDataVal(pValue->datum.p); if (!validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 7ad7612e7e..262adc5d6f 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -260,7 +260,7 @@ bool fmIsSameInOutType(int32_t funcId) { } static int32_t getFuncInfo(SFunctionNode* pFunc) { - char msg[64] = {0}; + char msg[128] = {0}; return fmGetFuncInfo(pFunc, msg, sizeof(msg)); } From ded461607443e8c1edbaa7aae80ed0310939e124 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 14:55:26 +0800 Subject: [PATCH 26/63] refactor(sync): add sync strategy --- include/libs/sync/sync.h | 24 ++++++++++++------- source/dnode/mnode/impl/src/mndMain.c | 18 +++++++------- source/dnode/mnode/impl/src/mndSync.c | 2 +- source/dnode/vnode/src/vnd/vnodeSync.c | 3 ++- source/libs/sync/src/syncMain.c | 2 +- .../test/syncConfigChangeSnapshotTest.cpp | 2 +- source/libs/sync/test/syncTestTool.cpp | 6 ++--- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index d4df039394..6e36e03b92 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -31,6 +31,12 @@ extern bool gRaftDetailLog; #define SYNC_INDEX_INVALID -1 #define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF +typedef enum { + SYNC_STRATEGY_NO_SNAPSHOT = 0, + SYNC_STRATEGY_STANDARD_SNAPSHOT = 1, + SYNC_STRATEGY_WAL_FIRST = 2, +} ESyncStrategy; + typedef uint64_t SyncNodeId; typedef int32_t SyncGroupId; typedef int64_t SyncIndex; @@ -183,15 +189,15 @@ typedef struct SSyncLogStore { } SSyncLogStore; typedef struct SSyncInfo { - bool isStandBy; - bool snapshotEnable; - SyncGroupId vgId; - int32_t batchSize; - SSyncCfg syncCfg; - char path[TSDB_FILENAME_LEN]; - SWal* pWal; - SSyncFSM* pFsm; - SMsgCb* msgcb; + bool isStandBy; + ESyncStrategy snapshotStrategy; + SyncGroupId vgId; + int32_t batchSize; + SSyncCfg syncCfg; + char path[TSDB_FILENAME_LEN]; + SWal* pWal; + SSyncFSM* pFsm; + SMsgCb* msgcb; int32_t (*FpSendMsg)(const SEpSet* pEpSet, SRpcMsg* pMsg); int32_t (*FpEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg); } SSyncInfo; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index c39c9847a9..a3b9bf57fd 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); @@ -579,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)]; @@ -632,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)); @@ -713,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/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 971cecf63a..2053f3886c 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -178,7 +178,7 @@ int32_t mndInitSync(SMnode *pMnode) { syncInfo.pWal = pMnode->pWal; syncInfo.pFsm = mndSyncMakeFsm(pMnode); syncInfo.isStandBy = pMgmt->standby; - syncInfo.snapshotEnable = true; + syncInfo.snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT; mInfo("start to open mnode sync, standby:%d", pMgmt->standby); if (pMgmt->standby || pMgmt->replica.id > 0) { diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 8af7e8c9b3..201f4a4180 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -442,7 +442,8 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) { int32_t vnodeSyncOpen(SVnode *pVnode, char *path) { SSyncInfo syncInfo = { - .snapshotEnable = false, + .snapshotStrategy = SYNC_STRATEGY_NO_SNAPSHOT, + .batchSize = 10, .vgId = pVnode->config.vgId, .isStandBy = pVnode->config.standby, .syncCfg = pVnode->config.syncCfg, diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index ddda60bc18..56e459751a 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -815,7 +815,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { // create a new raft config file SRaftCfgMeta meta; meta.isStandBy = pSyncInfo->isStandBy; - meta.snapshotEnable = pSyncInfo->snapshotEnable; + meta.snapshotEnable = pSyncInfo->snapshotStrategy; meta.lastConfigIndex = SYNC_INDEX_INVALID; ret = raftCfgCreateFile((SSyncCfg*)&(pSyncInfo->syncCfg), meta, pSyncNode->configPath); ASSERT(ret == 0); diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index 01f321cbd4..968baff952 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -198,7 +198,7 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal* snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex); syncInfo.pWal = pWal; syncInfo.isStandBy = isStandBy; - syncInfo.snapshotEnable = true; + syncInfo.snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT; SSyncCfg* pCfg = &syncInfo.syncCfg; diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index 505260e978..c6d3a3e4af 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -203,7 +203,7 @@ SWal* createWal(char* path, int32_t vgId) { } int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal* pWal, char* path, bool isStandBy, - bool enableSnapshot) { + ESyncStrategy enableSnapshot) { SSyncInfo syncInfo; syncInfo.vgId = vgId; syncInfo.msgcb = &gSyncIO->msgcb; @@ -213,7 +213,7 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal* snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex); syncInfo.pWal = pWal; syncInfo.isStandBy = isStandBy; - syncInfo.snapshotEnable = enableSnapshot; + syncInfo.snapshotStrategy = enableSnapshot; SSyncCfg* pCfg = &syncInfo.syncCfg; @@ -316,7 +316,7 @@ int main(int argc, char** argv) { int32_t replicaNum = atoi(argv[1]); int32_t myIndex = atoi(argv[2]); - bool enableSnapshot = atoi(argv[3]); + ESyncStrategy enableSnapshot = (ESyncStrategy)atoi(argv[3]); int32_t lastApplyIndex = atoi(argv[4]); int32_t lastApplyTerm = atoi(argv[5]); int32_t writeRecordNum = atoi(argv[6]); From a7e222ff9245776e7d94c96b45ef8676b35d5099 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 14:57:20 +0800 Subject: [PATCH 27/63] fix(query): histogram function add param check for distribution --- source/libs/function/src/builtins.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index ff958fad85..b061f4e9f9 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1032,6 +1032,8 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32 return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + int8_t binType; + char* binDesc; for (int32_t i = 1; i < numOfParams; ++i) { SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); if (QUERY_NODE_VALUE != nodeType(pParamNode)) { @@ -1042,6 +1044,23 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32 pValue->notReserved = true; + if (i == 1) { + binType = validateHistogramBinType(varDataVal(pValue->datum.p)); + if (binType == UNKNOWN_BIN) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "HISTOGRAM function binType parameter should be " + "\"user_input\", \"log_bin\" or \"linear_bin\""); + } + } + + if (i == 2) { + char errMsg[128] = {0}; + binDesc = varDataVal(pValue->datum.p); + if (!validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); + } + } + if (i == 3 && pValue->datum.i != 1 && pValue->datum.i != 0) { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "HISTOGRAM function normalized parameter should be 0/1"); From df36cd165b92ca7ec2355d497be91df003338561 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Jul 2022 15:01:51 +0800 Subject: [PATCH 28/63] fix invalid read/write --- source/libs/transport/test/transUT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/test/transUT.cpp b/source/libs/transport/test/transUT.cpp index 86c4830284..b55f771ebd 100644 --- a/source/libs/transport/test/transUT.cpp +++ b/source/libs/transport/test/transUT.cpp @@ -175,7 +175,7 @@ static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) rpcMsg.code = 0; rpcSendResponse(&rpcMsg); - rpcReleaseHandle(pMsg->info.handle, TAOS_CONN_SERVER); + rpcReleaseHandle(&pMsg->info, TAOS_CONN_SERVER); } static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { { From 2cff2e922876553e0adb1d8849765300454c0628 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 15:12:34 +0800 Subject: [PATCH 29/63] fix: some problems of parser and planner --- source/libs/parser/src/parTranslater.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 403f0635bd..5651412566 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2787,6 +2787,7 @@ static int32_t translateDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelet } static int32_t translateDelete(STranslateContext* pCxt, SDeleteStmt* pDelete) { + pCxt->pCurrStmt = (SNode*)pDelete; int32_t code = translateFrom(pCxt, pDelete->pFromTable); if (TSDB_CODE_SUCCESS == code) { code = translateDeleteWhere(pCxt, pDelete); From 4cd45e6bd7ed57d2d39e6f1620bfc0aa4ab39187 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 4 Jul 2022 15:16:39 +0800 Subject: [PATCH 30/63] test: add test case for tmq --- .../system-test/7-tmq/tmqConsFromTsdb-1ctb.py | 263 ++++++++++++++++++ .../7-tmq/tmqConsFromTsdb1-1ctb.py | 241 ++++++++++++++++ tests/system-test/fulltest.sh | 2 + 3 files changed, 506 insertions(+) create mode 100644 tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py create mode 100644 tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py new file mode 100644 index 0000000000..1d2aaccda5 --- /dev/null +++ b/tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py @@ -0,0 +1,263 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +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): + self.vgroups = 1 + self.ctbNum = 1 + self.rowsPerTbl = 100000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 100000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdDnodes.stop(1) + tdDnodes.start(1) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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: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("%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': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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 = 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) + + 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) + firstConsumeRows = resultList[0] + + 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) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 2 + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 1/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) + secondConsumeRows = resultList[0] + + 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) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 3 + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 1/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) + thirdConsumeRows = resultList[0] + + if not (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) + + # total consume + actConsumeTotalRows = firstConsumeRows + secondConsumeRows + thirdConsumeRows + + 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)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py new file mode 100644 index 0000000000..5cb373092b --- /dev/null +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py @@ -0,0 +1,241 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +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): + self.vgroups = 1 + self.ctbNum = 1 + self.rowsPerTbl = 100000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdDnodes.stop(1) + tdDnodes.start(1) + return + + 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': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 15, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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 = 3 + 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 = 2 + resultList = tmqCom.selectConsumeResult(expectRows) + actConsumeTotalRows = resultList[0] + resultList[1] + + 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)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 3 end ...... ") + + def tmqCase4(self): + tdLog.printNoPrefix("======== test case 4: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + + 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 = 5 + expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) + 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 commit notify") + tmqCom.getStartCommitNotifyFromTmqsim() + + tdLog.info("pkill consume processor") + tdCom.killProcessor("tmq_sim") + + # time.sleep(10) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 6 + 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 = resultList[0] + + if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted): + tdLog.info("act consume rows: %d"%(actConsumeTotalRows)) + tdLog.info("and second consume rows should be between 0 and %d"%(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 4 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase3() + self.tmqCase4() + + 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/fulltest.sh b/tests/system-test/fulltest.sh index 8f1137510e..eb411b33fa 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -163,3 +163,5 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py From 22d8c5e9ab6d7a144d1e0e276fe07c61a8ce4007 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 15:26:44 +0800 Subject: [PATCH 31/63] fix(query): disable histogram to be used with indefinite rows function in projection TD-16948 --- 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 bc004579ba..96c375e986 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2112,7 +2112,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "histogram", .type = FUNCTION_TYPE_HISTOGRAM, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_FORBID_FILL_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC, .translateFunc = translateHistogram, .getEnvFunc = getHistogramFuncEnv, .initFunc = histogramFunctionSetup, From 0c1a46c26ea5303145ab0420750de6473fdd49e8 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 15:29:55 +0800 Subject: [PATCH 32/63] refactor(sync): add sync strategy --- include/libs/sync/syncTools.h | 3 + source/dnode/vnode/src/vnd/vnodeSync.c | 171 +++++++++++++++++-------- source/libs/transport/inc/transComm.h | 2 +- 3 files changed, 121 insertions(+), 55 deletions(-) diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 0340bf026b..e6147a2e0e 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -624,6 +624,9 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMsg); int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); +int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatch* pMsg); +int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntriesReply* pMsg); + int32_t syncNodeOnSnapshotSendCb(SSyncNode* ths, SyncSnapshotSend* pMsg); int32_t syncNodeOnSnapshotRspCb(SSyncNode* ths, SyncSnapshotRsp* pMsg); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 201f4a4180..b8f1a5238f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -256,70 +256,133 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { SRpcMsg *pRpcMsg = pMsg; - if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { - SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); + // ToDo: ugly! use function pointer + // use different strategy + if (syncNodeSnapshotEnable(pSyncNode)) { + if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { + SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnTimeoutCb(pSyncNode, pSyncMsg); + syncTimeoutDestroy(pSyncMsg); - ret = syncNodeOnTimeoutCb(pSyncNode, pSyncMsg); - syncTimeoutDestroy(pSyncMsg); + } else if (pRpcMsg->msgType == TDMT_SYNC_PING) { + SyncPing *pSyncMsg = syncPingFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnPingCb(pSyncNode, pSyncMsg); + syncPingDestroy(pSyncMsg); - } else if (pRpcMsg->msgType == TDMT_SYNC_PING) { - SyncPing *pSyncMsg = syncPingFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); + } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { + SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnPingReplyCb(pSyncNode, pSyncMsg); + syncPingReplyDestroy(pSyncMsg); - ret = syncNodeOnPingCb(pSyncNode, pSyncMsg); - syncPingDestroy(pSyncMsg); + } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { + SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnClientRequestCb(pSyncNode, pSyncMsg, NULL); + syncClientRequestDestroy(pSyncMsg); - } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { - SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { + SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnRequestVoteCb(pSyncNode, pSyncMsg); + syncRequestVoteDestroy(pSyncMsg); - ret = syncNodeOnPingReplyCb(pSyncNode, pSyncMsg); - syncPingReplyDestroy(pSyncMsg); + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { + SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnRequestVoteReplyCb(pSyncNode, pSyncMsg); + syncRequestVoteReplyDestroy(pSyncMsg); - } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { - SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { + SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnAppendEntriesCb(pSyncNode, pSyncMsg); + syncAppendEntriesDestroy(pSyncMsg); - ret = syncNodeOnClientRequestCb(pSyncNode, pSyncMsg, NULL); - syncClientRequestDestroy(pSyncMsg); + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { + SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnAppendEntriesReplyCb(pSyncNode, pSyncMsg); + syncAppendEntriesReplyDestroy(pSyncMsg); - } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { - SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); + } else if (pRpcMsg->msgType == TDMT_SYNC_SET_VNODE_STANDBY) { + ret = vnodeSetStandBy(pVnode); + if (ret != 0 && terrno != 0) ret = terrno; + SRpcMsg rsp = {.code = ret, .info = pMsg->info}; + tmsgSendRsp(&rsp); + } else { + vError("==vnodeProcessSyncReq== error msg type:%d", pRpcMsg->msgType); + ret = -1; + } - ret = syncNodeOnRequestVoteCb(pSyncNode, pSyncMsg); - syncRequestVoteDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { - SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); - - ret = syncNodeOnRequestVoteReplyCb(pSyncNode, pSyncMsg); - syncRequestVoteReplyDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { - SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); - - ret = syncNodeOnAppendEntriesCb(pSyncNode, pSyncMsg); - syncAppendEntriesDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { - SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pRpcMsg); - assert(pSyncMsg != NULL); - - ret = syncNodeOnAppendEntriesReplyCb(pSyncNode, pSyncMsg); - syncAppendEntriesReplyDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_SET_VNODE_STANDBY) { - ret = vnodeSetStandBy(pVnode); - if (ret != 0 && terrno != 0) ret = terrno; - SRpcMsg rsp = {.code = ret, .info = pMsg->info}; - tmsgSendRsp(&rsp); } else { - vError("==vnodeProcessSyncReq== error msg type:%d", pRpcMsg->msgType); - ret = -1; + // use wal first strategy + + if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { + SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnTimeoutCb(pSyncNode, pSyncMsg); + syncTimeoutDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_PING) { + SyncPing *pSyncMsg = syncPingFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnPingCb(pSyncNode, pSyncMsg); + syncPingDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { + SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnPingReplyCb(pSyncNode, pSyncMsg); + syncPingReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { + SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnClientRequestCb(pSyncNode, pSyncMsg, NULL); + syncClientRequestDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST_BATCH) { + SyncClientRequestBatch *pSyncMsg = syncClientRequestBatchFromRpcMsg(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnClientRequestBatchCb(pSyncNode, pSyncMsg); + syncClientRequestBatchDestroyDeep(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { + SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnRequestVoteCb(pSyncNode, pSyncMsg); + syncRequestVoteDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { + SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnRequestVoteReplyCb(pSyncNode, pSyncMsg); + syncRequestVoteReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_BATCH) { + SyncAppendEntriesBatch *pSyncMsg = syncAppendEntriesBatchFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnAppendEntriesSnapshot2Cb(pSyncNode, pSyncMsg); + syncAppendEntriesBatchDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { + SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pRpcMsg); + ASSERT(pSyncMsg != NULL); + ret = syncNodeOnAppendEntriesReplySnapshot2Cb(pSyncNode, pSyncMsg); + syncAppendEntriesReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_SET_VNODE_STANDBY) { + ret = vnodeSetStandBy(pVnode); + if (ret != 0 && terrno != 0) ret = terrno; + SRpcMsg rsp = {.code = ret, .info = pMsg->info}; + tmsgSendRsp(&rsp); + } else { + vError("==vnodeProcessSyncReq== error msg type:%d", pRpcMsg->msgType); + ret = -1; + } } syncNodeRelease(pSyncNode); diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 21e7f7c7af..8db619270c 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -96,7 +96,7 @@ typedef void* queue[2]; #define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field)))) #define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit -#define TRANS_RETRY_INTERVAL 200 // ms retry interval +#define TRANS_RETRY_INTERVAL 30 // ms retry interval #define TRANS_CONN_TIMEOUT 3 // connect timeout typedef SRpcMsg STransMsg; From 6e59c13cbd813af926fb3e3d4980613b3bd74983 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 15:57:28 +0800 Subject: [PATCH 33/63] refactor(sync): add sync strategy --- include/libs/sync/syncTools.h | 3 ++- source/dnode/mnode/impl/src/mndMain.c | 2 +- source/dnode/vnode/src/vnd/vnodeSync.c | 2 +- source/libs/sync/inc/syncInt.h | 5 +++-- source/libs/sync/src/syncMain.c | 4 +++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index e6147a2e0e..7e95623740 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -643,7 +643,8 @@ typedef int32_t (*FpOnSnapshotSendCb)(SSyncNode* ths, SyncSnapshotSend* pMsg); typedef int32_t (*FpOnSnapshotRspCb)(SSyncNode* ths, SyncSnapshotRsp* pMsg); // option ---------------------------------- -bool syncNodeSnapshotEnable(SSyncNode* pSyncNode); +bool syncNodeSnapshotEnable(SSyncNode* pSyncNode); +ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode); // --------------------------------------------- diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index a3b9bf57fd..bc6830b8f3 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -427,7 +427,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { } while (0); // ToDo: ugly! use function pointer - if (syncNodeSnapshotEnable(pSyncNode)) { + if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_STANDARD_SNAPSHOT) { if (pMsg->msgType == TDMT_SYNC_TIMEOUT) { SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pMsg); code = syncNodeOnTimeoutCb(pSyncNode, pSyncMsg); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index b8f1a5238f..0445eda7af 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -258,7 +258,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // ToDo: ugly! use function pointer // use different strategy - if (syncNodeSnapshotEnable(pSyncNode)) { + if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_NO_SNAPSHOT) { if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); ASSERT(pSyncMsg != NULL); diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 66e5d28bdd..8936cd6ed9 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -174,8 +174,9 @@ 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); -SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex); +bool syncNodeSnapshotEnable(SSyncNode* pSyncNode); +ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode); +SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex); // ping -------------- int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* pMsg); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 56e459751a..ad7895b718 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1100,7 +1100,9 @@ void syncNodeClose(SSyncNode* pSyncNode) { } // option -bool syncNodeSnapshotEnable(SSyncNode* pSyncNode) { return pSyncNode->pRaftCfg->snapshotEnable; } +// bool syncNodeSnapshotEnable(SSyncNode* pSyncNode) { return pSyncNode->pRaftCfg->snapshotEnable; } + +ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode) { return pSyncNode->pRaftCfg->snapshotEnable; } // ping -------------- int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* pMsg) { From 59f015a121594177094e9a3596e069062942bbdc Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 16:22:02 +0800 Subject: [PATCH 34/63] refactor(sync): add error code sync-timeout --- include/libs/sync/sync.h | 5 ----- include/util/taoserror.h | 1 + source/util/src/terror.c | 1 + 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 6e36e03b92..a93b359ef3 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -54,11 +54,6 @@ typedef enum { TAOS_SYNC_STATE_ERROR = 103, } ESyncState; -typedef enum { - TAOS_SYNC_FSM_CB_SUCCESS = 0, - TAOS_SYNC_FSM_CB_OTHER_ERROR = 1, -} ESyncFsmCbCode; - typedef struct SNodeInfo { uint16_t nodePort; char nodeFqdn[TSDB_FQDN_LEN]; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index f881e29610..add8ee6974 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -428,6 +428,7 @@ int32_t* taosGetErrno(); #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_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0914) #define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF) // tq diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 923ff1878c..18d1beddbc 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -433,6 +433,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RECONFIG_NOT_READY, "Sync not ready for re 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_TIMEOUT, "Sync timeout") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error") // wal From 8b486765d3668ab6630d82b7517e6ec47829878e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 16:23:38 +0800 Subject: [PATCH 35/63] fix: sort operator exception error --- source/common/src/tdatablock.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index b72fd961f5..bca740e9ce 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -895,7 +895,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { SBlockOrderInfo* pOrder = taosArrayGet(pOrderInfo, 0); int64_t p0 = taosGetTimestampUs(); - + __compar_fn_t fn = getKeyComparFunc(pColInfoData->info.type, pOrder->order); taosSort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); @@ -923,8 +923,9 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { pInfo->pColData = taosArrayGet(pDataBlock->pDataBlock, pInfo->slotId); } + terrno = 0; taosqsort(index, rows, sizeof(int32_t), &helper, dataBlockCompar); - if(terrno) return terrno; + if (terrno) return terrno; int64_t p1 = taosGetTimestampUs(); @@ -1438,21 +1439,21 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) { } } -static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, size_t end){ +static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, size_t end) { int32_t dataOffset = -1; int32_t dataLen = 0; int32_t beigin = start; - while(beigin < end){ + while (beigin < end) { int32_t offset = pColInfoData->varmeta.offset[beigin]; - if(offset == -1) { + if (offset == -1) { beigin++; continue; } - if(start != 0) { + if (start != 0) { pColInfoData->varmeta.offset[beigin] = dataLen; } - char *data = pColInfoData->pData + offset; - if(dataOffset == -1) dataOffset = offset; // mark the begin of data + char* data = pColInfoData->pData + offset; + if (dataOffset == -1) dataOffset = offset; // mark the begin of data int32_t type = pColInfoData->info.type; if (type == TSDB_DATA_TYPE_JSON) { dataLen += getJsonValueLen(data); @@ -1461,7 +1462,7 @@ static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, s } beigin++; } - if(dataOffset > 0){ + if (dataOffset > 0) { memmove(pColInfoData->pData, pColInfoData->pData + dataOffset, dataLen); memmove(pColInfoData->varmeta.offset, &pColInfoData->varmeta.offset[start], (end - start) * sizeof(int32_t)); } From e4053ed90302eebf1300a90e8158f2fe58e7a3c9 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 17:13:22 +0800 Subject: [PATCH 36/63] refactor(query): remove redundant param check on function execution context --- source/libs/scalar/src/sclfunc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index f35f81892d..47ba441e7e 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -360,9 +360,6 @@ static void trtrim(char *input, char *output, int32_t type, int32_t charLen) { static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _len_fn lenFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -586,9 +583,6 @@ DONE: static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _conv_fn convFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -628,9 +622,6 @@ static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScala static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _trim_fn trimFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -664,16 +655,10 @@ static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarPar int32_t substrFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t subPos = 0; GET_TYPED_DATA(subPos, int32_t, GET_PARAM_TYPE(&pInput[1]), pInput[1].columnData->pData); - if (subPos == 0) { //subPos needs to be positive or negative values; - return TSDB_CODE_FAILED; - } int32_t subLen = INT16_MAX; if (inputNum == 3) { GET_TYPED_DATA(subLen, int32_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); - if (subLen < 0 || subLen > INT16_MAX) { //subLen cannot be negative - return TSDB_CODE_FAILED; - } subLen = (GET_PARAM_TYPE(pInput) == TSDB_DATA_TYPE_VARCHAR) ? subLen : subLen * TSDB_NCHAR_SIZE; } @@ -1149,13 +1134,6 @@ int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarP int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t type = GET_PARAM_TYPE(pInput); - if (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR) { - return TSDB_CODE_FAILED; - } - - if (inputNum != 1) { - return TSDB_CODE_FAILED; - } char tmp[TSDB_MAX_JSON_TAG_LEN] = {0}; for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { From af6a9abfdeb3bef9450345086ed7143e3fe7ea5f Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 17:13:22 +0800 Subject: [PATCH 37/63] refactor(query): remove redundant param check on function execution context TD-17029 --- source/libs/scalar/src/sclfunc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index f35f81892d..47ba441e7e 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -360,9 +360,6 @@ static void trtrim(char *input, char *output, int32_t type, int32_t charLen) { static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _len_fn lenFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -586,9 +583,6 @@ DONE: static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _conv_fn convFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -628,9 +622,6 @@ static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScala static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput, _trim_fn trimFn) { int32_t type = GET_PARAM_TYPE(pInput); - if (inputNum != 1 || !IS_VAR_DATA_TYPE(type)) { - return TSDB_CODE_FAILED; - } SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; @@ -664,16 +655,10 @@ static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarPar int32_t substrFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t subPos = 0; GET_TYPED_DATA(subPos, int32_t, GET_PARAM_TYPE(&pInput[1]), pInput[1].columnData->pData); - if (subPos == 0) { //subPos needs to be positive or negative values; - return TSDB_CODE_FAILED; - } int32_t subLen = INT16_MAX; if (inputNum == 3) { GET_TYPED_DATA(subLen, int32_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); - if (subLen < 0 || subLen > INT16_MAX) { //subLen cannot be negative - return TSDB_CODE_FAILED; - } subLen = (GET_PARAM_TYPE(pInput) == TSDB_DATA_TYPE_VARCHAR) ? subLen : subLen * TSDB_NCHAR_SIZE; } @@ -1149,13 +1134,6 @@ int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarP int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t type = GET_PARAM_TYPE(pInput); - if (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR) { - return TSDB_CODE_FAILED; - } - - if (inputNum != 1) { - return TSDB_CODE_FAILED; - } char tmp[TSDB_MAX_JSON_TAG_LEN] = {0}; for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { From 047f65935ddbdc186e413b5174bf0887ab5c6d3d Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 17:21:42 +0800 Subject: [PATCH 38/63] fix: automatically supplement primary key columns when creating stream --- source/libs/parser/src/parTranslater.c | 40 +++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5651412566..302359f185 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4264,6 +4264,38 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { tNameGetFullDbName(&name, pDbFName); } +static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt; + SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); + if (QUERY_NODE_FUNCTION == nodeType(pProj) && FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pProj)->funcType) { + return TSDB_CODE_SUCCESS; + } + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wstartts"); + strcpy(pFunc->node.aliasName, pFunc->functionName); + int32_t code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + } + return code; +} + +static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SCMCreateStreamReq* pReq) { + pCxt->createStream = true; + int32_t code = addWstartTsToCreateStreamQuery(pStmt); + if (TSDB_CODE_SUCCESS == code) { + code = translateQuery(pCxt, pStmt); + } + if (TSDB_CODE_SUCCESS == code) { + getSourceDatabase(pStmt, pCxt->pParseCxt->acctId, pReq->sourceDB); + code = nodesNodeToString(pStmt, false, &pReq->ast, NULL); + } + return code; +} + static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pReq->igExists = pStmt->ignoreExists; @@ -4277,13 +4309,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* tNameExtractFullName(&name, pReq->targetStbFullName); } - pCxt->createStream = true; - int32_t code = translateQuery(pCxt, pStmt->pQuery); - if (TSDB_CODE_SUCCESS == code) { - getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); - code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); - } - + int32_t code = buildCreateStreamQuery(pCxt, pStmt->pQuery, pReq); if (TSDB_CODE_SUCCESS == code) { pReq->sql = strdup(pCxt->pParseCxt->pSql); if (NULL == pReq->sql) { From 57836d8bb235b1a77590c264c35ff74be04bc7b6 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 4 Jul 2022 17:40:20 +0800 Subject: [PATCH 39/63] enh: add type convert api --- include/libs/nodes/plannodes.h | 1 + source/libs/command/inc/commandInt.h | 6 + source/libs/command/src/explain.c | 279 +++++++++++++++++++++ source/libs/planner/src/planPhysiCreater.c | 3 + source/libs/scalar/src/scalar.c | 69 +++++ source/libs/scheduler/src/schJob.c | 5 + 6 files changed, 363 insertions(+) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 3558e04bbf..b71fac459d 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -320,6 +320,7 @@ typedef struct SInterpFuncPhysiNode { SNodeList* pFuncs; STimeWindow timeRange; int64_t interval; + int8_t intervalUnit; EFillMode fillMode; SNode* pFillValues; // SNodeListNode SNode* pTimeSeries; // SColumnNode diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index 06e9af7569..6aca581f45 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -29,13 +29,17 @@ extern "C" { #define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s" #define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s" #define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s" +#define EXPLAIN_DISTBLK_SCAN_FORMAT "Block Dist Scan on %s" +#define EXPLAIN_LASTROW_SCAN_FORMAT "Last Row Scan on %s" #define EXPLAIN_PROJECTION_FORMAT "Projection" #define EXPLAIN_JOIN_FORMAT "%s" #define EXPLAIN_AGG_FORMAT "Aggragate" #define EXPLAIN_INDEF_ROWS_FORMAT "Indefinite Rows Function" #define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1" #define EXPLAIN_SORT_FORMAT "Sort" +#define EXPLAIN_GROUP_SORT_FORMAT "Group Sort" #define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s" +#define EXPLAIN_MERGE_INTERVAL_FORMAT "Merge Interval on Column %s" #define EXPLAIN_FILL_FORMAT "Fill" #define EXPLAIN_SESSION_FORMAT "Session" #define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s" @@ -62,10 +66,12 @@ extern "C" { #define EXPLAIN_COST_FORMAT "cost=%.2f..%.2f" #define EXPLAIN_ROWS_FORMAT "rows=%" PRIu64 #define EXPLAIN_COLUMNS_FORMAT "columns=%d" +#define EXPLAIN_PSEUDO_COLUMNS_FORMAT "pseudo_columns=%d" #define EXPLAIN_WIDTH_FORMAT "width=%d" #define EXPLAIN_TABLE_SCAN_FORMAT "order=[asc|%d desc|%d]" #define EXPLAIN_GROUPS_FORMAT "groups=%d" #define EXPLAIN_WIDTH_FORMAT "width=%d" +#define EXPLAIN_INTERVAL_VALUE_FORMAT "interval=%" PRId64 "%c" #define EXPLAIN_FUNCTIONS_FORMAT "functions=%d" #define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64 #define EXPLAIN_MODE_FORMAT "mode=%s" diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 7af36a0842..a811af4457 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -199,6 +199,31 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo pPhysiChildren = mergePhysiNode->scan.node.pChildren; break; } + case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: { + SBlockDistScanPhysiNode *distPhysiNode = (SBlockDistScanPhysiNode *)pNode; + pPhysiChildren = distPhysiNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: { + SLastRowScanPhysiNode *lastRowPhysiNode = (SLastRowScanPhysiNode *)pNode; + pPhysiChildren = lastRowPhysiNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: { + SGroupSortPhysiNode *groupSortPhysiNode = (SGroupSortPhysiNode *)pNode; + pPhysiChildren = groupSortPhysiNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: { + SMergeIntervalPhysiNode *mergeIntPhysiNode = (SMergeIntervalPhysiNode *)pNode; + pPhysiChildren = mergeIntPhysiNode->window.node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: { + SInterpFuncPhysiNode *interpPhysiNode = (SInterpFuncPhysiNode *)pNode; + pPhysiChildren = interpPhysiNode->node.pChildren; + break; + } default: qError("not supported physical node type %d", pNode->type); QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); @@ -378,6 +403,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pTagScanNode->pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTagScanNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pTagScanNode->node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); EXPLAIN_ROW_END(); @@ -415,6 +442,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pTblScanNode->scan.pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTblScanNode->scan.pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pTblScanNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_TABLE_SCAN_FORMAT, pTblScanNode->scanSeq[0], pTblScanNode->scanSeq[1]); @@ -516,6 +545,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pSTblScanNode->scan.pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pSTblScanNode->scan.pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pSTblScanNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); @@ -1131,6 +1162,254 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } break; } + case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: { + SBlockDistScanPhysiNode *pDistScanNode = (SBlockDistScanPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_DISTBLK_SCAN_FORMAT, pDistScanNode->tableName.tname); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pDistScanNode->pScanCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pDistScanNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pDistScanNode->node.pOutputDataBlockDesc->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, + nodesGetOutputNumFromSlotList(pDistScanNode->node.pOutputDataBlockDesc->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pDistScanNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pDistScanNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pDistScanNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, + TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: { + SLastRowScanPhysiNode *pLastRowNode = (SLastRowScanPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_LASTROW_SCAN_FORMAT, pLastRowNode->tableName.tname); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pLastRowNode->pScanCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pLastRowNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->node.pOutputDataBlockDesc->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, + nodesGetOutputNumFromSlotList(pLastRowNode->node.pOutputDataBlockDesc->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pLastRowNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pLastRowNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, + TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: { + SGroupSortPhysiNode *pSortNode = (SGroupSortPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_GROUP_SORT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + + SDataBlockDescNode *pDescNode = pSortNode->node.pOutputDataBlockDesc; + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, nodesGetOutputNumFromSlotList(pDescNode->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pDescNode->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (EXPLAIN_MODE_ANALYZE == ctx->mode) { + // sort key + EXPLAIN_ROW_NEW(level + 1, "Sort Key: "); + if (pResNode->pExecInfo) { + for (int32_t i = 0; i < LIST_LENGTH(pSortNode->pSortKeys); ++i) { + SOrderByExprNode *ptn = (SOrderByExprNode *)nodesListGetNode(pSortNode->pSortKeys, i); + EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); + } + } + + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + // sort method + EXPLAIN_ROW_NEW(level + 1, "Sort Method: "); + + int32_t nodeNum = taosArrayGetSize(pResNode->pExecInfo); + SExplainExecInfo *execInfo = taosArrayGet(pResNode->pExecInfo, 0); + SSortExecInfo *pExecInfo = (SSortExecInfo *)execInfo->verboseInfo; + EXPLAIN_ROW_APPEND("%s", pExecInfo->sortMethod == SORT_QSORT_T ? "quicksort" : "merge sort"); + if (pExecInfo->sortBuffer > 1024 * 1024) { + EXPLAIN_ROW_APPEND(" Buffers:%.2f Mb", pExecInfo->sortBuffer / (1024 * 1024.0)); + } else if (pExecInfo->sortBuffer > 1024) { + EXPLAIN_ROW_APPEND(" Buffers:%.2f Kb", pExecInfo->sortBuffer / (1024.0)); + } else { + EXPLAIN_ROW_APPEND(" Buffers:%d b", pExecInfo->sortBuffer); + } + + EXPLAIN_ROW_APPEND(" loops:%d", pExecInfo->loops); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + } + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, + nodesGetOutputNumFromSlotList(pSortNode->node.pOutputDataBlockDesc->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pSortNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pSortNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, + TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: { + SMergeIntervalPhysiNode *pIntNode = (SMergeIntervalPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_MERGE_INTERVAL_FORMAT, nodesGetNameFromColumnNode(pIntNode->window.pTspk)); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pIntNode->window.pFuncs->length); + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, + nodesGetOutputNumFromSlotList(pIntNode->window.node.pOutputDataBlockDesc->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + uint8_t precision = getIntervalPrecision(pIntNode); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIME_WINDOWS_FORMAT, + INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->interval, pIntNode->intervalUnit, precision), + pIntNode->intervalUnit, pIntNode->offset, getPrecisionUnit(precision), + INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->sliding, pIntNode->slidingUnit, precision), + pIntNode->slidingUnit); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pIntNode->window.node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + VARSTR_HEADER_SIZE, + TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: { + SInterpFuncPhysiNode *pInterpNode = (SInterpFuncPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + if (pInterpNode->pFuncs) { + EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pInterpNode->pFuncs->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + + EXPLAIN_ROW_APPEND(EXPLAIN_MODE_FORMAT, nodesGetFillModeString(pInterpNode->fillMode)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, + nodesGetOutputNumFromSlotList(pInterpNode->node.pOutputDataBlockDesc->pSlots)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pInterpNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (pInterpNode->pFillValues) { + SNodeListNode *pValues = (SNodeListNode *)pInterpNode->pFillValues; + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILL_VALUE_FORMAT); + SNode *tNode = NULL; + int32_t i = 0; + FOREACH(tNode, pValues->pNodeList) { + if (i) { + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + SValueNode *tValue = (SValueNode *)tNode; + char *value = nodesGetStrValueFromNode(tValue); + EXPLAIN_ROW_APPEND(EXPLAIN_STRING_TYPE_FORMAT, value); + taosMemoryFree(value); + ++i; + } + + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_INTERVAL_VALUE_FORMAT, pInterpNode->interval, pInterpNode->intervalUnit); + EXPLAIN_ROW_END(); + + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIMERANGE_FORMAT, pInterpNode->timeRange.skey, pInterpNode->timeRange.ekey); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pInterpNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pInterpNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, + TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } + break; + } default: qError("not supported physical node type %d", pNode->type); return TSDB_CODE_QRY_APP_ERROR; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index aac9c25f77..0eb05ccbe9 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -552,6 +552,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_USER_TABLES) || 0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED)) { vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode); + } else { + pSubplan->execNode.nodeId = MNODE_HANDLE; + pSubplan->execNode.epSet = pCxt->pPlanCxt->mgmtEpSet; } SQueryNodeLoad node = {.addr = {.nodeId = MNODE_HANDLE, .epSet = pCxt->pPlanCxt->mgmtEpSet}, .load = 0}; taosArrayPush(pCxt->pExecNodeList, &node); diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index ba6bd4bd5f..cbb1089d61 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1035,3 +1035,72 @@ _return: sclFreeRes(ctx.pRes); return code; } + +int32_t scalarGetOperatorResultType(SDataType left, SDataType right, EOperatorType op, SDataType* pRes) { + switch (op) { + case OP_TYPE_ADD: + if (left.type == TSDB_DATA_TYPE_TIMESTAMP && right.type == TSDB_DATA_TYPE_TIMESTAMP) { + qError("invalid op %d, left type:%d, right type:%d", op, left.type, right.type); + return TSDB_CODE_TSC_INVALID_OPERATION; + } + if ((left.type == TSDB_DATA_TYPE_TIMESTAMP && (IS_INTEGER_TYPE(right.type) || right.type == TSDB_DATA_TYPE_BOOL)) || + (right.type == TSDB_DATA_TYPE_TIMESTAMP && (IS_INTEGER_TYPE(left.type) || left.type == TSDB_DATA_TYPE_BOOL))) { + pRes->type = TSDB_DATA_TYPE_TIMESTAMP; + return TSDB_CODE_SUCCESS; + } + pRes->type = TSDB_DATA_TYPE_DOUBLE; + return TSDB_CODE_SUCCESS; + case OP_TYPE_SUB: + if ((left.type == TSDB_DATA_TYPE_TIMESTAMP && right.type == TSDB_DATA_TYPE_BIGINT) || + (right.type == TSDB_DATA_TYPE_TIMESTAMP && left.type == TSDB_DATA_TYPE_BIGINT)) { + pRes->type = TSDB_DATA_TYPE_TIMESTAMP; + return TSDB_CODE_SUCCESS; + } + pRes->type = TSDB_DATA_TYPE_DOUBLE; + return TSDB_CODE_SUCCESS; + case OP_TYPE_MULTI: + if (left.type == TSDB_DATA_TYPE_TIMESTAMP && right.type == TSDB_DATA_TYPE_TIMESTAMP) { + qError("invalid op %d, left type:%d, right type:%d", op, left.type, right.type); + return TSDB_CODE_TSC_INVALID_OPERATION; + } + case OP_TYPE_DIV: + if (left.type == TSDB_DATA_TYPE_TIMESTAMP && right.type == TSDB_DATA_TYPE_TIMESTAMP) { + qError("invalid op %d, left type:%d, right type:%d", op, left.type, right.type); + return TSDB_CODE_TSC_INVALID_OPERATION; + } + case OP_TYPE_REM: + case OP_TYPE_MINUS: + pRes->type = TSDB_DATA_TYPE_DOUBLE; + return TSDB_CODE_SUCCESS; + case OP_TYPE_GREATER_THAN: + case OP_TYPE_GREATER_EQUAL: + case OP_TYPE_LOWER_THAN: + case OP_TYPE_LOWER_EQUAL: + case OP_TYPE_EQUAL: + case OP_TYPE_NOT_EQUAL: + case OP_TYPE_IN: + case OP_TYPE_NOT_IN: + case OP_TYPE_LIKE: + case OP_TYPE_NOT_LIKE: + case OP_TYPE_MATCH: + case OP_TYPE_NMATCH: + case OP_TYPE_IS_NULL: + case OP_TYPE_IS_NOT_NULL: + case OP_TYPE_IS_TRUE: + case OP_TYPE_JSON_CONTAINS: + pRes->type = TSDB_DATA_TYPE_BOOL; + return TSDB_CODE_SUCCESS; + case OP_TYPE_BIT_AND: + case OP_TYPE_BIT_OR: + pRes->type = TSDB_DATA_TYPE_BIGINT; + return TSDB_CODE_SUCCESS; + case OP_TYPE_JSON_GET_VALUE: + pRes->type = TSDB_DATA_TYPE_JSON; + return TSDB_CODE_SUCCESS; + default: + ASSERT(0); + return TSDB_CODE_APP_ERROR; + } +} + + diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 6e4838e50c..1c2fe5255c 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -669,6 +669,11 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } + if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + SCH_TASK_ELOG("no execNode specifed for data src task, numOfEps:%d", pTask->plan->execNode.epSet.numOfEps); + SCH_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + SCH_ERR_RET(schSetAddrsFromNodeList(pJob, pTask)); /* From 630eebecd588eeb3006338d45cac6134d2ffc8f7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 17:50:35 +0800 Subject: [PATCH 40/63] enh: check available memory of dnode while creating db --- include/common/tmsg.h | 6 + include/util/taoserror.h | 11 +- include/util/tdef.h | 3 + source/common/src/tmsg.c | 20 ++- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 2 + source/dnode/mgmt/node_util/src/dmEps.c | 2 +- source/dnode/mnode/impl/inc/mndDef.h | 6 +- source/dnode/mnode/impl/inc/mndVgroup.h | 2 + source/dnode/mnode/impl/src/mndDb.c | 15 ++- source/dnode/mnode/impl/src/mndDnode.c | 9 +- source/dnode/mnode/impl/src/mndVgroup.c | 133 ++++++++++++++++---- source/libs/tfs/src/tfs.c | 2 +- source/util/src/terror.c | 1 + source/util/src/ttimer.c | 3 +- 14 files changed, 172 insertions(+), 43 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 454b940862..de9c11fb89 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -708,6 +708,7 @@ typedef struct { int32_t buffer; // MB int32_t pageSize; int32_t pages; + int32_t lastRowMem; int32_t daysPerFile; int32_t daysToKeep0; int32_t daysToKeep1; @@ -736,6 +737,7 @@ typedef struct { int32_t buffer; int32_t pageSize; int32_t pages; + int32_t lastRowMem; int32_t daysPerFile; int32_t daysToKeep0; int32_t daysToKeep1; @@ -1025,6 +1027,8 @@ typedef struct { int64_t updateTime; int32_t numOfCores; int32_t numOfSupportVnodes; + int64_t memTotal; + int64_t memAvail; char dnodeEp[TSDB_EP_LEN]; SMnodeLoad mload; SQnodeLoad qload; @@ -1079,6 +1083,7 @@ typedef struct { int32_t buffer; int32_t pageSize; int32_t pages; + int32_t lastRowMem; int32_t daysPerFile; int32_t daysToKeep0; int32_t daysToKeep1; @@ -1131,6 +1136,7 @@ typedef struct { int32_t buffer; int32_t pageSize; int32_t pages; + int32_t lastRowMem; int32_t daysPerFile; int32_t daysToKeep0; int32_t daysToKeep1; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 33313e0400..59b02ea4e4 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -173,11 +173,12 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341) #define TSDB_CODE_MND_TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x0342) #define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0343) -#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0344) -#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0345) -#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0346) -#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0347) -#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0348) +#define TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0344) +#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0345) +#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0346) +#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0347) +#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0348) +#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0349) // mnode-node #define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350) diff --git a/include/util/tdef.h b/include/util/tdef.h index 7c7413a421..84bc30b9e7 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -334,6 +334,9 @@ typedef enum ELogicConditionType { #define TSDB_MIN_DB_CACHE_LAST_ROW 0 #define TSDB_MAX_DB_CACHE_LAST_ROW 3 #define TSDB_DEFAULT_CACHE_LAST_ROW 0 +#define TSDB_MIN_DB_LAST_ROW_MEM 1 // MB +#define TSDB_MAX_DB_LAST_ROW_MEM 65536 +#define TSDB_DEFAULT_LAST_ROW_MEM 1 #define TSDB_DB_STREAM_MODE_OFF 0 #define TSDB_DB_STREAM_MODE_ON 1 #define TSDB_DEFAULT_DB_STREAM_MODE 0 diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index aaf1e5414c..22dd8d7de0 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -949,6 +949,8 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeI64(&encoder, pReq->updateTime) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfCores) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfSupportVnodes) < 0) return -1; + if (tEncodeI64(&encoder, pReq->memTotal) < 0) return -1; + if (tEncodeI64(&encoder, pReq->memAvail) < 0) return -1; if (tEncodeCStr(&encoder, pReq->dnodeEp) < 0) return -1; // cluster cfg @@ -1010,6 +1012,8 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->updateTime) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfCores) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfSupportVnodes) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->memTotal) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->memAvail) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->dnodeEp) < 0) return -1; // cluster cfg @@ -1974,6 +1978,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; @@ -2015,6 +2020,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->lastRowMem) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; @@ -2069,6 +2075,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; @@ -2094,6 +2101,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->lastRowMem) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; @@ -3586,6 +3594,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; @@ -3643,6 +3652,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->lastRowMem) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; @@ -3665,8 +3675,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * SReplica *pReplica = &pReq->replicas[i]; if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; } - - if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); if (pReq->pRetensions == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -3768,7 +3777,8 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; + if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; @@ -3782,7 +3792,6 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq SReplica *pReplica = &pReq->replicas[i]; if (tEncodeSReplica(&encoder, pReplica) < 0) return -1; } - tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3799,6 +3808,7 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->lastRowMem) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; @@ -3813,7 +3823,7 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR SReplica *pReplica = &pReq->replicas[i]; if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; } - + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 234a133243..59b442881a 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -67,6 +67,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { req.updateTime = pMgmt->pData->updateTime; req.numOfCores = tsNumOfCores; req.numOfSupportVnodes = tsNumOfSupportVnodes; + req.memTotal = tsTotalMemoryKB * 1024; + req.memAvail = req.memTotal - tsRpcQueueMemoryAllowed - 16 * 1024 * 1024; tstrncpy(req.dnodeEp, tsLocalEp, TSDB_EP_LEN); req.clusterCfg.statusInterval = tsStatusInterval; diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index 096fc753b2..7fe7d44827 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -280,7 +280,7 @@ static void dmPrintEps(SDnodeData *pData) { dDebug("print dnode list, num:%d", numOfEps); for (int32_t i = 0; i < numOfEps; i++) { SDnodeEp *pEp = taosArrayGet(pData->dnodeEps, i); - dDebug("dnode:%d, fqdn:%s port:%u is_mnode:%d", pEp->id, pEp->ep.fqdn, pEp->ep.port, pEp->isMnode); + dDebug("dnode:%d, fqdn:%s port:%u isMnode:%d", pEp->id, pEp->ep.fqdn, pEp->ep.port, pEp->isMnode); } } diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 21002f5f9c..ee0c5cedf3 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -149,6 +149,9 @@ typedef struct { int32_t numOfVnodes; int32_t numOfSupportVnodes; int32_t numOfCores; + int64_t memTotal; + int64_t memAvail; + int64_t memUsed; EDndReason offlineReason; uint16_t port; char fqdn[TSDB_FQDN_LEN]; @@ -243,6 +246,7 @@ typedef struct { int32_t buffer; int32_t pageSize; int32_t pages; + int32_t lastRowMem; int32_t daysPerFile; int32_t daysToKeep0; int32_t daysToKeep1; @@ -255,8 +259,8 @@ typedef struct { int8_t compression; int8_t replications; int8_t strict; - int8_t cacheLastRow; int8_t hashMethod; // default is 1 + int8_t cacheLastRow; int32_t numOfRetensions; SArray* pRetensions; int8_t schemaless; diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 6622b89b1d..c8237d17d8 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -30,6 +30,8 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup); SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup); int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId); void mndSortVnodeGid(SVgObj *pVgroup); +int64_t mndGetVnodesMemory(SMnode *pMnode, int32_t dnodeId); +int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup); SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId); int32_t mndAllocSmaVgroup(SMnode *, SDbObj *pDb, SVgObj *pVgroup); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 4f958de121..3bcd80a8b2 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -93,6 +93,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT32(pRaw, dataPos, pDb->cfg.buffer, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.pageSize, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.pages, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.lastRowMem, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysPerFile, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysToKeep0, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysToKeep1, _OVER) @@ -165,6 +166,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.buffer, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.pageSize, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.pages, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.lastRowMem, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysPerFile, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysToKeep0, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysToKeep1, _OVER) @@ -230,8 +232,9 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) { pOld->cfgVersion = pNew->cfgVersion; pOld->vgVersion = pNew->vgVersion; pOld->cfg.buffer = pNew->cfg.buffer; - pOld->cfg.pages = pNew->cfg.pages; pOld->cfg.pageSize = pNew->cfg.pageSize; + pOld->cfg.pages = pNew->cfg.pages; + pOld->cfg.lastRowMem = pNew->cfg.lastRowMem; pOld->cfg.daysPerFile = pNew->cfg.daysPerFile; pOld->cfg.daysToKeep0 = pNew->cfg.daysToKeep0; pOld->cfg.daysToKeep1 = pNew->cfg.daysToKeep1; @@ -288,6 +291,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->buffer < TSDB_MIN_BUFFER_PER_VNODE || pCfg->buffer > TSDB_MAX_BUFFER_PER_VNODE) return -1; if (pCfg->pageSize < TSDB_MIN_PAGESIZE_PER_VNODE || pCfg->pageSize > TSDB_MAX_PAGESIZE_PER_VNODE) return -1; if (pCfg->pages < TSDB_MIN_PAGES_PER_VNODE || pCfg->pages > TSDB_MAX_PAGES_PER_VNODE) return -1; + if (pCfg->lastRowMem < TSDB_MIN_DB_LAST_ROW_MEM || pCfg->lastRowMem > TSDB_MAX_DB_LAST_ROW_MEM) return -1; if (pCfg->daysPerFile < TSDB_MIN_DAYS_PER_FILE || pCfg->daysPerFile > TSDB_MAX_DAYS_PER_FILE) return -1; if (pCfg->daysToKeep0 < TSDB_MIN_KEEP || pCfg->daysToKeep0 > TSDB_MAX_KEEP) return -1; if (pCfg->daysToKeep1 < TSDB_MIN_KEEP || pCfg->daysToKeep1 > TSDB_MAX_KEEP) return -1; @@ -336,6 +340,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->replications < 0) pCfg->replications = TSDB_DEFAULT_DB_REPLICA; if (pCfg->strict < 0) pCfg->strict = TSDB_DEFAULT_DB_STRICT; if (pCfg->cacheLastRow < 0) pCfg->cacheLastRow = TSDB_DEFAULT_CACHE_LAST_ROW; + if (pCfg->lastRowMem <= 0) pCfg->lastRowMem = TSDB_DEFAULT_LAST_ROW_MEM; if (pCfg->numOfRetensions < 0) pCfg->numOfRetensions = 0; if (pCfg->schemaless < 0) pCfg->schemaless = TSDB_DB_SCHEMALESS_OFF; } @@ -434,6 +439,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, .buffer = pCreate->buffer, .pageSize = pCreate->pageSize, .pages = pCreate->pages, + .lastRowMem = pCreate->lastRowMem, .daysPerFile = pCreate->daysPerFile, .daysToKeep0 = pCreate->daysToKeep0, .daysToKeep1 = pCreate->daysToKeep1, @@ -475,7 +481,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, int32_t code = -1; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); if (pTrans == NULL) goto _OVER; - + // mndTransSetSerial(pTrans); mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db); mndTransSetDbName(pTrans, dbObj.name, NULL); @@ -622,6 +628,11 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) { terrno = 0; } + if (pAlter->lastRowMem >= 0 && pAlter->lastRowMem != pDb->cfg.lastRowMem) { + pDb->cfg.lastRowMem = pAlter->lastRowMem; + terrno = 0; + } + if (pAlter->replications > 0 && pAlter->replications != pDb->cfg.replications) { #if 1 terrno = TSDB_CODE_OPS_NOT_SUPPORT; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 8198445753..1073ebc316 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -15,8 +15,8 @@ #define _DEFAULT_SOURCE #include "mndDnode.h" -#include "mndPrivilege.h" #include "mndMnode.h" +#include "mndPrivilege.h" #include "mndQnode.h" #include "mndShow.h" #include "mndSnode.h" @@ -432,7 +432,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { } if (!online) { - mInfo("dnode:%d, from offline to online", pDnode->id); + mInfo("dnode:%d, from offline to online, memory avail:%" PRId64 " total:%" PRId64 " cores:%.2f", pDnode->id, + statusReq.memAvail, statusReq.memTotal, statusReq.numOfCores); } else { mDebug("dnode:%d, send dnode epset, online:%d dnodeVer:%" PRId64 ":%" PRId64 " reboot:%d", pDnode->id, online, statusReq.dnodeVer, dnodeVer, reboot); @@ -441,6 +442,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { pDnode->rebootTime = statusReq.rebootTime; pDnode->numOfCores = statusReq.numOfCores; pDnode->numOfSupportVnodes = statusReq.numOfSupportVnodes; + pDnode->memAvail = statusReq.memAvail; + pDnode->memTotal = statusReq.memTotal; SStatusRsp statusRsp = {0}; statusRsp.dnodeVer = dnodeVer; @@ -580,7 +583,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { strcpy(info.name, "timezone"); snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsTimezoneStr); taosArrayPush(rsp.variables, &info); - + strcpy(info.name, "locale"); snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsLocale); taosArrayPush(rsp.variables, &info); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index c53e831e84..3a3331a0b3 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -207,6 +207,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg createReq.buffer = pDb->cfg.buffer; createReq.pageSize = pDb->cfg.pageSize; createReq.pages = pDb->cfg.pages; + createReq.lastRowMem = pDb->cfg.lastRowMem; createReq.daysPerFile = pDb->cfg.daysPerFile; createReq.daysToKeep0 = pDb->cfg.daysToKeep0; createReq.daysToKeep1 = pDb->cfg.daysToKeep1; @@ -274,8 +275,9 @@ void *mndBuildAlterVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_ SAlterVnodeReq alterReq = {0}; alterReq.vgVersion = pVgroup->version; alterReq.buffer = pDb->cfg.buffer; - alterReq.pages = pDb->cfg.pages; alterReq.pageSize = pDb->cfg.pageSize; + alterReq.pages = pDb->cfg.pages; + alterReq.lastRowMem = pDb->cfg.lastRowMem; alterReq.daysPerFile = pDb->cfg.daysPerFile; alterReq.daysToKeep0 = pDb->cfg.daysToKeep0; alterReq.daysToKeep1 = pDb->cfg.daysToKeep1; @@ -392,9 +394,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 bool online = mndIsDnodeOnline(pDnode, curMs); bool isMnode = mndIsMnode(pMnode, pDnode->id); pDnode->numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id); + pDnode->memUsed = mndGetVnodesMemory(pMnode, pDnode->id); - mDebug("dnode:%d, vnodes:%d support_vnodes:%d is_mnode:%d online:%d", pDnode->id, pDnode->numOfVnodes, - pDnode->numOfSupportVnodes, isMnode, online); + mDebug("dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d memory avail:%" PRId64 " used:%" PRId64, pDnode->id, + pDnode->numOfVnodes, pDnode->numOfSupportVnodes, isMnode, online, pDnode->memAvail, pDnode->memUsed); if (isMnode) { pDnode->numOfVnodes++; @@ -426,15 +429,7 @@ 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) { @@ -447,7 +442,7 @@ void mndSortVnodeGid(SVgObj *pVgroup) { } } -static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) { +static int32_t mndGetAvailableDnode(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, SArray *pArray) { SSdb *pSdb = pMnode->pSdb; int32_t allocedVnodes = 0; void *pIter = NULL; @@ -470,6 +465,16 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr return -1; } + int64_t vgMem = mndGetVgroupMemory(pMnode, pDb, pVgroup); + if (pDnode->memAvail - vgMem - pDnode->memUsed <= 0) { + mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d, avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vgMem, pDnode->id, pDnode->memAvail, pDnode->memUsed); + terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE; + return -1; + } else { + pDnode->memUsed += vgMem; + } + pVgid->dnodeId = pDnode->id; if (pVgroup->replica == 1) { pVgid->role = TAOS_SYNC_STATE_LEADER; @@ -477,7 +482,8 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr pVgid->role = TAOS_SYNC_STATE_FOLLOWER; } - mInfo("db:%s, vgId:%d, vn:%d dnode:%d is alloced", pVgroup->dbName, pVgroup->vgId, v, pVgid->dnodeId); + mInfo("db:%s, vgId:%d, vn:%d is alloced, memory:%" PRId64 ", dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, v, vgMem, pVgid->dnodeId, pDnode->memAvail, pDnode->memUsed); pDnode->numOfVnodes++; } @@ -498,7 +504,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) { pVgroup->dbUid = pDb->uid; pVgroup->replica = 1; - if (mndGetAvailableDnode(pMnode, pVgroup, pArray) != 0) return -1; + if (mndGetAvailableDnode(pMnode, pDb, pVgroup, pArray) != 0) return -1; mInfo("db:%s, sma vgId:%d is alloced", pDb->name, pVgroup->vgId); return 0; @@ -546,8 +552,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) { pVgroup->dbUid = pDb->uid; pVgroup->replica = pDb->cfg.replications; - if (mndGetAvailableDnode(pMnode, pVgroup, pArray) != 0) { - terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; + if (mndGetAvailableDnode(pMnode, pDb, pVgroup, pArray) != 0) { goto _OVER; } @@ -728,6 +733,43 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) { return numOfVnodes; } +int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDbInput, SVgObj *pVgroup) { + SDbObj *pDb = pDbInput; + if (pDbInput == NULL) { + pDb = mndAcquireDb(pMnode, pVgroup->dbName); + } + + int64_t vgroupMemroy = (int64_t)pDb->cfg.buffer * 1024 * 1024 + (int64_t)pDb->cfg.pages * pDb->cfg.pageSize * 1024; + if (pDb->cfg.cacheLastRow > 0) { + vgroupMemroy += (int64_t)pDb->cfg.lastRowMem * 1024 * 1024; + } + + if (pDbInput == NULL) { + mndReleaseDb(pMnode, pDb); + } + return vgroupMemroy; +} + +static bool mndGetVnodeMemroyFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) { + SVgObj *pVgroup = pObj; + int32_t dnodeId = *(int32_t *)p1; + int64_t *pVnodeMemory = (int64_t *)p2; + + for (int32_t v = 0; v < pVgroup->replica; ++v) { + if (pVgroup->vnodeGid[v].dnodeId == dnodeId) { + *pVnodeMemory += mndGetVgroupMemory(pMnode, NULL, pVgroup); + } + } + + return true; +} + +int64_t mndGetVnodesMemory(SMnode *pMnode, int32_t dnodeId) { + int64_t vnodeMemory = 0; + sdbTraverse(pMnode->pSdb, SDB_VGROUP, mndGetVnodeMemroyFp, &dnodeId, &vnodeMemory, NULL); + return vnodeMemory; +} + static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -807,9 +849,20 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) { return -1; } + int64_t vgMem = mndGetVgroupMemory(pMnode, NULL, pVgroup); + if (pDnode->memAvail - vgMem - pDnode->memUsed <= 0) { + mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vgMem, pDnode->id, pDnode->memAvail, pDnode->memUsed); + terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE; + return -1; + } else { + pDnode->memUsed += vgMem; + } + pVgid->dnodeId = pDnode->id; pVgid->role = TAOS_SYNC_STATE_ERROR; - mInfo("db:%s, vgId:%d, vn:%d dnode:%d, is added", pVgroup->dbName, pVgroup->vgId, pVgroup->replica, pVgid->dnodeId); + mInfo("db:%s, vgId:%d, vn:%d is added, memory:%" PRId64 ", dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, pVgroup->replica, vgMem, pVgid->dnodeId, pDnode->memAvail, pDnode->memUsed); pVgroup->replica++; pDnode->numOfVnodes++; @@ -835,7 +888,10 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray for (int32_t vn = 0; vn < pVgroup->replica; ++vn) { SVnodeGid *pVgid = &pVgroup->vnodeGid[vn]; if (pVgid->dnodeId == pDnode->id) { - mInfo("db:%s, vgId:%d, vn:%d dnode:%d, is removed", pVgroup->dbName, pVgroup->vgId, vn, pVgid->dnodeId); + int64_t vgMem = mndGetVgroupMemory(pMnode, NULL, pVgroup); + pDnode->memUsed -= vgMem; + mInfo("db:%s, vgId:%d, vn:%d is removed, memory:%" PRId64 ", dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vn, vgMem, pVgid->dnodeId, pDnode->memAvail, pDnode->memUsed); pDnode->numOfVnodes--; pVgroup->replica--; *pDelVgid = *pVgid; @@ -1161,6 +1217,17 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; goto _OVER; } + + int64_t vgMem = mndGetVgroupMemory(pMnode, NULL, pVgroup); + if (pNew1->memAvail - vgMem - pNew1->memUsed <= 0) { + mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vgMem, pNew1->id, pNew1->memAvail, pNew1->memUsed); + terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE; + return -1; + } else { + pNew1->memUsed += vgMem; + } + if (mndAddIncVgroupReplicaToTrans(pMnode, pTrans, pDb, &newVg, pNew1->id) != 0) goto _OVER; if (mndAddDecVgroupReplicaFromTrans(pMnode, pTrans, pDb, &newVg, pOld1->id) != 0) goto _OVER; } @@ -1173,6 +1240,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; goto _OVER; } + int64_t vgMem = mndGetVgroupMemory(pMnode, NULL, pVgroup); + if (pNew2->memAvail - vgMem - pNew2->memUsed <= 0) { + mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vgMem, pNew2->id, pNew2->memAvail, pNew2->memUsed); + terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE; + return -1; + } else { + pNew2->memUsed += vgMem; + } if (mndAddIncVgroupReplicaToTrans(pMnode, pTrans, pDb, &newVg, pNew2->id) != 0) goto _OVER; if (mndAddDecVgroupReplicaFromTrans(pMnode, pTrans, pDb, &newVg, pOld2->id) != 0) goto _OVER; } @@ -1185,6 +1261,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; goto _OVER; } + int64_t vgMem = mndGetVgroupMemory(pMnode, NULL, pVgroup); + if (pNew3->memAvail - vgMem - pNew3->memUsed <= 0) { + mError("db:%s, vgId:%d, no enough memory:%" PRId64 " in dnode:%d avail:%" PRId64 " used:%" PRId64, + pVgroup->dbName, pVgroup->vgId, vgMem, pNew3->id, pNew3->memAvail, pNew3->memUsed); + terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE; + return -1; + } else { + pNew3->memUsed += vgMem; + } if (mndAddIncVgroupReplicaToTrans(pMnode, pTrans, pDb, &newVg, pNew3->id) != 0) goto _OVER; if (mndAddDecVgroupReplicaFromTrans(pMnode, pTrans, pDb, &newVg, pOld3->id) != 0) goto _OVER; } @@ -1415,7 +1500,7 @@ _OVER: mndReleaseDb(pMnode, pDb); return code; -#endif +#endif } int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SArray *pArray) { @@ -1654,9 +1739,9 @@ static int32_t mndBalanceVgroupBetweenDnode(SMnode *pMnode, STrans *pTrans, SDno } static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) { - int32_t code = -1; - int32_t numOfVgroups = 0; - STrans *pTrans = NULL; + int32_t code = -1; + int32_t numOfVgroups = 0; + STrans *pTrans = NULL; SHashObj *pBalancedVgroups = NULL; pBalancedVgroups = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); @@ -1721,7 +1806,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; SArray *pArray = NULL; - void *pIter = NULL; + void *pIter = NULL; int64_t curMs = taosGetTimestampMs(); SBalanceVgroupReq req = {0}; @@ -1766,7 +1851,7 @@ _OVER: taosArrayDestroy(pArray); return code; -#endif +#endif } bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; } \ No newline at end of file diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 2d3d41de64..62aec219df 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -291,7 +291,7 @@ int32_t tfsRmdir(STfs *pTfs, const char *rname) { for (int32_t id = 0; id < pTier->ndisk; id++) { STfsDisk *pDisk = pTier->disks[id]; snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); - uInfo("====> tfs remove dir : path:%s aname:%s rname:[%s]", pDisk->path, aname, rname); + uInfo("tfs remove dir : path:%s aname:%s rname:[%s]", pDisk->path, aname, rname); taosRemoveDir(aname); } } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 564751ad67..d53324f737 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -177,6 +177,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ALREADY_EXIST, "Dnode already exists" TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, "Dnode does not exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DNODES, "Too many dnodes") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_DNODES, "Out of dnodes") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE, "No enough memory in dnode") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CLUSTER_CFG, "Cluster cfg inconsistent") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CLUSTER_ID, "Cluster id not match") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_CFG, "Invalid dnode cfg") diff --git a/source/util/src/ttimer.c b/source/util/src/ttimer.c index 36b9437b66..7256331c85 100644 --- a/source/util/src/ttimer.c +++ b/source/util/src/ttimer.c @@ -18,6 +18,7 @@ #include "taoserror.h" #include "tlog.h" #include "tsched.h" +#include "tdef.h" #define tmrFatal(...) \ { \ @@ -110,7 +111,7 @@ typedef struct time_wheel_t { tmr_obj_t** slots; } time_wheel_t; -static int32_t tsMaxTmrCtrl = 512; +static int32_t tsMaxTmrCtrl = TSDB_MAX_VNODES_PER_DB + 100; static TdThreadOnce tmrModuleInit = PTHREAD_ONCE_INIT; static TdThreadMutex tmrCtrlMutex; From 3cc215bdcc0dfd28497a568be76d1a4bba4f3489 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 17:54:00 +0800 Subject: [PATCH 41/63] fix: crash while write wal in multi-threaded way --- source/libs/wal/src/walWrite.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 9245c03826..27f12259bc 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -332,21 +332,25 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog terrno = TSDB_CODE_WAL_SIZE_LIMIT; return -1; } + taosThreadMutexLock(&pWal->mutex); if (index == pWal->vers.lastVer + 1) { if (taosArrayGetSize(pWal->fileInfoSet) == 0) { pWal->vers.firstVer = index; if (walRoll(pWal) < 0) { + taosThreadMutexUnlock(&pWal->mutex); return -1; } } else { int64_t passed = walGetSeq() - pWal->lastRollSeq; if (pWal->cfg.rollPeriod != -1 && pWal->cfg.rollPeriod != 0 && passed > pWal->cfg.rollPeriod) { if (walRoll(pWal) < 0) { + taosThreadMutexUnlock(&pWal->mutex); return -1; } } else if (pWal->cfg.segSize != -1 && pWal->cfg.segSize != 0 && walGetLastFileSize(pWal) > pWal->cfg.segSize) { if (walRoll(pWal) < 0) { + taosThreadMutexUnlock(&pWal->mutex); return -1; } } @@ -355,6 +359,7 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog // reject skip log or rewrite log // must truncate explicitly first terrno = TSDB_CODE_WAL_INVALID_VER; + taosThreadMutexUnlock(&pWal->mutex); return -1; } @@ -362,8 +367,6 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog ASSERT(pWal->writeCur >= 0); - taosThreadMutexLock(&pWal->mutex); - if (pWal->pWriteIdxTFile == NULL || pWal->pWriteLogTFile == NULL) { walSetWrite(pWal); taosLSeekFile(pWal->pWriteLogTFile, 0, SEEK_END); From 6e98552ecabc303d4f84b1ee18d6c5259af8a765 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 4 Jul 2022 17:54:49 +0800 Subject: [PATCH 42/63] fix(query): fix timetruncate/timediff local variable overwrite issue TD-17032 --- source/libs/scalar/src/sclfunc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index f35f81892d..8f90e78c8c 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1196,6 +1196,8 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); + timeUnit = timeUnit * 1000 / factor; + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { if (colDataIsNull_s(pInput[0].columnData, i)) { colDataAppendNULL(pOutput->columnData, i); @@ -1228,7 +1230,6 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara char buf[20] = {0}; NUM_TO_STRING(TSDB_DATA_TYPE_BIGINT, &timeVal, sizeof(buf), buf); int32_t tsDigits = (int32_t)strlen(buf); - timeUnit = timeUnit * 1000 / factor; switch (timeUnit) { case 0: { /* 1u */ @@ -1384,6 +1385,11 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); } + int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : + (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); + + timeUnit = timeUnit * 1000 / factor; + int32_t numOfRows = 0; for (int32_t i = 0; i < inputNum; ++i) { if (pInput[i].numOfRows > numOfRows) { @@ -1463,9 +1469,6 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p } } } else { - int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : - (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); - timeUnit = timeUnit * 1000 / factor; switch(timeUnit) { case 0: { /* 1u */ result = result / 1000; From eae44cd9df6b32262aa8f4b0d91300d5ae32808b Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 4 Jul 2022 18:10:40 +0800 Subject: [PATCH 43/63] refactor(sync): add error code sync-timeout --- source/libs/transport/inc/transComm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 8db619270c..3cb3df26d4 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -96,7 +96,7 @@ typedef void* queue[2]; #define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field)))) #define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit -#define TRANS_RETRY_INTERVAL 30 // ms retry interval +#define TRANS_RETRY_INTERVAL 15 // ms retry interval #define TRANS_CONN_TIMEOUT 3 // connect timeout typedef SRpcMsg STransMsg; From 07fa747429854710b72cdfb4932063f3e80eb484 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 18:30:10 +0800 Subject: [PATCH 44/63] fix: valgrind error --- include/common/tmsg.h | 2 +- source/common/src/tmsg.c | 4 ++-- source/dnode/mnode/impl/inc/mndDef.h | 2 +- source/dnode/mnode/impl/src/mndDb.c | 2 +- source/libs/parser/src/parTranslater.c | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index de9c11fb89..00b220da57 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1025,7 +1025,7 @@ typedef struct { int64_t clusterId; int64_t rebootTime; int64_t updateTime; - int32_t numOfCores; + float numOfCores; int32_t numOfSupportVnodes; int64_t memTotal; int64_t memAvail; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 22dd8d7de0..c07a7d2141 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -947,7 +947,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeI64(&encoder, pReq->clusterId) < 0) return -1; if (tEncodeI64(&encoder, pReq->rebootTime) < 0) return -1; if (tEncodeI64(&encoder, pReq->updateTime) < 0) return -1; - if (tEncodeI32(&encoder, pReq->numOfCores) < 0) return -1; + if (tEncodeFloat(&encoder, pReq->numOfCores) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfSupportVnodes) < 0) return -1; if (tEncodeI64(&encoder, pReq->memTotal) < 0) return -1; if (tEncodeI64(&encoder, pReq->memAvail) < 0) return -1; @@ -1010,7 +1010,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->clusterId) < 0) return -1; if (tDecodeI64(&decoder, &pReq->rebootTime) < 0) return -1; if (tDecodeI64(&decoder, &pReq->updateTime) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->numOfCores) < 0) return -1; + if (tDecodeFloat(&decoder, &pReq->numOfCores) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfSupportVnodes) < 0) return -1; if (tDecodeI64(&decoder, &pReq->memTotal) < 0) return -1; if (tDecodeI64(&decoder, &pReq->memAvail) < 0) return -1; diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index ee0c5cedf3..f39a848992 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -148,7 +148,7 @@ typedef struct { int32_t accessTimes; int32_t numOfVnodes; int32_t numOfSupportVnodes; - int32_t numOfCores; + float numOfCores; int64_t memTotal; int64_t memAvail; int64_t memUsed; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3bcd80a8b2..6770cd578a 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -628,7 +628,7 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) { terrno = 0; } - if (pAlter->lastRowMem >= 0 && pAlter->lastRowMem != pDb->cfg.lastRowMem) { + if (pAlter->lastRowMem > 0 && pAlter->lastRowMem != pDb->cfg.lastRowMem) { pDb->cfg.lastRowMem = pAlter->lastRowMem; terrno = 0; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5651412566..63d0932b3d 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3138,6 +3138,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, pReq->buffer = pStmt->pOptions->buffer; pReq->pageSize = -1; pReq->pages = pStmt->pOptions->pages; + pReq->lastRowMem = -1; pReq->daysPerFile = -1; pReq->daysToKeep0 = pStmt->pOptions->keep[0]; pReq->daysToKeep1 = pStmt->pOptions->keep[1]; From f213212faf8cfb5e9ff90d77020f10a1660b0ede Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Jul 2022 18:57:06 +0800 Subject: [PATCH 45/63] fix compile error --- source/libs/transport/src/transComm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 3be0c7b72d..5f6e3db615 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -480,10 +480,6 @@ bool transEpSetIsEqual(SEpSet* a, SEpSet* b) { } return true; } -static int32_t transGetRefMgt() { - // - return refMgt; -} static void transInitEnv() { refMgt = transOpenRefMgt(50000, transDestoryExHandle); @@ -517,11 +513,11 @@ void transCloseRefMgt(int32_t mgt) { } int64_t transAddExHandle(int32_t refMgt, void* p) { // acquire extern handle - return taosAddRef(transGetRefMgt(), p); + return taosAddRef(refMgt, p); } int32_t transRemoveExHandle(int32_t refMgt, int64_t refId) { // acquire extern handle - return taosRemoveRef(transGetRefMgt(), refId); + return taosRemoveRef(refMgt, refId); } void* transAcquireExHandle(int32_t refMgt, int64_t refId) { @@ -531,7 +527,7 @@ void* transAcquireExHandle(int32_t refMgt, int64_t refId) { int32_t transReleaseExHandle(int32_t refMgt, int64_t refId) { // release extern handle - return taosReleaseRef(transGetRefMgt(), refId); + return taosReleaseRef(refMgt, refId); } void transDestoryExHandle(void* handle) { if (handle == NULL) { From 63e3529e0f23512d657de9469b3a135b0b298f07 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 19:03:10 +0800 Subject: [PATCH 46/63] fix: system memory not set in ut --- source/common/src/tmsg.c | 8 ++++---- source/dnode/mgmt/test/sut/src/sut.cpp | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c07a7d2141..7bbc0e362b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3675,7 +3675,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * SReplica *pReplica = &pReq->replicas[i]; if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; } - if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); if (pReq->pRetensions == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -3777,8 +3777,8 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; - if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->lastRowMem) < 0) return -1; + if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; @@ -3823,7 +3823,7 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR SReplica *pReplica = &pReq->replicas[i]; if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; } - + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index 21d9351ceb..a5e6128800 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -30,12 +30,14 @@ void Testbase::InitLog(const char* path) { tsdbDebugFlag = 0; tsLogEmbedded = 1; tsAsyncLog = 0; - tsRpcQueueMemoryAllowed = 1024 * 1024 * 64; - + taosRemoveDir(path); taosMkDir(path); tstrncpy(tsLogDir, path, PATH_MAX); - if (taosInitLog("taosdlog", 1) != 0) { + + taosGetSystemInfo(); + tsRpcQueueMemoryAllowed = tsTotalMemoryKB * 0.1; +if (taosInitLog("taosdlog", 1) != 0) { printf("failed to init log file\n"); } } From 83cbc4108825541f18416db5fa222cd9311036bf Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 4 Jul 2022 19:12:21 +0800 Subject: [PATCH 47/63] fix: fix explain crash issue --- source/libs/command/src/explain.c | 30 ++++++++++++++++++--------- source/libs/planner/src/planSpliter.c | 6 +++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index a811af4457..fde53b7064 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -403,8 +403,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pTagScanNode->pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTagScanNode->pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + if (pTagScanNode->pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTagScanNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pTagScanNode->node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); EXPLAIN_ROW_END(); @@ -442,8 +444,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pTblScanNode->scan.pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTblScanNode->scan.pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + if (pTblScanNode->scan.pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pTblScanNode->scan.pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pTblScanNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_TABLE_SCAN_FORMAT, pTblScanNode->scanSeq[0], pTblScanNode->scanSeq[1]); @@ -545,8 +549,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pSTblScanNode->scan.pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pSTblScanNode->scan.pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + if (pSTblScanNode->scan.pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pSTblScanNode->scan.pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pSTblScanNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); @@ -1172,8 +1178,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pDistScanNode->pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pDistScanNode->pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + if (pDistScanNode->pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pDistScanNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pDistScanNode->node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); @@ -1209,8 +1217,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pLastRowNode->pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pLastRowNode->pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + if (pLastRowNode->pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pLastRowNode->pScanPseudoCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 60c04c2c30..ebe6cb385e 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1014,14 +1014,14 @@ static int32_t unionMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) { return TSDB_CODE_SUCCESS; } -static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode) { +static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode, ESubplanType subplanType) { SLogicSubplan* pSubplan = (SLogicSubplan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); if (NULL == pSubplan) { return NULL; } pSubplan->id.queryId = pCxt->queryId; pSubplan->id.groupId = pCxt->groupId; - pSubplan->subplanType = SUBPLAN_TYPE_SCAN; + pSubplan->subplanType = subplanType; pSubplan->pNode = pNode; pNode->pParent = NULL; return pSubplan; @@ -1035,7 +1035,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl SNode* pChild = NULL; FOREACH(pChild, pSplitNode->pChildren) { - SLogicSubplan* pNewSubplan = unionCreateSubplan(pCxt, (SLogicNode*)pChild); + SLogicSubplan* pNewSubplan = unionCreateSubplan(pCxt, (SLogicNode*)pChild, pUnionSubplan->subplanType); code = nodesListMakeStrictAppend(&pUnionSubplan->pChildren, (SNode*)pNewSubplan); if (TSDB_CODE_SUCCESS == code) { REPLACE_NODE(NULL); From ac34cde0af3ee14ac7eb053d59947a0bd03386cd Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 19:27:27 +0800 Subject: [PATCH 48/63] fix: increase the validity check of the rollup parameter in the create table statement --- source/common/src/tmsg.c | 10 +-- source/libs/parser/src/parTranslater.c | 64 +++++++++++++---- source/libs/parser/test/mockCatalog.cpp | 69 ++++++++++--------- .../libs/parser/test/mockCatalogService.cpp | 28 ++++++++ source/libs/parser/test/mockCatalogService.h | 2 + source/libs/parser/test/parInitialATest.cpp | 4 +- source/libs/parser/test/parInitialCTest.cpp | 48 +++++++------ 7 files changed, 152 insertions(+), 73 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index aaf1e5414c..f886562e4b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2679,10 +2679,12 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->cacheLastRow) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1; - pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); - if (pRsp->pRetensions == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; + if (pRsp->numOfRetensions > 0) { + pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); + if (pRsp->pRetensions == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } } for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 302359f185..c443d14e55 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3215,13 +3215,30 @@ static bool validRollupFunc(const char* pFunc) { return false; } -static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs) { +static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs, bool createStable, + SDbCfgInfo* pDbCfg) { if (NULL == pFuncs) { + if (NULL != pDbCfg->pRetensions) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, + "To create a super table in a database with the retensions parameter configured, " + "the 'ROLLUP' option must be present"); + } return TSDB_CODE_SUCCESS; } - if (1 != LIST_LENGTH(pFuncs) || !validRollupFunc(((SFunctionNode*)nodesListGetNode(pFuncs, 0))->functionName)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION); + if (!createStable || NULL == pDbCfg->pRetensions) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, + "Invalid option rollup: Only supported for create super table in databases " + "configured with the 'RETENTIONS' option"); + } + if (1 != LIST_LENGTH(pFuncs)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION, + "Invalid option rollup: only one function is allowed"); + } + const char* pFunc = ((SFunctionNode*)nodesListGetNode(pFuncs, 0))->functionName; + if (!validRollupFunc(pFunc)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION, + "Invalid option rollup: %s function is not supported", pFunc); } return TSDB_CODE_SUCCESS; } @@ -3358,11 +3375,18 @@ static int32_t getTableMaxDelayOption(STranslateContext* pCxt, SValueNode* pVal, pMaxDelay); } -static int32_t checkTableMaxDelayOption(STranslateContext* pCxt, STableOptions* pOptions) { +static int32_t checkTableMaxDelayOption(STranslateContext* pCxt, STableOptions* pOptions, bool createStable, + SDbCfgInfo* pDbCfg) { if (NULL == pOptions->pMaxDelay) { return TSDB_CODE_SUCCESS; } + if (!createStable || NULL == pDbCfg->pRetensions) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, + "Invalid option maxdelay: Only supported for create super table in databases " + "configured with the 'RETENTIONS' option"); + } + if (LIST_LENGTH(pOptions->pMaxDelay) > 2) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "maxdelay"); } @@ -3381,11 +3405,18 @@ static int32_t getTableWatermarkOption(STranslateContext* pCxt, SValueNode* pVal pMaxDelay); } -static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions* pOptions) { +static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions* pOptions, bool createStable, + SDbCfgInfo* pDbCfg) { if (NULL == pOptions->pWatermark) { return TSDB_CODE_SUCCESS; } + if (!createStable || NULL == pDbCfg->pRetensions) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, + "Invalid option watermark: Only supported for create super table in databases " + "configured with the 'RETENTIONS' option"); + } + if (LIST_LENGTH(pOptions->pWatermark) > 2) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "watermark"); } @@ -3399,13 +3430,20 @@ static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions* return code; } -static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { - int32_t code = checkTableMaxDelayOption(pCxt, pStmt->pOptions); - if (TSDB_CODE_SUCCESS == code) { - code = checkTableWatermarkOption(pCxt, pStmt->pOptions); +static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt, bool createStable) { + int32_t code = TSDB_CODE_SUCCESS; + SDbCfgInfo dbCfg = {0}; + if (createStable) { + code = getDBCfg(pCxt, pStmt->dbName, &dbCfg); } if (TSDB_CODE_SUCCESS == code) { - code = checkTableRollupOption(pCxt, pStmt->pOptions->pRollupFuncs); + code = checkTableMaxDelayOption(pCxt, pStmt->pOptions, createStable, &dbCfg); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTableWatermarkOption(pCxt, pStmt->pOptions, createStable, &dbCfg); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTableRollupOption(pCxt, pStmt->pOptions->pRollupFuncs, createStable, &dbCfg); } if (TSDB_CODE_SUCCESS == code) { code = checkTableSmaOption(pCxt, pStmt); @@ -3684,7 +3722,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { SMCreateStbReq createReq = {0}; - int32_t code = checkCreateTable(pCxt, pStmt); + int32_t code = checkCreateTable(pCxt, pStmt, true); if (TSDB_CODE_SUCCESS == code) { code = buildCreateStbReq(pCxt, pStmt, &createReq); } @@ -4267,7 +4305,7 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); - if (QUERY_NODE_FUNCTION == nodeType(pProj) && FUNCTION_TYPE_WSTARTTS == ((SFunctionNode*)pProj)->funcType) { + if (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstartts", ((SFunctionNode*)pProj)->functionName)) { return TSDB_CODE_SUCCESS; } SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); @@ -5258,7 +5296,7 @@ static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { SCreateTableStmt* pStmt = (SCreateTableStmt*)pQuery->pRoot; - int32_t code = checkCreateTable(pCxt, pStmt); + int32_t code = checkCreateTable(pCxt, pStmt, false); SVgroupInfo info = {0}; if (TSDB_CODE_SUCCESS == code) { code = getTableHashVgroup(pCxt, pStmt->dbName, pStmt->tableName, &info); diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 36a2eb3808..6eafa0555b 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -159,7 +159,7 @@ void generatePerformanceSchema(MockCatalogService* mcs) { * c4 | column | DOUBLE | 8 | * c5 | column | DOUBLE | 8 | */ -void generateTestT1(MockCatalogService* mcs) { +void generateTestTables(MockCatalogService* mcs) { ITableBuilder& builder = mcs->createTableBuilder("test", "t1", TSDB_NORMAL_TABLE, 6) .setPrecision(TSDB_TIME_PRECISION_MILLI) .setVgid(1) @@ -183,23 +183,7 @@ void generateTestT1(MockCatalogService* mcs) { * tag2 | tag | VARCHAR | 20 | * tag3 | tag | TIMESTAMP | 8 | * Child Table: st1s1, st1s2 - */ -void generateTestST1(MockCatalogService* mcs) { - ITableBuilder& builder = mcs->createTableBuilder("test", "st1", TSDB_SUPER_TABLE, 3, 3) - .setPrecision(TSDB_TIME_PRECISION_MILLI) - .addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) - .addColumn("c1", TSDB_DATA_TYPE_INT) - .addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) - .addTag("tag1", TSDB_DATA_TYPE_INT) - .addTag("tag2", TSDB_DATA_TYPE_BINARY, 20) - .addTag("tag3", TSDB_DATA_TYPE_TIMESTAMP); - builder.done(); - mcs->createSubTable("test", "st1", "st1s1", 1); - mcs->createSubTable("test", "st1", "st1s2", 2); - mcs->createSubTable("test", "st1", "st1s3", 1); -} - -/* + * * Super Table: st2 * Field | Type | DataType | Bytes | * ========================================================================== @@ -209,16 +193,32 @@ void generateTestST1(MockCatalogService* mcs) { * jtag | tag | json | -- | * Child Table: st2s1, st2s2 */ -void generateTestST2(MockCatalogService* mcs) { - ITableBuilder& builder = mcs->createTableBuilder("test", "st2", TSDB_SUPER_TABLE, 3, 1) - .setPrecision(TSDB_TIME_PRECISION_MILLI) - .addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) - .addColumn("c1", TSDB_DATA_TYPE_INT) - .addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) - .addTag("jtag", TSDB_DATA_TYPE_JSON); - builder.done(); - mcs->createSubTable("test", "st2", "st2s1", 1); - mcs->createSubTable("test", "st2", "st2s2", 2); +void generateTestStables(MockCatalogService* mcs) { + { + ITableBuilder& builder = mcs->createTableBuilder("test", "st1", TSDB_SUPER_TABLE, 3, 3) + .setPrecision(TSDB_TIME_PRECISION_MILLI) + .addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) + .addColumn("c1", TSDB_DATA_TYPE_INT) + .addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) + .addTag("tag1", TSDB_DATA_TYPE_INT) + .addTag("tag2", TSDB_DATA_TYPE_BINARY, 20) + .addTag("tag3", TSDB_DATA_TYPE_TIMESTAMP); + builder.done(); + mcs->createSubTable("test", "st1", "st1s1", 1); + mcs->createSubTable("test", "st1", "st1s2", 2); + mcs->createSubTable("test", "st1", "st1s3", 1); + } + { + ITableBuilder& builder = mcs->createTableBuilder("test", "st2", TSDB_SUPER_TABLE, 3, 1) + .setPrecision(TSDB_TIME_PRECISION_MILLI) + .addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) + .addColumn("c1", TSDB_DATA_TYPE_INT) + .addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) + .addTag("jtag", TSDB_DATA_TYPE_JSON); + builder.done(); + mcs->createSubTable("test", "st2", "st2s1", 1); + mcs->createSubTable("test", "st2", "st2s2", 2); + } } void generateFunctions(MockCatalogService* mcs) { @@ -233,6 +233,11 @@ void generateDnodes(MockCatalogService* mcs) { mcs->createDnode(3, "host3", 7030); } +void generateDatabases(MockCatalogService* mcs) { + mcs->createDatabase("test"); + mcs->createDatabase("rollup_db", true); +} + } // namespace int32_t __catalogGetHandle(const char* clusterId, struct SCatalog** catalogHandle) { return 0; } @@ -262,7 +267,7 @@ int32_t __catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char } int32_t __catalogGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* dbFName, SDbCfgInfo* pDbCfg) { - return 0; + return g_mockCatalogService->catalogGetDBCfg(dbFName, pDbCfg); } int32_t __catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, @@ -359,11 +364,11 @@ void initMetaDataEnv() { } void generateMetaData() { + generateDatabases(g_mockCatalogService.get()); generateInformationSchema(g_mockCatalogService.get()); generatePerformanceSchema(g_mockCatalogService.get()); - generateTestT1(g_mockCatalogService.get()); - generateTestST1(g_mockCatalogService.get()); - generateTestST2(g_mockCatalogService.get()); + generateTestTables(g_mockCatalogService.get()); + generateTestStables(g_mockCatalogService.get()); generateFunctions(g_mockCatalogService.get()); generateDnodes(g_mockCatalogService.get()); g_mockCatalogService->showTables(); diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 8830bc7cb3..0f759018d9 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -140,6 +140,17 @@ class MockCatalogServiceImpl { return TSDB_CODE_SUCCESS; } + int32_t catalogGetDBCfg(const char* pDbFName, SDbCfgInfo* pDbCfg) const { + std::string dbFName(pDbFName); + DbCfgCache::const_iterator it = dbCfg_.find(dbFName.substr(std::string(pDbFName).find_last_of('.') + 1)); + if (dbCfg_.end() == it) { + return TSDB_CODE_FAILED; + } + + memcpy(pDbCfg, &(it->second), sizeof(SDbCfgInfo)); + return TSDB_CODE_SUCCESS; + } + int32_t catalogGetUdfInfo(const std::string& funcName, SFuncInfo* pInfo) const { auto it = udf_.find(funcName); if (udf_.end() == it) { @@ -323,12 +334,21 @@ class MockCatalogServiceImpl { dnode_.insert(std::make_pair(dnodeId, epSet)); } + void createDatabase(const std::string& db, bool rollup) { + SDbCfgInfo cfg = {0}; + if (rollup) { + cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention)); + } + dbCfg_.insert(std::make_pair(db, cfg)); + } + private: typedef std::map> TableMetaCache; typedef std::map DbMetaCache; typedef std::map> UdfMetaCache; typedef std::map> IndexMetaCache; typedef std::map DnodeCache; + typedef std::map DbCfgCache; uint64_t getNextId() { return id_++; } @@ -486,6 +506,7 @@ class MockCatalogServiceImpl { for (int32_t i = 0; i < ndbs; ++i) { SMetaRes res = {0}; res.pRes = taosMemoryCalloc(1, sizeof(SDbCfgInfo)); + res.code = catalogGetDBCfg((const char*)taosArrayGet(pDbCfgReq, i), (SDbCfgInfo*)res.pRes); taosArrayPush(*pDbCfgData, &res); } } @@ -576,6 +597,7 @@ class MockCatalogServiceImpl { UdfMetaCache udf_; IndexMetaCache index_; DnodeCache dnode_; + DbCfgCache dbCfg_; }; MockCatalogService::MockCatalogService() : impl_(new MockCatalogServiceImpl()) {} @@ -605,6 +627,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const std::string& host, i impl_->createDnode(dnodeId, host, port); } +void MockCatalogService::createDatabase(const std::string& db, bool rollup) { impl_->createDatabase(db, rollup); } + int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const { return impl_->catalogGetTableMeta(pTableName, pTableMeta); } @@ -621,6 +645,10 @@ int32_t MockCatalogService::catalogGetDBVgInfo(const char* pDbFName, SArray** pV return impl_->catalogGetDBVgInfo(pDbFName, pVgList); } +int32_t MockCatalogService::catalogGetDBCfg(const char* pDbFName, SDbCfgInfo* pDbCfg) const { + return impl_->catalogGetDBCfg(pDbFName, pDbCfg); +} + int32_t MockCatalogService::catalogGetUdfInfo(const std::string& funcName, SFuncInfo* pInfo) const { return impl_->catalogGetUdfInfo(funcName, pInfo); } diff --git a/source/libs/parser/test/mockCatalogService.h b/source/libs/parser/test/mockCatalogService.h index 932424823c..5c8a8acad1 100644 --- a/source/libs/parser/test/mockCatalogService.h +++ b/source/libs/parser/test/mockCatalogService.h @@ -63,11 +63,13 @@ class MockCatalogService { void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize); void createSmaIndex(const SMCreateSmaReq* pReq); void createDnode(int32_t dnodeId, const std::string& host, int16_t port); + void createDatabase(const std::string& db, bool rollup = false); int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const; int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo) const; int32_t catalogGetTableDistVgInfo(const SName* pTableName, SArray** pVgList) const; int32_t catalogGetDBVgInfo(const char* pDbFName, SArray** pVgList) const; + int32_t catalogGetDBCfg(const char* pDbFName, SDbCfgInfo* pDbCfg) const; int32_t catalogGetUdfInfo(const std::string& funcName, SFuncInfo* pInfo) const; int32_t catalogGetTableIndex(const SName* pTableName, SArray** pIndexes) const; int32_t catalogGetDnodeList(SArray** pDnodes) const; diff --git a/source/libs/parser/test/parInitialATest.cpp b/source/libs/parser/test/parInitialATest.cpp index 9148f8f28d..f4d0ba1cc8 100644 --- a/source/libs/parser/test/parInitialATest.cpp +++ b/source/libs/parser/test/parInitialATest.cpp @@ -38,9 +38,9 @@ TEST_F(ParserInitialATest, alterDnode) { TEST_F(ParserInitialATest, alterDatabase) { useDb("root", "test"); - run("ALTER DATABASE wxy_db CACHELAST 1 FSYNC 200 WAL 1"); + run("ALTER DATABASE test CACHELAST 1 FSYNC 200 WAL 1"); - run("ALTER DATABASE wxy_db KEEP 2400"); + run("ALTER DATABASE test KEEP 2400"); } TEST_F(ParserInitialATest, alterLocal) { diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 0a980fa889..74fea075de 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -359,11 +359,11 @@ TEST_F(ParserInitialCTest, createStable) { memset(&expect, 0, sizeof(SMCreateStbReq)); }; - auto setCreateStbReqFunc = [&](const char* pTbname, int8_t igExists = 0, int64_t delay1 = -1, int64_t delay2 = -1, - int64_t watermark1 = TSDB_DEFAULT_ROLLUP_WATERMARK, + auto setCreateStbReqFunc = [&](const char* pDbName, const char* pTbName, int8_t igExists = 0, int64_t delay1 = -1, + int64_t delay2 = -1, int64_t watermark1 = TSDB_DEFAULT_ROLLUP_WATERMARK, int64_t watermark2 = TSDB_DEFAULT_ROLLUP_WATERMARK, int32_t ttl = TSDB_DEFAULT_TABLE_TTL, const char* pComment = nullptr) { - int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname); + int32_t len = snprintf(expect.name, sizeof(expect.name), "0.%s.%s", pDbName, pTbName); expect.name[len] = '\0'; expect.igExists = igExists; expect.delay1 = delay1; @@ -454,14 +454,14 @@ TEST_F(ParserInitialCTest, createStable) { tFreeSMCreateStbReq(&req); }); - setCreateStbReqFunc("t1"); + setCreateStbReqFunc("test", "t1"); addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP); addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT); addFieldToCreateStbReqFunc(false, "id", TSDB_DATA_TYPE_INT); run("CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"); clearCreateStbReq(); - setCreateStbReqFunc("t1", 1, 100 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_MINUTE, 10, + setCreateStbReqFunc("rollup_db", "t1", 1, 100 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_MINUTE, 10, 1 * MILLISECOND_PER_MINUTE, 100, "test create table"); addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP, 0, 0); addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT); @@ -493,7 +493,7 @@ TEST_F(ParserInitialCTest, createStable) { addFieldToCreateStbReqFunc(false, "a13", TSDB_DATA_TYPE_BOOL); addFieldToCreateStbReqFunc(false, "a14", TSDB_DATA_TYPE_NCHAR, 30 * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); addFieldToCreateStbReqFunc(false, "a15", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE); - run("CREATE STABLE IF NOT EXISTS test.t1(" + run("CREATE STABLE IF NOT EXISTS rollup_db.t1(" "ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), " "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, " "c13 NCHAR(30), c14 VARCHAR(50)) " @@ -507,12 +507,13 @@ TEST_F(ParserInitialCTest, createStable) { TEST_F(ParserInitialCTest, createStableSemanticCheck) { useDb("root", "test"); - run("CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(CEIL)", TSDB_CODE_PAR_INVALID_ROLLUP_OPTION); + run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(CEIL)", + TSDB_CODE_PAR_INVALID_ROLLUP_OPTION); - run("CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 0s WATERMARK 1m", + run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 0s WATERMARK 1m", TSDB_CODE_PAR_INVALID_RANGE_OPTION); - run("CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 10s WATERMARK 18m", + run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 10s WATERMARK 18m", TSDB_CODE_PAR_INVALID_RANGE_OPTION); } @@ -561,30 +562,33 @@ TEST_F(ParserInitialCTest, createStream) { tFreeSCMCreateStreamReq(&req); }); - setCreateStreamReqFunc("s1", "test", "create stream s1 as select * from t1"); - run("CREATE STREAM s1 AS SELECT * FROM t1"); + setCreateStreamReqFunc("s1", "test", "create stream s1 as select count(*) from t1 interval(10s)"); + run("CREATE STREAM s1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); - setCreateStreamReqFunc("s1", "test", "create stream if not exists s1 as select * from t1", nullptr, 1); - run("CREATE STREAM IF NOT EXISTS s1 AS SELECT * FROM t1"); + setCreateStreamReqFunc("s1", "test", "create stream if not exists s1 as select count(*) from t1 interval(10s)", + nullptr, 1); + run("CREATE STREAM IF NOT EXISTS s1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); - setCreateStreamReqFunc("s1", "test", "create stream s1 into st1 as select * from t1", "st1"); - run("CREATE STREAM s1 INTO st1 AS SELECT * FROM t1"); + setCreateStreamReqFunc("s1", "test", "create stream s1 into st1 as select count(*) from t1 interval(10s)", "st1"); + run("CREATE STREAM s1 INTO st1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); - setCreateStreamReqFunc( - "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"); + setCreateStreamReqFunc("s1", "test", + "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 " + "as select count(*) from t1 interval(10s)", + "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 COUNT(*) " + "FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); } TEST_F(ParserInitialCTest, createStreamSemanticCheck) { useDb("root", "test"); - run("CREATE STREAM s1 AS SELECT PERCENTILE(c1, 30) FROM t1", TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC); + run("CREATE STREAM s1 AS SELECT PERCENTILE(c1, 30) FROM t1 INTERVAL(10S)", TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC); } TEST_F(ParserInitialCTest, createTable) { @@ -598,7 +602,7 @@ TEST_F(ParserInitialCTest, createTable) { "c13 NCHAR(30), c15 VARCHAR(50)) " "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)"); - run("CREATE TABLE IF NOT EXISTS test.t1(" + run("CREATE TABLE IF NOT EXISTS rollup_db.t1(" "ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), " "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, " "c13 NCHAR(30), c14 VARCHAR(50)) " From 86573eda58aa7873c704a11675031a3a870f2519 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 4 Jul 2022 19:48:45 +0800 Subject: [PATCH 49/63] chore: update taos tools for3.0 (#14518) * chore(release): make get_os.sh works on mac * chore(tools): update taos-tools * chore: update taos-tools for 3.0 [TD-16450] --- tools/taos-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/taos-tools b/tools/taos-tools index 7105027650..1163c0f60a 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit 7105027650b51e701cfa1dac11b8fb42d447dd01 +Subproject commit 1163c0f60aa65d6cc58283247c8bf8c56ba43b92 From 0feee09804b80e477bffedfe068ec4b3ba72929b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 20:13:39 +0800 Subject: [PATCH 50/63] test: cases with 100 dnodes --- tests/script/sh/deploy.sh | 4 +-- tests/script/sh/stop_dnodes.sh | 2 +- tests/script/tmp/prepare.sim | 58 +++++++++++++++------------------- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index d54624872f..1deea26337 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -121,7 +121,7 @@ echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG echo "fqdn ${HOSTNAME}" >> $TAOS_CFG echo "serverPort ${NODE}" >> $TAOS_CFG -echo "supportVnodes 128" >> $TAOS_CFG +echo "supportVnodes 1024" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG @@ -135,7 +135,7 @@ echo "jniDebugFlag 143" >> $TAOS_CFG echo "qDebugFlag 143" >> $TAOS_CFG echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "uDebugFlag 131" >> $TAOS_CFG +echo "uDebugFlag 143" >> $TAOS_CFG echo "sDebugFlag 143" >> $TAOS_CFG echo "wDebugFlag 143" >> $TAOS_CFG echo "numOfLogLines 20000000" >> $TAOS_CFG diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index b431c0627c..d30c75022a 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -14,7 +14,7 @@ while [ -n "$PID" ]; do echo kill -9 $PID #pkill -9 taosd kill -9 $PID - echo "Killing processes locking on port 6030" + echo "Killing taosd processes" if [ "$OS_TYPE" != "Darwin" ]; then fuser -k -n tcp 6030 else diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index 3b43656a41..d0276a2a02 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -7,39 +7,33 @@ system sh/deploy.sh -n dnode4 -i 4 return -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/deploy.sh -n dnode9 -i 9 system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -system sh/exec.sh -n dnode5 -s start -system sh/exec.sh -n dnode6 -s start -system sh/exec.sh -n dnode7 -s start -system sh/exec.sh -n dnode8 -s start -system sh/exec.sh -n dnode9 -s start +sql connect -sleep 2000 +$num = 200 +$i = 0 +while $i < $num + $port = $i + 8000 + $i = $i + 1 + sql create dnode $hostname port $port +endw -sql create dnode $hostname port 7200 -sql create dnode $hostname port 7300 -sql create dnode $hostname port 7400 -sql create dnode $hostname port 7500 -sql create dnode $hostname port 7600 -sql create dnode $hostname port 7700 -sql create dnode $hostname port 7800 -sql create dnode $hostname port 7900 +$i = 0 +while $i < $num + $port = $i + 8000 + $i = $i + 1 + $name = dnode . $port + system sh/deploy.sh -n $name -i 1 + system sh/cfg.sh -n $name -c serverPort -v $port + system sh/exec.sh -n $name -s start +endw -sql show dnodes; -print $data00 $data01 -print $data10 $data11 -print $data20 $data21 -print $data30 $data31 -print $data40 $data41 \ No newline at end of file +return + +create database db vgroups 1024 buffer 3; +use db; +create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); +create table ct1 using stb tags(1000); +create table ct2 using stb tags(1000) ; +show db.tables; +insert into ct1 values(now+0s, 10, 2.0, 3.0); \ No newline at end of file From b6613b5cf27dcf85d1312dd6eed8680f72f53166 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 4 Jul 2022 20:26:31 +0800 Subject: [PATCH 51/63] test: add rsma persistence and recovery case --- source/dnode/vnode/src/sma/smaCommit.c | 12 +- tests/script/jenkins/basic.txt | 1 + .../tsim/sma/rsmaPersistenceRecovery.sim | 237 ++++++++++++++++++ 3 files changed, 244 insertions(+), 6 deletions(-) create mode 100644 tests/script/tsim/sma/rsmaPersistenceRecovery.sim diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c index 30299e8792..6e75176136 100644 --- a/source/dnode/vnode/src/sma/smaCommit.c +++ b/source/dnode/vnode/src/sma/smaCommit.c @@ -83,8 +83,8 @@ int32_t smaBegin(SSma *pSma) { /** * @brief pre-commit for rollup sma. * 1) set trigger stat of rsma timer TASK_TRIGGER_STAT_PAUSED. - * 2) perform persist task for qTaskInfo - * 3) wait all triggered fetch tasks finished + * 2) wait all triggered fetch tasks finished + * 3) perform persist task for qTaskInfo * * @param pSma * @return int32_t @@ -102,10 +102,7 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) { // step 1: set persistence task paused atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_PAUSED); - // step 2: perform persist task for qTaskInfo - tdRSmaPersistExecImpl(pRSmaStat); - - // step 3: wait all triggered fetch tasks finished + // step 2: wait all triggered fetch tasks finished int32_t nLoops = 0; while (1) { if (T_REF_VAL_GET(pStat) == 0) { @@ -121,6 +118,9 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) { } } + // step 3: perform persist task for qTaskInfo + tdRSmaPersistExecImpl(pRSmaStat); + smaDebug("vgId:%d, rsma pre commit succeess", SMA_VID(pSma)); return TSDB_CODE_SUCCESS; diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 2b33067381..cbcc2d86ef 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -164,6 +164,7 @@ ./test.sh -f tsim/sma/drop_sma.sim ./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim ./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim +./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim # --- valgrind ./test.sh -f tsim/valgrind/checkError.sim -v diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim new file mode 100644 index 0000000000..4c3f9a7308 --- /dev/null +++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim @@ -0,0 +1,237 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print =============== create database with retentions +sql create database d0 retentions 5s:7d,5m:21d,15m:365d; +sql use d0 + +print =============== create super table and register rsma +sql create table if not exists stb (ts timestamp, c1 int, c2 float) tags (city binary(20),district binary(20)) rollup(max) max_delay 5s,5s watermark 2s,3s; + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +sql create table ct1 using stb tags("BeiJing", "ChaoYang"); + +sql show tables +if $rows != 1 then + return -1 +endi + +print =============== insert data and trigger rollup +sql insert into ct1 values(now, 10, 10.0); +sql insert into ct1 values(now+1s, 1, 1.0); +sql insert into ct1 values(now+2s, 100, 100.0); + +print =============== wait maxdelay 5+1 seconds for results +sleep 6000 + +print =============== select * from retention level 2 from memory +sql select * from ct1; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 2 file rows $rows > 2 + return -1 +endi + + +if $data01 != 100 then + if $data01 != 10 then + print retention level 2 file result $data01 != 100 or 10 + return -1 + endi +endi + +print =============== select * from retention level 1 from memory +sql select * from ct1 where ts > now-8d; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 1 file rows $rows > 2 + return -1 +endi + +if $data01 != 100 then + if $data01 != 10 then + print retention level 1 file result $data01 != 100 or 10 + return -1 + endi +endi + +print =============== select * from retention level 0 from memory +sql select * from ct1 where ts > now-3d; +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows < 1 then + print retention level 0 file rows $rows < 1 + return -1 +endi + +if $data01 != 10 then + print retention level 0 file result $data01 != 10 + return -1 +endi + +#=================================================================== + + +#==================== reboot to trigger commit data to file +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +print =============== select * from retention level 2 from file +sql select * from ct1; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 2 file rows $rows > 2 + return -1 +endi + +if $data01 != 100 then + if $data01 != 10 then + print retention level 2 file result $data01 != 100 or 10 + return -1 + endi +endi + +print =============== select * from retention level 1 from file +sql select * from ct1 where ts > now-8d; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 1 file rows $rows > 2 + return -1 +endi + +if $data01 != 100 then + if $data01 != 10 then + print retention level 1 file result $data01 != 100 or 10 + return -1 + endi +endi + +print =============== select * from retention level 0 from file +sql select * from ct1 where ts > now-3d; +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +if $rows < 1 then + print retention level 0 file rows $rows < 1 + return -1 +endi + +if $data01 != 10 then + print retention level 0 file result $data01 != 10 + return -1 +endi + +print =============== insert after rsma qtaskinfo recovery +sql insert into ct1 values(now, 50, 500.0); +sql insert into ct1 values(now+1s, 40, 40.0); + +print =============== wait maxdelay 5+1 seconds for results +sleep 6000 + +print =============== select * from retention level 2 from file and memory after rsma qtaskinfo recovery +sql select * from ct1; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 2 file/mem rows $rows > 2 + return -1 +endi + +if $data01 != 100 then + if $data01 != 10 then + print retention level 2 file/mem result $data01 != 100 or 10 + return -1 + endi +endi + +if $data02 != 500.00000 then + if $data01 != 100.00000 then + print retention level 1 file/mem result $data01 != 500.00000 or 100.00000 + return -1 + endi +endi + +print =============== select * from retention level 1 from file and memory after rsma qtaskinfo recovery +sql select * from ct1 where ts > now-8d; +print $data00 $data01 $data02 +if $rows > 2 then + print retention level 1 file/mem rows $rows > 2 + return -1 +endi + +if $data01 != 100 then + if $data01 != 10 then + print retention level 1 file/mem result $data01 != 100 or 10 + return -1 + endi +endi + +if $data02 != 500.00000 then + if $data01 != 100.00000 then + print retention level 1 file/mem result $data01 != 500.00000 or 100.00000 + return -1 + endi +endi + + +print =============== select * from retention level 0 from file and memory after rsma qtaskinfo recovery +sql select * from ct1 where ts > now-3d; +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows < 1 then + print retention level 0 file/mem rows $rows < 1 + return -1 +endi + +if $data01 != 10 then + print retention level 0 file/mem result $data01 != 10 + return -1 +endi + +if $data11 != 1 then + print retention level 0 file/mem result $data11 != 1 + return -1 +endi + +if $data21 != 100 then + print retention level 0 file/mem result $data21 != 100 + return -1 +endi + +if $data31 != 50 then + print retention level 0 file/mem result $data31 != 50 + return -1 +endi + +if $data32 != 500.00000 then + print retention level 0 file/mem result $data32 != 500.00000 + return -1 +endi + + +if $data41 != 40 then + print retention level 0 file/mem result $data41 != 40 + return -1 +endi + +if $data41 != 40 then + print retention level 0 file/mem result $data41 != 40 + return -1 +endi + + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 57dae9fcda61e7d2db6fb49d44c2bbd60f0bc9d9 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 20:29:19 +0800 Subject: [PATCH 52/63] fix: increase the tag value overflow check when creating table --- source/libs/parser/src/parTranslater.c | 259 ++++++++++++++----------- 1 file changed, 148 insertions(+), 111 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c443d14e55..f506d25316 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -784,12 +784,144 @@ static int32_t parseBoolFromValueNode(STranslateContext* pCxt, SValueNode* pVal) } } -static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SDataType targetDt) { - uint8_t precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, targetDt.precision); - pVal->node.resType.precision = precision; +static EDealRes translateDurationValue(STranslateContext* pCxt, SValueNode* pVal) { + if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, + pVal->node.resType.precision) != TSDB_CODE_SUCCESS) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int64_t*)&pVal->typeData = pVal->datum.i; + return DEAL_RES_CONTINUE; +} + +static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, SDataType targetDt, bool strict) { + int32_t code = TSDB_CODE_SUCCESS; + switch (targetDt.type) { + case TSDB_DATA_TYPE_BOOL: + if (TSDB_CODE_SUCCESS != parseBoolFromValueNode(pCxt, pVal)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(bool*)&pVal->typeData = pVal->datum.b; + break; + case TSDB_DATA_TYPE_TINYINT: { + code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_TINYINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int8_t*)&pVal->typeData = pVal->datum.i; + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_SMALLINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int16_t*)&pVal->typeData = pVal->datum.i; + break; + } + case TSDB_DATA_TYPE_INT: { + code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_INT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int32_t*)&pVal->typeData = pVal->datum.i; + break; + } + case TSDB_DATA_TYPE_BIGINT: { + code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_BIGINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int64_t*)&pVal->typeData = pVal->datum.i; + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UTINYINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(uint8_t*)&pVal->typeData = pVal->datum.u; + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_USMALLINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(uint16_t*)&pVal->typeData = pVal->datum.u; + break; + } + case TSDB_DATA_TYPE_UINT: { + code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(uint32_t*)&pVal->typeData = pVal->datum.u; + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UBIGINT(pVal->datum.i))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(uint64_t*)&pVal->typeData = pVal->datum.u; + break; + } + case TSDB_DATA_TYPE_FLOAT: { + pVal->datum.d = taosStr2Double(pVal->literal, NULL); + *(float*)&pVal->typeData = pVal->datum.d; + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + pVal->datum.d = taosStr2Double(pVal->literal, NULL); + *(double*)&pVal->typeData = pVal->datum.d; + break; + } + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: { + pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); + if (NULL == pVal->datum.p) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + } + int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, pVal->node.resType.bytes); + varDataSetLen(pVal->datum.p, len); + strncpy(varDataVal(pVal->datum.p), pVal->literal, len); + break; + } + case TSDB_DATA_TYPE_TIMESTAMP: { + if (TSDB_CODE_SUCCESS != parseTimeFromValueNode(pCxt, pVal)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + *(int64_t*)&pVal->typeData = pVal->datum.i; + break; + } + case TSDB_DATA_TYPE_NCHAR: { + pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); + if (NULL == pVal->datum.p) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + } + + int32_t len = 0; + if (!taosMbsToUcs4(pVal->literal, strlen(pVal->literal), (TdUcs4*)varDataVal(pVal->datum.p), + targetDt.bytes - VARSTR_HEADER_SIZE, &len)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + varDataSetLen(pVal->datum.p, len); + break; + } + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + default: + break; + } + return DEAL_RES_CONTINUE; +} + +static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SDataType targetDt, bool strict) { if (pVal->placeholderNo > 0 || pVal->isNull) { return DEAL_RES_CONTINUE; } + if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { // TODO // pVal->node.resType = targetDt; @@ -797,114 +929,18 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD 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) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - } - *(int64_t*)&pVal->typeData = pVal->datum.i; - } else { - switch (targetDt.type) { - case TSDB_DATA_TYPE_NULL: - break; - case TSDB_DATA_TYPE_BOOL: - if (TSDB_CODE_SUCCESS != parseBoolFromValueNode(pCxt, pVal)) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - } - *(bool*)&pVal->typeData = pVal->datum.b; - break; - case TSDB_DATA_TYPE_TINYINT: { - pVal->datum.i = taosStr2Int64(pVal->literal, NULL, 10); - *(int8_t*)&pVal->typeData = pVal->datum.i; - break; - } - case TSDB_DATA_TYPE_SMALLINT: { - pVal->datum.i = taosStr2Int64(pVal->literal, NULL, 10); - *(int16_t*)&pVal->typeData = pVal->datum.i; - break; - } - case TSDB_DATA_TYPE_INT: { - pVal->datum.i = taosStr2Int64(pVal->literal, NULL, 10); - *(int32_t*)&pVal->typeData = pVal->datum.i; - break; - } - case TSDB_DATA_TYPE_BIGINT: { - pVal->datum.i = taosStr2Int64(pVal->literal, NULL, 10); - *(int64_t*)&pVal->typeData = pVal->datum.i; - break; - } - case TSDB_DATA_TYPE_UTINYINT: { - pVal->datum.u = taosStr2UInt64(pVal->literal, NULL, 10); - *(uint8_t*)&pVal->typeData = pVal->datum.u; - break; - } - case TSDB_DATA_TYPE_USMALLINT: { - pVal->datum.u = taosStr2UInt64(pVal->literal, NULL, 10); - *(uint16_t*)&pVal->typeData = pVal->datum.u; - break; - } - case TSDB_DATA_TYPE_UINT: { - pVal->datum.u = taosStr2UInt64(pVal->literal, NULL, 10); - *(uint32_t*)&pVal->typeData = pVal->datum.u; - break; - } - case TSDB_DATA_TYPE_UBIGINT: { - pVal->datum.u = taosStr2UInt64(pVal->literal, NULL, 10); - *(uint64_t*)&pVal->typeData = pVal->datum.u; - break; - } - case TSDB_DATA_TYPE_FLOAT: { - pVal->datum.d = taosStr2Double(pVal->literal, NULL); - *(float*)&pVal->typeData = pVal->datum.d; - break; - } - case TSDB_DATA_TYPE_DOUBLE: { - pVal->datum.d = taosStr2Double(pVal->literal, NULL); - *(double*)&pVal->typeData = pVal->datum.d; - break; - } - case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { - pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); - if (NULL == pVal->datum.p) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); - } - int32_t len = TMIN(targetDt.bytes - VARSTR_HEADER_SIZE, pVal->node.resType.bytes); - varDataSetLen(pVal->datum.p, len); - strncpy(varDataVal(pVal->datum.p), pVal->literal, len); - break; - } - case TSDB_DATA_TYPE_TIMESTAMP: { - if (TSDB_CODE_SUCCESS != parseTimeFromValueNode(pCxt, pVal)) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - } - *(int64_t*)&pVal->typeData = pVal->datum.i; - break; - } - case TSDB_DATA_TYPE_NCHAR: { - pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); - if (NULL == pVal->datum.p) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); - } - int32_t len = 0; - if (!taosMbsToUcs4(pVal->literal, strlen(pVal->literal), (TdUcs4*)varDataVal(pVal->datum.p), - targetDt.bytes - VARSTR_HEADER_SIZE, &len)) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - } - varDataSetLen(pVal->datum.p, len); - break; - } - case TSDB_DATA_TYPE_DECIMAL: - case TSDB_DATA_TYPE_BLOB: - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - default: - break; - } + pVal->node.resType.precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, targetDt.precision); + + EDealRes res = DEAL_RES_CONTINUE; + if (pVal->isDuration) { + res = translateDurationValue(pCxt, pVal); + } else { + res = translateNormalValue(pCxt, pVal, targetDt, strict); } pVal->node.resType = targetDt; pVal->translate = true; - return DEAL_RES_CONTINUE; + return res; } static int32_t calcTypeBytes(SDataType dt) { @@ -920,7 +956,7 @@ static int32_t calcTypeBytes(SDataType dt) { static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { SDataType dt = pVal->node.resType; dt.bytes = calcTypeBytes(dt); - return translateValueImpl(pCxt, pVal, dt); + return translateValueImpl(pCxt, pVal, dt, false); } static bool isMultiResFunc(SNode* pNode) { @@ -4305,7 +4341,8 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); - if (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstartts", ((SFunctionNode*)pProj)->functionName)) { + if (NULL == pSelect->pWindow || + (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstartts", ((SFunctionNode*)pProj)->functionName))) { return TSDB_CODE_SUCCESS; } SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); @@ -5400,7 +5437,7 @@ static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt, if (NULL == *pVal) { return TSDB_CODE_OUT_OF_MEMORY; } - return DEAL_RES_ERROR == translateValueImpl(pCxt, *pVal, targetDt) ? pCxt->errCode : TSDB_CODE_SUCCESS; + return DEAL_RES_ERROR == translateValueImpl(pCxt, *pVal, targetDt, true) ? pCxt->errCode : TSDB_CODE_SUCCESS; } static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode, @@ -5784,7 +5821,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS } SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); - if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt)) { + if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt, true)) { return pCxt->errCode; } From 0b183585a016b622afc12603d9f97946e922f4b8 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 4 Jul 2022 20:29:25 +0800 Subject: [PATCH 53/63] test: test case adapation for rsma recovery --- tests/script/tsim/sma/rsmaPersistenceRecovery.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim index 4c3f9a7308..ba23532184 100644 --- a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim +++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim @@ -227,8 +227,8 @@ if $data41 != 40 then return -1 endi -if $data41 != 40 then - print retention level 0 file/mem result $data41 != 40 +if $data42 != 40.00000 then + print retention level 0 file/mem result $data42 != 40.00000 return -1 endi From 4bd126813851f7394a638901238f21b6ac2f212a Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 4 Jul 2022 20:34:37 +0800 Subject: [PATCH 54/63] test: test case adapation for rsma recovery --- tests/script/tsim/sma/rsmaPersistenceRecovery.sim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim index ba23532184..1b54e5a47d 100644 --- a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim +++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim @@ -154,8 +154,8 @@ if $data01 != 100 then endi if $data02 != 500.00000 then - if $data01 != 100.00000 then - print retention level 1 file/mem result $data01 != 500.00000 or 100.00000 + if $data02 != 100.00000 then + print retention level 1 file/mem result $data02 != 500.00000 or 100.00000 return -1 endi endi @@ -176,8 +176,8 @@ if $data01 != 100 then endi if $data02 != 500.00000 then - if $data01 != 100.00000 then - print retention level 1 file/mem result $data01 != 500.00000 or 100.00000 + if $data02 != 100.00000 then + print retention level 1 file/mem result $data02 != 500.00000 or 100.00000 return -1 endi endi From 505b0f1f45a667ba8f87d11c8e5c72a30eda104a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Jul 2022 20:36:45 +0800 Subject: [PATCH 55/63] test: case for valgrind --- tests/script/tmp/prepare.sim | 14 +++++++------- tests/script/tsim/valgrind/basic.sim | 29 ++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index d0276a2a02..2e16ee7bda 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -30,10 +30,10 @@ endw return -create database db vgroups 1024 buffer 3; -use db; -create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); -create table ct1 using stb tags(1000); -create table ct2 using stb tags(1000) ; -show db.tables; -insert into ct1 values(now+0s, 10, 2.0, 3.0); \ No newline at end of file +sql create database db vgroups 1024 buffer 3; +sql use db; +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); +sql create table ct1 using stb tags(1000); +sql create table ct2 using stb tags(1000) ; +sql show db.tables; +sql insert into ct1 values(now+0s, 10, 2.0, 3.0); \ No newline at end of file diff --git a/tests/script/tsim/valgrind/basic.sim b/tests/script/tsim/valgrind/basic.sim index 0f11ae0313..b449527568 100644 --- a/tests/script/tsim/valgrind/basic.sim +++ b/tests/script/tsim/valgrind/basic.sim @@ -1,8 +1,33 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode1 -s start -v sql connect -sql create database d0 vgroups 1; +print =============== step1: create drop show dnodes +$x = 0 +step1: + $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 +if $rows != 1 then + return -1 +endi +goto _OVER + +print =============== step2: create alter drop show user +sql create user u1 pass 'taosdata' +sql show users +sql alter user u1 sysinfo 1 +sql alter user u1 enable 1 +sql alter user u1 pass 'taosdata' +sql alter user u2 sysinfo 0 +sql drop user u1 + +_OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT From 8127887dc448fbc48c8c161cb6284b6cfb6baa2a Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 4 Jul 2022 20:47:56 +0800 Subject: [PATCH 56/63] fix(tmq): prepare scan should reset operator status --- source/libs/executor/src/executorimpl.c | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 20e507b040..25b61e15c3 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2843,11 +2843,18 @@ 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; + + pOperator->status = OP_OPENED; + if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { SStreamBlockScanInfo* pScanInfo = pOperator->info; pScanInfo->blockType = STREAM_INPUT__DATA_SCAN; + pScanInfo->pSnapshotReadOp->status = OP_OPENED; + STableScanInfo* pInfo = pScanInfo->pSnapshotReadOp->info; + ASSERT(pInfo->scanMode == TABLE_SCAN__TABLE_ORDER); + if (uid == 0) { pInfo->noTable = 1; return TSDB_CODE_SUCCESS; @@ -2861,14 +2868,6 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { 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 + 1; - tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); - pInfo->cond.twindows[0].skey = oldSkey; - pInfo->scanTimes = 0; - pInfo->curTWinIdx = 0; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList); @@ -2880,8 +2879,17 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { pInfo->currentTable = i; } } - // TODO after processing drop, + // TODO after processing drop, found can be false ASSERT(found); + + tsdbSetTableId(pInfo->dataReader, uid); + int64_t oldSkey = pInfo->cond.twindows[0].skey; + 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; + qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts, pInfo->currentTable, tableSz); } From 7c5419b43e26e766561f73b0243eb4dd319da36b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 4 Jul 2022 21:12:15 +0800 Subject: [PATCH 57/63] fix: fix: increase the tag value overflow check when creating table --- source/libs/parser/src/parTranslater.c | 10 +++++----- source/libs/parser/test/parInitialCTest.cpp | 15 +++++++++++++++ tests/system-test/2-query/abs.py | 2 +- .../2-query/distribute_agg_apercentile.py | 2 +- tests/system-test/2-query/distribute_agg_avg.py | 2 +- tests/system-test/2-query/distribute_agg_count.py | 2 +- tests/system-test/2-query/distribute_agg_max.py | 2 +- tests/system-test/2-query/distribute_agg_min.py | 2 +- .../system-test/2-query/distribute_agg_spread.py | 2 +- .../system-test/2-query/distribute_agg_stddev.py | 2 +- tests/system-test/2-query/distribute_agg_sum.py | 2 +- tests/system-test/2-query/function_null.py | 2 +- tests/system-test/2-query/irate.py | 2 +- tests/system-test/2-query/max.py | 2 +- tests/system-test/2-query/twa.py | 2 +- 15 files changed, 33 insertions(+), 18 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f506d25316..4c6d357636 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3300,8 +3300,8 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); } if (TSDB_CODE_SUCCESS == code) { - if ((TSDB_DATA_TYPE_VARCHAR == pTag->dataType.type && pTag->dataType.bytes > TSDB_MAX_BINARY_LEN) || - (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && pTag->dataType.bytes > TSDB_MAX_NCHAR_LEN)) { + if ((TSDB_DATA_TYPE_VARCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_NCHAR_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } } @@ -3322,11 +3322,11 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN return code; } -static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, SNodeList* pCols) { +static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, int32_t ntags, SNodeList* pCols) { int32_t ncols = LIST_LENGTH(pCols); if (ncols < TSDB_MIN_COLUMNS) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); - } else if (ncols > TSDB_MAX_COLUMNS) { + } else if (ncols + ntags > TSDB_MAX_COLUMNS) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TOO_MANY_COLUMNS); } @@ -3382,7 +3382,7 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt int32_t code = checkTableTagsSchema(pCxt, pHash, pStmt->pTags); if (TSDB_CODE_SUCCESS == code) { - code = checkTableColsSchema(pCxt, pHash, pStmt->pCols); + code = checkTableColsSchema(pCxt, pHash, LIST_LENGTH(pStmt->pTags), pStmt->pCols); } taosHashCleanup(pHash); diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 74fea075de..10921a2082 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -621,6 +621,21 @@ TEST_F(ParserInitialCTest, createTable) { // run("CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy', NOW + 1S)"); } +TEST_F(ParserInitialCTest, createTableSemanticCheck) { + useDb("root", "test"); + + string sql = "CREATE TABLE st1(ts TIMESTAMP, "; + for (int32_t i = 1; i < 4096; ++i) { + if (i > 1) { + sql.append(", "); + } + sql.append("c" + to_string(i) + " INT"); + } + sql.append(") TAGS (t1 int)"); + + run(sql, TSDB_CODE_PAR_TOO_MANY_COLUMNS); +} + TEST_F(ParserInitialCTest, createTopic) { useDb("root", "test"); diff --git a/tests/system-test/2-query/abs.py b/tests/system-test/2-query/abs.py index 961a6446b5..90a1b8f343 100644 --- a/tests/system-test/2-query/abs.py +++ b/tests/system-test/2-query/abs.py @@ -139,7 +139,7 @@ class TDTestCase: ) for i in range(4): tdSql.execute( - f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_apercentile.py b/tests/system-test/2-query/distribute_agg_apercentile.py index fd1455ce16..022d13c5ae 100644 --- a/tests/system-test/2-query/distribute_agg_apercentile.py +++ b/tests/system-test/2-query/distribute_agg_apercentile.py @@ -36,7 +36,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_avg.py b/tests/system-test/2-query/distribute_agg_avg.py index 647a262558..c690a17b4a 100644 --- a/tests/system-test/2-query/distribute_agg_avg.py +++ b/tests/system-test/2-query/distribute_agg_avg.py @@ -53,7 +53,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_count.py b/tests/system-test/2-query/distribute_agg_count.py index 2ac9c86df0..b3638dac4b 100644 --- a/tests/system-test/2-query/distribute_agg_count.py +++ b/tests/system-test/2-query/distribute_agg_count.py @@ -55,7 +55,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_max.py b/tests/system-test/2-query/distribute_agg_max.py index 5c9760cbcf..0924ea16ac 100644 --- a/tests/system-test/2-query/distribute_agg_max.py +++ b/tests/system-test/2-query/distribute_agg_max.py @@ -55,7 +55,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_min.py b/tests/system-test/2-query/distribute_agg_min.py index dd20d88229..8d077fd59b 100644 --- a/tests/system-test/2-query/distribute_agg_min.py +++ b/tests/system-test/2-query/distribute_agg_min.py @@ -55,7 +55,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_spread.py b/tests/system-test/2-query/distribute_agg_spread.py index 94f1a61d77..c91fd1d30b 100644 --- a/tests/system-test/2-query/distribute_agg_spread.py +++ b/tests/system-test/2-query/distribute_agg_spread.py @@ -55,7 +55,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_stddev.py b/tests/system-test/2-query/distribute_agg_stddev.py index 5050e6e940..59ede38983 100644 --- a/tests/system-test/2-query/distribute_agg_stddev.py +++ b/tests/system-test/2-query/distribute_agg_stddev.py @@ -64,7 +64,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/distribute_agg_sum.py b/tests/system-test/2-query/distribute_agg_sum.py index add4d75c61..8dcd902b3d 100644 --- a/tests/system-test/2-query/distribute_agg_sum.py +++ b/tests/system-test/2-query/distribute_agg_sum.py @@ -53,7 +53,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/function_null.py b/tests/system-test/2-query/function_null.py index 4de7a7f113..545872b39d 100644 --- a/tests/system-test/2-query/function_null.py +++ b/tests/system-test/2-query/function_null.py @@ -42,7 +42,7 @@ class TDTestCase: ) for i in range(4): tdSql.execute( - f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/irate.py b/tests/system-test/2-query/irate.py index 238924d851..d0573a6bf4 100644 --- a/tests/system-test/2-query/irate.py +++ b/tests/system-test/2-query/irate.py @@ -97,7 +97,7 @@ class TDTestCase: ) for i in range(4): tdSql.execute( - f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/max.py b/tests/system-test/2-query/max.py index 46426a5a95..3cd023648e 100644 --- a/tests/system-test/2-query/max.py +++ b/tests/system-test/2-query/max.py @@ -109,7 +109,7 @@ class TDTestCase: ''' ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( diff --git a/tests/system-test/2-query/twa.py b/tests/system-test/2-query/twa.py index b400e503d9..9f0e189a5f 100644 --- a/tests/system-test/2-query/twa.py +++ b/tests/system-test/2-query/twa.py @@ -34,7 +34,7 @@ class TDTestCase: ) for i in range(self.tb_nums): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') ts = self.ts for j in range(self.row_nums): ts+=j*self.time_step From c7559a81cae2ac229337611f0d86b95148897382 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Jul 2022 23:28:27 +0800 Subject: [PATCH 58/63] refactor: do some internal refactor. --- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 354 +++++++++++++++--------- source/libs/executor/src/executorimpl.c | 2 +- source/libs/executor/src/scanoperator.c | 16 +- tests/script/tsim/tmq/basic1.sim | 1 + 5 files changed, 230 insertions(+), 145 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 1d6784982c..de2905fe96 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -130,7 +130,7 @@ bool tsdbNextDataBlock(STsdbReader *pReader); void tsdbRetrieveDataBlockInfo(STsdbReader *pReader, SDataBlockInfo *pDataBlockInfo); int32_t tsdbRetrieveDataBlockStatisInfo(STsdbReader *pReader, SColumnDataAgg ***pBlockStatis, bool *allHave); SArray *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList); -void tsdbResetReadHandle(STsdbReader *pReader, SQueryTableDataCond *pCond, int32_t tWinIdx); +int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond, int32_t tWinIdx); int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo); int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 2460c5090f..d83f482ca8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -16,17 +16,22 @@ #include "tsdb.h" #define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC) +typedef struct { + STbDataIter *iter; + int32_t index; + bool hasVal; +} SIterInfo; + typedef struct STableBlockScanInfo { uint64_t uid; TSKEY lastKey; SBlockIdx blockIdx; SArray* pBlockList; // block data index list - bool iterInit; // whether to initialize the in-memory skip list iterator or not - STbDataIter* iter; // mem buffer skip list iterator - STbDataIter* iiter; // imem buffer skip list iterator + SIterInfo iter; // mem buffer skip list iterator + SIterInfo iiter; // imem buffer skip list iterator SArray* delSkyline; // delete info for this table - bool memHasVal; - bool imemHasVal; + int32_t fileDelIndex; + bool iterInit; // whether to initialize the in-memory skip list iterator or not } STableBlockScanInfo; typedef struct SBlockOrderWrapper { @@ -112,14 +117,14 @@ struct STsdbReader { char* idStr; // query info handle, for debug purpose int32_t type; // query type: 1. retrieve all data blocks, 2. retrieve direct prev|next rows SBlockLoadSuppInfo suppInfo; - SArray* prev; // previous row which is before than time window - SArray* next; // next row which is after the query time window + SIOCostSummary cost; STSchema* pSchema; - - SDataFReader* pFileReader; - SVersionRange verRange; + SDataFReader* pFileReader; + SVersionRange verRange; #if 0 + SArray* prev; // previous row which is before than time window + SArray* next; // next row which is after the query time window SFileBlockInfo* pDataBlockInfo; SDataCols* pDataCols; // in order to hold current file data block int32_t allocSize; // allocated data block size @@ -136,19 +141,19 @@ struct STsdbReader { static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter); static int buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, STsdbReader* pReader); -static TSDBROW* getValidRow(STbDataIter* pIter, bool* hasVal, STsdbReader* pReader); +static TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader); static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader, SRowMerger* pMerger); -static int32_t doMergeRowsInBuf(STbDataIter* pIter, bool* hasVal, int64_t ts, SRowMerger* pMerger, - STsdbReader* pReader); +static int32_t doMergeRowsInBuf(SIterInfo *pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader); static int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow); static void setComposedBlockFlag(STsdbReader* pReader, bool composed); static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader); +static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey); -static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, STbDataIter* dIter, bool* hasVal, STSRow** pTSRow, - STsdbReader* pReader); +static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo *pIter, SArray* pDelList, STSRow** pTSRow, STsdbReader* pReader); static void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STSRow** pTSRow); +static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData, STbData* piMemTbData); static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) { SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; @@ -372,7 +377,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->suid = pCond->suid; pReader->order = pCond->order; pReader->capacity = 4096; - pReader->idStr = strdup(idstr); + pReader->idStr = (idstr != NULL)? strdup(idstr):NULL; pReader->verRange = (SVersionRange) {.minVer = pCond->startVersion, .maxVer = 10000}; pReader->type = pCond->type; pReader->window = updateQueryTimeWindow(pVnode->pTsdb, pCond->twindows); @@ -1708,7 +1713,7 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pFBloc } static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, int64_t endKey) { - if (!(pBlockScanInfo->imemHasVal || pBlockScanInfo->memHasVal)) { + if (!(pBlockScanInfo->iiter.hasVal || pBlockScanInfo->iter.hasVal)) { return TSDB_CODE_SUCCESS; } @@ -1728,13 +1733,14 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* } static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, TSDBROW* pRow, - STSRow* pTSRow, STbDataIter* pIter, bool* hasVal, int64_t key) { + STSRow* pTSRow, SIterInfo* pIter, int64_t key) { SRowMerger merge = {0}; SBlockData* pBlockData = &pReader->status.fileBlockData; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; TSDBKEY k = TSDBROW_KEY(pRow); TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); + SArray* pDelList = pBlockScanInfo->delSkyline; // ascending order traverse if (ASCENDING_TRAVERSE(pReader->order)) { @@ -1744,19 +1750,19 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMergerGetRow(&merge, &pTSRow); } else if (k.ts < key) { // k.ts < key - doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, hasVal, &pTSRow, pReader); + doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, pDelList, &pTSRow, pReader); } else { // k.ts == key, ascending order: file block ----> imem rows -----> mem rows tRowMergerInit(&merge, &fRow, pReader->pSchema); doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMerge(&merge, pRow); - doMergeRowsInBuf(pIter, hasVal, k.ts, &merge, pReader); + doMergeRowsInBuf(pIter, k.ts, pBlockScanInfo->delSkyline, &merge, pReader); tRowMergerGetRow(&merge, &pTSRow); } } else { // descending order scan if (key < k.ts) { - doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, hasVal, &pTSRow, pReader); + doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, pDelList, &pTSRow, pReader); } else if (k.ts < key) { tRowMergerInit(&merge, &fRow, pReader->pSchema); @@ -1766,7 +1772,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* updateSchema(pRow, pBlockScanInfo->uid, pReader); tRowMergerInit(&merge, pRow, pReader->pSchema); - doMergeRowsInBuf(pIter, hasVal, k.ts, &merge, pReader); + doMergeRowsInBuf(pIter, k.ts, pBlockScanInfo->delSkyline, &merge, pReader); tRowMerge(&merge, &fRow); doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); @@ -1786,9 +1792,10 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pReader->status.fileBlockData; + SArray* pDelList = pBlockScanInfo->delSkyline; - TSDBROW* pRow = getValidRow(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, pReader); - TSDBROW* piRow = getValidRow(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, pReader); + TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pDelList, pReader); + TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pDelList, pReader); ASSERT(pRow != NULL && piRow != NULL); int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex]; @@ -1808,12 +1815,12 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (ik.ts == key) { tRowMerge(&merge, piRow); - doMergeRowsInBuf(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, key, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iiter, key, pBlockScanInfo->delSkyline, &merge, pReader); } if (k.ts == key) { tRowMerge(&merge, pRow); - doMergeRowsInBuf(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, key, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iter, key, pBlockScanInfo->delSkyline, &merge, pReader); } tRowMergerGetRow(&merge, &pTSRow); @@ -1825,7 +1832,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [3] ik.ts < key <= k.ts // [4] ik.ts < k.ts <= key if (ik.ts < k.ts) { - doMergeMultiRows(piRow, uid, pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, &pTSRow, pReader); + doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader); doAppendOneRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1833,7 +1840,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [5] k.ts < key <= ik.ts // [6] k.ts < ik.ts <= key if (k.ts < ik.ts) { - doMergeMultiRows(pRow, uid, pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, &pTSRow, pReader); + doMergeMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, &pTSRow, pReader); doAppendOneRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1853,11 +1860,11 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* updateSchema(pRow, uid, pReader); tRowMergerInit(&merge, pRow, pReader->pSchema); - doMergeRowsInBuf(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, key, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iter, key, pBlockScanInfo->delSkyline, &merge, pReader); if (ik.ts == k.ts) { tRowMerge(&merge, piRow); - doMergeRowsInBuf(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, key, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iiter, key, pBlockScanInfo->delSkyline, &merge, pReader); } if (k.ts == key) { @@ -1875,7 +1882,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [3] ik.ts > k.ts >= Key // [4] ik.ts > key >= k.ts if (ik.ts > key) { - doMergeMultiRows(piRow, uid, pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, &pTSRow, pReader); + doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader); doAppendOneRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1894,7 +1901,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* //[7] key = ik.ts > k.ts if (key == ik.ts) { - doMergeMultiRows(piRow, uid, pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, &pTSRow, pReader); + doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader); TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); tRowMerge(&merge, &fRow); @@ -1909,7 +1916,8 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* ASSERT(0); } -static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo, STsdbReader* pReader) { +static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo, STableBlockScanInfo* pBlockScanInfo, + STsdbReader* pReader) { // check for version and time range int64_t ver = pBlockData->aVersion[pDumpInfo->rowIndex]; if (ver > pReader->verRange.maxVer || ver < pReader->verRange.minVer) { @@ -1921,6 +1929,11 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDum return false; } + TSDBKEY k = {.ts = ts, .version = ver}; + if (hasBeenDropped(pBlockScanInfo->delSkyline, &pBlockScanInfo->fileDelIndex, &k)) { + return false; + } + return true; } @@ -1934,22 +1947,20 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI STSRow* pTSRow = NULL; int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex]; - TSDBROW* pRow = getValidRow(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, pReader); - TSDBROW* piRow = getValidRow(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, pReader); + TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); + TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader); - if (pBlockScanInfo->memHasVal && pBlockScanInfo->imemHasVal) { + if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal) { return doMergeThreeLevelRows(pReader, pBlockScanInfo); } else { // imem + file - if (pBlockScanInfo->imemHasVal) { - return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, pTSRow, pBlockScanInfo->iiter, - &pBlockScanInfo->imemHasVal, key); + if (pBlockScanInfo->iiter.hasVal) { + return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, pTSRow, &pBlockScanInfo->iiter, key); } // mem + file - if (pBlockScanInfo->memHasVal) { - return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, pTSRow, pBlockScanInfo->iter, - &pBlockScanInfo->memHasVal, key); + if (pBlockScanInfo->iter.hasVal) { + return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, pTSRow, &pBlockScanInfo->iter,key); } // imem & mem are all empty, only file exist @@ -1973,7 +1984,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader, STableBlockScanInfo* while (1) { // todo check the validate of row in file block { - if (!isValidFileBlockRow(pBlockData, pDumpInfo, pReader)) { + if (!isValidFileBlockRow(pBlockData, pDumpInfo, pBlockScanInfo, pReader)) { pDumpInfo->rowIndex += step; SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter); @@ -2018,7 +2029,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader, STableBlockScanInfo* void setComposedBlockFlag(STsdbReader* pReader, bool composed) { pReader->status.composedDataBlock = composed; } -static int32_t initMemIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { +static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { if (pBlockScanInfo->iterInit) { return TSDB_CODE_SUCCESS; } @@ -2038,9 +2049,9 @@ static int32_t initMemIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* if (pReader->pTsdb->mem != NULL) { tsdbGetTbDataFromMemTable(pReader->pTsdb->mem, pReader->suid, pBlockScanInfo->uid, &d); if (d != NULL) { - code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter); + code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { - pBlockScanInfo->memHasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter) != NULL); + pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL); tsdbDebug("%p uid:%" PRId64 ", check data in mem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64 "-%" PRId64 " %s", @@ -2059,9 +2070,9 @@ static int32_t initMemIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* if (pReader->pTsdb->imem != NULL) { tsdbGetTbDataFromMemTable(pReader->pTsdb->imem, pReader->suid, pBlockScanInfo->uid, &di); if (di != NULL) { - code = tsdbTbDataIterCreate(di, &startKey, backward, &pBlockScanInfo->iiter); + code = tsdbTbDataIterCreate(di, &startKey, backward, &pBlockScanInfo->iiter.iter); if (code == TSDB_CODE_SUCCESS) { - pBlockScanInfo->imemHasVal = (tsdbTbDataIterGet(pBlockScanInfo->iiter) != NULL); + pBlockScanInfo->iiter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iiter.iter) != NULL); tsdbDebug("%p uid:%" PRId64 ", check data in imem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64 "-%" PRId64 " %s", @@ -2076,18 +2087,22 @@ static int32_t initMemIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* tsdbDebug("%p uid:%" PRId64 ", no data in imem, %s", pReader, pBlockScanInfo->uid, pReader->idStr); } + initDelSkylineIterator(pBlockScanInfo, pReader, d, di); + pBlockScanInfo->iterInit = true; return TSDB_CODE_SUCCESS; } -static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { +int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData, STbData* piMemTbData) { if (pBlockScanInfo->delSkyline != NULL) { return TSDB_CODE_SUCCESS; } -#if 0 + int32_t code = 0; STsdb* pTsdb = pReader->pTsdb; + SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); + SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); if (pDelFile) { SDelFReader* pDelFReader = NULL; @@ -2101,27 +2116,51 @@ static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdb goto _err; } - SDelFile* pDelFileR = pReader->pTsdb->fs->nState->pDelFile; - if (pDelFileR) { - code = tsdbDelFReaderOpen(&pDelFReader, pDelFileR, pTsdb, NULL); - if (code) { - goto _err; - } - - code = tsdbReadDelIdx(pDelFReader, aDelIdx, NULL); - if (code) { - goto _err; - } + code = tsdbReadDelIdx(pDelFReader, aDelIdx, NULL); + if (code) { + goto _err; } - code = tsdbBuildDeleteSkyline(pBlockScanInfo->delSkyline, 0, (int32_t)(nDelData - 1), aSkyline); + SDelIdx idx = {.suid = pReader->suid, .uid = pBlockScanInfo->uid}; + SDelIdx* pIdx = taosArraySearch(aDelIdx, &idx, tCmprDelIdx, TD_EQ); + + code = tsdbReadDelData(pDelFReader, pIdx, pDelData, NULL); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } } - _err: + SDelData* p = NULL; + if (pMemTbData != NULL) { + p = pMemTbData->pHead; + while (p) { + taosArrayPush(pDelData, p); + p = p->pNext; + } + } + + if (piMemTbData != NULL) { + p = piMemTbData->pHead; + while (p) { + taosArrayPush(pDelData, p); + p = p->pNext; + } + } + + if (taosArrayGetSize(pDelData) > 0) { + pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY)); + code = tsdbBuildDeleteSkyline(pDelData, 0, (int32_t)(taosArrayGetSize(pDelData) - 1), pBlockScanInfo->delSkyline); + } + + taosArrayDestroy(pDelData); + pBlockScanInfo->iter.index = ASCENDING_TRAVERSE(pReader->order)? 0:taosArrayGetSize(pBlockScanInfo->delSkyline) - 1; + pBlockScanInfo->iiter.index = pBlockScanInfo->iter.index; + pBlockScanInfo->fileDelIndex = pBlockScanInfo->iter.index; return code; -#endif - return 0; +_err: + taosArrayDestroy(pDelData); + return code; } static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pReader) { @@ -2130,13 +2169,13 @@ static TSDBKEY getCurrentKeyInBuf(SDataBlockIter* pBlockIter, STsdbReader* pRead SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter); STableBlockScanInfo* pScanInfo = taosHashGet(pReader->status.pTableMap, &pFBlock->uid, sizeof(pFBlock->uid)); - initMemIterator(pScanInfo, pReader); - TSDBROW* pRow = getValidRow(pScanInfo->iter, &pScanInfo->memHasVal, pReader); + initMemDataIterator(pScanInfo, pReader); + TSDBROW* pRow = getValidRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader); if (pRow != NULL) { key = TSDBROW_KEY(pRow); } - pRow = getValidRow(pScanInfo->iiter, &pScanInfo->imemHasVal, pReader); + pRow = getValidRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader); if (pRow != NULL) { TSDBKEY k = TSDBROW_KEY(pRow); if (key.ts > k.ts) { @@ -2230,7 +2269,7 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) { } STableBlockScanInfo* pBlockScanInfo = pStatus->pTableIter; - initMemIterator(pBlockScanInfo, pReader); + initMemDataIterator(pBlockScanInfo, pReader); int64_t endKey = (ASCENDING_TRAVERSE(pReader->order)) ? INT64_MAX : INT64_MIN; int32_t code = buildDataBlockFromBuf(pReader, pBlockScanInfo, endKey); @@ -2369,51 +2408,89 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) { // taosArrayPush(pTsdbReadHandle->pTableCheckInfo, &info); // } -TSDBROW* getValidRow(STbDataIter* pIter, bool* hasVal, STsdbReader* pReader) { - if (!(*hasVal)) { +bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey) { + ASSERT(pKey != NULL); + if (pDelList == NULL) { + return false; + } + + if (*index >= taosArrayGetSize(pDelList) - 1) { + TSDBKEY* last = taosArrayGetLast(pDelList); + if (pKey->ts > last->ts) { + return false; + } else if (pKey->ts == last->ts) { + size_t size = taosArrayGetSize(pDelList); + TSDBKEY* prev = taosArrayGet(pDelList, size - 2); + if (prev->version >= pKey->version) { + return true; + } else { + return false; + } + } else { + ASSERT(0); + } + } else { + TSDBKEY* pCurrent = taosArrayGet(pDelList, *index); + TSDBKEY* pNext = taosArrayGet(pDelList, (*index) + 1); + + if (pCurrent->ts <= pKey->ts && pNext->ts >= pKey->ts && pCurrent->version >= pKey->version) { + return true; + } else { + while (pNext->ts < pKey->ts && (*index) < taosArrayGetSize(pDelList) - 1) { + (*index) += 1; + } + + return false; + } + } +} + +TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader) { + if (!pIter->hasVal) { return NULL; } - TSDBROW* pRow = tsdbTbDataIterGet(pIter); + TSDBROW* pRow = tsdbTbDataIterGet(pIter->iter); TSDBKEY key = TSDBROW_KEY(pRow); if (outOfTimeWindow(key.ts, &pReader->window)) { - *hasVal = false; + pIter->hasVal = false; return NULL; } - if (key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer) { + // it is a valid data version + if ((key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer) && (!hasBeenDropped(pDelList, &pIter->index, &key))) { return pRow; } while (1) { - *hasVal = tsdbTbDataIterNext(pIter); - if (!(*hasVal)) { + pIter->hasVal = tsdbTbDataIterNext(pIter->iter); + if (!pIter->hasVal) { return NULL; } - pRow = tsdbTbDataIterGet(pIter); + pRow = tsdbTbDataIterGet(pIter->iter); key = TSDBROW_KEY(pRow); if (outOfTimeWindow(key.ts, &pReader->window)) { - *hasVal = false; + pIter->hasVal = false; return NULL; } - if (key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer) { + if (key.version <= pReader->verRange.maxVer && key.version >= pReader->verRange.minVer && (!hasBeenDropped(pDelList, &pIter->index, &key))) { return pRow; } } } -int32_t doMergeRowsInBuf(STbDataIter* pIter, bool* hasVal, int64_t ts, SRowMerger* pMerger, STsdbReader* pReader) { +int32_t doMergeRowsInBuf(SIterInfo *pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader) { while (1) { - *hasVal = tsdbTbDataIterNext(pIter); - if (!(*hasVal)) { + pIter->hasVal = tsdbTbDataIterNext(pIter->iter); + if (!pIter->hasVal) { break; } // data exists but not valid - TSDBROW* pRow = getValidRow(pIter, hasVal, pReader); + TSDBROW* pRow = getValidRow(pIter, pDelList, pReader); if (pRow == NULL) { break; } @@ -2539,15 +2616,14 @@ void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader) { } } -void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, STbDataIter* dIter, bool* hasVal, STSRow** pTSRow, - STsdbReader* pReader) { +void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo *pIter, SArray* pDelList, STSRow** pTSRow, STsdbReader* pReader) { SRowMerger merge = {0}; TSDBKEY k = TSDBROW_KEY(pRow); updateSchema(pRow, uid, pReader); tRowMergerInit(&merge, pRow, pReader->pSchema); - doMergeRowsInBuf(dIter, hasVal, k.ts, &merge, pReader); + doMergeRowsInBuf(pIter, k.ts, pDelList, &merge, pReader); tRowMergerGetRow(&merge, pTSRow); } @@ -2562,18 +2638,18 @@ void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlo updateSchema(piRow, pBlockScanInfo->uid, pReader); tRowMergerInit(&merge, piRow, pReader->pSchema); - doMergeRowsInBuf(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, ik.ts, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iiter, ik.ts, pBlockScanInfo->delSkyline, &merge, pReader); tRowMerge(&merge, pRow); - doMergeRowsInBuf(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, k.ts, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iter, k.ts, pBlockScanInfo->delSkyline, &merge, pReader); } else { updateSchema(pRow, pBlockScanInfo->uid, pReader); tRowMergerInit(&merge, pRow, pReader->pSchema); - doMergeRowsInBuf(pBlockScanInfo->iiter, &pBlockScanInfo->memHasVal, ik.ts, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iter, k.ts, pBlockScanInfo->delSkyline, &merge, pReader); tRowMerge(&merge, piRow); - doMergeRowsInBuf(pBlockScanInfo->iter, &pBlockScanInfo->imemHasVal, k.ts, &merge, pReader); + doMergeRowsInBuf(&pBlockScanInfo->iiter, k.ts, pBlockScanInfo->delSkyline, &merge, pReader); } tRowMergerGetRow(&merge, pTSRow); @@ -2581,33 +2657,34 @@ void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlo int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STSRow** pTSRow, int64_t endKey) { - TSDBROW* pRow = getValidRow(pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, pReader); - TSDBROW* piRow = getValidRow(pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, pReader); + TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); + TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader); + SArray* pDelList = pBlockScanInfo->delSkyline; // todo refactor bool asc = ASCENDING_TRAVERSE(pReader->order); - if (pBlockScanInfo->memHasVal) { + if (pBlockScanInfo->iter.hasVal) { TSDBKEY k = TSDBROW_KEY(pRow); if ((k.ts >= endKey && asc) || (k.ts <= endKey && !asc)) { pRow = NULL; } } - if (pBlockScanInfo->imemHasVal) { + if (pBlockScanInfo->iiter.hasVal) { TSDBKEY k = TSDBROW_KEY(piRow); if ((k.ts >= endKey && asc) || (k.ts <= endKey && !asc)) { piRow = NULL; } } - if (pBlockScanInfo->memHasVal && pBlockScanInfo->imemHasVal && pRow != NULL && piRow != NULL) { + if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal && pRow != NULL && piRow != NULL) { TSDBKEY k = TSDBROW_KEY(pRow); TSDBKEY ik = TSDBROW_KEY(piRow); if (ik.ts < k.ts) { // ik.ts < k.ts - doMergeMultiRows(piRow, pBlockScanInfo->uid, pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, pTSRow, pReader); + doMergeMultiRows(piRow, pBlockScanInfo->uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader); } else if (k.ts < ik.ts) { - doMergeMultiRows(pRow, pBlockScanInfo->uid, pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, pTSRow, pReader); + doMergeMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader); } else { // ik.ts == k.ts doMergeMemIMemRows(pRow, piRow, pBlockScanInfo, pReader, pTSRow); } @@ -2615,13 +2692,13 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR return TSDB_CODE_SUCCESS; } - if (pBlockScanInfo->memHasVal && pRow != NULL) { - doMergeMultiRows(pRow, pBlockScanInfo->uid, pBlockScanInfo->iter, &pBlockScanInfo->memHasVal, pTSRow, pReader); + if (pBlockScanInfo->iter.hasVal && pRow != NULL) { + doMergeMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader); return TSDB_CODE_SUCCESS; } - if (pBlockScanInfo->imemHasVal && piRow != NULL) { - doMergeMultiRows(piRow, pBlockScanInfo->uid, pBlockScanInfo->iiter, &pBlockScanInfo->imemHasVal, pTSRow, pReader); + if (pBlockScanInfo->iiter.hasVal && piRow != NULL) { + doMergeMultiRows(piRow, pBlockScanInfo->uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader); return TSDB_CODE_SUCCESS; } @@ -2686,7 +2763,7 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e doAppendOneRow(pBlock, pReader, pTSRow); // no data in buffer, return immediately - if (!(pBlockScanInfo->memHasVal || pBlockScanInfo->imemHasVal)) { + if (!(pBlockScanInfo->iter.hasVal || pBlockScanInfo->iiter.hasVal)) { break; } @@ -2699,12 +2776,13 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e return TSDB_CODE_SUCCESS; } +// todo refactor, use arraylist instead int32_t tsdbSetTableId(STsdbReader* pReader, int64_t uid) { - // if (pReader->pTableCheckInfo) taosArrayDestroy(pReader->pTableCheckInfo); - // pReader->pTableCheckInfo = createCheckInfoFromUid(pReader, uid); - // if (pReader->pTableCheckInfo == NULL) { - // return TSDB_CODE_TDB_OUT_OF_MEMORY; - // } + ASSERT(pReader != NULL); + taosHashClear(pReader->status.pTableMap); + + STableBlockScanInfo info = {.lastKey = 0, .uid = uid}; + taosHashPut(pReader->status.pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info)); return TDB_CODE_SUCCESS; } @@ -3165,40 +3243,46 @@ SArray* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) { return pReader->pResBlock->pDataBlock; } -void tsdbResetReadHandle(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_t tWinIdx) { - // if (isEmptyQueryTimeWindow(pReader)) { - // if (pCond->order != pReader->order) { - // pReader->order = pCond->order; - // TSWAP(pReader->window.skey, pReader->window.ekey); - // } +int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_t tWinIdx) { + if (isEmptyQueryTimeWindow(&pReader->window)) { + return TSDB_CODE_SUCCESS; + } - // return; - // } + setQueryTimewindow(pReader, pCond, tWinIdx); - // pReader->order = pCond->order; - // setQueryTimewindow(pReader, pCond, tWinIdx); - // pReader->type = TSDB_QUERY_TYPE_ALL; - // pReader->cur.fid = -1; - // pReader->cur.win = TSWINDOW_INITIALIZER; - // pReader->checkFiles = true; - // pReader->activeIndex = 0; // current active table index - // pReader->locateStart = false; - // pReader->loadExternalRow = pCond->loadExternalRows; + pReader->order = pCond->order; + pReader->type = BLOCK_LOAD_OFFSET_ORDER; + pReader->status.loadFromFile = true; + pReader->status.pTableIter = NULL; - // if (ASCENDING_TRAVERSE(pCond->order)) { - // assert(pReader->window.skey <= pReader->window.ekey); - // } else { - // assert(pReader->window.skey >= pReader->window.ekey); - // } + pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows[tWinIdx]); - // // allocate buffer in order to load data blocks from file - // memset(pReader->suppInfo.pstatis, 0, sizeof(SColumnDataAgg)); - // memset(pReader->suppInfo.plist, 0, POINTER_BYTES); + // allocate buffer in order to load data blocks from file + memset(pReader->suppInfo.pstatis, 0, sizeof(SColumnDataAgg)); + memset(pReader->suppInfo.plist, 0, POINTER_BYTES); - // tsdbInitDataBlockLoadInfo(&pReader->dataBlockLoadInfo); - // tsdbInitCompBlockLoadInfo(&pReader->compBlockLoadInfo); + // todo set the correct numOfTables + int32_t numOfTables = 1; + SDataBlockIter* pBlockIter = &pReader->status.blockIter; - // resetCheckInfo(pReader); + STsdbFSState* pFState = pReader->pTsdb->fs->cState; + initFilesetIterator(&pReader->status.fileIter, pFState, pReader->order, pReader->idStr); + resetDataBlockIterator(&pReader->status.blockIter, pReader->order); + + int32_t code = 0; + // no data in files, let's try buffer in memory + if (pReader->status.fileIter.numOfFiles == 0) { + pReader->status.loadFromFile = false; + } else { + code = initForFirstBlockInFile(pReader, pBlockIter); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + + ASSERT(0); + tsdbDebug("%p reset tsdbreader in query %s", pReader, numOfTables, pReader->idStr); + return code; } int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTableBlockInfo) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 9742ec720f..8ea03d647a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2866,7 +2866,7 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) { tsdbSetTableId(pInfo->dataReader, uid); int64_t oldSkey = pInfo->cond.twindows[0].skey; pInfo->cond.twindows[0].skey = ts + 1; - tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + tsdbReaderReset(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 a1ea712bbf..916c8939c7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -440,7 +440,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { } pTableScanInfo->curTWinIdx += 1; if (pTableScanInfo->curTWinIdx < pTableScanInfo->cond.numOfTWindows) { - tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, pTableScanInfo->curTWinIdx); + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, pTableScanInfo->curTWinIdx); } } @@ -455,7 +455,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { qDebug("%s qrange:%" PRId64 "-%" PRId64, GET_TASKID(pTaskInfo), pWin->skey, pWin->ekey); } // do prepare for the next round table scan operation - tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); pTableScanInfo->curTWinIdx = 0; } } @@ -464,7 +464,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { if (pTableScanInfo->scanTimes < total) { if (pTableScanInfo->cond.order == TSDB_ORDER_ASC) { prepareForDescendingScan(pTableScanInfo, pTableScanInfo->pCtx, 0); - tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); pTableScanInfo->curTWinIdx = 0; } @@ -482,7 +482,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { } pTableScanInfo->curTWinIdx += 1; if (pTableScanInfo->curTWinIdx < pTableScanInfo->cond.numOfTWindows) { - tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, pTableScanInfo->curTWinIdx); + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, pTableScanInfo->curTWinIdx); } } @@ -498,7 +498,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { STimeWindow* pWin = &pTableScanInfo->cond.twindows[i]; qDebug("%s qrange:%" PRId64 "-%" PRId64, GET_TASKID(pTaskInfo), pWin->skey, pWin->ekey); } - tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); pTableScanInfo->curTWinIdx = 0; } } @@ -526,7 +526,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { } STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, pInfo->currentTable); tsdbSetTableId(pInfo->dataReader, pTableInfo->uid); - tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + tsdbReaderReset(pInfo->dataReader, &pInfo->cond, 0); pInfo->scanTimes = 0; pInfo->curTWinIdx = 0; } @@ -560,7 +560,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { SArray* tableList = taosArrayGetP(pTaskInfo->tableqinfoList.pGroupList, pInfo->currentGroupId); // tsdbSetTableList(pInfo->dataReader, tableList); - tsdbResetReadHandle(pInfo->dataReader, &pInfo->cond, 0); + tsdbReaderReset(pInfo->dataReader, &pInfo->cond, 0); pInfo->curTWinIdx = 0; pInfo->scanTimes = 0; @@ -859,7 +859,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo, SSDataBlock* pSDB, int3 STableScanInfo* pTableScanInfo = pInfo->pSnapshotReadOp->info; pTableScanInfo->cond.twindows[0] = win; pTableScanInfo->curTWinIdx = 0; - // tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); + // tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); // if (!pTableScanInfo->dataReader) { // return false; // } diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index ee9e87cf04..6880f290f5 100644 --- a/tests/script/tsim/tmq/basic1.sim +++ b/tests/script/tsim/tmq/basic1.sim @@ -131,6 +131,7 @@ if $data[0][1] != $consumerId then return -1 endi if $data[0][2] != $expectmsgcnt then + print expect $expectmsgcnt , actual $data02 return -1 endi if $data[0][3] != $expectmsgcnt then From f2f90c3265f333f7483bd472c16bc4d4672e688a Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 5 Jul 2022 10:20:10 +0800 Subject: [PATCH 59/63] fix: compile error --- source/libs/parser/src/sql.c | 5942 +++++++++++++++++----------------- 1 file changed, 2955 insertions(+), 2987 deletions(-) diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index fe6e36bf5b..fcf4d69a66 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 375 +#define YYNOCODE 376 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - 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; + EJoinType yy52; + bool yy89; + SDataType yy224; + int32_t yy228; + SNode* yy248; + SAlterOption yy301; + ENullOrder yy345; + SToken yy401; + EOrder yy482; + int64_t yy525; + SNodeList* yy552; + EFillMode yy582; + int8_t yy695; + EOperatorType yy716; } 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 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 +#define YYNSTATE 656 +#define YYNRULE 484 +#define YYNTOKEN 253 +#define YY_MAX_SHIFT 655 +#define YY_MIN_SHIFTREDUCE 957 +#define YY_MAX_SHIFTREDUCE 1440 +#define YY_ERROR_ACTION 1441 +#define YY_ACCEPT_ACTION 1442 +#define YY_NO_ACTION 1443 +#define YY_MIN_REDUCE 1444 +#define YY_MAX_REDUCE 1927 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,703 +216,664 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2609) +#define YY_ACTTAB_COUNT (2401) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 422, 1563, 423, 1475, 1900, 430, 1438, 423, 1475, 69, - /* 10 */ 69, 379, 40, 38, 1744, 141, 1775, 1899, 541, 1531, - /* 20 */ 333, 1897, 1238, 115, 534, 1741, 41, 39, 37, 36, - /* 30 */ 35, 1570, 1569, 1313, 101, 1236, 1565, 100, 99, 98, - /* 40 */ 97, 96, 95, 94, 93, 92, 120, 1741, 297, 544, - /* 50 */ 1745, 1737, 1743, 322, 338, 1757, 1308, 1619, 1621, 14, - /* 60 */ 544, 1741, 533, 562, 439, 1244, 343, 546, 1263, 40, - /* 70 */ 38, 1376, 541, 1737, 1743, 1552, 1900, 333, 140, 1238, - /* 80 */ 1452, 167, 1, 1775, 544, 562, 118, 1737, 1743, 158, - /* 90 */ 1313, 569, 1236, 1897, 373, 464, 1727, 1900, 568, 562, - /* 100 */ 120, 245, 1842, 540, 649, 539, 67, 1900, 1900, 66, - /* 110 */ 1898, 44, 546, 1308, 1897, 1056, 14, 463, 1315, 1316, - /* 120 */ 157, 159, 1244, 1788, 1897, 1897, 1263, 87, 1758, 571, - /* 130 */ 1760, 1761, 567, 439, 562, 1900, 60, 1834, 1380, 2, - /* 140 */ 118, 300, 1830, 541, 1262, 1058, 43, 1262, 157, 151, - /* 150 */ 652, 210, 1897, 1900, 543, 153, 1842, 1843, 1004, 1847, - /* 160 */ 1003, 649, 1613, 1239, 262, 1237, 159, 31, 255, 987, - /* 170 */ 1897, 120, 535, 458, 320, 1315, 1316, 60, 149, 73, - /* 180 */ 604, 203, 138, 642, 638, 634, 630, 260, 1005, 1242, - /* 190 */ 1243, 1576, 1291, 1292, 1294, 1295, 1296, 1297, 1298, 564, - /* 200 */ 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, 991, - /* 210 */ 992, 118, 85, 1323, 421, 225, 372, 425, 371, 1262, - /* 220 */ 1239, 160, 1237, 412, 1136, 1137, 154, 1842, 1843, 1261, - /* 230 */ 1847, 34, 33, 310, 505, 41, 39, 37, 36, 35, - /* 240 */ 71, 299, 319, 541, 507, 1671, 1242, 1243, 514, 1291, - /* 250 */ 1292, 1294, 1295, 1296, 1297, 1298, 564, 560, 1306, 1307, - /* 260 */ 1309, 1310, 1311, 1312, 1314, 1317, 40, 38, 1440, 171, - /* 270 */ 170, 120, 1626, 1674, 333, 160, 1238, 216, 217, 321, - /* 280 */ 212, 311, 301, 309, 308, 160, 462, 1313, 1624, 1236, - /* 290 */ 464, 530, 110, 109, 108, 107, 106, 105, 104, 103, - /* 300 */ 102, 1211, 1463, 205, 517, 429, 1276, 517, 425, 517, - /* 310 */ 1308, 118, 463, 14, 1335, 111, 160, 1293, 111, 1244, - /* 320 */ 162, 61, 460, 40, 38, 465, 155, 1842, 1843, 60, - /* 330 */ 1847, 333, 1574, 1238, 1502, 1574, 2, 1574, 299, 427, - /* 340 */ 1462, 507, 1244, 1727, 1313, 1260, 1236, 1094, 593, 592, - /* 350 */ 591, 1098, 590, 1100, 1101, 589, 1103, 586, 649, 1109, - /* 360 */ 583, 1111, 1112, 580, 577, 1550, 517, 1308, 1336, 536, - /* 370 */ 531, 600, 1315, 1316, 1617, 1461, 1244, 377, 37, 36, - /* 380 */ 35, 1727, 34, 33, 1620, 1621, 41, 39, 37, 36, - /* 390 */ 35, 1341, 1293, 8, 1574, 626, 625, 624, 341, 60, - /* 400 */ 623, 622, 621, 121, 616, 615, 614, 613, 612, 611, - /* 410 */ 610, 609, 131, 605, 596, 649, 1727, 1239, 1849, 1237, - /* 420 */ 34, 33, 1397, 604, 41, 39, 37, 36, 35, 1315, - /* 430 */ 1316, 1551, 30, 331, 1330, 1331, 1332, 1333, 1334, 1338, - /* 440 */ 1339, 1340, 1846, 1242, 1243, 607, 1291, 1292, 1294, 1295, - /* 450 */ 1296, 1297, 1298, 564, 560, 1306, 1307, 1309, 1310, 1311, - /* 460 */ 1312, 1314, 1317, 527, 1395, 1396, 1398, 1399, 160, 517, - /* 470 */ 474, 473, 471, 470, 1239, 472, 1237, 1559, 116, 469, - /* 480 */ 378, 84, 468, 467, 466, 34, 33, 11, 10, 41, - /* 490 */ 39, 37, 36, 35, 117, 1407, 1004, 1574, 1003, 209, - /* 500 */ 1242, 1243, 1566, 1291, 1292, 1294, 1295, 1296, 1297, 1298, - /* 510 */ 564, 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, - /* 520 */ 40, 38, 1318, 336, 479, 602, 1005, 72, 333, 1433, - /* 530 */ 1238, 138, 160, 1505, 504, 189, 301, 1561, 160, 489, - /* 540 */ 1576, 1313, 339, 1236, 129, 128, 599, 598, 597, 144, - /* 550 */ 138, 517, 497, 202, 456, 452, 448, 444, 188, 1576, - /* 560 */ 77, 517, 382, 517, 1308, 620, 618, 482, 1335, 1349, - /* 570 */ 490, 476, 397, 1244, 398, 1900, 201, 40, 38, 1574, - /* 580 */ 1626, 1567, 517, 70, 58, 333, 186, 1238, 157, 1574, - /* 590 */ 9, 1574, 1897, 438, 474, 473, 1625, 364, 1313, 472, - /* 600 */ 1236, 55, 116, 469, 54, 517, 468, 467, 466, 7, - /* 610 */ 1574, 1900, 649, 1670, 517, 294, 1571, 1432, 517, 366, - /* 620 */ 362, 1308, 1336, 1373, 157, 1703, 1315, 1316, 1897, 498, - /* 630 */ 1244, 34, 33, 1574, 1460, 41, 39, 37, 36, 35, - /* 640 */ 991, 992, 1574, 1626, 1459, 1341, 1574, 9, 185, 178, - /* 650 */ 337, 183, 1849, 1264, 517, 435, 34, 33, 1458, 1624, - /* 660 */ 41, 39, 37, 36, 35, 502, 23, 1664, 517, 649, - /* 670 */ 1669, 1239, 294, 1237, 176, 1727, 1845, 215, 169, 515, - /* 680 */ 1457, 550, 1574, 1315, 1316, 1727, 30, 331, 1330, 1331, - /* 690 */ 1332, 1333, 1334, 1338, 1339, 1340, 1574, 1242, 1243, 1727, - /* 700 */ 1291, 1292, 1294, 1295, 1296, 1297, 1298, 564, 560, 1306, - /* 710 */ 1307, 1309, 1310, 1311, 1312, 1314, 1317, 1441, 34, 33, - /* 720 */ 488, 1727, 41, 39, 37, 36, 35, 1849, 1239, 601, - /* 730 */ 1237, 1387, 1617, 486, 267, 484, 1456, 1604, 101, 1219, - /* 740 */ 1220, 100, 99, 98, 97, 96, 95, 94, 93, 92, - /* 750 */ 608, 1844, 1546, 541, 1242, 1243, 1715, 1291, 1292, 1294, - /* 760 */ 1295, 1296, 1297, 1298, 564, 560, 1306, 1307, 1309, 1310, - /* 770 */ 1311, 1312, 1314, 1317, 40, 38, 296, 1727, 1260, 553, - /* 780 */ 517, 120, 333, 247, 1238, 405, 1453, 1455, 417, 517, - /* 790 */ 1369, 516, 602, 1276, 1454, 1313, 1265, 1236, 1557, 505, - /* 800 */ 256, 1337, 546, 352, 1451, 390, 1262, 418, 1574, 392, - /* 810 */ 1672, 129, 128, 599, 598, 597, 1247, 1574, 1308, 548, - /* 820 */ 517, 118, 1854, 1369, 1342, 45, 4, 1244, 1727, 52, - /* 830 */ 501, 340, 1450, 138, 1449, 1727, 245, 1842, 540, 383, - /* 840 */ 539, 1372, 1577, 1900, 2, 1727, 34, 33, 1574, 528, - /* 850 */ 41, 39, 37, 36, 35, 194, 157, 206, 192, 1448, - /* 860 */ 1897, 1238, 1447, 34, 33, 28, 649, 41, 39, 37, - /* 870 */ 36, 35, 1446, 1727, 1236, 1727, 563, 1246, 551, 416, - /* 880 */ 1315, 1316, 411, 410, 409, 408, 407, 404, 403, 402, - /* 890 */ 401, 400, 396, 395, 394, 393, 387, 386, 385, 384, - /* 900 */ 1727, 381, 380, 1727, 1244, 27, 1445, 11, 10, 139, - /* 910 */ 619, 34, 33, 1727, 273, 41, 39, 37, 36, 35, - /* 920 */ 1549, 196, 1435, 1436, 195, 1239, 227, 1237, 271, 57, - /* 930 */ 1444, 1492, 56, 1443, 198, 200, 42, 197, 199, 558, - /* 940 */ 1532, 1747, 214, 649, 1757, 595, 1250, 1727, 172, 250, - /* 950 */ 367, 1242, 1243, 475, 1291, 1292, 1294, 1295, 1296, 1297, - /* 960 */ 1298, 564, 560, 1306, 1307, 1309, 1310, 1311, 1312, 1314, - /* 970 */ 1317, 1727, 1775, 60, 1727, 123, 1187, 1749, 554, 1293, - /* 980 */ 569, 491, 218, 29, 1487, 1727, 1485, 568, 137, 34, - /* 990 */ 33, 457, 126, 41, 39, 37, 36, 35, 127, 50, - /* 1000 */ 231, 546, 1239, 42, 1237, 42, 477, 1249, 480, 42, - /* 1010 */ 239, 86, 1788, 575, 602, 510, 87, 1758, 571, 1760, - /* 1020 */ 1761, 567, 1757, 562, 1481, 1776, 1834, 342, 1242, 1243, - /* 1030 */ 300, 1830, 224, 129, 128, 599, 598, 597, 1087, 1394, - /* 1040 */ 234, 126, 1900, 1343, 127, 1299, 64, 63, 376, 266, - /* 1050 */ 1775, 166, 112, 1115, 83, 157, 1028, 370, 545, 1897, - /* 1060 */ 1476, 1614, 126, 1727, 80, 568, 1864, 542, 244, 1327, - /* 1070 */ 295, 249, 644, 360, 252, 358, 354, 350, 163, 345, - /* 1080 */ 254, 1119, 3, 1757, 1126, 5, 1029, 1260, 347, 344, - /* 1090 */ 1788, 351, 1124, 306, 88, 1758, 571, 1760, 1761, 567, - /* 1100 */ 1757, 562, 130, 1056, 1834, 307, 1203, 263, 326, 1830, - /* 1110 */ 152, 1775, 160, 399, 1666, 168, 406, 413, 414, 545, - /* 1120 */ 415, 419, 156, 1266, 1727, 420, 568, 428, 1775, 1269, - /* 1130 */ 1860, 175, 431, 177, 1268, 432, 569, 433, 1270, 180, - /* 1140 */ 434, 1727, 436, 568, 182, 1267, 184, 437, 68, 440, - /* 1150 */ 187, 1788, 461, 1757, 459, 88, 1758, 571, 1760, 1761, - /* 1160 */ 567, 1564, 562, 492, 264, 1834, 124, 191, 1788, 326, - /* 1170 */ 1830, 152, 88, 1758, 571, 1760, 1761, 567, 298, 562, - /* 1180 */ 91, 1775, 1834, 1560, 193, 132, 326, 1830, 1913, 569, - /* 1190 */ 133, 1861, 1562, 1558, 1727, 134, 568, 1868, 135, 324, - /* 1200 */ 323, 1708, 204, 207, 493, 499, 496, 503, 1757, 1252, - /* 1210 */ 525, 211, 506, 511, 1707, 316, 512, 220, 1676, 508, - /* 1220 */ 1313, 1788, 1245, 318, 222, 88, 1758, 571, 1760, 1761, - /* 1230 */ 567, 125, 562, 513, 76, 1834, 1775, 265, 1575, 326, - /* 1240 */ 1830, 1913, 1265, 1308, 569, 1865, 521, 529, 1875, 1727, - /* 1250 */ 1891, 568, 1244, 1874, 1856, 229, 538, 523, 233, 524, - /* 1260 */ 325, 532, 6, 522, 520, 519, 1369, 119, 1264, 552, - /* 1270 */ 555, 19, 1757, 146, 238, 243, 1788, 1850, 327, 78, - /* 1280 */ 88, 1758, 571, 1760, 1761, 567, 1757, 562, 240, 242, - /* 1290 */ 1834, 526, 241, 248, 326, 1830, 1913, 1896, 1757, 573, - /* 1300 */ 1775, 1618, 268, 549, 645, 1853, 1547, 251, 569, 556, - /* 1310 */ 1916, 253, 259, 1727, 1775, 568, 646, 1815, 648, 51, - /* 1320 */ 145, 270, 569, 272, 1721, 281, 1775, 1727, 291, 568, - /* 1330 */ 290, 1720, 62, 1719, 569, 346, 1716, 348, 349, 1727, - /* 1340 */ 1788, 568, 1231, 546, 284, 1758, 571, 1760, 1761, 567, - /* 1350 */ 1253, 562, 1248, 1232, 1788, 546, 164, 353, 280, 1758, - /* 1360 */ 571, 1760, 1761, 567, 1714, 562, 1788, 1757, 357, 355, - /* 1370 */ 280, 1758, 571, 1760, 1761, 567, 1256, 562, 356, 1713, - /* 1380 */ 1712, 359, 537, 361, 1900, 1711, 1710, 560, 1306, 1307, - /* 1390 */ 1309, 1310, 1311, 1312, 363, 1775, 1900, 159, 365, 1693, - /* 1400 */ 368, 1897, 165, 569, 369, 1206, 1205, 1687, 1727, 157, - /* 1410 */ 568, 1686, 374, 1897, 375, 1685, 1684, 1175, 1659, 1658, - /* 1420 */ 1657, 65, 1656, 1655, 1757, 1654, 1653, 1652, 388, 389, - /* 1430 */ 1651, 391, 1650, 1649, 1648, 1788, 1647, 1646, 1645, 89, - /* 1440 */ 1758, 571, 1760, 1761, 567, 1757, 562, 1644, 1643, 1834, - /* 1450 */ 1642, 1641, 1775, 1833, 1830, 1640, 1639, 1638, 1637, 122, - /* 1460 */ 569, 1636, 1635, 1634, 1633, 1727, 1632, 568, 1631, 1630, - /* 1470 */ 1629, 1177, 1628, 1775, 150, 424, 1471, 173, 113, 994, - /* 1480 */ 174, 566, 1627, 1504, 1472, 993, 1727, 426, 568, 1701, - /* 1490 */ 1695, 114, 1788, 179, 181, 1682, 89, 1758, 571, 1760, - /* 1500 */ 1761, 567, 1683, 562, 1668, 1757, 1834, 1553, 1503, 1501, - /* 1510 */ 557, 1830, 441, 1788, 443, 1499, 1497, 288, 1758, 571, - /* 1520 */ 1760, 1761, 567, 565, 562, 559, 1806, 1022, 442, 445, - /* 1530 */ 447, 449, 446, 1775, 450, 1495, 451, 455, 453, 454, - /* 1540 */ 1484, 569, 1483, 1468, 1555, 1130, 1727, 1129, 568, 190, - /* 1550 */ 49, 1554, 1055, 1054, 1053, 1052, 617, 619, 1049, 1048, - /* 1560 */ 1493, 1757, 1047, 312, 1488, 1486, 481, 313, 314, 1467, - /* 1570 */ 478, 483, 1466, 1788, 485, 1465, 487, 142, 1758, 571, - /* 1580 */ 1760, 1761, 567, 1757, 562, 1700, 90, 1213, 1694, 1775, - /* 1590 */ 136, 1681, 53, 494, 495, 1679, 315, 569, 1680, 1678, - /* 1600 */ 208, 1677, 1727, 1675, 568, 213, 1223, 1667, 15, 221, - /* 1610 */ 219, 1775, 74, 226, 75, 16, 317, 42, 1254, 569, - /* 1620 */ 1409, 547, 1914, 48, 1727, 500, 568, 509, 17, 1788, - /* 1630 */ 80, 24, 223, 89, 1758, 571, 1760, 1761, 567, 228, - /* 1640 */ 562, 230, 1391, 1834, 1757, 232, 237, 236, 1831, 13, - /* 1650 */ 143, 1788, 1747, 26, 246, 289, 1758, 571, 1760, 1761, - /* 1660 */ 567, 235, 562, 25, 1757, 1393, 1386, 1366, 79, 47, - /* 1670 */ 1365, 1746, 1775, 147, 18, 1426, 1415, 518, 1421, 10, - /* 1680 */ 569, 1420, 328, 1425, 1424, 1727, 329, 568, 1328, 1284, - /* 1690 */ 572, 1791, 1775, 20, 1303, 561, 32, 46, 1301, 1300, - /* 1700 */ 569, 148, 161, 12, 21, 1727, 22, 568, 574, 335, - /* 1710 */ 578, 1116, 1788, 1113, 576, 579, 289, 1758, 571, 1760, - /* 1720 */ 1761, 567, 1110, 562, 570, 581, 584, 582, 587, 1757, - /* 1730 */ 1093, 594, 1788, 1125, 1121, 1104, 142, 1758, 571, 1760, - /* 1740 */ 1761, 567, 585, 562, 1102, 588, 1108, 1107, 1757, 1020, - /* 1750 */ 81, 82, 59, 257, 603, 1044, 606, 1775, 258, 1106, - /* 1760 */ 1105, 1062, 330, 1042, 1041, 569, 1040, 1039, 1038, 1037, - /* 1770 */ 1727, 1036, 568, 1035, 1059, 1057, 1775, 1032, 1031, 1030, - /* 1780 */ 1027, 1915, 1500, 1026, 566, 1025, 627, 1498, 628, 1727, - /* 1790 */ 631, 568, 629, 632, 1496, 633, 635, 1788, 637, 636, - /* 1800 */ 1494, 289, 1758, 571, 1760, 1761, 567, 639, 562, 640, - /* 1810 */ 641, 1482, 643, 984, 1464, 261, 1788, 1757, 647, 650, - /* 1820 */ 288, 1758, 571, 1760, 1761, 567, 1240, 562, 269, 1807, - /* 1830 */ 651, 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, - /* 1840 */ 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, - /* 1850 */ 332, 1439, 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, - /* 1860 */ 568, 1775, 1439, 1439, 1439, 1439, 334, 1439, 1439, 569, - /* 1870 */ 1439, 1439, 1439, 1439, 1727, 1757, 568, 1439, 1439, 1439, - /* 1880 */ 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, 1439, 289, - /* 1890 */ 1758, 571, 1760, 1761, 567, 1439, 562, 1439, 1439, 1757, - /* 1900 */ 1439, 1788, 1439, 1775, 1439, 289, 1758, 571, 1760, 1761, - /* 1910 */ 567, 569, 562, 1439, 1439, 1439, 1727, 1439, 568, 1439, - /* 1920 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, - /* 1930 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, - /* 1940 */ 1727, 1757, 568, 1788, 1439, 1439, 1439, 274, 1758, 571, - /* 1950 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1439, 1439, 1439, - /* 1960 */ 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1775, - /* 1970 */ 1439, 275, 1758, 571, 1760, 1761, 567, 569, 562, 1439, - /* 1980 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1775, - /* 1990 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, - /* 2000 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1788, - /* 2010 */ 1439, 1439, 1439, 276, 1758, 571, 1760, 1761, 567, 1439, - /* 2020 */ 562, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, - /* 2030 */ 1439, 1439, 1439, 283, 1758, 571, 1760, 1761, 567, 1439, - /* 2040 */ 562, 1439, 1439, 1439, 1439, 1757, 1439, 1439, 1439, 1775, - /* 2050 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, - /* 2060 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1439, - /* 2070 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2080 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1788, - /* 2090 */ 1439, 1439, 1439, 285, 1758, 571, 1760, 1761, 567, 1439, - /* 2100 */ 562, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2110 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 277, 1758, 571, - /* 2120 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1775, - /* 2130 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, - /* 2140 */ 1439, 1439, 1727, 1439, 568, 1439, 1439, 1439, 1439, 1439, - /* 2150 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2160 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1757, 568, 1788, - /* 2170 */ 1439, 1439, 1439, 286, 1758, 571, 1760, 1761, 567, 1439, - /* 2180 */ 562, 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2190 */ 1439, 1439, 1439, 1788, 1439, 1775, 1439, 278, 1758, 571, - /* 2200 */ 1760, 1761, 567, 569, 562, 1439, 1439, 1439, 1727, 1439, - /* 2210 */ 568, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 569, - /* 2220 */ 1439, 1439, 1439, 1439, 1727, 1757, 568, 1439, 1439, 1439, - /* 2230 */ 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, 1439, 287, - /* 2240 */ 1758, 571, 1760, 1761, 567, 1757, 562, 1439, 1439, 1439, - /* 2250 */ 1439, 1788, 1439, 1775, 1439, 279, 1758, 571, 1760, 1761, - /* 2260 */ 567, 569, 562, 1439, 1439, 1439, 1727, 1439, 568, 1439, - /* 2270 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2280 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, - /* 2290 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 292, 1758, 571, - /* 2300 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1439, - /* 2310 */ 1439, 1439, 1439, 1788, 1439, 1439, 1439, 293, 1758, 571, - /* 2320 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1439, 1439, 1757, - /* 2330 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2340 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, - /* 2350 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, - /* 2360 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, - /* 2370 */ 1727, 1439, 568, 1788, 1439, 1439, 1439, 1769, 1758, 571, - /* 2380 */ 1760, 1761, 567, 1439, 562, 1757, 1439, 1439, 1439, 1439, - /* 2390 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, - /* 2400 */ 1439, 1768, 1758, 571, 1760, 1761, 567, 1439, 562, 1757, - /* 2410 */ 1439, 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, - /* 2420 */ 1439, 569, 1439, 1439, 1439, 1439, 1727, 1439, 568, 1439, - /* 2430 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1775, 1439, 1439, - /* 2440 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, - /* 2450 */ 1727, 1757, 568, 1788, 1439, 1439, 1439, 1767, 1758, 571, - /* 2460 */ 1760, 1761, 567, 1439, 562, 1439, 1439, 1757, 1439, 1439, - /* 2470 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1775, - /* 2480 */ 1439, 304, 1758, 571, 1760, 1761, 567, 569, 562, 1439, - /* 2490 */ 1439, 1439, 1727, 1439, 568, 1775, 1439, 1439, 1439, 1439, - /* 2500 */ 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, 1727, 1757, - /* 2510 */ 568, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, - /* 2520 */ 1439, 1439, 1439, 303, 1758, 571, 1760, 1761, 567, 1757, - /* 2530 */ 562, 1439, 1439, 1439, 1439, 1788, 1439, 1775, 1439, 305, - /* 2540 */ 1758, 571, 1760, 1761, 567, 569, 562, 1439, 1439, 1439, - /* 2550 */ 1727, 1439, 568, 1439, 1439, 1439, 1439, 1775, 1439, 1439, - /* 2560 */ 1439, 1439, 1439, 1439, 1439, 569, 1439, 1439, 1439, 1439, - /* 2570 */ 1727, 1439, 568, 1439, 1439, 1439, 1439, 1788, 1439, 1439, - /* 2580 */ 1439, 302, 1758, 571, 1760, 1761, 567, 1439, 562, 1439, - /* 2590 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1788, 1439, 1439, - /* 2600 */ 1439, 282, 1758, 571, 1760, 1761, 567, 1439, 562, + /* 0 */ 31, 256, 84, 425, 544, 426, 1479, 141, 1442, 1780, + /* 10 */ 1749, 1536, 40, 38, 1570, 117, 433, 537, 426, 1479, + /* 20 */ 334, 1746, 1242, 1571, 374, 1746, 41, 39, 37, 36, + /* 30 */ 35, 547, 120, 1317, 101, 1240, 380, 100, 99, 98, + /* 40 */ 97, 96, 95, 94, 93, 92, 1267, 1742, 1748, 323, + /* 50 */ 1267, 1742, 1748, 549, 69, 536, 1312, 1762, 507, 565, + /* 60 */ 14, 1268, 61, 565, 1377, 1905, 1248, 115, 344, 40, + /* 70 */ 38, 1380, 118, 298, 544, 520, 1574, 334, 157, 1242, + /* 80 */ 1467, 442, 1902, 1, 547, 1780, 162, 246, 1847, 543, + /* 90 */ 1317, 542, 1240, 572, 1905, 430, 11, 10, 1732, 1905, + /* 100 */ 571, 1264, 120, 1579, 1466, 652, 547, 159, 211, 1905, + /* 110 */ 1762, 1902, 157, 1312, 549, 1557, 1902, 14, 1269, 1319, + /* 120 */ 1320, 1732, 157, 1248, 339, 1793, 1902, 1624, 1626, 87, + /* 130 */ 1763, 574, 1765, 1766, 570, 60, 565, 73, 1780, 1839, + /* 140 */ 2, 60, 118, 301, 1835, 1732, 572, 43, 216, 1140, + /* 150 */ 1141, 1732, 520, 571, 1905, 1905, 546, 153, 1847, 1848, + /* 160 */ 491, 1852, 652, 111, 1243, 1631, 1241, 1904, 159, 44, + /* 170 */ 463, 1902, 1902, 489, 442, 487, 1319, 1320, 1793, 1353, + /* 180 */ 1579, 1630, 142, 1763, 574, 1765, 1766, 570, 1444, 565, + /* 190 */ 1246, 1247, 248, 1295, 1296, 1298, 1299, 1300, 1301, 1302, + /* 200 */ 567, 563, 1310, 1311, 1313, 1314, 1315, 1316, 1318, 1321, + /* 210 */ 1223, 1224, 110, 109, 108, 107, 106, 105, 104, 103, + /* 220 */ 102, 1243, 160, 1241, 1625, 1626, 550, 1919, 1401, 1905, + /* 230 */ 60, 1485, 34, 33, 60, 83, 41, 39, 37, 36, + /* 240 */ 35, 58, 158, 311, 493, 80, 1902, 1246, 1247, 228, + /* 250 */ 1295, 1296, 1298, 1299, 1300, 1301, 1302, 567, 563, 1310, + /* 260 */ 1311, 1313, 1314, 1315, 1316, 1318, 1321, 40, 38, 530, + /* 270 */ 1399, 1400, 1402, 1403, 160, 334, 140, 1242, 1456, 647, + /* 280 */ 160, 1465, 1750, 1376, 302, 1905, 160, 1007, 1317, 1006, + /* 290 */ 1240, 1266, 312, 1746, 310, 309, 69, 465, 157, 34, + /* 300 */ 33, 467, 1902, 41, 39, 37, 36, 35, 1280, 1509, + /* 310 */ 373, 1312, 372, 1905, 151, 14, 1339, 1008, 1575, 1742, + /* 320 */ 1748, 1248, 1732, 466, 40, 38, 1903, 1618, 477, 476, + /* 330 */ 1902, 565, 334, 475, 1242, 1506, 116, 472, 2, 553, + /* 340 */ 471, 470, 469, 474, 473, 1317, 1675, 1240, 295, 1098, + /* 350 */ 596, 595, 594, 1102, 593, 1104, 1105, 592, 1107, 589, + /* 360 */ 652, 1113, 586, 1115, 1116, 583, 580, 605, 1312, 160, + /* 370 */ 1340, 477, 476, 160, 1319, 1320, 475, 1464, 1248, 116, + /* 380 */ 472, 623, 621, 471, 470, 469, 129, 128, 602, 601, + /* 390 */ 600, 424, 556, 1345, 428, 8, 538, 629, 628, 627, + /* 400 */ 342, 1854, 626, 625, 624, 121, 619, 618, 617, 616, + /* 410 */ 615, 614, 613, 612, 131, 608, 321, 652, 1732, 1243, + /* 420 */ 204, 1241, 34, 33, 138, 1851, 41, 39, 37, 36, + /* 430 */ 35, 1319, 1320, 1581, 30, 332, 1334, 1335, 1336, 1337, + /* 440 */ 1338, 1342, 1343, 1344, 990, 1246, 1247, 1437, 1295, 1296, + /* 450 */ 1298, 1299, 1300, 1301, 1302, 567, 563, 1310, 1311, 1313, + /* 460 */ 1314, 1315, 1316, 1318, 1321, 34, 33, 467, 544, 41, + /* 470 */ 39, 37, 36, 35, 1631, 1854, 1243, 551, 1241, 71, + /* 480 */ 300, 322, 607, 510, 994, 995, 1463, 34, 33, 466, + /* 490 */ 1629, 41, 39, 37, 36, 35, 120, 1462, 1411, 1850, + /* 500 */ 23, 432, 1246, 1247, 428, 1295, 1296, 1298, 1299, 1300, + /* 510 */ 1301, 1302, 567, 563, 1310, 1311, 1313, 1314, 1315, 1316, + /* 520 */ 1318, 1321, 40, 38, 1322, 482, 365, 1732, 655, 544, + /* 530 */ 334, 1265, 1242, 337, 160, 1436, 118, 554, 1732, 302, + /* 540 */ 492, 138, 263, 1317, 1007, 1240, 1006, 520, 367, 363, + /* 550 */ 1581, 154, 1847, 1848, 203, 1852, 149, 120, 378, 461, + /* 560 */ 1720, 645, 641, 637, 633, 261, 1312, 533, 485, 167, + /* 570 */ 603, 1339, 479, 1622, 1008, 1579, 1248, 202, 549, 40, + /* 580 */ 38, 1762, 1266, 217, 218, 1461, 1854, 334, 508, 1242, + /* 590 */ 520, 85, 557, 9, 226, 67, 320, 118, 66, 1676, + /* 600 */ 1317, 111, 1240, 55, 1631, 1555, 54, 353, 468, 1780, + /* 610 */ 1849, 338, 246, 1847, 543, 652, 542, 572, 1579, 1905, + /* 620 */ 1629, 1060, 1732, 1312, 571, 1340, 1732, 517, 27, 1319, + /* 630 */ 1320, 1384, 157, 1248, 34, 33, 1902, 1266, 41, 39, + /* 640 */ 37, 36, 35, 1679, 300, 539, 534, 510, 1345, 1793, + /* 650 */ 9, 520, 1062, 88, 1763, 574, 1765, 1766, 570, 213, + /* 660 */ 565, 1460, 379, 1839, 607, 994, 995, 327, 1835, 1918, + /* 670 */ 1669, 1327, 652, 1674, 1243, 295, 1241, 1266, 1873, 1579, + /* 680 */ 1215, 169, 206, 37, 36, 35, 1319, 1320, 1556, 30, + /* 690 */ 332, 1334, 1335, 1336, 1337, 1338, 1342, 1343, 1344, 1459, + /* 700 */ 1246, 1247, 1732, 1295, 1296, 1298, 1299, 1300, 1301, 1302, + /* 710 */ 567, 563, 1310, 1311, 1313, 1314, 1315, 1316, 1318, 1321, + /* 720 */ 1445, 34, 33, 508, 1248, 41, 39, 37, 36, 35, + /* 730 */ 1341, 1243, 604, 1241, 1677, 1622, 268, 610, 77, 1609, + /* 740 */ 1732, 101, 7, 1458, 100, 99, 98, 97, 96, 95, + /* 750 */ 94, 93, 92, 1346, 1455, 1454, 1297, 1246, 1247, 1572, + /* 760 */ 1295, 1296, 1298, 1299, 1300, 1301, 1302, 567, 563, 1310, + /* 770 */ 1311, 1313, 1314, 1315, 1316, 1318, 1321, 40, 38, 297, + /* 780 */ 611, 1264, 1551, 605, 1732, 334, 599, 1242, 406, 1762, + /* 790 */ 520, 418, 1859, 1373, 28, 1732, 1732, 1391, 1317, 413, + /* 800 */ 1240, 383, 129, 128, 602, 601, 600, 340, 391, 520, + /* 810 */ 419, 1297, 393, 1453, 138, 138, 520, 1780, 1579, 1452, + /* 820 */ 398, 1312, 520, 1582, 1581, 572, 1451, 399, 29, 1568, + /* 830 */ 1732, 1248, 571, 441, 34, 33, 1496, 1579, 41, 39, + /* 840 */ 37, 36, 35, 384, 1579, 171, 170, 1457, 2, 1564, + /* 850 */ 1579, 1297, 500, 210, 1732, 45, 4, 1793, 478, 1566, + /* 860 */ 1732, 89, 1763, 574, 1765, 1766, 570, 1732, 565, 1450, + /* 870 */ 652, 1839, 1251, 34, 33, 1838, 1835, 41, 39, 37, + /* 880 */ 36, 35, 72, 417, 1319, 1320, 412, 411, 410, 409, + /* 890 */ 408, 405, 404, 403, 402, 401, 397, 396, 395, 394, + /* 900 */ 388, 387, 386, 385, 1449, 382, 381, 1762, 195, 197, + /* 910 */ 1732, 193, 196, 139, 520, 34, 33, 1491, 274, 41, + /* 920 */ 39, 37, 36, 35, 1373, 1576, 1562, 199, 1537, 1243, + /* 930 */ 198, 1241, 272, 57, 201, 1780, 56, 200, 207, 480, + /* 940 */ 52, 504, 1579, 548, 566, 1732, 561, 1448, 1732, 1762, + /* 950 */ 571, 598, 173, 421, 251, 1246, 1247, 1447, 1295, 1296, + /* 960 */ 1298, 1299, 1300, 1301, 1302, 567, 563, 1310, 1311, 1313, + /* 970 */ 1314, 1315, 1316, 1318, 1321, 1793, 520, 1780, 60, 88, + /* 980 */ 1763, 574, 1765, 1766, 570, 572, 565, 1708, 1732, 1839, + /* 990 */ 1732, 1489, 571, 327, 1835, 152, 1032, 1250, 1732, 11, + /* 1000 */ 10, 531, 622, 1254, 1579, 460, 549, 156, 42, 520, + /* 1010 */ 494, 1439, 1440, 483, 1781, 1865, 86, 1793, 1762, 190, + /* 1020 */ 501, 87, 1763, 574, 1765, 1766, 570, 1033, 565, 1752, + /* 1030 */ 1480, 1839, 1554, 144, 240, 301, 1835, 1579, 459, 455, + /* 1040 */ 451, 447, 189, 368, 520, 1619, 1780, 1905, 215, 1191, + /* 1050 */ 343, 64, 63, 377, 548, 505, 166, 545, 137, 1732, + /* 1060 */ 157, 571, 371, 1869, 1902, 250, 1754, 123, 70, 126, + /* 1070 */ 127, 187, 1579, 42, 520, 296, 1331, 50, 361, 245, + /* 1080 */ 359, 355, 351, 163, 346, 518, 1793, 520, 1762, 219, + /* 1090 */ 88, 1763, 574, 1765, 1766, 570, 232, 565, 519, 253, + /* 1100 */ 1839, 255, 1579, 42, 327, 1835, 152, 1242, 513, 3, + /* 1110 */ 225, 1091, 42, 5, 267, 1579, 1780, 160, 1398, 1264, + /* 1120 */ 1240, 345, 348, 352, 572, 307, 1866, 605, 1253, 1732, + /* 1130 */ 1060, 571, 578, 186, 179, 1207, 184, 235, 308, 264, + /* 1140 */ 438, 1762, 400, 520, 1347, 1671, 129, 128, 602, 601, + /* 1150 */ 600, 1248, 126, 1303, 257, 520, 1793, 168, 407, 177, + /* 1160 */ 88, 1763, 574, 1765, 1766, 570, 341, 565, 415, 1780, + /* 1170 */ 1839, 1579, 544, 1119, 327, 1835, 1918, 572, 325, 324, + /* 1180 */ 127, 1270, 1732, 1579, 571, 1896, 414, 420, 1256, 416, + /* 1190 */ 652, 422, 423, 1123, 112, 126, 431, 176, 1273, 1317, + /* 1200 */ 120, 1249, 434, 435, 178, 1762, 1272, 1274, 436, 1793, + /* 1210 */ 181, 437, 439, 88, 1763, 574, 1765, 1766, 570, 183, + /* 1220 */ 565, 1130, 1312, 1839, 1271, 1762, 440, 327, 1835, 1918, + /* 1230 */ 462, 185, 1248, 1780, 68, 1128, 130, 464, 1858, 443, + /* 1240 */ 118, 572, 188, 1713, 1569, 299, 1732, 265, 571, 1243, + /* 1250 */ 205, 1241, 192, 1780, 1565, 155, 1847, 1848, 91, 1852, + /* 1260 */ 194, 572, 549, 132, 133, 1567, 1732, 208, 571, 1563, + /* 1270 */ 495, 529, 134, 1793, 135, 1246, 1247, 281, 1763, 574, + /* 1280 */ 1765, 1766, 570, 502, 565, 1762, 212, 506, 499, 496, + /* 1290 */ 317, 528, 509, 1793, 514, 221, 1712, 89, 1763, 574, + /* 1300 */ 1765, 1766, 570, 1905, 565, 124, 1681, 1839, 511, 319, + /* 1310 */ 125, 560, 1835, 1780, 515, 516, 159, 223, 266, 1269, + /* 1320 */ 1902, 572, 76, 1580, 532, 524, 1732, 1870, 571, 230, + /* 1330 */ 1257, 541, 1252, 526, 527, 525, 326, 1880, 1762, 535, + /* 1340 */ 6, 234, 549, 523, 522, 1861, 1373, 244, 1268, 119, + /* 1350 */ 558, 242, 1762, 1793, 239, 241, 1260, 281, 1763, 574, + /* 1360 */ 1765, 1766, 570, 243, 565, 328, 1780, 563, 1310, 1311, + /* 1370 */ 1313, 1314, 1315, 1316, 569, 1879, 146, 1901, 1855, 1732, + /* 1380 */ 1780, 571, 555, 1905, 19, 1820, 249, 252, 572, 1921, + /* 1390 */ 78, 576, 1552, 1732, 269, 571, 157, 1623, 260, 648, + /* 1400 */ 1902, 145, 649, 651, 51, 552, 1793, 282, 271, 254, + /* 1410 */ 289, 1763, 574, 1765, 1766, 570, 568, 565, 562, 1811, + /* 1420 */ 1793, 1762, 292, 273, 89, 1763, 574, 1765, 1766, 570, + /* 1430 */ 1726, 565, 291, 1762, 1839, 559, 1725, 62, 1724, 1836, + /* 1440 */ 347, 1721, 350, 349, 1235, 1762, 1236, 164, 354, 1780, + /* 1450 */ 1719, 356, 357, 358, 318, 1718, 360, 572, 1717, 362, + /* 1460 */ 1716, 1780, 1732, 1715, 571, 364, 521, 366, 1698, 572, + /* 1470 */ 165, 369, 370, 1780, 1732, 1210, 571, 1209, 1692, 1691, + /* 1480 */ 375, 572, 376, 1690, 1689, 1179, 1732, 1664, 571, 1793, + /* 1490 */ 1663, 1662, 65, 290, 1763, 574, 1765, 1766, 570, 1661, + /* 1500 */ 565, 1793, 1660, 1762, 1659, 290, 1763, 574, 1765, 1766, + /* 1510 */ 570, 1658, 565, 1793, 1657, 389, 390, 285, 1763, 574, + /* 1520 */ 1765, 1766, 570, 1762, 565, 1656, 392, 1655, 34, 33, + /* 1530 */ 1654, 1780, 41, 39, 37, 36, 35, 1653, 1652, 572, + /* 1540 */ 122, 1641, 1640, 1639, 1732, 1651, 571, 1650, 1649, 1648, + /* 1550 */ 1647, 1780, 1646, 1645, 1644, 540, 331, 1643, 1642, 572, + /* 1560 */ 1638, 1637, 1636, 1635, 1732, 1634, 571, 1633, 1181, 1632, + /* 1570 */ 1510, 1793, 172, 1762, 1508, 142, 1763, 574, 1765, 1766, + /* 1580 */ 570, 1476, 565, 1475, 1706, 1762, 174, 997, 1700, 996, + /* 1590 */ 113, 1793, 1688, 1687, 114, 290, 1763, 574, 1765, 1766, + /* 1600 */ 570, 1780, 565, 182, 1280, 427, 1673, 150, 175, 569, + /* 1610 */ 180, 1558, 429, 1780, 1732, 1507, 571, 1026, 333, 1505, + /* 1620 */ 1920, 572, 444, 445, 446, 1503, 1732, 449, 571, 448, + /* 1630 */ 450, 1501, 452, 453, 454, 1499, 456, 1762, 458, 1488, + /* 1640 */ 1487, 1793, 1472, 457, 1560, 289, 1763, 574, 1765, 1766, + /* 1650 */ 570, 1134, 565, 1793, 1812, 1133, 1559, 290, 1763, 574, + /* 1660 */ 1765, 1766, 570, 1762, 565, 1780, 620, 1059, 191, 49, + /* 1670 */ 335, 1058, 1057, 572, 1497, 313, 1056, 622, 1732, 1492, + /* 1680 */ 571, 1053, 1052, 1051, 314, 1490, 315, 481, 1471, 484, + /* 1690 */ 486, 1780, 1470, 488, 1469, 490, 90, 1705, 1699, 572, + /* 1700 */ 1217, 136, 497, 1686, 1732, 1793, 571, 1684, 1685, 290, + /* 1710 */ 1763, 574, 1765, 1766, 570, 1227, 565, 1683, 1762, 1682, + /* 1720 */ 1680, 1672, 222, 53, 227, 42, 15, 209, 1258, 214, + /* 1730 */ 1762, 1793, 220, 498, 74, 275, 1763, 574, 1765, 1766, + /* 1740 */ 570, 316, 565, 75, 16, 80, 1780, 48, 238, 512, + /* 1750 */ 224, 503, 24, 229, 572, 1413, 231, 237, 1780, 1732, + /* 1760 */ 233, 571, 1752, 1425, 247, 1395, 572, 26, 1397, 143, + /* 1770 */ 236, 1732, 25, 571, 1390, 1370, 79, 47, 1751, 1369, + /* 1780 */ 1762, 147, 18, 1430, 1419, 1424, 1793, 329, 1429, 1428, + /* 1790 */ 276, 1763, 574, 1765, 1766, 570, 1762, 565, 1793, 330, + /* 1800 */ 10, 20, 277, 1763, 574, 1765, 1766, 570, 1780, 565, + /* 1810 */ 1332, 1307, 1796, 564, 32, 17, 572, 1305, 148, 161, + /* 1820 */ 1304, 1732, 1288, 571, 1780, 46, 12, 21, 22, 577, + /* 1830 */ 13, 575, 572, 1120, 336, 1117, 581, 1732, 579, 571, + /* 1840 */ 582, 584, 573, 1114, 585, 587, 1108, 1106, 1793, 588, + /* 1850 */ 590, 591, 284, 1763, 574, 1765, 1766, 570, 1762, 565, + /* 1860 */ 1097, 81, 82, 1112, 1793, 597, 1129, 1111, 286, 1763, + /* 1870 */ 574, 1765, 1766, 570, 59, 565, 1110, 1762, 1109, 258, + /* 1880 */ 1125, 1024, 606, 1048, 1066, 609, 1780, 259, 1046, 1045, + /* 1890 */ 1044, 1043, 1042, 1063, 572, 1041, 1040, 1039, 1061, 1732, + /* 1900 */ 1036, 571, 1035, 1034, 1031, 1780, 1504, 1030, 1502, 1029, + /* 1910 */ 630, 631, 634, 572, 1500, 632, 638, 635, 1732, 1762, + /* 1920 */ 571, 636, 640, 1498, 642, 639, 1793, 643, 1486, 644, + /* 1930 */ 278, 1763, 574, 1765, 1766, 570, 646, 565, 987, 1468, + /* 1940 */ 262, 650, 1443, 1443, 1244, 1793, 270, 1780, 653, 287, + /* 1950 */ 1763, 574, 1765, 1766, 570, 572, 565, 654, 1443, 1443, + /* 1960 */ 1732, 1762, 571, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 1970 */ 1443, 1762, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 1980 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1793, 1443, 1780, + /* 1990 */ 1443, 279, 1763, 574, 1765, 1766, 570, 572, 565, 1780, + /* 2000 */ 1443, 1443, 1732, 1443, 571, 1443, 1443, 572, 1443, 1443, + /* 2010 */ 1443, 1443, 1732, 1443, 571, 1443, 1443, 1443, 1443, 1443, + /* 2020 */ 1443, 1443, 1443, 1762, 1443, 1443, 1443, 1443, 1443, 1793, + /* 2030 */ 1443, 1443, 1443, 288, 1763, 574, 1765, 1766, 570, 1793, + /* 2040 */ 565, 1443, 1443, 280, 1763, 574, 1765, 1766, 570, 1762, + /* 2050 */ 565, 1780, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 572, + /* 2060 */ 1443, 1443, 1443, 1443, 1732, 1762, 571, 1443, 1443, 1443, + /* 2070 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1780, 1443, 1443, + /* 2080 */ 1443, 1443, 1443, 1443, 1443, 572, 1443, 1443, 1443, 1443, + /* 2090 */ 1732, 1793, 571, 1780, 1443, 293, 1763, 574, 1765, 1766, + /* 2100 */ 570, 572, 565, 1443, 1443, 1443, 1732, 1443, 571, 1443, + /* 2110 */ 1443, 1443, 1443, 1443, 1443, 1762, 1443, 1793, 1443, 1443, + /* 2120 */ 1443, 294, 1763, 574, 1765, 1766, 570, 1762, 565, 1443, + /* 2130 */ 1443, 1443, 1443, 1793, 1443, 1443, 1443, 1774, 1763, 574, + /* 2140 */ 1765, 1766, 570, 1780, 565, 1443, 1443, 1443, 1443, 1443, + /* 2150 */ 1443, 572, 1443, 1443, 1443, 1780, 1732, 1443, 571, 1443, + /* 2160 */ 1443, 1443, 1443, 572, 1443, 1443, 1443, 1443, 1732, 1443, + /* 2170 */ 571, 1443, 1443, 1443, 1443, 1443, 1443, 1762, 1443, 1443, + /* 2180 */ 1443, 1443, 1443, 1793, 1443, 1443, 1443, 1773, 1763, 574, + /* 2190 */ 1765, 1766, 570, 1443, 565, 1793, 1443, 1443, 1443, 1772, + /* 2200 */ 1763, 574, 1765, 1766, 570, 1780, 565, 1443, 1443, 1443, + /* 2210 */ 1443, 1443, 1443, 572, 1443, 1443, 1443, 1443, 1732, 1762, + /* 2220 */ 571, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 2230 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 2240 */ 1443, 1443, 1443, 1443, 1443, 1793, 1443, 1780, 1443, 305, + /* 2250 */ 1763, 574, 1765, 1766, 570, 572, 565, 1443, 1443, 1443, + /* 2260 */ 1732, 1762, 571, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 2270 */ 1443, 1762, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 2280 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1793, 1443, 1780, + /* 2290 */ 1443, 304, 1763, 574, 1765, 1766, 570, 572, 565, 1780, + /* 2300 */ 1443, 1443, 1732, 1443, 571, 1443, 1443, 572, 1443, 1443, + /* 2310 */ 1443, 1443, 1732, 1443, 571, 1443, 1443, 1443, 1443, 1443, + /* 2320 */ 1443, 1762, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1793, + /* 2330 */ 1443, 1443, 1443, 306, 1763, 574, 1765, 1766, 570, 1793, + /* 2340 */ 565, 1443, 1443, 303, 1763, 574, 1765, 1766, 570, 1780, + /* 2350 */ 565, 1443, 1443, 1443, 1443, 1443, 1443, 572, 1443, 1443, + /* 2360 */ 1443, 1443, 1732, 1443, 571, 1443, 1443, 1443, 1443, 1443, + /* 2370 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, + /* 2380 */ 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1793, + /* 2390 */ 1443, 1443, 1443, 283, 1763, 574, 1765, 1766, 570, 1443, + /* 2400 */ 565, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 259, 284, 261, 262, 353, 259, 252, 261, 262, 267, - /* 10 */ 267, 263, 12, 13, 285, 268, 283, 366, 263, 272, - /* 20 */ 20, 370, 22, 280, 291, 296, 12, 13, 14, 15, - /* 30 */ 16, 289, 289, 33, 21, 35, 285, 24, 25, 26, - /* 40 */ 27, 28, 29, 30, 31, 32, 291, 296, 300, 20, - /* 50 */ 285, 322, 323, 324, 294, 255, 56, 297, 298, 59, - /* 60 */ 20, 296, 329, 334, 58, 65, 312, 312, 20, 12, - /* 70 */ 13, 14, 263, 322, 323, 0, 353, 20, 254, 22, - /* 80 */ 256, 56, 82, 283, 20, 334, 331, 322, 323, 366, - /* 90 */ 33, 291, 35, 370, 312, 94, 296, 353, 298, 334, - /* 100 */ 291, 346, 347, 348, 104, 350, 81, 353, 353, 84, - /* 110 */ 366, 82, 312, 56, 370, 35, 59, 116, 118, 119, - /* 120 */ 366, 366, 65, 323, 370, 370, 20, 327, 328, 329, - /* 130 */ 330, 331, 332, 58, 334, 353, 82, 337, 14, 82, - /* 140 */ 331, 341, 342, 263, 20, 65, 82, 20, 366, 282, - /* 150 */ 19, 56, 370, 353, 345, 346, 347, 348, 20, 350, - /* 160 */ 22, 104, 295, 163, 33, 165, 366, 338, 339, 4, - /* 170 */ 370, 291, 20, 35, 275, 118, 119, 82, 47, 84, - /* 180 */ 58, 114, 283, 52, 53, 54, 55, 56, 50, 189, - /* 190 */ 190, 292, 192, 193, 194, 195, 196, 197, 198, 199, - /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 44, - /* 210 */ 45, 331, 81, 14, 260, 84, 162, 263, 164, 20, - /* 220 */ 163, 221, 165, 76, 118, 119, 346, 347, 348, 20, - /* 230 */ 350, 8, 9, 37, 298, 12, 13, 14, 15, 16, - /* 240 */ 173, 174, 306, 263, 177, 309, 189, 190, 117, 192, + /* 0 */ 339, 340, 266, 260, 264, 262, 263, 269, 253, 284, + /* 10 */ 286, 273, 12, 13, 286, 279, 260, 292, 262, 263, + /* 20 */ 20, 297, 22, 287, 313, 297, 12, 13, 14, 15, + /* 30 */ 16, 20, 292, 33, 21, 35, 264, 24, 25, 26, + /* 40 */ 27, 28, 29, 30, 31, 32, 20, 323, 324, 325, + /* 50 */ 20, 323, 324, 313, 268, 330, 56, 256, 313, 335, + /* 60 */ 60, 20, 4, 335, 4, 354, 66, 281, 313, 12, + /* 70 */ 13, 14, 332, 301, 264, 264, 290, 20, 367, 22, + /* 80 */ 256, 59, 371, 83, 20, 284, 275, 347, 348, 349, + /* 90 */ 33, 351, 35, 292, 354, 14, 1, 2, 297, 354, + /* 100 */ 299, 20, 292, 292, 256, 105, 20, 367, 56, 354, + /* 110 */ 256, 371, 367, 56, 313, 0, 371, 60, 20, 119, + /* 120 */ 120, 297, 367, 66, 295, 324, 371, 298, 299, 328, + /* 130 */ 329, 330, 331, 332, 333, 83, 335, 85, 284, 338, + /* 140 */ 83, 83, 332, 342, 343, 297, 292, 83, 114, 119, + /* 150 */ 120, 297, 264, 299, 354, 354, 346, 347, 348, 349, + /* 160 */ 21, 351, 105, 275, 164, 284, 166, 367, 367, 83, + /* 170 */ 282, 371, 371, 34, 59, 36, 119, 120, 324, 84, + /* 180 */ 292, 300, 328, 329, 330, 331, 332, 333, 0, 335, + /* 190 */ 190, 191, 151, 193, 194, 195, 196, 197, 198, 199, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 210 */ 176, 177, 24, 25, 26, 27, 28, 29, 30, 31, + /* 220 */ 32, 164, 222, 166, 298, 299, 372, 373, 190, 354, + /* 230 */ 83, 0, 8, 9, 83, 83, 12, 13, 14, 15, + /* 240 */ 16, 3, 367, 37, 313, 93, 371, 190, 191, 151, /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - /* 260 */ 203, 204, 205, 206, 207, 208, 12, 13, 0, 122, - /* 270 */ 123, 291, 283, 0, 20, 221, 22, 113, 114, 290, - /* 280 */ 149, 85, 59, 87, 88, 221, 90, 33, 299, 35, - /* 290 */ 94, 148, 24, 25, 26, 27, 28, 29, 30, 31, - /* 300 */ 32, 170, 255, 172, 263, 260, 83, 263, 263, 263, - /* 310 */ 56, 331, 116, 59, 91, 274, 221, 193, 274, 65, - /* 320 */ 274, 4, 281, 12, 13, 281, 346, 347, 348, 82, - /* 330 */ 350, 20, 291, 22, 0, 291, 82, 291, 174, 14, - /* 340 */ 255, 177, 65, 296, 33, 20, 35, 95, 96, 97, - /* 350 */ 98, 99, 100, 101, 102, 103, 104, 105, 104, 107, - /* 360 */ 108, 109, 110, 111, 112, 0, 263, 56, 145, 226, - /* 370 */ 227, 293, 118, 119, 296, 255, 65, 274, 14, 15, - /* 380 */ 16, 296, 8, 9, 297, 298, 12, 13, 14, 15, - /* 390 */ 16, 168, 193, 82, 291, 61, 62, 63, 64, 82, - /* 400 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - /* 410 */ 76, 77, 78, 79, 93, 104, 296, 163, 325, 165, - /* 420 */ 8, 9, 189, 58, 12, 13, 14, 15, 16, 118, - /* 430 */ 119, 0, 209, 210, 211, 212, 213, 214, 215, 216, - /* 440 */ 217, 218, 349, 189, 190, 65, 192, 193, 194, 195, - /* 450 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - /* 460 */ 206, 207, 208, 230, 231, 232, 233, 234, 221, 263, - /* 470 */ 61, 62, 269, 270, 163, 66, 165, 284, 69, 70, - /* 480 */ 274, 265, 73, 74, 75, 8, 9, 1, 2, 12, - /* 490 */ 13, 14, 15, 16, 278, 83, 20, 291, 22, 56, - /* 500 */ 189, 190, 286, 192, 193, 194, 195, 196, 197, 198, - /* 510 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - /* 520 */ 12, 13, 14, 275, 4, 94, 50, 84, 20, 155, - /* 530 */ 22, 283, 221, 0, 312, 33, 59, 284, 221, 19, - /* 540 */ 292, 33, 275, 35, 113, 114, 115, 116, 117, 47, - /* 550 */ 283, 263, 316, 33, 52, 53, 54, 55, 56, 292, - /* 560 */ 265, 263, 274, 263, 56, 269, 270, 47, 91, 83, - /* 570 */ 312, 51, 274, 65, 274, 353, 56, 12, 13, 291, - /* 580 */ 283, 286, 263, 81, 3, 20, 84, 22, 366, 291, - /* 590 */ 82, 291, 370, 274, 61, 62, 299, 158, 33, 66, - /* 600 */ 35, 81, 69, 70, 84, 263, 73, 74, 75, 39, - /* 610 */ 291, 353, 104, 308, 263, 310, 274, 243, 263, 180, - /* 620 */ 181, 56, 145, 4, 366, 274, 118, 119, 370, 274, - /* 630 */ 65, 8, 9, 291, 255, 12, 13, 14, 15, 16, - /* 640 */ 44, 45, 291, 283, 255, 168, 291, 82, 146, 147, - /* 650 */ 290, 149, 325, 20, 263, 153, 8, 9, 255, 299, - /* 660 */ 12, 13, 14, 15, 16, 274, 43, 291, 263, 104, - /* 670 */ 308, 163, 310, 165, 172, 296, 349, 113, 302, 274, - /* 680 */ 255, 43, 291, 118, 119, 296, 209, 210, 211, 212, - /* 690 */ 213, 214, 215, 216, 217, 218, 291, 189, 190, 296, - /* 700 */ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - /* 710 */ 202, 203, 204, 205, 206, 207, 208, 0, 8, 9, - /* 720 */ 21, 296, 12, 13, 14, 15, 16, 325, 163, 293, - /* 730 */ 165, 83, 296, 34, 276, 36, 255, 279, 21, 175, - /* 740 */ 176, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 750 */ 271, 349, 273, 263, 189, 190, 0, 192, 193, 194, - /* 760 */ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - /* 770 */ 205, 206, 207, 208, 12, 13, 18, 296, 20, 43, - /* 780 */ 263, 291, 20, 150, 22, 27, 256, 255, 30, 263, - /* 790 */ 220, 274, 94, 83, 255, 33, 20, 35, 284, 298, - /* 800 */ 274, 145, 312, 47, 255, 47, 20, 49, 291, 51, - /* 810 */ 309, 113, 114, 115, 116, 117, 35, 291, 56, 238, - /* 820 */ 263, 331, 219, 220, 168, 42, 43, 65, 296, 150, - /* 830 */ 151, 274, 255, 283, 255, 296, 346, 347, 348, 81, - /* 840 */ 350, 222, 292, 353, 82, 296, 8, 9, 291, 364, - /* 850 */ 12, 13, 14, 15, 16, 86, 366, 284, 89, 255, - /* 860 */ 370, 22, 255, 8, 9, 209, 104, 12, 13, 14, - /* 870 */ 15, 16, 255, 296, 35, 296, 284, 35, 240, 121, - /* 880 */ 118, 119, 124, 125, 126, 127, 128, 129, 130, 131, - /* 890 */ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - /* 900 */ 296, 143, 144, 296, 65, 2, 255, 1, 2, 18, - /* 910 */ 43, 8, 9, 296, 23, 12, 13, 14, 15, 16, - /* 920 */ 0, 86, 118, 119, 89, 163, 150, 165, 37, 38, - /* 930 */ 255, 0, 41, 255, 86, 86, 43, 89, 89, 59, - /* 940 */ 272, 46, 43, 104, 255, 284, 165, 296, 57, 373, - /* 950 */ 83, 189, 190, 22, 192, 193, 194, 195, 196, 197, - /* 960 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - /* 970 */ 208, 296, 283, 82, 296, 43, 83, 82, 242, 193, - /* 980 */ 291, 319, 83, 2, 0, 296, 0, 298, 150, 8, - /* 990 */ 9, 264, 43, 12, 13, 14, 15, 16, 43, 43, - /* 1000 */ 43, 312, 163, 43, 165, 43, 22, 165, 22, 43, - /* 1010 */ 360, 120, 323, 43, 94, 83, 327, 328, 329, 330, - /* 1020 */ 331, 332, 255, 334, 0, 283, 337, 264, 189, 190, - /* 1030 */ 341, 342, 83, 113, 114, 115, 116, 117, 83, 83, - /* 1040 */ 83, 43, 353, 83, 43, 83, 155, 156, 157, 83, - /* 1050 */ 283, 160, 43, 83, 82, 366, 35, 166, 291, 370, - /* 1060 */ 262, 295, 43, 296, 92, 298, 326, 351, 344, 189, - /* 1070 */ 179, 367, 48, 182, 367, 184, 185, 186, 187, 188, - /* 1080 */ 367, 83, 354, 255, 83, 223, 65, 20, 263, 321, - /* 1090 */ 323, 47, 83, 320, 327, 328, 329, 330, 331, 332, - /* 1100 */ 255, 334, 83, 35, 337, 269, 161, 314, 341, 342, - /* 1110 */ 343, 283, 221, 263, 263, 42, 303, 301, 145, 291, - /* 1120 */ 301, 263, 355, 20, 296, 257, 298, 257, 283, 20, - /* 1130 */ 363, 267, 318, 267, 20, 298, 291, 311, 20, 267, - /* 1140 */ 313, 296, 311, 298, 267, 20, 267, 304, 267, 263, - /* 1150 */ 267, 323, 283, 255, 257, 327, 328, 329, 330, 331, - /* 1160 */ 332, 283, 334, 171, 318, 337, 307, 283, 323, 341, - /* 1170 */ 342, 343, 327, 328, 329, 330, 331, 332, 257, 334, - /* 1180 */ 263, 283, 337, 283, 283, 283, 341, 342, 343, 291, - /* 1190 */ 283, 363, 283, 283, 296, 283, 298, 352, 283, 12, - /* 1200 */ 13, 296, 265, 265, 317, 263, 298, 263, 255, 22, - /* 1210 */ 228, 265, 296, 147, 296, 311, 305, 291, 296, 296, - /* 1220 */ 33, 323, 35, 296, 265, 327, 328, 329, 330, 331, - /* 1230 */ 332, 307, 334, 304, 265, 337, 283, 279, 291, 341, - /* 1240 */ 342, 343, 20, 56, 291, 326, 296, 229, 359, 296, - /* 1250 */ 352, 298, 65, 359, 362, 307, 154, 296, 307, 296, - /* 1260 */ 296, 296, 235, 237, 236, 224, 220, 291, 20, 239, - /* 1270 */ 241, 82, 255, 359, 361, 321, 323, 325, 244, 82, - /* 1280 */ 327, 328, 329, 330, 331, 332, 255, 334, 358, 356, - /* 1290 */ 337, 104, 357, 368, 341, 342, 343, 369, 255, 287, - /* 1300 */ 283, 296, 263, 369, 36, 352, 273, 368, 291, 369, - /* 1310 */ 374, 368, 265, 296, 283, 298, 258, 340, 257, 315, - /* 1320 */ 310, 266, 291, 253, 0, 277, 283, 296, 277, 298, - /* 1330 */ 277, 0, 42, 0, 291, 73, 0, 35, 183, 296, - /* 1340 */ 323, 298, 35, 312, 327, 328, 329, 330, 331, 332, - /* 1350 */ 163, 334, 165, 35, 323, 312, 35, 183, 327, 328, - /* 1360 */ 329, 330, 331, 332, 0, 334, 323, 255, 183, 35, - /* 1370 */ 327, 328, 329, 330, 331, 332, 189, 334, 35, 0, - /* 1380 */ 0, 183, 365, 35, 353, 0, 0, 200, 201, 202, - /* 1390 */ 203, 204, 205, 206, 22, 283, 353, 366, 35, 0, - /* 1400 */ 168, 370, 82, 291, 167, 165, 163, 0, 296, 366, - /* 1410 */ 298, 0, 159, 370, 158, 0, 0, 46, 0, 0, - /* 1420 */ 0, 142, 0, 0, 255, 0, 0, 0, 137, 35, - /* 1430 */ 0, 137, 0, 0, 0, 323, 0, 0, 0, 327, - /* 1440 */ 328, 329, 330, 331, 332, 255, 334, 0, 0, 337, - /* 1450 */ 0, 0, 283, 341, 342, 0, 0, 0, 0, 42, - /* 1460 */ 291, 0, 0, 0, 0, 296, 0, 298, 0, 0, - /* 1470 */ 0, 22, 0, 283, 43, 46, 0, 42, 39, 14, - /* 1480 */ 40, 291, 0, 0, 0, 14, 296, 46, 298, 0, - /* 1490 */ 0, 39, 323, 39, 154, 0, 327, 328, 329, 330, - /* 1500 */ 331, 332, 0, 334, 0, 255, 337, 0, 0, 0, - /* 1510 */ 341, 342, 35, 323, 39, 0, 0, 327, 328, 329, - /* 1520 */ 330, 331, 332, 333, 334, 335, 336, 60, 47, 35, - /* 1530 */ 39, 35, 47, 283, 47, 0, 39, 39, 35, 47, - /* 1540 */ 0, 291, 0, 0, 0, 35, 296, 22, 298, 89, - /* 1550 */ 91, 0, 35, 35, 35, 35, 43, 43, 35, 35, - /* 1560 */ 0, 255, 35, 22, 0, 0, 35, 22, 22, 0, - /* 1570 */ 49, 35, 0, 323, 35, 0, 22, 327, 328, 329, - /* 1580 */ 330, 331, 332, 255, 334, 0, 20, 35, 0, 283, - /* 1590 */ 169, 0, 150, 22, 150, 0, 150, 291, 0, 0, - /* 1600 */ 147, 0, 296, 0, 298, 83, 178, 0, 82, 39, - /* 1610 */ 82, 283, 82, 46, 82, 225, 288, 43, 22, 291, - /* 1620 */ 83, 371, 372, 43, 296, 152, 298, 148, 225, 323, - /* 1630 */ 92, 82, 146, 327, 328, 329, 330, 331, 332, 82, - /* 1640 */ 334, 83, 83, 337, 255, 82, 46, 43, 342, 225, - /* 1650 */ 82, 323, 46, 43, 46, 327, 328, 329, 330, 331, - /* 1660 */ 332, 82, 334, 82, 255, 83, 83, 83, 82, 43, - /* 1670 */ 83, 46, 283, 46, 43, 83, 83, 288, 35, 2, - /* 1680 */ 291, 35, 35, 35, 35, 296, 35, 298, 189, 22, - /* 1690 */ 93, 82, 283, 43, 83, 82, 82, 219, 83, 83, - /* 1700 */ 291, 46, 46, 82, 82, 296, 82, 298, 35, 35, - /* 1710 */ 35, 83, 323, 83, 82, 82, 327, 328, 329, 330, - /* 1720 */ 331, 332, 83, 334, 191, 35, 35, 82, 35, 255, - /* 1730 */ 22, 94, 323, 35, 22, 83, 327, 328, 329, 330, - /* 1740 */ 331, 332, 82, 334, 83, 82, 106, 106, 255, 60, - /* 1750 */ 82, 82, 82, 43, 59, 35, 80, 283, 43, 106, - /* 1760 */ 106, 65, 288, 35, 35, 291, 35, 35, 35, 22, - /* 1770 */ 296, 35, 298, 35, 65, 35, 283, 35, 35, 35, - /* 1780 */ 35, 372, 0, 35, 291, 35, 35, 0, 47, 296, - /* 1790 */ 35, 298, 39, 47, 0, 39, 35, 323, 39, 47, - /* 1800 */ 0, 327, 328, 329, 330, 331, 332, 35, 334, 47, - /* 1810 */ 39, 0, 35, 35, 0, 22, 323, 255, 21, 21, - /* 1820 */ 327, 328, 329, 330, 331, 332, 22, 334, 22, 336, - /* 1830 */ 20, 375, 375, 255, 375, 375, 375, 375, 375, 375, - /* 1840 */ 375, 375, 375, 375, 375, 283, 375, 375, 375, 375, - /* 1850 */ 288, 375, 375, 291, 375, 375, 375, 375, 296, 375, - /* 1860 */ 298, 283, 375, 375, 375, 375, 288, 375, 375, 291, - /* 1870 */ 375, 375, 375, 375, 296, 255, 298, 375, 375, 375, - /* 1880 */ 375, 375, 375, 375, 375, 323, 375, 375, 375, 327, - /* 1890 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 255, - /* 1900 */ 375, 323, 375, 283, 375, 327, 328, 329, 330, 331, - /* 1910 */ 332, 291, 334, 375, 375, 375, 296, 375, 298, 375, - /* 1920 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, - /* 1930 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, - /* 1940 */ 296, 255, 298, 323, 375, 375, 375, 327, 328, 329, - /* 1950 */ 330, 331, 332, 375, 334, 375, 375, 375, 375, 375, - /* 1960 */ 375, 255, 375, 375, 375, 375, 375, 323, 375, 283, - /* 1970 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, - /* 1980 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 283, - /* 1990 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, - /* 2000 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 323, - /* 2010 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, - /* 2020 */ 334, 255, 375, 375, 375, 375, 375, 375, 375, 323, - /* 2030 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, - /* 2040 */ 334, 375, 375, 375, 375, 255, 375, 375, 375, 283, - /* 2050 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, - /* 2060 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, - /* 2070 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, - /* 2080 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 323, - /* 2090 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, - /* 2100 */ 334, 255, 375, 375, 375, 375, 375, 375, 375, 375, - /* 2110 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, - /* 2120 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 283, - /* 2130 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, - /* 2140 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, - /* 2150 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, - /* 2160 */ 375, 291, 375, 375, 375, 375, 296, 255, 298, 323, - /* 2170 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 375, - /* 2180 */ 334, 375, 375, 255, 375, 375, 375, 375, 375, 375, - /* 2190 */ 375, 375, 375, 323, 375, 283, 375, 327, 328, 329, - /* 2200 */ 330, 331, 332, 291, 334, 375, 375, 375, 296, 375, - /* 2210 */ 298, 283, 375, 375, 375, 375, 375, 375, 375, 291, - /* 2220 */ 375, 375, 375, 375, 296, 255, 298, 375, 375, 375, - /* 2230 */ 375, 375, 375, 375, 375, 323, 375, 375, 375, 327, - /* 2240 */ 328, 329, 330, 331, 332, 255, 334, 375, 375, 375, - /* 2250 */ 375, 323, 375, 283, 375, 327, 328, 329, 330, 331, - /* 2260 */ 332, 291, 334, 375, 375, 375, 296, 375, 298, 375, - /* 2270 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, - /* 2280 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, - /* 2290 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, - /* 2300 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 375, - /* 2310 */ 375, 375, 375, 323, 375, 375, 375, 327, 328, 329, - /* 2320 */ 330, 331, 332, 375, 334, 375, 375, 375, 375, 255, - /* 2330 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, - /* 2340 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, - /* 2350 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, - /* 2360 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, - /* 2370 */ 296, 375, 298, 323, 375, 375, 375, 327, 328, 329, - /* 2380 */ 330, 331, 332, 375, 334, 255, 375, 375, 375, 375, - /* 2390 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 375, - /* 2400 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 255, - /* 2410 */ 375, 375, 375, 283, 375, 375, 375, 375, 375, 375, - /* 2420 */ 375, 291, 375, 375, 375, 375, 296, 375, 298, 375, - /* 2430 */ 375, 375, 375, 375, 375, 375, 375, 283, 375, 375, - /* 2440 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, - /* 2450 */ 296, 255, 298, 323, 375, 375, 375, 327, 328, 329, - /* 2460 */ 330, 331, 332, 375, 334, 375, 375, 255, 375, 375, - /* 2470 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 283, - /* 2480 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, - /* 2490 */ 375, 375, 296, 375, 298, 283, 375, 375, 375, 375, - /* 2500 */ 375, 375, 375, 291, 375, 375, 375, 375, 296, 255, - /* 2510 */ 298, 375, 375, 375, 375, 375, 375, 375, 375, 323, - /* 2520 */ 375, 375, 375, 327, 328, 329, 330, 331, 332, 255, - /* 2530 */ 334, 375, 375, 375, 375, 323, 375, 283, 375, 327, - /* 2540 */ 328, 329, 330, 331, 332, 291, 334, 375, 375, 375, - /* 2550 */ 296, 375, 298, 375, 375, 375, 375, 283, 375, 375, - /* 2560 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, - /* 2570 */ 296, 375, 298, 375, 375, 375, 375, 323, 375, 375, - /* 2580 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 375, - /* 2590 */ 375, 375, 375, 375, 375, 375, 375, 323, 375, 375, - /* 2600 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, + /* 260 */ 203, 204, 205, 206, 207, 208, 209, 12, 13, 231, + /* 270 */ 232, 233, 234, 235, 222, 20, 255, 22, 257, 48, + /* 280 */ 222, 256, 286, 223, 60, 354, 222, 20, 33, 22, + /* 290 */ 35, 20, 86, 297, 88, 89, 268, 91, 367, 8, + /* 300 */ 9, 95, 371, 12, 13, 14, 15, 16, 84, 0, + /* 310 */ 163, 56, 165, 354, 283, 60, 92, 50, 290, 323, + /* 320 */ 324, 66, 297, 117, 12, 13, 367, 296, 62, 63, + /* 330 */ 371, 335, 20, 67, 22, 0, 70, 71, 83, 43, + /* 340 */ 74, 75, 76, 270, 271, 33, 309, 35, 311, 96, + /* 350 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + /* 360 */ 105, 108, 109, 110, 111, 112, 113, 95, 56, 222, + /* 370 */ 146, 62, 63, 222, 119, 120, 67, 256, 66, 70, + /* 380 */ 71, 270, 271, 74, 75, 76, 114, 115, 116, 117, + /* 390 */ 118, 261, 43, 169, 264, 83, 20, 62, 63, 64, + /* 400 */ 65, 326, 67, 68, 69, 70, 71, 72, 73, 74, + /* 410 */ 75, 76, 77, 78, 79, 80, 276, 105, 297, 164, + /* 420 */ 115, 166, 8, 9, 284, 350, 12, 13, 14, 15, + /* 430 */ 16, 119, 120, 293, 210, 211, 212, 213, 214, 215, + /* 440 */ 216, 217, 218, 219, 4, 190, 191, 156, 193, 194, + /* 450 */ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + /* 460 */ 205, 206, 207, 208, 209, 8, 9, 95, 264, 12, + /* 470 */ 13, 14, 15, 16, 284, 326, 164, 239, 166, 174, + /* 480 */ 175, 291, 59, 178, 44, 45, 256, 8, 9, 117, + /* 490 */ 300, 12, 13, 14, 15, 16, 292, 256, 84, 350, + /* 500 */ 43, 261, 190, 191, 264, 193, 194, 195, 196, 197, + /* 510 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + /* 520 */ 208, 209, 12, 13, 14, 4, 159, 297, 19, 264, + /* 530 */ 20, 20, 22, 276, 222, 244, 332, 241, 297, 60, + /* 540 */ 19, 284, 33, 33, 20, 35, 22, 264, 181, 182, + /* 550 */ 293, 347, 348, 349, 33, 351, 47, 292, 275, 35, + /* 560 */ 0, 52, 53, 54, 55, 56, 56, 149, 47, 56, + /* 570 */ 294, 92, 51, 297, 50, 292, 66, 56, 313, 12, + /* 580 */ 13, 256, 20, 114, 115, 256, 326, 20, 299, 22, + /* 590 */ 264, 82, 243, 83, 85, 82, 307, 332, 85, 310, + /* 600 */ 33, 275, 35, 82, 284, 0, 85, 47, 282, 284, + /* 610 */ 350, 291, 347, 348, 349, 105, 351, 292, 292, 354, + /* 620 */ 300, 35, 297, 56, 299, 146, 297, 118, 2, 119, + /* 630 */ 120, 14, 367, 66, 8, 9, 371, 20, 12, 13, + /* 640 */ 14, 15, 16, 0, 175, 227, 228, 178, 169, 324, + /* 650 */ 83, 264, 66, 328, 329, 330, 331, 332, 333, 150, + /* 660 */ 335, 256, 275, 338, 59, 44, 45, 342, 343, 344, + /* 670 */ 292, 14, 105, 309, 164, 311, 166, 20, 353, 292, + /* 680 */ 171, 303, 173, 14, 15, 16, 119, 120, 0, 210, + /* 690 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 256, + /* 700 */ 190, 191, 297, 193, 194, 195, 196, 197, 198, 199, + /* 710 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 720 */ 0, 8, 9, 299, 66, 12, 13, 14, 15, 16, + /* 730 */ 146, 164, 294, 166, 310, 297, 277, 66, 266, 280, + /* 740 */ 297, 21, 39, 256, 24, 25, 26, 27, 28, 29, + /* 750 */ 30, 31, 32, 169, 256, 256, 194, 190, 191, 287, + /* 760 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + /* 770 */ 203, 204, 205, 206, 207, 208, 209, 12, 13, 18, + /* 780 */ 272, 20, 274, 95, 297, 20, 94, 22, 27, 256, + /* 790 */ 264, 30, 220, 221, 210, 297, 297, 84, 33, 77, + /* 800 */ 35, 275, 114, 115, 116, 117, 118, 276, 47, 264, + /* 810 */ 49, 194, 51, 256, 284, 284, 264, 284, 292, 256, + /* 820 */ 275, 56, 264, 293, 293, 292, 256, 275, 2, 285, + /* 830 */ 297, 66, 299, 275, 8, 9, 0, 292, 12, 13, + /* 840 */ 14, 15, 16, 82, 292, 123, 124, 257, 83, 285, + /* 850 */ 292, 194, 317, 56, 297, 42, 43, 324, 22, 285, + /* 860 */ 297, 328, 329, 330, 331, 332, 333, 297, 335, 256, + /* 870 */ 105, 338, 35, 8, 9, 342, 343, 12, 13, 14, + /* 880 */ 15, 16, 85, 122, 119, 120, 125, 126, 127, 128, + /* 890 */ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + /* 900 */ 139, 140, 141, 142, 256, 144, 145, 256, 87, 87, + /* 910 */ 297, 90, 90, 18, 264, 8, 9, 0, 23, 12, + /* 920 */ 13, 14, 15, 16, 221, 275, 285, 87, 273, 164, + /* 930 */ 90, 166, 37, 38, 87, 284, 41, 90, 285, 22, + /* 940 */ 151, 152, 292, 292, 285, 297, 60, 256, 297, 256, + /* 950 */ 299, 285, 57, 58, 374, 190, 191, 256, 193, 194, + /* 960 */ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + /* 970 */ 205, 206, 207, 208, 209, 324, 264, 284, 83, 328, + /* 980 */ 329, 330, 331, 332, 333, 292, 335, 275, 297, 338, + /* 990 */ 297, 0, 299, 342, 343, 344, 35, 35, 297, 1, + /* 1000 */ 2, 365, 43, 166, 292, 265, 313, 356, 43, 264, + /* 1010 */ 320, 119, 120, 22, 284, 364, 121, 324, 256, 33, + /* 1020 */ 275, 328, 329, 330, 331, 332, 333, 66, 335, 46, + /* 1030 */ 263, 338, 0, 47, 361, 342, 343, 292, 52, 53, + /* 1040 */ 54, 55, 56, 84, 264, 296, 284, 354, 43, 84, + /* 1050 */ 265, 156, 157, 158, 292, 275, 161, 352, 151, 297, + /* 1060 */ 367, 299, 167, 327, 371, 368, 83, 43, 82, 43, + /* 1070 */ 43, 85, 292, 43, 264, 180, 190, 43, 183, 345, + /* 1080 */ 185, 186, 187, 188, 189, 275, 324, 264, 256, 84, + /* 1090 */ 328, 329, 330, 331, 332, 333, 43, 335, 275, 368, + /* 1100 */ 338, 368, 292, 43, 342, 343, 344, 22, 84, 355, + /* 1110 */ 84, 84, 43, 224, 84, 292, 284, 222, 84, 20, + /* 1120 */ 35, 322, 264, 47, 292, 321, 364, 95, 166, 297, + /* 1130 */ 35, 299, 43, 147, 148, 162, 150, 84, 270, 315, + /* 1140 */ 154, 256, 264, 264, 84, 264, 114, 115, 116, 117, + /* 1150 */ 118, 66, 43, 84, 275, 264, 324, 42, 304, 173, + /* 1160 */ 328, 329, 330, 331, 332, 333, 275, 335, 146, 284, + /* 1170 */ 338, 292, 264, 84, 342, 343, 344, 292, 12, 13, + /* 1180 */ 43, 20, 297, 292, 299, 353, 302, 264, 22, 302, + /* 1190 */ 105, 264, 258, 84, 43, 43, 258, 268, 20, 33, + /* 1200 */ 292, 35, 319, 299, 268, 256, 20, 20, 312, 324, + /* 1210 */ 268, 314, 312, 328, 329, 330, 331, 332, 333, 268, + /* 1220 */ 335, 84, 56, 338, 20, 256, 305, 342, 343, 344, + /* 1230 */ 258, 268, 66, 284, 268, 84, 84, 284, 353, 264, + /* 1240 */ 332, 292, 268, 297, 284, 258, 297, 319, 299, 164, + /* 1250 */ 266, 166, 284, 284, 284, 347, 348, 349, 264, 351, + /* 1260 */ 284, 292, 313, 284, 284, 284, 297, 266, 299, 284, + /* 1270 */ 172, 105, 284, 324, 284, 190, 191, 328, 329, 330, + /* 1280 */ 331, 332, 333, 264, 335, 256, 266, 264, 299, 318, + /* 1290 */ 312, 229, 297, 324, 148, 292, 297, 328, 329, 330, + /* 1300 */ 331, 332, 333, 354, 335, 308, 297, 338, 297, 297, + /* 1310 */ 308, 342, 343, 284, 306, 305, 367, 266, 280, 20, + /* 1320 */ 371, 292, 266, 292, 230, 297, 297, 327, 299, 308, + /* 1330 */ 164, 155, 166, 297, 297, 238, 297, 360, 256, 297, + /* 1340 */ 236, 308, 313, 237, 225, 363, 221, 322, 20, 292, + /* 1350 */ 242, 358, 256, 324, 362, 359, 190, 328, 329, 330, + /* 1360 */ 331, 332, 333, 357, 335, 245, 284, 201, 202, 203, + /* 1370 */ 204, 205, 206, 207, 292, 360, 360, 370, 326, 297, + /* 1380 */ 284, 299, 240, 354, 83, 341, 369, 369, 292, 375, + /* 1390 */ 83, 288, 274, 297, 264, 299, 367, 297, 266, 36, + /* 1400 */ 371, 311, 259, 258, 316, 370, 324, 278, 267, 369, + /* 1410 */ 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, + /* 1420 */ 324, 256, 278, 254, 328, 329, 330, 331, 332, 333, + /* 1430 */ 0, 335, 278, 256, 338, 370, 0, 42, 0, 343, + /* 1440 */ 74, 0, 184, 35, 35, 256, 35, 35, 184, 284, + /* 1450 */ 0, 35, 35, 184, 289, 0, 184, 292, 0, 35, + /* 1460 */ 0, 284, 297, 0, 299, 22, 289, 35, 0, 292, + /* 1470 */ 83, 169, 168, 284, 297, 166, 299, 164, 0, 0, + /* 1480 */ 160, 292, 159, 0, 0, 46, 297, 0, 299, 324, + /* 1490 */ 0, 0, 143, 328, 329, 330, 331, 332, 333, 0, + /* 1500 */ 335, 324, 0, 256, 0, 328, 329, 330, 331, 332, + /* 1510 */ 333, 0, 335, 324, 0, 138, 35, 328, 329, 330, + /* 1520 */ 331, 332, 333, 256, 335, 0, 138, 0, 8, 9, + /* 1530 */ 0, 284, 12, 13, 14, 15, 16, 0, 0, 292, + /* 1540 */ 42, 0, 0, 0, 297, 0, 299, 0, 0, 0, + /* 1550 */ 0, 284, 0, 0, 0, 366, 289, 0, 0, 292, + /* 1560 */ 0, 0, 0, 0, 297, 0, 299, 0, 22, 0, + /* 1570 */ 0, 324, 56, 256, 0, 328, 329, 330, 331, 332, + /* 1580 */ 333, 0, 335, 0, 0, 256, 42, 14, 0, 14, + /* 1590 */ 39, 324, 0, 0, 39, 328, 329, 330, 331, 332, + /* 1600 */ 333, 284, 335, 155, 84, 46, 0, 43, 40, 292, + /* 1610 */ 39, 0, 46, 284, 297, 0, 299, 61, 289, 0, + /* 1620 */ 373, 292, 35, 47, 39, 0, 297, 47, 299, 35, + /* 1630 */ 39, 0, 35, 47, 39, 0, 35, 256, 39, 0, + /* 1640 */ 0, 324, 0, 47, 0, 328, 329, 330, 331, 332, + /* 1650 */ 333, 35, 335, 324, 337, 22, 0, 328, 329, 330, + /* 1660 */ 331, 332, 333, 256, 335, 284, 43, 35, 90, 92, + /* 1670 */ 289, 35, 35, 292, 0, 22, 35, 43, 297, 0, + /* 1680 */ 299, 35, 35, 35, 22, 0, 22, 49, 0, 35, + /* 1690 */ 35, 284, 0, 35, 0, 22, 20, 0, 0, 292, + /* 1700 */ 35, 170, 22, 0, 297, 324, 299, 0, 0, 328, + /* 1710 */ 329, 330, 331, 332, 333, 179, 335, 0, 256, 0, + /* 1720 */ 0, 0, 39, 151, 46, 43, 83, 148, 22, 84, + /* 1730 */ 256, 324, 83, 151, 83, 328, 329, 330, 331, 332, + /* 1740 */ 333, 151, 335, 83, 226, 93, 284, 43, 46, 149, + /* 1750 */ 147, 153, 83, 83, 292, 84, 84, 43, 284, 297, + /* 1760 */ 83, 299, 46, 35, 46, 84, 292, 43, 84, 83, + /* 1770 */ 83, 297, 83, 299, 84, 84, 83, 43, 46, 84, + /* 1780 */ 256, 46, 43, 84, 84, 35, 324, 35, 35, 35, + /* 1790 */ 328, 329, 330, 331, 332, 333, 256, 335, 324, 35, + /* 1800 */ 2, 43, 328, 329, 330, 331, 332, 333, 284, 335, + /* 1810 */ 190, 84, 83, 83, 83, 226, 292, 84, 46, 46, + /* 1820 */ 84, 297, 22, 299, 284, 220, 83, 83, 83, 35, + /* 1830 */ 226, 94, 292, 84, 35, 84, 35, 297, 83, 299, + /* 1840 */ 83, 35, 192, 84, 83, 35, 84, 84, 324, 83, + /* 1850 */ 35, 83, 328, 329, 330, 331, 332, 333, 256, 335, + /* 1860 */ 22, 83, 83, 107, 324, 95, 35, 107, 328, 329, + /* 1870 */ 330, 331, 332, 333, 83, 335, 107, 256, 107, 43, + /* 1880 */ 22, 61, 60, 35, 66, 81, 284, 43, 35, 35, + /* 1890 */ 35, 35, 35, 66, 292, 22, 35, 35, 35, 297, + /* 1900 */ 35, 299, 35, 35, 35, 284, 0, 35, 0, 35, + /* 1910 */ 35, 47, 35, 292, 0, 39, 35, 47, 297, 256, + /* 1920 */ 299, 39, 39, 0, 35, 47, 324, 47, 0, 39, + /* 1930 */ 328, 329, 330, 331, 332, 333, 35, 335, 35, 0, + /* 1940 */ 22, 21, 376, 376, 22, 324, 22, 284, 21, 328, + /* 1950 */ 329, 330, 331, 332, 333, 292, 335, 20, 376, 376, + /* 1960 */ 297, 256, 299, 376, 376, 376, 376, 376, 376, 376, + /* 1970 */ 376, 256, 376, 376, 376, 376, 376, 376, 376, 376, + /* 1980 */ 376, 376, 376, 376, 376, 376, 376, 324, 376, 284, + /* 1990 */ 376, 328, 329, 330, 331, 332, 333, 292, 335, 284, + /* 2000 */ 376, 376, 297, 376, 299, 376, 376, 292, 376, 376, + /* 2010 */ 376, 376, 297, 376, 299, 376, 376, 376, 376, 376, + /* 2020 */ 376, 376, 376, 256, 376, 376, 376, 376, 376, 324, + /* 2030 */ 376, 376, 376, 328, 329, 330, 331, 332, 333, 324, + /* 2040 */ 335, 376, 376, 328, 329, 330, 331, 332, 333, 256, + /* 2050 */ 335, 284, 376, 376, 376, 376, 376, 376, 376, 292, + /* 2060 */ 376, 376, 376, 376, 297, 256, 299, 376, 376, 376, + /* 2070 */ 376, 376, 376, 376, 376, 376, 376, 284, 376, 376, + /* 2080 */ 376, 376, 376, 376, 376, 292, 376, 376, 376, 376, + /* 2090 */ 297, 324, 299, 284, 376, 328, 329, 330, 331, 332, + /* 2100 */ 333, 292, 335, 376, 376, 376, 297, 376, 299, 376, + /* 2110 */ 376, 376, 376, 376, 376, 256, 376, 324, 376, 376, + /* 2120 */ 376, 328, 329, 330, 331, 332, 333, 256, 335, 376, + /* 2130 */ 376, 376, 376, 324, 376, 376, 376, 328, 329, 330, + /* 2140 */ 331, 332, 333, 284, 335, 376, 376, 376, 376, 376, + /* 2150 */ 376, 292, 376, 376, 376, 284, 297, 376, 299, 376, + /* 2160 */ 376, 376, 376, 292, 376, 376, 376, 376, 297, 376, + /* 2170 */ 299, 376, 376, 376, 376, 376, 376, 256, 376, 376, + /* 2180 */ 376, 376, 376, 324, 376, 376, 376, 328, 329, 330, + /* 2190 */ 331, 332, 333, 376, 335, 324, 376, 376, 376, 328, + /* 2200 */ 329, 330, 331, 332, 333, 284, 335, 376, 376, 376, + /* 2210 */ 376, 376, 376, 292, 376, 376, 376, 376, 297, 256, + /* 2220 */ 299, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 2230 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 2240 */ 376, 376, 376, 376, 376, 324, 376, 284, 376, 328, + /* 2250 */ 329, 330, 331, 332, 333, 292, 335, 376, 376, 376, + /* 2260 */ 297, 256, 299, 376, 376, 376, 376, 376, 376, 376, + /* 2270 */ 376, 256, 376, 376, 376, 376, 376, 376, 376, 376, + /* 2280 */ 376, 376, 376, 376, 376, 376, 376, 324, 376, 284, + /* 2290 */ 376, 328, 329, 330, 331, 332, 333, 292, 335, 284, + /* 2300 */ 376, 376, 297, 376, 299, 376, 376, 292, 376, 376, + /* 2310 */ 376, 376, 297, 376, 299, 376, 376, 376, 376, 376, + /* 2320 */ 376, 256, 376, 376, 376, 376, 376, 376, 376, 324, + /* 2330 */ 376, 376, 376, 328, 329, 330, 331, 332, 333, 324, + /* 2340 */ 335, 376, 376, 328, 329, 330, 331, 332, 333, 284, + /* 2350 */ 335, 376, 376, 376, 376, 376, 376, 292, 376, 376, + /* 2360 */ 376, 376, 297, 376, 299, 376, 376, 376, 376, 376, + /* 2370 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 2380 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 324, + /* 2390 */ 376, 376, 376, 328, 329, 330, 331, 332, 333, 376, + /* 2400 */ 335, }; -#define YY_SHIFT_COUNT (652) +#define YY_SHIFT_COUNT (655) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1814) +#define YY_SHIFT_MAX (1939) static const unsigned short int yy_shift_ofst[] = { - /* 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, 565, 64, 64, 29, 29, 29, 1187, 1187, - /* 50 */ 1187, 54, 95, 247, 40, 40, 165, 165, 317, 106, - /* 60 */ 247, 247, 40, 40, 40, 40, 40, 40, 40, 40, - /* 70 */ 6, 40, 40, 40, 48, 127, 40, 40, 127, 152, - /* 80 */ 40, 127, 127, 127, 40, 122, 758, 223, 477, 477, - /* 90 */ 13, 409, 839, 839, 839, 839, 839, 839, 839, 839, - /* 100 */ 839, 839, 839, 839, 839, 839, 839, 839, 839, 839, - /* 110 */ 839, 196, 106, 325, 325, 75, 80, 365, 633, 633, - /* 120 */ 633, 80, 209, 48, 273, 273, 127, 127, 277, 277, - /* 130 */ 321, 380, 252, 252, 252, 252, 252, 252, 252, 131, - /* 140 */ 717, 533, 374, 233, 138, 67, 143, 124, 199, 476, - /* 150 */ 596, 1, 776, 603, 570, 603, 783, 581, 581, 581, - /* 160 */ 619, 786, 862, 1067, 1044, 1068, 945, 1067, 1067, 1073, - /* 170 */ 973, 973, 1067, 1103, 1103, 1109, 6, 48, 6, 1114, - /* 180 */ 1118, 6, 1114, 6, 1125, 6, 6, 1067, 6, 1103, - /* 190 */ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - /* 200 */ 127, 1067, 1103, 277, 1109, 122, 992, 48, 122, 1067, - /* 210 */ 1067, 1114, 122, 982, 277, 277, 277, 277, 982, 277, - /* 220 */ 1066, 209, 1125, 122, 321, 122, 209, 1222, 277, 1018, - /* 230 */ 982, 277, 277, 1018, 982, 277, 277, 127, 1027, 1102, - /* 240 */ 1018, 1026, 1028, 1041, 862, 1046, 209, 1248, 1029, 1030, - /* 250 */ 1034, 1029, 1030, 1029, 1030, 1189, 1197, 277, 380, 1067, - /* 260 */ 122, 1268, 1103, 2609, 2609, 2609, 2609, 2609, 2609, 2609, - /* 270 */ 334, 502, 268, 520, 412, 623, 648, 903, 981, 838, - /* 280 */ 710, 431, 855, 855, 855, 855, 855, 855, 855, 855, - /* 290 */ 920, 698, 14, 14, 164, 439, 25, 147, 699, 564, - /* 300 */ 486, 656, 364, 364, 364, 364, 756, 867, 769, 835, - /* 310 */ 848, 849, 931, 984, 986, 443, 679, 893, 899, 932, - /* 320 */ 949, 955, 956, 781, 842, 957, 906, 804, 638, 736, - /* 330 */ 960, 880, 962, 895, 966, 970, 998, 1001, 1009, 1019, - /* 340 */ 972, 1021, 1024, 1324, 1331, 1290, 1333, 1262, 1336, 1302, - /* 350 */ 1155, 1307, 1318, 1321, 1174, 1364, 1334, 1343, 1185, 1379, - /* 360 */ 1198, 1380, 1348, 1385, 1372, 1386, 1363, 1399, 1320, 1232, - /* 370 */ 1237, 1240, 1243, 1407, 1411, 1253, 1256, 1415, 1416, 1371, - /* 380 */ 1418, 1419, 1420, 1279, 1422, 1423, 1425, 1426, 1427, 1291, - /* 390 */ 1394, 1430, 1294, 1432, 1433, 1434, 1436, 1437, 1438, 1447, - /* 400 */ 1448, 1450, 1451, 1455, 1456, 1457, 1458, 1417, 1461, 1462, - /* 410 */ 1463, 1464, 1466, 1468, 1449, 1469, 1470, 1472, 1482, 1483, - /* 420 */ 1484, 1435, 1439, 1431, 1465, 1429, 1471, 1441, 1476, 1440, - /* 430 */ 1452, 1489, 1490, 1502, 1454, 1340, 1495, 1504, 1507, 1467, - /* 440 */ 1508, 1509, 1477, 1481, 1475, 1515, 1494, 1485, 1491, 1516, - /* 450 */ 1496, 1487, 1497, 1535, 1503, 1492, 1498, 1540, 1542, 1543, - /* 460 */ 1544, 1459, 1460, 1510, 1525, 1551, 1517, 1518, 1519, 1520, - /* 470 */ 1513, 1514, 1523, 1524, 1527, 1560, 1541, 1564, 1545, 1521, - /* 480 */ 1565, 1546, 1531, 1569, 1536, 1572, 1539, 1575, 1554, 1566, - /* 490 */ 1585, 1442, 1552, 1588, 1421, 1571, 1444, 1453, 1591, 1595, - /* 500 */ 1446, 1473, 1598, 1599, 1601, 1526, 1522, 1428, 1603, 1528, - /* 510 */ 1479, 1530, 1607, 1570, 1486, 1532, 1538, 1567, 1574, 1390, - /* 520 */ 1549, 1537, 1557, 1558, 1559, 1563, 1596, 1580, 1582, 1568, - /* 530 */ 1579, 1581, 1583, 1604, 1600, 1606, 1586, 1610, 1403, 1584, - /* 540 */ 1587, 1608, 1478, 1626, 1625, 1627, 1592, 1631, 1424, 1593, - /* 550 */ 1643, 1646, 1647, 1648, 1649, 1651, 1593, 1677, 1499, 1650, - /* 560 */ 1609, 1611, 1613, 1615, 1614, 1616, 1655, 1621, 1622, 1656, - /* 570 */ 1667, 1533, 1624, 1597, 1628, 1673, 1674, 1632, 1630, 1675, - /* 580 */ 1633, 1639, 1690, 1645, 1652, 1691, 1660, 1661, 1693, 1663, - /* 590 */ 1640, 1641, 1653, 1654, 1708, 1637, 1668, 1669, 1698, 1670, - /* 600 */ 1710, 1710, 1712, 1689, 1695, 1720, 1696, 1676, 1715, 1728, - /* 610 */ 1729, 1731, 1732, 1733, 1747, 1736, 1738, 1709, 1513, 1740, - /* 620 */ 1514, 1742, 1743, 1744, 1745, 1748, 1750, 1782, 1751, 1741, - /* 630 */ 1753, 1787, 1755, 1746, 1756, 1794, 1761, 1752, 1759, 1800, - /* 640 */ 1772, 1762, 1771, 1811, 1777, 1778, 1814, 1793, 1797, 1804, - /* 650 */ 1806, 1798, 1810, + /* 0 */ 895, 0, 0, 57, 57, 255, 255, 255, 312, 312, + /* 10 */ 255, 255, 510, 567, 765, 567, 567, 567, 567, 567, + /* 20 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + /* 30 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + /* 40 */ 567, 567, 567, 64, 64, 86, 86, 86, 1166, 1166, + /* 50 */ 1166, 147, 52, 151, 11, 11, 440, 440, 58, 30, + /* 60 */ 151, 151, 11, 11, 11, 11, 11, 11, 11, 11, + /* 70 */ 22, 11, 11, 11, 26, 271, 11, 11, 271, 376, + /* 80 */ 11, 271, 271, 271, 11, 423, 761, 224, 479, 479, + /* 90 */ 13, 266, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, + /* 100 */ 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, + /* 110 */ 1085, 206, 30, 81, 81, 115, 586, 605, 41, 41, + /* 120 */ 41, 586, 511, 26, 643, 643, 271, 271, 658, 658, + /* 130 */ 692, 671, 253, 253, 253, 253, 253, 253, 253, 509, + /* 140 */ 720, 309, 291, 38, 524, 305, 418, 617, 657, 267, + /* 150 */ 621, 372, 98, 572, 703, 572, 813, 238, 238, 238, + /* 160 */ 60, 562, 889, 1099, 1076, 1095, 973, 1099, 1099, 1115, + /* 170 */ 1022, 1022, 1099, 1099, 1161, 1161, 1178, 22, 26, 22, + /* 180 */ 1186, 1187, 22, 1186, 22, 1204, 22, 22, 1099, 22, + /* 190 */ 1161, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 200 */ 271, 271, 1099, 1161, 658, 1178, 423, 1098, 26, 423, + /* 210 */ 1099, 1099, 1186, 423, 1062, 658, 658, 658, 658, 1062, + /* 220 */ 658, 1146, 511, 1204, 423, 692, 423, 511, 1299, 658, + /* 230 */ 1094, 1062, 658, 658, 1094, 1062, 658, 658, 271, 1104, + /* 240 */ 1176, 1094, 1097, 1106, 1119, 889, 1125, 511, 1328, 1108, + /* 250 */ 1142, 1120, 1108, 1142, 1108, 1142, 1301, 1307, 658, 671, + /* 260 */ 1099, 423, 1363, 1161, 2401, 2401, 2401, 2401, 2401, 2401, + /* 270 */ 2401, 335, 986, 188, 521, 414, 457, 713, 626, 826, + /* 280 */ 907, 1520, 688, 865, 865, 865, 865, 865, 865, 865, + /* 290 */ 865, 1032, 272, 14, 14, 469, 367, 513, 722, 139, + /* 300 */ 34, 95, 584, 669, 669, 669, 669, 560, 959, 821, + /* 310 */ 822, 840, 847, 836, 917, 991, 797, 789, 965, 1005, + /* 320 */ 1024, 1026, 1027, 1034, 837, 962, 1053, 998, 892, 296, + /* 330 */ 349, 1060, 886, 1069, 983, 1030, 1089, 1109, 1137, 1151, + /* 340 */ 1152, 152, 961, 231, 1430, 1436, 1395, 1438, 1366, 1441, + /* 350 */ 1408, 1258, 1409, 1411, 1412, 1264, 1450, 1416, 1417, 1269, + /* 360 */ 1455, 1272, 1458, 1424, 1460, 1443, 1463, 1432, 1468, 1387, + /* 370 */ 1302, 1304, 1309, 1313, 1478, 1479, 1320, 1323, 1483, 1484, + /* 380 */ 1439, 1487, 1490, 1491, 1349, 1499, 1502, 1504, 1511, 1514, + /* 390 */ 1377, 1481, 1525, 1388, 1527, 1530, 1537, 1538, 1545, 1547, + /* 400 */ 1548, 1549, 1550, 1552, 1553, 1554, 1557, 1558, 1498, 1541, + /* 410 */ 1542, 1543, 1560, 1561, 1562, 1546, 1563, 1565, 1567, 1569, + /* 420 */ 1570, 1516, 1574, 1581, 1544, 1551, 1564, 1573, 1559, 1575, + /* 430 */ 1566, 1583, 1568, 1555, 1584, 1588, 1592, 1571, 1448, 1593, + /* 440 */ 1606, 1611, 1556, 1615, 1619, 1587, 1576, 1585, 1625, 1594, + /* 450 */ 1580, 1591, 1631, 1597, 1586, 1595, 1635, 1601, 1596, 1599, + /* 460 */ 1639, 1640, 1642, 1644, 1577, 1578, 1616, 1633, 1656, 1632, + /* 470 */ 1636, 1637, 1641, 1623, 1634, 1646, 1647, 1648, 1674, 1653, + /* 480 */ 1679, 1662, 1638, 1685, 1664, 1654, 1688, 1655, 1692, 1658, + /* 490 */ 1694, 1673, 1676, 1697, 1572, 1665, 1698, 1531, 1680, 1582, + /* 500 */ 1579, 1703, 1707, 1590, 1598, 1708, 1717, 1719, 1643, 1645, + /* 510 */ 1536, 1720, 1649, 1600, 1651, 1721, 1683, 1603, 1660, 1652, + /* 520 */ 1678, 1682, 1518, 1669, 1671, 1670, 1672, 1681, 1677, 1706, + /* 530 */ 1704, 1684, 1686, 1687, 1689, 1690, 1714, 1702, 1716, 1693, + /* 540 */ 1724, 1589, 1691, 1695, 1718, 1605, 1734, 1732, 1735, 1699, + /* 550 */ 1739, 1604, 1700, 1728, 1750, 1752, 1753, 1754, 1764, 1700, + /* 560 */ 1798, 1620, 1758, 1729, 1727, 1730, 1733, 1731, 1736, 1772, + /* 570 */ 1743, 1744, 1773, 1800, 1650, 1745, 1737, 1749, 1794, 1799, + /* 580 */ 1755, 1751, 1801, 1757, 1759, 1806, 1761, 1762, 1810, 1766, + /* 590 */ 1763, 1815, 1768, 1756, 1760, 1769, 1771, 1838, 1770, 1778, + /* 600 */ 1779, 1831, 1791, 1836, 1836, 1858, 1820, 1822, 1848, 1818, + /* 610 */ 1804, 1844, 1853, 1854, 1855, 1856, 1857, 1873, 1861, 1862, + /* 620 */ 1827, 1623, 1863, 1634, 1865, 1867, 1868, 1869, 1872, 1874, + /* 630 */ 1906, 1875, 1864, 1876, 1908, 1877, 1870, 1882, 1914, 1881, + /* 640 */ 1878, 1883, 1923, 1889, 1880, 1890, 1928, 1901, 1903, 1939, + /* 650 */ 1918, 1920, 1922, 1924, 1927, 1937, }; -#define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-349) -#define YY_REDUCE_MAX (2274) +#define YY_REDUCE_COUNT (270) +#define YY_REDUCE_MIN (-339) +#define YY_REDUCE_MAX (2065) static const short yy_reduce_ofst[] = { - /* 0 */ -246, -200, 689, 767, 828, 845, 898, 953, 1031, 1043, - /* 10 */ 1112, 1169, 1190, 1250, 1306, 1328, 1389, 1017, 1409, 1474, - /* 20 */ 1493, 1562, 1578, 1620, 1644, 1686, 1706, 1766, 1790, 1846, - /* 30 */ 1870, 1912, 1928, 1970, 1990, 2050, 2074, 2130, 2154, 2196, - /* 40 */ 2212, 2254, 2274, -245, 490, -191, -120, -20, -271, -249, - /* 50 */ -235, -218, 222, 258, 41, 44, -259, -254, -349, -240, - /* 60 */ -277, -256, 46, 103, 206, 288, 298, 300, 319, 342, - /* 70 */ -257, 351, 355, 391, -64, -101, 405, 517, -11, -267, - /* 80 */ 526, 248, 360, 267, 557, 216, -252, -171, -171, -171, - /* 90 */ -176, -253, 47, 85, 120, 379, 389, 403, 425, 481, - /* 100 */ 532, 539, 549, 577, 579, 604, 607, 617, 651, 675, - /* 110 */ 678, -133, 87, -46, 45, -258, 203, 295, 93, 327, - /* 120 */ 402, 296, 376, 501, 305, 362, 550, 297, 78, 436, - /* 130 */ 458, 479, -283, 193, 253, 514, 573, 592, 661, 236, - /* 140 */ 530, 668, 576, 485, 727, 662, 650, 742, 742, 763, - /* 150 */ 798, 766, 740, 716, 716, 716, 724, 704, 707, 713, - /* 160 */ 728, 742, 768, 825, 773, 836, 793, 850, 851, 813, - /* 170 */ 816, 819, 858, 868, 870, 814, 864, 837, 866, 826, - /* 180 */ 827, 872, 831, 877, 843, 879, 881, 886, 883, 897, - /* 190 */ 869, 878, 884, 900, 901, 902, 907, 909, 910, 912, - /* 200 */ 915, 917, 921, 905, 846, 937, 887, 908, 938, 942, - /* 210 */ 944, 904, 946, 859, 916, 918, 922, 923, 924, 927, - /* 220 */ 911, 926, 929, 959, 958, 969, 947, 919, 950, 889, - /* 230 */ 948, 961, 963, 894, 951, 964, 965, 742, 892, 913, - /* 240 */ 914, 930, 935, 933, 954, 716, 976, 952, 928, 925, - /* 250 */ 936, 934, 939, 940, 943, 977, 1012, 1005, 1033, 1039, - /* 260 */ 1047, 1058, 1061, 1004, 1010, 1048, 1051, 1053, 1055, 1070, + /* 0 */ -245, -199, 693, 651, 762, 325, 832, 885, 949, 1029, + /* 10 */ 533, 969, 1082, -146, 1096, 1165, 1177, 1189, 1247, 1267, + /* 20 */ 1317, 1329, 1381, 1407, 1462, 1474, 1524, 1540, 1602, 1621, + /* 30 */ 1663, 1705, 1715, 1767, 1793, 1809, 1859, 1871, 1921, 1963, + /* 40 */ 2005, 2015, 2065, -260, 265, -190, 204, 908, -276, -272, + /* 50 */ -4, -289, -255, -69, -112, 326, -257, -244, -200, -171, + /* 60 */ -125, -41, -189, 283, 387, 526, 545, 552, 558, 650, + /* 70 */ -214, 712, 745, 780, 289, 140, 810, 823, 190, -275, + /* 80 */ 879, 257, 320, 531, 891, -264, -228, -339, -339, -339, + /* 90 */ 21, -262, -176, -152, 25, 121, 230, 241, 329, 405, + /* 100 */ 443, 487, 498, 499, 557, 563, 570, 613, 648, 691, + /* 110 */ 701, 31, -74, 130, 240, 28, 73, 472, 75, 149, + /* 120 */ 260, 111, 378, 424, 37, 364, 530, -119, 276, 438, + /* 130 */ 459, 508, 544, 564, 574, 641, 653, 659, 666, 535, + /* 140 */ 590, 655, 580, 636, 740, 690, 673, 730, 730, 785, + /* 150 */ 767, 749, 736, 705, 705, 705, 734, 697, 731, 733, + /* 160 */ 754, 730, 799, 858, 804, 868, 824, 878, 881, 854, + /* 170 */ 884, 887, 923, 927, 934, 938, 883, 929, 904, 936, + /* 180 */ 896, 897, 942, 900, 951, 921, 963, 966, 975, 974, + /* 190 */ 972, 953, 960, 968, 970, 976, 979, 980, 981, 985, + /* 200 */ 988, 990, 994, 987, 946, 928, 984, 971, 989, 1001, + /* 210 */ 1019, 1023, 978, 1020, 997, 995, 999, 1009, 1011, 1002, + /* 220 */ 1012, 1008, 1003, 1010, 1051, 1038, 1056, 1031, 1000, 1028, + /* 230 */ 977, 1021, 1036, 1037, 1015, 1033, 1039, 1042, 730, 982, + /* 240 */ 992, 1016, 996, 993, 1006, 1025, 705, 1057, 1052, 1007, + /* 250 */ 1017, 1014, 1035, 1018, 1065, 1040, 1044, 1103, 1100, 1118, + /* 260 */ 1130, 1132, 1143, 1145, 1088, 1090, 1129, 1144, 1154, 1141, + /* 270 */ 1169, }; static const YYACTIONTYPE yy_default[] = { - /* 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, 1507, 1848, 1848, - /* 120 */ 1848, 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, 1876, 1437, 1437, 1437, 1437, 1876, 1437, - /* 220 */ 1437, 1437, 1437, 1507, 1437, 1507, 1437, 1437, 1437, 1878, - /* 230 */ 1876, 1437, 1437, 1878, 1876, 1437, 1437, 1437, 1890, 1886, - /* 240 */ 1878, 1894, 1892, 1869, 1867, 1854, 1437, 1437, 1908, 1904, - /* 250 */ 1920, 1908, 1904, 1908, 1904, 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, 1437, 1774, 1889, 1888, 1812, 1811, 1810, 1808, 1773, - /* 290 */ 1437, 1568, 1772, 1771, 1437, 1437, 1437, 1437, 1437, 1437, - /* 300 */ 1437, 1437, 1765, 1766, 1764, 1763, 1437, 1437, 1437, 1437, - /* 310 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, - /* 320 */ 1437, 1437, 1437, 1437, 1437, 1437, 1837, 1437, 1905, 1909, - /* 330 */ 1437, 1437, 1437, 1748, 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, 1437, 1437, 1437, 1708, 1437, - /* 510 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1870, 1437, - /* 520 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, - /* 530 */ 1437, 1437, 1437, 1437, 1437, 1748, 1437, 1887, 1437, 1847, - /* 540 */ 1843, 1437, 1437, 1839, 1747, 1437, 1437, 1903, 1437, 1437, - /* 550 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1832, 1437, 1805, - /* 560 */ 1790, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, - /* 570 */ 1437, 1759, 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, + /* 0 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 10 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 20 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 30 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 40 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 50 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 60 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 70 */ 1514, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 80 */ 1441, 1441, 1441, 1441, 1441, 1512, 1665, 1441, 1841, 1441, + /* 90 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 100 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 110 */ 1441, 1441, 1441, 1441, 1441, 1514, 1441, 1512, 1853, 1853, + /* 120 */ 1853, 1441, 1441, 1441, 1709, 1709, 1441, 1441, 1441, 1441, + /* 130 */ 1608, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1701, + /* 140 */ 1441, 1441, 1922, 1441, 1441, 1707, 1876, 1441, 1441, 1441, + /* 150 */ 1441, 1561, 1868, 1845, 1859, 1846, 1843, 1907, 1907, 1907, + /* 160 */ 1862, 1441, 1872, 1441, 1441, 1441, 1693, 1441, 1441, 1670, + /* 170 */ 1667, 1667, 1441, 1441, 1441, 1441, 1441, 1514, 1441, 1514, + /* 180 */ 1441, 1441, 1514, 1441, 1514, 1441, 1514, 1514, 1441, 1514, + /* 190 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 200 */ 1441, 1441, 1441, 1441, 1441, 1441, 1512, 1703, 1441, 1512, + /* 210 */ 1441, 1441, 1441, 1512, 1881, 1441, 1441, 1441, 1441, 1881, + /* 220 */ 1441, 1441, 1441, 1441, 1512, 1441, 1512, 1441, 1441, 1441, + /* 230 */ 1883, 1881, 1441, 1441, 1883, 1881, 1441, 1441, 1441, 1895, + /* 240 */ 1891, 1883, 1899, 1897, 1874, 1872, 1859, 1441, 1441, 1913, + /* 250 */ 1909, 1925, 1913, 1909, 1913, 1909, 1441, 1577, 1441, 1441, + /* 260 */ 1441, 1512, 1473, 1441, 1695, 1709, 1611, 1611, 1611, 1515, + /* 270 */ 1446, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 280 */ 1441, 1441, 1441, 1779, 1894, 1893, 1817, 1816, 1815, 1813, + /* 290 */ 1778, 1441, 1573, 1777, 1776, 1441, 1441, 1441, 1441, 1441, + /* 300 */ 1441, 1441, 1441, 1770, 1771, 1769, 1768, 1441, 1441, 1441, + /* 310 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 320 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1842, 1441, 1910, + /* 330 */ 1914, 1441, 1441, 1441, 1753, 1441, 1441, 1441, 1441, 1441, + /* 340 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 350 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 360 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 370 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 380 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 390 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 400 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 410 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 420 */ 1441, 1441, 1441, 1441, 1441, 1441, 1478, 1441, 1441, 1441, + /* 430 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 440 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 450 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 460 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 470 */ 1441, 1441, 1441, 1542, 1541, 1441, 1441, 1441, 1441, 1441, + /* 480 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 490 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 500 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 510 */ 1441, 1713, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 520 */ 1441, 1875, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 530 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1753, 1441, + /* 540 */ 1892, 1441, 1852, 1848, 1441, 1441, 1844, 1752, 1441, 1441, + /* 550 */ 1908, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 560 */ 1837, 1441, 1810, 1795, 1441, 1441, 1441, 1441, 1441, 1441, + /* 570 */ 1441, 1441, 1441, 1441, 1764, 1441, 1441, 1441, 1441, 1441, + /* 580 */ 1605, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 590 */ 1441, 1441, 1441, 1590, 1588, 1587, 1586, 1441, 1583, 1441, + /* 600 */ 1441, 1441, 1441, 1614, 1613, 1441, 1441, 1441, 1441, 1441, + /* 610 */ 1441, 1534, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 620 */ 1441, 1525, 1441, 1524, 1441, 1441, 1441, 1441, 1441, 1441, + /* 630 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 640 */ 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441, + /* 650 */ 1441, 1441, 1441, 1441, 1441, 1441, }; /********** End of lemon-generated parsing tables *****************************/ @@ -990,6 +951,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* MNODE => nothing */ 0, /* DATABASE => nothing */ 0, /* USE => nothing */ + 0, /* FLUSH => nothing */ 0, /* IF => nothing */ 0, /* NOT => nothing */ 0, /* EXISTS => nothing */ @@ -1178,12 +1140,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 245, /* NK_BITNOT => ID */ - 245, /* INSERT => ID */ - 245, /* VALUES => ID */ - 245, /* IMPORT => ID */ - 245, /* NK_SEMI => ID */ - 245, /* FILE => ID */ + 246, /* NK_BITNOT => ID */ + 246, /* INSERT => ID */ + 246, /* VALUES => ID */ + 246, /* IMPORT => ID */ + 246, /* NK_SEMI => ID */ + 246, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1329,323 +1291,324 @@ static const char *const yyTokenName[] = { /* 55 */ "MNODE", /* 56 */ "DATABASE", /* 57 */ "USE", - /* 58 */ "IF", - /* 59 */ "NOT", - /* 60 */ "EXISTS", - /* 61 */ "BUFFER", - /* 62 */ "CACHELAST", - /* 63 */ "COMP", - /* 64 */ "DURATION", - /* 65 */ "NK_VARIABLE", - /* 66 */ "FSYNC", - /* 67 */ "MAXROWS", - /* 68 */ "MINROWS", - /* 69 */ "KEEP", - /* 70 */ "PAGES", - /* 71 */ "PAGESIZE", - /* 72 */ "PRECISION", - /* 73 */ "REPLICA", - /* 74 */ "STRICT", - /* 75 */ "WAL", - /* 76 */ "VGROUPS", - /* 77 */ "SINGLE_STABLE", - /* 78 */ "RETENTIONS", - /* 79 */ "SCHEMALESS", - /* 80 */ "NK_COLON", - /* 81 */ "TABLE", - /* 82 */ "NK_LP", - /* 83 */ "NK_RP", - /* 84 */ "STABLE", - /* 85 */ "ADD", - /* 86 */ "COLUMN", - /* 87 */ "MODIFY", - /* 88 */ "RENAME", - /* 89 */ "TAG", - /* 90 */ "SET", - /* 91 */ "NK_EQ", - /* 92 */ "USING", - /* 93 */ "TAGS", - /* 94 */ "COMMENT", - /* 95 */ "BOOL", - /* 96 */ "TINYINT", - /* 97 */ "SMALLINT", - /* 98 */ "INT", - /* 99 */ "INTEGER", - /* 100 */ "BIGINT", - /* 101 */ "FLOAT", - /* 102 */ "DOUBLE", - /* 103 */ "BINARY", - /* 104 */ "TIMESTAMP", - /* 105 */ "NCHAR", - /* 106 */ "UNSIGNED", - /* 107 */ "JSON", - /* 108 */ "VARCHAR", - /* 109 */ "MEDIUMBLOB", - /* 110 */ "BLOB", - /* 111 */ "VARBINARY", - /* 112 */ "DECIMAL", - /* 113 */ "MAX_DELAY", - /* 114 */ "WATERMARK", - /* 115 */ "ROLLUP", - /* 116 */ "TTL", - /* 117 */ "SMA", - /* 118 */ "FIRST", - /* 119 */ "LAST", - /* 120 */ "SHOW", - /* 121 */ "DATABASES", - /* 122 */ "TABLES", - /* 123 */ "STABLES", - /* 124 */ "MNODES", - /* 125 */ "MODULES", - /* 126 */ "QNODES", - /* 127 */ "FUNCTIONS", - /* 128 */ "INDEXES", - /* 129 */ "ACCOUNTS", - /* 130 */ "APPS", - /* 131 */ "CONNECTIONS", - /* 132 */ "LICENCE", - /* 133 */ "GRANTS", - /* 134 */ "QUERIES", - /* 135 */ "SCORES", - /* 136 */ "TOPICS", - /* 137 */ "VARIABLES", - /* 138 */ "BNODES", - /* 139 */ "SNODES", - /* 140 */ "CLUSTER", - /* 141 */ "TRANSACTIONS", - /* 142 */ "DISTRIBUTED", - /* 143 */ "CONSUMERS", - /* 144 */ "SUBSCRIPTIONS", - /* 145 */ "LIKE", - /* 146 */ "INDEX", - /* 147 */ "FUNCTION", - /* 148 */ "INTERVAL", - /* 149 */ "TOPIC", - /* 150 */ "AS", - /* 151 */ "WITH", - /* 152 */ "META", - /* 153 */ "CONSUMER", - /* 154 */ "GROUP", - /* 155 */ "DESC", - /* 156 */ "DESCRIBE", - /* 157 */ "RESET", - /* 158 */ "QUERY", - /* 159 */ "CACHE", - /* 160 */ "EXPLAIN", - /* 161 */ "ANALYZE", - /* 162 */ "VERBOSE", - /* 163 */ "NK_BOOL", - /* 164 */ "RATIO", - /* 165 */ "NK_FLOAT", - /* 166 */ "COMPACT", - /* 167 */ "VNODES", - /* 168 */ "IN", - /* 169 */ "OUTPUTTYPE", - /* 170 */ "AGGREGATE", - /* 171 */ "BUFSIZE", - /* 172 */ "STREAM", - /* 173 */ "INTO", - /* 174 */ "TRIGGER", - /* 175 */ "AT_ONCE", - /* 176 */ "WINDOW_CLOSE", - /* 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 */ "expression_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 */ "stream_options", - /* 311 */ "topic_name", - /* 312 */ "query_expression", - /* 313 */ "cgroup_name", - /* 314 */ "analyze_opt", - /* 315 */ "explain_options", - /* 316 */ "agg_func_opt", - /* 317 */ "bufsize_opt", - /* 318 */ "stream_name", - /* 319 */ "into_opt", - /* 320 */ "dnode_list", - /* 321 */ "where_clause_opt", - /* 322 */ "signed", - /* 323 */ "literal_func", - /* 324 */ "literal_list", - /* 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", + /* 58 */ "FLUSH", + /* 59 */ "IF", + /* 60 */ "NOT", + /* 61 */ "EXISTS", + /* 62 */ "BUFFER", + /* 63 */ "CACHELAST", + /* 64 */ "COMP", + /* 65 */ "DURATION", + /* 66 */ "NK_VARIABLE", + /* 67 */ "FSYNC", + /* 68 */ "MAXROWS", + /* 69 */ "MINROWS", + /* 70 */ "KEEP", + /* 71 */ "PAGES", + /* 72 */ "PAGESIZE", + /* 73 */ "PRECISION", + /* 74 */ "REPLICA", + /* 75 */ "STRICT", + /* 76 */ "WAL", + /* 77 */ "VGROUPS", + /* 78 */ "SINGLE_STABLE", + /* 79 */ "RETENTIONS", + /* 80 */ "SCHEMALESS", + /* 81 */ "NK_COLON", + /* 82 */ "TABLE", + /* 83 */ "NK_LP", + /* 84 */ "NK_RP", + /* 85 */ "STABLE", + /* 86 */ "ADD", + /* 87 */ "COLUMN", + /* 88 */ "MODIFY", + /* 89 */ "RENAME", + /* 90 */ "TAG", + /* 91 */ "SET", + /* 92 */ "NK_EQ", + /* 93 */ "USING", + /* 94 */ "TAGS", + /* 95 */ "COMMENT", + /* 96 */ "BOOL", + /* 97 */ "TINYINT", + /* 98 */ "SMALLINT", + /* 99 */ "INT", + /* 100 */ "INTEGER", + /* 101 */ "BIGINT", + /* 102 */ "FLOAT", + /* 103 */ "DOUBLE", + /* 104 */ "BINARY", + /* 105 */ "TIMESTAMP", + /* 106 */ "NCHAR", + /* 107 */ "UNSIGNED", + /* 108 */ "JSON", + /* 109 */ "VARCHAR", + /* 110 */ "MEDIUMBLOB", + /* 111 */ "BLOB", + /* 112 */ "VARBINARY", + /* 113 */ "DECIMAL", + /* 114 */ "MAX_DELAY", + /* 115 */ "WATERMARK", + /* 116 */ "ROLLUP", + /* 117 */ "TTL", + /* 118 */ "SMA", + /* 119 */ "FIRST", + /* 120 */ "LAST", + /* 121 */ "SHOW", + /* 122 */ "DATABASES", + /* 123 */ "TABLES", + /* 124 */ "STABLES", + /* 125 */ "MNODES", + /* 126 */ "MODULES", + /* 127 */ "QNODES", + /* 128 */ "FUNCTIONS", + /* 129 */ "INDEXES", + /* 130 */ "ACCOUNTS", + /* 131 */ "APPS", + /* 132 */ "CONNECTIONS", + /* 133 */ "LICENCE", + /* 134 */ "GRANTS", + /* 135 */ "QUERIES", + /* 136 */ "SCORES", + /* 137 */ "TOPICS", + /* 138 */ "VARIABLES", + /* 139 */ "BNODES", + /* 140 */ "SNODES", + /* 141 */ "CLUSTER", + /* 142 */ "TRANSACTIONS", + /* 143 */ "DISTRIBUTED", + /* 144 */ "CONSUMERS", + /* 145 */ "SUBSCRIPTIONS", + /* 146 */ "LIKE", + /* 147 */ "INDEX", + /* 148 */ "FUNCTION", + /* 149 */ "INTERVAL", + /* 150 */ "TOPIC", + /* 151 */ "AS", + /* 152 */ "WITH", + /* 153 */ "META", + /* 154 */ "CONSUMER", + /* 155 */ "GROUP", + /* 156 */ "DESC", + /* 157 */ "DESCRIBE", + /* 158 */ "RESET", + /* 159 */ "QUERY", + /* 160 */ "CACHE", + /* 161 */ "EXPLAIN", + /* 162 */ "ANALYZE", + /* 163 */ "VERBOSE", + /* 164 */ "NK_BOOL", + /* 165 */ "RATIO", + /* 166 */ "NK_FLOAT", + /* 167 */ "COMPACT", + /* 168 */ "VNODES", + /* 169 */ "IN", + /* 170 */ "OUTPUTTYPE", + /* 171 */ "AGGREGATE", + /* 172 */ "BUFSIZE", + /* 173 */ "STREAM", + /* 174 */ "INTO", + /* 175 */ "TRIGGER", + /* 176 */ "AT_ONCE", + /* 177 */ "WINDOW_CLOSE", + /* 178 */ "IGNORE", + /* 179 */ "EXPIRED", + /* 180 */ "KILL", + /* 181 */ "CONNECTION", + /* 182 */ "TRANSACTION", + /* 183 */ "BALANCE", + /* 184 */ "VGROUP", + /* 185 */ "MERGE", + /* 186 */ "REDISTRIBUTE", + /* 187 */ "SPLIT", + /* 188 */ "SYNCDB", + /* 189 */ "DELETE", + /* 190 */ "NULL", + /* 191 */ "NK_QUESTION", + /* 192 */ "NK_ARROW", + /* 193 */ "ROWTS", + /* 194 */ "TBNAME", + /* 195 */ "QSTARTTS", + /* 196 */ "QENDTS", + /* 197 */ "WSTARTTS", + /* 198 */ "WENDTS", + /* 199 */ "WDURATION", + /* 200 */ "CAST", + /* 201 */ "NOW", + /* 202 */ "TODAY", + /* 203 */ "TIMEZONE", + /* 204 */ "CLIENT_VERSION", + /* 205 */ "SERVER_VERSION", + /* 206 */ "SERVER_STATUS", + /* 207 */ "CURRENT_USER", + /* 208 */ "COUNT", + /* 209 */ "LAST_ROW", + /* 210 */ "BETWEEN", + /* 211 */ "IS", + /* 212 */ "NK_LT", + /* 213 */ "NK_GT", + /* 214 */ "NK_LE", + /* 215 */ "NK_GE", + /* 216 */ "NK_NE", + /* 217 */ "MATCH", + /* 218 */ "NMATCH", + /* 219 */ "CONTAINS", + /* 220 */ "JOIN", + /* 221 */ "INNER", + /* 222 */ "SELECT", + /* 223 */ "DISTINCT", + /* 224 */ "WHERE", + /* 225 */ "PARTITION", + /* 226 */ "BY", + /* 227 */ "SESSION", + /* 228 */ "STATE_WINDOW", + /* 229 */ "SLIDING", + /* 230 */ "FILL", + /* 231 */ "VALUE", + /* 232 */ "NONE", + /* 233 */ "PREV", + /* 234 */ "LINEAR", + /* 235 */ "NEXT", + /* 236 */ "HAVING", + /* 237 */ "RANGE", + /* 238 */ "EVERY", + /* 239 */ "ORDER", + /* 240 */ "SLIMIT", + /* 241 */ "SOFFSET", + /* 242 */ "LIMIT", + /* 243 */ "OFFSET", + /* 244 */ "ASC", + /* 245 */ "NULLS", + /* 246 */ "ID", + /* 247 */ "NK_BITNOT", + /* 248 */ "INSERT", + /* 249 */ "VALUES", + /* 250 */ "IMPORT", + /* 251 */ "NK_SEMI", + /* 252 */ "FILE", + /* 253 */ "cmd", + /* 254 */ "account_options", + /* 255 */ "alter_account_options", + /* 256 */ "literal", + /* 257 */ "alter_account_option", + /* 258 */ "user_name", + /* 259 */ "sysinfo_opt", + /* 260 */ "privileges", + /* 261 */ "priv_level", + /* 262 */ "priv_type_list", + /* 263 */ "priv_type", + /* 264 */ "db_name", + /* 265 */ "dnode_endpoint", + /* 266 */ "not_exists_opt", + /* 267 */ "db_options", + /* 268 */ "exists_opt", + /* 269 */ "alter_db_options", + /* 270 */ "integer_list", + /* 271 */ "variable_list", + /* 272 */ "retention_list", + /* 273 */ "alter_db_option", + /* 274 */ "retention", + /* 275 */ "full_table_name", + /* 276 */ "column_def_list", + /* 277 */ "tags_def_opt", + /* 278 */ "table_options", + /* 279 */ "multi_create_clause", + /* 280 */ "tags_def", + /* 281 */ "multi_drop_clause", + /* 282 */ "alter_table_clause", + /* 283 */ "alter_table_options", + /* 284 */ "column_name", + /* 285 */ "type_name", + /* 286 */ "signed_literal", + /* 287 */ "create_subtable_clause", + /* 288 */ "specific_tags_opt", + /* 289 */ "expression_list", + /* 290 */ "drop_table_clause", + /* 291 */ "col_name_list", + /* 292 */ "table_name", + /* 293 */ "column_def", + /* 294 */ "duration_list", + /* 295 */ "rollup_func_list", + /* 296 */ "alter_table_option", + /* 297 */ "duration_literal", + /* 298 */ "rollup_func_name", + /* 299 */ "function_name", + /* 300 */ "col_name", + /* 301 */ "db_name_cond_opt", + /* 302 */ "like_pattern_opt", + /* 303 */ "table_name_cond", + /* 304 */ "from_db_opt", + /* 305 */ "index_name", + /* 306 */ "index_options", + /* 307 */ "func_list", + /* 308 */ "sliding_opt", + /* 309 */ "sma_stream_opt", + /* 310 */ "func", + /* 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 */ "literal_list", + /* 326 */ "table_alias", + /* 327 */ "column_alias", + /* 328 */ "expression", + /* 329 */ "pseudo_column", + /* 330 */ "column_reference", + /* 331 */ "function_expression", + /* 332 */ "subquery", + /* 333 */ "star_func", + /* 334 */ "star_func_para_list", + /* 335 */ "noarg_func", + /* 336 */ "other_para_list", + /* 337 */ "star_func_para", + /* 338 */ "predicate", + /* 339 */ "compare_op", + /* 340 */ "in_op", + /* 341 */ "in_predicate_value", + /* 342 */ "boolean_value_expression", + /* 343 */ "boolean_primary", + /* 344 */ "common_expression", + /* 345 */ "from_clause_opt", + /* 346 */ "table_reference_list", + /* 347 */ "table_reference", + /* 348 */ "table_primary", + /* 349 */ "joined_table", + /* 350 */ "alias_opt", + /* 351 */ "parenthesized_joined_table", + /* 352 */ "join_type", + /* 353 */ "search_condition", + /* 354 */ "query_specification", + /* 355 */ "set_quantifier_opt", + /* 356 */ "select_list", + /* 357 */ "partition_by_clause_opt", + /* 358 */ "range_opt", + /* 359 */ "every_opt", + /* 360 */ "fill_opt", + /* 361 */ "twindow_clause_opt", + /* 362 */ "group_by_clause_opt", + /* 363 */ "having_clause_opt", + /* 364 */ "select_item", + /* 365 */ "fill_mode", + /* 366 */ "group_by_list", + /* 367 */ "query_expression_body", + /* 368 */ "order_by_clause_opt", + /* 369 */ "slimit_clause_opt", + /* 370 */ "limit_clause_opt", + /* 371 */ "query_primary", + /* 372 */ "sort_specification_list", + /* 373 */ "sort_specification", + /* 374 */ "ordering_specification_opt", + /* 375 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1719,423 +1682,424 @@ static const char *const yyRuleName[] = { /* 63 */ "cmd ::= DROP DATABASE exists_opt db_name", /* 64 */ "cmd ::= USE db_name", /* 65 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 66 */ "not_exists_opt ::= IF NOT EXISTS", - /* 67 */ "not_exists_opt ::=", - /* 68 */ "exists_opt ::= IF EXISTS", - /* 69 */ "exists_opt ::=", - /* 70 */ "db_options ::=", - /* 71 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 72 */ "db_options ::= db_options CACHELAST NK_INTEGER", - /* 73 */ "db_options ::= db_options COMP NK_INTEGER", - /* 74 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 75 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 76 */ "db_options ::= db_options FSYNC NK_INTEGER", - /* 77 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 78 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 79 */ "db_options ::= db_options KEEP integer_list", - /* 80 */ "db_options ::= db_options KEEP variable_list", - /* 81 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 82 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 83 */ "db_options ::= db_options PRECISION NK_STRING", - /* 84 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 85 */ "db_options ::= db_options STRICT NK_INTEGER", - /* 86 */ "db_options ::= db_options WAL NK_INTEGER", - /* 87 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 88 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 89 */ "db_options ::= db_options RETENTIONS retention_list", - /* 90 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 91 */ "alter_db_options ::= alter_db_option", - /* 92 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 93 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 94 */ "alter_db_option ::= CACHELAST NK_INTEGER", - /* 95 */ "alter_db_option ::= FSYNC NK_INTEGER", - /* 96 */ "alter_db_option ::= KEEP integer_list", - /* 97 */ "alter_db_option ::= KEEP variable_list", - /* 98 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 99 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 100 */ "alter_db_option ::= STRICT NK_INTEGER", - /* 101 */ "alter_db_option ::= WAL NK_INTEGER", - /* 102 */ "integer_list ::= NK_INTEGER", - /* 103 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 104 */ "variable_list ::= NK_VARIABLE", - /* 105 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 106 */ "retention_list ::= retention", - /* 107 */ "retention_list ::= retention_list NK_COMMA retention", - /* 108 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 109 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 110 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 111 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 112 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 113 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 114 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 115 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 116 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 117 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 118 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 119 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 120 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 121 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 122 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 123 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 124 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 125 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 126 */ "multi_create_clause ::= create_subtable_clause", - /* 127 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 128 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options", - /* 129 */ "multi_drop_clause ::= drop_table_clause", - /* 130 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 131 */ "drop_table_clause ::= exists_opt full_table_name", - /* 132 */ "specific_tags_opt ::=", - /* 133 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", - /* 134 */ "full_table_name ::= table_name", - /* 135 */ "full_table_name ::= db_name NK_DOT table_name", - /* 136 */ "column_def_list ::= column_def", - /* 137 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 138 */ "column_def ::= column_name type_name", - /* 139 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 140 */ "type_name ::= BOOL", - /* 141 */ "type_name ::= TINYINT", - /* 142 */ "type_name ::= SMALLINT", - /* 143 */ "type_name ::= INT", - /* 144 */ "type_name ::= INTEGER", - /* 145 */ "type_name ::= BIGINT", - /* 146 */ "type_name ::= FLOAT", - /* 147 */ "type_name ::= DOUBLE", - /* 148 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 149 */ "type_name ::= TIMESTAMP", - /* 150 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 151 */ "type_name ::= TINYINT UNSIGNED", - /* 152 */ "type_name ::= SMALLINT UNSIGNED", - /* 153 */ "type_name ::= INT UNSIGNED", - /* 154 */ "type_name ::= BIGINT UNSIGNED", - /* 155 */ "type_name ::= JSON", - /* 156 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 157 */ "type_name ::= MEDIUMBLOB", - /* 158 */ "type_name ::= BLOB", - /* 159 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 160 */ "type_name ::= DECIMAL", - /* 161 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 162 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 163 */ "tags_def_opt ::=", - /* 164 */ "tags_def_opt ::= tags_def", - /* 165 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 166 */ "table_options ::=", - /* 167 */ "table_options ::= table_options COMMENT NK_STRING", - /* 168 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 169 */ "table_options ::= table_options WATERMARK duration_list", - /* 170 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 171 */ "table_options ::= table_options TTL NK_INTEGER", - /* 172 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 173 */ "alter_table_options ::= alter_table_option", - /* 174 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 175 */ "alter_table_option ::= COMMENT NK_STRING", - /* 176 */ "alter_table_option ::= TTL NK_INTEGER", - /* 177 */ "duration_list ::= duration_literal", - /* 178 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 179 */ "rollup_func_list ::= rollup_func_name", - /* 180 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 181 */ "rollup_func_name ::= function_name", - /* 182 */ "rollup_func_name ::= FIRST", - /* 183 */ "rollup_func_name ::= LAST", - /* 184 */ "col_name_list ::= col_name", - /* 185 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 186 */ "col_name ::= column_name", - /* 187 */ "cmd ::= SHOW DNODES", - /* 188 */ "cmd ::= SHOW USERS", - /* 189 */ "cmd ::= SHOW DATABASES", - /* 190 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 191 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 192 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 193 */ "cmd ::= SHOW MNODES", - /* 194 */ "cmd ::= SHOW MODULES", - /* 195 */ "cmd ::= SHOW QNODES", - /* 196 */ "cmd ::= SHOW FUNCTIONS", - /* 197 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 198 */ "cmd ::= SHOW STREAMS", - /* 199 */ "cmd ::= SHOW ACCOUNTS", - /* 200 */ "cmd ::= SHOW APPS", - /* 201 */ "cmd ::= SHOW CONNECTIONS", - /* 202 */ "cmd ::= SHOW LICENCE", - /* 203 */ "cmd ::= SHOW GRANTS", - /* 204 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 205 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 206 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 207 */ "cmd ::= SHOW QUERIES", - /* 208 */ "cmd ::= SHOW SCORES", - /* 209 */ "cmd ::= SHOW TOPICS", - /* 210 */ "cmd ::= SHOW VARIABLES", - /* 211 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 212 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", - /* 213 */ "cmd ::= SHOW BNODES", - /* 214 */ "cmd ::= SHOW SNODES", - /* 215 */ "cmd ::= SHOW CLUSTER", - /* 216 */ "cmd ::= SHOW TRANSACTIONS", - /* 217 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 218 */ "cmd ::= SHOW CONSUMERS", - /* 219 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 220 */ "db_name_cond_opt ::=", - /* 221 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 222 */ "like_pattern_opt ::=", - /* 223 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 224 */ "table_name_cond ::= table_name", - /* 225 */ "from_db_opt ::=", - /* 226 */ "from_db_opt ::= FROM db_name", - /* 227 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 228 */ "cmd ::= DROP INDEX exists_opt index_name", - /* 229 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 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", - /* 231 */ "func_list ::= func", - /* 232 */ "func_list ::= func_list NK_COMMA func", - /* 233 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 234 */ "sma_stream_opt ::=", - /* 235 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 236 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 237 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 238 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 239 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 240 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 241 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 242 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 243 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 244 */ "cmd ::= DESC full_table_name", - /* 245 */ "cmd ::= DESCRIBE full_table_name", - /* 246 */ "cmd ::= RESET QUERY CACHE", - /* 247 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 248 */ "analyze_opt ::=", - /* 249 */ "analyze_opt ::= ANALYZE", - /* 250 */ "explain_options ::=", - /* 251 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 252 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 253 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 254 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 255 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 256 */ "agg_func_opt ::=", - /* 257 */ "agg_func_opt ::= AGGREGATE", - /* 258 */ "bufsize_opt ::=", - /* 259 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 260 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", - /* 261 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 262 */ "into_opt ::=", - /* 263 */ "into_opt ::= INTO full_table_name", - /* 264 */ "stream_options ::=", - /* 265 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 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 */ "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", + /* 66 */ "cmd ::= FLUSH DATABASE db_name", + /* 67 */ "not_exists_opt ::= IF NOT EXISTS", + /* 68 */ "not_exists_opt ::=", + /* 69 */ "exists_opt ::= IF EXISTS", + /* 70 */ "exists_opt ::=", + /* 71 */ "db_options ::=", + /* 72 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 73 */ "db_options ::= db_options CACHELAST NK_INTEGER", + /* 74 */ "db_options ::= db_options COMP NK_INTEGER", + /* 75 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 76 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 77 */ "db_options ::= db_options FSYNC NK_INTEGER", + /* 78 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 79 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 80 */ "db_options ::= db_options KEEP integer_list", + /* 81 */ "db_options ::= db_options KEEP variable_list", + /* 82 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 83 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 84 */ "db_options ::= db_options PRECISION NK_STRING", + /* 85 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 86 */ "db_options ::= db_options STRICT NK_INTEGER", + /* 87 */ "db_options ::= db_options WAL NK_INTEGER", + /* 88 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 89 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 90 */ "db_options ::= db_options RETENTIONS retention_list", + /* 91 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 92 */ "alter_db_options ::= alter_db_option", + /* 93 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 94 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 95 */ "alter_db_option ::= CACHELAST NK_INTEGER", + /* 96 */ "alter_db_option ::= FSYNC NK_INTEGER", + /* 97 */ "alter_db_option ::= KEEP integer_list", + /* 98 */ "alter_db_option ::= KEEP variable_list", + /* 99 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 100 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 101 */ "alter_db_option ::= STRICT NK_INTEGER", + /* 102 */ "alter_db_option ::= WAL NK_INTEGER", + /* 103 */ "integer_list ::= NK_INTEGER", + /* 104 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 105 */ "variable_list ::= NK_VARIABLE", + /* 106 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 107 */ "retention_list ::= retention", + /* 108 */ "retention_list ::= retention_list NK_COMMA retention", + /* 109 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 110 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 111 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 112 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 113 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 114 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 115 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 116 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 117 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 118 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 119 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 120 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 121 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 122 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 123 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 124 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 125 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 126 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 127 */ "multi_create_clause ::= create_subtable_clause", + /* 128 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 129 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options", + /* 130 */ "multi_drop_clause ::= drop_table_clause", + /* 131 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 132 */ "drop_table_clause ::= exists_opt full_table_name", + /* 133 */ "specific_tags_opt ::=", + /* 134 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", + /* 135 */ "full_table_name ::= table_name", + /* 136 */ "full_table_name ::= db_name NK_DOT table_name", + /* 137 */ "column_def_list ::= column_def", + /* 138 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 139 */ "column_def ::= column_name type_name", + /* 140 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 141 */ "type_name ::= BOOL", + /* 142 */ "type_name ::= TINYINT", + /* 143 */ "type_name ::= SMALLINT", + /* 144 */ "type_name ::= INT", + /* 145 */ "type_name ::= INTEGER", + /* 146 */ "type_name ::= BIGINT", + /* 147 */ "type_name ::= FLOAT", + /* 148 */ "type_name ::= DOUBLE", + /* 149 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 150 */ "type_name ::= TIMESTAMP", + /* 151 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 152 */ "type_name ::= TINYINT UNSIGNED", + /* 153 */ "type_name ::= SMALLINT UNSIGNED", + /* 154 */ "type_name ::= INT UNSIGNED", + /* 155 */ "type_name ::= BIGINT UNSIGNED", + /* 156 */ "type_name ::= JSON", + /* 157 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 158 */ "type_name ::= MEDIUMBLOB", + /* 159 */ "type_name ::= BLOB", + /* 160 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 161 */ "type_name ::= DECIMAL", + /* 162 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 163 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 164 */ "tags_def_opt ::=", + /* 165 */ "tags_def_opt ::= tags_def", + /* 166 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 167 */ "table_options ::=", + /* 168 */ "table_options ::= table_options COMMENT NK_STRING", + /* 169 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 170 */ "table_options ::= table_options WATERMARK duration_list", + /* 171 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 172 */ "table_options ::= table_options TTL NK_INTEGER", + /* 173 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 174 */ "alter_table_options ::= alter_table_option", + /* 175 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 176 */ "alter_table_option ::= COMMENT NK_STRING", + /* 177 */ "alter_table_option ::= TTL NK_INTEGER", + /* 178 */ "duration_list ::= duration_literal", + /* 179 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 180 */ "rollup_func_list ::= rollup_func_name", + /* 181 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 182 */ "rollup_func_name ::= function_name", + /* 183 */ "rollup_func_name ::= FIRST", + /* 184 */ "rollup_func_name ::= LAST", + /* 185 */ "col_name_list ::= col_name", + /* 186 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 187 */ "col_name ::= column_name", + /* 188 */ "cmd ::= SHOW DNODES", + /* 189 */ "cmd ::= SHOW USERS", + /* 190 */ "cmd ::= SHOW DATABASES", + /* 191 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 192 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 193 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 194 */ "cmd ::= SHOW MNODES", + /* 195 */ "cmd ::= SHOW MODULES", + /* 196 */ "cmd ::= SHOW QNODES", + /* 197 */ "cmd ::= SHOW FUNCTIONS", + /* 198 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 199 */ "cmd ::= SHOW STREAMS", + /* 200 */ "cmd ::= SHOW ACCOUNTS", + /* 201 */ "cmd ::= SHOW APPS", + /* 202 */ "cmd ::= SHOW CONNECTIONS", + /* 203 */ "cmd ::= SHOW LICENCE", + /* 204 */ "cmd ::= SHOW GRANTS", + /* 205 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 206 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 207 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 208 */ "cmd ::= SHOW QUERIES", + /* 209 */ "cmd ::= SHOW SCORES", + /* 210 */ "cmd ::= SHOW TOPICS", + /* 211 */ "cmd ::= SHOW VARIABLES", + /* 212 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 213 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", + /* 214 */ "cmd ::= SHOW BNODES", + /* 215 */ "cmd ::= SHOW SNODES", + /* 216 */ "cmd ::= SHOW CLUSTER", + /* 217 */ "cmd ::= SHOW TRANSACTIONS", + /* 218 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 219 */ "cmd ::= SHOW CONSUMERS", + /* 220 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 221 */ "db_name_cond_opt ::=", + /* 222 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 223 */ "like_pattern_opt ::=", + /* 224 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 225 */ "table_name_cond ::= table_name", + /* 226 */ "from_db_opt ::=", + /* 227 */ "from_db_opt ::= FROM db_name", + /* 228 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 229 */ "cmd ::= DROP INDEX exists_opt index_name", + /* 230 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 231 */ "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", + /* 232 */ "func_list ::= func", + /* 233 */ "func_list ::= func_list NK_COMMA func", + /* 234 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 235 */ "sma_stream_opt ::=", + /* 236 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 237 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 238 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 239 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 240 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 241 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 242 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 243 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 244 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 245 */ "cmd ::= DESC full_table_name", + /* 246 */ "cmd ::= DESCRIBE full_table_name", + /* 247 */ "cmd ::= RESET QUERY CACHE", + /* 248 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 249 */ "analyze_opt ::=", + /* 250 */ "analyze_opt ::= ANALYZE", + /* 251 */ "explain_options ::=", + /* 252 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 253 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 254 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 255 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 256 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 257 */ "agg_func_opt ::=", + /* 258 */ "agg_func_opt ::= AGGREGATE", + /* 259 */ "bufsize_opt ::=", + /* 260 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 261 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 262 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 263 */ "into_opt ::=", + /* 264 */ "into_opt ::= INTO full_table_name", + /* 265 */ "stream_options ::=", + /* 266 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 267 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 268 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 269 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 270 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 271 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 272 */ "cmd ::= KILL QUERY NK_STRING", + /* 273 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 274 */ "cmd ::= BALANCE VGROUP", + /* 275 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 276 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 277 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 278 */ "dnode_list ::= DNODE NK_INTEGER", + /* 279 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 280 */ "cmd ::= SYNCDB db_name REPLICA", + /* 281 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 282 */ "cmd ::= query_expression", + /* 283 */ "literal ::= NK_INTEGER", + /* 284 */ "literal ::= NK_FLOAT", + /* 285 */ "literal ::= NK_STRING", + /* 286 */ "literal ::= NK_BOOL", + /* 287 */ "literal ::= TIMESTAMP NK_STRING", + /* 288 */ "literal ::= duration_literal", + /* 289 */ "literal ::= NULL", + /* 290 */ "literal ::= NK_QUESTION", + /* 291 */ "duration_literal ::= NK_VARIABLE", + /* 292 */ "signed ::= NK_INTEGER", + /* 293 */ "signed ::= NK_PLUS NK_INTEGER", + /* 294 */ "signed ::= NK_MINUS NK_INTEGER", + /* 295 */ "signed ::= NK_FLOAT", + /* 296 */ "signed ::= NK_PLUS NK_FLOAT", + /* 297 */ "signed ::= NK_MINUS NK_FLOAT", + /* 298 */ "signed_literal ::= signed", + /* 299 */ "signed_literal ::= NK_STRING", + /* 300 */ "signed_literal ::= NK_BOOL", + /* 301 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 302 */ "signed_literal ::= duration_literal", + /* 303 */ "signed_literal ::= NULL", + /* 304 */ "signed_literal ::= literal_func", + /* 305 */ "literal_list ::= signed_literal", + /* 306 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 307 */ "db_name ::= NK_ID", + /* 308 */ "table_name ::= NK_ID", + /* 309 */ "column_name ::= NK_ID", + /* 310 */ "function_name ::= NK_ID", + /* 311 */ "table_alias ::= NK_ID", + /* 312 */ "column_alias ::= NK_ID", + /* 313 */ "user_name ::= NK_ID", + /* 314 */ "index_name ::= NK_ID", + /* 315 */ "topic_name ::= NK_ID", + /* 316 */ "stream_name ::= NK_ID", + /* 317 */ "cgroup_name ::= NK_ID", + /* 318 */ "expression ::= literal", + /* 319 */ "expression ::= pseudo_column", + /* 320 */ "expression ::= column_reference", + /* 321 */ "expression ::= function_expression", + /* 322 */ "expression ::= subquery", + /* 323 */ "expression ::= NK_LP expression NK_RP", + /* 324 */ "expression ::= NK_PLUS expression", + /* 325 */ "expression ::= NK_MINUS expression", + /* 326 */ "expression ::= expression NK_PLUS expression", + /* 327 */ "expression ::= expression NK_MINUS expression", + /* 328 */ "expression ::= expression NK_STAR expression", + /* 329 */ "expression ::= expression NK_SLASH expression", + /* 330 */ "expression ::= expression NK_REM expression", + /* 331 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 332 */ "expression ::= expression NK_BITAND expression", + /* 333 */ "expression ::= expression NK_BITOR expression", + /* 334 */ "expression_list ::= expression", + /* 335 */ "expression_list ::= expression_list NK_COMMA expression", + /* 336 */ "column_reference ::= column_name", + /* 337 */ "column_reference ::= table_name NK_DOT column_name", + /* 338 */ "pseudo_column ::= ROWTS", + /* 339 */ "pseudo_column ::= TBNAME", + /* 340 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 341 */ "pseudo_column ::= QSTARTTS", + /* 342 */ "pseudo_column ::= QENDTS", + /* 343 */ "pseudo_column ::= WSTARTTS", + /* 344 */ "pseudo_column ::= WENDTS", + /* 345 */ "pseudo_column ::= WDURATION", + /* 346 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 347 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 348 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 349 */ "function_expression ::= literal_func", + /* 350 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 351 */ "literal_func ::= NOW", + /* 352 */ "noarg_func ::= NOW", + /* 353 */ "noarg_func ::= TODAY", + /* 354 */ "noarg_func ::= TIMEZONE", + /* 355 */ "noarg_func ::= DATABASE", + /* 356 */ "noarg_func ::= CLIENT_VERSION", + /* 357 */ "noarg_func ::= SERVER_VERSION", + /* 358 */ "noarg_func ::= SERVER_STATUS", + /* 359 */ "noarg_func ::= CURRENT_USER", + /* 360 */ "noarg_func ::= USER", + /* 361 */ "star_func ::= COUNT", + /* 362 */ "star_func ::= FIRST", + /* 363 */ "star_func ::= LAST", + /* 364 */ "star_func ::= LAST_ROW", + /* 365 */ "star_func_para_list ::= NK_STAR", + /* 366 */ "star_func_para_list ::= other_para_list", + /* 367 */ "other_para_list ::= star_func_para", + /* 368 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 369 */ "star_func_para ::= expression", + /* 370 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 371 */ "predicate ::= expression compare_op expression", + /* 372 */ "predicate ::= expression BETWEEN expression AND expression", + /* 373 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 374 */ "predicate ::= expression IS NULL", + /* 375 */ "predicate ::= expression IS NOT NULL", + /* 376 */ "predicate ::= expression in_op in_predicate_value", + /* 377 */ "compare_op ::= NK_LT", + /* 378 */ "compare_op ::= NK_GT", + /* 379 */ "compare_op ::= NK_LE", + /* 380 */ "compare_op ::= NK_GE", + /* 381 */ "compare_op ::= NK_NE", + /* 382 */ "compare_op ::= NK_EQ", + /* 383 */ "compare_op ::= LIKE", + /* 384 */ "compare_op ::= NOT LIKE", + /* 385 */ "compare_op ::= MATCH", + /* 386 */ "compare_op ::= NMATCH", + /* 387 */ "compare_op ::= CONTAINS", + /* 388 */ "in_op ::= IN", + /* 389 */ "in_op ::= NOT IN", + /* 390 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 391 */ "boolean_value_expression ::= boolean_primary", + /* 392 */ "boolean_value_expression ::= NOT boolean_primary", + /* 393 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 394 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 395 */ "boolean_primary ::= predicate", + /* 396 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 397 */ "common_expression ::= expression", + /* 398 */ "common_expression ::= boolean_value_expression", + /* 399 */ "from_clause_opt ::=", + /* 400 */ "from_clause_opt ::= FROM table_reference_list", + /* 401 */ "table_reference_list ::= table_reference", + /* 402 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 403 */ "table_reference ::= table_primary", + /* 404 */ "table_reference ::= joined_table", + /* 405 */ "table_primary ::= table_name alias_opt", + /* 406 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 407 */ "table_primary ::= subquery alias_opt", + /* 408 */ "table_primary ::= parenthesized_joined_table", + /* 409 */ "alias_opt ::=", + /* 410 */ "alias_opt ::= table_alias", + /* 411 */ "alias_opt ::= AS table_alias", + /* 412 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 413 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 414 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 415 */ "join_type ::=", + /* 416 */ "join_type ::= INNER", + /* 417 */ "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", + /* 418 */ "set_quantifier_opt ::=", + /* 419 */ "set_quantifier_opt ::= DISTINCT", + /* 420 */ "set_quantifier_opt ::= ALL", + /* 421 */ "select_list ::= select_item", + /* 422 */ "select_list ::= select_list NK_COMMA select_item", + /* 423 */ "select_item ::= NK_STAR", + /* 424 */ "select_item ::= common_expression", + /* 425 */ "select_item ::= common_expression column_alias", + /* 426 */ "select_item ::= common_expression AS column_alias", + /* 427 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 428 */ "where_clause_opt ::=", + /* 429 */ "where_clause_opt ::= WHERE search_condition", + /* 430 */ "partition_by_clause_opt ::=", + /* 431 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 432 */ "twindow_clause_opt ::=", + /* 433 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 434 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 435 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 436 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 437 */ "sliding_opt ::=", + /* 438 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 439 */ "fill_opt ::=", + /* 440 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 441 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 442 */ "fill_mode ::= NONE", + /* 443 */ "fill_mode ::= PREV", + /* 444 */ "fill_mode ::= NULL", + /* 445 */ "fill_mode ::= LINEAR", + /* 446 */ "fill_mode ::= NEXT", + /* 447 */ "group_by_clause_opt ::=", + /* 448 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 449 */ "group_by_list ::= expression", + /* 450 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 451 */ "having_clause_opt ::=", + /* 452 */ "having_clause_opt ::= HAVING search_condition", + /* 453 */ "range_opt ::=", + /* 454 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 455 */ "every_opt ::=", + /* 456 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 457 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 458 */ "query_expression_body ::= query_primary", + /* 459 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 460 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 461 */ "query_primary ::= query_specification", + /* 462 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 463 */ "order_by_clause_opt ::=", + /* 464 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 465 */ "slimit_clause_opt ::=", + /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 467 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 468 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 469 */ "limit_clause_opt ::=", + /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 471 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 472 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 473 */ "subquery ::= NK_LP query_expression NK_RP", + /* 474 */ "search_condition ::= common_expression", + /* 475 */ "sort_specification_list ::= sort_specification", + /* 476 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 477 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 478 */ "ordering_specification_opt ::=", + /* 479 */ "ordering_specification_opt ::= ASC", + /* 480 */ "ordering_specification_opt ::= DESC", + /* 481 */ "null_ordering_opt ::=", + /* 482 */ "null_ordering_opt ::= NULLS FIRST", + /* 483 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2262,181 +2226,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - 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 310: /* stream_options */ - case 312: /* query_expression */ - case 315: /* explain_options */ - case 319: /* into_opt */ - case 321: /* where_clause_opt */ - case 322: /* signed */ - case 323: /* 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 */ + case 253: /* cmd */ + case 256: /* literal */ + case 267: /* db_options */ + case 269: /* alter_db_options */ + case 274: /* retention */ + case 275: /* full_table_name */ + case 278: /* table_options */ + case 282: /* alter_table_clause */ + case 283: /* alter_table_options */ + case 286: /* signed_literal */ + case 287: /* create_subtable_clause */ + case 290: /* drop_table_clause */ + case 293: /* column_def */ + case 297: /* duration_literal */ + case 298: /* rollup_func_name */ + case 300: /* col_name */ + case 301: /* db_name_cond_opt */ + case 302: /* like_pattern_opt */ + case 303: /* table_name_cond */ + case 304: /* from_db_opt */ + case 306: /* index_options */ + case 308: /* sliding_opt */ + case 309: /* sma_stream_opt */ + case 310: /* 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 328: /* expression */ + case 329: /* pseudo_column */ + case 330: /* column_reference */ + case 331: /* function_expression */ + case 332: /* subquery */ + case 337: /* star_func_para */ + case 338: /* predicate */ + case 341: /* in_predicate_value */ + case 342: /* boolean_value_expression */ + case 343: /* boolean_primary */ + case 344: /* common_expression */ + case 345: /* from_clause_opt */ + case 346: /* table_reference_list */ + case 347: /* table_reference */ + case 348: /* table_primary */ + case 349: /* joined_table */ + case 351: /* parenthesized_joined_table */ + case 353: /* search_condition */ + case 354: /* query_specification */ + case 358: /* range_opt */ + case 359: /* every_opt */ + case 360: /* fill_opt */ + case 361: /* twindow_clause_opt */ + case 363: /* having_clause_opt */ + case 364: /* select_item */ + case 367: /* query_expression_body */ + case 369: /* slimit_clause_opt */ + case 370: /* limit_clause_opt */ + case 371: /* query_primary */ + case 373: /* sort_specification */ { - nodesDestroyNode((yypminor->yy212)); + nodesDestroyNode((yypminor->yy248)); } break; - case 253: /* account_options */ - case 254: /* alter_account_options */ - case 256: /* alter_account_option */ - case 317: /* bufsize_opt */ + case 254: /* account_options */ + case 255: /* alter_account_options */ + case 257: /* alter_account_option */ + case 318: /* bufsize_opt */ { } break; - 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 311: /* topic_name */ - case 313: /* cgroup_name */ - case 318: /* stream_name */ - case 325: /* table_alias */ - case 326: /* column_alias */ - case 332: /* star_func */ - case 334: /* noarg_func */ - case 349: /* alias_opt */ + case 258: /* user_name */ + case 261: /* priv_level */ + case 264: /* db_name */ + case 265: /* dnode_endpoint */ + case 284: /* column_name */ + case 292: /* table_name */ + case 299: /* function_name */ + case 305: /* index_name */ + case 312: /* topic_name */ + case 314: /* cgroup_name */ + case 319: /* stream_name */ + case 326: /* table_alias */ + case 327: /* column_alias */ + case 333: /* star_func */ + case 335: /* noarg_func */ + case 350: /* alias_opt */ { } break; - case 258: /* sysinfo_opt */ + case 259: /* sysinfo_opt */ { } break; - case 259: /* privileges */ - case 261: /* priv_type_list */ - case 262: /* priv_type */ + case 260: /* privileges */ + case 262: /* priv_type_list */ + case 263: /* priv_type */ { } break; - case 265: /* not_exists_opt */ - case 267: /* exists_opt */ - case 314: /* analyze_opt */ - case 316: /* agg_func_opt */ - case 354: /* set_quantifier_opt */ + case 266: /* not_exists_opt */ + case 268: /* exists_opt */ + case 315: /* analyze_opt */ + case 317: /* agg_func_opt */ + case 355: /* set_quantifier_opt */ { } break; - 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: /* expression_list */ - case 290: /* col_name_list */ - case 293: /* duration_list */ - case 294: /* rollup_func_list */ - case 306: /* func_list */ - case 320: /* dnode_list */ - case 324: /* literal_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 */ + case 270: /* integer_list */ + case 271: /* variable_list */ + case 272: /* retention_list */ + case 276: /* column_def_list */ + case 277: /* tags_def_opt */ + case 279: /* multi_create_clause */ + case 280: /* tags_def */ + case 281: /* multi_drop_clause */ + case 288: /* specific_tags_opt */ + case 289: /* expression_list */ + case 291: /* col_name_list */ + case 294: /* duration_list */ + case 295: /* rollup_func_list */ + case 307: /* func_list */ + case 321: /* dnode_list */ + case 325: /* literal_list */ + case 334: /* star_func_para_list */ + case 336: /* other_para_list */ + case 356: /* select_list */ + case 357: /* partition_by_clause_opt */ + case 362: /* group_by_clause_opt */ + case 366: /* group_by_list */ + case 368: /* order_by_clause_opt */ + case 372: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy424)); + nodesDestroyList((yypminor->yy552)); } break; - case 272: /* alter_db_option */ - case 295: /* alter_table_option */ + case 273: /* alter_db_option */ + case 296: /* alter_table_option */ { } break; - case 284: /* type_name */ + case 285: /* type_name */ { } break; - case 338: /* compare_op */ - case 339: /* in_op */ + case 339: /* compare_op */ + case 340: /* in_op */ { } break; - case 351: /* join_type */ + case 352: /* join_type */ { } break; - case 364: /* fill_mode */ + case 365: /* fill_mode */ { } break; - case 373: /* ordering_specification_opt */ + case 374: /* ordering_specification_opt */ { } break; - case 374: /* null_ordering_opt */ + case 375: /* null_ordering_opt */ { } @@ -2735,489 +2699,490 @@ 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[] = { - { 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 expression_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 */ - { 314, 0 }, /* (248) analyze_opt ::= */ - { 314, -1 }, /* (249) analyze_opt ::= ANALYZE */ - { 315, 0 }, /* (250) explain_options ::= */ - { 315, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 315, -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 */ - { 316, 0 }, /* (256) agg_func_opt ::= */ - { 316, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ - { 317, 0 }, /* (258) bufsize_opt ::= */ - { 317, -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 */ - { 319, 0 }, /* (262) into_opt ::= */ - { 319, -2 }, /* (263) into_opt ::= INTO full_table_name */ - { 310, 0 }, /* (264) stream_options ::= */ - { 310, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 310, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 310, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 310, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ - { 310, -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 */ - { 320, -2 }, /* (277) dnode_list ::= DNODE NK_INTEGER */ - { 320, -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 */ - { 322, -1 }, /* (291) signed ::= NK_INTEGER */ - { 322, -2 }, /* (292) signed ::= NK_PLUS NK_INTEGER */ - { 322, -2 }, /* (293) signed ::= NK_MINUS NK_INTEGER */ - { 322, -1 }, /* (294) signed ::= NK_FLOAT */ - { 322, -2 }, /* (295) signed ::= NK_PLUS NK_FLOAT */ - { 322, -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 */ - { 324, -1 }, /* (304) literal_list ::= signed_literal */ - { 324, -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 */ - { 311, -1 }, /* (314) topic_name ::= NK_ID */ - { 318, -1 }, /* (315) stream_name ::= NK_ID */ - { 313, -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 */ - { 288, -1 }, /* (333) expression_list ::= expression */ - { 288, -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 */ - { 323, -3 }, /* (349) literal_func ::= noarg_func NK_LP NK_RP */ - { 323, -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 */ - { 321, 0 }, /* (427) where_clause_opt ::= */ - { 321, -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 */ - { 312, -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 */ + { 253, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 253, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 254, 0 }, /* (2) account_options ::= */ + { 254, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 254, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 254, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 254, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 254, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 254, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 254, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 254, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 254, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 255, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 255, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 257, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 257, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 257, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 257, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 257, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 257, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 257, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 257, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 257, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 257, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 253, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 253, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 253, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 253, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 253, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 259, 0 }, /* (29) sysinfo_opt ::= */ + { 259, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 253, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 253, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 260, -1 }, /* (33) privileges ::= ALL */ + { 260, -1 }, /* (34) privileges ::= priv_type_list */ + { 262, -1 }, /* (35) priv_type_list ::= priv_type */ + { 262, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 263, -1 }, /* (37) priv_type ::= READ */ + { 263, -1 }, /* (38) priv_type ::= WRITE */ + { 261, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 261, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 253, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 253, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 253, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 253, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 253, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 253, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 253, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 253, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 265, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 265, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 265, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 253, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 253, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 253, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 253, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 253, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 253, -2 }, /* (64) cmd ::= USE db_name */ + { 253, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 253, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 266, -3 }, /* (67) not_exists_opt ::= IF NOT EXISTS */ + { 266, 0 }, /* (68) not_exists_opt ::= */ + { 268, -2 }, /* (69) exists_opt ::= IF EXISTS */ + { 268, 0 }, /* (70) exists_opt ::= */ + { 267, 0 }, /* (71) db_options ::= */ + { 267, -3 }, /* (72) db_options ::= db_options BUFFER NK_INTEGER */ + { 267, -3 }, /* (73) db_options ::= db_options CACHELAST NK_INTEGER */ + { 267, -3 }, /* (74) db_options ::= db_options COMP NK_INTEGER */ + { 267, -3 }, /* (75) db_options ::= db_options DURATION NK_INTEGER */ + { 267, -3 }, /* (76) db_options ::= db_options DURATION NK_VARIABLE */ + { 267, -3 }, /* (77) db_options ::= db_options FSYNC NK_INTEGER */ + { 267, -3 }, /* (78) db_options ::= db_options MAXROWS NK_INTEGER */ + { 267, -3 }, /* (79) db_options ::= db_options MINROWS NK_INTEGER */ + { 267, -3 }, /* (80) db_options ::= db_options KEEP integer_list */ + { 267, -3 }, /* (81) db_options ::= db_options KEEP variable_list */ + { 267, -3 }, /* (82) db_options ::= db_options PAGES NK_INTEGER */ + { 267, -3 }, /* (83) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 267, -3 }, /* (84) db_options ::= db_options PRECISION NK_STRING */ + { 267, -3 }, /* (85) db_options ::= db_options REPLICA NK_INTEGER */ + { 267, -3 }, /* (86) db_options ::= db_options STRICT NK_INTEGER */ + { 267, -3 }, /* (87) db_options ::= db_options WAL NK_INTEGER */ + { 267, -3 }, /* (88) db_options ::= db_options VGROUPS NK_INTEGER */ + { 267, -3 }, /* (89) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 267, -3 }, /* (90) db_options ::= db_options RETENTIONS retention_list */ + { 267, -3 }, /* (91) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 269, -1 }, /* (92) alter_db_options ::= alter_db_option */ + { 269, -2 }, /* (93) alter_db_options ::= alter_db_options alter_db_option */ + { 273, -2 }, /* (94) alter_db_option ::= BUFFER NK_INTEGER */ + { 273, -2 }, /* (95) alter_db_option ::= CACHELAST NK_INTEGER */ + { 273, -2 }, /* (96) alter_db_option ::= FSYNC NK_INTEGER */ + { 273, -2 }, /* (97) alter_db_option ::= KEEP integer_list */ + { 273, -2 }, /* (98) alter_db_option ::= KEEP variable_list */ + { 273, -2 }, /* (99) alter_db_option ::= PAGES NK_INTEGER */ + { 273, -2 }, /* (100) alter_db_option ::= REPLICA NK_INTEGER */ + { 273, -2 }, /* (101) alter_db_option ::= STRICT NK_INTEGER */ + { 273, -2 }, /* (102) alter_db_option ::= WAL NK_INTEGER */ + { 270, -1 }, /* (103) integer_list ::= NK_INTEGER */ + { 270, -3 }, /* (104) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 271, -1 }, /* (105) variable_list ::= NK_VARIABLE */ + { 271, -3 }, /* (106) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 272, -1 }, /* (107) retention_list ::= retention */ + { 272, -3 }, /* (108) retention_list ::= retention_list NK_COMMA retention */ + { 274, -3 }, /* (109) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 253, -9 }, /* (110) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 253, -3 }, /* (111) cmd ::= CREATE TABLE multi_create_clause */ + { 253, -9 }, /* (112) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 253, -3 }, /* (113) cmd ::= DROP TABLE multi_drop_clause */ + { 253, -4 }, /* (114) cmd ::= DROP STABLE exists_opt full_table_name */ + { 253, -3 }, /* (115) cmd ::= ALTER TABLE alter_table_clause */ + { 253, -3 }, /* (116) cmd ::= ALTER STABLE alter_table_clause */ + { 282, -2 }, /* (117) alter_table_clause ::= full_table_name alter_table_options */ + { 282, -5 }, /* (118) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 282, -4 }, /* (119) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 282, -5 }, /* (120) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 282, -5 }, /* (121) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 282, -5 }, /* (122) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 282, -4 }, /* (123) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 282, -5 }, /* (124) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 282, -5 }, /* (125) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 282, -6 }, /* (126) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 279, -1 }, /* (127) multi_create_clause ::= create_subtable_clause */ + { 279, -2 }, /* (128) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 287, -10 }, /* (129) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options */ + { 281, -1 }, /* (130) multi_drop_clause ::= drop_table_clause */ + { 281, -2 }, /* (131) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 290, -2 }, /* (132) drop_table_clause ::= exists_opt full_table_name */ + { 288, 0 }, /* (133) specific_tags_opt ::= */ + { 288, -3 }, /* (134) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 275, -1 }, /* (135) full_table_name ::= table_name */ + { 275, -3 }, /* (136) full_table_name ::= db_name NK_DOT table_name */ + { 276, -1 }, /* (137) column_def_list ::= column_def */ + { 276, -3 }, /* (138) column_def_list ::= column_def_list NK_COMMA column_def */ + { 293, -2 }, /* (139) column_def ::= column_name type_name */ + { 293, -4 }, /* (140) column_def ::= column_name type_name COMMENT NK_STRING */ + { 285, -1 }, /* (141) type_name ::= BOOL */ + { 285, -1 }, /* (142) type_name ::= TINYINT */ + { 285, -1 }, /* (143) type_name ::= SMALLINT */ + { 285, -1 }, /* (144) type_name ::= INT */ + { 285, -1 }, /* (145) type_name ::= INTEGER */ + { 285, -1 }, /* (146) type_name ::= BIGINT */ + { 285, -1 }, /* (147) type_name ::= FLOAT */ + { 285, -1 }, /* (148) type_name ::= DOUBLE */ + { 285, -4 }, /* (149) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 285, -1 }, /* (150) type_name ::= TIMESTAMP */ + { 285, -4 }, /* (151) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 285, -2 }, /* (152) type_name ::= TINYINT UNSIGNED */ + { 285, -2 }, /* (153) type_name ::= SMALLINT UNSIGNED */ + { 285, -2 }, /* (154) type_name ::= INT UNSIGNED */ + { 285, -2 }, /* (155) type_name ::= BIGINT UNSIGNED */ + { 285, -1 }, /* (156) type_name ::= JSON */ + { 285, -4 }, /* (157) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 285, -1 }, /* (158) type_name ::= MEDIUMBLOB */ + { 285, -1 }, /* (159) type_name ::= BLOB */ + { 285, -4 }, /* (160) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 285, -1 }, /* (161) type_name ::= DECIMAL */ + { 285, -4 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 285, -6 }, /* (163) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 277, 0 }, /* (164) tags_def_opt ::= */ + { 277, -1 }, /* (165) tags_def_opt ::= tags_def */ + { 280, -4 }, /* (166) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 278, 0 }, /* (167) table_options ::= */ + { 278, -3 }, /* (168) table_options ::= table_options COMMENT NK_STRING */ + { 278, -3 }, /* (169) table_options ::= table_options MAX_DELAY duration_list */ + { 278, -3 }, /* (170) table_options ::= table_options WATERMARK duration_list */ + { 278, -5 }, /* (171) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 278, -3 }, /* (172) table_options ::= table_options TTL NK_INTEGER */ + { 278, -5 }, /* (173) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 283, -1 }, /* (174) alter_table_options ::= alter_table_option */ + { 283, -2 }, /* (175) alter_table_options ::= alter_table_options alter_table_option */ + { 296, -2 }, /* (176) alter_table_option ::= COMMENT NK_STRING */ + { 296, -2 }, /* (177) alter_table_option ::= TTL NK_INTEGER */ + { 294, -1 }, /* (178) duration_list ::= duration_literal */ + { 294, -3 }, /* (179) duration_list ::= duration_list NK_COMMA duration_literal */ + { 295, -1 }, /* (180) rollup_func_list ::= rollup_func_name */ + { 295, -3 }, /* (181) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 298, -1 }, /* (182) rollup_func_name ::= function_name */ + { 298, -1 }, /* (183) rollup_func_name ::= FIRST */ + { 298, -1 }, /* (184) rollup_func_name ::= LAST */ + { 291, -1 }, /* (185) col_name_list ::= col_name */ + { 291, -3 }, /* (186) col_name_list ::= col_name_list NK_COMMA col_name */ + { 300, -1 }, /* (187) col_name ::= column_name */ + { 253, -2 }, /* (188) cmd ::= SHOW DNODES */ + { 253, -2 }, /* (189) cmd ::= SHOW USERS */ + { 253, -2 }, /* (190) cmd ::= SHOW DATABASES */ + { 253, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 253, -4 }, /* (192) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 253, -3 }, /* (193) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 253, -2 }, /* (194) cmd ::= SHOW MNODES */ + { 253, -2 }, /* (195) cmd ::= SHOW MODULES */ + { 253, -2 }, /* (196) cmd ::= SHOW QNODES */ + { 253, -2 }, /* (197) cmd ::= SHOW FUNCTIONS */ + { 253, -5 }, /* (198) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 253, -2 }, /* (199) cmd ::= SHOW STREAMS */ + { 253, -2 }, /* (200) cmd ::= SHOW ACCOUNTS */ + { 253, -2 }, /* (201) cmd ::= SHOW APPS */ + { 253, -2 }, /* (202) cmd ::= SHOW CONNECTIONS */ + { 253, -2 }, /* (203) cmd ::= SHOW LICENCE */ + { 253, -2 }, /* (204) cmd ::= SHOW GRANTS */ + { 253, -4 }, /* (205) cmd ::= SHOW CREATE DATABASE db_name */ + { 253, -4 }, /* (206) cmd ::= SHOW CREATE TABLE full_table_name */ + { 253, -4 }, /* (207) cmd ::= SHOW CREATE STABLE full_table_name */ + { 253, -2 }, /* (208) cmd ::= SHOW QUERIES */ + { 253, -2 }, /* (209) cmd ::= SHOW SCORES */ + { 253, -2 }, /* (210) cmd ::= SHOW TOPICS */ + { 253, -2 }, /* (211) cmd ::= SHOW VARIABLES */ + { 253, -3 }, /* (212) cmd ::= SHOW LOCAL VARIABLES */ + { 253, -4 }, /* (213) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 253, -2 }, /* (214) cmd ::= SHOW BNODES */ + { 253, -2 }, /* (215) cmd ::= SHOW SNODES */ + { 253, -2 }, /* (216) cmd ::= SHOW CLUSTER */ + { 253, -2 }, /* (217) cmd ::= SHOW TRANSACTIONS */ + { 253, -4 }, /* (218) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 253, -2 }, /* (219) cmd ::= SHOW CONSUMERS */ + { 253, -2 }, /* (220) cmd ::= SHOW SUBSCRIPTIONS */ + { 301, 0 }, /* (221) db_name_cond_opt ::= */ + { 301, -2 }, /* (222) db_name_cond_opt ::= db_name NK_DOT */ + { 302, 0 }, /* (223) like_pattern_opt ::= */ + { 302, -2 }, /* (224) like_pattern_opt ::= LIKE NK_STRING */ + { 303, -1 }, /* (225) table_name_cond ::= table_name */ + { 304, 0 }, /* (226) from_db_opt ::= */ + { 304, -2 }, /* (227) from_db_opt ::= FROM db_name */ + { 253, -8 }, /* (228) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 253, -4 }, /* (229) cmd ::= DROP INDEX exists_opt index_name */ + { 306, -10 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 306, -12 }, /* (231) 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 */ + { 307, -1 }, /* (232) func_list ::= func */ + { 307, -3 }, /* (233) func_list ::= func_list NK_COMMA func */ + { 310, -4 }, /* (234) func ::= function_name NK_LP expression_list NK_RP */ + { 309, 0 }, /* (235) sma_stream_opt ::= */ + { 309, -3 }, /* (236) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 309, -3 }, /* (237) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 253, -6 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 253, -7 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 253, -9 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 253, -7 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 253, -9 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 253, -4 }, /* (243) cmd ::= DROP TOPIC exists_opt topic_name */ + { 253, -7 }, /* (244) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 253, -2 }, /* (245) cmd ::= DESC full_table_name */ + { 253, -2 }, /* (246) cmd ::= DESCRIBE full_table_name */ + { 253, -3 }, /* (247) cmd ::= RESET QUERY CACHE */ + { 253, -4 }, /* (248) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 315, 0 }, /* (249) analyze_opt ::= */ + { 315, -1 }, /* (250) analyze_opt ::= ANALYZE */ + { 316, 0 }, /* (251) explain_options ::= */ + { 316, -3 }, /* (252) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 316, -3 }, /* (253) explain_options ::= explain_options RATIO NK_FLOAT */ + { 253, -6 }, /* (254) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 253, -10 }, /* (255) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 253, -4 }, /* (256) cmd ::= DROP FUNCTION exists_opt function_name */ + { 317, 0 }, /* (257) agg_func_opt ::= */ + { 317, -1 }, /* (258) agg_func_opt ::= AGGREGATE */ + { 318, 0 }, /* (259) bufsize_opt ::= */ + { 318, -2 }, /* (260) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 253, -8 }, /* (261) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 253, -4 }, /* (262) cmd ::= DROP STREAM exists_opt stream_name */ + { 320, 0 }, /* (263) into_opt ::= */ + { 320, -2 }, /* (264) into_opt ::= INTO full_table_name */ + { 311, 0 }, /* (265) stream_options ::= */ + { 311, -3 }, /* (266) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 311, -3 }, /* (267) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 311, -4 }, /* (268) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 311, -3 }, /* (269) stream_options ::= stream_options WATERMARK duration_literal */ + { 311, -3 }, /* (270) stream_options ::= stream_options IGNORE EXPIRED */ + { 253, -3 }, /* (271) cmd ::= KILL CONNECTION NK_INTEGER */ + { 253, -3 }, /* (272) cmd ::= KILL QUERY NK_STRING */ + { 253, -3 }, /* (273) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 253, -2 }, /* (274) cmd ::= BALANCE VGROUP */ + { 253, -4 }, /* (275) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 253, -4 }, /* (276) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 253, -3 }, /* (277) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 321, -2 }, /* (278) dnode_list ::= DNODE NK_INTEGER */ + { 321, -3 }, /* (279) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 253, -3 }, /* (280) cmd ::= SYNCDB db_name REPLICA */ + { 253, -4 }, /* (281) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 253, -1 }, /* (282) cmd ::= query_expression */ + { 256, -1 }, /* (283) literal ::= NK_INTEGER */ + { 256, -1 }, /* (284) literal ::= NK_FLOAT */ + { 256, -1 }, /* (285) literal ::= NK_STRING */ + { 256, -1 }, /* (286) literal ::= NK_BOOL */ + { 256, -2 }, /* (287) literal ::= TIMESTAMP NK_STRING */ + { 256, -1 }, /* (288) literal ::= duration_literal */ + { 256, -1 }, /* (289) literal ::= NULL */ + { 256, -1 }, /* (290) literal ::= NK_QUESTION */ + { 297, -1 }, /* (291) duration_literal ::= NK_VARIABLE */ + { 323, -1 }, /* (292) signed ::= NK_INTEGER */ + { 323, -2 }, /* (293) signed ::= NK_PLUS NK_INTEGER */ + { 323, -2 }, /* (294) signed ::= NK_MINUS NK_INTEGER */ + { 323, -1 }, /* (295) signed ::= NK_FLOAT */ + { 323, -2 }, /* (296) signed ::= NK_PLUS NK_FLOAT */ + { 323, -2 }, /* (297) signed ::= NK_MINUS NK_FLOAT */ + { 286, -1 }, /* (298) signed_literal ::= signed */ + { 286, -1 }, /* (299) signed_literal ::= NK_STRING */ + { 286, -1 }, /* (300) signed_literal ::= NK_BOOL */ + { 286, -2 }, /* (301) signed_literal ::= TIMESTAMP NK_STRING */ + { 286, -1 }, /* (302) signed_literal ::= duration_literal */ + { 286, -1 }, /* (303) signed_literal ::= NULL */ + { 286, -1 }, /* (304) signed_literal ::= literal_func */ + { 325, -1 }, /* (305) literal_list ::= signed_literal */ + { 325, -3 }, /* (306) literal_list ::= literal_list NK_COMMA signed_literal */ + { 264, -1 }, /* (307) db_name ::= NK_ID */ + { 292, -1 }, /* (308) table_name ::= NK_ID */ + { 284, -1 }, /* (309) column_name ::= NK_ID */ + { 299, -1 }, /* (310) function_name ::= NK_ID */ + { 326, -1 }, /* (311) table_alias ::= NK_ID */ + { 327, -1 }, /* (312) column_alias ::= NK_ID */ + { 258, -1 }, /* (313) user_name ::= NK_ID */ + { 305, -1 }, /* (314) index_name ::= NK_ID */ + { 312, -1 }, /* (315) topic_name ::= NK_ID */ + { 319, -1 }, /* (316) stream_name ::= NK_ID */ + { 314, -1 }, /* (317) cgroup_name ::= NK_ID */ + { 328, -1 }, /* (318) expression ::= literal */ + { 328, -1 }, /* (319) expression ::= pseudo_column */ + { 328, -1 }, /* (320) expression ::= column_reference */ + { 328, -1 }, /* (321) expression ::= function_expression */ + { 328, -1 }, /* (322) expression ::= subquery */ + { 328, -3 }, /* (323) expression ::= NK_LP expression NK_RP */ + { 328, -2 }, /* (324) expression ::= NK_PLUS expression */ + { 328, -2 }, /* (325) expression ::= NK_MINUS expression */ + { 328, -3 }, /* (326) expression ::= expression NK_PLUS expression */ + { 328, -3 }, /* (327) expression ::= expression NK_MINUS expression */ + { 328, -3 }, /* (328) expression ::= expression NK_STAR expression */ + { 328, -3 }, /* (329) expression ::= expression NK_SLASH expression */ + { 328, -3 }, /* (330) expression ::= expression NK_REM expression */ + { 328, -3 }, /* (331) expression ::= column_reference NK_ARROW NK_STRING */ + { 328, -3 }, /* (332) expression ::= expression NK_BITAND expression */ + { 328, -3 }, /* (333) expression ::= expression NK_BITOR expression */ + { 289, -1 }, /* (334) expression_list ::= expression */ + { 289, -3 }, /* (335) expression_list ::= expression_list NK_COMMA expression */ + { 330, -1 }, /* (336) column_reference ::= column_name */ + { 330, -3 }, /* (337) column_reference ::= table_name NK_DOT column_name */ + { 329, -1 }, /* (338) pseudo_column ::= ROWTS */ + { 329, -1 }, /* (339) pseudo_column ::= TBNAME */ + { 329, -3 }, /* (340) pseudo_column ::= table_name NK_DOT TBNAME */ + { 329, -1 }, /* (341) pseudo_column ::= QSTARTTS */ + { 329, -1 }, /* (342) pseudo_column ::= QENDTS */ + { 329, -1 }, /* (343) pseudo_column ::= WSTARTTS */ + { 329, -1 }, /* (344) pseudo_column ::= WENDTS */ + { 329, -1 }, /* (345) pseudo_column ::= WDURATION */ + { 331, -4 }, /* (346) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 331, -4 }, /* (347) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 331, -6 }, /* (348) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 331, -1 }, /* (349) function_expression ::= literal_func */ + { 324, -3 }, /* (350) literal_func ::= noarg_func NK_LP NK_RP */ + { 324, -1 }, /* (351) literal_func ::= NOW */ + { 335, -1 }, /* (352) noarg_func ::= NOW */ + { 335, -1 }, /* (353) noarg_func ::= TODAY */ + { 335, -1 }, /* (354) noarg_func ::= TIMEZONE */ + { 335, -1 }, /* (355) noarg_func ::= DATABASE */ + { 335, -1 }, /* (356) noarg_func ::= CLIENT_VERSION */ + { 335, -1 }, /* (357) noarg_func ::= SERVER_VERSION */ + { 335, -1 }, /* (358) noarg_func ::= SERVER_STATUS */ + { 335, -1 }, /* (359) noarg_func ::= CURRENT_USER */ + { 335, -1 }, /* (360) noarg_func ::= USER */ + { 333, -1 }, /* (361) star_func ::= COUNT */ + { 333, -1 }, /* (362) star_func ::= FIRST */ + { 333, -1 }, /* (363) star_func ::= LAST */ + { 333, -1 }, /* (364) star_func ::= LAST_ROW */ + { 334, -1 }, /* (365) star_func_para_list ::= NK_STAR */ + { 334, -1 }, /* (366) star_func_para_list ::= other_para_list */ + { 336, -1 }, /* (367) other_para_list ::= star_func_para */ + { 336, -3 }, /* (368) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 337, -1 }, /* (369) star_func_para ::= expression */ + { 337, -3 }, /* (370) star_func_para ::= table_name NK_DOT NK_STAR */ + { 338, -3 }, /* (371) predicate ::= expression compare_op expression */ + { 338, -5 }, /* (372) predicate ::= expression BETWEEN expression AND expression */ + { 338, -6 }, /* (373) predicate ::= expression NOT BETWEEN expression AND expression */ + { 338, -3 }, /* (374) predicate ::= expression IS NULL */ + { 338, -4 }, /* (375) predicate ::= expression IS NOT NULL */ + { 338, -3 }, /* (376) predicate ::= expression in_op in_predicate_value */ + { 339, -1 }, /* (377) compare_op ::= NK_LT */ + { 339, -1 }, /* (378) compare_op ::= NK_GT */ + { 339, -1 }, /* (379) compare_op ::= NK_LE */ + { 339, -1 }, /* (380) compare_op ::= NK_GE */ + { 339, -1 }, /* (381) compare_op ::= NK_NE */ + { 339, -1 }, /* (382) compare_op ::= NK_EQ */ + { 339, -1 }, /* (383) compare_op ::= LIKE */ + { 339, -2 }, /* (384) compare_op ::= NOT LIKE */ + { 339, -1 }, /* (385) compare_op ::= MATCH */ + { 339, -1 }, /* (386) compare_op ::= NMATCH */ + { 339, -1 }, /* (387) compare_op ::= CONTAINS */ + { 340, -1 }, /* (388) in_op ::= IN */ + { 340, -2 }, /* (389) in_op ::= NOT IN */ + { 341, -3 }, /* (390) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 342, -1 }, /* (391) boolean_value_expression ::= boolean_primary */ + { 342, -2 }, /* (392) boolean_value_expression ::= NOT boolean_primary */ + { 342, -3 }, /* (393) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 342, -3 }, /* (394) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 343, -1 }, /* (395) boolean_primary ::= predicate */ + { 343, -3 }, /* (396) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 344, -1 }, /* (397) common_expression ::= expression */ + { 344, -1 }, /* (398) common_expression ::= boolean_value_expression */ + { 345, 0 }, /* (399) from_clause_opt ::= */ + { 345, -2 }, /* (400) from_clause_opt ::= FROM table_reference_list */ + { 346, -1 }, /* (401) table_reference_list ::= table_reference */ + { 346, -3 }, /* (402) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 347, -1 }, /* (403) table_reference ::= table_primary */ + { 347, -1 }, /* (404) table_reference ::= joined_table */ + { 348, -2 }, /* (405) table_primary ::= table_name alias_opt */ + { 348, -4 }, /* (406) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 348, -2 }, /* (407) table_primary ::= subquery alias_opt */ + { 348, -1 }, /* (408) table_primary ::= parenthesized_joined_table */ + { 350, 0 }, /* (409) alias_opt ::= */ + { 350, -1 }, /* (410) alias_opt ::= table_alias */ + { 350, -2 }, /* (411) alias_opt ::= AS table_alias */ + { 351, -3 }, /* (412) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 351, -3 }, /* (413) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 349, -6 }, /* (414) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 352, 0 }, /* (415) join_type ::= */ + { 352, -1 }, /* (416) join_type ::= INNER */ + { 354, -12 }, /* (417) 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 */ + { 355, 0 }, /* (418) set_quantifier_opt ::= */ + { 355, -1 }, /* (419) set_quantifier_opt ::= DISTINCT */ + { 355, -1 }, /* (420) set_quantifier_opt ::= ALL */ + { 356, -1 }, /* (421) select_list ::= select_item */ + { 356, -3 }, /* (422) select_list ::= select_list NK_COMMA select_item */ + { 364, -1 }, /* (423) select_item ::= NK_STAR */ + { 364, -1 }, /* (424) select_item ::= common_expression */ + { 364, -2 }, /* (425) select_item ::= common_expression column_alias */ + { 364, -3 }, /* (426) select_item ::= common_expression AS column_alias */ + { 364, -3 }, /* (427) select_item ::= table_name NK_DOT NK_STAR */ + { 322, 0 }, /* (428) where_clause_opt ::= */ + { 322, -2 }, /* (429) where_clause_opt ::= WHERE search_condition */ + { 357, 0 }, /* (430) partition_by_clause_opt ::= */ + { 357, -3 }, /* (431) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 361, 0 }, /* (432) twindow_clause_opt ::= */ + { 361, -6 }, /* (433) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 361, -4 }, /* (434) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 361, -6 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 361, -8 }, /* (436) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 308, 0 }, /* (437) sliding_opt ::= */ + { 308, -4 }, /* (438) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 360, 0 }, /* (439) fill_opt ::= */ + { 360, -4 }, /* (440) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 360, -6 }, /* (441) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 365, -1 }, /* (442) fill_mode ::= NONE */ + { 365, -1 }, /* (443) fill_mode ::= PREV */ + { 365, -1 }, /* (444) fill_mode ::= NULL */ + { 365, -1 }, /* (445) fill_mode ::= LINEAR */ + { 365, -1 }, /* (446) fill_mode ::= NEXT */ + { 362, 0 }, /* (447) group_by_clause_opt ::= */ + { 362, -3 }, /* (448) group_by_clause_opt ::= GROUP BY group_by_list */ + { 366, -1 }, /* (449) group_by_list ::= expression */ + { 366, -3 }, /* (450) group_by_list ::= group_by_list NK_COMMA expression */ + { 363, 0 }, /* (451) having_clause_opt ::= */ + { 363, -2 }, /* (452) having_clause_opt ::= HAVING search_condition */ + { 358, 0 }, /* (453) range_opt ::= */ + { 358, -6 }, /* (454) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 359, 0 }, /* (455) every_opt ::= */ + { 359, -4 }, /* (456) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 313, -4 }, /* (457) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 367, -1 }, /* (458) query_expression_body ::= query_primary */ + { 367, -4 }, /* (459) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 367, -3 }, /* (460) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 371, -1 }, /* (461) query_primary ::= query_specification */ + { 371, -6 }, /* (462) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 368, 0 }, /* (463) order_by_clause_opt ::= */ + { 368, -3 }, /* (464) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 369, 0 }, /* (465) slimit_clause_opt ::= */ + { 369, -2 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 369, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 369, -4 }, /* (468) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 370, 0 }, /* (469) limit_clause_opt ::= */ + { 370, -2 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 370, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 370, -4 }, /* (472) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 332, -3 }, /* (473) subquery ::= NK_LP query_expression NK_RP */ + { 353, -1 }, /* (474) search_condition ::= common_expression */ + { 372, -1 }, /* (475) sort_specification_list ::= sort_specification */ + { 372, -3 }, /* (476) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 373, -3 }, /* (477) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 374, 0 }, /* (478) ordering_specification_opt ::= */ + { 374, -1 }, /* (479) ordering_specification_opt ::= ASC */ + { 374, -1 }, /* (480) ordering_specification_opt ::= DESC */ + { 375, 0 }, /* (481) null_ordering_opt ::= */ + { 375, -2 }, /* (482) null_ordering_opt ::= NULLS FIRST */ + { 375, -2 }, /* (483) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3306,11 +3271,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,253,&yymsp[0].minor); + yy_destructor(yypParser,254,&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,254,&yymsp[0].minor); + yy_destructor(yypParser,255,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3324,20 +3289,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,253,&yymsp[-2].minor); +{ yy_destructor(yypParser,254,&yymsp[-2].minor); { } - yy_destructor(yypParser,255,&yymsp[0].minor); + yy_destructor(yypParser,256,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,256,&yymsp[0].minor); +{ yy_destructor(yypParser,257,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,254,&yymsp[-1].minor); +{ yy_destructor(yypParser,255,&yymsp[-1].minor); { } - yy_destructor(yypParser,256,&yymsp[0].minor); + yy_destructor(yypParser,257,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3351,72 +3316,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,255,&yymsp[0].minor); + yy_destructor(yypParser,256,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy0, yymsp[0].minor.yy653); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy401, &yymsp[-1].minor.yy0, yymsp[0].minor.yy695); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, 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.yy329, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, 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.yy329, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy329); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy401); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy653 = 1; } +{ yymsp[1].minor.yy695 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy653 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy695 = 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.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy525, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy525, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy609 = yymsp[0].minor.yy609; } - yymsp[0].minor.yy609 = yylhsminor.yy609; +{ yylhsminor.yy525 = yymsp[0].minor.yy525; } + yymsp[0].minor.yy525 = yylhsminor.yy525; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy609 = yymsp[-2].minor.yy609 | yymsp[0].minor.yy609; } - yymsp[-2].minor.yy609 = yylhsminor.yy609; +{ yylhsminor.yy525 = yymsp[-2].minor.yy525 | yymsp[0].minor.yy525; } + yymsp[-2].minor.yy525 = yylhsminor.yy525; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy525 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy525 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy329 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy329 = yylhsminor.yy329; +{ yylhsminor.yy401 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy401 = yylhsminor.yy401; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy329 = yymsp[-2].minor.yy329; } - yymsp[-2].minor.yy329 = yylhsminor.yy329; +{ yylhsminor.yy401 = yymsp[-2].minor.yy401; } + yymsp[-2].minor.yy401 = yylhsminor.yy401; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy329, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy401, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy401, &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.yy329); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy401); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3433,32 +3398,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 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; + case 307: /* db_name ::= NK_ID */ yytestcase(yyruleno==307); + case 308: /* table_name ::= NK_ID */ yytestcase(yyruleno==308); + case 309: /* column_name ::= NK_ID */ yytestcase(yyruleno==309); + case 310: /* function_name ::= NK_ID */ yytestcase(yyruleno==310); + case 311: /* table_alias ::= NK_ID */ yytestcase(yyruleno==311); + case 312: /* column_alias ::= NK_ID */ yytestcase(yyruleno==312); + case 313: /* user_name ::= NK_ID */ yytestcase(yyruleno==313); + case 314: /* index_name ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* topic_name ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* stream_name ::= NK_ID */ yytestcase(yyruleno==316); + case 317: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==317); + case 352: /* noarg_func ::= NOW */ yytestcase(yyruleno==352); + case 353: /* noarg_func ::= TODAY */ yytestcase(yyruleno==353); + case 354: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==354); + case 355: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==355); + case 356: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==356); + case 357: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==357); + case 358: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==358); + case 359: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==359); + case 360: /* noarg_func ::= USER */ yytestcase(yyruleno==360); + case 361: /* star_func ::= COUNT */ yytestcase(yyruleno==361); + case 362: /* star_func ::= FIRST */ yytestcase(yyruleno==362); + case 363: /* star_func ::= LAST */ yytestcase(yyruleno==363); + case 364: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==364); +{ yylhsminor.yy401 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy401 = yylhsminor.yy401; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3491,1221 +3456,1224 @@ 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.yy737, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy89, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); } break; - case 66: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy737 = true; } + case 66: /* cmd ::= FLUSH DATABASE db_name */ +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } 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 417: /* set_quantifier_opt ::= */ yytestcase(yyruleno==417); -{ yymsp[1].minor.yy737 = false; } + case 67: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy89 = true; } break; - case 68: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy737 = true; } + case 68: /* not_exists_opt ::= */ + case 70: /* exists_opt ::= */ yytestcase(yyruleno==70); + case 249: /* analyze_opt ::= */ yytestcase(yyruleno==249); + case 257: /* agg_func_opt ::= */ yytestcase(yyruleno==257); + case 418: /* set_quantifier_opt ::= */ yytestcase(yyruleno==418); +{ yymsp[1].minor.yy89 = false; } break; - case 70: /* db_options ::= */ -{ yymsp[1].minor.yy212 = createDefaultDatabaseOptions(pCxt); } + case 69: /* exists_opt ::= IF EXISTS */ +{ yymsp[-1].minor.yy89 = true; } break; - case 71: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 71: /* db_options ::= */ +{ yymsp[1].minor.yy248 = createDefaultDatabaseOptions(pCxt); } break; - case 72: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 72: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 73: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 73: /* db_options ::= db_options CACHELAST NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 74: /* db_options ::= db_options DURATION NK_INTEGER */ - case 75: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==75); -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 74: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 76: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 75: /* db_options ::= db_options DURATION NK_INTEGER */ + case 76: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==76); +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 77: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 77: /* db_options ::= db_options FSYNC NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 78: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 78: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 79: /* db_options ::= db_options KEEP integer_list */ - case 80: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==80); -{ 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.yy245.type = DB_OPTION_WAL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } - break; - case 102: /* integer_list ::= NK_INTEGER */ -{ 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 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.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.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); - case 129: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==129); - case 136: /* column_def_list ::= column_def */ yytestcase(yyruleno==136); - 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 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 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.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.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.yy424); } - break; - case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ 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.yy737, yymsp[0].minor.yy212); } - break; - case 114: /* cmd ::= ALTER TABLE alter_table_clause */ - case 281: /* cmd ::= query_expression */ yytestcase(yyruleno==281); -{ pCxt->pRootNode = yymsp[0].minor.yy212; } - break; - case 115: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy212); } - break; - case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy212 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + case 79: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ 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; + case 80: /* db_options ::= db_options KEEP integer_list */ + case 81: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==81); +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_KEEP, yymsp[0].minor.yy552); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ 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.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; + case 82: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ 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; + case 83: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 84: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 85: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 86: /* db_options ::= db_options STRICT NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 87: /* db_options ::= db_options WAL NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 88: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 89: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 90: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_RETENTIONS, yymsp[0].minor.yy552); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 91: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 92: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy248 = createAlterDatabaseOptions(pCxt); yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yylhsminor.yy248, &yymsp[0].minor.yy301); } + yymsp[0].minor.yy248 = yylhsminor.yy248; + break; + case 93: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy248, &yymsp[0].minor.yy301); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; + break; + case 94: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 95: /* alter_db_option ::= CACHELAST NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 96: /* alter_db_option ::= FSYNC NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 97: /* alter_db_option ::= KEEP integer_list */ + case 98: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==98); +{ yymsp[-1].minor.yy301.type = DB_OPTION_KEEP; yymsp[-1].minor.yy301.pList = yymsp[0].minor.yy552; } + break; + case 99: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_PAGES; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 100: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 101: /* alter_db_option ::= STRICT NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_STRICT; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 102: /* alter_db_option ::= WAL NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = DB_OPTION_WAL; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } + break; + case 103: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy552 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy552 = yylhsminor.yy552; + break; + case 104: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 279: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==279); +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy552 = yylhsminor.yy552; + break; + case 105: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy552 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy552 = yylhsminor.yy552; + break; + case 106: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy552 = yylhsminor.yy552; + break; + case 107: /* retention_list ::= retention */ + case 127: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==127); + case 130: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==130); + case 137: /* column_def_list ::= column_def */ yytestcase(yyruleno==137); + case 180: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==180); + case 185: /* col_name_list ::= col_name */ yytestcase(yyruleno==185); + case 232: /* func_list ::= func */ yytestcase(yyruleno==232); + case 305: /* literal_list ::= signed_literal */ yytestcase(yyruleno==305); + case 367: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==367); + case 421: /* select_list ::= select_item */ yytestcase(yyruleno==421); + case 475: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==475); +{ yylhsminor.yy552 = createNodeList(pCxt, yymsp[0].minor.yy248); } + yymsp[0].minor.yy552 = yylhsminor.yy552; + break; + case 108: /* retention_list ::= retention_list NK_COMMA retention */ + case 138: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==138); + case 181: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==181); + case 186: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==186); + case 233: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==233); + case 306: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==306); + case 368: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==368); + case 422: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==422); + case 476: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==476); +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy552 = yylhsminor.yy552; + break; + case 109: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy248 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; + break; + case 110: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 112: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==112); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy552, yymsp[-1].minor.yy552, yymsp[0].minor.yy248); } + break; + case 111: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy552); } + break; + case 113: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy552); } + break; + case 114: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } + break; + case 115: /* cmd ::= ALTER TABLE alter_table_clause */ + case 282: /* cmd ::= query_expression */ yytestcase(yyruleno==282); +{ pCxt->pRootNode = yymsp[0].minor.yy248; } + break; + case 116: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy248); } + break; + case 117: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy248 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ 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; + case 118: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy401, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy212 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy212, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy329); } - yymsp[-3].minor.yy212 = yylhsminor.yy212; + case 119: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; + break; + case 120: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ 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; + case 121: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ 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; + case 122: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy401, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy212 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy212, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } - yymsp[-5].minor.yy212 = yylhsminor.yy212; + case 123: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; 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.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy212); } - yymsp[-1].minor.yy424 = yylhsminor.yy424; + case 124: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options */ -{ 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; + case 125: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy212 = createDropTableClause(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy212); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + case 126: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy248 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy248, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; 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.yy424 = NULL; } + case 128: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 131: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==131); +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-1].minor.yy552, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy552 = yylhsminor.yy552; break; - case 133: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; } + case 129: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP expression_list NK_RP table_options */ +{ yylhsminor.yy248 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy89, yymsp[-8].minor.yy248, yymsp[-6].minor.yy248, yymsp[-5].minor.yy552, yymsp[-2].minor.yy552, yymsp[0].minor.yy248); } + yymsp[-9].minor.yy248 = yylhsminor.yy248; break; - case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy212 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy329, NULL); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 132: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy248 = createDropTableClause(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy212 = createRealTableNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, NULL); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 133: /* specific_tags_opt ::= */ + case 164: /* tags_def_opt ::= */ yytestcase(yyruleno==164); + case 430: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==430); + case 447: /* group_by_clause_opt ::= */ yytestcase(yyruleno==447); + case 463: /* order_by_clause_opt ::= */ yytestcase(yyruleno==463); +{ yymsp[1].minor.yy552 = NULL; } break; - case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34, NULL); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + case 134: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy552 = yymsp[-1].minor.yy552; } break; - case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-2].minor.yy34, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy212 = yylhsminor.yy212; + case 135: /* full_table_name ::= table_name */ +{ yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy401, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 136: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 139: /* column_def ::= column_name type_name */ +{ yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy224, NULL); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 140: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-2].minor.yy224, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - case 143: /* type_name ::= INT */ - case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_INT); } + case 141: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 142: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 143: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 144: /* type_name ::= INT */ + case 145: /* type_name ::= INTEGER */ yytestcase(yyruleno==145); +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 146: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 147: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 148: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 149: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 150: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UINT); } + case 151: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 152: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_JSON); } + case 153: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 154: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 155: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 156: /* type_name ::= JSON */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 157: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 158: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 159: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 160: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 164: /* tags_def_opt ::= tags_def */ - case 365: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==365); -{ yylhsminor.yy424 = yymsp[0].minor.yy424; } - yymsp[0].minor.yy424 = yylhsminor.yy424; + case 161: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; } + case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 166: /* table_options ::= */ -{ yymsp[1].minor.yy212 = createDefaultTableOptions(pCxt); } + case 163: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 165: /* tags_def_opt ::= tags_def */ + case 366: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==366); +{ yylhsminor.yy552 = yymsp[0].minor.yy552; } + yymsp[0].minor.yy552 = yylhsminor.yy552; break; - case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy424); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 166: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy552 = yymsp[-1].minor.yy552; } break; - case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy424); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 167: /* table_options ::= */ +{ yymsp[1].minor.yy248 = createDefaultTableOptions(pCxt); } break; - case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); } - yymsp[-4].minor.yy212 = yylhsminor.yy212; + case 168: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 169: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy552); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); } - yymsp[-4].minor.yy212 = yylhsminor.yy212; + case 170: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy552); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 173: /* alter_table_options ::= alter_table_option */ -{ 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; + case 171: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy552); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + case 172: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy245.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } + case 173: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_SMA, yymsp[-1].minor.yy552); } + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy245.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } + case 174: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy248 = createAlterTableOptions(pCxt); yylhsminor.yy248 = setTableOption(pCxt, yylhsminor.yy248, yymsp[0].minor.yy301.type, &yymsp[0].minor.yy301.val); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 177: /* duration_list ::= duration_literal */ - case 333: /* expression_list ::= expression */ yytestcase(yyruleno==333); -{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } - yymsp[0].minor.yy424 = yylhsminor.yy424; + case 175: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy248 = setTableOption(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy301.type, &yymsp[0].minor.yy301.val); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ - 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; + case 176: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy301.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } break; - case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy329, NULL); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 177: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy301.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy301.val = yymsp[0].minor.yy0; } break; - case 182: /* rollup_func_name ::= FIRST */ - case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 178: /* duration_list ::= duration_literal */ + case 334: /* expression_list ::= expression */ yytestcase(yyruleno==334); +{ yylhsminor.yy552 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[0].minor.yy552 = yylhsminor.yy552; break; - case 186: /* col_name ::= column_name */ -{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 179: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 335: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==335); +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } + yymsp[-2].minor.yy552 = yylhsminor.yy552; break; - case 187: /* cmd ::= SHOW DNODES */ + case 182: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy401, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; + break; + case 183: /* rollup_func_name ::= FIRST */ + case 184: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==184); +{ yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy248 = yylhsminor.yy248; + break; + case 187: /* col_name ::= column_name */ +{ yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; + break; + case 188: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 188: /* cmd ::= SHOW USERS */ + case 189: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 189: /* cmd ::= SHOW DATABASES */ + case 190: /* cmd ::= SHOW DATABASES */ { 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.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } + case 191: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, 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.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } + case 192: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, 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.yy212, NULL, OP_TYPE_LIKE); } + case 193: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy248, NULL, OP_TYPE_LIKE); } break; - case 193: /* cmd ::= SHOW MNODES */ + case 194: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 194: /* cmd ::= SHOW MODULES */ + case 195: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); } break; - case 195: /* cmd ::= SHOW QNODES */ + case 196: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 196: /* cmd ::= SHOW FUNCTIONS */ + case 197: /* cmd ::= SHOW FUNCTIONS */ { 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.yy212, yymsp[-1].minor.yy212, OP_TYPE_EQUAL); } + case 198: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy248, yymsp[-1].minor.yy248, OP_TYPE_EQUAL); } break; - case 198: /* cmd ::= SHOW STREAMS */ + case 199: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 199: /* cmd ::= SHOW ACCOUNTS */ + case 200: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 200: /* cmd ::= SHOW APPS */ + case 201: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 201: /* cmd ::= SHOW CONNECTIONS */ + case 202: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 202: /* cmd ::= SHOW LICENCE */ - case 203: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==203); + case 203: /* cmd ::= SHOW LICENCE */ + case 204: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==204); { 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.yy329); } + case 205: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy401); } break; - case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy212); } + case 206: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy248); } break; - case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy212); } + case 207: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy248); } break; - case 207: /* cmd ::= SHOW QUERIES */ + case 208: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 208: /* cmd ::= SHOW SCORES */ + case 209: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 209: /* cmd ::= SHOW TOPICS */ + case 210: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 210: /* cmd ::= SHOW VARIABLES */ + case 211: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 211: /* cmd ::= SHOW LOCAL VARIABLES */ + case 212: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 212: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + case 213: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); } break; - case 213: /* cmd ::= SHOW BNODES */ + case 214: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 214: /* cmd ::= SHOW SNODES */ + case 215: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 215: /* cmd ::= SHOW CLUSTER */ + case 216: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 216: /* cmd ::= SHOW TRANSACTIONS */ + case 217: /* cmd ::= SHOW TRANSACTIONS */ { 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.yy212); } + case 218: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy248); } break; - case 218: /* cmd ::= SHOW CONSUMERS */ + case 219: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 219: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 220: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 220: /* db_name_cond_opt ::= */ - case 225: /* from_db_opt ::= */ yytestcase(yyruleno==225); -{ yymsp[1].minor.yy212 = createDefaultDatabaseCondValue(pCxt); } + case 221: /* db_name_cond_opt ::= */ + case 226: /* from_db_opt ::= */ yytestcase(yyruleno==226); +{ yymsp[1].minor.yy248 = createDefaultDatabaseCondValue(pCxt); } break; - case 221: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy329); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + case 222: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 222: /* like_pattern_opt ::= */ - case 262: /* into_opt ::= */ yytestcase(yyruleno==262); - 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; } + case 223: /* like_pattern_opt ::= */ + case 263: /* into_opt ::= */ yytestcase(yyruleno==263); + case 399: /* from_clause_opt ::= */ yytestcase(yyruleno==399); + case 428: /* where_clause_opt ::= */ yytestcase(yyruleno==428); + case 432: /* twindow_clause_opt ::= */ yytestcase(yyruleno==432); + case 437: /* sliding_opt ::= */ yytestcase(yyruleno==437); + case 439: /* fill_opt ::= */ yytestcase(yyruleno==439); + case 451: /* having_clause_opt ::= */ yytestcase(yyruleno==451); + case 453: /* range_opt ::= */ yytestcase(yyruleno==453); + case 455: /* every_opt ::= */ yytestcase(yyruleno==455); + case 465: /* slimit_clause_opt ::= */ yytestcase(yyruleno==465); + case 469: /* limit_clause_opt ::= */ yytestcase(yyruleno==469); +{ yymsp[1].minor.yy248 = NULL; } break; - case 223: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 224: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 224: /* table_name_cond ::= table_name */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 225: /* table_name_cond ::= table_name */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy401); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 226: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } + case 227: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy401); } 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.yy737, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, NULL, yymsp[0].minor.yy212); } + case 228: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy401, &yymsp[-1].minor.yy401, NULL, yymsp[0].minor.yy248); } break; - case 228: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } + case 229: /* cmd ::= DROP INDEX exists_opt index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } 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.yy212 = createIndexOption(pCxt, yymsp[-7].minor.yy424, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } + case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy248 = createIndexOption(pCxt, yymsp[-7].minor.yy552, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } 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.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); } + case 231: /* 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.yy248 = createIndexOption(pCxt, yymsp[-9].minor.yy552, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; - case 233: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424); } - yymsp[-3].minor.yy212 = yylhsminor.yy212; + case 234: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy552); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - case 234: /* sma_stream_opt ::= */ - case 264: /* stream_options ::= */ yytestcase(yyruleno==264); -{ yymsp[1].minor.yy212 = createStreamOptions(pCxt); } + case 235: /* sma_stream_opt ::= */ + case 265: /* stream_options ::= */ yytestcase(yyruleno==265); +{ yymsp[1].minor.yy248 = 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.yy212)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 236: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 269: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==269); +{ ((SStreamOptions*)yymsp[-2].minor.yy248)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 236: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy212)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 237: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy248)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 237: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } + case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); } break; - case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy329, false); } + case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy401, 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.yy737, &yymsp[-5].minor.yy329, &yymsp[0].minor.yy329, true); } + case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy89, &yymsp[-5].minor.yy401, &yymsp[0].minor.yy401, true); } break; - case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, yymsp[0].minor.yy212, false); } + case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy401, yymsp[0].minor.yy248, 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.yy737, &yymsp[-5].minor.yy329, yymsp[0].minor.yy212, true); } + case 242: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy89, &yymsp[-5].minor.yy401, yymsp[0].minor.yy248, true); } break; - case 242: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } + case 243: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; - case 243: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } + case 244: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); } 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.yy212); } + case 245: /* cmd ::= DESC full_table_name */ + case 246: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==246); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy248); } break; - case 246: /* cmd ::= RESET QUERY CACHE */ + case 247: /* 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.yy737, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } + case 248: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; - case 249: /* analyze_opt ::= ANALYZE */ - case 257: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==257); - case 418: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==418); -{ yymsp[0].minor.yy737 = true; } + case 250: /* analyze_opt ::= ANALYZE */ + case 258: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==258); + case 419: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==419); +{ yymsp[0].minor.yy89 = true; } break; - case 250: /* explain_options ::= */ -{ yymsp[1].minor.yy212 = createDefaultExplainOptions(pCxt); } + case 251: /* explain_options ::= */ +{ yymsp[1].minor.yy248 = createDefaultExplainOptions(pCxt); } break; - case 251: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy212 = setExplainVerbose(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 252: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy248 = setExplainVerbose(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 252: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy212 = setExplainRatio(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 253: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy248 = setExplainRatio(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 253: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy424); } + case 254: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy552); } 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.yy737, yymsp[-8].minor.yy737, &yymsp[-5].minor.yy329, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy34, yymsp[0].minor.yy610); } + case 255: /* 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.yy89, yymsp[-8].minor.yy89, &yymsp[-5].minor.yy401, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy224, yymsp[0].minor.yy228); } break; - case 255: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } + case 256: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; - case 258: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy610 = 0; } + case 259: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy228 = 0; } break; - case 259: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy610 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 260: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy228 = 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.yy737, &yymsp[-4].minor.yy329, yymsp[-2].minor.yy212, yymsp[-3].minor.yy212, yymsp[0].minor.yy212); } + case 261: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy89, &yymsp[-4].minor.yy401, yymsp[-2].minor.yy248, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); } break; - case 261: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } + case 262: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); } break; - case 263: /* into_opt ::= INTO full_table_name */ - 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; } + case 264: /* into_opt ::= INTO full_table_name */ + case 400: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==400); + case 429: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==429); + case 452: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==452); +{ yymsp[-1].minor.yy248 = yymsp[0].minor.yy248; } break; - case 265: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 266: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy248)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 266: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + case 267: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy248)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 267: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((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; + case 268: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy248)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy248)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-3].minor.yy248; } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - 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; + case 270: /* stream_options ::= stream_options IGNORE EXPIRED */ +{ ((SStreamOptions*)yymsp[-2].minor.yy248)->ignoreExpired = true; yylhsminor.yy248 = yymsp[-2].minor.yy248; } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 270: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 271: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 271: /* cmd ::= KILL QUERY NK_STRING */ + case 272: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 272: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 273: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 273: /* cmd ::= BALANCE VGROUP */ + case 274: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 274: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 275: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 275: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); } + case 276: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy552); } break; - case 276: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 277: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 277: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 278: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy552 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 279: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy329); } + case 280: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy401); } break; - case 280: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } + case 281: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; - 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; + case 283: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 284: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 285: /* literal ::= NK_STRING */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 286: /* literal ::= NK_BOOL */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 287: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - 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; + case 288: /* literal ::= duration_literal */ + case 298: /* signed_literal ::= signed */ yytestcase(yyruleno==298); + case 318: /* expression ::= literal */ yytestcase(yyruleno==318); + case 319: /* expression ::= pseudo_column */ yytestcase(yyruleno==319); + case 320: /* expression ::= column_reference */ yytestcase(yyruleno==320); + case 321: /* expression ::= function_expression */ yytestcase(yyruleno==321); + case 322: /* expression ::= subquery */ yytestcase(yyruleno==322); + case 349: /* function_expression ::= literal_func */ yytestcase(yyruleno==349); + case 391: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==391); + case 395: /* boolean_primary ::= predicate */ yytestcase(yyruleno==395); + case 397: /* common_expression ::= expression */ yytestcase(yyruleno==397); + case 398: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==398); + case 401: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==401); + case 403: /* table_reference ::= table_primary */ yytestcase(yyruleno==403); + case 404: /* table_reference ::= joined_table */ yytestcase(yyruleno==404); + case 408: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==408); + case 458: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==458); + case 461: /* query_primary ::= query_specification */ yytestcase(yyruleno==461); +{ yylhsminor.yy248 = yymsp[0].minor.yy248; } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 289: /* literal ::= NULL */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 290: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 291: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 291: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 292: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 292: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 293: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 293: /* signed ::= NK_MINUS NK_INTEGER */ + case 294: /* 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.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 294: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 295: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 295: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 296: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 296: /* signed ::= NK_MINUS NK_FLOAT */ + case 297: /* 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.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 298: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 299: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 299: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 300: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 300: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 301: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - 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; + case 302: /* signed_literal ::= duration_literal */ + case 304: /* signed_literal ::= literal_func */ yytestcase(yyruleno==304); + case 369: /* star_func_para ::= expression */ yytestcase(yyruleno==369); + case 424: /* select_item ::= common_expression */ yytestcase(yyruleno==424); + case 474: /* search_condition ::= common_expression */ yytestcase(yyruleno==474); +{ yylhsminor.yy248 = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - case 302: /* signed_literal ::= NULL */ -{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 303: /* signed_literal ::= NULL */ +{ yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 323: /* expression ::= NK_LP expression NK_RP */ + case 396: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==396); +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 323: /* expression ::= NK_PLUS expression */ + case 324: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); - yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 324: /* expression ::= NK_MINUS expression */ + case 325: /* expression ::= NK_MINUS expression */ { - 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)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL)); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 325: /* expression ::= expression NK_PLUS expression */ + case 326: /* expression ::= expression NK_PLUS expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 326: /* expression ::= expression NK_MINUS expression */ + case 327: /* expression ::= expression NK_MINUS expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 327: /* expression ::= expression NK_STAR expression */ + case 328: /* expression ::= expression NK_STAR expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 328: /* expression ::= expression NK_SLASH expression */ + case 329: /* expression ::= expression NK_SLASH expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 329: /* expression ::= expression NK_REM expression */ + case 330: /* expression ::= expression NK_REM expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 330: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 331: /* expression ::= column_reference NK_ARROW NK_STRING */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 331: /* expression ::= expression NK_BITAND expression */ + case 332: /* expression ::= expression NK_BITAND expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 332: /* expression ::= expression NK_BITOR expression */ + case 333: /* expression ::= expression NK_BITOR expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 336: /* column_reference ::= column_name */ +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy401, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 337: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 338: /* pseudo_column ::= ROWTS */ + case 339: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==339); + case 341: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==341); + case 342: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==342); + case 343: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==343); + case 344: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==344); + case 345: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==345); + case 351: /* literal_func ::= NOW */ yytestcase(yyruleno==351); +{ yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 340: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy401)))); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 346: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 347: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==347); +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy552)); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - 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; + case 348: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy224)); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; - 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; + case 350: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy401, NULL)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 365: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy552 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy552 = yylhsminor.yy552; break; - 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; + case 370: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 427: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==427); +{ yylhsminor.yy248 = createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 370: /* predicate ::= expression compare_op expression */ - case 375: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==375); + case 371: /* predicate ::= expression compare_op expression */ + case 376: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==376); { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy716, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 371: /* predicate ::= expression BETWEEN expression AND expression */ + case 372: /* predicate ::= expression BETWEEN expression AND expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-4].minor.yy212 = yylhsminor.yy212; + yymsp[-4].minor.yy248 = yylhsminor.yy248; break; - case 372: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 373: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-5].minor.yy212 = yylhsminor.yy212; + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; - case 373: /* predicate ::= expression IS NULL */ + case 374: /* predicate ::= expression IS 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)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), NULL)); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 374: /* predicate ::= expression IS NOT NULL */ + case 375: /* predicate ::= expression IS NOT 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)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL)); } - yymsp[-3].minor.yy212 = yylhsminor.yy212; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - case 376: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_THAN; } + case 377: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy716 = OP_TYPE_LOWER_THAN; } break; - case 377: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_THAN; } + case 378: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy716 = OP_TYPE_GREATER_THAN; } break; - case 378: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_EQUAL; } + case 379: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy716 = OP_TYPE_LOWER_EQUAL; } break; - case 379: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_EQUAL; } + case 380: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy716 = OP_TYPE_GREATER_EQUAL; } break; - case 380: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy290 = OP_TYPE_NOT_EQUAL; } + case 381: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy716 = OP_TYPE_NOT_EQUAL; } break; - case 381: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy290 = OP_TYPE_EQUAL; } + case 382: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy716 = OP_TYPE_EQUAL; } break; - case 382: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy290 = OP_TYPE_LIKE; } + case 383: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy716 = OP_TYPE_LIKE; } break; - case 383: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_LIKE; } + case 384: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy716 = OP_TYPE_NOT_LIKE; } break; - case 384: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy290 = OP_TYPE_MATCH; } + case 385: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy716 = OP_TYPE_MATCH; } break; - case 385: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy290 = OP_TYPE_NMATCH; } + case 386: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy716 = OP_TYPE_NMATCH; } break; - case 386: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy290 = OP_TYPE_JSON_CONTAINS; } + case 387: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy716 = OP_TYPE_JSON_CONTAINS; } break; - case 387: /* in_op ::= IN */ -{ yymsp[0].minor.yy290 = OP_TYPE_IN; } + case 388: /* in_op ::= IN */ +{ yymsp[0].minor.yy716 = OP_TYPE_IN; } break; - case 388: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_IN; } + case 389: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy716 = OP_TYPE_NOT_IN; } break; - 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; + case 390: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy552)); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 391: /* boolean_value_expression ::= NOT boolean_primary */ + case 392: /* boolean_value_expression ::= NOT boolean_primary */ { - 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)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL)); } - yymsp[-1].minor.yy212 = yylhsminor.yy212; + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 392: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 393: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 393: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 394: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - 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))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248); + yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } - yymsp[-2].minor.yy212 = yylhsminor.yy212; + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 402: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy248 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, NULL); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 405: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - 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; + case 406: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-3].minor.yy401, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - 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; + case 407: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy248 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - case 408: /* alias_opt ::= */ -{ yymsp[1].minor.yy329 = nil_token; } + case 409: /* alias_opt ::= */ +{ yymsp[1].minor.yy401 = nil_token; } break; - case 409: /* alias_opt ::= table_alias */ -{ yylhsminor.yy329 = yymsp[0].minor.yy329; } - yymsp[0].minor.yy329 = yylhsminor.yy329; + case 410: /* alias_opt ::= table_alias */ +{ yylhsminor.yy401 = yymsp[0].minor.yy401; } + yymsp[0].minor.yy401 = yylhsminor.yy401; break; - case 410: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy329 = yymsp[0].minor.yy329; } + case 411: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy401 = yymsp[0].minor.yy401; } break; - 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; } + case 412: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 413: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==413); +{ yymsp[-2].minor.yy248 = yymsp[-1].minor.yy248; } break; - 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; + case 414: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy248 = createJoinTableNode(pCxt, yymsp[-4].minor.yy52, yymsp[-5].minor.yy248, yymsp[-2].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-5].minor.yy248 = yylhsminor.yy248; break; - case 414: /* join_type ::= */ -{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } + case 415: /* join_type ::= */ +{ yymsp[1].minor.yy52 = JOIN_TYPE_INNER; } break; - case 415: /* join_type ::= INNER */ -{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } + case 416: /* join_type ::= INNER */ +{ yymsp[0].minor.yy52 = JOIN_TYPE_INNER; } break; - 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 */ + case 417: /* 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.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); + yymsp[-11].minor.yy248 = createSelectStmt(pCxt, yymsp[-10].minor.yy89, yymsp[-9].minor.yy552, yymsp[-8].minor.yy248); + yymsp[-11].minor.yy248 = addWhereClause(pCxt, yymsp[-11].minor.yy248, yymsp[-7].minor.yy248); + yymsp[-11].minor.yy248 = addPartitionByClause(pCxt, yymsp[-11].minor.yy248, yymsp[-6].minor.yy552); + yymsp[-11].minor.yy248 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy248, yymsp[-2].minor.yy248); + yymsp[-11].minor.yy248 = addGroupByClause(pCxt, yymsp[-11].minor.yy248, yymsp[-1].minor.yy552); + yymsp[-11].minor.yy248 = addHavingClause(pCxt, yymsp[-11].minor.yy248, yymsp[0].minor.yy248); + yymsp[-11].minor.yy248 = addRangeClause(pCxt, yymsp[-11].minor.yy248, yymsp[-5].minor.yy248); + yymsp[-11].minor.yy248 = addEveryClause(pCxt, yymsp[-11].minor.yy248, yymsp[-4].minor.yy248); + yymsp[-11].minor.yy248 = addFillClause(pCxt, yymsp[-11].minor.yy248, yymsp[-3].minor.yy248); } break; - case 419: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy737 = false; } + case 420: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy89 = false; } break; - case 422: /* select_item ::= NK_STAR */ -{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy212 = yylhsminor.yy212; + case 423: /* select_item ::= NK_STAR */ +{ yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy248 = yylhsminor.yy248; break; - 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; + case 425: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-1].minor.yy248 = yylhsminor.yy248; break; - 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; + case 426: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), &yymsp[0].minor.yy401); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; 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.yy424 = yymsp[0].minor.yy424; } + case 431: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 448: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==448); + case 464: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==464); +{ yymsp[-2].minor.yy552 = yymsp[0].minor.yy552; } break; - 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)); } + case 433: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy248 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; - case 433: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy212 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } + case 434: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy248 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; - 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); } + case 435: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } break; - 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); } + case 436: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); } 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.yy212 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy212); } + case 438: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 456: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==456); +{ yymsp[-3].minor.yy248 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy248); } break; - case 439: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy212 = createFillNode(pCxt, yymsp[-1].minor.yy294, NULL); } + case 440: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy248 = createFillNode(pCxt, yymsp[-1].minor.yy582, NULL); } break; - 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)); } + case 441: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy248 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy552)); } break; - case 441: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy294 = FILL_MODE_NONE; } + case 442: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy582 = FILL_MODE_NONE; } break; - case 442: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy294 = FILL_MODE_PREV; } + case 443: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy582 = FILL_MODE_PREV; } break; - case 443: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy294 = FILL_MODE_NULL; } + case 444: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy582 = FILL_MODE_NULL; } break; - case 444: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy294 = FILL_MODE_LINEAR; } + case 445: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy582 = FILL_MODE_LINEAR; } break; - case 445: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy294 = FILL_MODE_NEXT; } + case 446: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy582 = FILL_MODE_NEXT; } break; - case 448: /* group_by_list ::= expression */ -{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[0].minor.yy424 = yylhsminor.yy424; + case 449: /* group_by_list ::= expression */ +{ yylhsminor.yy552 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } + yymsp[0].minor.yy552 = yylhsminor.yy552; break; - 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; + case 450: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); } + yymsp[-2].minor.yy552 = yylhsminor.yy552; break; - 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)); } + case 454: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy248 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); } break; - case 456: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 457: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - 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); + yylhsminor.yy248 = addOrderByClause(pCxt, yymsp[-3].minor.yy248, yymsp[-2].minor.yy552); + yylhsminor.yy248 = addSlimitClause(pCxt, yylhsminor.yy248, yymsp[-1].minor.yy248); + yylhsminor.yy248 = addLimitClause(pCxt, yylhsminor.yy248, yymsp[0].minor.yy248); } - yymsp[-3].minor.yy212 = yylhsminor.yy212; + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - 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; + case 459: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-3].minor.yy248 = yylhsminor.yy248; break; - 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; + case 460: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy248, yymsp[0].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; 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.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); + case 462: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ +{ yymsp[-5].minor.yy248 = yymsp[-4].minor.yy248; } + yy_destructor(yypParser,368,&yymsp[-3].minor); + yy_destructor(yypParser,369,&yymsp[-2].minor); + yy_destructor(yypParser,370,&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.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==470); +{ yymsp[-1].minor.yy248 = 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.yy212 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 467: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 471: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==471); +{ yymsp[-3].minor.yy248 = 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.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 468: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 472: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==472); +{ yymsp[-3].minor.yy248 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - 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; + case 473: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy248); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - 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; + case 477: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy248 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), yymsp[-1].minor.yy482, yymsp[0].minor.yy345); } + yymsp[-2].minor.yy248 = yylhsminor.yy248; break; - case 477: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy188 = ORDER_ASC; } + case 478: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy482 = ORDER_ASC; } break; - case 478: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy188 = ORDER_ASC; } + case 479: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy482 = ORDER_ASC; } break; - case 479: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy188 = ORDER_DESC; } + case 480: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy482 = ORDER_DESC; } break; - case 480: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy607 = NULL_ORDER_DEFAULT; } + case 481: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy345 = NULL_ORDER_DEFAULT; } break; - case 481: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy607 = NULL_ORDER_FIRST; } + case 482: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy345 = NULL_ORDER_FIRST; } break; - case 482: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy607 = NULL_ORDER_LAST; } + case 483: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy345 = NULL_ORDER_LAST; } break; default: break; From 39a31e8d253b2da600edcecd7dcb5232d89491a2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 5 Jul 2022 10:52:33 +0800 Subject: [PATCH 60/63] fix: remove mock code --- include/libs/executor/executor.h | 3 --- source/libs/executor/inc/executorimpl.h | 4 ---- source/libs/executor/src/executorMain.c | 23 +---------------------- source/libs/executor/src/executorimpl.c | 3 --- source/libs/qworker/src/qworker.c | 5 ----- 5 files changed, 1 insertion(+), 37 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index bfcaeeb59c..9d09861b8e 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -37,9 +37,6 @@ typedef struct SReadHandle { void* mnd; SMsgCb* pMsgCb; - /* XXXXXXXXXXXXXXXXXXXX */ - int32_t deleteQuery; - /* XXXXXXXXXXXXXXXXXXXX */ // int8_t initTsdbReader; bool tqReader; } SReadHandle; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 8f61a67658..84dd87b9e7 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -151,10 +151,6 @@ typedef struct SExecTaskInfo { jmp_buf env; // jump to this position when error happens. EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] struct SOperatorInfo* pRoot; - - /* XXXXXXXXXXXXXXXXXXXX */ - SReadHandle* pHandle; - /* XXXXXXXXXXXXXXXXXXXX */ } SExecTaskInfo; enum { diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 1a5dd00120..007c61afc3 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -139,29 +139,8 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { qDebug("%s execTask is launched", GET_TASKID(pTaskInfo)); int64_t st = taosGetTimestampUs(); - /* XXXXXXXXXXXXXXXXXXXX */ - if (pTaskInfo->pHandle->deleteQuery) { - static int32_t first = 1; - if (first) { - *pRes = createDataBlock(); - int64_t rows = 33; - SColumnInfoData infoData = createColumnInfoData(TSDB_DATA_TYPE_BIGINT, 8, 1); - blockDataAppendColInfo(*pRes, &infoData); - blockDataEnsureCapacity(*pRes, 1); - (*pRes)->info.rows = 1; - SColumnInfoData* pCol1 = taosArrayGet((*pRes)->pDataBlock, 0); - colDataAppend(pCol1, 0, (char*)&rows, false); - first = 0; - } else { - *pRes = NULL; - } - } else { - /* XXXXXXXXXXXXXXXXXXXX */ - *pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot); - /* XXXXXXXXXXXXXXXXXXXX */ - } - /* XXXXXXXXXXXXXXXXXXXX */ + *pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot); uint64_t el = (taosGetTimestampUs() - st); pTaskInfo->cost.elapsedTime += el; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 87239e8aa6..c30d047c47 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -4770,9 +4770,6 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead &(*pTaskInfo)->tableqinfoList, pPlan->user); - /* XXXXXXXXXXXXXXXXXXXX */ - (*pTaskInfo)->pHandle = pHandle; - /* XXXXXXXXXXXXXXXXXXXX */ if (NULL == (*pTaskInfo)->pRoot) { code = (*pTaskInfo)->code; goto _complete; diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 28959d03af..9a5a3d1bc9 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -930,11 +930,6 @@ int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes) { } ctx.plan = plan; - - /* XXXXXXXXXXXXXXXXXXXX */ - SReadHandle *phandle = (SReadHandle*)qwMsg->node; - phandle->deleteQuery = 1; - /* XXXXXXXXXXXXXXXXXXXX */ code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, NULL, OPTR_EXEC_MODEL_BATCH); if (code) { From de85dea5e2c545617fe3b1284df1197400676647 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 5 Jul 2022 10:58:43 +0800 Subject: [PATCH 61/63] tsdbUtil: fix cmpr functions --- source/dnode/vnode/src/tsdb/tsdbUtil.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 6eb7329487..293e8896ac 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -229,15 +229,15 @@ int32_t tCmprBlockIdx(void const *lhs, void const *rhs) { SBlockIdx *lBlockIdx = *(SBlockIdx **)lhs; SBlockIdx *rBlockIdx = *(SBlockIdx **)rhs; - if (lBlockIdx->suid < lBlockIdx->suid) { + if (lBlockIdx->suid < rBlockIdx->suid) { return -1; - } else if (lBlockIdx->suid > lBlockIdx->suid) { + } else if (lBlockIdx->suid > rBlockIdx->suid) { return 1; } - if (lBlockIdx->uid < lBlockIdx->uid) { + if (lBlockIdx->uid < rBlockIdx->uid) { return -1; - } else if (lBlockIdx->uid > lBlockIdx->uid) { + } else if (lBlockIdx->uid > rBlockIdx->uid) { return 1; } @@ -385,15 +385,15 @@ int32_t tCmprDelIdx(void const *lhs, void const *rhs) { SDelIdx *lDelIdx = *(SDelIdx **)lhs; SDelIdx *rDelIdx = *(SDelIdx **)rhs; - if (lDelIdx->suid < lDelIdx->suid) { + if (lDelIdx->suid < rDelIdx->suid) { return -1; - } else if (lDelIdx->suid > lDelIdx->suid) { + } else if (lDelIdx->suid > rDelIdx->suid) { return 1; } - if (lDelIdx->uid < lDelIdx->uid) { + if (lDelIdx->uid < rDelIdx->uid) { return -1; - } else if (lDelIdx->uid > lDelIdx->uid) { + } else if (lDelIdx->uid > rDelIdx->uid) { return 1; } From f6cd94d781f231aebdf47d9fb551817500759995 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 5 Jul 2022 11:03:09 +0800 Subject: [PATCH 62/63] tRealloc: fix type void * conversion --- include/util/tRealloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/util/tRealloc.h b/include/util/tRealloc.h index c051369488..8d40f6cc5d 100644 --- a/include/util/tRealloc.h +++ b/include/util/tRealloc.h @@ -38,7 +38,7 @@ static FORCE_INLINE int32_t tRealloc(uint8_t **ppBuf, int64_t size) { bsize *= 2; } - pBuf = taosMemoryRealloc(*ppBuf ? (*ppBuf) - sizeof(int64_t) : *ppBuf, bsize + sizeof(int64_t)); + pBuf = (uint8_t *)taosMemoryRealloc(*ppBuf ? (*ppBuf) - sizeof(int64_t) : *ppBuf, bsize + sizeof(int64_t)); if (pBuf == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; @@ -61,4 +61,4 @@ static FORCE_INLINE void tFree(uint8_t *pBuf) { } #endif -#endif /*_TD_UTIL_TREALLOC_H_*/ \ No newline at end of file +#endif /*_TD_UTIL_TREALLOC_H_*/ From b8899c82fee5edc69705ac35a3be4d81a5e3d799 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 5 Jul 2022 03:08:10 +0000 Subject: [PATCH 63/63] add some read del data code --- source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index ce94c0ecb7..efd0eec0b0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -345,8 +345,14 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData ASSERT(pHdr->suid == pDelIdx->suid); ASSERT(pHdr->uid == pDelIdx->uid); n += sizeof(*pHdr); + taosArrayClear(aDelData); while (n < size - sizeof(TSCKSUM)) { n += tGetDelData(*ppBuf + n, pDelData); + + if (taosArrayPush(aDelData, pDelData) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } } ASSERT(n == size - sizeof(TSCKSUM));