From b8391fad62eb5d23544f7218a272685325e40aea Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 12 Apr 2022 19:10:52 +0800 Subject: [PATCH 01/60] fix heartbeat msg --- include/common/tmsg.h | 114 ++++++---- include/libs/scheduler/scheduler.h | 2 + include/util/tarray.h | 8 + source/client/inc/clientInt.h | 10 +- source/client/src/clientEnv.c | 70 +++++- source/client/src/clientHb.c | 146 +++++++++++- source/client/src/clientImpl.c | 2 +- source/client/src/clientMain.c | 6 +- source/client/src/clientMsgHandler.c | 2 +- source/common/src/tmsg.c | 117 +++++++++- source/dnode/mnode/impl/inc/mndInt.h | 1 - source/dnode/mnode/impl/src/mndDb.c | 2 + source/dnode/mnode/impl/src/mndProfile.c | 277 +++++++++++------------ source/libs/scheduler/inc/schedulerInt.h | 4 +- source/libs/scheduler/src/scheduler.c | 30 ++- source/util/src/tarray.c | 15 ++ 16 files changed, 586 insertions(+), 220 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ba9147dcdd..dd7d904255 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -341,12 +341,12 @@ int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq); int32_t tDeserializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq); typedef struct { - int32_t acctId; - int64_t clusterId; - int32_t connId; - int8_t superUser; - SEpSet epSet; - char sVersion[128]; + int32_t acctId; + int64_t clusterId; + uint32_t connId; + int8_t superUser; + SEpSet epSet; + char sVersion[128]; } SConnectRsp; int32_t tSerializeSConnectRsp(void* buf, int32_t bufLen, SConnectRsp* pRsp); @@ -1038,40 +1038,6 @@ typedef struct { int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq); int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq); -typedef struct { - char sql[TSDB_SHOW_SQL_LEN]; - int32_t queryId; - int64_t useconds; - int64_t stime; - int64_t qId; - int64_t sqlObjId; - int32_t pid; - char fqdn[TSDB_FQDN_LEN]; - int8_t stableQuery; - int32_t numOfSub; - char subSqlInfo[TSDB_SHOW_SUBQUERY_LEN]; // include subqueries' index, Obj IDs and states(C-complete/I-imcomplete) -} SQueryDesc; - -typedef struct { - int32_t connId; - int32_t pid; - int32_t numOfQueries; - int32_t numOfStreams; - char app[TSDB_APP_NAME_LEN]; - char pData[]; -} SHeartBeatReq; - -typedef struct { - int32_t connId; - int32_t queryId; - int32_t streamId; - int32_t totalDnodes; - int32_t onlineDnodes; - int8_t killConnection; - int8_t align[3]; - SEpSet epSet; -} SHeartBeatRsp; - typedef struct { int32_t connId; int32_t queryId; @@ -1674,13 +1640,48 @@ typedef struct { } SKv; typedef struct { - int32_t connId; + int64_t tscRid; int32_t hbType; } SClientHbKey; typedef struct { - SClientHbKey connKey; - SHashObj* info; // hash + int64_t tid; + int32_t status; +} SQuerySubDesc; + +typedef struct { + char sql[TSDB_SHOW_SQL_LEN]; + uint64_t queryId; + int64_t useconds; + int64_t stime; + int64_t reqRid; + int32_t pid; + char fqdn[TSDB_FQDN_LEN]; + int32_t subPlanNum; + SArray* subDesc; // SArray +} SQueryDesc; + +typedef struct { + uint32_t connId; + int32_t pid; + char app[TSDB_APP_NAME_LEN]; + SArray* queryDesc; // SArray +} SQueryHbReqBasic; + +typedef struct { + uint32_t connId; + uint64_t killRid; + int32_t totalDnodes; + int32_t onlineDnodes; + int8_t killConnection; + int8_t align[3]; + SEpSet epSet; +} SQueryHbRspBasic; + +typedef struct { + SClientHbKey connKey; + SQueryHbReqBasic* query; + SHashObj* info; // hash } SClientHbReq; typedef struct { @@ -1689,9 +1690,10 @@ typedef struct { } SClientHbBatchReq; typedef struct { - SClientHbKey connKey; - int32_t status; - SArray* info; // Array + SClientHbKey connKey; + int32_t status; + SQueryHbRspBasic* query; + SArray* info; // Array } SClientHbRsp; typedef struct { @@ -1711,8 +1713,23 @@ static FORCE_INLINE void tFreeReqKvHash(SHashObj* info) { } } +static FORCE_INLINE void tFreeClientHbQueryDesc(void* pDesc) { + SQueryDesc* desc = (SQueryDesc*)pDesc; + if (desc->subDesc) { + taosArrayDestroy(desc->subDesc); + desc->subDesc = NULL; + } +} + static FORCE_INLINE void tFreeClientHbReq(void* pReq) { SClientHbReq* req = (SClientHbReq*)pReq; + if (req->query) { + if (req->query->queryDesc) { + taosArrayDestroyEx(req->query->queryDesc, tFreeClientHbQueryDesc); + } + taosMemoryFreeClear(req->query); + } + if (req->info) { tFreeReqKvHash(req->info); taosHashCleanup(req->info); @@ -1741,6 +1758,7 @@ static FORCE_INLINE void tFreeClientKv(void* pKv) { static FORCE_INLINE void tFreeClientHbRsp(void* pRsp) { SClientHbRsp* rsp = (SClientHbRsp*)pRsp; + taosMemoryFreeClear(rsp->query); if (rsp->info) taosArrayDestroyEx(rsp->info, tFreeClientKv); } @@ -1769,13 +1787,13 @@ static FORCE_INLINE int32_t tDecodeSKv(SCoder* pDecoder, SKv* pKv) { } static FORCE_INLINE int32_t tEncodeSClientHbKey(SCoder* pEncoder, const SClientHbKey* pKey) { - if (tEncodeI32(pEncoder, pKey->connId) < 0) return -1; + if (tEncodeI64(pEncoder, pKey->tscRid) < 0) return -1; if (tEncodeI32(pEncoder, pKey->hbType) < 0) return -1; return 0; } static FORCE_INLINE int32_t tDecodeSClientHbKey(SCoder* pDecoder, SClientHbKey* pKey) { - if (tDecodeI32(pDecoder, &pKey->connId) < 0) return -1; + if (tDecodeI64(pDecoder, &pKey->tscRid) < 0) return -1; if (tDecodeI32(pDecoder, &pKey->hbType) < 0) return -1; return 0; } diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index 5ab4ead89c..460749243c 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -89,6 +89,8 @@ int32_t schedulerAsyncExecJob(void *transport, SArray *pNodeList, SQueryPlan* pD */ int32_t schedulerFetchRows(int64_t job, void **data); +int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub); + /** * Cancel query job diff --git a/include/util/tarray.h b/include/util/tarray.h index 521e54040d..383af8309d 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -205,6 +205,14 @@ SArray* taosArrayDup(const SArray* pSrc); */ void taosArrayClear(SArray* pArray); +/** + * clear the array (remove all element) + * @param pArray + * @param fp + */ +void taosArrayClearEx(SArray* pArray, void (*fp)(void*)); + + /** * destroy array list * @param pArray diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 96d7cead68..4bb1d8e3ff 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -43,7 +43,8 @@ extern "C" { } \ } while (0) -#define HEARTBEAT_INTERVAL 1500 // ms +//#define HEARTBEAT_INTERVAL 1500 // ms +#define HEARTBEAT_INTERVAL 15000 // ms TODO typedef struct SAppInstInfo SAppInstInfo; @@ -139,6 +140,7 @@ typedef struct STscObj { TdThreadMutex mutex; // used to protect the operation on db int32_t numOfReqs; // number of sqlObj bound to this connection SAppInstInfo* pAppInfo; + SHashObj* pRequests; } STscObj; typedef struct SResultColumn { @@ -215,11 +217,15 @@ int taos_init(); void* createTscObj(const char* user, const char* auth, const char* db, SAppInstInfo* pAppInfo); void destroyTscObj(void* pObj); +STscObj *acquireTscObj(int64_t rid); +int32_t releaseTscObj(int64_t rid); uint64_t generateRequestId(); void* createRequest(STscObj* pObj, __taos_async_fn_t fp, void* param, int32_t type); void destroyRequest(SRequestObj* pRequest); +SRequestObj *acquireRequest(int64_t rid); +int32_t releaseRequest(int64_t rid); char* getDbOfConnection(STscObj* pObj); void setConnectionDB(STscObj* pTscObj, const char* db); @@ -258,7 +264,7 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key); void appHbMgrCleanup(void); // conn level -int hbRegisterConn(SAppHbMgr* pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType); +int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int32_t hbType); void hbDeregisterConn(SAppHbMgr* pAppHbMgr, SClientHbKey connKey); int hbAddConnInfo(SAppHbMgr* pAppHbMgr, SClientHbKey connKey, void* key, void* value, int32_t keyLen, int32_t valueLen); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 359649884f..f997d4cff2 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -37,7 +37,8 @@ static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; volatile int32_t tscInitRes = 0; static void registerRequest(SRequestObj *pRequest) { - STscObj *pTscObj = (STscObj *)taosAcquireRef(clientConnRefPool, pRequest->pTscObj->id); + STscObj *pTscObj = acquireTscObj(pRequest->pTscObj->id); + assert(pTscObj != NULL); // connection has been released already, abort creating request. @@ -69,7 +70,7 @@ static void deregisterRequest(SRequestObj *pRequest) { tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", reqId:0x%" PRIx64 " elapsed:%" PRIu64 " ms, current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration/1000, num, currentInst); - taosReleaseRef(clientConnRefPool, pTscObj->id); + releaseTscObj(pTscObj->id); } // todo close the transporter properly @@ -107,12 +108,24 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { return pDnodeConn; } +void closeAllRequests(SHashObj *pRequests) { + void *pIter = taosHashIterate(pRequests, NULL); + while (pIter != NULL) { + int64_t *rid = pIter; + + releaseRequest(*rid); + + pIter = taosHashIterate(pRequests, pIter); + } +} + void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; - SClientHbKey connKey = {.connId = pTscObj->connId, .hbType = pTscObj->connType}; + SClientHbKey connKey = {.tscRid = pTscObj->id, .hbType = pTscObj->connType}; hbDeregisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey); atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); + closeAllRequests(pTscObj->pRequests); tscDebug("connObj 0x%" PRIx64 " destroyed, totalConn:%" PRId64, pTscObj->id, pTscObj->pAppInfo->numOfConns); taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFreeClear(pTscObj); @@ -125,6 +138,13 @@ void *createTscObj(const char *user, const char *auth, const char *db, SAppInstI return NULL; } + pObj->pRequests = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); + if (NULL == pObj->pRequests) { + taosMemoryFree(pObj); + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + return NULL; + } + pObj->pAppInfo = pAppInfo; tstrncpy(pObj->user, user, sizeof(pObj->user)); memcpy(pObj->pass, auth, TSDB_PASSWORD_LEN); @@ -140,6 +160,14 @@ void *createTscObj(const char *user, const char *auth, const char *db, SAppInstI return pObj; } +STscObj *acquireTscObj(int64_t rid) { + return (STscObj *)taosAcquireRef(clientConnRefPool, rid); +} + +int32_t releaseTscObj(int64_t rid) { + return taosReleaseRef(clientConnRefPool, rid); +} + void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t type) { assert(pObj != NULL); @@ -160,6 +188,14 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty tsem_init(&pRequest->body.rspSem, 0, 0); registerRequest(pRequest); + + if (taosHashPut(pObj->pRequests, &pRequest->self, sizeof(pRequest->self), &pRequest->self, sizeof(pRequest->self))) { + destroyRequest(pRequest); + releaseTscObj(pObj->id); + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + return NULL; + } + return pRequest; } @@ -185,6 +221,8 @@ static void doDestroyRequest(void *p) { assert(RID_VALID(pRequest->self)); + taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); + taosMemoryFreeClear(pRequest->msgBuf); taosMemoryFreeClear(pRequest->sqlstr); taosMemoryFreeClear(pRequest->pInfo); @@ -213,9 +251,18 @@ void destroyRequest(SRequestObj *pRequest) { return; } - taosReleaseRef(clientReqRefPool, pRequest->self); + taosRemoveRef(clientReqRefPool, pRequest->self); } +SRequestObj *acquireRequest(int64_t rid) { + return (SRequestObj *)taosAcquireRef(clientReqRefPool, rid); +} + +int32_t releaseRequest(int64_t rid) { + return taosReleaseRef(clientReqRefPool, rid); +} + + 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. @@ -456,11 +503,18 @@ uint64_t generateRequestId() { } } - int64_t ts = taosGetTimestampMs(); - uint64_t pid = taosGetPId(); - int32_t val = atomic_add_fetch_32(&requestSerialId, 1); + uint64_t id = 0; + + while (true) { + int64_t ts = taosGetTimestampMs(); + uint64_t pid = taosGetPId(); + int32_t val = atomic_add_fetch_32(&requestSerialId, 1); - uint64_t id = ((hashId & 0x0FFF) << 52) | ((pid & 0x0FFF) << 40) | ((ts & 0xFFFFFF) << 16) | (val & 0xFFFF); + id = ((hashId & 0x0FFF) << 52) | ((pid & 0x0FFF) << 40) | ((ts & 0xFFFFFF) << 16) | (val & 0xFFFF); + if (id) { + break; + } + } return id; } diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index d389fc34c6..642ba46336 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -14,6 +14,7 @@ */ #include "catalog.h" +#include "scheduler.h" #include "clientInt.h" #include "clientLog.h" #include "trpc.h" @@ -107,10 +108,36 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { SHbConnInfo *info = taosHashGet(pAppHbMgr->connInfo, &pRsp->connKey, sizeof(SClientHbKey)); if (NULL == info) { - tscWarn("fail to get connInfo, may be dropped, connId:%d, type:%d", pRsp->connKey.connId, pRsp->connKey.hbType); + tscWarn("fail to get connInfo, may be dropped, refId:%" PRIx64 ", type:%d", pRsp->connKey.tscRid, pRsp->connKey.hbType); return TSDB_CODE_SUCCESS; } + if (pRsp->query) { + STscObj *pTscObj = (STscObj *)acquireTscObj(pRsp->connKey.tscRid); + if (NULL == pTscObj) { + tscDebug("tscObj rid %" PRIx64 " not exist", pRsp->connKey.tscRid); + } else { + updateEpSet_s(&pTscObj->pAppInfo->mgmtEp, &pRsp->query->epSet); + pTscObj->connId = pRsp->query->connId; + + if (pRsp->query->killRid) { + SRequestObj *pRequest = acquireRequest(pRsp->query->killRid); + if (NULL == pRequest) { + tscDebug("request 0x%" PRIx64 " not exist to kill", pRsp->query->killRid); + } else { + taos_stop_query((TAOS_RES *)pRequest); + releaseRequest(pRsp->query->killRid); + } + } + + if (pRsp->query->killConnection) { + taos_close(pTscObj); + } + + releaseTscObj(pRsp->connKey.tscRid); + } + } + int32_t kvNum = pRsp->info ? taosArrayGetSize(pRsp->info) : 0; tscDebug("hb got %d rsp kv", kvNum); @@ -206,6 +233,97 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) return code; } +int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { + int64_t now = taosGetTimestampUs(); + SQueryDesc desc = {0}; + int32_t code = 0; + + void *pIter = taosHashIterate(pObj->pRequests, NULL); + while (pIter != NULL) { + int64_t *rid = pIter; + SRequestObj *pRequest = acquireRequest(*rid); + if (NULL == pRequest) { + continue; + } + + tstrncpy(desc.sql, pRequest->sqlstr, sizeof(desc.sql)); + desc.stime = pRequest->metric.start; + desc.queryId = pRequest->requestId; + desc.useconds = now - pRequest->metric.start; + desc.reqRid = pRequest->self; + desc.pid = hbBasic->pid; + taosGetFqdn(desc.fqdn); + desc.subPlanNum = pRequest->body.pDag ? pRequest->body.pDag->numOfSubplans : 0; + + if (desc.subPlanNum) { + desc.subDesc = taosArrayInit(desc.subPlanNum, sizeof(SQuerySubDesc)); + if (NULL == desc.subDesc) { + releaseRequest(*rid); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + code = schedulerGetTasksStatus(pRequest->body.queryJob, desc.subDesc); + if (code) { + taosArrayDestroy(desc.subDesc); + desc.subDesc = NULL; + } + } + + releaseRequest(*rid); + taosArrayPush(hbBasic->queryDesc, &desc); + + pIter = taosHashIterate(pObj->pRequests, pIter); + } + + return TSDB_CODE_SUCCESS; +} + +int32_t hbGetQueryBasicInfo(SClientHbKey *connKey, SClientHbReq *req) { + STscObj *pTscObj = (STscObj *)acquireTscObj(connKey->tscRid); + if (NULL == pTscObj) { + tscWarn("tscObj rid %" PRIx64 " not exist", connKey->tscRid); + return TSDB_CODE_QRY_APP_ERROR; + } + + int32_t numOfQueries = pTscObj->pRequests ? taosHashGetSize(pTscObj->pRequests) : 0; + if (numOfQueries <= 0) { + releaseTscObj(connKey->tscRid); + tscDebug("no queries on connection"); + return TSDB_CODE_QRY_APP_ERROR; + } + + SQueryHbReqBasic *hbBasic = (SQueryHbReqBasic *)taosMemoryCalloc(1, sizeof(SQueryHbReqBasic)); + if (NULL == hbBasic) { + tscError("calloc %d failed", (int32_t)sizeof(SQueryHbReqBasic)); + releaseTscObj(connKey->tscRid); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + hbBasic->queryDesc = taosArrayInit(numOfQueries, sizeof(SQueryDesc)); + if (NULL == hbBasic->queryDesc) { + tscWarn("taosArrayInit %d queryDesc failed", numOfQueries); + releaseTscObj(connKey->tscRid); + taosMemoryFree(hbBasic); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + hbBasic->connId = pTscObj->connId; + hbBasic->pid = taosGetPId(); + taosGetAppName(hbBasic->app, NULL); + + int32_t code = hbBuildQueryDesc(hbBasic, pTscObj); + if (code) { + releaseTscObj(connKey->tscRid); + taosMemoryFree(hbBasic); + return code; + } + + req->query = hbBasic; + releaseTscObj(connKey->tscRid); + + return TSDB_CODE_SUCCESS; +} + int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SClientHbReq *req) { SDbVgVersion *dbs = NULL; uint32_t dbNum = 0; @@ -284,6 +402,8 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req return code; } + hbGetQueryBasicInfo(connKey, req); + code = hbGetExpiredDBInfo(connKey, pCatalog, req); if (TSDB_CODE_SUCCESS != code) { return code; @@ -316,6 +436,11 @@ void hbFreeReq(void *req) { tFreeReqKvHash(pReq->info); } +void hbClearClientHbReq(SClientHbReq *pReq) { + pReq->query = NULL; + pReq->info = NULL; +} + SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { SClientHbBatchReq *pBatchReq = taosMemoryCalloc(1, sizeof(SClientHbBatchReq)); if (pBatchReq == NULL) { @@ -334,20 +459,21 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { if (info) { code = (*clientHbMgr.reqHandle[pOneReq->connKey.hbType])(&pOneReq->connKey, info->param, pOneReq); if (code) { - taosHashCancelIterate(pAppHbMgr->activeInfo, pIter); - break; + pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); + continue; } } taosArrayPush(pBatchReq->reqs, pOneReq); + hbClearClientHbReq(pOneReq); pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); } - if (code) { - taosArrayDestroyEx(pBatchReq->reqs, hbFreeReq); - taosMemoryFreeClear(pBatchReq); - } +// if (code) { +// taosArrayDestroyEx(pBatchReq->reqs, hbFreeReq); +// taosMemoryFreeClear(pBatchReq); +// } return pBatchReq; } @@ -548,7 +674,7 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo * if (data != NULL) { return 0; } - SClientHbReq hbReq; + SClientHbReq hbReq = {0}; hbReq.connKey = connKey; hbReq.info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); @@ -565,9 +691,9 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo * return 0; } -int hbRegisterConn(SAppHbMgr *pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType) { +int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int32_t hbType) { SClientHbKey connKey = { - .connId = connId, + .tscRid = tscRefId, .hbType = HEARTBEAT_TYPE_QUERY, }; SHbConnInfo info = {0}; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b311060ea9..2c58094b4d 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -458,7 +458,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t taos_close(pTscObj); pTscObj = NULL; } else { - tscDebug("0x%" PRIx64 " connection is opening, connId:%d, dnodeConn:%p, reqId:0x%" PRIx64, pTscObj->id, + tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, reqId:0x%" PRIx64, pTscObj->id, pTscObj->connId, pTscObj->pAppInfo->pTransporter, pRequest->requestId); destroyRequest(pRequest); } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e10cf5179e..76257a7c0e 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -14,6 +14,7 @@ */ #include "catalog.h" +#include "scheduler.h" #include "clientInt.h" #include "clientLog.h" #include "os.h" @@ -66,6 +67,7 @@ void taos_cleanup(void) { rpcCleanup(); catalogDestroy(); + schedulerDestroy(); taosCloseLog(); tscInfo("all local resources released"); @@ -98,7 +100,7 @@ void taos_close(TAOS *taos) { STscObj *pTscObj = (STscObj *)taos; tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); - /*taosRemoveRef(clientConnRefPool, pTscObj->id);*/ + taosRemoveRef(clientConnRefPool, pTscObj->id); } int taos_errno(TAOS_RES *tres) { @@ -366,7 +368,7 @@ void taos_stop_query(TAOS_RES *res) { return; } - // scheduleCancelJob(pRequest->body.pQueryJob); + schedulerFreeJob(pRequest->body.queryJob); } bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) { diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 4314391743..ca4c681304 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -71,7 +71,7 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { pTscObj->connType = HEARTBEAT_TYPE_QUERY; - hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, connectRsp.connId, connectRsp.clusterId, HEARTBEAT_TYPE_QUERY); + hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, pTscObj->id, connectRsp.clusterId, HEARTBEAT_TYPE_QUERY); // pRequest->body.resInfo.pRspMsg = pMsg->pData; tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 5973a70b59..92fa9b8e97 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -134,6 +134,42 @@ void *taosDecodeSEpSet(void *buf, SEpSet *pEp) { static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq) { if (tEncodeSClientHbKey(pEncoder, &pReq->connKey) < 0) return -1; + if (pReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { + int32_t queryNum = 0; + if (pReq->query) { + queryNum = 1; + if (tEncodeI32(pEncoder, queryNum) < 0) return -1; + if (tEncodeU32(pEncoder, pReq->query->connId) < 0) return -1; + if (tEncodeI32(pEncoder, pReq->query->pid) < 0) return -1; + if (tEncodeCStr(pEncoder, pReq->query->app) < 0) return -1; + + int32_t num = taosArrayGetSize(pReq->query->queryDesc); + if (tEncodeI32(pEncoder, num) < 0) return -1; + + for (int32_t i = 0; i < num; ++i) { + SQueryDesc *desc = taosArrayGet(pReq->query->queryDesc, i); + if (tEncodeCStr(pEncoder, desc->sql) < 0) return -1; + if (tEncodeU64(pEncoder, desc->queryId) < 0) return -1; + if (tEncodeI64(pEncoder, desc->useconds) < 0) return -1; + if (tEncodeI64(pEncoder, desc->stime) < 0) return -1; + if (tEncodeI64(pEncoder, desc->reqRid) < 0) return -1; + if (tEncodeI32(pEncoder, desc->pid) < 0) return -1; + if (tEncodeCStr(pEncoder, desc->fqdn) < 0) return -1; + if (tEncodeI32(pEncoder, desc->subPlanNum) < 0) return -1; + + int32_t snum = desc->subDesc ? taosArrayGetSize(desc->subDesc) : 0; + if (tEncodeI32(pEncoder, snum) < 0) return -1; + for (int32_t m = 0; m < snum; ++m) { + SQuerySubDesc *sDesc = taosArrayGet(desc->subDesc, m); + if (tEncodeI64(pEncoder, sDesc->tid) < 0) return -1; + if (tEncodeI32(pEncoder, sDesc->status) < 0) return -1; + } + } + } else { + if (tEncodeI32(pEncoder, queryNum) < 0) return -1; + } + } + int32_t kvNum = taosHashGetSize(pReq->info); if (tEncodeI32(pEncoder, kvNum) < 0) return -1; void *pIter = taosHashIterate(pReq->info, NULL); @@ -149,6 +185,53 @@ static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq static int32_t tDeserializeSClientHbReq(SCoder *pDecoder, SClientHbReq *pReq) { if (tDecodeSClientHbKey(pDecoder, &pReq->connKey) < 0) return -1; + if (pReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { + int32_t queryNum = 0; + if (tDecodeI32(pDecoder, &queryNum) < 0) return -1; + if (queryNum) { + pReq->query = taosMemoryCalloc(1, sizeof(*pReq->query)); + if (NULL == pReq->query) return -1; + if (tDecodeU32(pDecoder, &pReq->query->connId) < 0) return -1; + if (tDecodeI32(pDecoder, &pReq->query->pid) < 0) return -1; + if (tDecodeCStrTo(pDecoder, pReq->query->app) < 0) return -1; + + int32_t num = 0; + if (tDecodeI32(pDecoder, &num) < 0) return -1; + if (num > 0) { + pReq->query->queryDesc = taosArrayInit(num, sizeof(SQueryDesc)); + if (NULL == pReq->query->queryDesc) return -1; + + for (int32_t i = 0; i < num; ++i) { + SQueryDesc desc = {0}; + if (tDecodeCStrTo(pDecoder, desc.sql) < 0) return -1; + if (tDecodeU64(pDecoder, &desc.queryId) < 0) return -1; + if (tDecodeI64(pDecoder, &desc.useconds) < 0) return -1; + if (tDecodeI64(pDecoder, &desc.stime) < 0) return -1; + if (tDecodeI64(pDecoder, &desc.reqRid) < 0) return -1; + if (tDecodeI32(pDecoder, &desc.pid) < 0) return -1; + if (tDecodeCStrTo(pDecoder, desc.fqdn) < 0) return -1; + if (tDecodeI32(pDecoder, &desc.subPlanNum) < 0) return -1; + + int32_t snum = 0; + if (tDecodeI32(pDecoder, &snum) < 0) return -1; + if (snum > 0) { + desc.subDesc = taosArrayInit(snum, sizeof(SQuerySubDesc)); + if (NULL == desc.subDesc) return -1; + + for (int32_t m = 0; m < snum; ++m) { + SQuerySubDesc sDesc = {0}; + if (tDecodeI64(pDecoder, &sDesc.tid) < 0) return -1; + if (tDecodeI32(pDecoder, &sDesc.status) < 0) return -1; + taosArrayPush(desc.subDesc, &sDesc); + } + } + + taosArrayPush(pReq->query->queryDesc, &desc); + } + } + } + } + int32_t kvNum = 0; if (tDecodeI32(pDecoder, &kvNum) < 0) return -1; if (pReq->info == NULL) { @@ -168,6 +251,20 @@ static int32_t tSerializeSClientHbRsp(SCoder *pEncoder, const SClientHbRsp *pRsp if (tEncodeSClientHbKey(pEncoder, &pRsp->connKey) < 0) return -1; if (tEncodeI32(pEncoder, pRsp->status) < 0) return -1; + int32_t queryNum = 0; + if (pRsp->query) { + queryNum = 1; + if (tEncodeI32(pEncoder, queryNum) < 0) return -1; + if (tEncodeU32(pEncoder, pRsp->query->connId) < 0) return -1; + if (tEncodeU64(pEncoder, pRsp->query->killRid) < 0) return -1; + if (tEncodeI32(pEncoder, pRsp->query->totalDnodes) < 0) return -1; + if (tEncodeI32(pEncoder, pRsp->query->onlineDnodes) < 0) return -1; + if (tEncodeI8(pEncoder, pRsp->query->killConnection) < 0) return -1; + if (tEncodeSEpSet(pEncoder, &pRsp->query->epSet) < 0) return -1; + } else { + if (tEncodeI32(pEncoder, queryNum) < 0) return -1; + } + int32_t kvNum = taosArrayGetSize(pRsp->info); if (tEncodeI32(pEncoder, kvNum) < 0) return -1; for (int32_t i = 0; i < kvNum; i++) { @@ -182,6 +279,19 @@ static int32_t tDeserializeSClientHbRsp(SCoder *pDecoder, SClientHbRsp *pRsp) { if (tDecodeSClientHbKey(pDecoder, &pRsp->connKey) < 0) return -1; if (tDecodeI32(pDecoder, &pRsp->status) < 0) return -1; + int32_t queryNum = 0; + if (tDecodeI32(pDecoder, &queryNum) < 0) return -1; + if (queryNum) { + pRsp->query = taosMemoryCalloc(1, sizeof(*pRsp->query)); + if (NULL == pRsp->query) return -1; + if (tDecodeU32(pDecoder, &pRsp->query->connId) < 0) return -1; + if (tDecodeU64(pDecoder, &pRsp->query->killRid) < 0) return -1; + if (tDecodeI32(pDecoder, &pRsp->query->totalDnodes) < 0) return -1; + if (tDecodeI32(pDecoder, &pRsp->query->onlineDnodes) < 0) return -1; + if (tDecodeI8(pDecoder, &pRsp->query->killConnection) < 0) return -1; + if (tDecodeSEpSet(pDecoder, &pRsp->query->epSet) < 0) return -1; + } + int32_t kvNum = 0; if (tDecodeI32(pDecoder, &kvNum) < 0) return -1; pRsp->info = taosArrayInit(kvNum, sizeof(SKv)); @@ -224,8 +334,9 @@ int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchR int32_t reqNum = 0; if (tDecodeI32(&decoder, &reqNum) < 0) return -1; - if (pBatchReq->reqs == NULL) { + if (reqNum > 0) { pBatchReq->reqs = taosArrayInit(reqNum, sizeof(SClientHbReq)); + if (NULL == pBatchReq->reqs) return -1; } for (int32_t i = 0; i < reqNum; i++) { SClientHbReq req = {0}; @@ -2564,7 +2675,7 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI32(&encoder, pRsp->acctId) < 0) return -1; if (tEncodeI64(&encoder, pRsp->clusterId) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->connId) < 0) return -1; + if (tEncodeU32(&encoder, pRsp->connId) < 0) return -1; if (tEncodeI8(&encoder, pRsp->superUser) < 0) return -1; if (tEncodeSEpSet(&encoder, &pRsp->epSet) < 0) return -1; if (tEncodeCStr(&encoder, pRsp->sVersion) < 0) return -1; @@ -2582,7 +2693,7 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->acctId) < 0) return -1; if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->connId) < 0) return -1; + if (tDecodeU32(&decoder, &pRsp->connId) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1; if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1; if (tDecodeCStrTo(&decoder, pRsp->sVersion) < 0) return -1; diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index fa1502fe10..ad42eebc1b 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -75,7 +75,6 @@ typedef struct { } SShowMgmt; typedef struct { - int32_t connId; SCacheObj *cache; } SProfileMgmt; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 49e9ccaba6..fe75e6c60c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1128,6 +1128,8 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) { if (taosArrayGetSize(usedbRsp.pVgroupInfos) <= 0) { terrno = TSDB_CODE_MND_DB_NOT_EXIST; + } else { + code = 0; } } else { usedbRsp.vgVersion = usedbReq.vgVersion; diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 320671c332..b036b857e5 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -29,7 +29,7 @@ #define QUERY_SAVE_SIZE 20 typedef struct { - int32_t id; + uint32_t id; char user[TSDB_USER_LEN]; char app[TSDB_APP_NAME_LEN]; // app name that invokes taosc int64_t appStartTimeMs; // app start time @@ -39,15 +39,15 @@ typedef struct { int8_t killed; int64_t loginTimeMs; int64_t lastAccessTimeMs; - int32_t queryId; + uint64_t killId; int32_t numOfQueries; - SQueryDesc *pQueries; + SArray *pQueries; //SArray } SConnObj; static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, uint16_t port, int32_t pid, const char *app, int64_t startTime); static void mndFreeConn(SConnObj *pConn); -static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId); +static SConnObj *mndAcquireConn(SMnode *pMnode, uint32_t connId); static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn); static void *mndGetNextConn(SMnode *pMnode, SCacheIter *pIter); static void mndCancelGetNextConn(SMnode *pMnode, void *pIter); @@ -97,8 +97,9 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, ui const char *app, int64_t startTime) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; - int32_t connId = atomic_add_fetch_32(&pMgmt->connId, 1); - if (connId == 0) atomic_add_fetch_32(&pMgmt->connId, 1); + char connStr[255] = {0}; + int32_t len = snprintf(connStr, sizeof(connStr), "%s%d%d%d%s", user, ip, port, pid, app); + int32_t connId = mndGenerateUid(connStr, len); if (startTime == 0) startTime = taosGetTimestampMs(); SConnObj connObj = {.id = connId, @@ -109,7 +110,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, ui .killed = 0, .loginTimeMs = taosGetTimestampMs(), .lastAccessTimeMs = 0, - .queryId = 0, + .killId = 0, .numOfQueries = 0, .pQueries = NULL}; @@ -124,35 +125,35 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, uint32_t ip, ui mError("conn:%d, failed to put into cache since %s, user:%s", connId, user, terrstr()); return NULL; } else { - mTrace("conn:%d, is created, data:%p user:%s", pConn->id, pConn, user); + mTrace("conn:%u, is created, data:%p user:%s", pConn->id, pConn, user); return pConn; } } static void mndFreeConn(SConnObj *pConn) { taosMemoryFreeClear(pConn->pQueries); - mTrace("conn:%d, is destroyed, data:%p", pConn->id, pConn); + mTrace("conn:%u, is destroyed, data:%p", pConn->id, pConn); } -static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) { +static SConnObj *mndAcquireConn(SMnode *pMnode, uint32_t connId) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; - SConnObj *pConn = taosCacheAcquireByKey(pMgmt->cache, &connId, sizeof(int32_t)); + SConnObj *pConn = taosCacheAcquireByKey(pMgmt->cache, &connId, sizeof(connId)); if (pConn == NULL) { - mDebug("conn:%d, already destroyed", connId); + mDebug("conn:%u, already destroyed", connId); return NULL; } int32_t keepTime = tsShellActivityTimer * 3; pConn->lastAccessTimeMs = keepTime * 1000 + (uint64_t)taosGetTimestampMs(); - mTrace("conn:%d, acquired from cache, data:%p", pConn->id, pConn); + mTrace("conn:%u, acquired from cache, data:%p", pConn->id, pConn); return pConn; } static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn) { if (pConn == NULL) return; - mTrace("conn:%d, released from cache, data:%p", pConn->id, pConn); + mTrace("conn:%u, released from cache, data:%p", pConn->id, pConn); SProfileMgmt *pMgmt = &pMnode->profileMgmt; taosCacheRelease(pMgmt->cache, (void **)&pConn, false); @@ -217,6 +218,8 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { goto CONN_OVER; } + mndAcquireConn(pMnode, pConn->id); + SConnectRsp connectRsp = {0}; connectRsp.acctId = pUser->acctId; connectRsp.superUser = pUser->superUser; @@ -236,7 +239,7 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) { pReq->rspLen = contLen; pReq->pRsp = pRsp; - mDebug("user:%s, login from %s, conn:%d, app:%s", pReq->user, ip, pConn->id, connReq.app); + mDebug("user:%s, login from %s:%d, conn:%u, app:%s", pReq->user, ip, pConn->port, pConn->id, connReq.app); code = 0; @@ -249,22 +252,13 @@ CONN_OVER: return code; } -static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) { - pConn->numOfQueries = 0; - int32_t numOfQueries = htonl(pReq->numOfQueries); +static int32_t mndSaveQueryList(SConnObj *pConn, SQueryHbReqBasic *pBasic) { + taosArrayDestroyEx(pConn->pQueries, tFreeClientHbQueryDesc); - if (numOfQueries > 0) { - if (pConn->pQueries == NULL) { - pConn->pQueries = taosMemoryCalloc(sizeof(SQueryDesc), QUERY_SAVE_SIZE); - } - - pConn->numOfQueries = TMIN(QUERY_SAVE_SIZE, numOfQueries); - - int32_t saveSize = pConn->numOfQueries * sizeof(SQueryDesc); - if (saveSize > 0 && pConn->pQueries != NULL) { - memcpy(pConn->pQueries, pReq->pData, saveSize); - } - } + pConn->pQueries = pBasic->queryDesc; + pBasic->queryDesc = NULL; + + pConn->numOfQueries = pBasic->queryDesc ? taosArrayGetSize(pBasic->queryDesc) : 0; return TSDB_CODE_SUCCESS; } @@ -334,6 +328,111 @@ static SClientHbRsp *mndMqHbBuildRsp(SMnode *pMnode, SClientHbReq *pReq) { return NULL; } +static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHbReq *pHbReq, SClientHbBatchRsp *pBatchRsp) { + SProfileMgmt *pMgmt = &pMnode->profileMgmt; + SClientHbRsp hbRsp = {.connKey = pHbReq->connKey, .status = 0, .info = NULL, .query = NULL}; + + if (pHbReq->query) { + SQueryHbReqBasic *pBasic = pHbReq->query; + + SRpcConnInfo connInfo = {0}; + rpcGetConnInfo(pMsg->handle, &connInfo); + + SConnObj *pConn = mndAcquireConn(pMnode, pBasic->connId); + if (pConn == NULL) { + pConn = mndCreateConn(pMnode, connInfo.user, connInfo.clientIp, connInfo.clientPort, pBasic->pid, pBasic->app, 0); + if (pConn == NULL) { + mError("user:%s, conn:%u is freed and failed to create new since %s", connInfo.user, pBasic->connId, terrstr()); + return -1; + } else { + mDebug("user:%s, conn:%u is freed and create a new conn:%u", connInfo.user, pBasic->connId, pConn->id); + } + } else if (pConn->killed) { + mError("user:%s, conn:%u is already killed", connInfo.user, pConn->id); + mndReleaseConn(pMnode, pConn); + terrno = TSDB_CODE_MND_INVALID_CONNECTION; + return -1; + } + + SQueryHbRspBasic *rspBasic = taosMemoryCalloc(1, sizeof(SQueryHbRspBasic)); + if (rspBasic == NULL) { + mndReleaseConn(pMnode, pConn); + terrno = TSDB_CODE_OUT_OF_MEMORY; + mError("user:%s, conn:%u failed to process hb while since %s", pConn->user, pBasic->connId, terrstr()); + return -1; + } + + mndSaveQueryList(pConn, pBasic); + if (pConn->killed != 0) { + rspBasic->killConnection = 1; + } + + if (pConn->killId != 0) { + rspBasic->killRid = pConn->killId; + pConn->killId = 0; + } + + rspBasic->connId = pConn->id; + rspBasic->totalDnodes = 1; //TODO + rspBasic->onlineDnodes = 1; //TODO + mndGetMnodeEpSet(pMnode, &rspBasic->epSet); + mndReleaseConn(pMnode, pConn); + + hbRsp.query = rspBasic; + } + + int32_t kvNum = taosHashGetSize(pHbReq->info); + if (NULL == pHbReq->info || kvNum <= 0) { + taosArrayPush(pBatchRsp->rsps, &hbRsp); + return TSDB_CODE_SUCCESS; + } + + hbRsp.info = taosArrayInit(kvNum, sizeof(SKv)); + if (NULL == hbRsp.info) { + mError("taosArrayInit %d rsp kv failed", kvNum); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + void *pIter = taosHashIterate(pHbReq->info, NULL); + while (pIter != NULL) { + SKv *kv = pIter; + + switch (kv->key) { + case HEARTBEAT_KEY_DBINFO: { + void *rspMsg = NULL; + int32_t rspLen = 0; + mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbVgVersion), &rspMsg, &rspLen); + if (rspMsg && rspLen > 0) { + SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg}; + taosArrayPush(hbRsp.info, &kv1); + } + break; + } + case HEARTBEAT_KEY_STBINFO: { + void *rspMsg = NULL; + int32_t rspLen = 0; + mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableMetaVersion), &rspMsg, &rspLen); + if (rspMsg && rspLen > 0) { + SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg}; + taosArrayPush(hbRsp.info, &kv1); + } + break; + } + default: + mError("invalid kv key:%d", kv->key); + hbRsp.status = TSDB_CODE_MND_APP_ERROR; + break; + } + + pIter = taosHashIterate(pHbReq->info, pIter); + } + + taosArrayPush(pBatchRsp->rsps, &hbRsp); + + return TSDB_CODE_SUCCESS; +} + static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { SMnode *pMnode = pReq->pNode; @@ -351,48 +450,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { for (int i = 0; i < sz; i++) { SClientHbReq *pHbReq = taosArrayGet(batchReq.reqs, i); if (pHbReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { - int32_t kvNum = taosHashGetSize(pHbReq->info); - if (NULL == pHbReq->info || kvNum <= 0) { - continue; - } - - SClientHbRsp hbRsp = {.connKey = pHbReq->connKey, .status = 0, .info = taosArrayInit(kvNum, sizeof(SKv))}; - - void *pIter = taosHashIterate(pHbReq->info, NULL); - while (pIter != NULL) { - SKv *kv = pIter; - - switch (kv->key) { - case HEARTBEAT_KEY_DBINFO: { - void *rspMsg = NULL; - int32_t rspLen = 0; - mndValidateDbInfo(pMnode, kv->value, kv->valueLen / sizeof(SDbVgVersion), &rspMsg, &rspLen); - if (rspMsg && rspLen > 0) { - SKv kv1 = {.key = HEARTBEAT_KEY_DBINFO, .valueLen = rspLen, .value = rspMsg}; - taosArrayPush(hbRsp.info, &kv1); - } - break; - } - case HEARTBEAT_KEY_STBINFO: { - void *rspMsg = NULL; - int32_t rspLen = 0; - mndValidateStbInfo(pMnode, kv->value, kv->valueLen / sizeof(SSTableMetaVersion), &rspMsg, &rspLen); - if (rspMsg && rspLen > 0) { - SKv kv1 = {.key = HEARTBEAT_KEY_STBINFO, .valueLen = rspLen, .value = rspMsg}; - taosArrayPush(hbRsp.info, &kv1); - } - break; - } - default: - mError("invalid kv key:%d", kv->key); - hbRsp.status = TSDB_CODE_MND_APP_ERROR; - break; - } - - pIter = taosHashIterate(pHbReq->info, pIter); - } - - taosArrayPush(batchRsp.rsps, &hbRsp); + mndProcessQueryHeartBeat(pMnode, &pReq->rpcMsg, pHbReq, &batchRsp); } else if (pHbReq->connKey.hbType == HEARTBEAT_TYPE_MQ) { SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq); if (pRsp != NULL) { @@ -421,73 +479,8 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { taosArrayDestroy(batchRsp.rsps); pReq->rspLen = tlen; pReq->pRsp = buf; + return 0; - -#if 0 - SMnode *pMnode = pReq->pNode; - SProfileMgmt *pMgmt = &pMnode->profileMgmt; - - SHeartBeatReq *pHeartbeat = pReq->rpcMsg.pCont; - pHeartbeat->connId = htonl(pHeartbeat->connId); - pHeartbeat->pid = htonl(pHeartbeat->pid); - - SConnObj *pConn = mndAcquireConn(pMnode, pHeartbeat->connId); - if (pConn == NULL) { - pConn = mndCreateConn(pMnode, &info, pHeartbeat->pid, pHeartbeat->app, 0); - if (pConn == NULL) { - mError("user:%s, conn:%d is freed and failed to create new since %s", pReq->user, pHeartbeat->connId, terrstr()); - return -1; - } else { - mDebug("user:%s, conn:%d is freed and create a new conn:%d", pReq->user, pHeartbeat->connId, pConn->id); - } - } else if (pConn->killed) { - mError("user:%s, conn:%d is already killed", pReq->user, pConn->id); - terrno = TSDB_CODE_MND_INVALID_CONNECTION; - return -1; - } else { - if (pConn->ip != info.clientIp || pConn->port != info.clientPort /* || strcmp(pConn->user, info.user) != 0 */) { - char oldIpStr[40]; - char newIpStr[40]; - taosIpPort2String(pConn->ip, pConn->port, oldIpStr); - taosIpPort2String(info.clientIp, info.clientPort, newIpStr); - mError("conn:%d, incoming conn user:%s ip:%s, not match exist user:%s ip:%s", pConn->id, info.user, newIpStr, - pConn->user, oldIpStr); - - if (pMgmt->connId < pConn->id) pMgmt->connId = pConn->id + 1; - taosCacheRelease(pMgmt->cache, (void **)&pConn, false); - terrno = TSDB_CODE_MND_INVALID_CONNECTION; - return -1; - } - } - - SHeartBeatRsp *pRsp = rpcMallocCont(sizeof(SHeartBeatRsp)); - if (pRsp == NULL) { - mndReleaseConn(pMnode, pConn); - terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("user:%s, conn:%d failed to process hb while since %s", pReq->user, pHeartbeat->connId, terrstr()); - return -1; - } - - mndSaveQueryStreamList(pConn, pHeartbeat); - if (pConn->killed != 0) { - pRsp->killConnection = 1; - } - - if (pConn->queryId != 0) { - pRsp->queryId = htonl(pConn->queryId); - pConn->queryId = 0; - } - - pRsp->connId = htonl(pConn->id); - pRsp->totalDnodes = htonl(1); - pRsp->onlineDnodes = htonl(1); - mndGetMnodeEpSet(pMnode, &pRsp->epSet); - mndReleaseConn(pMnode, pConn); - - pReq->contLen = sizeof(SConnectRsp); - pReq->pRsp = pRsp; - return 0; -#endif } static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) { @@ -518,7 +511,7 @@ static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) { return -1; } else { mInfo("connId:%d, queryId:%d is killed by user:%s", killReq.connId, killReq.queryId, pReq->user); - pConn->queryId = killReq.queryId; + pConn->killId = killReq.queryId; taosCacheRelease(pMgmt->cache, (void **)&pConn, false); return 0; } @@ -651,7 +644,7 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pConn->id; + *(uint32_t *)pWrite = pConn->id; cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -808,6 +801,7 @@ static int32_t mndGetQueryMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *p static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { SMnode *pMnode = pReq->pNode; int32_t numOfRows = 0; +#if 0 SConnObj *pConn = NULL; int32_t cols = 0; char *pWrite; @@ -905,6 +899,7 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; +#endif return numOfRows; } @@ -917,4 +912,4 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter) { int32_t mndGetNumOfConnections(SMnode *pMnode) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; return taosCacheGetNumOfObj(pMgmt->cache); -} \ No newline at end of file +} diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 62a96b6438..d1def1bef1 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -156,8 +156,8 @@ typedef struct SSchJob { int32_t levelNum; int32_t taskNum; void *transport; - SArray *nodeList; // qnode/vnode list, element is SQueryNodeAddr - SArray *levels; // Element is SQueryLevel, starting from 0. SArray + SArray *nodeList; // qnode/vnode list, SArray + SArray *levels; // starting from 0. SArray SNodeList *subPlans; // subplan pointer copied from DAG, no need to free it in scheduler int32_t levelIdx; diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 11f8e880a6..8dd7625325 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2655,6 +2655,34 @@ _return: SCH_RET(code); } +int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { + int32_t code = 0; + SSchJob *pJob = schAcquireJob(job); + if (NULL == pJob) { + qDebug("acquire job from jobRef list failed, may not started or dropped, refId:%" PRIx64, job); + SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); + } + + if (pJob->status < JOB_TASK_STATUS_NOT_START || pJob->levelNum <= 0 || NULL == pJob->levels) { + qDebug("job not initialized or not executable job, refId:%" PRIx64, job); + SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); + } + + for (int32_t i = pJob->levelNum - 1; i >= 0; --i) { + SSchLevel *pLevel = taosArrayGet(pJob->levels, i); + + for (int32_t m = 0; m < pLevel->taskNum; ++m) { + SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + SQuerySubDesc subDesc = {.tid = pTask->taskId, .status = pTask->status}; + + taosArrayPush(pSub, &subDesc); + } + } + + return TSDB_CODE_SUCCESS; +} + + int32_t scheduleCancelJob(int64_t job) { SSchJob *pJob = schAcquireJob(job); if (NULL == pJob) { @@ -2672,7 +2700,7 @@ int32_t scheduleCancelJob(int64_t job) { void schedulerFreeJob(int64_t job) { SSchJob *pJob = schAcquireJob(job); if (NULL == pJob) { - qError("acquire job from jobRef list failed, may be dropped, refId:%" PRIx64, job); + qDebug("acquire job from jobRef list failed, may be dropped, refId:%" PRIx64, job); return; } diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index a74b26a386..4477a5cacd 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -303,6 +303,21 @@ void taosArrayClear(SArray* pArray) { pArray->size = 0; } +void taosArrayClearEx(SArray* pArray, void (*fp)(void*)) { + if (pArray == NULL) return; + if (fp == NULL) { + pArray->size = 0; + return; + } + + for (int32_t i = 0; i < pArray->size; ++i) { + fp(TARRAY_GET_ELEM(pArray, i)); + } + + pArray->size = 0; +} + + void* taosArrayDestroy(SArray* pArray) { if (pArray) { taosMemoryFree(pArray->pData); From 4766deb2992b6d2bc4f388b4fdb3298ef3291015 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Apr 2022 10:48:09 +0800 Subject: [PATCH 02/60] feature/qnode --- source/dnode/mnode/impl/inc/mndPerfSchema.h | 45 +++++ source/dnode/mnode/impl/src/mndPerfSchema.c | 174 ++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 source/dnode/mnode/impl/inc/mndPerfSchema.h create mode 100644 source/dnode/mnode/impl/src/mndPerfSchema.c diff --git a/source/dnode/mnode/impl/inc/mndPerfSchema.h b/source/dnode/mnode/impl/inc/mndPerfSchema.h new file mode 100644 index 0000000000..2c613e253c --- /dev/null +++ b/source/dnode/mnode/impl/inc/mndPerfSchema.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_MND_PERF_SCHEMA_H_ +#define _TD_MND_PERF_SCHEMA_H_ + +#include "mndInt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SPerfsTableSchema { + char *name; + int32_t type; + int32_t bytes; +} SPerfsTableSchema; + +typedef struct SPerfsTableMeta { + char *name; + const SPerfsTableSchema *schema; + int32_t colNum; +} SPerfsTableMeta; + +int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp); +int32_t mndInitPerfs(SMnode *pMnode); +void mndCleanupPerfs(SMnode *pMnode); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MND_PERF_SCHEMA_H_*/ diff --git a/source/dnode/mnode/impl/src/mndPerfSchema.c b/source/dnode/mnode/impl/src/mndPerfSchema.c new file mode 100644 index 0000000000..38e9e79228 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndPerfSchema.c @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "mndPerfSchema.h" +#include "mndInt.h" + +//!!!! Note: only APPEND columns in below tables, NO insert !!!! +static const SPerfsTableSchema connectionsSchema[] = { + {.name = "conn_id", .bytes = 4, .type = TSDB_DATA_TYPE_UINT}, + {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "program", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "end_point", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "login_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, + {.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, +}; +static const SPerfsTableSchema queriesSchema[] = { + {.name = "query_id", .bytes = 4, .type = TSDB_DATA_TYPE_UBIGINT}, + {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "fqdn", .bytes = TSDB_FQDN_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "exec_time", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, + {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, + {.name = "sub_queries", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "sub_query_info", .bytes = TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, +}; + +static const SPerfsTableSchema topicSchema[] = { + {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, + {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "row_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, +}; + +static const SPerfsTableSchema consumerSchema[] = { + {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "status", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + // ep + // up time + // topics +}; + +static const SPerfsTableSchema subscribeSchema[] = { + {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY}, +}; + +static const SPerfsTableMeta perfsMeta[] = { + {TSDB_PERFS_TABLE_CONNECTIONS, connectionsSchema, tListLen(connectionsSchema)}, + {TSDB_PERFS_TABLE_QUERIES, queriesSchema, tListLen(queriesSchema)}, + {TSDB_PERFS_TABLE_TOPICS, topicSchema, tListLen(topicSchema)}, + {TSDB_PERFS_TABLE_CONSUMERS, consumerSchema, tListLen(consumerSchema)}, + {TSDB_PERFS_TABLE_SUBSCRIBES, subscribeSchema, tListLen(subscribeSchema)}, +}; + +// connection/application/ +int32_t mndInitPerfsTableSchema(const SPerfsTableSchema *pSrc, int32_t colNum, SSchema **pDst) { + SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema)); + if (NULL == schema) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int32_t i = 0; i < colNum; ++i) { + strcpy(schema[i].name, pSrc[i].name); + + schema[i].type = pSrc[i].type; + schema[i].colId = i + 1; + schema[i].bytes = pSrc[i].bytes; + } + + *pDst = schema; + return TSDB_CODE_SUCCESS; +} + +int32_t mndPerfsInitMeta(SHashObj *hash) { + STableMetaRsp meta = {0}; + + strcpy(meta.dbFName, TSDB_INFORMATION_SCHEMA_DB); + meta.tableType = TSDB_SYSTEM_TABLE; + meta.sversion = 1; + meta.tversion = 1; + + for (int32_t i = 0; i < tListLen(perfsMeta); ++i) { + strcpy(meta.tbName, perfsMeta[i].name); + meta.numOfColumns = perfsMeta[i].colNum; + + if (mndInitPerfsTableSchema(perfsMeta[i].schema, perfsMeta[i].colNum, &meta.pSchemas)) { + return -1; + } + + if (taosHashPut(hash, meta.tbName, strlen(meta.tbName), &meta, sizeof(meta))) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + + return TSDB_CODE_SUCCESS; +} + +int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) { + if (NULL == pMnode->perfsMeta) { + terrno = TSDB_CODE_MND_NOT_READY; + return -1; + } + + STableMetaRsp *meta = (STableMetaRsp *)taosHashGet(pMnode->perfsMeta, tbName, strlen(tbName)); + if (NULL == meta) { + mError("invalid performance schema table name:%s", tbName); + terrno = TSDB_CODE_MND_INVALID_INFOS_TBL; + return -1; + } + + *pRsp = *meta; + + pRsp->pSchemas = taosMemoryCalloc(meta->numOfColumns, sizeof(SSchema)); + if (pRsp->pSchemas == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + pRsp->pSchemas = NULL; + return -1; + } + + memcpy(pRsp->pSchemas, meta->pSchemas, meta->numOfColumns * sizeof(SSchema)); + + return 0; +} + +int32_t mndInitPerfs(SMnode *pMnode) { + pMnode->perfsMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + if (pMnode->perfsMeta == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + return mndPerfsInitMeta(pMnode->perfsMeta); +} + +void mndCleanupPerfs(SMnode *pMnode) { + if (NULL == pMnode->perfsMeta) { + return; + } + + void *pIter = taosHashIterate(pMnode->perfsMeta, NULL); + while (pIter) { + STableMetaRsp *meta = (STableMetaRsp *)pIter; + + taosMemoryFreeClear(meta->pSchemas); + + pIter = taosHashIterate(pMnode->perfsMeta, pIter); + } + + taosHashCleanup(pMnode->perfsMeta); + pMnode->perfsMeta = NULL; +} + From 94b5031554a6bcd11e0f1354e44b77c0c2a34cc9 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Apr 2022 10:48:26 +0800 Subject: [PATCH 03/60] feature/qnode --- include/util/tdef.h | 7 ++++++ source/client/inc/clientInt.h | 3 +-- source/dnode/mnode/impl/inc/mndInt.h | 5 ++++ source/dnode/mnode/impl/src/mndInfoSchema.c | 5 +--- source/dnode/mnode/impl/src/mndStb.c | 6 +++++ source/dnode/mnode/impl/src/mnode.c | 2 ++ source/libs/catalog/inc/catalogInt.h | 8 +++---- source/libs/catalog/src/catalog.c | 26 ++++++++++----------- tools/shell/src/shellEngine.c | 2 ++ 9 files changed, 41 insertions(+), 23 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 263c90c0f8..d66e555f8c 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -113,6 +113,13 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_INS_TABLE_BNODES "bnodes" #define TSDB_INS_TABLE_SNODES "snodes" +#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" +#define TSDB_PERFS_TABLE_CONNECTIONS "connections" +#define TSDB_PERFS_TABLE_QUERIES "queries" +#define TSDB_PERFS_TABLE_TOPICS "topics" +#define TSDB_PERFS_TABLE_CONSUMERS "consumers" +#define TSDB_PERFS_TABLE_SUBSCRIBES "subscribes" + #define TSDB_INDEX_TYPE_SMA "SMA" #define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT" diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 4ec01e5693..4e3299fd1b 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -43,8 +43,7 @@ extern "C" { } \ } while (0) -//#define HEARTBEAT_INTERVAL 1500 // ms -#define HEARTBEAT_INTERVAL 15000 // ms TODO +#define HEARTBEAT_INTERVAL 1500 // ms typedef struct SAppInstInfo SAppInstInfo; diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index ad42eebc1b..5c72e47cc4 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -38,6 +38,10 @@ extern "C" { #define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }} #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} +#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE) +#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE) +#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE) + typedef int32_t (*MndMsgFp)(SNodeMsg *pMsg); typedef int32_t (*MndInitFp)(SMnode *pMnode); typedef void (*MndCleanupFp)(SMnode *pMnode); @@ -118,6 +122,7 @@ typedef struct SMnode { STelemMgmt telemMgmt; SSyncMgmt syncMgmt; SHashObj *infosMeta; + SHashObj *perfsMeta; SGrantInfo grant; MndMsgFp msgFp[TDMT_MAX]; SMsgCb msgCb; diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index d60e7f5cf9..990f5fb70d 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -15,10 +15,7 @@ #define _DEFAULT_SOURCE #include "mndInfoSchema.h" - -#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE) -#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE) -#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE) +#include "mndInt.h" //!!!! Note: only APPEND columns in below tables, NO insert !!!! static const SInfosTableSchema dnodesSchema[] = { diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index afcea6e732..e6c5aa030b 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -18,6 +18,7 @@ #include "mndDb.h" #include "mndDnode.h" #include "mndInfoSchema.h" +#include "mndPerfSchema.h" #include "mndMnode.h" #include "mndShow.h" #include "mndTrans.h" @@ -1516,6 +1517,11 @@ static int32_t mndProcessTableMetaReq(SNodeMsg *pReq) { if (mndBuildInsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp) != 0) { goto RETRIEVE_META_OVER; } + } else if (0 == strcmp(infoReq.dbFName, TSDB_PERFORMANCE_SCHEMA_DB)) { + mDebug("performance_schema table:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName); + if (mndBuildPerfsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp) != 0) { + goto RETRIEVE_META_OVER; + } } else { mDebug("stb:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName); if (mndBuildStbSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp) != 0) { diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index 5a1780530c..7d1905a53e 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -23,6 +23,7 @@ #include "mndDnode.h" #include "mndFunc.h" #include "mndInfoSchema.h" +#include "mndPerfSchema.h" #include "mndMnode.h" #include "mndOffset.h" #include "mndProfile.h" @@ -208,6 +209,7 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { if (mndAllocStep(pMnode, "mnode-stb", mndInitStb, mndCleanupStb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-stb", mndInitSma, mndCleanupSma) != 0) return -1; if (mndAllocStep(pMnode, "mnode-infos", mndInitInfos, mndCleanupInfos) != 0) return -1; + if (mndAllocStep(pMnode, "mnode-perfs", mndInitPerfs, mndCleanupPerfs) != 0) return -1; if (mndAllocStep(pMnode, "mnode-db", mndInitDb, mndCleanupDb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-func", mndInitFunc, mndCleanupFunc) != 0) return -1; if (deploy) { diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 09f51dc03e..8938084724 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -227,20 +227,20 @@ typedef struct SCtgAction { #define CTG_FLAG_STB 0x1 #define CTG_FLAG_NOT_STB 0x2 #define CTG_FLAG_UNKNOWN_STB 0x4 -#define CTG_FLAG_INF_DB 0x8 +#define CTG_FLAG_SYS_DB 0x8 #define CTG_FLAG_FORCE_UPDATE 0x10 #define CTG_FLAG_IS_STB(_flag) ((_flag) & CTG_FLAG_STB) #define CTG_FLAG_IS_NOT_STB(_flag) ((_flag) & CTG_FLAG_NOT_STB) #define CTG_FLAG_IS_UNKNOWN_STB(_flag) ((_flag) & CTG_FLAG_UNKNOWN_STB) -#define CTG_FLAG_IS_INF_DB(_flag) ((_flag) & CTG_FLAG_INF_DB) +#define CTG_FLAG_IS_SYS_DB(_flag) ((_flag) & CTG_FLAG_SYS_DB) #define CTG_FLAG_IS_FORCE_UPDATE(_flag) ((_flag) & CTG_FLAG_FORCE_UPDATE) -#define CTG_FLAG_SET_INF_DB(_flag) ((_flag) |= CTG_FLAG_INF_DB) +#define CTG_FLAG_SET_SYS_DB(_flag) ((_flag) |= CTG_FLAG_SYS_DB) #define CTG_FLAG_SET_STB(_flag, tbType) do { (_flag) |= ((tbType) == TSDB_SUPER_TABLE) ? CTG_FLAG_STB : ((tbType) > TSDB_SUPER_TABLE ? CTG_FLAG_NOT_STB : CTG_FLAG_UNKNOWN_STB); } while (0) #define CTG_FLAG_MAKE_STB(_isStb) (((_isStb) == 1) ? CTG_FLAG_STB : ((_isStb) == 0 ? CTG_FLAG_NOT_STB : CTG_FLAG_UNKNOWN_STB)) #define CTG_FLAG_MATCH_STB(_flag, tbType) (CTG_FLAG_IS_UNKNOWN_STB(_flag) || (CTG_FLAG_IS_STB(_flag) && (tbType) == TSDB_SUPER_TABLE) || (CTG_FLAG_IS_NOT_STB(_flag) && (tbType) != TSDB_SUPER_TABLE)) -#define CTG_IS_INF_DBNAME(_dbname) ((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) +#define CTG_IS_SYS_DBNAME(_dbname) (((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || ((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB)))) #define CTG_META_SIZE(pMeta) (sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema)) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 2aa858fe06..21e0be40a4 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -217,7 +217,7 @@ int32_t ctgPushRmDBMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t dbId) } char *p = strchr(dbFName, '.'); - if (p && CTG_IS_INF_DBNAME(p + 1)) { + if (p && CTG_IS_SYS_DBNAME(p + 1)) { dbFName = p + 1; } @@ -304,7 +304,7 @@ int32_t ctgPushUpdateVgMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t d } char *p = strchr(dbFName, '.'); - if (p && CTG_IS_INF_DBNAME(p + 1)) { + if (p && CTG_IS_SYS_DBNAME(p + 1)) { dbFName = p + 1; } @@ -336,7 +336,7 @@ int32_t ctgPushUpdateTblMsgInQueue(SCatalog* pCtg, STableMetaOutput *output, boo } char *p = strchr(output->dbFName, '.'); - if (p && CTG_IS_INF_DBNAME(p + 1)) { + if (p && CTG_IS_SYS_DBNAME(p + 1)) { memmove(output->dbFName, p + 1, strlen(p + 1)); } @@ -410,7 +410,7 @@ void ctgWReleaseVgInfo(SCtgDBCache *dbCache) { int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache, bool acquire) { char *p = strchr(dbFName, '.'); - if (p && CTG_IS_INF_DBNAME(p + 1)) { + if (p && CTG_IS_SYS_DBNAME(p + 1)) { dbFName = p + 1; } @@ -688,7 +688,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable } char dbFName[TSDB_DB_FNAME_LEN] = {0}; - if (CTG_FLAG_IS_INF_DB(flag)) { + if (CTG_FLAG_IS_SYS_DB(flag)) { strcpy(dbFName, pTableName->dbname); } else { tNameGetFullDbName(pTableName, dbFName); @@ -1721,7 +1721,7 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, SVgroupInfo vgroupInfo = {0}; int32_t code = 0; - if (!CTG_FLAG_IS_INF_DB(flag)) { + if (!CTG_FLAG_IS_SYS_DB(flag)) { CTG_ERR_RET(catalogGetTableHashVgroup(pCtg, pTrans, pMgmtEps, pTableName, &vgroupInfo)); } @@ -1732,7 +1732,7 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); } - if (CTG_FLAG_IS_INF_DB(flag)) { + if (CTG_FLAG_IS_SYS_DB(flag)) { ctgDebug("will refresh tbmeta, supposed in information_schema, tbName:%s", tNameGetTableName(pTableName)); CTG_ERR_JRET(ctgGetTableMetaFromMnodeImpl(pCtg, pTrans, pMgmtEps, (char *)pTableName->dbname, (char *)pTableName->tname, output)); @@ -1820,8 +1820,8 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons uint64_t suid = 0; STableMetaOutput *output = NULL; - if (CTG_IS_INF_DBNAME(pTableName->dbname)) { - CTG_FLAG_SET_INF_DB(flag); + if (CTG_IS_SYS_DBNAME(pTableName->dbname)) { + CTG_FLAG_SET_SYS_DB(flag); } CTG_ERR_RET(ctgGetTableMetaFromCache(pCtg, pTableName, pTableMeta, &inCache, flag, &dbId)); @@ -1829,7 +1829,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons int32_t tbType = 0; if (inCache) { - if (CTG_FLAG_MATCH_STB(flag, (*pTableMeta)->tableType) && ((!CTG_FLAG_IS_FORCE_UPDATE(flag)) || (CTG_FLAG_IS_INF_DB(flag)))) { + if (CTG_FLAG_MATCH_STB(flag, (*pTableMeta)->tableType) && ((!CTG_FLAG_IS_FORCE_UPDATE(flag)) || (CTG_FLAG_IS_SYS_DB(flag)))) { goto _return; } @@ -1885,7 +1885,7 @@ _return: if (CTG_TABLE_NOT_EXIST(code) && inCache) { char dbFName[TSDB_DB_FNAME_LEN] = {0}; - if (CTG_FLAG_IS_INF_DB(flag)) { + if (CTG_FLAG_IS_SYS_DB(flag)) { strcpy(dbFName, pTableName->dbname); } else { tNameGetFullDbName(pTableName, dbFName); @@ -2633,7 +2633,7 @@ int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } - if (CTG_IS_INF_DBNAME(pTableName->dbname)) { + if (CTG_IS_SYS_DBNAME(pTableName->dbname)) { ctgError("no valid vgInfo for db, dbname:%s", pTableName->dbname); CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } @@ -2666,7 +2666,7 @@ _return: int32_t catalogGetTableHashVgroup(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName, SVgroupInfo *pVgroup) { CTG_API_ENTER(); - if (CTG_IS_INF_DBNAME(pTableName->dbname)) { + if (CTG_IS_SYS_DBNAME(pTableName->dbname)) { ctgError("no valid vgInfo for db, dbname:%s", pTableName->dbname); CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index b89d517ad3..d883362636 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -344,6 +344,8 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { atomic_store_64(&result, 0); freeResultWithRid(oresult); + taos_free_result(pSql); + return; } From d57ecd97b0d61130240661ffa8285e44a9527301 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Apr 2022 17:52:26 +0800 Subject: [PATCH 04/60] stmt --- source/client/inc/clientStmt.h | 48 ++++++++ source/client/src/clientMain.c | 179 ++++++++++++++++++++--------- source/client/src/clientStmt.c | 6 + source/libs/parser/src/parInsert.c | 19 ++- 4 files changed, 196 insertions(+), 56 deletions(-) create mode 100644 source/client/inc/clientStmt.h create mode 100644 source/client/src/clientStmt.c diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h new file mode 100644 index 0000000000..e358ce37aa --- /dev/null +++ b/source/client/inc/clientStmt.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_CLIENTSTMT_H +#define TDENGINE_CLIENTSTMT_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + STMT_TYPE_INSERT = 1, + STMT_TYPE_MULTI_INSERT, + STMT_TYPE_QUERY, +} STMT_TYPE; + +typedef struct STscStmt { + STMT_TYPE type; + int16_t last; + STscObj* taos; + SSqlObj* pSql; + SMultiTbStmt mtb; + SNormalStmt normal; + + int numOfRows; +} STscStmt; + +#define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) +#define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) +#define SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) + +#ifdef __cplusplus +} +#endif + +#endif // TDENGINE_CLIENTSTMT_H diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 2f5c1b69a4..e9d1ca0d24 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -559,76 +559,149 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { } TAOS_STMT *taos_stmt_init(TAOS *taos) { - // TODO - return NULL; + if (taos == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } + + return stmtInit(taos); } int taos_stmt_close(TAOS_STMT *stmt) { - // TODO - return -1; + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtClose(stmt); } int taos_stmt_execute(TAOS_STMT *stmt) { - // TODO - return -1; + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtExec(stmt); } char *taos_stmt_errstr(TAOS_STMT *stmt) { - // TODO - return NULL; + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } + + return stmtErrstr(stmt); } int taos_stmt_affected_rows(TAOS_STMT *stmt) { - // TODO - return -1; + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return 0; + } + + return stmtAffectedRows(stmt); } +int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) { + if (stmt == NULL || bind == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtBind(stmt, bind); +} + +int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) { + if (stmt == NULL || sql == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtPrepare(stmt, sql, length); +} + +int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags) { + if (stmt == NULL || name == NULL || tags == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtSetTbNameTags(stmt, name, tags); +} + +int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) { + if (stmt == NULL || name == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtSetTbNameTags(stmt, name, NULL); +} + +int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { + if (stmt == NULL || insert == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtIsInsert(stmt, insert); +} + +int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { + if (stmt == NULL || nums == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtGetParamNum(stmt, nums); +} + +int taos_stmt_add_batch(TAOS_STMT *stmt) { + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtAddBatch(stmt); +} + +TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) { + if (stmt == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtUseResult(stmt); +} + +int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { + if (stmt == NULL || bind == NULL) { + tscError("NULL parameter for %s", __FUNC__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtBindBatch(stmt, bind); +} + + TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) { // TODO return NULL; } -int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) { - // TODO - return -1; -} -int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) { - // TODO - return -1; -} - -int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags) { - // TODO - return -1; -} - -int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) { - // TODO - return -1; -} - -int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { - // TODO - return -1; -} - -int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { - // TODO - return -1; -} - -int taos_stmt_add_batch(TAOS_STMT *stmt) { - // TODO - return -1; -} - -TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) { - // TODO - return NULL; -} - -int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { - // TODO - return -1; -} diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c new file mode 100644 index 0000000000..8ac7a8238d --- /dev/null +++ b/source/client/src/clientStmt.c @@ -0,0 +1,6 @@ + +#include "clientInt.h" +#include "clientLog.h" +#include "tdef.h" + + diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 435ab317e6..9a0483cd33 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -223,11 +223,15 @@ static int32_t createSName(SName* pName, SToken* pTableName, SParseContext* pPar return code; } -static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) { +static int32_t getTableMetaImpl(SInsertParseContext* pCxt, SToken* pTname, bool isStb) { SParseContext* pBasicCtx = pCxt->pComCxt; SName name = {0}; createSName(&name, pTname, pBasicCtx, &pCxt->msg); - CHECK_CODE(catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &pCxt->pTableMeta)); + if (isStb) { + CHECK_CODE(catalogGetSTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &pCxt->pTableMeta)); + } else { + CHECK_CODE(catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &pCxt->pTableMeta)); + } SVgroupInfo vg; CHECK_CODE(catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg)); CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg))); @@ -235,6 +239,15 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) { return TSDB_CODE_SUCCESS; } +static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) { + return getTableMetaImpl(pCxt, pTname, false); +} + +static int32_t getSTableMeta(SInsertParseContext* pCxt, SToken* pTname) { + return getTableMetaImpl(pCxt, pTname, true); +} + + static int32_t findCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchema) { while (start < end) { if (strlen(pSchema[start].name) == pColname->n && strncmp(pColname->z, pSchema[start].name, pColname->n) == 0) { @@ -811,7 +824,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken) SToken sToken; // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) NEXT_TOKEN(pCxt->pSql, sToken); - CHECK_CODE(getTableMeta(pCxt, &sToken)); + CHECK_CODE(getSTableMeta(pCxt, &sToken)); if (TSDB_SUPER_TABLE != pCxt->pTableMeta->tableType) { return buildInvalidOperationMsg(&pCxt->msg, "create table only from super table is allowed"); } From 3bc9550233db0700caa30b1eb861894341736444 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Apr 2022 19:33:07 +0800 Subject: [PATCH 05/60] feature/qnode --- source/client/src/clientEnv.c | 9 +---- source/client/src/clientImpl.c | 7 ++++ source/client/src/clientStmt.c | 49 ++++++++++++++++++++++++++ source/libs/nodes/src/nodesUtilFuncs.c | 2 +- 4 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 source/client/src/clientStmt.c diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 20a3b5c549..7f413bdabc 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -189,14 +189,7 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty tsem_init(&pRequest->body.rspSem, 0, 0); registerRequest(pRequest); - - if (taosHashPut(pObj->pRequests, &pRequest->self, sizeof(pRequest->self), &pRequest->self, sizeof(pRequest->self))) { - destroyRequest(pRequest); - releaseTscObj(pObj->id); - terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; - return NULL; - } - + return pRequest; } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c22ed0bd60..0252dfe634 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -132,6 +132,13 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj* (*pRequest)->sqlstr[sqlLen] = 0; (*pRequest)->sqlLen = sqlLen; + if (taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, sizeof((*pRequest)->self))) { + destroyRequest(*pRequest); + *pRequest = NULL; + tscError("put request to request hash failed"); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + tscDebugL("0x%" PRIx64 " SQL: %s, reqId:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c new file mode 100644 index 0000000000..c371375bdd --- /dev/null +++ b/source/client/src/clientStmt.c @@ -0,0 +1,49 @@ + +#include "clientInt.h" +#include "clientLog.h" +#include "tdef.h" + +TAOS_STMT *stmtInit(TAOS *taos) { + STscObj* pObj = (STscObj*)taos; + STscStmt* pStmt = NULL; + +#if 0 + pStmt = taosMemoryCalloc(1, sizeof(STscStmt)); + if (pStmt == NULL) { + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + tscError("failed to allocate memory for statement"); + return NULL; + } + pStmt->taos = pObj; + + SSqlObj* pSql = calloc(1, sizeof(SSqlObj)); + + if (pSql == NULL) { + free(pStmt); + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + tscError("failed to allocate memory for statement"); + return NULL; + } + + if (TSDB_CODE_SUCCESS != tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { + free(pSql); + free(pStmt); + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + tscError("failed to malloc payload buffer"); + return NULL; + } + + tsem_init(&pSql->rspSem, 0, 0); + pSql->signature = pSql; + pSql->pTscObj = pObj; + pSql->maxRetry = TSDB_MAX_REPLICA; + pStmt->pSql = pSql; + pStmt->last = STMT_INIT; + pStmt->numOfRows = 0; + registerSqlObj(pSql); +#endif + + return pStmt; +} + + diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 1c565ddd37..772aa71eb2 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1202,7 +1202,7 @@ void valueNodeToVariant(const SValueNode* pNode, SVariant* pVal) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: - pVal->pz = pNode->datum.p; + pVal->pz = pNode->datum.p + VARSTR_HEADER_SIZE; break; case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_DECIMAL: From a823535f277cc9f32fc63ccae92ecd59f02cc282 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 13 Apr 2022 19:57:21 +0800 Subject: [PATCH 06/60] stmt --- source/client/inc/clientStmt.h | 33 ++++++++++++++++------ source/client/src/clientMain.c | 31 +++++++++++---------- source/client/src/clientStmt.c | 51 ++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 24 deletions(-) diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h index e358ce37aa..c29361758d 100644 --- a/source/client/inc/clientStmt.h +++ b/source/client/inc/clientStmt.h @@ -28,18 +28,33 @@ typedef enum { typedef struct STscStmt { STMT_TYPE type; - int16_t last; - STscObj* taos; - SSqlObj* pSql; - SMultiTbStmt mtb; - SNormalStmt normal; + //int16_t last; + //STscObj* taos; + //SSqlObj* pSql; + //SMultiTbStmt mtb; + //SNormalStmt normal; - int numOfRows; + //int numOfRows; } STscStmt; -#define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) -#define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) -#define SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) +#define STMT_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) +#define STMT_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) +#define STMT_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) + +TAOS_STMT *stmtInit(TAOS *taos); +int stmtClose(TAOS_STMT *stmt); +int stmtExec(TAOS_STMT *stmt); +char *stmtErrstr(TAOS_STMT *stmt); +int stmtAffectedRows(TAOS_STMT *stmt); +int stmtBind(TAOS_STMT *stmt, TAOS_BIND *bind); +int stmtPrepare(TAOS_STMT *stmt, const char *sql, unsigned long length); +int stmtSetTbNameTags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags); +int stmtIsInsert(TAOS_STMT *stmt, int *insert); +int stmtGetParamNum(TAOS_STMT *stmt, int *nums); +int stmtAddBatch(TAOS_STMT *stmt); +TAOS_RES *stmtUseResult(TAOS_STMT *stmt); +int stmtBindBatch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind); + #ifdef __cplusplus } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e9d1ca0d24..84f9c7ac30 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -16,6 +16,7 @@ #include "catalog.h" #include "scheduler.h" #include "clientInt.h" +#include "clientStmt.h" #include "clientLog.h" #include "os.h" #include "query.h" @@ -560,7 +561,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { TAOS_STMT *taos_stmt_init(TAOS *taos) { if (taos == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -570,7 +571,7 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) { int taos_stmt_close(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -580,7 +581,7 @@ int taos_stmt_close(TAOS_STMT *stmt) { int taos_stmt_execute(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -590,7 +591,7 @@ int taos_stmt_execute(TAOS_STMT *stmt) { char *taos_stmt_errstr(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -600,7 +601,7 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) { int taos_stmt_affected_rows(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return 0; } @@ -610,7 +611,7 @@ int taos_stmt_affected_rows(TAOS_STMT *stmt) { int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) { if (stmt == NULL || bind == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -620,7 +621,7 @@ int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind) { int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) { if (stmt == NULL || sql == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -630,7 +631,7 @@ int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length) { int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags) { if (stmt == NULL || name == NULL || tags == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -640,7 +641,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) { if (stmt == NULL || name == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -650,7 +651,7 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) { int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { if (stmt == NULL || insert == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -660,7 +661,7 @@ int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { if (stmt == NULL || nums == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -670,7 +671,7 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { int taos_stmt_add_batch(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -680,9 +681,9 @@ int taos_stmt_add_batch(TAOS_STMT *stmt) { TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) { if (stmt == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; - return terrno; + return NULL; } return stmtUseResult(stmt); @@ -690,7 +691,7 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt) { int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { if (stmt == NULL || bind == NULL) { - tscError("NULL parameter for %s", __FUNC__); + tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 2d8a489381..8c4cff9251 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -1,6 +1,7 @@ #include "clientInt.h" #include "clientLog.h" +#include "clientStmt.h" #include "tdef.h" TAOS_STMT *stmtInit(TAOS *taos) { @@ -46,3 +47,53 @@ TAOS_STMT *stmtInit(TAOS *taos) { return pStmt; } +int stmtClose(TAOS_STMT *stmt) { + return TSDB_CODE_SUCCESS; +} + +int stmtExec(TAOS_STMT *stmt) { + return TSDB_CODE_SUCCESS; +} + +char *stmtErrstr(TAOS_STMT *stmt) { + return NULL; +} + +int stmtAffectedRows(TAOS_STMT *stmt) { + return TSDB_CODE_SUCCESS; +} + +int stmtBind(TAOS_STMT *stmt, TAOS_BIND *bind) { + return TSDB_CODE_SUCCESS; +} + +int stmtPrepare(TAOS_STMT *stmt, const char *sql, unsigned long length) { + return TSDB_CODE_SUCCESS; +} + +int stmtSetTbNameTags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags) { + return TSDB_CODE_SUCCESS; +} + +int stmtIsInsert(TAOS_STMT *stmt, int *insert) { + return TSDB_CODE_SUCCESS; +} + +int stmtGetParamNum(TAOS_STMT *stmt, int *nums) { + return TSDB_CODE_SUCCESS; +} + +int stmtAddBatch(TAOS_STMT *stmt) { + return TSDB_CODE_SUCCESS; +} + +TAOS_RES *stmtUseResult(TAOS_STMT *stmt) { + return NULL; +} + +int stmtBindBatch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { + return TSDB_CODE_SUCCESS; +} + + + From d90dbe6c6e51be05d3e9ea8e90d9cadfa2311d6a Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 14 Apr 2022 11:48:59 +0800 Subject: [PATCH 07/60] disable hb --- source/client/src/clientHb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 642ba46336..4f716ba431 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -648,7 +648,7 @@ int hbMgrInit() { hbMgrInitHandle(); // init backgroud thread - hbCreateThread(); + //hbCreateThread(); return 0; } From 7d92aaaad3dfac5e04fb9baad6938b5b796218d1 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 14 Apr 2022 15:28:43 +0800 Subject: [PATCH 08/60] feature/qnode --- source/dnode/mnode/impl/src/mndProfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index be2c311dbf..2055512e82 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -898,6 +898,7 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i } pShow->numOfRows += numOfRows; +#endif return numOfRows; } From 21a5e4f9b9ffdf80b926d820a15e172468a11bad Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 14 Apr 2022 19:54:59 +0800 Subject: [PATCH 09/60] fix hb issue --- include/common/tmsg.h | 18 +++++++------- source/client/inc/clientInt.h | 11 +++------ source/client/src/clientEnv.c | 2 +- source/client/src/clientHb.c | 24 +++++++++---------- source/common/src/tmsg.c | 3 +-- source/dnode/mnode/impl/src/mndProfile.c | 6 ++--- .../dnode/mnode/impl/test/profile/profile.cpp | 2 +- 7 files changed, 29 insertions(+), 37 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ea7905f21a..ee81ed2042 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -70,13 +70,11 @@ typedef uint16_t tmsg_t; #define TSDB_IE_TYPE_DNODE_EXT 6 #define TSDB_IE_TYPE_DNODE_STATE 7 -typedef enum { - HEARTBEAT_TYPE_MQ = 0, - HEARTBEAT_TYPE_QUERY, - // types can be added here - // - HEARTBEAT_TYPE_MAX -} EHbType; +enum { + CONN_TYPE__QUERY = 1, + CONN_TYPE__TMQ, + CONN_TYPE__MAX +}; enum { HEARTBEAT_KEY_DBINFO = 1, @@ -1649,7 +1647,7 @@ typedef struct { typedef struct { int64_t tscRid; - int32_t hbType; + int8_t connType; } SClientHbKey; typedef struct { @@ -1796,13 +1794,13 @@ static FORCE_INLINE int32_t tDecodeSKv(SCoder* pDecoder, SKv* pKv) { static FORCE_INLINE int32_t tEncodeSClientHbKey(SCoder* pEncoder, const SClientHbKey* pKey) { if (tEncodeI64(pEncoder, pKey->tscRid) < 0) return -1; - if (tEncodeI32(pEncoder, pKey->hbType) < 0) return -1; + if (tEncodeI8(pEncoder, pKey->connType) < 0) return -1; return 0; } static FORCE_INLINE int32_t tDecodeSClientHbKey(SCoder* pDecoder, SClientHbKey* pKey) { if (tDecodeI64(pDecoder, &pKey->tscRid) < 0) return -1; - if (tDecodeI32(pDecoder, &pKey->hbType) < 0) return -1; + if (tDecodeI8(pDecoder, &pKey->connType) < 0) return -1; return 0; } diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 61a3303c3f..79d6b2fdf1 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -45,11 +45,6 @@ extern "C" { #define HEARTBEAT_INTERVAL 1500 // ms -enum { - CONN_TYPE__QUERY = 1, - CONN_TYPE__TMQ, -}; - typedef struct SAppInstInfo SAppInstInfo; typedef struct { @@ -84,8 +79,8 @@ typedef struct { TdThread thread; TdThreadMutex lock; // used when app init and cleanup SArray* appHbMgrs; // SArray one for each cluster - FHbReqHandle reqHandle[HEARTBEAT_TYPE_MAX]; - FHbRspHandle rspHandle[HEARTBEAT_TYPE_MAX]; + FHbReqHandle reqHandle[CONN_TYPE__MAX]; + FHbRspHandle rspHandle[CONN_TYPE__MAX]; } SClientHbMgr; typedef struct SQueryExecMetric { @@ -307,7 +302,7 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key); void appHbMgrCleanup(void); // conn level -int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int32_t hbType); +int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType); void hbDeregisterConn(SAppHbMgr* pAppHbMgr, SClientHbKey connKey); int hbAddConnInfo(SAppHbMgr* pAppHbMgr, SClientHbKey connKey, void* key, void* value, int32_t keyLen, int32_t valueLen); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 7f413bdabc..969b18f067 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -122,7 +122,7 @@ void closeAllRequests(SHashObj *pRequests) { void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; - SClientHbKey connKey = {.tscRid = pTscObj->id, .hbType = pTscObj->connType}; + SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey); atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); closeAllRequests(pTscObj->pRequests); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 4bd8a89a38..e65a3017d6 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -110,7 +110,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { SHbConnInfo *info = taosHashGet(pAppHbMgr->connInfo, &pRsp->connKey, sizeof(SClientHbKey)); if (NULL == info) { - tscWarn("fail to get connInfo, may be dropped, refId:%" PRIx64 ", type:%d", pRsp->connKey.tscRid, pRsp->connKey.hbType); + tscWarn("fail to get connInfo, may be dropped, refId:%" PRIx64 ", type:%d", pRsp->connKey.tscRid, pRsp->connKey.connType); return TSDB_CODE_SUCCESS; } @@ -224,7 +224,7 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) for (int32_t i = 0; i < rspNum; ++i) { SClientHbRsp *rsp = taosArrayGet(pRsp.rsps, i); - code = (*clientHbMgr.rspHandle[rsp->connKey.hbType])((*pInst)->pAppHbMgr, rsp); + code = (*clientHbMgr.rspHandle[rsp->connKey.connType])((*pInst)->pAppHbMgr, rsp); if (code) { break; } @@ -420,11 +420,11 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req } void hbMgrInitMqHbHandle() { - clientHbMgr.reqHandle[HEARTBEAT_TYPE_QUERY] = hbQueryHbReqHandle; - clientHbMgr.reqHandle[HEARTBEAT_TYPE_MQ] = hbMqHbReqHandle; + clientHbMgr.reqHandle[CONN_TYPE__QUERY] = hbQueryHbReqHandle; + clientHbMgr.reqHandle[CONN_TYPE__TMQ] = hbMqHbReqHandle; - clientHbMgr.rspHandle[HEARTBEAT_TYPE_QUERY] = hbQueryHbRspHandle; - clientHbMgr.rspHandle[HEARTBEAT_TYPE_MQ] = hbMqHbRspHandle; + clientHbMgr.rspHandle[CONN_TYPE__QUERY] = hbQueryHbRspHandle; + clientHbMgr.rspHandle[CONN_TYPE__TMQ] = hbMqHbRspHandle; } static FORCE_INLINE void hbMgrInitHandle() { @@ -458,7 +458,7 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { SHbConnInfo *info = taosHashGet(pAppHbMgr->connInfo, &pOneReq->connKey, sizeof(SClientHbKey)); if (info) { - code = (*clientHbMgr.reqHandle[pOneReq->connKey.hbType])(&pOneReq->connKey, info->param, pOneReq); + code = (*clientHbMgr.reqHandle[pOneReq->connKey.connType])(&pOneReq->connKey, info->param, pOneReq); if (code) { pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); continue; @@ -692,22 +692,22 @@ int hbRegisterConnImpl(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, SHbConnInfo * return 0; } -int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int32_t hbType) { +int hbRegisterConn(SAppHbMgr *pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType) { SClientHbKey connKey = { .tscRid = tscRefId, - .hbType = hbType, + .connType = connType, }; SHbConnInfo info = {0}; - switch (hbType) { - case HEARTBEAT_TYPE_QUERY: { + switch (connType) { + case CONN_TYPE__QUERY: { int64_t *pClusterId = taosMemoryMalloc(sizeof(int64_t)); *pClusterId = clusterId; info.param = pClusterId; return hbRegisterConnImpl(pAppHbMgr, connKey, &info); } - case HEARTBEAT_TYPE_MQ: { + case CONN_TYPE__TMQ: { return 0; } default: diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a9a28b4879..d78d89ab50 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3424,5 +3424,4 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { taosMemoryFreeClear(pReq->sql); - taosMemoryFreeClear(pReq->ast); -} + taosMemoryFreeClear(pReq->ast) \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 96698e80bb..f169fb4b21 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -343,7 +343,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb SConnObj *pConn = mndAcquireConn(pMnode, pBasic->connId); if (pConn == NULL) { - pConn = mndCreateConn(pMnode, connInfo.user, connInfo.clientIp, connInfo.clientPort, pBasic->pid, pBasic->app, 0); + pConn = mndCreateConn(pMnode, connInfo.user, CONN_TYPE__QUERY, connInfo.clientIp, connInfo.clientPort, pBasic->pid, pBasic->app, 0); if (pConn == NULL) { mError("user:%s, conn:%u is freed and failed to create new since %s", connInfo.user, pBasic->connId, terrstr()); return -1; @@ -451,9 +451,9 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { int32_t sz = taosArrayGetSize(batchReq.reqs); for (int i = 0; i < sz; i++) { SClientHbReq *pHbReq = taosArrayGet(batchReq.reqs, i); - if (pHbReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { + if (pHbReq->connKey.connType == CONN_TYPE__QUERY) { mndProcessQueryHeartBeat(pMnode, &pReq->rpcMsg, pHbReq, &batchRsp); - } else if (pHbReq->connKey.hbType == HEARTBEAT_TYPE_MQ) { + } else if (pHbReq->connKey.connType == CONN_TYPE__TMQ) { SClientHbRsp *pRsp = mndMqHbBuildRsp(pMnode, pHbReq); if (pRsp != NULL) { taosArrayPush(batchRsp.rsps, pRsp); diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 14b31e5282..b06c98466b 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -99,7 +99,7 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) { SClientHbBatchReq batchReq = {0}; batchReq.reqs = taosArrayInit(0, sizeof(SClientHbReq)); SClientHbReq req = {0}; - req.connKey = {.connId = 123, .hbType = HEARTBEAT_TYPE_MQ}; + req.connKey = {.connId = 123, .hbType = CONN_TYPE__TMQ}; req.info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); SKv kv = {0}; kv.key = 123; From 6dae667c1d16e2e4024602ef511afab425ef02dd Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 14 Apr 2022 20:13:11 +0800 Subject: [PATCH 10/60] fix hb issue --- source/common/src/tmsg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d78d89ab50..99f173501b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -134,7 +134,7 @@ void *taosDecodeSEpSet(void *buf, SEpSet *pEp) { static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq) { if (tEncodeSClientHbKey(pEncoder, &pReq->connKey) < 0) return -1; - if (pReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { + if (pReq->connKey.connType == CONN_TYPE__QUERY) { int32_t queryNum = 0; if (pReq->query) { queryNum = 1; @@ -185,7 +185,7 @@ static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq static int32_t tDeserializeSClientHbReq(SCoder *pDecoder, SClientHbReq *pReq) { if (tDecodeSClientHbKey(pDecoder, &pReq->connKey) < 0) return -1; - if (pReq->connKey.hbType == HEARTBEAT_TYPE_QUERY) { + if (pReq->connKey.connType == CONN_TYPE__QUERY) { int32_t queryNum = 0; if (tDecodeI32(pDecoder, &queryNum) < 0) return -1; if (queryNum) { @@ -3424,4 +3424,5 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { taosMemoryFreeClear(pReq->sql); - taosMemoryFreeClear(pReq->ast) \ No newline at end of file + taosMemoryFreeClear(pReq->ast); +} From e048acfe76a734449b9141b40d5faa360d00a905 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 14 Apr 2022 12:36:35 +0000 Subject: [PATCH 11/60] refact vnode --- source/dnode/vnode/CMakeLists.txt | 2 +- source/dnode/vnode/inc/vnode.h | 3 ++- .../src/vnd/{vnodeMain.c => vnodeOpen.c} | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) rename source/dnode/vnode/src/vnd/{vnodeMain.c => vnodeOpen.c} (86%) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 3ab007e3a2..f7a3f2f109 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -10,7 +10,7 @@ target_sources( "src/vnd/vnodeCfg.c" "src/vnd/vnodeCommit.c" "src/vnd/vnodeInt.c" - "src/vnd/vnodeMain.c" + "src/vnd/vnodeOpen.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" "src/vnd/vnodeWrite.c" diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 76fc09ca1d..0b23a42ec9 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -44,9 +44,10 @@ typedef struct SVnodeCfg SVnodeCfg; int vnodeInit(); void vnodeCleanup(); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs); +void vnodeDestroy(const char *path); SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg); void vnodeClose(SVnode *pVnode); -void vnodeDestroy(const char *path); void vnodePreprocessWriteReqs(SVnode *pVnode, SArray *pMsgs); int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); diff --git a/source/dnode/vnode/src/vnd/vnodeMain.c b/source/dnode/vnode/src/vnd/vnodeOpen.c similarity index 86% rename from source/dnode/vnode/src/vnd/vnodeMain.c rename to source/dnode/vnode/src/vnd/vnodeOpen.c index 2fd848a39d..f208857762 100644 --- a/source/dnode/vnode/src/vnd/vnodeMain.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -20,6 +20,29 @@ static void vnodeFree(SVnode *pVnode); static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { +#if 0 + char dir[TSDB_FILENAME_LEN]; + // TODO: check if directory exists + + // check config + if (vnodeCheckCfg(pCfg) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + + // create vnode env + tfsMkdir(pTfs, path); + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + if (vnodeSaveCfg(dir, pCfg) < 0) { + vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + +#endif + return 0; +} + SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { SVnode *pVnode = NULL; From 2b6c03bc24e147a25c58a1e39f127e2419516497 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 14 Apr 2022 12:44:25 +0000 Subject: [PATCH 12/60] more --- source/dnode/vnode/inc/vnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 0b23a42ec9..25c6ffc1ad 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -42,7 +42,7 @@ typedef struct STsdbCfg STsdbCfg; // todo: remove typedef struct STqCfg STqCfg; // todo: remove typedef struct SVnodeCfg SVnodeCfg; -int vnodeInit(); +int vnodeInit(int nthreads); void vnodeCleanup(); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs); void vnodeDestroy(const char *path); From 688f2584dcb9fdfbd4c141d704d19588f18da1c7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Apr 2022 21:27:10 +0800 Subject: [PATCH 13/60] fix(cluster): unable to start taosd when using SANITIZER --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 2ab8af31b1..9226e9aa37 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -495,7 +495,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsRpcTimer = cfgGetItem(pCfg, "rpcTimer")->i32; tsRpcMaxTime = cfgGetItem(pCfg, "rpcMaxTime")->i32; tsRpcForceTcp = cfgGetItem(pCfg, "rpcForceTcp")->i32; - tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->bval; + tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32; tsCompressMsgSize = cfgGetItem(pCfg, "compressMsgSize")->i32; tsCompressColData = cfgGetItem(pCfg, "compressColData")->i32; tsMaxWildCardsLen = cfgGetItem(pCfg, "maxWildCardsLength")->i32; From ca3ce404af8c2c2e090353e5dd94ea33ace84b7a Mon Sep 17 00:00:00 2001 From: Ganlin Zhao <36554565+glzhao89@users.noreply.github.com> Date: Wed, 13 Apr 2022 12:38:57 +0800 Subject: [PATCH 14/60] feat(query): support now()/today() function in select clause TD-14243 --- include/libs/scalar/scalar.h | 2 + source/libs/function/src/builtins.c | 33 +- source/libs/parser/inc/parAst.h | 1 + source/libs/parser/inc/sql.y | 7 +- source/libs/parser/src/parAstCreater.c | 33 + source/libs/parser/src/sql.c | 2037 ++++++++++++------------ source/libs/scalar/src/sclfunc.c | 16 + 7 files changed, 1102 insertions(+), 1027 deletions(-) diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 10b4866a96..49af10cd2c 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -78,6 +78,8 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t todayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); bool getTimePseudoFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 27067fc966..5480e48cdf 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -433,6 +433,26 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = timeDiffFunction, .finalizeFunc = NULL }, + { + .name = "now", + .type = FUNCTION_TYPE_NOW, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = nowFunction, + .finalizeFunc = NULL + }, + { + .name = "today", + .type = FUNCTION_TYPE_TODAY, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = todayFunction, + .finalizeFunc = NULL + }, { .name = "_rowts", .type = FUNCTION_TYPE_ROWTS, @@ -503,16 +523,6 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = winDurFunction, .finalizeFunc = NULL }, - { - .name = "now", - .type = FUNCTION_TYPE_NOW, - .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, - .checkFunc = checkAndGetResultType, - .getEnvFunc = getTimePseudoFuncEnv, - .initFunc = NULL, - .sprocessFunc = winDurFunction, - .finalizeFunc = NULL - } }; const int32_t funcMgtBuiltinsNum = (sizeof(funcMgtBuiltins) / sizeof(SBuiltinFuncDefinition)); @@ -672,7 +682,8 @@ int32_t checkAndGetResultType(SFunctionNode* pFunc) { } case FUNCTION_TYPE_NOW: - // todo + case FUNCTION_TYPE_TODAY: + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; break; default: ASSERT(0); // to found the fault ASAP. diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index e781014216..f097631e08 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -93,6 +93,7 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); +SNode* createFunctionNodeNoParam(SAstCreateContext* pCxt, const SToken* pFuncName); SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 12ae5819b4..5301436899 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -503,6 +503,8 @@ column_name(A) ::= NK_ID(B). function_name(A) ::= NK_ID(B). { A = B; } function_name(A) ::= FIRST(B). { A = B; } function_name(A) ::= LAST(B). { A = B; } +function_name(A) ::= NOW(B). { A = B; } +function_name(A) ::= TODAY(B). { A = B; } %type table_alias { SToken } %destructor table_alias { } @@ -535,6 +537,7 @@ expression(A) ::= pseudo_column(B). expression(A) ::= column_reference(B). { A = B; } expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); } +expression(A) ::= function_name(B) NK_LP NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNodeNoParam(pCxt, &B)); } //for CAST function CAST(expr AS type_name) expression(A) ::= function_name(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { SNodeList *p = createNodeList(pCxt, releaseRawExprNode(pCxt, C)); @@ -587,8 +590,8 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +//pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +//pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index a14053ada7..cd6469c084 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -367,6 +367,39 @@ SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNod return (SNode*)func; } +SNode* createFunctionNodeNoParam(SAstCreateContext* pCxt, const SToken* pFuncName) { + SFunctionNode* func = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + CHECK_OUT_OF_MEM(func); + char buf[64] = {0}; + + int32_t dataType; + switch (pFuncName->type) { + case TK_NOW: { + int64_t ts = taosGetTimestamp(TSDB_TIME_PRECISION_MILLI); + snprintf(buf, sizeof(buf), "%"PRId64, ts); + dataType = TSDB_DATA_TYPE_BIGINT; + break; + } + case TK_TODAY: { + int64_t ts = taosGetTimestampToday(TSDB_TIME_PRECISION_MILLI); + snprintf(buf, sizeof(buf), "%"PRId64, ts); + dataType = TSDB_DATA_TYPE_BIGINT; + break; + } + //case TK_TIMEZONE: { + // strncpy(buf, tsTimezoneStr, strlen(tsTimezoneStr)); + // dataType = TSDB_DATA_TYPE_BINARY; + // break; + //} + } + SToken token = {.type = pFuncName->type, .n = strlen(buf), .z = buf}; + + SNodeList *pParameterList = createNodeList(pCxt, createValueNode(pCxt, dataType, &token)); + strncpy(func->functionName, pFuncName->z, pFuncName->n); + func->pParameterList = pParameterList; + return (SNode*)func; +} + SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList) { SNodeListNode* list = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); CHECK_OUT_OF_MEM(list); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index b1f8a24a83..a57142939a 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -133,17 +133,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYNSTATE 548 -#define YYNRULE 411 -#define YYNRULE_WITH_ACTION 411 +#define YYNRULE 412 +#define YYNRULE_WITH_ACTION 412 #define YYNTOKEN 209 #define YY_MAX_SHIFT 547 -#define YY_MIN_SHIFTREDUCE 808 -#define YY_MAX_SHIFTREDUCE 1218 -#define YY_ERROR_ACTION 1219 -#define YY_ACCEPT_ACTION 1220 -#define YY_NO_ACTION 1221 -#define YY_MIN_REDUCE 1222 -#define YY_MAX_REDUCE 1632 +#define YY_MIN_SHIFTREDUCE 809 +#define YY_MAX_SHIFTREDUCE 1220 +#define YY_ERROR_ACTION 1221 +#define YY_ACCEPT_ACTION 1222 +#define YY_NO_ACTION 1223 +#define YY_MIN_REDUCE 1224 +#define YY_MAX_REDUCE 1635 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -210,319 +210,320 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1539) +#define YY_ACTTAB_COUNT (1543) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 450, 257, 1483, 269, 25, 194, 1432, 117, 122, 1234, - /* 10 */ 312, 1331, 30, 28, 1479, 1486, 306, 1499, 1483, 1382, - /* 20 */ 266, 462, 1053, 21, 1075, 32, 31, 29, 27, 26, - /* 30 */ 1479, 1485, 23, 32, 31, 29, 27, 26, 1051, 274, - /* 40 */ 238, 1516, 32, 31, 29, 27, 26, 1611, 446, 1073, - /* 50 */ 11, 30, 28, 1161, 348, 406, 1483, 1058, 449, 266, - /* 60 */ 131, 1053, 1470, 1320, 1609, 30, 28, 434, 1479, 1485, - /* 70 */ 430, 9, 8, 266, 1, 1053, 463, 1051, 68, 1500, - /* 80 */ 1501, 1505, 1550, 540, 539, 72, 240, 1546, 1175, 11, - /* 90 */ 1499, 1051, 369, 424, 450, 100, 1058, 544, 1611, 407, - /* 100 */ 1433, 1342, 1261, 11, 32, 31, 29, 27, 26, 1052, - /* 110 */ 1058, 131, 348, 1, 1516, 1609, 32, 31, 29, 27, - /* 120 */ 26, 433, 118, 1389, 384, 277, 1300, 1, 98, 256, - /* 130 */ 1611, 449, 1423, 1425, 1387, 1470, 544, 432, 127, 1557, - /* 140 */ 1558, 270, 1562, 131, 498, 1137, 1054, 1609, 1052, 115, - /* 150 */ 544, 69, 1500, 1501, 1505, 1550, 845, 1344, 844, 259, - /* 160 */ 1546, 126, 1052, 1057, 1077, 1078, 1104, 1105, 1106, 1107, - /* 170 */ 1108, 1109, 1110, 1111, 1112, 164, 846, 381, 380, 372, - /* 180 */ 1578, 462, 1564, 1220, 84, 1054, 132, 83, 82, 81, - /* 190 */ 80, 79, 78, 77, 76, 75, 29, 27, 26, 1054, - /* 200 */ 1561, 374, 1057, 1077, 1078, 1104, 1105, 1106, 1107, 1108, - /* 210 */ 1109, 1110, 1111, 1112, 1319, 132, 1057, 1077, 1078, 1104, - /* 220 */ 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1318, 30, - /* 230 */ 28, 547, 305, 1564, 304, 12, 282, 266, 383, 1053, - /* 240 */ 377, 896, 132, 1215, 382, 213, 462, 97, 95, 378, - /* 250 */ 376, 1560, 379, 115, 536, 1051, 532, 528, 524, 212, - /* 260 */ 898, 1345, 32, 31, 29, 27, 26, 1611, 30, 28, - /* 270 */ 448, 1499, 463, 132, 1058, 209, 266, 498, 1053, 494, - /* 280 */ 131, 310, 30, 28, 1609, 66, 52, 1076, 206, 1074, - /* 290 */ 266, 7, 1053, 1333, 1051, 1516, 65, 1342, 1516, 96, - /* 300 */ 12, 496, 433, 1245, 334, 446, 463, 1337, 1051, 489, - /* 310 */ 101, 1214, 449, 1058, 544, 311, 1470, 1334, 459, 438, - /* 320 */ 493, 492, 491, 1185, 490, 1092, 1052, 1058, 513, 511, - /* 330 */ 7, 1342, 69, 1500, 1501, 1505, 1550, 423, 1470, 395, - /* 340 */ 259, 1546, 126, 1274, 7, 1222, 412, 132, 1470, 171, - /* 350 */ 141, 140, 393, 544, 190, 417, 1183, 1184, 1186, 1187, - /* 360 */ 413, 1577, 500, 1054, 1037, 1052, 168, 544, 1244, 93, - /* 370 */ 92, 91, 90, 89, 88, 87, 86, 85, 1327, 1052, - /* 380 */ 1057, 1077, 1078, 1104, 1105, 1106, 1107, 1108, 1109, 1110, - /* 390 */ 1111, 1112, 1079, 430, 1389, 383, 52, 377, 1611, 1329, - /* 400 */ 271, 382, 1054, 132, 97, 1387, 378, 376, 1243, 379, - /* 410 */ 1242, 1610, 405, 1470, 1241, 1609, 1054, 1338, 100, 1057, - /* 420 */ 1077, 1078, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, - /* 430 */ 1112, 1077, 1078, 1057, 1077, 1078, 1104, 1105, 1106, 1107, - /* 440 */ 1108, 1109, 1110, 1111, 1112, 430, 30, 28, 237, 420, - /* 450 */ 1073, 98, 439, 1470, 266, 1470, 1053, 327, 59, 1470, - /* 460 */ 339, 128, 1557, 1558, 1420, 1562, 1080, 1160, 397, 340, - /* 470 */ 100, 139, 1051, 32, 31, 29, 27, 26, 437, 1335, - /* 480 */ 934, 486, 485, 484, 938, 483, 940, 941, 482, 943, - /* 490 */ 479, 1058, 949, 476, 951, 952, 473, 470, 1223, 1611, - /* 500 */ 1569, 1156, 1564, 98, 425, 421, 9, 8, 1, 463, - /* 510 */ 189, 241, 131, 129, 1557, 1558, 1609, 1562, 319, 84, - /* 520 */ 1559, 1240, 83, 82, 81, 80, 79, 78, 77, 76, - /* 530 */ 75, 544, 216, 1325, 1342, 1372, 1092, 32, 31, 29, - /* 540 */ 27, 26, 338, 1052, 1124, 333, 332, 331, 330, 329, - /* 550 */ 1239, 326, 325, 324, 323, 322, 318, 317, 316, 315, - /* 560 */ 314, 313, 1271, 137, 116, 463, 1470, 1238, 501, 222, - /* 570 */ 1314, 1389, 1389, 6, 320, 32, 31, 29, 27, 26, - /* 580 */ 1054, 220, 1424, 1388, 175, 1168, 169, 447, 1237, 50, - /* 590 */ 1342, 1075, 49, 1125, 142, 1470, 488, 1057, 1077, 1078, - /* 600 */ 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1235, - /* 610 */ 1236, 1129, 1470, 241, 520, 519, 518, 517, 281, 1233, - /* 620 */ 516, 515, 514, 102, 509, 508, 507, 506, 505, 504, - /* 630 */ 503, 502, 108, 1470, 1232, 1499, 24, 264, 1119, 1120, - /* 640 */ 1121, 1122, 1123, 1127, 1128, 463, 1124, 463, 1231, 463, - /* 650 */ 1159, 844, 276, 463, 72, 1470, 347, 67, 1339, 1516, - /* 660 */ 115, 375, 460, 114, 1470, 279, 446, 367, 1344, 1256, - /* 670 */ 1342, 870, 1342, 115, 1342, 463, 449, 436, 1342, 1470, - /* 680 */ 1470, 1344, 1230, 1229, 461, 48, 47, 309, 1499, 136, - /* 690 */ 871, 386, 463, 1470, 303, 1125, 119, 1500, 1501, 1505, - /* 700 */ 1342, 208, 246, 297, 295, 1389, 291, 287, 133, 1301, - /* 710 */ 512, 278, 1516, 1129, 300, 1156, 1387, 1342, 299, 446, - /* 720 */ 157, 1053, 463, 155, 1499, 1228, 1227, 1470, 1470, 449, - /* 730 */ 445, 280, 132, 1470, 435, 1624, 1126, 1051, 24, 264, - /* 740 */ 1119, 1120, 1121, 1122, 1123, 1127, 1128, 1342, 1516, 69, - /* 750 */ 1500, 1501, 1505, 1550, 1130, 446, 1058, 259, 1546, 1623, - /* 760 */ 1499, 1459, 1226, 152, 1225, 449, 125, 191, 1584, 1470, - /* 770 */ 1470, 1470, 365, 343, 361, 357, 353, 151, 159, 22, - /* 780 */ 161, 158, 418, 160, 1516, 69, 1500, 1501, 1505, 1550, - /* 790 */ 1254, 446, 441, 259, 1546, 1623, 544, 289, 1217, 1218, - /* 800 */ 1383, 449, 250, 53, 1607, 1470, 149, 1470, 1052, 1470, - /* 810 */ 1499, 163, 389, 106, 162, 44, 178, 409, 404, 1182, - /* 820 */ 180, 69, 1500, 1501, 1505, 1550, 1490, 184, 164, 259, - /* 830 */ 1546, 1623, 372, 366, 1516, 33, 1580, 1499, 1488, 1131, - /* 840 */ 1568, 446, 431, 1116, 251, 1054, 249, 248, 1061, 371, - /* 850 */ 1517, 449, 1499, 33, 374, 1470, 193, 1088, 1073, 1060, - /* 860 */ 434, 1516, 1057, 148, 2, 121, 33, 145, 446, 284, - /* 870 */ 1020, 228, 1500, 1501, 1505, 288, 1516, 197, 449, 1499, - /* 880 */ 245, 199, 1470, 446, 143, 94, 273, 272, 104, 455, - /* 890 */ 896, 1611, 205, 449, 247, 1029, 1066, 1470, 70, 1500, - /* 900 */ 1501, 1505, 1550, 1516, 131, 321, 1549, 1546, 1609, 214, - /* 910 */ 446, 1422, 1059, 70, 1500, 1501, 1505, 1550, 64, 1064, - /* 920 */ 449, 444, 1546, 430, 1470, 106, 328, 442, 61, 927, - /* 930 */ 1063, 1058, 44, 468, 104, 138, 922, 955, 959, 336, - /* 940 */ 70, 1500, 1501, 1505, 1550, 335, 105, 337, 100, 1547, - /* 950 */ 965, 1084, 341, 106, 104, 1499, 342, 964, 107, 1083, - /* 960 */ 144, 345, 344, 1082, 346, 349, 147, 434, 51, 150, - /* 970 */ 1081, 464, 368, 370, 1332, 154, 373, 1328, 74, 1516, - /* 980 */ 399, 98, 1499, 1062, 400, 401, 446, 255, 408, 156, - /* 990 */ 1499, 187, 1557, 429, 170, 428, 449, 173, 1611, 109, - /* 1000 */ 1470, 110, 1330, 265, 1326, 111, 1516, 112, 1080, 411, - /* 1010 */ 419, 131, 1591, 446, 1516, 1609, 229, 1500, 1501, 1505, - /* 1020 */ 1067, 446, 398, 449, 410, 453, 1058, 1470, 1581, 416, - /* 1030 */ 414, 449, 176, 179, 1499, 1470, 5, 1070, 1590, 415, - /* 1040 */ 258, 422, 427, 233, 1500, 1501, 1505, 4, 99, 1079, - /* 1050 */ 1571, 232, 1500, 1501, 1505, 185, 183, 1156, 1516, 124, - /* 1060 */ 1565, 34, 443, 260, 17, 446, 1431, 1532, 1499, 186, - /* 1070 */ 440, 1430, 456, 457, 60, 449, 1499, 451, 458, 1470, - /* 1080 */ 452, 1499, 268, 426, 201, 203, 1343, 466, 58, 221, - /* 1090 */ 1626, 1315, 1516, 211, 192, 119, 1500, 1501, 1505, 446, - /* 1100 */ 1516, 1608, 215, 495, 217, 1516, 543, 446, 223, 449, - /* 1110 */ 40, 1464, 446, 1470, 224, 219, 263, 449, 1463, 283, - /* 1120 */ 1460, 1470, 449, 1499, 267, 285, 1470, 1047, 1499, 233, - /* 1130 */ 1500, 1501, 1505, 388, 1625, 286, 1499, 233, 1500, 1501, - /* 1140 */ 1505, 1048, 225, 1500, 1501, 1505, 290, 1516, 396, 1458, - /* 1150 */ 134, 294, 1516, 292, 446, 293, 1457, 296, 1456, 446, - /* 1160 */ 1516, 298, 166, 1447, 449, 391, 135, 446, 1470, 449, - /* 1170 */ 385, 301, 302, 1470, 1317, 1441, 165, 449, 1032, 1031, - /* 1180 */ 1499, 1470, 1440, 307, 231, 1500, 1501, 1505, 308, 234, - /* 1190 */ 1500, 1501, 1505, 1439, 1438, 1499, 1003, 226, 1500, 1501, - /* 1200 */ 1505, 1415, 42, 1414, 1516, 41, 1499, 1413, 1412, 1411, - /* 1210 */ 1410, 446, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1516, - /* 1220 */ 1402, 449, 1401, 1400, 103, 1470, 446, 1399, 1398, 1397, - /* 1230 */ 1516, 1499, 1396, 1395, 1394, 209, 449, 446, 1393, 494, - /* 1240 */ 1470, 235, 1500, 1501, 1505, 1392, 1005, 449, 1391, 1390, - /* 1250 */ 1273, 1470, 1455, 1449, 1437, 1516, 227, 1500, 1501, 1505, - /* 1260 */ 1428, 496, 446, 1321, 146, 1499, 1272, 236, 1500, 1501, - /* 1270 */ 1505, 1270, 449, 350, 352, 351, 1470, 863, 1499, 1268, - /* 1280 */ 493, 492, 491, 356, 490, 354, 1266, 355, 1264, 1516, - /* 1290 */ 1253, 359, 1513, 1500, 1501, 1505, 446, 358, 1252, 360, - /* 1300 */ 362, 363, 1516, 1249, 364, 1323, 449, 972, 73, 446, - /* 1310 */ 1470, 153, 1499, 512, 970, 1322, 895, 510, 894, 449, - /* 1320 */ 1499, 893, 892, 1470, 1262, 1499, 1512, 1500, 1501, 1505, - /* 1330 */ 252, 889, 888, 1257, 253, 387, 1516, 1255, 254, 243, - /* 1340 */ 1500, 1501, 1505, 446, 1516, 390, 1248, 392, 1247, 1516, - /* 1350 */ 394, 446, 71, 449, 1454, 167, 446, 1470, 1039, 1448, - /* 1360 */ 402, 449, 113, 1436, 1435, 1470, 449, 1499, 1427, 54, - /* 1370 */ 1470, 123, 1499, 1511, 1500, 1501, 1505, 172, 14, 43, - /* 1380 */ 3, 244, 1500, 1501, 1505, 33, 242, 1500, 1501, 1505, - /* 1390 */ 38, 1516, 177, 1181, 15, 403, 1516, 120, 446, 1488, - /* 1400 */ 174, 181, 37, 446, 19, 56, 1174, 182, 449, 55, - /* 1410 */ 20, 1203, 1470, 449, 36, 1153, 1152, 1470, 16, 1208, - /* 1420 */ 1202, 35, 261, 1207, 1206, 262, 8, 13, 239, 1500, - /* 1430 */ 1501, 1505, 1090, 230, 1500, 1501, 1505, 188, 130, 1117, - /* 1440 */ 1089, 195, 196, 18, 1426, 1179, 198, 454, 10, 200, - /* 1450 */ 45, 202, 57, 1068, 204, 61, 956, 39, 467, 275, - /* 1460 */ 1487, 471, 469, 207, 465, 953, 472, 474, 950, 475, - /* 1470 */ 477, 944, 478, 480, 942, 933, 481, 62, 967, 948, - /* 1480 */ 46, 63, 961, 963, 487, 861, 497, 902, 947, 499, - /* 1490 */ 946, 877, 884, 945, 883, 882, 210, 881, 899, 880, - /* 1500 */ 879, 878, 897, 874, 873, 872, 869, 1269, 868, 966, - /* 1510 */ 867, 866, 521, 522, 523, 1267, 525, 526, 527, 1265, - /* 1520 */ 529, 530, 531, 1263, 533, 534, 535, 1251, 537, 538, - /* 1530 */ 1250, 1246, 541, 542, 1221, 1055, 218, 545, 546, + /* 0 */ 117, 1222, 1236, 1391, 450, 312, 1485, 269, 216, 256, + /* 10 */ 1434, 1374, 30, 28, 1389, 21, 306, 1503, 1481, 1488, + /* 20 */ 266, 501, 1054, 1316, 1074, 32, 31, 29, 27, 26, + /* 30 */ 32, 31, 29, 27, 26, 238, 1077, 437, 1052, 257, + /* 40 */ 1333, 1521, 32, 31, 29, 27, 26, 1614, 433, 1329, + /* 50 */ 11, 30, 28, 1163, 282, 270, 1485, 1059, 449, 266, + /* 60 */ 131, 1054, 1472, 115, 1612, 30, 28, 448, 1481, 1487, + /* 70 */ 1503, 1346, 462, 266, 1, 1054, 277, 1052, 69, 1504, + /* 80 */ 1505, 1510, 1553, 1425, 1427, 1614, 259, 1549, 126, 11, + /* 90 */ 1263, 1052, 1224, 1177, 1521, 118, 1059, 544, 131, 1302, + /* 100 */ 190, 433, 1612, 25, 194, 1096, 413, 1580, 274, 1053, + /* 110 */ 1059, 449, 384, 1, 348, 1472, 93, 92, 91, 90, + /* 120 */ 89, 88, 87, 86, 85, 1485, 12, 7, 1093, 395, + /* 130 */ 52, 69, 1504, 1505, 1510, 1553, 544, 1481, 1487, 259, + /* 140 */ 1549, 126, 393, 96, 152, 1422, 1055, 125, 1053, 250, + /* 150 */ 544, 1339, 139, 365, 462, 361, 357, 353, 151, 305, + /* 160 */ 1581, 304, 1053, 1058, 1078, 1079, 1080, 1081, 1108, 1109, + /* 170 */ 1110, 1111, 1112, 1113, 1114, 164, 29, 27, 26, 372, + /* 180 */ 1078, 1079, 1080, 1081, 53, 1055, 132, 149, 6, 463, + /* 190 */ 132, 251, 132, 249, 248, 438, 371, 397, 310, 1055, + /* 200 */ 132, 374, 1058, 1078, 1079, 1080, 1081, 1108, 1109, 1110, + /* 210 */ 1111, 1112, 1113, 1114, 1344, 1322, 1058, 1078, 1079, 1080, + /* 220 */ 1081, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1614, 30, + /* 230 */ 28, 32, 31, 29, 27, 26, 436, 266, 132, 1054, + /* 240 */ 1614, 131, 30, 28, 148, 1612, 121, 463, 145, 237, + /* 250 */ 266, 1074, 1054, 1613, 1503, 1052, 72, 1612, 327, 1076, + /* 260 */ 388, 339, 1521, 369, 348, 143, 1162, 11, 1052, 446, + /* 270 */ 340, 1391, 1344, 450, 1059, 396, 498, 271, 1521, 1435, + /* 280 */ 30, 28, 1389, 123, 463, 446, 1320, 1059, 266, 166, + /* 290 */ 1054, 1, 391, 72, 1384, 449, 383, 385, 377, 1472, + /* 300 */ 375, 423, 382, 165, 7, 97, 1052, 378, 376, 1344, + /* 310 */ 379, 463, 463, 463, 544, 70, 1504, 1505, 1510, 1553, + /* 320 */ 311, 319, 320, 1552, 1549, 1059, 1053, 544, 439, 42, + /* 330 */ 1158, 846, 41, 845, 406, 498, 1344, 1344, 1344, 1053, + /* 340 */ 164, 512, 7, 338, 372, 300, 333, 332, 331, 330, + /* 350 */ 329, 847, 326, 325, 324, 323, 322, 318, 317, 316, + /* 360 */ 315, 314, 313, 1055, 84, 544, 374, 83, 82, 81, + /* 370 */ 80, 79, 78, 77, 76, 75, 1055, 1053, 407, 137, + /* 380 */ 1058, 1078, 1079, 1080, 1081, 1108, 1109, 1110, 1111, 1112, + /* 390 */ 1113, 1114, 897, 1058, 1078, 1079, 1080, 1081, 1108, 1109, + /* 400 */ 1110, 1111, 1112, 1113, 1114, 50, 540, 539, 49, 1614, + /* 410 */ 424, 899, 276, 279, 1055, 1075, 132, 30, 28, 1391, + /* 420 */ 115, 115, 131, 9, 8, 266, 1612, 1054, 1346, 1346, + /* 430 */ 1426, 1058, 1078, 1079, 1080, 1081, 1108, 1109, 1110, 1111, + /* 440 */ 1112, 1113, 1114, 1052, 32, 31, 29, 27, 26, 1161, + /* 450 */ 1335, 935, 486, 485, 484, 939, 483, 941, 942, 482, + /* 460 */ 944, 479, 1059, 950, 476, 952, 953, 473, 470, 32, + /* 470 */ 31, 29, 27, 26, 23, 65, 489, 52, 1054, 1, + /* 480 */ 1273, 463, 241, 462, 32, 31, 29, 27, 26, 101, + /* 490 */ 460, 381, 380, 500, 1052, 1472, 1336, 1139, 1340, 116, + /* 500 */ 463, 463, 544, 463, 222, 1082, 1344, 1096, 334, 347, + /* 510 */ 208, 420, 1341, 1059, 1053, 1126, 220, 513, 511, 441, + /* 520 */ 32, 31, 29, 27, 26, 1344, 1344, 1187, 1344, 142, + /* 530 */ 9, 8, 520, 519, 518, 517, 281, 12, 516, 515, + /* 540 */ 514, 102, 509, 508, 507, 506, 505, 504, 503, 502, + /* 550 */ 108, 1055, 1247, 544, 141, 140, 1246, 1331, 241, 417, + /* 560 */ 1185, 1186, 1188, 1189, 1127, 1053, 425, 421, 1058, 1078, + /* 570 */ 1079, 1080, 1081, 1108, 1109, 1110, 1111, 1112, 1113, 1114, + /* 580 */ 430, 1245, 1131, 32, 31, 29, 27, 26, 1244, 1391, + /* 590 */ 1083, 1126, 67, 1572, 1158, 278, 1217, 1472, 1567, 1567, + /* 600 */ 1389, 1472, 1055, 1219, 1220, 100, 1243, 24, 264, 1121, + /* 610 */ 1122, 1123, 1124, 1125, 1129, 1130, 1564, 1563, 1242, 1058, + /* 620 */ 48, 47, 309, 189, 136, 1241, 1472, 1237, 1567, 303, + /* 630 */ 106, 1503, 59, 1472, 409, 463, 463, 246, 98, 295, + /* 640 */ 1127, 291, 287, 133, 461, 280, 1562, 432, 127, 1560, + /* 650 */ 1561, 1472, 1565, 1337, 442, 1521, 1128, 1240, 1131, 845, + /* 660 */ 1344, 1344, 446, 1472, 1216, 1239, 1238, 132, 445, 115, + /* 670 */ 1472, 1235, 449, 1503, 1132, 367, 1472, 1347, 1234, 1233, + /* 680 */ 1327, 434, 430, 24, 264, 1121, 1122, 1123, 1124, 1125, + /* 690 */ 1129, 1130, 68, 1504, 1505, 1510, 1553, 1521, 1258, 22, + /* 700 */ 240, 1549, 1472, 1232, 446, 547, 1391, 100, 175, 114, + /* 710 */ 1472, 1472, 1614, 1231, 449, 1503, 1472, 1390, 1472, 213, + /* 720 */ 386, 1230, 95, 1472, 1472, 131, 434, 1229, 536, 1612, + /* 730 */ 532, 528, 524, 212, 69, 1504, 1505, 1510, 1553, 1521, + /* 740 */ 98, 1170, 259, 1549, 1626, 1228, 446, 1076, 1472, 297, + /* 750 */ 187, 1560, 429, 1587, 428, 1276, 449, 1614, 1472, 66, + /* 760 */ 1472, 1227, 206, 1503, 299, 157, 1472, 1461, 155, 169, + /* 770 */ 131, 44, 1472, 1062, 1612, 1184, 69, 1504, 1505, 1510, + /* 780 */ 1553, 1118, 871, 1061, 259, 1549, 1626, 1521, 159, 1256, + /* 790 */ 1472, 158, 459, 161, 446, 1610, 160, 163, 1492, 447, + /* 800 */ 162, 872, 64, 289, 449, 1503, 1472, 383, 1472, 377, + /* 810 */ 1490, 389, 61, 382, 488, 405, 97, 1303, 378, 376, + /* 820 */ 412, 379, 418, 171, 69, 1504, 1505, 1510, 1553, 1521, + /* 830 */ 191, 178, 259, 1549, 1626, 180, 446, 33, 1038, 343, + /* 840 */ 168, 1133, 404, 1571, 1065, 1385, 449, 273, 272, 33, + /* 850 */ 1472, 184, 1503, 1091, 1064, 434, 366, 1067, 33, 197, + /* 860 */ 1583, 94, 1021, 199, 431, 455, 228, 1504, 1505, 1510, + /* 870 */ 104, 1522, 193, 1060, 205, 106, 1521, 2, 44, 928, + /* 880 */ 1074, 468, 923, 446, 284, 956, 1614, 288, 245, 247, + /* 890 */ 897, 104, 1059, 449, 1503, 960, 1030, 1472, 105, 131, + /* 900 */ 1503, 214, 966, 1612, 106, 1503, 138, 104, 965, 321, + /* 910 */ 1424, 107, 328, 70, 1504, 1505, 1510, 1553, 1521, 335, + /* 920 */ 337, 444, 1549, 336, 1521, 446, 341, 1087, 1086, 1521, + /* 930 */ 342, 446, 464, 344, 144, 449, 446, 345, 1085, 1472, + /* 940 */ 147, 449, 51, 346, 1063, 1472, 449, 349, 1084, 370, + /* 950 */ 1472, 1503, 150, 265, 368, 119, 1504, 1505, 1510, 1225, + /* 960 */ 255, 70, 1504, 1505, 1510, 1553, 229, 1504, 1505, 1510, + /* 970 */ 1550, 373, 1334, 154, 1330, 1521, 1503, 156, 109, 110, + /* 980 */ 84, 1068, 446, 83, 82, 81, 80, 79, 78, 77, + /* 990 */ 76, 75, 449, 435, 1627, 1332, 1472, 1328, 1071, 414, + /* 1000 */ 1521, 111, 74, 430, 112, 398, 400, 446, 408, 170, + /* 1010 */ 411, 173, 233, 1504, 1505, 1510, 401, 449, 1503, 410, + /* 1020 */ 399, 1472, 1083, 1584, 419, 453, 1594, 430, 100, 176, + /* 1030 */ 1059, 416, 258, 1593, 1574, 179, 422, 232, 1504, 1505, + /* 1040 */ 1510, 5, 1521, 427, 415, 4, 1503, 183, 1158, 446, + /* 1050 */ 1082, 124, 100, 185, 99, 34, 186, 260, 1433, 449, + /* 1060 */ 17, 98, 440, 1472, 1568, 451, 443, 1611, 456, 426, + /* 1070 */ 1521, 128, 1560, 1561, 452, 1565, 1535, 446, 192, 119, + /* 1080 */ 1504, 1505, 1510, 1629, 1432, 98, 268, 449, 201, 1503, + /* 1090 */ 203, 1472, 457, 458, 263, 129, 1560, 1561, 215, 1565, + /* 1100 */ 58, 1345, 60, 466, 495, 1317, 217, 233, 1504, 1505, + /* 1110 */ 1510, 211, 543, 1521, 40, 223, 1503, 224, 1628, 219, + /* 1120 */ 446, 221, 1466, 1465, 283, 1462, 285, 286, 1048, 1049, + /* 1130 */ 449, 1503, 134, 290, 1472, 1460, 292, 267, 293, 294, + /* 1140 */ 1521, 1459, 1503, 296, 1458, 298, 1449, 446, 135, 301, + /* 1150 */ 233, 1504, 1505, 1510, 302, 1521, 1033, 449, 1032, 1443, + /* 1160 */ 1442, 1472, 446, 307, 308, 1441, 1521, 1440, 1004, 1417, + /* 1170 */ 1416, 1415, 449, 446, 1414, 1413, 1472, 225, 1504, 1505, + /* 1180 */ 1510, 1412, 1411, 449, 1410, 1409, 1408, 1472, 1503, 1407, + /* 1190 */ 1406, 1405, 231, 1504, 1505, 1510, 1503, 1404, 1403, 1402, + /* 1200 */ 103, 1503, 1006, 234, 1504, 1505, 1510, 1401, 1400, 1399, + /* 1210 */ 1398, 1397, 1521, 1396, 1395, 1394, 1393, 1392, 1275, 446, + /* 1220 */ 1521, 1457, 1451, 1439, 1430, 1521, 146, 446, 1323, 449, + /* 1230 */ 1503, 1274, 446, 1472, 1272, 352, 351, 449, 864, 350, + /* 1240 */ 1270, 1472, 449, 354, 1268, 1266, 1472, 356, 355, 226, + /* 1250 */ 1504, 1505, 1510, 1255, 1521, 1503, 359, 235, 1504, 1505, + /* 1260 */ 1510, 446, 227, 1504, 1505, 1510, 363, 358, 360, 364, + /* 1270 */ 362, 449, 1254, 1251, 1325, 1472, 73, 153, 971, 1521, + /* 1280 */ 973, 1324, 1503, 1264, 896, 895, 446, 894, 893, 890, + /* 1290 */ 1503, 236, 1504, 1505, 1510, 889, 449, 252, 512, 1259, + /* 1300 */ 1472, 253, 387, 1257, 510, 390, 1521, 254, 1250, 392, + /* 1310 */ 1249, 394, 71, 446, 1521, 1456, 1518, 1504, 1505, 1510, + /* 1320 */ 1040, 446, 1450, 449, 402, 1438, 1503, 1472, 167, 113, + /* 1330 */ 1437, 449, 43, 403, 1429, 1472, 54, 172, 122, 174, + /* 1340 */ 3, 33, 14, 1517, 1504, 1505, 1510, 38, 182, 20, + /* 1350 */ 1521, 243, 1504, 1505, 1510, 1503, 15, 446, 10, 177, + /* 1360 */ 1503, 1183, 120, 35, 181, 19, 1490, 449, 1503, 56, + /* 1370 */ 1176, 1472, 55, 37, 1205, 1155, 1154, 36, 16, 1521, + /* 1380 */ 1210, 1204, 188, 130, 1521, 1321, 446, 1516, 1504, 1505, + /* 1390 */ 1510, 446, 1521, 1319, 261, 1209, 449, 1208, 262, 446, + /* 1400 */ 1472, 449, 8, 195, 1119, 1472, 1094, 1092, 196, 449, + /* 1410 */ 1181, 13, 18, 1472, 1503, 198, 244, 1504, 1505, 1510, + /* 1420 */ 200, 242, 1504, 1505, 1510, 45, 1428, 202, 57, 239, + /* 1430 */ 1504, 1505, 1510, 61, 1489, 1069, 207, 39, 1521, 957, + /* 1440 */ 454, 467, 204, 465, 275, 446, 209, 469, 471, 954, + /* 1450 */ 494, 472, 474, 951, 209, 449, 475, 477, 494, 1472, + /* 1460 */ 480, 945, 478, 934, 943, 481, 949, 948, 947, 946, + /* 1470 */ 487, 62, 496, 968, 964, 230, 1504, 1505, 1510, 46, + /* 1480 */ 496, 967, 63, 962, 862, 903, 210, 497, 499, 885, + /* 1490 */ 884, 493, 492, 491, 883, 490, 882, 881, 880, 493, + /* 1500 */ 492, 491, 879, 490, 878, 900, 898, 875, 874, 873, + /* 1510 */ 870, 869, 868, 867, 1271, 521, 522, 1269, 1267, 523, + /* 1520 */ 526, 525, 527, 529, 530, 1265, 534, 533, 1253, 531, + /* 1530 */ 535, 537, 538, 1252, 1248, 541, 542, 1223, 1056, 1223, + /* 1540 */ 546, 218, 545, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 253, 240, 257, 256, 278, 279, 259, 211, 235, 213, - /* 10 */ 218, 237, 12, 13, 269, 270, 262, 212, 257, 246, - /* 20 */ 20, 20, 22, 2, 20, 12, 13, 14, 15, 16, - /* 30 */ 269, 270, 2, 12, 13, 14, 15, 16, 38, 240, - /* 40 */ 248, 236, 12, 13, 14, 15, 16, 293, 243, 20, - /* 50 */ 50, 12, 13, 14, 49, 218, 257, 57, 253, 20, - /* 60 */ 306, 22, 257, 0, 310, 12, 13, 262, 269, 270, - /* 70 */ 218, 1, 2, 20, 74, 22, 218, 38, 273, 274, - /* 80 */ 275, 276, 277, 215, 216, 227, 281, 282, 75, 50, - /* 90 */ 212, 38, 234, 20, 253, 243, 57, 97, 293, 262, - /* 100 */ 259, 243, 0, 50, 12, 13, 14, 15, 16, 109, - /* 110 */ 57, 306, 49, 74, 236, 310, 12, 13, 14, 15, - /* 120 */ 16, 243, 221, 236, 22, 245, 225, 74, 276, 242, - /* 130 */ 293, 253, 252, 253, 247, 257, 97, 285, 286, 287, - /* 140 */ 288, 228, 290, 306, 49, 75, 146, 310, 109, 236, - /* 150 */ 97, 273, 274, 275, 276, 277, 20, 244, 22, 281, - /* 160 */ 282, 283, 109, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 173, 174, 61, 40, 222, 223, 65, - /* 180 */ 302, 20, 271, 209, 21, 146, 186, 24, 25, 26, - /* 190 */ 27, 28, 29, 30, 31, 32, 14, 15, 16, 146, - /* 200 */ 289, 87, 163, 164, 165, 166, 167, 168, 169, 170, - /* 210 */ 171, 172, 173, 174, 0, 186, 163, 164, 165, 166, - /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 0, 12, - /* 230 */ 13, 19, 145, 271, 147, 74, 262, 20, 52, 22, - /* 240 */ 54, 38, 186, 139, 58, 33, 20, 61, 36, 63, - /* 250 */ 64, 289, 66, 236, 42, 38, 44, 45, 46, 47, - /* 260 */ 57, 244, 12, 13, 14, 15, 16, 293, 12, 13, - /* 270 */ 14, 212, 218, 186, 57, 61, 20, 49, 22, 65, - /* 280 */ 306, 227, 12, 13, 310, 73, 220, 20, 76, 20, - /* 290 */ 20, 74, 22, 212, 38, 236, 217, 243, 236, 233, - /* 300 */ 74, 87, 243, 212, 67, 243, 218, 241, 38, 85, - /* 310 */ 231, 207, 253, 57, 97, 227, 257, 238, 106, 71, - /* 320 */ 106, 107, 108, 163, 110, 75, 109, 57, 222, 223, - /* 330 */ 74, 243, 273, 274, 275, 276, 277, 275, 257, 21, - /* 340 */ 281, 282, 283, 0, 74, 0, 134, 186, 257, 137, - /* 350 */ 113, 114, 34, 97, 295, 195, 196, 197, 198, 199, - /* 360 */ 301, 302, 57, 146, 152, 109, 154, 97, 212, 24, - /* 370 */ 25, 26, 27, 28, 29, 30, 31, 32, 237, 109, + /* 0 */ 211, 209, 213, 236, 253, 218, 257, 256, 229, 242, + /* 10 */ 259, 232, 12, 13, 247, 2, 262, 212, 269, 270, + /* 20 */ 20, 224, 22, 226, 20, 12, 13, 14, 15, 16, + /* 30 */ 12, 13, 14, 15, 16, 248, 20, 3, 38, 240, + /* 40 */ 237, 236, 12, 13, 14, 15, 16, 293, 243, 237, + /* 50 */ 50, 12, 13, 14, 262, 228, 257, 57, 253, 20, + /* 60 */ 306, 22, 257, 236, 310, 12, 13, 14, 269, 270, + /* 70 */ 212, 244, 20, 20, 74, 22, 245, 38, 273, 274, + /* 80 */ 275, 276, 277, 252, 253, 293, 281, 282, 283, 50, + /* 90 */ 0, 38, 0, 75, 236, 221, 57, 97, 306, 225, + /* 100 */ 295, 243, 310, 278, 279, 75, 301, 302, 240, 109, + /* 110 */ 57, 253, 22, 74, 49, 257, 24, 25, 26, 27, + /* 120 */ 28, 29, 30, 31, 32, 257, 74, 74, 75, 21, + /* 130 */ 220, 273, 274, 275, 276, 277, 97, 269, 270, 281, + /* 140 */ 282, 283, 34, 233, 33, 243, 146, 36, 109, 35, + /* 150 */ 97, 241, 250, 42, 20, 44, 45, 46, 47, 145, + /* 160 */ 302, 147, 109, 163, 164, 165, 166, 167, 168, 169, + /* 170 */ 170, 171, 172, 173, 174, 61, 14, 15, 16, 65, + /* 180 */ 164, 165, 166, 167, 73, 146, 186, 76, 43, 218, + /* 190 */ 186, 77, 186, 79, 80, 71, 82, 262, 227, 146, + /* 200 */ 186, 87, 163, 164, 165, 166, 167, 168, 169, 170, + /* 210 */ 171, 172, 173, 174, 243, 0, 163, 164, 165, 166, + /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 293, 12, + /* 230 */ 13, 12, 13, 14, 15, 16, 202, 20, 186, 22, + /* 240 */ 293, 306, 12, 13, 133, 310, 135, 218, 137, 18, + /* 250 */ 20, 20, 22, 306, 212, 38, 227, 310, 27, 20, + /* 260 */ 4, 30, 236, 234, 49, 154, 4, 50, 38, 243, + /* 270 */ 39, 236, 243, 253, 57, 19, 49, 242, 236, 259, + /* 280 */ 12, 13, 247, 235, 218, 243, 0, 57, 20, 33, + /* 290 */ 22, 74, 36, 227, 246, 253, 52, 41, 54, 257, + /* 300 */ 234, 275, 58, 47, 74, 61, 38, 63, 64, 243, + /* 310 */ 66, 218, 218, 218, 97, 273, 274, 275, 276, 277, + /* 320 */ 227, 227, 227, 281, 282, 57, 109, 97, 204, 73, + /* 330 */ 185, 20, 76, 22, 218, 49, 243, 243, 243, 109, + /* 340 */ 61, 71, 74, 112, 65, 75, 115, 116, 117, 118, + /* 350 */ 119, 40, 121, 122, 123, 124, 125, 126, 127, 128, + /* 360 */ 129, 130, 131, 146, 21, 97, 87, 24, 25, 26, + /* 370 */ 27, 28, 29, 30, 31, 32, 146, 109, 262, 47, /* 380 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 390 */ 173, 174, 20, 218, 236, 52, 220, 54, 293, 237, - /* 400 */ 242, 58, 146, 186, 61, 247, 63, 64, 212, 66, - /* 410 */ 212, 306, 265, 257, 212, 310, 146, 241, 243, 163, - /* 420 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - /* 430 */ 174, 164, 165, 163, 164, 165, 166, 167, 168, 169, - /* 440 */ 170, 171, 172, 173, 174, 218, 12, 13, 18, 136, - /* 450 */ 20, 276, 204, 257, 20, 257, 22, 27, 217, 257, - /* 460 */ 30, 286, 287, 288, 243, 290, 20, 4, 262, 39, - /* 470 */ 243, 250, 38, 12, 13, 14, 15, 16, 3, 238, - /* 480 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - /* 490 */ 98, 57, 100, 101, 102, 103, 104, 105, 0, 293, - /* 500 */ 184, 185, 271, 276, 191, 192, 1, 2, 74, 218, - /* 510 */ 138, 50, 306, 286, 287, 288, 310, 290, 227, 21, - /* 520 */ 289, 212, 24, 25, 26, 27, 28, 29, 30, 31, - /* 530 */ 32, 97, 229, 237, 243, 232, 75, 12, 13, 14, - /* 540 */ 15, 16, 112, 109, 83, 115, 116, 117, 118, 119, - /* 550 */ 212, 121, 122, 123, 124, 125, 126, 127, 128, 129, - /* 560 */ 130, 131, 0, 47, 18, 218, 257, 212, 224, 23, - /* 570 */ 226, 236, 236, 43, 227, 12, 13, 14, 15, 16, - /* 580 */ 146, 35, 247, 247, 138, 14, 237, 237, 212, 73, - /* 590 */ 243, 20, 76, 132, 48, 257, 237, 163, 164, 165, - /* 600 */ 166, 167, 168, 169, 170, 171, 172, 173, 174, 213, - /* 610 */ 212, 150, 257, 50, 52, 53, 54, 55, 56, 212, - /* 620 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 630 */ 68, 69, 70, 257, 212, 212, 175, 176, 177, 178, - /* 640 */ 179, 180, 181, 182, 183, 218, 83, 218, 212, 218, - /* 650 */ 187, 22, 228, 218, 227, 257, 227, 111, 227, 236, - /* 660 */ 236, 234, 227, 138, 257, 228, 243, 38, 244, 0, - /* 670 */ 243, 38, 243, 236, 243, 218, 253, 202, 243, 257, - /* 680 */ 257, 244, 212, 212, 227, 139, 140, 141, 212, 143, - /* 690 */ 57, 22, 218, 257, 148, 132, 273, 274, 275, 276, - /* 700 */ 243, 227, 156, 142, 158, 236, 160, 161, 162, 225, - /* 710 */ 71, 242, 236, 150, 75, 185, 247, 243, 157, 243, - /* 720 */ 78, 22, 218, 81, 212, 212, 212, 257, 257, 253, - /* 730 */ 50, 227, 186, 257, 311, 312, 132, 38, 175, 176, - /* 740 */ 177, 178, 179, 180, 181, 182, 183, 243, 236, 273, - /* 750 */ 274, 275, 276, 277, 150, 243, 57, 281, 282, 283, - /* 760 */ 212, 0, 212, 33, 212, 253, 36, 313, 292, 257, - /* 770 */ 257, 257, 42, 253, 44, 45, 46, 47, 78, 175, - /* 780 */ 78, 81, 304, 81, 236, 273, 274, 275, 276, 277, - /* 790 */ 0, 243, 71, 281, 282, 283, 97, 36, 164, 165, - /* 800 */ 246, 253, 35, 73, 292, 257, 76, 257, 109, 257, - /* 810 */ 212, 78, 22, 71, 81, 71, 71, 75, 253, 75, - /* 820 */ 75, 273, 274, 275, 276, 277, 74, 298, 61, 281, - /* 830 */ 282, 283, 65, 215, 236, 71, 272, 212, 86, 75, - /* 840 */ 292, 243, 291, 163, 77, 146, 79, 80, 38, 82, - /* 850 */ 236, 253, 212, 71, 87, 257, 307, 75, 20, 38, - /* 860 */ 262, 236, 163, 133, 294, 135, 71, 137, 243, 218, - /* 870 */ 75, 273, 274, 275, 276, 36, 236, 71, 253, 212, - /* 880 */ 268, 75, 257, 243, 154, 71, 12, 13, 71, 75, - /* 890 */ 38, 293, 75, 253, 222, 144, 22, 257, 273, 274, - /* 900 */ 275, 276, 277, 236, 306, 218, 281, 282, 310, 263, - /* 910 */ 243, 218, 38, 273, 274, 275, 276, 277, 74, 109, - /* 920 */ 253, 281, 282, 218, 257, 71, 251, 206, 84, 75, - /* 930 */ 109, 57, 71, 71, 71, 120, 75, 75, 75, 132, - /* 940 */ 273, 274, 275, 276, 277, 249, 71, 249, 243, 282, - /* 950 */ 75, 20, 218, 71, 71, 212, 267, 75, 75, 20, - /* 960 */ 220, 243, 261, 20, 254, 218, 220, 262, 220, 220, - /* 970 */ 20, 97, 214, 236, 236, 236, 222, 236, 218, 236, - /* 980 */ 267, 276, 212, 109, 153, 266, 243, 214, 261, 236, - /* 990 */ 212, 286, 287, 288, 217, 290, 253, 217, 293, 236, - /* 1000 */ 257, 236, 236, 260, 236, 236, 236, 236, 20, 254, - /* 1010 */ 194, 306, 303, 243, 236, 310, 273, 274, 275, 276, - /* 1020 */ 146, 243, 243, 253, 243, 193, 57, 257, 272, 257, - /* 1030 */ 260, 253, 258, 258, 212, 257, 201, 163, 303, 189, - /* 1040 */ 257, 257, 200, 273, 274, 275, 276, 188, 243, 20, - /* 1050 */ 300, 273, 274, 275, 276, 296, 299, 185, 236, 297, - /* 1060 */ 271, 120, 205, 208, 74, 243, 258, 280, 212, 284, - /* 1070 */ 203, 258, 135, 255, 74, 253, 212, 257, 254, 257, - /* 1080 */ 257, 212, 257, 305, 243, 217, 243, 239, 217, 210, - /* 1090 */ 314, 226, 236, 217, 308, 273, 274, 275, 276, 243, - /* 1100 */ 236, 309, 232, 222, 218, 236, 214, 243, 230, 253, - /* 1110 */ 264, 0, 243, 257, 230, 219, 260, 253, 0, 64, - /* 1120 */ 0, 257, 253, 212, 260, 38, 257, 38, 212, 273, - /* 1130 */ 274, 275, 276, 4, 312, 159, 212, 273, 274, 275, - /* 1140 */ 276, 38, 273, 274, 275, 276, 159, 236, 19, 0, - /* 1150 */ 38, 159, 236, 38, 243, 38, 0, 38, 0, 243, - /* 1160 */ 236, 38, 33, 0, 253, 36, 74, 243, 257, 253, - /* 1170 */ 41, 150, 149, 257, 0, 0, 47, 253, 109, 146, - /* 1180 */ 212, 257, 0, 53, 273, 274, 275, 276, 142, 273, - /* 1190 */ 274, 275, 276, 0, 0, 212, 86, 273, 274, 275, - /* 1200 */ 276, 0, 73, 0, 236, 76, 212, 0, 0, 0, - /* 1210 */ 0, 243, 0, 0, 0, 0, 0, 0, 0, 236, - /* 1220 */ 0, 253, 0, 0, 120, 257, 243, 0, 0, 0, - /* 1230 */ 236, 212, 0, 0, 0, 61, 253, 243, 0, 65, - /* 1240 */ 257, 273, 274, 275, 276, 0, 22, 253, 0, 0, - /* 1250 */ 0, 257, 0, 0, 0, 236, 273, 274, 275, 276, - /* 1260 */ 0, 87, 243, 0, 43, 212, 0, 273, 274, 275, - /* 1270 */ 276, 0, 253, 38, 43, 36, 257, 51, 212, 0, - /* 1280 */ 106, 107, 108, 43, 110, 38, 0, 36, 0, 236, - /* 1290 */ 0, 36, 273, 274, 275, 276, 243, 38, 0, 43, - /* 1300 */ 38, 36, 236, 0, 43, 0, 253, 38, 83, 243, - /* 1310 */ 257, 81, 212, 71, 22, 0, 38, 71, 38, 253, - /* 1320 */ 212, 38, 38, 257, 0, 212, 273, 274, 275, 276, - /* 1330 */ 22, 38, 38, 0, 22, 39, 236, 0, 22, 273, - /* 1340 */ 274, 275, 276, 243, 236, 38, 0, 22, 0, 236, - /* 1350 */ 22, 243, 20, 253, 0, 155, 243, 257, 38, 0, - /* 1360 */ 22, 253, 151, 0, 0, 257, 253, 212, 0, 74, - /* 1370 */ 257, 135, 212, 273, 274, 275, 276, 43, 190, 138, - /* 1380 */ 71, 273, 274, 275, 276, 71, 273, 274, 275, 276, - /* 1390 */ 71, 236, 75, 75, 190, 138, 236, 74, 243, 86, - /* 1400 */ 133, 74, 138, 243, 74, 4, 75, 71, 253, 74, - /* 1410 */ 71, 38, 257, 253, 71, 75, 75, 257, 71, 75, - /* 1420 */ 38, 184, 38, 38, 38, 38, 2, 74, 273, 274, - /* 1430 */ 275, 276, 75, 273, 274, 275, 276, 86, 86, 163, - /* 1440 */ 75, 86, 75, 74, 0, 75, 74, 136, 190, 74, - /* 1450 */ 74, 43, 74, 22, 133, 84, 75, 74, 38, 38, - /* 1460 */ 86, 38, 74, 86, 85, 75, 74, 38, 75, 74, - /* 1470 */ 38, 75, 74, 38, 75, 22, 74, 74, 38, 99, - /* 1480 */ 74, 74, 22, 38, 87, 51, 50, 57, 99, 72, - /* 1490 */ 99, 22, 38, 99, 38, 38, 71, 38, 57, 38, - /* 1500 */ 38, 38, 38, 38, 38, 38, 38, 0, 38, 109, - /* 1510 */ 38, 38, 38, 36, 43, 0, 38, 36, 43, 0, - /* 1520 */ 38, 36, 43, 0, 38, 36, 43, 0, 38, 37, - /* 1530 */ 0, 0, 22, 21, 315, 22, 22, 21, 20, 315, - /* 1540 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, + /* 390 */ 173, 174, 38, 163, 164, 165, 166, 167, 168, 169, + /* 400 */ 170, 171, 172, 173, 174, 73, 215, 216, 76, 293, + /* 410 */ 20, 57, 228, 228, 146, 20, 186, 12, 13, 236, + /* 420 */ 236, 236, 306, 1, 2, 20, 310, 22, 244, 244, + /* 430 */ 247, 163, 164, 165, 166, 167, 168, 169, 170, 171, + /* 440 */ 172, 173, 174, 38, 12, 13, 14, 15, 16, 187, + /* 450 */ 212, 88, 89, 90, 91, 92, 93, 94, 95, 96, + /* 460 */ 97, 98, 57, 100, 101, 102, 103, 104, 105, 12, + /* 470 */ 13, 14, 15, 16, 2, 217, 85, 220, 22, 74, + /* 480 */ 0, 218, 50, 20, 12, 13, 14, 15, 16, 231, + /* 490 */ 227, 222, 223, 57, 38, 257, 238, 75, 241, 18, + /* 500 */ 218, 218, 97, 218, 23, 20, 243, 75, 67, 227, + /* 510 */ 227, 136, 227, 57, 109, 83, 35, 222, 223, 71, + /* 520 */ 12, 13, 14, 15, 16, 243, 243, 163, 243, 48, + /* 530 */ 1, 2, 52, 53, 54, 55, 56, 74, 58, 59, + /* 540 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + /* 550 */ 70, 146, 212, 97, 113, 114, 212, 237, 50, 195, + /* 560 */ 196, 197, 198, 199, 132, 109, 191, 192, 163, 164, + /* 570 */ 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + /* 580 */ 218, 212, 150, 12, 13, 14, 15, 16, 212, 236, + /* 590 */ 20, 83, 111, 184, 185, 242, 139, 257, 271, 271, + /* 600 */ 247, 257, 146, 164, 165, 243, 212, 175, 176, 177, + /* 610 */ 178, 179, 180, 181, 182, 183, 289, 289, 212, 163, + /* 620 */ 139, 140, 141, 138, 143, 212, 257, 213, 271, 148, + /* 630 */ 71, 212, 217, 257, 75, 218, 218, 156, 276, 158, + /* 640 */ 132, 160, 161, 162, 227, 227, 289, 285, 286, 287, + /* 650 */ 288, 257, 290, 238, 206, 236, 132, 212, 150, 22, + /* 660 */ 243, 243, 243, 257, 207, 212, 212, 186, 50, 236, + /* 670 */ 257, 212, 253, 212, 150, 38, 257, 244, 212, 212, + /* 680 */ 237, 262, 218, 175, 176, 177, 178, 179, 180, 181, + /* 690 */ 182, 183, 273, 274, 275, 276, 277, 236, 0, 175, + /* 700 */ 281, 282, 257, 212, 243, 19, 236, 243, 138, 138, + /* 710 */ 257, 257, 293, 212, 253, 212, 257, 247, 257, 33, + /* 720 */ 22, 212, 36, 257, 257, 306, 262, 212, 42, 310, + /* 730 */ 44, 45, 46, 47, 273, 274, 275, 276, 277, 236, + /* 740 */ 276, 14, 281, 282, 283, 212, 243, 20, 257, 142, + /* 750 */ 286, 287, 288, 292, 290, 0, 253, 293, 257, 73, + /* 760 */ 257, 212, 76, 212, 157, 78, 257, 0, 81, 237, + /* 770 */ 306, 71, 257, 38, 310, 75, 273, 274, 275, 276, + /* 780 */ 277, 163, 38, 38, 281, 282, 283, 236, 78, 0, + /* 790 */ 257, 81, 106, 78, 243, 292, 81, 78, 74, 237, + /* 800 */ 81, 57, 74, 36, 253, 212, 257, 52, 257, 54, + /* 810 */ 86, 22, 84, 58, 237, 265, 61, 225, 63, 64, + /* 820 */ 134, 66, 304, 137, 273, 274, 275, 276, 277, 236, + /* 830 */ 313, 71, 281, 282, 283, 75, 243, 71, 152, 253, + /* 840 */ 154, 75, 253, 292, 109, 246, 253, 12, 13, 71, + /* 850 */ 257, 298, 212, 75, 109, 262, 215, 22, 71, 71, + /* 860 */ 272, 71, 75, 75, 291, 75, 273, 274, 275, 276, + /* 870 */ 71, 236, 307, 38, 75, 71, 236, 294, 71, 75, + /* 880 */ 20, 71, 75, 243, 218, 75, 293, 36, 268, 222, + /* 890 */ 38, 71, 57, 253, 212, 75, 144, 257, 71, 306, + /* 900 */ 212, 263, 75, 310, 71, 212, 120, 71, 75, 218, + /* 910 */ 218, 75, 251, 273, 274, 275, 276, 277, 236, 249, + /* 920 */ 249, 281, 282, 132, 236, 243, 218, 20, 20, 236, + /* 930 */ 267, 243, 97, 261, 220, 253, 243, 243, 20, 257, + /* 940 */ 220, 253, 220, 254, 109, 257, 253, 218, 20, 236, + /* 950 */ 257, 212, 220, 260, 214, 273, 274, 275, 276, 0, + /* 960 */ 214, 273, 274, 275, 276, 277, 273, 274, 275, 276, + /* 970 */ 282, 222, 236, 236, 236, 236, 212, 236, 236, 236, + /* 980 */ 21, 146, 243, 24, 25, 26, 27, 28, 29, 30, + /* 990 */ 31, 32, 253, 311, 312, 236, 257, 236, 163, 260, + /* 1000 */ 236, 236, 218, 218, 236, 243, 153, 243, 261, 217, + /* 1010 */ 254, 217, 273, 274, 275, 276, 266, 253, 212, 243, + /* 1020 */ 267, 257, 20, 272, 194, 193, 303, 218, 243, 258, + /* 1030 */ 57, 257, 257, 303, 300, 258, 257, 273, 274, 275, + /* 1040 */ 276, 201, 236, 200, 189, 188, 212, 299, 185, 243, + /* 1050 */ 20, 297, 243, 296, 243, 120, 284, 208, 258, 253, + /* 1060 */ 74, 276, 203, 257, 271, 257, 205, 309, 135, 305, + /* 1070 */ 236, 286, 287, 288, 257, 290, 280, 243, 308, 273, + /* 1080 */ 274, 275, 276, 314, 258, 276, 257, 253, 243, 212, + /* 1090 */ 217, 257, 255, 254, 260, 286, 287, 288, 232, 290, + /* 1100 */ 217, 243, 74, 239, 222, 226, 218, 273, 274, 275, + /* 1110 */ 276, 217, 214, 236, 264, 230, 212, 230, 312, 219, + /* 1120 */ 243, 210, 0, 0, 64, 0, 38, 159, 38, 38, + /* 1130 */ 253, 212, 38, 159, 257, 0, 38, 260, 38, 159, + /* 1140 */ 236, 0, 212, 38, 0, 38, 0, 243, 74, 150, + /* 1150 */ 273, 274, 275, 276, 149, 236, 109, 253, 146, 0, + /* 1160 */ 0, 257, 243, 53, 142, 0, 236, 0, 86, 0, + /* 1170 */ 0, 0, 253, 243, 0, 0, 257, 273, 274, 275, + /* 1180 */ 276, 0, 0, 253, 0, 0, 0, 257, 212, 0, + /* 1190 */ 0, 0, 273, 274, 275, 276, 212, 0, 0, 0, + /* 1200 */ 120, 212, 22, 273, 274, 275, 276, 0, 0, 0, + /* 1210 */ 0, 0, 236, 0, 0, 0, 0, 0, 0, 243, + /* 1220 */ 236, 0, 0, 0, 0, 236, 43, 243, 0, 253, + /* 1230 */ 212, 0, 243, 257, 0, 43, 36, 253, 51, 38, + /* 1240 */ 0, 257, 253, 38, 0, 0, 257, 43, 36, 273, + /* 1250 */ 274, 275, 276, 0, 236, 212, 36, 273, 274, 275, + /* 1260 */ 276, 243, 273, 274, 275, 276, 36, 38, 43, 43, + /* 1270 */ 38, 253, 0, 0, 0, 257, 83, 81, 22, 236, + /* 1280 */ 38, 0, 212, 0, 38, 38, 243, 38, 38, 38, + /* 1290 */ 212, 273, 274, 275, 276, 38, 253, 22, 71, 0, + /* 1300 */ 257, 22, 39, 0, 71, 38, 236, 22, 0, 22, + /* 1310 */ 0, 22, 20, 243, 236, 0, 273, 274, 275, 276, + /* 1320 */ 38, 243, 0, 253, 22, 0, 212, 257, 155, 151, + /* 1330 */ 0, 253, 138, 138, 0, 257, 74, 43, 135, 133, + /* 1340 */ 71, 71, 190, 273, 274, 275, 276, 71, 71, 71, + /* 1350 */ 236, 273, 274, 275, 276, 212, 190, 243, 190, 75, + /* 1360 */ 212, 75, 74, 184, 74, 74, 86, 253, 212, 4, + /* 1370 */ 75, 257, 74, 138, 38, 75, 75, 71, 71, 236, + /* 1380 */ 75, 38, 86, 86, 236, 0, 243, 273, 274, 275, + /* 1390 */ 276, 243, 236, 0, 38, 38, 253, 38, 38, 243, + /* 1400 */ 257, 253, 2, 86, 163, 257, 75, 75, 75, 253, + /* 1410 */ 75, 74, 74, 257, 212, 74, 273, 274, 275, 276, + /* 1420 */ 74, 273, 274, 275, 276, 74, 0, 43, 74, 273, + /* 1430 */ 274, 275, 276, 84, 86, 22, 86, 74, 236, 75, + /* 1440 */ 136, 38, 133, 85, 38, 243, 61, 74, 38, 75, + /* 1450 */ 65, 74, 38, 75, 61, 253, 74, 38, 65, 257, + /* 1460 */ 38, 75, 74, 22, 75, 74, 99, 99, 99, 99, + /* 1470 */ 87, 74, 87, 38, 38, 273, 274, 275, 276, 74, + /* 1480 */ 87, 109, 74, 22, 51, 57, 71, 50, 72, 38, + /* 1490 */ 38, 106, 107, 108, 38, 110, 38, 38, 38, 106, + /* 1500 */ 107, 108, 38, 110, 22, 57, 38, 38, 38, 38, + /* 1510 */ 38, 38, 38, 38, 0, 38, 36, 0, 0, 43, + /* 1520 */ 36, 38, 43, 38, 36, 0, 36, 38, 0, 43, + /* 1530 */ 43, 38, 37, 0, 0, 22, 21, 315, 22, 315, + /* 1540 */ 20, 22, 21, 315, 315, 315, 315, 315, 315, 315, /* 1550 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, /* 1560 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, /* 1570 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, @@ -542,151 +543,152 @@ static const YYCODETYPE yy_lookahead[] = { /* 1710 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, /* 1720 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, /* 1730 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, - /* 1740 */ 315, 315, 315, 315, 315, 315, 315, 315, + /* 1740 */ 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, + /* 1750 */ 315, 315, }; #define YY_SHIFT_COUNT (547) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1531) +#define YY_SHIFT_MAX (1534) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 546, 0, 39, 53, 53, 53, 53, 217, 53, 53, - /* 10 */ 270, 434, 161, 256, 270, 270, 270, 270, 270, 270, - /* 20 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 30 */ 270, 270, 270, 270, 226, 226, 226, 29, 874, 874, - /* 40 */ 87, 1, 1, 56, 874, 267, 267, 1, 1, 1, - /* 50 */ 1, 1, 1, 5, 4, 73, 56, 4, 1, 1, - /* 60 */ 4, 1, 4, 4, 4, 1, 95, 430, 461, 563, - /* 70 */ 563, 163, 767, 699, 186, 699, 699, 699, 699, 699, - /* 80 */ 699, 699, 699, 699, 699, 699, 699, 699, 699, 699, - /* 90 */ 699, 699, 699, 699, 267, 136, 63, 203, 372, 372, - /* 100 */ 372, 228, 203, 269, 4, 4, 4, 224, 305, 392, - /* 110 */ 392, 392, 392, 392, 392, 392, 212, 498, 343, 104, - /* 120 */ 160, 267, 114, 267, 313, 629, 446, 316, 530, 316, - /* 130 */ 571, 475, 463, 838, 839, 852, 751, 838, 838, 815, - /* 140 */ 807, 807, 838, 931, 939, 5, 269, 943, 5, 5, - /* 150 */ 838, 5, 950, 4, 4, 4, 4, 4, 4, 4, - /* 160 */ 4, 4, 4, 4, 852, 838, 950, 269, 931, 831, - /* 170 */ 939, 95, 269, 943, 95, 988, 816, 832, 969, 816, - /* 180 */ 832, 969, 969, 835, 842, 850, 859, 872, 269, 1029, - /* 190 */ 941, 855, 857, 867, 990, 4, 832, 969, 969, 832, - /* 200 */ 969, 937, 269, 943, 95, 224, 95, 269, 1000, 852, - /* 210 */ 305, 838, 95, 950, 1539, 1539, 1539, 1539, 1539, 562, - /* 220 */ 730, 345, 1129, 214, 1174, 13, 21, 30, 250, 525, - /* 230 */ 92, 92, 92, 92, 92, 92, 92, 516, 237, 182, - /* 240 */ 70, 604, 182, 182, 182, 761, 561, 639, 642, 700, - /* 250 */ 702, 733, 102, 669, 790, 318, 742, 744, 745, 505, - /* 260 */ 634, 248, 721, 764, 680, 782, 752, 795, 806, 814, - /* 270 */ 817, 854, 810, 821, 861, 862, 863, 875, 882, 883, - /* 280 */ 844, 633, 1111, 1118, 1055, 1120, 1087, 976, 1089, 1103, - /* 290 */ 1112, 987, 1149, 1115, 1117, 992, 1156, 1119, 1158, 1123, - /* 300 */ 1163, 1092, 1021, 1023, 1069, 1033, 1175, 1182, 1130, 1046, - /* 310 */ 1193, 1194, 1110, 1201, 1203, 1207, 1208, 1209, 1210, 1212, - /* 320 */ 1213, 1214, 1215, 1216, 1217, 1218, 1220, 1222, 1223, 1104, - /* 330 */ 1227, 1228, 1229, 1232, 1233, 1234, 1224, 1238, 1245, 1248, - /* 340 */ 1249, 1250, 1252, 1253, 1254, 1260, 1221, 1263, 1226, 1266, - /* 350 */ 1271, 1235, 1239, 1231, 1279, 1247, 1251, 1240, 1286, 1259, - /* 360 */ 1255, 1256, 1288, 1262, 1265, 1261, 1290, 1298, 1303, 1305, - /* 370 */ 1225, 1230, 1269, 1242, 1292, 1315, 1278, 1280, 1283, 1284, - /* 380 */ 1246, 1242, 1293, 1294, 1324, 1308, 1333, 1312, 1296, 1337, - /* 390 */ 1316, 1307, 1346, 1325, 1348, 1328, 1332, 1354, 1241, 1200, - /* 400 */ 1320, 1359, 1211, 1338, 1257, 1236, 1363, 1364, 1264, 1368, - /* 410 */ 1295, 1334, 1267, 1309, 1314, 1188, 1317, 1319, 1318, 1323, - /* 420 */ 1327, 1330, 1331, 1336, 1313, 1335, 1339, 1204, 1340, 1341, - /* 430 */ 1351, 1237, 1343, 1352, 1344, 1347, 1258, 1401, 1373, 1382, - /* 440 */ 1384, 1385, 1386, 1387, 1424, 1276, 1355, 1357, 1365, 1353, - /* 450 */ 1369, 1367, 1370, 1372, 1375, 1311, 1376, 1444, 1408, 1321, - /* 460 */ 1378, 1371, 1374, 1377, 1431, 1383, 1379, 1381, 1420, 1421, - /* 470 */ 1388, 1390, 1423, 1392, 1393, 1429, 1395, 1396, 1432, 1398, - /* 480 */ 1399, 1435, 1402, 1380, 1389, 1391, 1394, 1453, 1397, 1403, - /* 490 */ 1440, 1400, 1406, 1407, 1445, 1242, 1460, 1434, 1436, 1430, - /* 500 */ 1417, 1425, 1454, 1456, 1457, 1459, 1461, 1462, 1463, 1469, - /* 510 */ 1441, 1246, 1464, 1242, 1465, 1466, 1467, 1468, 1470, 1472, - /* 520 */ 1473, 1507, 1474, 1477, 1471, 1515, 1478, 1481, 1475, 1519, - /* 530 */ 1482, 1485, 1479, 1523, 1486, 1489, 1483, 1527, 1490, 1492, - /* 540 */ 1530, 1531, 1510, 1512, 1513, 1514, 1516, 1518, + /* 0 */ 481, 0, 39, 217, 217, 217, 217, 230, 217, 217, + /* 10 */ 268, 405, 52, 53, 268, 268, 268, 268, 268, 268, + /* 20 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + /* 30 */ 268, 268, 268, 268, 463, 463, 463, 4, 835, 835, + /* 40 */ 14, 134, 134, 6, 835, 16, 16, 134, 134, 134, + /* 50 */ 134, 134, 134, 65, 239, 390, 6, 239, 134, 134, + /* 60 */ 239, 134, 239, 239, 239, 134, 227, 231, 432, 508, + /* 70 */ 508, 343, 114, 456, 244, 456, 456, 456, 456, 456, + /* 80 */ 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + /* 90 */ 456, 456, 456, 456, 16, 311, 215, 354, 485, 485, + /* 100 */ 485, 286, 354, 395, 239, 239, 239, 391, 436, 363, + /* 110 */ 363, 363, 363, 363, 363, 363, 686, 959, 755, 457, + /* 120 */ 364, 16, 16, 279, 375, 637, 570, 409, 145, 409, + /* 130 */ 727, 34, 262, 860, 851, 852, 752, 860, 860, 786, + /* 140 */ 791, 791, 860, 907, 908, 65, 395, 918, 65, 65, + /* 150 */ 860, 65, 928, 239, 239, 239, 239, 239, 239, 239, + /* 160 */ 239, 239, 239, 239, 852, 860, 928, 395, 907, 853, + /* 170 */ 908, 227, 395, 918, 227, 1002, 830, 832, 973, 830, + /* 180 */ 832, 973, 973, 840, 843, 855, 857, 863, 395, 1030, + /* 190 */ 935, 849, 861, 859, 986, 239, 832, 973, 973, 832, + /* 200 */ 973, 933, 395, 918, 227, 391, 227, 395, 1028, 852, + /* 210 */ 436, 860, 227, 928, 1543, 1543, 1543, 1543, 1543, 480, + /* 220 */ 111, 92, 256, 1385, 1393, 18, 13, 472, 30, 571, + /* 230 */ 219, 219, 219, 219, 219, 219, 219, 332, 441, 162, + /* 240 */ 422, 524, 162, 162, 162, 767, 607, 270, 687, 710, + /* 250 */ 715, 719, 90, 698, 789, 108, 559, 700, 760, 529, + /* 260 */ 439, 124, 448, 766, 618, 778, 724, 787, 788, 790, + /* 270 */ 799, 804, 735, 745, 807, 810, 820, 827, 833, 836, + /* 280 */ 728, 744, 1122, 1123, 1060, 1125, 1088, 968, 1090, 1091, + /* 290 */ 1094, 974, 1135, 1098, 1100, 980, 1141, 1105, 1144, 1107, + /* 300 */ 1146, 1074, 999, 1005, 1047, 1012, 1159, 1160, 1110, 1022, + /* 310 */ 1165, 1167, 1082, 1169, 1170, 1171, 1174, 1175, 1181, 1182, + /* 320 */ 1184, 1185, 1186, 1189, 1190, 1191, 1197, 1198, 1199, 1080, + /* 330 */ 1207, 1208, 1209, 1210, 1211, 1213, 1180, 1214, 1215, 1216, + /* 340 */ 1217, 1218, 1221, 1222, 1223, 1224, 1183, 1228, 1187, 1231, + /* 350 */ 1234, 1201, 1200, 1192, 1240, 1205, 1212, 1204, 1244, 1229, + /* 360 */ 1220, 1225, 1245, 1232, 1230, 1226, 1253, 1272, 1273, 1274, + /* 370 */ 1193, 1196, 1242, 1227, 1256, 1281, 1246, 1247, 1249, 1250, + /* 380 */ 1233, 1227, 1251, 1257, 1283, 1275, 1299, 1279, 1263, 1303, + /* 390 */ 1285, 1267, 1308, 1287, 1310, 1289, 1292, 1315, 1194, 1173, + /* 400 */ 1282, 1322, 1178, 1302, 1195, 1203, 1325, 1330, 1235, 1334, + /* 410 */ 1262, 1294, 1206, 1269, 1270, 1152, 1284, 1276, 1286, 1288, + /* 420 */ 1290, 1291, 1295, 1277, 1280, 1298, 1278, 1166, 1300, 1301, + /* 430 */ 1296, 1179, 1306, 1297, 1305, 1307, 1168, 1365, 1336, 1343, + /* 440 */ 1356, 1357, 1359, 1360, 1400, 1241, 1317, 1331, 1332, 1337, + /* 450 */ 1338, 1333, 1335, 1341, 1346, 1304, 1351, 1426, 1384, 1309, + /* 460 */ 1354, 1349, 1348, 1350, 1413, 1363, 1358, 1364, 1403, 1406, + /* 470 */ 1373, 1374, 1410, 1377, 1378, 1414, 1382, 1386, 1419, 1388, + /* 480 */ 1389, 1422, 1391, 1367, 1368, 1369, 1370, 1441, 1383, 1397, + /* 490 */ 1435, 1372, 1405, 1408, 1436, 1227, 1461, 1433, 1437, 1428, + /* 500 */ 1416, 1415, 1451, 1452, 1456, 1458, 1459, 1460, 1464, 1482, + /* 510 */ 1448, 1233, 1468, 1227, 1469, 1470, 1471, 1472, 1473, 1474, + /* 520 */ 1475, 1514, 1477, 1480, 1476, 1517, 1483, 1484, 1479, 1518, + /* 530 */ 1485, 1488, 1486, 1525, 1489, 1490, 1487, 1528, 1493, 1495, + /* 540 */ 1533, 1534, 1513, 1515, 1516, 1519, 1521, 1520, }; #define YY_REDUCE_COUNT (218) -#define YY_REDUCE_MIN (-274) -#define YY_REDUCE_MAX (1160) +#define YY_REDUCE_MIN (-251) +#define YY_REDUCE_MAX (1202) static const short yy_reduce_ofst[] = { - /* 0 */ -26, -195, 59, -122, 476, 512, 548, 598, 625, 640, - /* 10 */ 423, 667, 705, 743, 770, 778, 822, 856, 864, 869, - /* 20 */ 911, 916, 924, 968, 983, 994, 1019, 1053, 1066, 1100, - /* 30 */ 1108, 1113, 1155, 1160, -148, 175, 227, -163, -239, -201, - /* 40 */ -246, -142, 427, 206, -255, -253, -120, 54, 88, 291, - /* 50 */ 347, 429, 431, 66, -113, 62, 105, -87, 435, 457, - /* 60 */ 158, 474, 424, 469, 437, 504, 79, -208, -274, -274, - /* 70 */ -274, -204, -227, 81, -99, 91, 156, 196, 198, 202, - /* 80 */ 309, 338, 355, 376, 398, 407, 422, 436, 470, 471, - /* 90 */ 513, 514, 550, 552, -159, -132, 176, -45, -89, -38, - /* 100 */ 231, 241, 106, 221, 17, 335, 336, 303, 344, -226, - /* 110 */ 141, 162, 296, 349, 350, 359, 147, 396, 484, 454, - /* 120 */ 478, 520, 554, 565, 529, 618, 564, 551, 551, 551, - /* 130 */ 614, 549, 570, 651, 612, 672, 646, 687, 693, 675, - /* 140 */ 696, 698, 734, 689, 701, 740, 718, 710, 746, 748, - /* 150 */ 747, 749, 758, 737, 738, 739, 741, 753, 763, 765, - /* 160 */ 766, 768, 769, 771, 754, 760, 773, 779, 713, 719, - /* 170 */ 727, 777, 781, 755, 780, 756, 709, 774, 772, 735, - /* 180 */ 775, 783, 784, 750, 757, 762, 759, 551, 805, 789, - /* 190 */ 785, 776, 792, 786, 787, 614, 808, 820, 823, 813, - /* 200 */ 825, 818, 841, 824, 868, 870, 871, 843, 848, 881, - /* 210 */ 865, 886, 876, 892, 846, 878, 884, 896, 879, + /* 0 */ -208, 419, -195, -142, 461, 503, 551, 593, 42, 640, + /* 10 */ 682, 688, 464, 693, 739, 764, 806, 834, 877, 904, + /* 20 */ 919, 930, 976, 984, 989, 1018, 1043, 1070, 1078, 1114, + /* 30 */ 1143, 1148, 1156, 1202, 362, 785, 809, 116, -201, -132, + /* 40 */ -246, 29, 66, -65, -251, -249, -169, -29, 93, 94, + /* 50 */ 95, 282, 285, -90, -233, 26, -53, -173, 263, 417, + /* 60 */ 35, 283, 184, 353, 185, 418, 258, -213, -175, -175, + /* 70 */ -175, -211, 48, 238, -126, 340, 344, 369, 376, 394, + /* 80 */ 406, 413, 445, 453, 454, 459, 466, 467, 491, 501, + /* 90 */ 509, 515, 533, 549, 20, 191, 257, 269, 327, 328, + /* 100 */ 357, 415, 295, -98, 433, 183, 470, -221, -203, -197, + /* 110 */ -188, 320, 443, 532, 562, 577, 550, 414, 592, 517, + /* 120 */ 518, 586, 589, 599, 553, 641, 588, 573, 573, 573, + /* 130 */ 635, 565, 583, 666, 620, 667, 638, 691, 692, 661, + /* 140 */ 670, 671, 708, 663, 672, 714, 694, 689, 720, 722, + /* 150 */ 729, 732, 740, 713, 736, 737, 738, 741, 742, 743, + /* 160 */ 759, 761, 765, 768, 749, 784, 746, 762, 753, 750, + /* 170 */ 747, 792, 776, 756, 794, 751, 723, 771, 774, 730, + /* 180 */ 777, 775, 779, 734, 748, 754, 757, 573, 811, 793, + /* 190 */ 772, 769, 758, 770, 796, 635, 800, 808, 817, 826, + /* 200 */ 829, 837, 845, 839, 873, 866, 883, 858, 864, 882, + /* 210 */ 879, 888, 894, 898, 850, 885, 887, 900, 911, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 10 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 20 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 30 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 40 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 50 */ 1219, 1219, 1219, 1278, 1219, 1219, 1219, 1219, 1219, 1219, - /* 60 */ 1219, 1219, 1219, 1219, 1219, 1219, 1276, 1416, 1219, 1552, - /* 70 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 80 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 90 */ 1219, 1219, 1219, 1219, 1219, 1219, 1278, 1219, 1563, 1563, - /* 100 */ 1563, 1276, 1219, 1219, 1219, 1219, 1219, 1371, 1219, 1219, - /* 110 */ 1219, 1219, 1219, 1219, 1219, 1219, 1450, 1219, 1219, 1627, - /* 120 */ 1219, 1219, 1324, 1219, 1587, 1219, 1579, 1555, 1569, 1556, - /* 130 */ 1219, 1612, 1572, 1219, 1219, 1219, 1442, 1219, 1219, 1421, - /* 140 */ 1418, 1418, 1219, 1219, 1219, 1278, 1219, 1219, 1278, 1278, - /* 150 */ 1219, 1278, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 160 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1452, - /* 170 */ 1219, 1276, 1219, 1219, 1276, 1219, 1594, 1592, 1219, 1594, - /* 180 */ 1592, 1219, 1219, 1606, 1602, 1585, 1583, 1569, 1219, 1219, - /* 190 */ 1219, 1630, 1618, 1614, 1219, 1219, 1592, 1219, 1219, 1592, - /* 200 */ 1219, 1429, 1219, 1219, 1276, 1219, 1276, 1219, 1340, 1219, - /* 210 */ 1219, 1219, 1276, 1219, 1444, 1374, 1374, 1279, 1224, 1219, - /* 220 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1514, - /* 230 */ 1515, 1605, 1604, 1514, 1529, 1528, 1527, 1219, 1219, 1509, - /* 240 */ 1219, 1219, 1510, 1508, 1507, 1219, 1219, 1219, 1219, 1219, - /* 250 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1553, - /* 260 */ 1219, 1615, 1619, 1219, 1219, 1219, 1489, 1219, 1219, 1219, - /* 270 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 280 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 290 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 300 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 310 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 320 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 330 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 340 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 350 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 360 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 370 */ 1219, 1219, 1219, 1385, 1219, 1219, 1219, 1219, 1219, 1219, - /* 380 */ 1305, 1304, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 390 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 400 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 410 */ 1219, 1219, 1219, 1576, 1586, 1219, 1219, 1219, 1219, 1219, - /* 420 */ 1219, 1219, 1219, 1219, 1489, 1219, 1603, 1219, 1562, 1558, - /* 430 */ 1219, 1219, 1554, 1219, 1219, 1613, 1219, 1219, 1219, 1219, - /* 440 */ 1219, 1219, 1219, 1219, 1548, 1219, 1219, 1219, 1219, 1219, - /* 450 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 460 */ 1219, 1219, 1488, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 470 */ 1368, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 480 */ 1219, 1219, 1219, 1353, 1351, 1350, 1349, 1219, 1346, 1219, - /* 490 */ 1219, 1219, 1219, 1219, 1219, 1376, 1219, 1219, 1219, 1219, - /* 500 */ 1219, 1299, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 510 */ 1219, 1290, 1219, 1289, 1219, 1219, 1219, 1219, 1219, 1219, - /* 520 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 530 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, - /* 540 */ 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, + /* 0 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 10 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 20 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 30 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 40 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 50 */ 1221, 1221, 1221, 1280, 1221, 1221, 1221, 1221, 1221, 1221, + /* 60 */ 1221, 1221, 1221, 1221, 1221, 1221, 1278, 1418, 1221, 1555, + /* 70 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 80 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 90 */ 1221, 1221, 1221, 1221, 1221, 1221, 1280, 1221, 1566, 1566, + /* 100 */ 1566, 1278, 1221, 1221, 1221, 1221, 1221, 1373, 1221, 1221, + /* 110 */ 1221, 1221, 1221, 1221, 1221, 1221, 1452, 1221, 1221, 1630, + /* 120 */ 1221, 1221, 1221, 1326, 1590, 1221, 1582, 1558, 1572, 1559, + /* 130 */ 1221, 1615, 1575, 1221, 1221, 1221, 1444, 1221, 1221, 1423, + /* 140 */ 1420, 1420, 1221, 1221, 1221, 1280, 1221, 1221, 1280, 1280, + /* 150 */ 1221, 1280, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 160 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1454, + /* 170 */ 1221, 1278, 1221, 1221, 1278, 1221, 1597, 1595, 1221, 1597, + /* 180 */ 1595, 1221, 1221, 1609, 1605, 1588, 1586, 1572, 1221, 1221, + /* 190 */ 1221, 1633, 1621, 1617, 1221, 1221, 1595, 1221, 1221, 1595, + /* 200 */ 1221, 1431, 1221, 1221, 1278, 1221, 1278, 1221, 1342, 1221, + /* 210 */ 1221, 1221, 1278, 1221, 1446, 1376, 1376, 1281, 1226, 1221, + /* 220 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1519, + /* 230 */ 1520, 1608, 1607, 1519, 1532, 1531, 1530, 1221, 1221, 1514, + /* 240 */ 1221, 1221, 1515, 1513, 1512, 1221, 1221, 1221, 1221, 1221, + /* 250 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1556, + /* 260 */ 1221, 1618, 1622, 1221, 1221, 1221, 1491, 1221, 1221, 1221, + /* 270 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 280 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 290 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 300 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 310 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 320 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 330 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 340 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 350 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 360 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 370 */ 1221, 1221, 1221, 1387, 1221, 1221, 1221, 1221, 1221, 1221, + /* 380 */ 1307, 1306, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 390 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 400 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 410 */ 1221, 1221, 1221, 1579, 1589, 1221, 1221, 1221, 1221, 1221, + /* 420 */ 1221, 1221, 1221, 1221, 1491, 1221, 1606, 1221, 1565, 1561, + /* 430 */ 1221, 1221, 1557, 1221, 1221, 1616, 1221, 1221, 1221, 1221, + /* 440 */ 1221, 1221, 1221, 1221, 1551, 1221, 1221, 1221, 1221, 1221, + /* 450 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 460 */ 1221, 1221, 1490, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 470 */ 1370, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 480 */ 1221, 1221, 1221, 1355, 1353, 1352, 1351, 1221, 1348, 1221, + /* 490 */ 1221, 1221, 1221, 1221, 1221, 1378, 1221, 1221, 1221, 1221, + /* 500 */ 1221, 1301, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 510 */ 1221, 1292, 1221, 1291, 1221, 1221, 1221, 1221, 1221, 1221, + /* 520 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 530 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 540 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1386,146 +1388,147 @@ static const char *const yyRuleName[] = { /* 268 */ "function_name ::= NK_ID", /* 269 */ "function_name ::= FIRST", /* 270 */ "function_name ::= LAST", - /* 271 */ "table_alias ::= NK_ID", - /* 272 */ "column_alias ::= NK_ID", - /* 273 */ "user_name ::= NK_ID", - /* 274 */ "index_name ::= NK_ID", - /* 275 */ "topic_name ::= NK_ID", - /* 276 */ "stream_name ::= NK_ID", - /* 277 */ "expression ::= literal", - /* 278 */ "expression ::= pseudo_column", - /* 279 */ "expression ::= column_reference", - /* 280 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 281 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 282 */ "expression ::= function_name NK_LP expression AS type_name NK_RP", - /* 283 */ "expression ::= subquery", - /* 284 */ "expression ::= NK_LP expression NK_RP", - /* 285 */ "expression ::= NK_PLUS expression", - /* 286 */ "expression ::= NK_MINUS expression", - /* 287 */ "expression ::= expression NK_PLUS expression", - /* 288 */ "expression ::= expression NK_MINUS expression", - /* 289 */ "expression ::= expression NK_STAR expression", - /* 290 */ "expression ::= expression NK_SLASH expression", - /* 291 */ "expression ::= expression NK_REM expression", - /* 292 */ "expression_list ::= expression", - /* 293 */ "expression_list ::= expression_list NK_COMMA expression", - /* 294 */ "column_reference ::= column_name", - /* 295 */ "column_reference ::= table_name NK_DOT column_name", - /* 296 */ "pseudo_column ::= NOW", - /* 297 */ "pseudo_column ::= TODAY", - /* 298 */ "pseudo_column ::= ROWTS", - /* 299 */ "pseudo_column ::= TBNAME", - /* 300 */ "pseudo_column ::= QSTARTTS", - /* 301 */ "pseudo_column ::= QENDTS", - /* 302 */ "pseudo_column ::= WSTARTTS", - /* 303 */ "pseudo_column ::= WENDTS", - /* 304 */ "pseudo_column ::= WDURATION", - /* 305 */ "predicate ::= expression compare_op expression", - /* 306 */ "predicate ::= expression BETWEEN expression AND expression", - /* 307 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 308 */ "predicate ::= expression IS NULL", - /* 309 */ "predicate ::= expression IS NOT NULL", - /* 310 */ "predicate ::= expression in_op in_predicate_value", - /* 311 */ "compare_op ::= NK_LT", - /* 312 */ "compare_op ::= NK_GT", - /* 313 */ "compare_op ::= NK_LE", - /* 314 */ "compare_op ::= NK_GE", - /* 315 */ "compare_op ::= NK_NE", - /* 316 */ "compare_op ::= NK_EQ", - /* 317 */ "compare_op ::= LIKE", - /* 318 */ "compare_op ::= NOT LIKE", - /* 319 */ "compare_op ::= MATCH", - /* 320 */ "compare_op ::= NMATCH", - /* 321 */ "in_op ::= IN", - /* 322 */ "in_op ::= NOT IN", - /* 323 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 324 */ "boolean_value_expression ::= boolean_primary", - /* 325 */ "boolean_value_expression ::= NOT boolean_primary", - /* 326 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 327 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 328 */ "boolean_primary ::= predicate", - /* 329 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 330 */ "common_expression ::= expression", - /* 331 */ "common_expression ::= boolean_value_expression", - /* 332 */ "from_clause ::= FROM table_reference_list", - /* 333 */ "table_reference_list ::= table_reference", - /* 334 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 335 */ "table_reference ::= table_primary", - /* 336 */ "table_reference ::= joined_table", - /* 337 */ "table_primary ::= table_name alias_opt", - /* 338 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 339 */ "table_primary ::= subquery alias_opt", - /* 340 */ "table_primary ::= parenthesized_joined_table", - /* 341 */ "alias_opt ::=", - /* 342 */ "alias_opt ::= table_alias", - /* 343 */ "alias_opt ::= AS table_alias", - /* 344 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 345 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 346 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 347 */ "join_type ::=", - /* 348 */ "join_type ::= INNER", - /* 349 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 350 */ "set_quantifier_opt ::=", - /* 351 */ "set_quantifier_opt ::= DISTINCT", - /* 352 */ "set_quantifier_opt ::= ALL", - /* 353 */ "select_list ::= NK_STAR", - /* 354 */ "select_list ::= select_sublist", - /* 355 */ "select_sublist ::= select_item", - /* 356 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 357 */ "select_item ::= common_expression", - /* 358 */ "select_item ::= common_expression column_alias", - /* 359 */ "select_item ::= common_expression AS column_alias", - /* 360 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 361 */ "where_clause_opt ::=", - /* 362 */ "where_clause_opt ::= WHERE search_condition", - /* 363 */ "partition_by_clause_opt ::=", - /* 364 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 365 */ "twindow_clause_opt ::=", - /* 366 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 367 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 370 */ "sliding_opt ::=", - /* 371 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 372 */ "fill_opt ::=", - /* 373 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 374 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 375 */ "fill_mode ::= NONE", - /* 376 */ "fill_mode ::= PREV", - /* 377 */ "fill_mode ::= NULL", - /* 378 */ "fill_mode ::= LINEAR", - /* 379 */ "fill_mode ::= NEXT", - /* 380 */ "group_by_clause_opt ::=", - /* 381 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 382 */ "group_by_list ::= expression", - /* 383 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 384 */ "having_clause_opt ::=", - /* 385 */ "having_clause_opt ::= HAVING search_condition", - /* 386 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 387 */ "query_expression_body ::= query_primary", - /* 388 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 389 */ "query_primary ::= query_specification", - /* 390 */ "order_by_clause_opt ::=", - /* 391 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 392 */ "slimit_clause_opt ::=", - /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 396 */ "limit_clause_opt ::=", - /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 400 */ "subquery ::= NK_LP query_expression NK_RP", - /* 401 */ "search_condition ::= common_expression", - /* 402 */ "sort_specification_list ::= sort_specification", - /* 403 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 404 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 405 */ "ordering_specification_opt ::=", - /* 406 */ "ordering_specification_opt ::= ASC", - /* 407 */ "ordering_specification_opt ::= DESC", - /* 408 */ "null_ordering_opt ::=", - /* 409 */ "null_ordering_opt ::= NULLS FIRST", - /* 410 */ "null_ordering_opt ::= NULLS LAST", + /* 271 */ "function_name ::= NOW", + /* 272 */ "function_name ::= TODAY", + /* 273 */ "table_alias ::= NK_ID", + /* 274 */ "column_alias ::= NK_ID", + /* 275 */ "user_name ::= NK_ID", + /* 276 */ "index_name ::= NK_ID", + /* 277 */ "topic_name ::= NK_ID", + /* 278 */ "stream_name ::= NK_ID", + /* 279 */ "expression ::= literal", + /* 280 */ "expression ::= pseudo_column", + /* 281 */ "expression ::= column_reference", + /* 282 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 283 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 284 */ "expression ::= function_name NK_LP NK_RP", + /* 285 */ "expression ::= function_name NK_LP expression AS type_name NK_RP", + /* 286 */ "expression ::= subquery", + /* 287 */ "expression ::= NK_LP expression NK_RP", + /* 288 */ "expression ::= NK_PLUS expression", + /* 289 */ "expression ::= NK_MINUS expression", + /* 290 */ "expression ::= expression NK_PLUS expression", + /* 291 */ "expression ::= expression NK_MINUS expression", + /* 292 */ "expression ::= expression NK_STAR expression", + /* 293 */ "expression ::= expression NK_SLASH expression", + /* 294 */ "expression ::= expression NK_REM expression", + /* 295 */ "expression_list ::= expression", + /* 296 */ "expression_list ::= expression_list NK_COMMA expression", + /* 297 */ "column_reference ::= column_name", + /* 298 */ "column_reference ::= table_name NK_DOT column_name", + /* 299 */ "pseudo_column ::= ROWTS", + /* 300 */ "pseudo_column ::= TBNAME", + /* 301 */ "pseudo_column ::= QSTARTTS", + /* 302 */ "pseudo_column ::= QENDTS", + /* 303 */ "pseudo_column ::= WSTARTTS", + /* 304 */ "pseudo_column ::= WENDTS", + /* 305 */ "pseudo_column ::= WDURATION", + /* 306 */ "predicate ::= expression compare_op expression", + /* 307 */ "predicate ::= expression BETWEEN expression AND expression", + /* 308 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 309 */ "predicate ::= expression IS NULL", + /* 310 */ "predicate ::= expression IS NOT NULL", + /* 311 */ "predicate ::= expression in_op in_predicate_value", + /* 312 */ "compare_op ::= NK_LT", + /* 313 */ "compare_op ::= NK_GT", + /* 314 */ "compare_op ::= NK_LE", + /* 315 */ "compare_op ::= NK_GE", + /* 316 */ "compare_op ::= NK_NE", + /* 317 */ "compare_op ::= NK_EQ", + /* 318 */ "compare_op ::= LIKE", + /* 319 */ "compare_op ::= NOT LIKE", + /* 320 */ "compare_op ::= MATCH", + /* 321 */ "compare_op ::= NMATCH", + /* 322 */ "in_op ::= IN", + /* 323 */ "in_op ::= NOT IN", + /* 324 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 325 */ "boolean_value_expression ::= boolean_primary", + /* 326 */ "boolean_value_expression ::= NOT boolean_primary", + /* 327 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 328 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 329 */ "boolean_primary ::= predicate", + /* 330 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 331 */ "common_expression ::= expression", + /* 332 */ "common_expression ::= boolean_value_expression", + /* 333 */ "from_clause ::= FROM table_reference_list", + /* 334 */ "table_reference_list ::= table_reference", + /* 335 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 336 */ "table_reference ::= table_primary", + /* 337 */ "table_reference ::= joined_table", + /* 338 */ "table_primary ::= table_name alias_opt", + /* 339 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 340 */ "table_primary ::= subquery alias_opt", + /* 341 */ "table_primary ::= parenthesized_joined_table", + /* 342 */ "alias_opt ::=", + /* 343 */ "alias_opt ::= table_alias", + /* 344 */ "alias_opt ::= AS table_alias", + /* 345 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 346 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 347 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 348 */ "join_type ::=", + /* 349 */ "join_type ::= INNER", + /* 350 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 351 */ "set_quantifier_opt ::=", + /* 352 */ "set_quantifier_opt ::= DISTINCT", + /* 353 */ "set_quantifier_opt ::= ALL", + /* 354 */ "select_list ::= NK_STAR", + /* 355 */ "select_list ::= select_sublist", + /* 356 */ "select_sublist ::= select_item", + /* 357 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 358 */ "select_item ::= common_expression", + /* 359 */ "select_item ::= common_expression column_alias", + /* 360 */ "select_item ::= common_expression AS column_alias", + /* 361 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 362 */ "where_clause_opt ::=", + /* 363 */ "where_clause_opt ::= WHERE search_condition", + /* 364 */ "partition_by_clause_opt ::=", + /* 365 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 366 */ "twindow_clause_opt ::=", + /* 367 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 368 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 370 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 371 */ "sliding_opt ::=", + /* 372 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 373 */ "fill_opt ::=", + /* 374 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 375 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 376 */ "fill_mode ::= NONE", + /* 377 */ "fill_mode ::= PREV", + /* 378 */ "fill_mode ::= NULL", + /* 379 */ "fill_mode ::= LINEAR", + /* 380 */ "fill_mode ::= NEXT", + /* 381 */ "group_by_clause_opt ::=", + /* 382 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 383 */ "group_by_list ::= expression", + /* 384 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 385 */ "having_clause_opt ::=", + /* 386 */ "having_clause_opt ::= HAVING search_condition", + /* 387 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 388 */ "query_expression_body ::= query_primary", + /* 389 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 390 */ "query_primary ::= query_specification", + /* 391 */ "order_by_clause_opt ::=", + /* 392 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 393 */ "slimit_clause_opt ::=", + /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 396 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 397 */ "limit_clause_opt ::=", + /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 400 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 401 */ "subquery ::= NK_LP query_expression NK_RP", + /* 402 */ "search_condition ::= common_expression", + /* 403 */ "sort_specification_list ::= sort_specification", + /* 404 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 405 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 406 */ "ordering_specification_opt ::=", + /* 407 */ "ordering_specification_opt ::= ASC", + /* 408 */ "ordering_specification_opt ::= DESC", + /* 409 */ "null_ordering_opt ::=", + /* 410 */ "null_ordering_opt ::= NULLS FIRST", + /* 411 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2363,146 +2366,147 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 253, /* (268) function_name ::= NK_ID */ 253, /* (269) function_name ::= FIRST */ 253, /* (270) function_name ::= LAST */ - 271, /* (271) table_alias ::= NK_ID */ - 272, /* (272) column_alias ::= NK_ID */ - 214, /* (273) user_name ::= NK_ID */ - 254, /* (274) index_name ::= NK_ID */ - 261, /* (275) topic_name ::= NK_ID */ - 267, /* (276) stream_name ::= NK_ID */ - 273, /* (277) expression ::= literal */ - 273, /* (278) expression ::= pseudo_column */ - 273, /* (279) expression ::= column_reference */ - 273, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ - 273, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ - 273, /* (282) expression ::= function_name NK_LP expression AS type_name NK_RP */ - 273, /* (283) expression ::= subquery */ - 273, /* (284) expression ::= NK_LP expression NK_RP */ - 273, /* (285) expression ::= NK_PLUS expression */ - 273, /* (286) expression ::= NK_MINUS expression */ - 273, /* (287) expression ::= expression NK_PLUS expression */ - 273, /* (288) expression ::= expression NK_MINUS expression */ - 273, /* (289) expression ::= expression NK_STAR expression */ - 273, /* (290) expression ::= expression NK_SLASH expression */ - 273, /* (291) expression ::= expression NK_REM expression */ - 260, /* (292) expression_list ::= expression */ - 260, /* (293) expression_list ::= expression_list NK_COMMA expression */ - 275, /* (294) column_reference ::= column_name */ - 275, /* (295) column_reference ::= table_name NK_DOT column_name */ - 274, /* (296) pseudo_column ::= NOW */ - 274, /* (297) pseudo_column ::= TODAY */ - 274, /* (298) pseudo_column ::= ROWTS */ - 274, /* (299) pseudo_column ::= TBNAME */ - 274, /* (300) pseudo_column ::= QSTARTTS */ - 274, /* (301) pseudo_column ::= QENDTS */ - 274, /* (302) pseudo_column ::= WSTARTTS */ - 274, /* (303) pseudo_column ::= WENDTS */ - 274, /* (304) pseudo_column ::= WDURATION */ - 277, /* (305) predicate ::= expression compare_op expression */ - 277, /* (306) predicate ::= expression BETWEEN expression AND expression */ - 277, /* (307) predicate ::= expression NOT BETWEEN expression AND expression */ - 277, /* (308) predicate ::= expression IS NULL */ - 277, /* (309) predicate ::= expression IS NOT NULL */ - 277, /* (310) predicate ::= expression in_op in_predicate_value */ - 278, /* (311) compare_op ::= NK_LT */ - 278, /* (312) compare_op ::= NK_GT */ - 278, /* (313) compare_op ::= NK_LE */ - 278, /* (314) compare_op ::= NK_GE */ - 278, /* (315) compare_op ::= NK_NE */ - 278, /* (316) compare_op ::= NK_EQ */ - 278, /* (317) compare_op ::= LIKE */ - 278, /* (318) compare_op ::= NOT LIKE */ - 278, /* (319) compare_op ::= MATCH */ - 278, /* (320) compare_op ::= NMATCH */ - 279, /* (321) in_op ::= IN */ - 279, /* (322) in_op ::= NOT IN */ - 280, /* (323) in_predicate_value ::= NK_LP expression_list NK_RP */ - 281, /* (324) boolean_value_expression ::= boolean_primary */ - 281, /* (325) boolean_value_expression ::= NOT boolean_primary */ - 281, /* (326) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 281, /* (327) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 282, /* (328) boolean_primary ::= predicate */ - 282, /* (329) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 283, /* (330) common_expression ::= expression */ - 283, /* (331) common_expression ::= boolean_value_expression */ - 284, /* (332) from_clause ::= FROM table_reference_list */ - 285, /* (333) table_reference_list ::= table_reference */ - 285, /* (334) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 286, /* (335) table_reference ::= table_primary */ - 286, /* (336) table_reference ::= joined_table */ - 287, /* (337) table_primary ::= table_name alias_opt */ - 287, /* (338) table_primary ::= db_name NK_DOT table_name alias_opt */ - 287, /* (339) table_primary ::= subquery alias_opt */ - 287, /* (340) table_primary ::= parenthesized_joined_table */ - 289, /* (341) alias_opt ::= */ - 289, /* (342) alias_opt ::= table_alias */ - 289, /* (343) alias_opt ::= AS table_alias */ - 290, /* (344) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 290, /* (345) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 288, /* (346) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 291, /* (347) join_type ::= */ - 291, /* (348) join_type ::= INNER */ - 293, /* (349) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 294, /* (350) set_quantifier_opt ::= */ - 294, /* (351) set_quantifier_opt ::= DISTINCT */ - 294, /* (352) set_quantifier_opt ::= ALL */ - 295, /* (353) select_list ::= NK_STAR */ - 295, /* (354) select_list ::= select_sublist */ - 301, /* (355) select_sublist ::= select_item */ - 301, /* (356) select_sublist ::= select_sublist NK_COMMA select_item */ - 302, /* (357) select_item ::= common_expression */ - 302, /* (358) select_item ::= common_expression column_alias */ - 302, /* (359) select_item ::= common_expression AS column_alias */ - 302, /* (360) select_item ::= table_name NK_DOT NK_STAR */ - 296, /* (361) where_clause_opt ::= */ - 296, /* (362) where_clause_opt ::= WHERE search_condition */ - 297, /* (363) partition_by_clause_opt ::= */ - 297, /* (364) partition_by_clause_opt ::= PARTITION BY expression_list */ - 298, /* (365) twindow_clause_opt ::= */ - 298, /* (366) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 298, /* (367) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - 298, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 298, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 258, /* (370) sliding_opt ::= */ - 258, /* (371) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 303, /* (372) fill_opt ::= */ - 303, /* (373) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 303, /* (374) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - 304, /* (375) fill_mode ::= NONE */ - 304, /* (376) fill_mode ::= PREV */ - 304, /* (377) fill_mode ::= NULL */ - 304, /* (378) fill_mode ::= LINEAR */ - 304, /* (379) fill_mode ::= NEXT */ - 299, /* (380) group_by_clause_opt ::= */ - 299, /* (381) group_by_clause_opt ::= GROUP BY group_by_list */ - 305, /* (382) group_by_list ::= expression */ - 305, /* (383) group_by_list ::= group_by_list NK_COMMA expression */ - 300, /* (384) having_clause_opt ::= */ - 300, /* (385) having_clause_opt ::= HAVING search_condition */ - 262, /* (386) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 306, /* (387) query_expression_body ::= query_primary */ - 306, /* (388) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - 310, /* (389) query_primary ::= query_specification */ - 307, /* (390) order_by_clause_opt ::= */ - 307, /* (391) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 308, /* (392) slimit_clause_opt ::= */ - 308, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 308, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 308, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 309, /* (396) limit_clause_opt ::= */ - 309, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER */ - 309, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 309, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 276, /* (400) subquery ::= NK_LP query_expression NK_RP */ - 292, /* (401) search_condition ::= common_expression */ - 311, /* (402) sort_specification_list ::= sort_specification */ - 311, /* (403) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 312, /* (404) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - 313, /* (405) ordering_specification_opt ::= */ - 313, /* (406) ordering_specification_opt ::= ASC */ - 313, /* (407) ordering_specification_opt ::= DESC */ - 314, /* (408) null_ordering_opt ::= */ - 314, /* (409) null_ordering_opt ::= NULLS FIRST */ - 314, /* (410) null_ordering_opt ::= NULLS LAST */ + 253, /* (271) function_name ::= NOW */ + 253, /* (272) function_name ::= TODAY */ + 271, /* (273) table_alias ::= NK_ID */ + 272, /* (274) column_alias ::= NK_ID */ + 214, /* (275) user_name ::= NK_ID */ + 254, /* (276) index_name ::= NK_ID */ + 261, /* (277) topic_name ::= NK_ID */ + 267, /* (278) stream_name ::= NK_ID */ + 273, /* (279) expression ::= literal */ + 273, /* (280) expression ::= pseudo_column */ + 273, /* (281) expression ::= column_reference */ + 273, /* (282) expression ::= function_name NK_LP expression_list NK_RP */ + 273, /* (283) expression ::= function_name NK_LP NK_STAR NK_RP */ + 273, /* (284) expression ::= function_name NK_LP NK_RP */ + 273, /* (285) expression ::= function_name NK_LP expression AS type_name NK_RP */ + 273, /* (286) expression ::= subquery */ + 273, /* (287) expression ::= NK_LP expression NK_RP */ + 273, /* (288) expression ::= NK_PLUS expression */ + 273, /* (289) expression ::= NK_MINUS expression */ + 273, /* (290) expression ::= expression NK_PLUS expression */ + 273, /* (291) expression ::= expression NK_MINUS expression */ + 273, /* (292) expression ::= expression NK_STAR expression */ + 273, /* (293) expression ::= expression NK_SLASH expression */ + 273, /* (294) expression ::= expression NK_REM expression */ + 260, /* (295) expression_list ::= expression */ + 260, /* (296) expression_list ::= expression_list NK_COMMA expression */ + 275, /* (297) column_reference ::= column_name */ + 275, /* (298) column_reference ::= table_name NK_DOT column_name */ + 274, /* (299) pseudo_column ::= ROWTS */ + 274, /* (300) pseudo_column ::= TBNAME */ + 274, /* (301) pseudo_column ::= QSTARTTS */ + 274, /* (302) pseudo_column ::= QENDTS */ + 274, /* (303) pseudo_column ::= WSTARTTS */ + 274, /* (304) pseudo_column ::= WENDTS */ + 274, /* (305) pseudo_column ::= WDURATION */ + 277, /* (306) predicate ::= expression compare_op expression */ + 277, /* (307) predicate ::= expression BETWEEN expression AND expression */ + 277, /* (308) predicate ::= expression NOT BETWEEN expression AND expression */ + 277, /* (309) predicate ::= expression IS NULL */ + 277, /* (310) predicate ::= expression IS NOT NULL */ + 277, /* (311) predicate ::= expression in_op in_predicate_value */ + 278, /* (312) compare_op ::= NK_LT */ + 278, /* (313) compare_op ::= NK_GT */ + 278, /* (314) compare_op ::= NK_LE */ + 278, /* (315) compare_op ::= NK_GE */ + 278, /* (316) compare_op ::= NK_NE */ + 278, /* (317) compare_op ::= NK_EQ */ + 278, /* (318) compare_op ::= LIKE */ + 278, /* (319) compare_op ::= NOT LIKE */ + 278, /* (320) compare_op ::= MATCH */ + 278, /* (321) compare_op ::= NMATCH */ + 279, /* (322) in_op ::= IN */ + 279, /* (323) in_op ::= NOT IN */ + 280, /* (324) in_predicate_value ::= NK_LP expression_list NK_RP */ + 281, /* (325) boolean_value_expression ::= boolean_primary */ + 281, /* (326) boolean_value_expression ::= NOT boolean_primary */ + 281, /* (327) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 281, /* (328) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 282, /* (329) boolean_primary ::= predicate */ + 282, /* (330) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 283, /* (331) common_expression ::= expression */ + 283, /* (332) common_expression ::= boolean_value_expression */ + 284, /* (333) from_clause ::= FROM table_reference_list */ + 285, /* (334) table_reference_list ::= table_reference */ + 285, /* (335) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 286, /* (336) table_reference ::= table_primary */ + 286, /* (337) table_reference ::= joined_table */ + 287, /* (338) table_primary ::= table_name alias_opt */ + 287, /* (339) table_primary ::= db_name NK_DOT table_name alias_opt */ + 287, /* (340) table_primary ::= subquery alias_opt */ + 287, /* (341) table_primary ::= parenthesized_joined_table */ + 289, /* (342) alias_opt ::= */ + 289, /* (343) alias_opt ::= table_alias */ + 289, /* (344) alias_opt ::= AS table_alias */ + 290, /* (345) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 290, /* (346) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 288, /* (347) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 291, /* (348) join_type ::= */ + 291, /* (349) join_type ::= INNER */ + 293, /* (350) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 294, /* (351) set_quantifier_opt ::= */ + 294, /* (352) set_quantifier_opt ::= DISTINCT */ + 294, /* (353) set_quantifier_opt ::= ALL */ + 295, /* (354) select_list ::= NK_STAR */ + 295, /* (355) select_list ::= select_sublist */ + 301, /* (356) select_sublist ::= select_item */ + 301, /* (357) select_sublist ::= select_sublist NK_COMMA select_item */ + 302, /* (358) select_item ::= common_expression */ + 302, /* (359) select_item ::= common_expression column_alias */ + 302, /* (360) select_item ::= common_expression AS column_alias */ + 302, /* (361) select_item ::= table_name NK_DOT NK_STAR */ + 296, /* (362) where_clause_opt ::= */ + 296, /* (363) where_clause_opt ::= WHERE search_condition */ + 297, /* (364) partition_by_clause_opt ::= */ + 297, /* (365) partition_by_clause_opt ::= PARTITION BY expression_list */ + 298, /* (366) twindow_clause_opt ::= */ + 298, /* (367) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 298, /* (368) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + 298, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 298, /* (370) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 258, /* (371) sliding_opt ::= */ + 258, /* (372) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 303, /* (373) fill_opt ::= */ + 303, /* (374) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 303, /* (375) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + 304, /* (376) fill_mode ::= NONE */ + 304, /* (377) fill_mode ::= PREV */ + 304, /* (378) fill_mode ::= NULL */ + 304, /* (379) fill_mode ::= LINEAR */ + 304, /* (380) fill_mode ::= NEXT */ + 299, /* (381) group_by_clause_opt ::= */ + 299, /* (382) group_by_clause_opt ::= GROUP BY group_by_list */ + 305, /* (383) group_by_list ::= expression */ + 305, /* (384) group_by_list ::= group_by_list NK_COMMA expression */ + 300, /* (385) having_clause_opt ::= */ + 300, /* (386) having_clause_opt ::= HAVING search_condition */ + 262, /* (387) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 306, /* (388) query_expression_body ::= query_primary */ + 306, /* (389) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + 310, /* (390) query_primary ::= query_specification */ + 307, /* (391) order_by_clause_opt ::= */ + 307, /* (392) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 308, /* (393) slimit_clause_opt ::= */ + 308, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 308, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 308, /* (396) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 309, /* (397) limit_clause_opt ::= */ + 309, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER */ + 309, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 309, /* (400) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 276, /* (401) subquery ::= NK_LP query_expression NK_RP */ + 292, /* (402) search_condition ::= common_expression */ + 311, /* (403) sort_specification_list ::= sort_specification */ + 311, /* (404) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 312, /* (405) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + 313, /* (406) ordering_specification_opt ::= */ + 313, /* (407) ordering_specification_opt ::= ASC */ + 313, /* (408) ordering_specification_opt ::= DESC */ + 314, /* (409) null_ordering_opt ::= */ + 314, /* (410) null_ordering_opt ::= NULLS FIRST */ + 314, /* (411) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2779,146 +2783,147 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (268) function_name ::= NK_ID */ -1, /* (269) function_name ::= FIRST */ -1, /* (270) function_name ::= LAST */ - -1, /* (271) table_alias ::= NK_ID */ - -1, /* (272) column_alias ::= NK_ID */ - -1, /* (273) user_name ::= NK_ID */ - -1, /* (274) index_name ::= NK_ID */ - -1, /* (275) topic_name ::= NK_ID */ - -1, /* (276) stream_name ::= NK_ID */ - -1, /* (277) expression ::= literal */ - -1, /* (278) expression ::= pseudo_column */ - -1, /* (279) expression ::= column_reference */ - -4, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ - -6, /* (282) expression ::= function_name NK_LP expression AS type_name NK_RP */ - -1, /* (283) expression ::= subquery */ - -3, /* (284) expression ::= NK_LP expression NK_RP */ - -2, /* (285) expression ::= NK_PLUS expression */ - -2, /* (286) expression ::= NK_MINUS expression */ - -3, /* (287) expression ::= expression NK_PLUS expression */ - -3, /* (288) expression ::= expression NK_MINUS expression */ - -3, /* (289) expression ::= expression NK_STAR expression */ - -3, /* (290) expression ::= expression NK_SLASH expression */ - -3, /* (291) expression ::= expression NK_REM expression */ - -1, /* (292) expression_list ::= expression */ - -3, /* (293) expression_list ::= expression_list NK_COMMA expression */ - -1, /* (294) column_reference ::= column_name */ - -3, /* (295) column_reference ::= table_name NK_DOT column_name */ - -1, /* (296) pseudo_column ::= NOW */ - -1, /* (297) pseudo_column ::= TODAY */ - -1, /* (298) pseudo_column ::= ROWTS */ - -1, /* (299) pseudo_column ::= TBNAME */ - -1, /* (300) pseudo_column ::= QSTARTTS */ - -1, /* (301) pseudo_column ::= QENDTS */ - -1, /* (302) pseudo_column ::= WSTARTTS */ - -1, /* (303) pseudo_column ::= WENDTS */ - -1, /* (304) pseudo_column ::= WDURATION */ - -3, /* (305) predicate ::= expression compare_op expression */ - -5, /* (306) predicate ::= expression BETWEEN expression AND expression */ - -6, /* (307) predicate ::= expression NOT BETWEEN expression AND expression */ - -3, /* (308) predicate ::= expression IS NULL */ - -4, /* (309) predicate ::= expression IS NOT NULL */ - -3, /* (310) predicate ::= expression in_op in_predicate_value */ - -1, /* (311) compare_op ::= NK_LT */ - -1, /* (312) compare_op ::= NK_GT */ - -1, /* (313) compare_op ::= NK_LE */ - -1, /* (314) compare_op ::= NK_GE */ - -1, /* (315) compare_op ::= NK_NE */ - -1, /* (316) compare_op ::= NK_EQ */ - -1, /* (317) compare_op ::= LIKE */ - -2, /* (318) compare_op ::= NOT LIKE */ - -1, /* (319) compare_op ::= MATCH */ - -1, /* (320) compare_op ::= NMATCH */ - -1, /* (321) in_op ::= IN */ - -2, /* (322) in_op ::= NOT IN */ - -3, /* (323) in_predicate_value ::= NK_LP expression_list NK_RP */ - -1, /* (324) boolean_value_expression ::= boolean_primary */ - -2, /* (325) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (326) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (327) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (328) boolean_primary ::= predicate */ - -3, /* (329) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (330) common_expression ::= expression */ - -1, /* (331) common_expression ::= boolean_value_expression */ - -2, /* (332) from_clause ::= FROM table_reference_list */ - -1, /* (333) table_reference_list ::= table_reference */ - -3, /* (334) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (335) table_reference ::= table_primary */ - -1, /* (336) table_reference ::= joined_table */ - -2, /* (337) table_primary ::= table_name alias_opt */ - -4, /* (338) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (339) table_primary ::= subquery alias_opt */ - -1, /* (340) table_primary ::= parenthesized_joined_table */ - 0, /* (341) alias_opt ::= */ - -1, /* (342) alias_opt ::= table_alias */ - -2, /* (343) alias_opt ::= AS table_alias */ - -3, /* (344) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (345) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (346) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (347) join_type ::= */ - -1, /* (348) join_type ::= INNER */ - -9, /* (349) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (350) set_quantifier_opt ::= */ - -1, /* (351) set_quantifier_opt ::= DISTINCT */ - -1, /* (352) set_quantifier_opt ::= ALL */ - -1, /* (353) select_list ::= NK_STAR */ - -1, /* (354) select_list ::= select_sublist */ - -1, /* (355) select_sublist ::= select_item */ - -3, /* (356) select_sublist ::= select_sublist NK_COMMA select_item */ - -1, /* (357) select_item ::= common_expression */ - -2, /* (358) select_item ::= common_expression column_alias */ - -3, /* (359) select_item ::= common_expression AS column_alias */ - -3, /* (360) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (361) where_clause_opt ::= */ - -2, /* (362) where_clause_opt ::= WHERE search_condition */ - 0, /* (363) partition_by_clause_opt ::= */ - -3, /* (364) partition_by_clause_opt ::= PARTITION BY expression_list */ - 0, /* (365) twindow_clause_opt ::= */ - -6, /* (366) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (367) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - -6, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 0, /* (370) sliding_opt ::= */ - -4, /* (371) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (372) fill_opt ::= */ - -4, /* (373) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (374) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - -1, /* (375) fill_mode ::= NONE */ - -1, /* (376) fill_mode ::= PREV */ - -1, /* (377) fill_mode ::= NULL */ - -1, /* (378) fill_mode ::= LINEAR */ - -1, /* (379) fill_mode ::= NEXT */ - 0, /* (380) group_by_clause_opt ::= */ - -3, /* (381) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (382) group_by_list ::= expression */ - -3, /* (383) group_by_list ::= group_by_list NK_COMMA expression */ - 0, /* (384) having_clause_opt ::= */ - -2, /* (385) having_clause_opt ::= HAVING search_condition */ - -4, /* (386) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (387) query_expression_body ::= query_primary */ - -4, /* (388) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - -1, /* (389) query_primary ::= query_specification */ - 0, /* (390) order_by_clause_opt ::= */ - -3, /* (391) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (392) slimit_clause_opt ::= */ - -2, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (396) limit_clause_opt ::= */ - -2, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (400) subquery ::= NK_LP query_expression NK_RP */ - -1, /* (401) search_condition ::= common_expression */ - -1, /* (402) sort_specification_list ::= sort_specification */ - -3, /* (403) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (404) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - 0, /* (405) ordering_specification_opt ::= */ - -1, /* (406) ordering_specification_opt ::= ASC */ - -1, /* (407) ordering_specification_opt ::= DESC */ - 0, /* (408) null_ordering_opt ::= */ - -2, /* (409) null_ordering_opt ::= NULLS FIRST */ - -2, /* (410) null_ordering_opt ::= NULLS LAST */ + -1, /* (271) function_name ::= NOW */ + -1, /* (272) function_name ::= TODAY */ + -1, /* (273) table_alias ::= NK_ID */ + -1, /* (274) column_alias ::= NK_ID */ + -1, /* (275) user_name ::= NK_ID */ + -1, /* (276) index_name ::= NK_ID */ + -1, /* (277) topic_name ::= NK_ID */ + -1, /* (278) stream_name ::= NK_ID */ + -1, /* (279) expression ::= literal */ + -1, /* (280) expression ::= pseudo_column */ + -1, /* (281) expression ::= column_reference */ + -4, /* (282) expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (283) expression ::= function_name NK_LP NK_STAR NK_RP */ + -3, /* (284) expression ::= function_name NK_LP NK_RP */ + -6, /* (285) expression ::= function_name NK_LP expression AS type_name NK_RP */ + -1, /* (286) expression ::= subquery */ + -3, /* (287) expression ::= NK_LP expression NK_RP */ + -2, /* (288) expression ::= NK_PLUS expression */ + -2, /* (289) expression ::= NK_MINUS expression */ + -3, /* (290) expression ::= expression NK_PLUS expression */ + -3, /* (291) expression ::= expression NK_MINUS expression */ + -3, /* (292) expression ::= expression NK_STAR expression */ + -3, /* (293) expression ::= expression NK_SLASH expression */ + -3, /* (294) expression ::= expression NK_REM expression */ + -1, /* (295) expression_list ::= expression */ + -3, /* (296) expression_list ::= expression_list NK_COMMA expression */ + -1, /* (297) column_reference ::= column_name */ + -3, /* (298) column_reference ::= table_name NK_DOT column_name */ + -1, /* (299) pseudo_column ::= ROWTS */ + -1, /* (300) pseudo_column ::= TBNAME */ + -1, /* (301) pseudo_column ::= QSTARTTS */ + -1, /* (302) pseudo_column ::= QENDTS */ + -1, /* (303) pseudo_column ::= WSTARTTS */ + -1, /* (304) pseudo_column ::= WENDTS */ + -1, /* (305) pseudo_column ::= WDURATION */ + -3, /* (306) predicate ::= expression compare_op expression */ + -5, /* (307) predicate ::= expression BETWEEN expression AND expression */ + -6, /* (308) predicate ::= expression NOT BETWEEN expression AND expression */ + -3, /* (309) predicate ::= expression IS NULL */ + -4, /* (310) predicate ::= expression IS NOT NULL */ + -3, /* (311) predicate ::= expression in_op in_predicate_value */ + -1, /* (312) compare_op ::= NK_LT */ + -1, /* (313) compare_op ::= NK_GT */ + -1, /* (314) compare_op ::= NK_LE */ + -1, /* (315) compare_op ::= NK_GE */ + -1, /* (316) compare_op ::= NK_NE */ + -1, /* (317) compare_op ::= NK_EQ */ + -1, /* (318) compare_op ::= LIKE */ + -2, /* (319) compare_op ::= NOT LIKE */ + -1, /* (320) compare_op ::= MATCH */ + -1, /* (321) compare_op ::= NMATCH */ + -1, /* (322) in_op ::= IN */ + -2, /* (323) in_op ::= NOT IN */ + -3, /* (324) in_predicate_value ::= NK_LP expression_list NK_RP */ + -1, /* (325) boolean_value_expression ::= boolean_primary */ + -2, /* (326) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (327) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (328) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (329) boolean_primary ::= predicate */ + -3, /* (330) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (331) common_expression ::= expression */ + -1, /* (332) common_expression ::= boolean_value_expression */ + -2, /* (333) from_clause ::= FROM table_reference_list */ + -1, /* (334) table_reference_list ::= table_reference */ + -3, /* (335) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (336) table_reference ::= table_primary */ + -1, /* (337) table_reference ::= joined_table */ + -2, /* (338) table_primary ::= table_name alias_opt */ + -4, /* (339) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (340) table_primary ::= subquery alias_opt */ + -1, /* (341) table_primary ::= parenthesized_joined_table */ + 0, /* (342) alias_opt ::= */ + -1, /* (343) alias_opt ::= table_alias */ + -2, /* (344) alias_opt ::= AS table_alias */ + -3, /* (345) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (346) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (347) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (348) join_type ::= */ + -1, /* (349) join_type ::= INNER */ + -9, /* (350) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (351) set_quantifier_opt ::= */ + -1, /* (352) set_quantifier_opt ::= DISTINCT */ + -1, /* (353) set_quantifier_opt ::= ALL */ + -1, /* (354) select_list ::= NK_STAR */ + -1, /* (355) select_list ::= select_sublist */ + -1, /* (356) select_sublist ::= select_item */ + -3, /* (357) select_sublist ::= select_sublist NK_COMMA select_item */ + -1, /* (358) select_item ::= common_expression */ + -2, /* (359) select_item ::= common_expression column_alias */ + -3, /* (360) select_item ::= common_expression AS column_alias */ + -3, /* (361) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (362) where_clause_opt ::= */ + -2, /* (363) where_clause_opt ::= WHERE search_condition */ + 0, /* (364) partition_by_clause_opt ::= */ + -3, /* (365) partition_by_clause_opt ::= PARTITION BY expression_list */ + 0, /* (366) twindow_clause_opt ::= */ + -6, /* (367) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (368) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + -6, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (370) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 0, /* (371) sliding_opt ::= */ + -4, /* (372) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (373) fill_opt ::= */ + -4, /* (374) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (375) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + -1, /* (376) fill_mode ::= NONE */ + -1, /* (377) fill_mode ::= PREV */ + -1, /* (378) fill_mode ::= NULL */ + -1, /* (379) fill_mode ::= LINEAR */ + -1, /* (380) fill_mode ::= NEXT */ + 0, /* (381) group_by_clause_opt ::= */ + -3, /* (382) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (383) group_by_list ::= expression */ + -3, /* (384) group_by_list ::= group_by_list NK_COMMA expression */ + 0, /* (385) having_clause_opt ::= */ + -2, /* (386) having_clause_opt ::= HAVING search_condition */ + -4, /* (387) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (388) query_expression_body ::= query_primary */ + -4, /* (389) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + -1, /* (390) query_primary ::= query_specification */ + 0, /* (391) order_by_clause_opt ::= */ + -3, /* (392) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (393) slimit_clause_opt ::= */ + -2, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (396) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (397) limit_clause_opt ::= */ + -2, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (400) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (401) subquery ::= NK_LP query_expression NK_RP */ + -1, /* (402) search_condition ::= common_expression */ + -1, /* (403) sort_specification_list ::= sort_specification */ + -3, /* (404) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (405) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + 0, /* (406) ordering_specification_opt ::= */ + -1, /* (407) ordering_specification_opt ::= ASC */ + -1, /* (408) ordering_specification_opt ::= DESC */ + 0, /* (409) null_ordering_opt ::= */ + -2, /* (410) null_ordering_opt ::= NULLS FIRST */ + -2, /* (411) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3102,12 +3107,14 @@ static YYACTIONTYPE yy_reduce( case 268: /* function_name ::= NK_ID */ yytestcase(yyruleno==268); case 269: /* function_name ::= FIRST */ yytestcase(yyruleno==269); case 270: /* function_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* table_alias ::= NK_ID */ yytestcase(yyruleno==271); - case 272: /* column_alias ::= NK_ID */ yytestcase(yyruleno==272); - case 273: /* user_name ::= NK_ID */ yytestcase(yyruleno==273); - case 274: /* index_name ::= NK_ID */ yytestcase(yyruleno==274); - case 275: /* topic_name ::= NK_ID */ yytestcase(yyruleno==275); - case 276: /* stream_name ::= NK_ID */ yytestcase(yyruleno==276); + case 271: /* function_name ::= NOW */ yytestcase(yyruleno==271); + case 272: /* function_name ::= TODAY */ yytestcase(yyruleno==272); + case 273: /* table_alias ::= NK_ID */ yytestcase(yyruleno==273); + case 274: /* column_alias ::= NK_ID */ yytestcase(yyruleno==274); + case 275: /* user_name ::= NK_ID */ yytestcase(yyruleno==275); + case 276: /* index_name ::= NK_ID */ yytestcase(yyruleno==276); + case 277: /* topic_name ::= NK_ID */ yytestcase(yyruleno==277); + case 278: /* stream_name ::= NK_ID */ yytestcase(yyruleno==278); { yylhsminor.yy29 = yymsp[0].minor.yy0; } yymsp[0].minor.yy29 = yylhsminor.yy29; break; @@ -3160,7 +3167,7 @@ static YYACTIONTYPE yy_reduce( case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); - case 350: /* set_quantifier_opt ::= */ yytestcase(yyruleno==350); + case 351: /* set_quantifier_opt ::= */ yytestcase(yyruleno==351); { yymsp[1].minor.yy47 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ @@ -3301,8 +3308,8 @@ static YYACTIONTYPE yy_reduce( case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); case 210: /* func_list ::= func */ yytestcase(yyruleno==210); case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); - case 355: /* select_sublist ::= select_item */ yytestcase(yyruleno==355); - case 402: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==402); + case 356: /* select_sublist ::= select_item */ yytestcase(yyruleno==356); + case 403: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==403); { yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy182); } yymsp[0].minor.yy334 = yylhsminor.yy334; break; @@ -3312,8 +3319,8 @@ static YYACTIONTYPE yy_reduce( case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); - case 356: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==356); - case 403: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==403); + case 357: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==357); + case 404: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==404); { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy182); } yymsp[-2].minor.yy334 = yylhsminor.yy334; break; @@ -3394,9 +3401,9 @@ static YYACTIONTYPE yy_reduce( break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 363: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==363); - case 380: /* group_by_clause_opt ::= */ yytestcase(yyruleno==380); - case 390: /* order_by_clause_opt ::= */ yytestcase(yyruleno==390); + case 364: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==364); + case 381: /* group_by_clause_opt ::= */ yytestcase(yyruleno==381); + case 391: /* order_by_clause_opt ::= */ yytestcase(yyruleno==391); { yymsp[1].minor.yy334 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ @@ -3486,7 +3493,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 354: /* select_list ::= select_sublist */ yytestcase(yyruleno==354); + case 355: /* select_list ::= select_sublist */ yytestcase(yyruleno==355); { yylhsminor.yy334 = yymsp[0].minor.yy334; } yymsp[0].minor.yy334 = yylhsminor.yy334; break; @@ -3631,13 +3638,13 @@ static YYACTIONTYPE yy_reduce( break; case 196: /* like_pattern_opt ::= */ case 207: /* index_options ::= */ yytestcase(yyruleno==207); - case 361: /* where_clause_opt ::= */ yytestcase(yyruleno==361); - case 365: /* twindow_clause_opt ::= */ yytestcase(yyruleno==365); - case 370: /* sliding_opt ::= */ yytestcase(yyruleno==370); - case 372: /* fill_opt ::= */ yytestcase(yyruleno==372); - case 384: /* having_clause_opt ::= */ yytestcase(yyruleno==384); - case 392: /* slimit_clause_opt ::= */ yytestcase(yyruleno==392); - case 396: /* limit_clause_opt ::= */ yytestcase(yyruleno==396); + case 362: /* where_clause_opt ::= */ yytestcase(yyruleno==362); + case 366: /* twindow_clause_opt ::= */ yytestcase(yyruleno==366); + case 371: /* sliding_opt ::= */ yytestcase(yyruleno==371); + case 373: /* fill_opt ::= */ yytestcase(yyruleno==373); + case 385: /* having_clause_opt ::= */ yytestcase(yyruleno==385); + case 393: /* slimit_clause_opt ::= */ yytestcase(yyruleno==393); + case 397: /* limit_clause_opt ::= */ yytestcase(yyruleno==397); { yymsp[1].minor.yy182 = NULL; } break; case 197: /* like_pattern_opt ::= LIKE NK_STRING */ @@ -3694,7 +3701,7 @@ static YYACTIONTYPE yy_reduce( break; case 221: /* analyze_opt ::= ANALYZE */ case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); - case 351: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==351); + case 352: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==352); { yymsp[0].minor.yy47 = true; } break; case 222: /* explain_options ::= */ @@ -3772,20 +3779,20 @@ static YYACTIONTYPE yy_reduce( break; case 248: /* literal ::= duration_literal */ case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); - case 277: /* expression ::= literal */ yytestcase(yyruleno==277); - case 278: /* expression ::= pseudo_column */ yytestcase(yyruleno==278); - case 279: /* expression ::= column_reference */ yytestcase(yyruleno==279); - case 283: /* expression ::= subquery */ yytestcase(yyruleno==283); - case 324: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==324); - case 328: /* boolean_primary ::= predicate */ yytestcase(yyruleno==328); - case 330: /* common_expression ::= expression */ yytestcase(yyruleno==330); - case 331: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==331); - case 333: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==333); - case 335: /* table_reference ::= table_primary */ yytestcase(yyruleno==335); - case 336: /* table_reference ::= joined_table */ yytestcase(yyruleno==336); - case 340: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==340); - case 387: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==387); - case 389: /* query_primary ::= query_specification */ yytestcase(yyruleno==389); + case 279: /* expression ::= literal */ yytestcase(yyruleno==279); + case 280: /* expression ::= pseudo_column */ yytestcase(yyruleno==280); + case 281: /* expression ::= column_reference */ yytestcase(yyruleno==281); + case 286: /* expression ::= subquery */ yytestcase(yyruleno==286); + case 325: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==325); + case 329: /* boolean_primary ::= predicate */ yytestcase(yyruleno==329); + case 331: /* common_expression ::= expression */ yytestcase(yyruleno==331); + case 332: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==332); + case 334: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==334); + case 336: /* table_reference ::= table_primary */ yytestcase(yyruleno==336); + case 337: /* table_reference ::= joined_table */ yytestcase(yyruleno==337); + case 341: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==341); + case 388: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==388); + case 390: /* query_primary ::= query_specification */ yytestcase(yyruleno==390); { yylhsminor.yy182 = yymsp[0].minor.yy182; } yymsp[0].minor.yy182 = yylhsminor.yy182; break; @@ -3839,23 +3846,27 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 261: /* signed_literal ::= duration_literal */ - case 357: /* select_item ::= common_expression */ yytestcase(yyruleno==357); - case 401: /* search_condition ::= common_expression */ yytestcase(yyruleno==401); + case 358: /* select_item ::= common_expression */ yytestcase(yyruleno==358); + case 402: /* search_condition ::= common_expression */ yytestcase(yyruleno==402); { yylhsminor.yy182 = releaseRawExprNode(pCxt, yymsp[0].minor.yy182); } yymsp[0].minor.yy182 = yylhsminor.yy182; break; case 262: /* signed_literal ::= NULL */ { yymsp[0].minor.yy182 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 280: /* expression ::= function_name NK_LP expression_list NK_RP */ + case 282: /* expression ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy334)); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 281: /* expression ::= function_name NK_LP NK_STAR NK_RP */ + case 283: /* expression ::= function_name NK_LP NK_STAR NK_RP */ { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 282: /* expression ::= function_name NK_LP expression AS type_name NK_RP */ + case 284: /* expression ::= function_name NK_LP NK_RP */ +{ yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createFunctionNodeNoParam(pCxt, &yymsp[-2].minor.yy29)); } + yymsp[-2].minor.yy182 = yylhsminor.yy182; + break; + case 285: /* expression ::= function_name NK_LP expression AS type_name NK_RP */ { SNodeList *p = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182)); p = addValueNodeFromTypeToList(pCxt, yymsp[-1].minor.yy574, p); @@ -3863,26 +3874,26 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy182 = yylhsminor.yy182; break; - case 284: /* expression ::= NK_LP expression NK_RP */ - case 329: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==329); + case 287: /* expression ::= NK_LP expression NK_RP */ + case 330: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==330); { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 285: /* expression ::= NK_PLUS expression */ + case 288: /* expression ::= NK_PLUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 286: /* expression ::= NK_MINUS expression */ + case 289: /* expression ::= NK_MINUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy182), NULL)); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 287: /* expression ::= expression NK_PLUS expression */ + case 290: /* expression ::= expression NK_PLUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3890,7 +3901,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 288: /* expression ::= expression NK_MINUS expression */ + case 291: /* expression ::= expression NK_MINUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3898,7 +3909,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 289: /* expression ::= expression NK_STAR expression */ + case 292: /* expression ::= expression NK_STAR expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3906,7 +3917,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 290: /* expression ::= expression NK_SLASH expression */ + case 293: /* expression ::= expression NK_SLASH expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3914,7 +3925,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 291: /* expression ::= expression NK_REM expression */ + case 294: /* expression ::= expression NK_REM expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3922,36 +3933,34 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 292: /* expression_list ::= expression */ + case 295: /* expression_list ::= expression */ { yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); } yymsp[0].minor.yy334 = yylhsminor.yy334; break; - case 293: /* expression_list ::= expression_list NK_COMMA expression */ + case 296: /* expression_list ::= expression_list NK_COMMA expression */ { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy182)); } yymsp[-2].minor.yy334 = yylhsminor.yy334; break; - case 294: /* column_reference ::= column_name */ + case 297: /* column_reference ::= column_name */ { yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy29, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29)); } yymsp[0].minor.yy182 = yylhsminor.yy182; break; - case 295: /* column_reference ::= table_name NK_DOT column_name */ + case 298: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29)); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 296: /* pseudo_column ::= NOW */ - case 297: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==297); - case 298: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==298); - case 299: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==299); - case 300: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==302); - case 303: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==303); - case 304: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==304); + case 299: /* pseudo_column ::= ROWTS */ + case 300: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==300); + case 301: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==301); + case 302: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==302); + case 303: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==303); + case 304: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==304); + case 305: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==305); { yylhsminor.yy182 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy182 = yylhsminor.yy182; break; - case 305: /* predicate ::= expression compare_op expression */ - case 310: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==310); + case 306: /* predicate ::= expression compare_op expression */ + case 311: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==311); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3959,7 +3968,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 306: /* predicate ::= expression BETWEEN expression AND expression */ + case 307: /* predicate ::= expression BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3967,7 +3976,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy182 = yylhsminor.yy182; break; - case 307: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 308: /* predicate ::= expression NOT BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -3975,68 +3984,68 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy182 = yylhsminor.yy182; break; - case 308: /* predicate ::= expression IS NULL */ + case 309: /* predicate ::= expression IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), NULL)); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 309: /* predicate ::= expression IS NOT NULL */ + case 310: /* predicate ::= expression IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy182); yylhsminor.yy182 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), NULL)); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 311: /* compare_op ::= NK_LT */ + case 312: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy380 = OP_TYPE_LOWER_THAN; } break; - case 312: /* compare_op ::= NK_GT */ + case 313: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy380 = OP_TYPE_GREATER_THAN; } break; - case 313: /* compare_op ::= NK_LE */ + case 314: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy380 = OP_TYPE_LOWER_EQUAL; } break; - case 314: /* compare_op ::= NK_GE */ + case 315: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy380 = OP_TYPE_GREATER_EQUAL; } break; - case 315: /* compare_op ::= NK_NE */ + case 316: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy380 = OP_TYPE_NOT_EQUAL; } break; - case 316: /* compare_op ::= NK_EQ */ + case 317: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy380 = OP_TYPE_EQUAL; } break; - case 317: /* compare_op ::= LIKE */ + case 318: /* compare_op ::= LIKE */ { yymsp[0].minor.yy380 = OP_TYPE_LIKE; } break; - case 318: /* compare_op ::= NOT LIKE */ + case 319: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy380 = OP_TYPE_NOT_LIKE; } break; - case 319: /* compare_op ::= MATCH */ + case 320: /* compare_op ::= MATCH */ { yymsp[0].minor.yy380 = OP_TYPE_MATCH; } break; - case 320: /* compare_op ::= NMATCH */ + case 321: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy380 = OP_TYPE_NMATCH; } break; - case 321: /* in_op ::= IN */ + case 322: /* in_op ::= IN */ { yymsp[0].minor.yy380 = OP_TYPE_IN; } break; - case 322: /* in_op ::= NOT IN */ + case 323: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy380 = OP_TYPE_NOT_IN; } break; - case 323: /* in_predicate_value ::= NK_LP expression_list NK_RP */ + case 324: /* in_predicate_value ::= NK_LP expression_list NK_RP */ { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 325: /* boolean_value_expression ::= NOT boolean_primary */ + case 326: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy182), NULL)); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 326: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 327: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -4044,7 +4053,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 327: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 328: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy182); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy182); @@ -4052,52 +4061,52 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 332: /* from_clause ::= FROM table_reference_list */ - case 362: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==362); - case 385: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==385); + case 333: /* from_clause ::= FROM table_reference_list */ + case 363: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==363); + case 386: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==386); { yymsp[-1].minor.yy182 = yymsp[0].minor.yy182; } break; - case 334: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 335: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy182 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy182, yymsp[0].minor.yy182, NULL); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 337: /* table_primary ::= table_name alias_opt */ + case 338: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy182 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 338: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 339: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy182 = createRealTableNode(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 339: /* table_primary ::= subquery alias_opt */ + case 340: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy182 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182), &yymsp[0].minor.yy29); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 341: /* alias_opt ::= */ + case 342: /* alias_opt ::= */ { yymsp[1].minor.yy29 = nil_token; } break; - case 342: /* alias_opt ::= table_alias */ + case 343: /* alias_opt ::= table_alias */ { yylhsminor.yy29 = yymsp[0].minor.yy29; } yymsp[0].minor.yy29 = yylhsminor.yy29; break; - case 343: /* alias_opt ::= AS table_alias */ + case 344: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy29 = yymsp[0].minor.yy29; } break; - case 344: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 345: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==345); + case 345: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 346: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==346); { yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182; } break; - case 346: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 347: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy182 = createJoinTableNode(pCxt, yymsp[-4].minor.yy162, yymsp[-5].minor.yy182, yymsp[-2].minor.yy182, yymsp[0].minor.yy182); } yymsp[-5].minor.yy182 = yylhsminor.yy182; break; - case 347: /* join_type ::= */ + case 348: /* join_type ::= */ { yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } break; - case 348: /* join_type ::= INNER */ + case 349: /* join_type ::= INNER */ { yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } break; - case 349: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 350: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-8].minor.yy182 = createSelectStmt(pCxt, yymsp[-7].minor.yy47, yymsp[-6].minor.yy334, yymsp[-5].minor.yy182); yymsp[-8].minor.yy182 = addWhereClause(pCxt, yymsp[-8].minor.yy182, yymsp[-4].minor.yy182); @@ -4107,74 +4116,74 @@ static YYACTIONTYPE yy_reduce( yymsp[-8].minor.yy182 = addHavingClause(pCxt, yymsp[-8].minor.yy182, yymsp[0].minor.yy182); } break; - case 352: /* set_quantifier_opt ::= ALL */ + case 353: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy47 = false; } break; - case 353: /* select_list ::= NK_STAR */ + case 354: /* select_list ::= NK_STAR */ { yymsp[0].minor.yy334 = NULL; } break; - case 358: /* select_item ::= common_expression column_alias */ + case 359: /* select_item ::= common_expression column_alias */ { yylhsminor.yy182 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182), &yymsp[0].minor.yy29); } yymsp[-1].minor.yy182 = yylhsminor.yy182; break; - case 359: /* select_item ::= common_expression AS column_alias */ + case 360: /* select_item ::= common_expression AS column_alias */ { yylhsminor.yy182 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), &yymsp[0].minor.yy29); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 360: /* select_item ::= table_name NK_DOT NK_STAR */ + case 361: /* select_item ::= table_name NK_DOT NK_STAR */ { yylhsminor.yy182 = createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 364: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 381: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==381); - case 391: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==391); + case 365: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 382: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==382); + case 392: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==392); { yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } break; - case 366: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 367: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy182 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } break; - case 367: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + case 368: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ { yymsp[-3].minor.yy182 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy182)); } break; - case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy182 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), NULL, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } break; - case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 370: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy182 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy182), releaseRawExprNode(pCxt, yymsp[-3].minor.yy182), yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } break; - case 371: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 372: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { yymsp[-3].minor.yy182 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy182); } break; - case 373: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 374: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy182 = createFillNode(pCxt, yymsp[-1].minor.yy144, NULL); } break; - case 374: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 375: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy182 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } break; - case 375: /* fill_mode ::= NONE */ + case 376: /* fill_mode ::= NONE */ { yymsp[0].minor.yy144 = FILL_MODE_NONE; } break; - case 376: /* fill_mode ::= PREV */ + case 377: /* fill_mode ::= PREV */ { yymsp[0].minor.yy144 = FILL_MODE_PREV; } break; - case 377: /* fill_mode ::= NULL */ + case 378: /* fill_mode ::= NULL */ { yymsp[0].minor.yy144 = FILL_MODE_NULL; } break; - case 378: /* fill_mode ::= LINEAR */ + case 379: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy144 = FILL_MODE_LINEAR; } break; - case 379: /* fill_mode ::= NEXT */ + case 380: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy144 = FILL_MODE_NEXT; } break; - case 382: /* group_by_list ::= expression */ + case 383: /* group_by_list ::= expression */ { yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); } yymsp[0].minor.yy334 = yylhsminor.yy334; break; - case 383: /* group_by_list ::= group_by_list NK_COMMA expression */ + case 384: /* group_by_list ::= group_by_list NK_COMMA expression */ { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy182))); } yymsp[-2].minor.yy334 = yylhsminor.yy334; break; - case 386: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 387: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy182 = addOrderByClause(pCxt, yymsp[-3].minor.yy182, yymsp[-2].minor.yy334); yylhsminor.yy182 = addSlimitClause(pCxt, yylhsminor.yy182, yymsp[-1].minor.yy182); @@ -4182,46 +4191,46 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 388: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + case 389: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { yylhsminor.yy182 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy182, yymsp[0].minor.yy182); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; - case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==397); + case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==398); { yymsp[-1].minor.yy182 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==398); + case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==399); { yymsp[-3].minor.yy182 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==399); + case 396: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 400: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==400); { yymsp[-3].minor.yy182 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 400: /* subquery ::= NK_LP query_expression NK_RP */ + case 401: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy182 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy182); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 404: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + case 405: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { yylhsminor.yy182 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy182), yymsp[-1].minor.yy218, yymsp[0].minor.yy487); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; - case 405: /* ordering_specification_opt ::= */ + case 406: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy218 = ORDER_ASC; } break; - case 406: /* ordering_specification_opt ::= ASC */ + case 407: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy218 = ORDER_ASC; } break; - case 407: /* ordering_specification_opt ::= DESC */ + case 408: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy218 = ORDER_DESC; } break; - case 408: /* null_ordering_opt ::= */ + case 409: /* null_ordering_opt ::= */ { yymsp[1].minor.yy487 = NULL_ORDER_DEFAULT; } break; - case 409: /* null_ordering_opt ::= NULLS FIRST */ + case 410: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy487 = NULL_ORDER_FIRST; } break; - case 410: /* null_ordering_opt ::= NULLS LAST */ + case 411: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy487 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 4d57af822e..2dc0702402 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1242,6 +1242,22 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p return TSDB_CODE_SUCCESS; } +int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + if (inputNum != 1) { + return TSDB_CODE_FAILED; + } + colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 0)); + return TSDB_CODE_SUCCESS; +} + +int32_t todayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + if (inputNum != 1) { + return TSDB_CODE_FAILED; + } + colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 0)); + return TSDB_CODE_SUCCESS; +} + int32_t atanFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { return doScalarFunctionUnique(pInput, inputNum, pOutput, atan); } From 1aaf170491952d3f7db97741cba0997c1c43590d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Apr 2022 21:41:23 +0800 Subject: [PATCH 15/60] enh(cluster): enable tsim to support valgrind startup --- tests/script/test.sh | 4 ++-- tests/tsim/inc/simInt.h | 1 + tests/tsim/src/simExe.c | 4 ++++ tests/tsim/src/simMain.c | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index 7721f21db7..f5a9e4187b 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -125,8 +125,8 @@ ulimit -c unlimited if [ -n "$FILE_NAME" ]; then echo "------------------------------------------------------------------------" if [ $VALGRIND -eq 1 ]; then - echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME - valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME + echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v + valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else if [[ $MULTIPROCESS -eq 1 ]];then echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME diff --git a/tests/tsim/inc/simInt.h b/tests/tsim/inc/simInt.h index a667139de1..c8b13736c7 100644 --- a/tests/tsim/inc/simInt.h +++ b/tests/tsim/inc/simInt.h @@ -156,6 +156,7 @@ extern int32_t simDebugFlag; extern char simScriptDir[]; extern bool abortExecution; extern bool useMultiProcess; +extern bool useValgrind; SScript *simParseScript(char *fileName); SScript *simProcessCallOver(SScript *script); diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index d713233362..5a18084fff 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -340,6 +340,10 @@ bool simExecuteSystemCmd(SScript *script, char *option) { simReplaceStr(buf, "deploy.sh", "deploy.sh -m"); } + if (useValgrind) { + simReplaceStr(buf, "exec.sh", "exec.sh -v"); + } + simLogSql(buf, true); int32_t code = system(buf); int32_t repeatTimes = 0; diff --git a/tests/tsim/src/simMain.c b/tests/tsim/src/simMain.c index 8898f1b201..713e46df58 100644 --- a/tests/tsim/src/simMain.c +++ b/tests/tsim/src/simMain.c @@ -19,6 +19,7 @@ bool simExecSuccess = false; bool abortExecution = false; bool useMultiProcess = false; +bool useValgrind = false; void simHandleSignal(int32_t signo, void *sigInfo, void *context) { simSystemCleanUp(); @@ -35,6 +36,8 @@ int32_t main(int32_t argc, char *argv[]) { strcpy(scriptFile, argv[++i]); } else if (strcmp(argv[i], "-m") == 0) { useMultiProcess = true; + } else if (strcmp(argv[i], "-v") == 0) { + useValgrind = true; } else { printf("usage: %s [options] \n", argv[0]); printf(" [-c config]: config directory, default is: %s\n", configDir); From c490820b09305813fd866ce5bec10763ab57f85a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 14 Apr 2022 22:12:10 +0800 Subject: [PATCH 16/60] feat(query): add the merge join operator for child table inner join. --- source/libs/executor/inc/executorimpl.h | 25 +++- source/libs/executor/src/executorimpl.c | 184 +++++++++++++++++++++--- 2 files changed, 183 insertions(+), 26 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index cbd2dc66f5..78bc6947cd 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -549,8 +549,6 @@ typedef struct SStateWindowOperatorInfo { typedef struct SSortedMergeOperatorInfo { SOptrBasicInfo binfo; - bool hasVarCol; - SArray* pSortInfo; int32_t numOfSources; SSortHandle *pSortHandle; @@ -582,6 +580,24 @@ typedef struct SSortOperatorInfo { uint64_t totalElapsed; // total elapsed time } SSortOperatorInfo; +typedef struct SJoinOperatorInfo { + SSDataBlock *pRes; + int32_t joinType; + + SSDataBlock *pLeft; + int32_t leftPos; + SColumnInfo leftCol; + + SSDataBlock *pRight; + int32_t rightPos; + SColumnInfo rightCol; + + SNode *pOnCondition; +// SJoinStatus *status; +// int32_t numOfUpstream; +// SRspResultInfo resultInfo; +} SJoinOperatorInfo; + int32_t operatorDummyOpenFn(SOperatorInfo* pOperator); void operatorDummyCloseFn(void* param, int32_t numOfCols); int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num); @@ -628,6 +644,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SNode* pOnCondition, SExecTaskInfo* pTaskInfo); + #if 0 SOperatorInfo* createTableSeqScanOperatorInfo(void* pTsdbReadHandle, STaskRuntimeEnv* pRuntimeEnv); SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream, @@ -635,9 +653,6 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntim SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createTagScanOperatorInfo(SReaderHandle* pReaderHandle, SExprInfo* pExpr, int32_t numOfOutput); - -SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pdownstream, int32_t numOfDownstream, SSchema* pSchema, - int32_t numOfOutput); #endif void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 14acff3204..45674d31bc 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -6600,10 +6600,10 @@ bool validateExprColumnInfo(SQueriedTableInfo* pTableInfo, SExprBasicInfo* pExpr static SResSchema createResSchema(int32_t type, int32_t bytes, int32_t slotId, int32_t scale, int32_t precision, const char* name) { SResSchema s = {0}; - s.scale = scale; - s.type = type; - s.bytes = bytes; - s.slotId = slotId; + s.scale = scale; + s.type = type; + s.bytes = bytes; + s.slotId = slotId; s.precision = precision; strncpy(s.name, name, tListLen(s.name)); @@ -6679,8 +6679,7 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* SFunctionNode* pFuncNode = (SFunctionNode*)pTargetNode->pExpr; SDataType* pType = &pFuncNode->node.resType; - pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale, - pType->precision, pFuncNode->node.aliasName); + pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale, pType->precision, pFuncNode->node.aliasName); pExp->pExpr->_function.functionId = pFuncNode->funcId; pExp->pExpr->_function.pFunctNode = pFuncNode; @@ -6756,7 +6755,7 @@ static SArray* createIndexMap(SNodeList* pNodeList); static SArray* extractPartitionColInfo(SNodeList* pNodeList); SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, - uint64_t queryId, uint64_t taskId, STableGroupInfo* pTableGroupInfo) { + uint64_t queryId, uint64_t taskId, STableGroupInfo* pTableGroupInfo) { if (pPhyNode->pChildren == NULL || LIST_LENGTH(pPhyNode->pChildren) == 0) { int32_t type = nodeType(pPhyNode); if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == type) { @@ -6764,6 +6763,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo int32_t numOfCols = 0; tsdbReaderT pDataReader = doCreateDataReader((STableScanPhysiNode*)pPhyNode, pHandle, pTableGroupInfo, (uint64_t)queryId, taskId); + if (pDataReader == NULL) { + return NULL; + } + SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols); SSDataBlock* pResBlock = createOutputBuf_rv1(pScanPhyNode->node.pOutputDataBlockDesc); @@ -6802,13 +6805,15 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } } + int32_t num = 0; int32_t type = nodeType(pPhyNode); - size_t size = LIST_LENGTH(pPhyNode->pChildren); - ASSERT(size == 1); + size_t size = LIST_LENGTH(pPhyNode->pChildren); - SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, 0); - SOperatorInfo* op = createOperatorTree(pChildNode, pTaskInfo, pHandle, queryId, taskId, pTableGroupInfo); - int32_t num = 0; + SOperatorInfo** ops = taosMemoryCalloc(size, POINTER_BYTES); + for(int32_t i = 0; i < size; ++i) { + SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, i); + ops[i] = createOperatorTree(pChildNode, pTaskInfo, pHandle, queryId, taskId, pTableGroupInfo); + } if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) { SProjectPhysiNode* pProjPhyNode = (SProjectPhysiNode*) pPhyNode; @@ -6817,7 +6822,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SLimit limit = {.limit = pProjPhyNode->limit, .offset = pProjPhyNode->offset}; SLimit slimit = {.limit = pProjPhyNode->slimit, .offset = pProjPhyNode->soffset}; - return createProjectOperatorInfo(op, pExprInfo, num, pResBlock, &limit, &slimit, pTaskInfo); + return createProjectOperatorInfo(ops[0], pExprInfo, num, pResBlock, &limit, &slimit, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_AGG == type) { SAggPhysiNode* pAggNode = (SAggPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pAggNode->pAggFuncs, pAggNode->pGroupKeys, &num); @@ -6831,9 +6836,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo pScalarExprInfo = createExprInfo(pAggNode->pExprs, NULL, &numOfScalarExpr); } - return createGroupOperatorInfo(op, pExprInfo, num, pResBlock, pColList, pAggNode->node.pConditions, pScalarExprInfo, numOfScalarExpr, pTaskInfo, NULL); + return createGroupOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pAggNode->node.pConditions, pScalarExprInfo, numOfScalarExpr, pTaskInfo, NULL); } else { - return createAggregateOperatorInfo(op, pExprInfo, num, pResBlock, pTaskInfo, pTableGroupInfo); + return createAggregateOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo, pTableGroupInfo); } } else if (QUERY_NODE_PHYSICAL_PLAN_INTERVAL == type) { SIntervalPhysiNode* pIntervalPhyNode = (SIntervalPhysiNode*)pPhyNode; @@ -6851,33 +6856,39 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo }; int32_t primaryTsSlotId = ((SColumnNode*) pIntervalPhyNode->window.pTspk)->slotId; - return createIntervalOperatorInfo(op, pExprInfo, num, pResBlock, &interval, primaryTsSlotId, pTableGroupInfo, pTaskInfo); + return createIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, primaryTsSlotId, pTableGroupInfo, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) { SSortPhysiNode* pSortPhyNode = (SSortPhysiNode*)pPhyNode; SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SArray* info = createSortInfo(pSortPhyNode->pSortKeys, pSortPhyNode->pTargets); SArray* slotMap = createIndexMap(pSortPhyNode->pTargets); - return createSortOperatorInfo(op, pResBlock, info, slotMap, pTaskInfo); + return createSortOperatorInfo(ops[0], pResBlock, info, slotMap, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW == type) { SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pSessionNode->window.pFuncs, NULL, &num); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); - return createSessionAggOperatorInfo(op, pExprInfo, num, pResBlock, pSessionNode->gap, pTaskInfo); + return createSessionAggOperatorInfo(ops[0], pExprInfo, num, pResBlock, pSessionNode->gap, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_PARTITION == type) { SPartitionPhysiNode* pPartNode = (SPartitionPhysiNode*) pPhyNode; SArray* pColList = extractPartitionColInfo(pPartNode->pPartitionKeys); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SExprInfo* pExprInfo = createExprInfo(pPartNode->pTargets, NULL, &num); - return createPartitionOperatorInfo(op, pExprInfo, num, pResBlock, pColList, pTaskInfo, NULL); - } else if (QUERY_NODE_STATE_WINDOW == type) { + return createPartitionOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pTaskInfo, NULL); + } else if (QUERY_NODE_PHYSICAL_PLAN_STATE_WINDOW == type) { SStateWinodwPhysiNode* pStateNode = (SStateWinodwPhysiNode*) pPhyNode; SExprInfo* pExprInfo = createExprInfo(pStateNode->window.pFuncs, NULL, &num); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); - return createStatewindowOperatorInfo(op, pExprInfo, num, pResBlock, pTaskInfo); + return createStatewindowOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo); + } else if (QUERY_NODE_PHYSICAL_PLAN_JOIN == type) { + SJoinPhysiNode* pJoinNode = (SJoinPhysiNode*) pPhyNode; + SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + + SExprInfo* pExprInfo = createExprInfo(pJoinNode->pTargets, NULL, &num); + return createJoinOperatorInfo(ops, size, pExprInfo, num, pResBlock, pJoinNode->pOnConditions, pTaskInfo); } else { ASSERT(0); } /*else if (pPhyNode->info.type == OP_MultiTableAggregate) { @@ -7374,4 +7385,135 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo *operatorInfo, SExplainExecInfo return TSDB_CODE_SUCCESS; } +static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator, bool* newgroup) { + SJoinOperatorInfo* pJoinInfo = pOperator->info; +// SOptrBasicInfo* pInfo = &pJoinInfo->binfo; + SSDataBlock* pRes = pJoinInfo->pRes; + blockDataCleanup(pRes); + blockDataEnsureCapacity(pRes, 4096); + + int32_t nrows = 0; + + while (1) { + bool prevVal = *newgroup; + + if (pJoinInfo->pLeft == NULL || pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { + SOperatorInfo* ds1 = pOperator->pDownstream[0]; + publishOperatorProfEvent(ds1, QUERY_PROF_BEFORE_OPERATOR_EXEC); + pJoinInfo->pLeft = ds1->getNextFn(ds1, newgroup); + publishOperatorProfEvent(ds1, QUERY_PROF_AFTER_OPERATOR_EXEC); + + pJoinInfo->leftPos = 0; + if (pJoinInfo->pLeft == NULL) { + setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); + break; + } + } + + if (pJoinInfo->pRight == NULL || pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { + SOperatorInfo* ds2 = pOperator->pDownstream[1]; + publishOperatorProfEvent(ds2, QUERY_PROF_BEFORE_OPERATOR_EXEC); + pJoinInfo->pRight = ds2->getNextFn(ds2, newgroup); + publishOperatorProfEvent(ds2, QUERY_PROF_AFTER_OPERATOR_EXEC); + + pJoinInfo->rightPos = 0; + if (pJoinInfo->pRight == NULL) { + setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); + break; + } + } + + SColumnInfoData* pLeftCol = taosArrayGet(pJoinInfo->pLeft->pDataBlock, pJoinInfo->leftCol.slotId); + char* pLeftVal = colDataGetData(pLeftCol, pJoinInfo->leftPos); + + SColumnInfoData* pRightCol = taosArrayGet(pJoinInfo->pRight->pDataBlock, pJoinInfo->rightCol.slotId); + char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); + + // only the timestamp match support for ordinary table + ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + if (*(int64_t*) pLeftVal == *(int64_t*) pRightVal) { + for(int32_t i = 0; i < pOperator->numOfOutput; ++i) { + SColumnInfoData* pDst = taosArrayGet(pRes->pDataBlock, i); + + SExprInfo* pExprInfo = &pOperator->pExpr[i]; + + int32_t blockId = pExprInfo->base.pParam[0].pCol->dataBlockId; + int32_t slotId = pExprInfo->base.pParam[0].pCol->slotId; + + SColumnInfoData* pSrc = NULL; + if (pJoinInfo->pLeft->info.blockId == blockId) { + pSrc = taosArrayGet(pJoinInfo->pLeft->pDataBlock, slotId); + } else { + pSrc = taosArrayGet(pJoinInfo->pRight->pDataBlock, slotId); + } + + if (colDataIsNull_s(pSrc, pJoinInfo->leftPos)) { + colDataAppendNULL(pDst, nrows); + } else { + char* p = colDataGetData(pSrc, pJoinInfo->leftPos); + colDataAppend(pDst, nrows, p, false); + } + } + + pJoinInfo->leftPos += 1; + pJoinInfo->rightPos += 1; + + nrows += 1; + } else if (*(int64_t*) pLeftVal < *(int64_t*) pRightVal) { + pJoinInfo->leftPos += 1; + + if (pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { + continue; + } + } else if (*(int64_t*) pLeftVal > *(int64_t*) pRightVal) { + pJoinInfo->rightPos += 1; + if (pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { + continue; + } + } + + // the pDataBlock are always the same one, no need to call this again + pRes->info.rows = nrows; + if (pRes->info.rows >= pOperator->resultInfo.threshold) { + break; + } + } + + return (pRes->info.rows > 0) ? pRes : NULL; +} + +SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SNode* pOnCondition, SExecTaskInfo* pTaskInfo) { + SJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SJoinOperatorInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pOperator == NULL || pInfo == NULL) { + goto _error; + } + + pOperator->resultInfo.capacity = 4096; + pOperator->resultInfo.threshold = 4096 * 0.75; + +// initResultRowInf +// o(&pInfo->binfo.resultRowInfo, 8); + pInfo->pRes = pResBlock; + + pOperator->name = "JoinOperator"; + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_JOIN; + pOperator->blockingOptr = true; + pOperator->status = OP_NOT_OPENED; + pOperator->pExpr = pExprInfo; + pOperator->numOfOutput = numOfCols; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; + pOperator->getNextFn = doMergeJoin; + pOperator->closeFn = destroyBasicOperatorInfo; + + int32_t code = appendDownstream(pOperator, pDownstream, numOfDownstream); + return pOperator; + + _error: + taosMemoryFree(pInfo); + taosMemoryFree(pOperator); + pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; + return NULL; +} \ No newline at end of file From 30799e59ceb84a0771dca54e8ecc528924af5e8d Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 14 Apr 2022 23:39:14 +0800 Subject: [PATCH 17/60] test: remove show databases check from insert cases (#11508) * [TD-13558]: taos shell refactor add taosTools as submodule * add tools/taos-tools * add more client interface for taosTools compile * update taos-tools * update taos-tools * refactor shell * [TD-13558]: taos shell test speed * [TD-13558]: taos -n startup works * taos -n rpc works * taos -n server works * cleanup code since no endPort in 3.0 * update taos-tools * [TD-13558]: taos -C works * improve taos shell -c WIP * update taos-tools * add demoapi.c * adjust show databases result for 3.0 * test: add platform logic * add nchar * adjust taos_fetch_lengths * print fields * remove show databases check from insert cases --- example/src/demoapi.c | 57 +++++++++------ tests/pytest/insert/bigint.py | 4 -- tests/pytest/insert/double.py | 4 -- tests/pytest/insert/smallint.py | 4 -- tests/pytest/insert/timestamp.py | 93 +++++++++++++++++++++++++ tests/pytest/insert/tinyint.py | 4 -- tests/pytest/insert/unsignedBigint.py | 4 -- tests/pytest/insert/unsignedInt.py | 4 -- tests/pytest/insert/unsignedSmallint.py | 4 -- tests/pytest/insert/unsignedTinyint.py | 4 -- tests/pytest/smoketest.sh | 22 ++++++ 11 files changed, 152 insertions(+), 52 deletions(-) create mode 100644 tests/pytest/insert/timestamp.py diff --git a/example/src/demoapi.c b/example/src/demoapi.c index ede13b4bb8..b1efdb21b9 100644 --- a/example/src/demoapi.c +++ b/example/src/demoapi.c @@ -65,22 +65,32 @@ static void prepare_data(TAOS* taos) { usleep(100000); taos_select_db(taos, "test"); - res = taos_query(taos, "create table meters(ts timestamp, f float, n int, b binary(20)) tags(area int, localtion binary(20));"); + res = taos_query(taos, "create table meters(ts timestamp, f float, n int, b binary(20), c nchar(20)) tags(area int, city binary(20), dist nchar(20));"); taos_free_result(res); char command[1024] = {0}; for (int64_t i = 0; i < g_num_of_tb; i ++) { - sprintf(command, "create table t%"PRId64" using meters tags(%"PRId64", '%s');", - i, i, (i%2)?"beijing":"shanghai"); +// sprintf(command, "create table t%"PRId64" using meters tags(%"PRId64", '%s', '%s');", +// i, i, (i%2)?"beijing":"shanghai", (i%2)?"朝阳区":"黄浦区"); + sprintf(command, "create table t%"PRId64" using meters tags(%"PRId64", '%s', '%s');", + i, i, (i%2)?"beijing":"shanghai", (i%2)?"chaoyang":"huangpu"); res = taos_query(taos, command); + if ((res) && (0 == taos_errno(res))) { + okPrint("t%" PRId64 " created\n", i); + } else { + errorPrint("%s() LN%d: %s\n", + __func__, __LINE__, taos_errstr(res)); + } taos_free_result(res); int64_t j = 0; int64_t total = 0; int64_t affected; for (; j < g_num_of_rec -1; j ++) { - sprintf(command, "insert into t%"PRId64" values(%" PRId64 ", %f, %"PRId64", '%c%d')", - i, 1650000000000+j, (float)j, j, 'a'+(int)j%10, rand()); + sprintf(command, "insert into t%"PRId64" " + "values(%" PRId64 ", %f, %"PRId64", '%c%d', '%c%d')", + i, 1650000000000+j, (float)j, j, 'a'+(int)j%25, rand(), + 'z' - (int)j%25, rand()); res = taos_query(taos, command); if ((res) && (0 == taos_errno(res))) { affected = taos_affected_rows(res); @@ -91,7 +101,7 @@ static void prepare_data(TAOS* taos) { } taos_free_result(res); } - sprintf(command, "insert into t%"PRId64" values(%" PRId64 ", NULL, NULL, NULL)", + sprintf(command, "insert into t%"PRId64" values(%" PRId64 ", NULL, NULL, NULL, NULL)", i, 1650000000000+j+1); res = taos_query(taos, command); if ((res) && (0 == taos_errno(res))) { @@ -107,12 +117,16 @@ static void prepare_data(TAOS* taos) { } } -static int print_result(TAOS_RES* res, int block) { +static int print_result(char *tbname, TAOS_RES* res, int block) { int64_t num_rows = 0; TAOS_ROW row = NULL; int num_fields = taos_num_fields(res); TAOS_FIELD* fields = taos_fetch_fields(res); + for (int f = 0; f < num_fields; f++) { + printf("fields[%d].name=%s, fields[%d].type=%d, fields[%d].bytes=%d\n", + f, fields[f].name, f, fields[f].type, f, fields[f].bytes); + } if (block) { warnPrint("%s() LN%d, call taos_fetch_block()\n", __func__, __LINE__); int rows = 0; @@ -126,6 +140,16 @@ static int print_result(TAOS_RES* res, int block) { taos_print_row(temp, row, fields, num_fields); puts(temp); num_rows ++; + + int* lengths = taos_fetch_lengths(res); + if (lengths) { + for (int c = 0; c < num_fields; c++) { + printf("length of column %d is %d\n", c, lengths[c]); + } + } else { + errorPrint("%s() LN%d: %s's lengths is NULL\n", + __func__, __LINE__, tbname); + } } } @@ -134,28 +158,21 @@ static int print_result(TAOS_RES* res, int block) { static void verify_query(TAOS* taos) { // TODO: select count(tbname) from stable once stable query work + // + char tbname[193] = {0}; char command[1024] = {0}; for (int64_t i = 0; i < g_num_of_tb; i++) { - sprintf(command, "select * from t%"PRId64"", i); + sprintf(tbname, "t%"PRId64"", i); + sprintf(command, "select * from %s", tbname); TAOS_RES* res = taos_query(taos, command); if (res) { if (0 == taos_errno(res)) { int field_count = taos_field_count(res); printf("field_count: %d\n", field_count); - int* lengths = taos_fetch_lengths(res); - if (lengths) { - for (int c = 0; c < field_count; c++) { - printf("length of column %d is %d\n", c, lengths[c]); - } - } else { - errorPrint("%s() LN%d: t%"PRId64"'s lengths is NULL\n", - __func__, __LINE__, i); - } - - int64_t rows = print_result(res, i % 2); - printf("rows is: %"PRId64"\n", rows); + int64_t rows = print_result(tbname, res, i % 2); + printf("rows is: %"PRId64"\n", rows); } else { errorPrint("%s() LN%d: %s\n", diff --git a/tests/pytest/insert/bigint.py b/tests/pytest/insert/bigint.py index 7c7d2d0f95..5431cf8106 100644 --- a/tests/pytest/insert/bigint.py +++ b/tests/pytest/insert/bigint.py @@ -54,10 +54,6 @@ class TDTestCase: tdSql.checkData(0, 1, 9223372036854770000) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/double.py b/tests/pytest/insert/double.py index 1b66ed1c44..2699f4b0e9 100644 --- a/tests/pytest/insert/double.py +++ b/tests/pytest/insert/double.py @@ -75,10 +75,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2.000000000) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/smallint.py b/tests/pytest/insert/smallint.py index 16322e9aeb..1a1eab6a98 100644 --- a/tests/pytest/insert/smallint.py +++ b/tests/pytest/insert/smallint.py @@ -91,10 +91,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/timestamp.py b/tests/pytest/insert/timestamp.py new file mode 100644 index 0000000000..d5ddffcfaf --- /dev/null +++ b/tests/pytest/insert/timestamp.py @@ -0,0 +1,93 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.ts = 1607281690000 + + def run(self): + tdSql.prepare() + + # TS-806 + tdLog.info("test case for TS-806") + + # Case 1 + tdSql.execute("create table t1(ts timestamp, c1 int)") + tdSql.execute("insert into t1(c1, ts) values(1, %d)" % self.ts) + tdSql.query("select * from t1") + tdSql.checkRows(1) + + # Case 2 + tdSql.execute( + "insert into t1(c1, ts) values(2, %d)(3, %d)" % + (self.ts + 1000, self.ts + 2000)) + tdSql.query("select * from t1") + tdSql.checkRows(3) + + # Case 3 + tdSql.execute("create table t2(ts timestamp, c1 timestamp)") + tdSql.execute( + " insert into t2(c1, ts) values(%d, %d)" % + (self.ts, self.ts + 5000)) + tdSql.query("select * from t2") + tdSql.checkRows(1) + + tdSql.execute( + " insert into t2(c1, ts) values(%d, %d)(%d, %d)" % + (self.ts, self.ts + 6000, self.ts + 3000, self.ts + 8000)) + tdSql.query("select * from t2") + tdSql.checkRows(3) + + # Case 4 + tdSql.execute( + "create table stb(ts timestamp, c1 int, c2 binary(20)) tags(tstag timestamp, t1 int)") + tdSql.execute( + "insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', %d, 1)" % + self.ts) + tdSql.query("select * from stb") + tdSql.checkRows(1) + + # Case 5 + tdSql.execute( + "insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', now, 1) tb2(c1, ts) using stb tags(now + 2m, 1000) values(1, now - 1h)") + tdSql.query("select * from stb") + tdSql.checkRows(3) + + tdSql.execute(" insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', now + 10s, 1) tb2(c1, ts) using stb(tstag) tags(now + 2m) values(1, now - 3h)(2, now - 2h)") + tdSql.query("select * from stb") + tdSql.checkRows(6) + + # Case 6 + tdSql.execute( + "create table stb2 (ts timestamp, c1 timestamp, c2 timestamp) tags(t1 timestamp, t2 timestamp)") + tdSql.execute(" insert into tb4(c1, c2, ts) using stb2(t2, t1) tags(now, now + 1h) values(now + 1s, now + 2s, now + 3s)(now -1s, now - 2s, now - 3s) tb5(c2, ts, c1) using stb2(t2) tags(now + 1h) values(now, now, now)") + tdSql.query("select * from stb2") + tdSql.checkRows(3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/tinyint.py b/tests/pytest/insert/tinyint.py index a10c999e8c..a27b60aa72 100644 --- a/tests/pytest/insert/tinyint.py +++ b/tests/pytest/insert/tinyint.py @@ -91,10 +91,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/unsignedBigint.py b/tests/pytest/insert/unsignedBigint.py index b222f2cd01..0e99afa142 100644 --- a/tests/pytest/insert/unsignedBigint.py +++ b/tests/pytest/insert/unsignedBigint.py @@ -93,10 +93,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/unsignedInt.py b/tests/pytest/insert/unsignedInt.py index ed18999bc4..f38964677f 100644 --- a/tests/pytest/insert/unsignedInt.py +++ b/tests/pytest/insert/unsignedInt.py @@ -93,10 +93,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/unsignedSmallint.py b/tests/pytest/insert/unsignedSmallint.py index 9893c470ce..815390868b 100644 --- a/tests/pytest/insert/unsignedSmallint.py +++ b/tests/pytest/insert/unsignedSmallint.py @@ -93,10 +93,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) # convert end def stop(self): diff --git a/tests/pytest/insert/unsignedTinyint.py b/tests/pytest/insert/unsignedTinyint.py index 5bdfe7580b..200ac00eb0 100644 --- a/tests/pytest/insert/unsignedTinyint.py +++ b/tests/pytest/insert/unsignedTinyint.py @@ -91,10 +91,6 @@ class TDTestCase: tdSql.checkData(0, 1, 2) tdLog.info('drop database db') tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) def stop(self): diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index cbe80882fb..7ac5d4f6d3 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -4,10 +4,32 @@ ulimit -c unlimited # insert python3 ./test.py $1 -f insert/basic.py python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/bool.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/tinyint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/smallint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/int.py +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/bigint.py python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/float.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/double.py +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/nchar.py python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/timestamp.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/unsignedTinyint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/unsignedSmallint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/unsignedInt.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/unsignedBigint.py +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/multi.py python3 ./test.py $1 -s && sleep 1 From 770ca9fa6acf22d1a34e08c0886f96dca16d41e9 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 15 Apr 2022 06:58:43 +0800 Subject: [PATCH 18/60] feat: add affected rows --- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 2 ++ source/dnode/vnode/src/tsdb/tsdbTDBImpl.c | 13 ++----------- source/dnode/vnode/src/tsdb/tsdbWrite.c | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 54115003cf..5a477e646c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -375,6 +375,8 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p if (pMemTable->keyMin > keyMin) pMemTable->keyMin = keyMin; if (pMemTable->keyMax < keyMax) pMemTable->keyMax = keyMax; + (*pAffectedRows) += pBlock->numOfRows; + // STSRow* lastRow = NULL; // int64_t osize = SL_SIZE(pTableData->pData); // tsdbSetupSkipListHookFns(pTableData->pData, pRepo, pTable, &points, &lastRow); diff --git a/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c index 519ecd3fa0..ebfa1ecaeb 100644 --- a/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c @@ -107,8 +107,7 @@ int32_t tsdbSaveSmaToDB(SDBFile *pDBF, void *pKey, int32_t keyLen, void *pVal, i } void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32_t *valLen) { - void *result; - void *pVal; + void *pVal = NULL; int ret; ret = tdbDbGet(pDBF->pDB, pKey, keyLen, &pVal, valLen); @@ -120,18 +119,10 @@ void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32 ASSERT(*valLen >= 0); - result = taosMemoryMalloc(*valLen); - - if (result == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; - } - // TODO: lock? // TODO: Would the key/value be destoryed during return the data? // TODO: How about the key is updated while value length is changed? The original value buffer would be freed // automatically? - memcpy(result, pVal, *valLen); - return result; + return pVal; } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c index abfcc675ea..910b5adc96 100644 --- a/source/dnode/vnode/src/tsdb/tsdbWrite.c +++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c @@ -31,5 +31,5 @@ int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp) { return -1; } } - return tsdbMemTableInsert(pTsdb, pTsdb->mem, pMsg, NULL); + return tsdbMemTableInsert(pTsdb, pTsdb->mem, pMsg, pRsp); } \ No newline at end of file From 3b9e9772d013e4260efa5fecf1cc7f90c2940169 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:12:29 +0800 Subject: [PATCH 19/60] test: reopen dbTest --- .../dnode/mnode/impl/test/db/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/db/db.cpp | 143 +++--------------- 2 files changed, 27 insertions(+), 124 deletions(-) diff --git a/source/dnode/mnode/impl/test/db/CMakeLists.txt b/source/dnode/mnode/impl/test/db/CMakeLists.txt index 1a5b4d3936..3f6a80835f 100644 --- a/source/dnode/mnode/impl/test/db/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/db/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_db -# COMMAND mnode_test_db -#) +add_test( + NAME dbTest + COMMAND dbTest +) diff --git a/source/dnode/mnode/impl/test/db/db.cpp b/source/dnode/mnode/impl/test/db/db.cpp index 0282663b17..adba6ca434 100644 --- a/source/dnode/mnode/impl/test/db/db.cpp +++ b/source/dnode/mnode/impl/test/db/db.cpp @@ -26,29 +26,8 @@ class MndTestDb : public ::testing::Test { Testbase MndTestDb::test; TEST_F(MndTestDb, 01_ShowDb) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vgroups"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "ntables"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_SMALLINT, 2, "replica"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_SMALLINT, 2, "quorum"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_SMALLINT, 2, "days"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "keep0,keep1,keep2"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "cache"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_INT, 4, "blocks"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_INT, 4, "minrows"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "maxrows"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_TINYINT, 1, "wallevel"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_INT, 4, "fsync"); - CHECK_SCHEMA(14, TSDB_DATA_TYPE_TINYINT, 1, "comp"); - CHECK_SCHEMA(15, TSDB_DATA_TYPE_TINYINT, 1, "cachelast"); - CHECK_SCHEMA(16, TSDB_DATA_TYPE_BINARY, 3 + VARSTR_HEADER_SIZE, "precision"); -// CHECK_SCHEMA(17, TSDB_DATA_TYPE_TINYINT, 1, "update"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { @@ -58,7 +37,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -66,6 +45,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -74,6 +54,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -84,47 +67,11 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // ntables - CheckInt16(1); // replica - CheckInt16(1); // quorum - CheckInt16(10); // days - CheckBinary("3650,3650,3650", 24); // days - CheckInt32(16); // cache - CheckInt32(10); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(1); // wallevel - CheckInt32(3000); // fsync - CheckInt8(2); // comp - CheckInt8(0); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update - - test.SendShowMetaReq(TSDB_MGMT_TABLE_VGROUP, "1.d1"); - CHECK_META("show vgroups", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "vgId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "tables"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "v1_dnode"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, 9 + VARSTR_HEADER_SIZE, "v1_status"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_VGROUP, "vgroups", "1.d1"); EXPECT_EQ(test.GetShowRows(), 2); - CheckInt32(2); - CheckInt32(3); - IgnoreInt32(); - IgnoreInt32(); - CheckInt16(1); - CheckInt16(1); - CheckBinary("master", 9); - CheckBinary("master", 9); { SAlterDbReq alterdbReq = {0}; @@ -147,55 +94,14 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); { SDropDbReq dropdbReq = {0}; @@ -214,11 +120,8 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { EXPECT_STREQ(dropdbRsp.db, "1.d1"); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { @@ -228,7 +131,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -236,6 +139,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -244,6 +148,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -254,12 +161,8 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d2", TSDB_DB_NAME_LEN - 1); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); uint64_t d2_uid = 0; From a1f69af4237edeb1121552ecd0e7f331455e8f3c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:23:08 +0800 Subject: [PATCH 20/60] test: reopen dnodeTest --- .../mnode/impl/test/dnode/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/dnode/mdnode.cpp | 118 +----------------- 2 files changed, 9 insertions(+), 117 deletions(-) diff --git a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt index 16e08d6c35..d064df90bc 100644 --- a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_dnode -# COMMAND mnode_test_dnode -#) +add_test( + NAME mdnodeTest + COMMAND mdnodeTest +) diff --git a/source/dnode/mnode/impl/test/dnode/mdnode.cpp b/source/dnode/mnode/impl/test/dnode/mdnode.cpp index f575556345..a4cbc201a9 100644 --- a/source/dnode/mnode/impl/test/dnode/mdnode.cpp +++ b/source/dnode/mnode/impl/test/dnode/mdnode.cpp @@ -51,27 +51,8 @@ TestServer MndTestDnode::server4; TestServer MndTestDnode::server5; TEST_F(MndTestDnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vnodes"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_SMALLINT, 2, "support_vnodes"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "status"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "offline_reason"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); } TEST_F(MndTestDnode, 02_ConfigDnode) { @@ -162,25 +143,8 @@ TEST_F(MndTestDnode, 03_Create_Dnode) { taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9024", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); } TEST_F(MndTestDnode, 04_Drop_Dnode) { @@ -236,19 +200,9 @@ TEST_F(MndTestDnode, 04_Drop_Dnode) { ASSERT_EQ(pRsp->code, TSDB_CODE_MND_DNODE_NOT_EXIST); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); - taosMsleep(2000); server2.Stop(); server2.DoStart(); @@ -298,40 +252,9 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { } taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - // restart uInfo("stop all server"); test.Restart(); @@ -341,37 +264,6 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { server5.Restart(); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); } From e499587d64a9e03c3207917aae0615707e8ea895 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 15 Apr 2022 10:34:28 +0800 Subject: [PATCH 21/60] disable hb --- source/client/src/clientHb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index e65a3017d6..a6678b2ec0 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -655,7 +655,7 @@ int hbMgrInit() { } void hbMgrCleanUp() { - hbStopThread(); + //hbStopThread(); // destroy all appHbMgr int8_t old = atomic_val_compare_exchange_8(&clientHbMgr.inited, 1, 0); From f431cbe03a2190c1bec1c7a60ccb30a60731949b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:39:42 +0800 Subject: [PATCH 22/60] test: reopen funcTest --- source/dnode/mnode/impl/src/mndInfoSchema.c | 10 +++-- .../dnode/mnode/impl/test/func/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/func/func.cpp | 43 +++---------------- 3 files changed, 16 insertions(+), 47 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index c21a6e61df..32c9847fea 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -94,11 +94,13 @@ static const SInfosTableSchema userDBSchema[] = { }; static const SInfosTableSchema userFuncSchema[] = { - {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "name", .bytes = TSDB_FUNC_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "comment", .bytes = PATH_MAX - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "aggregate", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "comment", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "code_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema userIdxSchema[] = { diff --git a/source/dnode/mnode/impl/test/func/CMakeLists.txt b/source/dnode/mnode/impl/test/func/CMakeLists.txt index 26b0a60968..ecb4f851be 100644 --- a/source/dnode/mnode/impl/test/func/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/func/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. FUNC_SRC) -add_executable(mnode_test_func ${FUNC_SRC}) +aux_source_directory(. MNODE_FUNC_TEST_SRC) +add_executable(funcTest ${MNODE_FUNC_TEST_SRC}) target_link_libraries( - mnode_test_func + funcTest PUBLIC sut ) add_test( - NAME mnode_test_func - COMMAND mnode_test_func + NAME funcTest + COMMAND funcTest ) diff --git a/source/dnode/mnode/impl/test/func/func.cpp b/source/dnode/mnode/impl/test/func/func.cpp index f34f77de0c..6b9c410738 100644 --- a/source/dnode/mnode/impl/test/func/func.cpp +++ b/source/dnode/mnode/impl/test/func/func.cpp @@ -26,18 +26,7 @@ class MndTestFunc : public ::testing::Test { Testbase MndTestFunc::test; TEST_F(MndTestFunc, 01_Show_Func) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, PATH_MAX + VARSTR_HEADER_SIZE, "comment"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "aggregate"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_TYPE_STR_MAX_LEN + VARSTR_HEADER_SIZE, "outputtype"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_INT, 4, "code_len"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_INT, 4, "bufsize"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -194,19 +183,8 @@ TEST_F(MndTestFunc, 02_Create_Func) { } } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f1", TSDB_FUNC_NAME_LEN); - CheckBinaryByte('m', TSDB_FUNC_COMMENT_LEN); - CheckInt32(0); - CheckBinary("SMALLINT", TSDB_TYPE_STR_MAX_LEN); - CheckTimestamp(); - CheckInt32(TSDB_FUNC_CODE_LEN); - CheckInt32(4); } TEST_F(MndTestFunc, 03_Retrieve_Func) { @@ -331,10 +309,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -529,20 +504,12 @@ TEST_F(MndTestFunc, 04_Drop_Func) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f2", TSDB_FUNC_NAME_LEN); } From 1a96baf3293cf2ef71ed6017cf8f6bc2feac8f49 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:42:44 +0800 Subject: [PATCH 23/60] test: reopen mnodeTest --- .../mnode/impl/test/mnode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/mnode/mnode.cpp | 43 ++----------------- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt index 4d9b473291..94c25281b2 100644 --- a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. MTEST_SRC) -add_executable(mnode_test_mnode ${MTEST_SRC}) +aux_source_directory(. MNODE_MNODE_TEST_SRC) +add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC}) target_link_libraries( - mnode_test_mnode + mmnodeTest PUBLIC sut ) add_test( - NAME mnode_test_mnode - COMMAND mnode_test_mnode + NAME mmnodeTest + COMMAND mmnodeTest ) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index dd2867f7f9..20cbb28b72 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -39,23 +39,8 @@ Testbase MndTestMnode::test; TestServer MndTestMnode::server2; TEST_F(MndTestMnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - CHECK_META("show mnodes", 5); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, 12 + VARSTR_HEADER_SIZE, "role"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "role_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) { @@ -104,8 +89,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -122,20 +106,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("localhost:9029", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckBinary("slave", 12); - CheckTimestamp(); - CheckTimestamp(); - IgnoreTimestamp(); - IgnoreTimestamp(); } { @@ -151,15 +123,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } { From 2a4a536ce2f888d3bee469e2c797caa5e6e3afdc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:47:00 +0800 Subject: [PATCH 24/60] test: reopen profileTest --- source/dnode/mnode/impl/test/mnode/mnode.cpp | 6 +-- .../mnode/impl/test/profile/CMakeLists.txt | 10 ++--- .../dnode/mnode/impl/test/profile/profile.cpp | 41 ++----------------- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index 20cbb28b72..444c674667 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -39,7 +39,7 @@ Testbase MndTestMnode::test; TestServer MndTestMnode::server2; TEST_F(MndTestMnode, 01_ShowDnode) { - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -106,7 +106,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -123,7 +123,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } diff --git a/source/dnode/mnode/impl/test/profile/CMakeLists.txt b/source/dnode/mnode/impl/test/profile/CMakeLists.txt index 88d7366b7d..8b811ebfed 100644 --- a/source/dnode/mnode/impl/test/profile/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/profile/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. PROFILE_SRC) -add_executable(mnode_test_profile ${PROFILE_SRC}) +aux_source_directory(. MNODE_PROFILE_TEST_SRC) +add_executable(profileTest ${MNODE_PROFILE_TEST_SRC}) target_link_libraries( - mnode_test_profile + profileTest PUBLIC sut ) add_test( - NAME mnode_test_profile - COMMAND mnode_test_profile + NAME profileTest + COMMAND profileTest ) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 14b31e5282..f4be703d72 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -74,25 +74,8 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { } TEST_F(MndTestProfile, 03_ConnectMsg_Show) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - CHECK_META("show connections", 7); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, "program"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "login_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_access"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(1); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("mnode_test_profile", TSDB_APP_NAME_LEN); - CheckInt32(1234); - IgnoreBinary(TSDB_IPv4ADDR_LEN + 6); - CheckTimestamp(); - CheckTimestamp(); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + EXPECT_EQ(test.GetShowRows(), 0); } TEST_F(MndTestProfile, 04_HeartBeatMsg) { @@ -311,24 +294,6 @@ TEST_F(MndTestProfile, 08_KillQueryMsg_InvalidConn) { } TEST_F(MndTestProfile, 09_KillQueryMsg) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QUERIES, ""); - CHECK_META("show queries", 14); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "queryId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 22 + VARSTR_HEADER_SIZE, "qid"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "created_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BIGINT, 8, "time"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 18 + VARSTR_HEADER_SIZE, "sql_obj_id"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "ep"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_BOOL, 1, "stable_query"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "sub_queries"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, "sub_query_info"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, "sql"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QUERIES, "queries", ""); EXPECT_EQ(test.GetShowRows(), 0); } From 66ea2d6bdc45db3933922301b08c3a5dee8dd02b Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 15 Apr 2022 10:49:00 +0800 Subject: [PATCH 25/60] fix(os): .free func const ptr. --- include/os/osMemory.h | 4 ++-- source/libs/transport/src/transComm.c | 2 +- source/libs/transport/test/transportTests.cpp | 12 ++++++------ source/os/src/osMemory.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/os/osMemory.h b/include/os/osMemory.h index e516000c66..4efe69e204 100644 --- a/include/os/osMemory.h +++ b/include/os/osMemory.h @@ -33,13 +33,13 @@ void *taosMemoryMalloc(int32_t size); void *taosMemoryCalloc(int32_t num, int32_t size); void *taosMemoryRealloc(void *ptr, int32_t size); void *taosMemoryStrDup(void *ptr); -void taosMemoryFree(const void *ptr); +void taosMemoryFree(void *ptr); int32_t taosMemorySize(void *ptr); #define taosMemoryFreeClear(ptr) \ do { \ if (ptr) { \ - taosMemoryFree(ptr); \ + taosMemoryFree((void*)ptr); \ (ptr) = NULL; \ } \ } while (0) diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 3078324c6b..ef9cccccb7 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -292,7 +292,7 @@ void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType) { void transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) { queue->q = taosArrayInit(2, sizeof(void*)); - queue->freeFunc = freeFunc; + queue->freeFunc = (void (*)(const void*))freeFunc; } bool transQueuePush(STransQueue* queue, void* arg) { if (queue->q == NULL) { diff --git a/source/libs/transport/test/transportTests.cpp b/source/libs/transport/test/transportTests.cpp index ce795b1763..2488dda3f6 100644 --- a/source/libs/transport/test/transportTests.cpp +++ b/source/libs/transport/test/transportTests.cpp @@ -156,14 +156,14 @@ TEST_F(TransCtxEnv, mergeTest) { STransCtx *src = (STransCtx *)taosMemoryCalloc(1, sizeof(STransCtx)); transCtxInit(src); { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryMalloc(12); taosHashPut(src->args, &key, sizeof(key), &val1, sizeof(val1)); key++; } { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryMalloc(12); taosHashPut(src->args, &key, sizeof(key), &val1, sizeof(val1)); key++; @@ -176,14 +176,14 @@ TEST_F(TransCtxEnv, mergeTest) { STransCtx *src = (STransCtx *)taosMemoryCalloc(1, sizeof(STransCtx)); transCtxInit(src); { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryMalloc(12); taosHashPut(src->args, &key, sizeof(key), &val1, sizeof(val1)); key++; } { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryMalloc(12); taosHashPut(src->args, &key, sizeof(key), &val1, sizeof(val1)); key++; @@ -198,7 +198,7 @@ TEST_F(TransCtxEnv, mergeTest) { STransCtx *src = (STransCtx *)taosMemoryCalloc(1, sizeof(STransCtx)); transCtxInit(src); { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryCalloc(1, 11); memcpy(val1.val, val.c_str(), val.size()); @@ -206,7 +206,7 @@ TEST_F(TransCtxEnv, mergeTest) { key++; } { - STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = taosMemoryFree}; + STransCtxVal val1 = {.val = NULL, .clone = NULL, .freeFunc = (void (*)(const void*))taosMemoryFree}; val1.val = taosMemoryCalloc(1, 11); memcpy(val1.val, val.c_str(), val.size()); taosHashPut(src->args, &key, sizeof(key), &val1, sizeof(val1)); diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 3545aabdca..cd756b45e2 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -156,7 +156,7 @@ void *taosMemoryStrDup(void *ptr) { } -void taosMemoryFree(const void *ptr) { +void taosMemoryFree(void *ptr) { if (ptr == NULL) return; #ifdef USE_TD_MEMORY @@ -166,10 +166,10 @@ void taosMemoryFree(const void *ptr) { // memset(pTdMemoryInfo, 0, sizeof(TdMemoryInfo)); free(pTdMemoryInfo); } else { - free((void*)ptr); + free(ptr); } #else - return free((void*)ptr); + return free(ptr); #endif } From a8ab69e6cbddb0a42dd6c1648867fa6a2e143b9d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:54:04 +0800 Subject: [PATCH 26/60] test: reopen snodeTest --- .../mnode/impl/test/snode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/snode/snode.cpp | 37 +++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/source/dnode/mnode/impl/test/snode/CMakeLists.txt b/source/dnode/mnode/impl/test/snode/CMakeLists.txt index 44a5f35f94..9c60da364c 100644 --- a/source/dnode/mnode/impl/test/snode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/snode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. STEST_SRC) -add_executable(mnode_test_snode ${STEST_SRC}) +aux_source_directory(. MNODE_SNODE_TEST_SRC) +add_executable(msnodeTest ${MNODE_SNODE_TEST_SRC}) target_link_libraries( - mnode_test_snode + msnodeTest PUBLIC sut ) add_test( - NAME mnode_test_snode - COMMAND mnode_test_snode + NAME msnodeTest + COMMAND msnodeTest ) diff --git a/source/dnode/mnode/impl/test/snode/snode.cpp b/source/dnode/mnode/impl/test/snode/snode.cpp index 7d24d89154..3742c06b0a 100644 --- a/source/dnode/mnode/impl/test/snode/snode.cpp +++ b/source/dnode/mnode/impl/test/snode/snode.cpp @@ -39,14 +39,7 @@ Testbase MndTestSnode::test; TestServer MndTestSnode::server2; TEST_F(MndTestSnode, 01_Show_Snode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestSnode, 02_Create_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckBinary("localhost:9017", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { From dbe44ff13671b677c1050d72036acbc0720565fa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:54:15 +0800 Subject: [PATCH 27/60] test: reopen qnodeTest --- .../mnode/impl/test/qnode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/qnode/qnode.cpp | 37 +++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt index 77ac39e409..8259f9f47d 100644 --- a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. QTEST_SRC) -add_executable(mnode_test_qnode ${QTEST_SRC}) +aux_source_directory(. MNODE_QNODE_TEST_SRC) +add_executable(mqnodeTest ${MNODE_QNODE_TEST_SRC}) target_link_libraries( - mnode_test_qnode + mqnodeTest PUBLIC sut ) add_test( - NAME mnode_test_qnode - COMMAND mnode_test_qnode + NAME mqnodeTest + COMMAND mqnodeTest ) diff --git a/source/dnode/mnode/impl/test/qnode/qnode.cpp b/source/dnode/mnode/impl/test/qnode/qnode.cpp index be214cacf2..7240e0f183 100644 --- a/source/dnode/mnode/impl/test/qnode/qnode.cpp +++ b/source/dnode/mnode/impl/test/qnode/qnode.cpp @@ -39,14 +39,7 @@ Testbase MndTestQnode::test; TestServer MndTestQnode::server2; TEST_F(MndTestQnode, 01_Show_Qnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckBinary("localhost:9015", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { From d8b6afee985eac379291ddef565d658bcd4aef36 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:58:15 +0800 Subject: [PATCH 28/60] test: reopen smaTest --- source/dnode/mnode/impl/test/sma/CMakeLists.txt | 10 +++++----- source/dnode/mnode/impl/test/sma/sma.cpp | 15 ++++++--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/source/dnode/mnode/impl/test/sma/CMakeLists.txt b/source/dnode/mnode/impl/test/sma/CMakeLists.txt index 943695abf3..3f9ec123a8 100644 --- a/source/dnode/mnode/impl/test/sma/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/sma/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SMA_SRC) -add_executable(mnode_test_sma ${SMA_SRC}) +aux_source_directory(. MNODE_SMA_TEST_SRC) +add_executable(smaTest ${MNODE_SMA_TEST_SRC}) target_link_libraries( - mnode_test_sma + smaTest PUBLIC sut ) add_test( - NAME mnode_test_sma - COMMAND mnode_test_sma + NAME smaTest + COMMAND smaTest ) diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp index 4b0e33a323..4f3b0d6e37 100644 --- a/source/dnode/mnode/impl/test/sma/sma.cpp +++ b/source/dnode/mnode/impl/test/sma/sma.cpp @@ -207,7 +207,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -216,7 +216,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateTSmaReq(smaname, stbname, 0, "expr", "tagsFilter", "sql", "ast", &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -225,7 +225,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); CHECK_META("show indexes", 3); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -239,7 +239,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildDropTSmaReq(smaname, 0, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } @@ -263,10 +263,8 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildCreateBSmaStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 1); -// CheckBinary("bsmastb", TSDB_TABLE_NAME_LEN); } test.Restart(); @@ -281,8 +279,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildDropStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 0); } From de121928070e2c8e30425192c25d838c2a4b4410 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:58:27 +0800 Subject: [PATCH 29/60] test: reopen showTest --- .../dnode/mnode/impl/test/show/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/show/show.cpp | 37 ++----------------- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/source/dnode/mnode/impl/test/show/CMakeLists.txt b/source/dnode/mnode/impl/test/show/CMakeLists.txt index cc0706ca50..69e93e7086 100644 --- a/source/dnode/mnode/impl/test/show/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/show/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SHOW_SRC) -add_executable(mnode_test_show ${SHOW_SRC}) +aux_source_directory(. MNODE_SHOW_TEST_SRC) +add_executable(showTest ${MNODE_SHOW_TEST_SRC}) target_link_libraries( - mnode_test_show + showTest PUBLIC sut ) add_test( - NAME mnode_test_show - COMMAND mnode_test_show + NAME showTest + COMMAND showTest ) diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index a57d99a257..5b8c186ccf 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -67,42 +67,11 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - - STableMetaRsp* pMeta = test.GetShowMeta(); - EXPECT_STREQ(pMeta->tbName, "show connections"); - EXPECT_EQ(pMeta->numOfTags, 0); - EXPECT_EQ(pMeta->numOfColumns, 7); - EXPECT_EQ(pMeta->precision, 0); - EXPECT_EQ(pMeta->tableType, 0); - EXPECT_EQ(pMeta->update, 0); - EXPECT_EQ(pMeta->sversion, 0); - EXPECT_EQ(pMeta->tversion, 0); - EXPECT_EQ(pMeta->tuid, 0); - EXPECT_EQ(pMeta->suid, 0); - - test.SendShowRetrieveReq(); - - SRetrieveTableRsp* pRetrieveRsp = test.GetRetrieveRsp(); - EXPECT_EQ(pRetrieveRsp->numOfRows, 1); - EXPECT_EQ(pRetrieveRsp->useconds, 0); - EXPECT_EQ(pRetrieveRsp->completed, 1); - EXPECT_EQ(pRetrieveRsp->precision, TSDB_TIME_PRECISION_MILLI); - EXPECT_EQ(pRetrieveRsp->compressed, 0); - EXPECT_EQ(pRetrieveRsp->compLen, 0); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + // EXPECT_EQ(test.GetShowRows(), 1); } TEST_F(MndTestShow, 04_ShowMsg_Cluster) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CLUSTER, ""); - CHECK_META( "show cluster", 3); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BIGINT, 8, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_CLUSTER, "cluster", ""); EXPECT_EQ(test.GetShowRows(), 1); - - IgnoreInt64(); - IgnoreBinary(TSDB_CLUSTER_ID_LEN); - CheckTimestamp(); } \ No newline at end of file From b0f4a396d42eed4896b984a658357a67ccad7021 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 03:48:51 +0000 Subject: [PATCH 30/60] refact vnode --- source/dnode/vnode/CMakeLists.txt | 2 +- source/dnode/vnode/src/inc/vnd.h | 8 ++- source/dnode/vnode/src/vnd/vnodeCfg.c | 93 +++++++++++++++++++++++++- source/dnode/vnode/src/vnd/vnodeOpen.c | 9 ++- 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index f7a3f2f109..c0e458219c 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -4,13 +4,13 @@ target_sources( vnode PRIVATE # vnode + "src/vnd/vnodeOpen.c" "src/vnd/vnodeArenaMAImpl.c" "src/vnd/vnodeBufferPool.c" # "src/vnd/vnodeBufferPool2.c" "src/vnd/vnodeCfg.c" "src/vnd/vnodeCommit.c" "src/vnd/vnodeInt.c" - "src/vnd/vnodeOpen.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" "src/vnd/vnodeWrite.c" diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 1cdb38b650..55b69a9e6e 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -30,6 +30,10 @@ extern "C" { #define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) // clang-format on +// vnodeCfg ==================== +int vnodeSaveCfg(const char* dir, const SVnodeCfg* pCfg); +int vnodeCommitCfg(const char* dir); + // vnodeModule ==================== int vnodeScheduleTask(int (*execute)(void*), void* arg); @@ -75,9 +79,9 @@ void vmaFree(SVMemAllocator* pVMA, void* ptr); bool vmaIsFull(SVMemAllocator* pVMA); // vnodeCfg.h -extern const SVnodeCfg defaultVnodeOptions; +extern const SVnodeCfg vnodeCfgDefault; -int vnodeValidateOptions(const SVnodeCfg*); +int vnodeCheckCfg(const SVnodeCfg*); void vnodeOptionsCopy(SVnodeCfg* pDest, const SVnodeCfg* pSrc); // For commit diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index ef417cabc6..8da9950aa7 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,14 +15,99 @@ #include "vnodeInt.h" -const SVnodeCfg defaultVnodeOptions = { - .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; /* TODO */ +#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME_TMP "vnode_tmp.json" -int vnodeValidateOptions(const SVnodeCfg *pVnodeOptions) { +static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len); +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg); + +const SVnodeCfg vnodeCfgDefault = { + .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; + +int vnodeCheckCfg(const SVnodeCfg *pCfg) { // TODO return 0; } +int vnodeSaveCfg(const char *dir, const SVnodeCfg *pCfg) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile; + uint8_t *data; + int len; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + // encode info + data = NULL; + len = 0; + + if (vnodeEncodeInfo(pCfg, &data, &len) < 0) { + return -1; + } + + // save info to a vnode_tmp.json + pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosWriteFile(pFile, data, len) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + if (taosFsyncFile(pFile) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // free info binary + taosMemoryFree(data); + + vInfo("vgId: %d vnode info is saved, fname: %s", pCfg->vgId, fname); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(data); + return -1; +} + +int vnodeCommitCfg(const char *dir) { + char fname[TSDB_FILENAME_LEN]; + char tfname[TSDB_FILENAME_LEN]; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + if (taosRenameFile(tfname, fname) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + return 0; +} + +int vnodeLoadCfg(const char *dir) { + // TODO + return 0; +} + +static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len) { + // TODO + return 0; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg) { + // TODO + return 0; +} + +#if 1 //====================================================================== void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { memcpy((void *)pDest, (void *)pSrc, sizeof(SVnodeCfg)); } @@ -46,3 +131,5 @@ int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) { return TSDB_CODE_SUCCESS; } + +#endif \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index f208857762..6729f7ce0c 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -21,8 +21,8 @@ static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { -#if 0 char dir[TSDB_FILENAME_LEN]; + // TODO: check if directory exists // check config @@ -34,12 +34,11 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { // create vnode env tfsMkdir(pTfs, path); snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); - if (vnodeSaveCfg(dir, pCfg) < 0) { + if (vnodeSaveCfg(dir, pCfg) < 0 || vnodeCommitCfg(dir) < 0) { vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); return -1; } -#endif return 0; } @@ -47,7 +46,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { SVnode *pVnode = NULL; // Set default options - SVnodeCfg cfg = defaultVnodeOptions; + SVnodeCfg cfg = vnodeCfgDefault; if (pVnodeCfg != NULL) { cfg.vgId = pVnodeCfg->vgId; cfg.msgCb = pVnodeCfg->msgCb; @@ -59,7 +58,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { } // Validate options - if (vnodeValidateOptions(&cfg) < 0) { + if (vnodeCheckCfg(&cfg) < 0) { // TODO return NULL; } From d2761b41145e50bb4ca4d640021e0b91753365df Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 12:09:27 +0800 Subject: [PATCH 31/60] ehn(query): refactor c driver codes. --- source/client/inc/clientInt.h | 35 +++------ source/client/src/clientEnv.c | 7 +- source/client/src/clientImpl.c | 14 ++++ source/client/src/clientMain.c | 4 +- source/client/src/clientMsgHandler.c | 97 +++---------------------- source/libs/executor/src/executorimpl.c | 23 +++--- source/libs/qworker/src/qworker.c | 2 +- 7 files changed, 55 insertions(+), 127 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 0f12880272..32668356ee 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -43,13 +43,23 @@ extern "C" { } \ } while (0) +#define ERROR_MSG_BUF_DEFAULT_SIZE 512 #define HEARTBEAT_INTERVAL 1500 // ms +// todo refactor enum { CONN_TYPE__QUERY = 1, CONN_TYPE__TMQ, }; +enum { + RES_TYPE__QUERY = 1, + RES_TYPE__TMQ, +}; + +#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) + typedef struct SAppInstInfo SAppInstInfo; typedef struct { @@ -172,33 +182,15 @@ typedef struct SReqResultInfo { int32_t payloadLen; } SReqResultInfo; -typedef struct SShowReqInfo { - int64_t execId; // showId/queryId - int32_t vgId; - SArray* pArray; // SArray - int32_t currentIndex; // current accessed vgroup index. -} SShowReqInfo; - typedef struct SRequestSendRecvBody { tsem_t rspSem; // not used now void* fp; - SShowReqInfo showInfo; // todo this attribute will be removed after the query framework being completed. SDataBuf requestMsg; int64_t queryJob; // query job, created according to sql query DAG. struct SQueryPlan* pDag; // the query dag, generated according to the sql statement. SReqResultInfo resInfo; } SRequestSendRecvBody; -#define ERROR_MSG_BUF_DEFAULT_SIZE 512 - -enum { - RES_TYPE__QUERY = 1, - RES_TYPE__TMQ, -}; - -#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) -#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) - typedef struct { int8_t resType; char* topic; @@ -217,7 +209,6 @@ typedef struct SRequestObj { int32_t sqlLen; int64_t self; char* msgBuf; - void* pInfo; // sql parse info, generated by parser module int32_t code; SArray* dbList; SArray* tableList; @@ -252,7 +243,7 @@ extern int (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code); SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj); -int taos_init(); +int taos_init(); void* createTscObj(const char* user, const char* auth, const char* db, SAppInstInfo* pAppInfo); void destroyTscObj(void* pObj); @@ -266,7 +257,6 @@ char* getDbOfConnection(STscObj* pObj); void setConnectionDB(STscObj* pTscObj, const char* db); void resetConnectDB(STscObj* pTscObj); -void taos_init_imp(void); int taos_options_imp(TSDB_OPTION option, const char* str); void* openTransporter(const char* user, const char* auth, int32_t numOfThreads); @@ -286,8 +276,7 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj* void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); void doSetOneRowPtr(SReqResultInfo* pResultInfo); -int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, - bool convertUcs4); +int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, bool convertUcs4); void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols); int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index fec6c8e5db..a258fd305e 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -33,7 +33,7 @@ SAppInfo appInfo; int32_t clientReqRefPool = -1; int32_t clientConnRefPool = -1; -static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; +static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; volatile int32_t tscInitRes = 0; static void registerRequest(SRequestObj *pRequest) { @@ -188,7 +188,6 @@ static void doDestroyRequest(void *p) { taosMemoryFreeClear(pRequest->msgBuf); taosMemoryFreeClear(pRequest->sqlstr); - taosMemoryFreeClear(pRequest->pInfo); taosMemoryFreeClear(pRequest->pDb); doFreeReqResultInfo(&pRequest->body.resInfo); @@ -198,10 +197,6 @@ static void doDestroyRequest(void *p) { schedulerFreeJob(pRequest->body.queryJob); } - if (pRequest->body.showInfo.pArray != NULL) { - taosArrayDestroy(pRequest->body.showInfo.pArray); - } - taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 96a7230ff3..b3615c208c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ #include "clientInt.h" #include "clientLog.h" diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 42d204284e..96ef8d0d21 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -193,7 +193,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { } } else { - // assert to avoid uninitialization error + // assert to avoid un-initialization error ASSERT(0); } return NULL; @@ -355,6 +355,7 @@ int taos_result_precision(TAOS_RES *res) { if (res == NULL) { return TSDB_TIME_PRECISION_MILLI; } + if (TD_RES_QUERY(res)) { SRequestObj *pRequest = (SRequestObj *)res; return pRequest->body.resInfo.precision; @@ -467,6 +468,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { if (res == NULL) { return 0; } + if (TD_RES_TMQ(res)) { SReqResultInfo *pResultInfo = tmqGetNextResInfo(res); if (pResultInfo == NULL) { diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 67c5679cac..87a8e86415 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -117,10 +117,10 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { struct SCatalog *pCatalog = NULL; if (usedbRsp.vgVersion >= 0) { - int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); - if (code != TSDB_CODE_SUCCESS) { + int32_t code1 = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); + if (code1 != TSDB_CODE_SUCCESS) { tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, - tstrerror(code)); + tstrerror(code1)); } else { catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid); } @@ -154,10 +154,10 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { } else { struct SCatalog* pCatalog = NULL; - int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); - if (code != TSDB_CODE_SUCCESS) { + int32_t code1 = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); + if (code1 != TSDB_CODE_SUCCESS) { tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId, - tstrerror(code)); + tstrerror(code1)); } else { catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup); } @@ -209,84 +209,9 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { } void initMsgHandleFp() { -#if 0 - tscBuildMsg[TSDB_SQL_SELECT] = tscBuildQueryMsg; - tscBuildMsg[TSDB_SQL_INSERT] = tscBuildSubmitMsg; - tscBuildMsg[TSDB_SQL_FETCH] = tscBuildFetchMsg; - - tscBuildMsg[TSDB_SQL_CREATE_DB] = tscBuildCreateDbMsg; - tscBuildMsg[TSDB_SQL_CREATE_USER] = tscBuildUserMsg; - tscBuildMsg[TSDB_SQL_CREATE_FUNCTION] = tscBuildCreateFuncMsg; - - tscBuildMsg[TSDB_SQL_CREATE_ACCT] = tscBuildAcctMsg; - tscBuildMsg[TSDB_SQL_ALTER_ACCT] = tscBuildAcctMsg; - - tscBuildMsg[TSDB_SQL_CREATE_TABLE] = tscBuildCreateTableMsg; - tscBuildMsg[TSDB_SQL_DROP_USER] = tscBuildDropUserAcctMsg; - tscBuildMsg[TSDB_SQL_DROP_ACCT] = tscBuildDropUserAcctMsg; - tscBuildMsg[TSDB_SQL_DROP_DB] = tscBuildDropDbMsg; - tscBuildMsg[TSDB_SQL_DROP_FUNCTION] = tscBuildDropFuncMsg; - tscBuildMsg[TSDB_SQL_SYNC_DB_REPLICA] = tscBuildSyncDbReplicaMsg; - tscBuildMsg[TSDB_SQL_DROP_TABLE] = tscBuildDropTableMsg; - tscBuildMsg[TSDB_SQL_ALTER_USER] = tscBuildUserMsg; - tscBuildMsg[TSDB_SQL_CREATE_DNODE] = tscBuildCreateDnodeMsg; - tscBuildMsg[TSDB_SQL_DROP_DNODE] = tscBuildDropDnodeMsg; - tscBuildMsg[TSDB_SQL_CFG_DNODE] = tscBuildCfgDnodeMsg; - tscBuildMsg[TSDB_SQL_ALTER_TABLE] = tscBuildAlterTableMsg; - tscBuildMsg[TSDB_SQL_UPDATE_TAG_VAL] = tscBuildUpdateTagMsg; - tscBuildMsg[TSDB_SQL_ALTER_DB] = tscAlterDbMsg; - tscBuildMsg[TSDB_SQL_COMPACT_VNODE] = tscBuildCompactMsg; - - - tscBuildMsg[TSDB_SQL_USE_DB] = tscBuildUseDbMsg; - tscBuildMsg[TSDB_SQL_STABLEVGROUP] = tscBuildSTableVgroupMsg; - tscBuildMsg[TSDB_SQL_RETRIEVE_FUNC] = tscBuildRetrieveFuncMsg; - - tscBuildMsg[TSDB_SQL_HB] = tscBuildHeartBeatMsg; - tscBuildMsg[TSDB_SQL_SHOW] = tscBuildShowMsg; - tscBuildMsg[TSDB_SQL_RETRIEVE_MNODE] = tscBuildRetrieveFromMgmtMsg; - tscBuildMsg[TSDB_SQL_KILL_QUERY] = tscBuildKillMsg; - tscBuildMsg[TSDB_SQL_KILL_STREAM] = tscBuildKillMsg; - tscBuildMsg[TSDB_SQL_KILL_CONNECTION] = tscBuildKillMsg; - - tscProcessMsgRsp[TSDB_SQL_SELECT] = tscProcessQueryRsp; - tscProcessMsgRsp[TSDB_SQL_FETCH] = tscProcessRetrieveRspFromNode; - - tscProcessMsgRsp[TSDB_SQL_DROP_DB] = tscProcessDropDbRsp; - tscProcessMsgRsp[TSDB_SQL_DROP_TABLE] = tscProcessDropTableRsp; - - tscProcessMsgRsp[TSDB_SQL_USE_DB] = tscProcessUseDbRsp; - tscProcessMsgRsp[TSDB_SQL_META] = tscProcessTableMetaRsp; - tscProcessMsgRsp[TSDB_SQL_STABLEVGROUP] = tscProcessSTableVgroupRsp; - tscProcessMsgRsp[TSDB_SQL_MULTI_META] = tscProcessMultiTableMetaRsp; - tscProcessMsgRsp[TSDB_SQL_RETRIEVE_FUNC] = tscProcessRetrieveFuncRsp; - - tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp; - tscProcessMsgRsp[TSDB_SQL_RETRIEVE_MNODE] = tscProcessRetrieveRspFromNode; // rsp handled by same function. - tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp; - - tscProcessMsgRsp[TSDB_SQL_CURRENT_DB] = tscProcessLocalRetrieveRsp; - tscProcessMsgRsp[TSDB_SQL_CURRENT_USER] = tscProcessLocalRetrieveRsp; - tscProcessMsgRsp[TSDB_SQL_SERV_VERSION] = tscProcessLocalRetrieveRsp; - tscProcessMsgRsp[TSDB_SQL_CLI_VERSION] = tscProcessLocalRetrieveRsp; - tscProcessMsgRsp[TSDB_SQL_SERV_STATUS] = tscProcessLocalRetrieveRsp; - - tscProcessMsgRsp[TSDB_SQL_RETRIEVE_EMPTY_RESULT] = tscProcessEmptyResultRsp; - - tscProcessMsgRsp[TSDB_SQL_RETRIEVE_GLOBALMERGE] = tscProcessRetrieveGlobalMergeRsp; - - tscProcessMsgRsp[TSDB_SQL_ALTER_TABLE] = tscProcessAlterTableMsgRsp; - tscProcessMsgRsp[TSDB_SQL_ALTER_DB] = tscProcessAlterDbMsgRsp; - tscProcessMsgRsp[TSDB_SQL_COMPACT_VNODE] = tscProcessCompactRsp; - - tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_TABLE] = tscProcessShowCreateRsp; - tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_STABLE] = tscProcessShowCreateRsp; - tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_DATABASE] = tscProcessShowCreateRsp; -#endif - - handleRequestRspFp[TMSG_INDEX(TDMT_MND_CONNECT)] = processConnectRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_DB)] = processCreateDbRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_USE_DB)] = processUseDbRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_STB)] = processCreateTableRsp; - handleRequestRspFp[TMSG_INDEX(TDMT_MND_DROP_DB)] = processDropDbRsp; + handleRequestRspFp[TMSG_INDEX(TDMT_MND_CONNECT)] = processConnectRsp; + handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_DB)] = processCreateDbRsp; + handleRequestRspFp[TMSG_INDEX(TDMT_MND_USE_DB)] = processUseDbRsp; + handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_STB)] = processCreateTableRsp; + handleRequestRspFp[TMSG_INDEX(TDMT_MND_DROP_DB)] = processDropDbRsp; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 45674d31bc..20b7169895 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -6815,6 +6815,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo ops[i] = createOperatorTree(pChildNode, pTaskInfo, pHandle, queryId, taskId, pTableGroupInfo); } + SOperatorInfo* pOptr = NULL; if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) { SProjectPhysiNode* pProjPhyNode = (SProjectPhysiNode*) pPhyNode; SExprInfo* pExprInfo = createExprInfo(pProjPhyNode->pProjections, NULL, &num); @@ -6822,7 +6823,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SLimit limit = {.limit = pProjPhyNode->limit, .offset = pProjPhyNode->offset}; SLimit slimit = {.limit = pProjPhyNode->slimit, .offset = pProjPhyNode->soffset}; - return createProjectOperatorInfo(ops[0], pExprInfo, num, pResBlock, &limit, &slimit, pTaskInfo); + pOptr = createProjectOperatorInfo(ops[0], pExprInfo, num, pResBlock, &limit, &slimit, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_AGG == type) { SAggPhysiNode* pAggNode = (SAggPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pAggNode->pAggFuncs, pAggNode->pGroupKeys, &num); @@ -6836,9 +6837,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo pScalarExprInfo = createExprInfo(pAggNode->pExprs, NULL, &numOfScalarExpr); } - return createGroupOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pAggNode->node.pConditions, pScalarExprInfo, numOfScalarExpr, pTaskInfo, NULL); + pOptr = createGroupOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pAggNode->node.pConditions, pScalarExprInfo, numOfScalarExpr, pTaskInfo, NULL); } else { - return createAggregateOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo, pTableGroupInfo); + pOptr = createAggregateOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo, pTableGroupInfo); } } else if (QUERY_NODE_PHYSICAL_PLAN_INTERVAL == type) { SIntervalPhysiNode* pIntervalPhyNode = (SIntervalPhysiNode*)pPhyNode; @@ -6856,39 +6857,39 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo }; int32_t primaryTsSlotId = ((SColumnNode*) pIntervalPhyNode->window.pTspk)->slotId; - return createIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, primaryTsSlotId, pTableGroupInfo, pTaskInfo); + pOptr = createIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, primaryTsSlotId, pTableGroupInfo, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) { SSortPhysiNode* pSortPhyNode = (SSortPhysiNode*)pPhyNode; SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SArray* info = createSortInfo(pSortPhyNode->pSortKeys, pSortPhyNode->pTargets); SArray* slotMap = createIndexMap(pSortPhyNode->pTargets); - return createSortOperatorInfo(ops[0], pResBlock, info, slotMap, pTaskInfo); + pOptr = createSortOperatorInfo(ops[0], pResBlock, info, slotMap, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW == type) { SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pSessionNode->window.pFuncs, NULL, &num); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); - return createSessionAggOperatorInfo(ops[0], pExprInfo, num, pResBlock, pSessionNode->gap, pTaskInfo); + pOptr = createSessionAggOperatorInfo(ops[0], pExprInfo, num, pResBlock, pSessionNode->gap, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_PARTITION == type) { SPartitionPhysiNode* pPartNode = (SPartitionPhysiNode*) pPhyNode; SArray* pColList = extractPartitionColInfo(pPartNode->pPartitionKeys); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SExprInfo* pExprInfo = createExprInfo(pPartNode->pTargets, NULL, &num); - return createPartitionOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pTaskInfo, NULL); + pOptr = createPartitionOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pTaskInfo, NULL); } else if (QUERY_NODE_PHYSICAL_PLAN_STATE_WINDOW == type) { SStateWinodwPhysiNode* pStateNode = (SStateWinodwPhysiNode*) pPhyNode; SExprInfo* pExprInfo = createExprInfo(pStateNode->window.pFuncs, NULL, &num); SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); - return createStatewindowOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo); + pOptr = createStatewindowOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_JOIN == type) { SJoinPhysiNode* pJoinNode = (SJoinPhysiNode*) pPhyNode; SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); SExprInfo* pExprInfo = createExprInfo(pJoinNode->pTargets, NULL, &num); - return createJoinOperatorInfo(ops, size, pExprInfo, num, pResBlock, pJoinNode->pOnConditions, pTaskInfo); + pOptr = createJoinOperatorInfo(ops, size, pExprInfo, num, pResBlock, pJoinNode->pOnConditions, pTaskInfo); } else { ASSERT(0); } /*else if (pPhyNode->info.type == OP_MultiTableAggregate) { @@ -6901,7 +6902,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo return createMultiTableAggOperatorInfo(op, pPhyNode->pTargets, pTaskInfo, pTableGroupInfo); } }*/ - return NULL; + + taosMemoryFree(ops); + return pOptr; } static tsdbReaderT createDataReaderImpl(STableScanPhysiNode* pTableScanNode, STableGroupInfo* pGroupInfo, diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 67871dfe62..a9a360e03e 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -1020,7 +1020,7 @@ int32_t qwProcessReady(QW_FPARAMS_DEF, SQWMsg *qwMsg) { } if (ctx->phase == QW_PHASE_PRE_QUERY) { - ctx->ctrlConnInfo.handle == qwMsg->connInfo.handle; + ctx->ctrlConnInfo.handle = qwMsg->connInfo.handle; ctx->ctrlConnInfo.ahandle = qwMsg->connInfo.ahandle; QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_READY); needRsp = false; From 85496cbb4c74a2009b59a2be2d3fc873d7a0707f Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 15 Apr 2022 13:17:25 +0800 Subject: [PATCH 32/60] fix(connector): lua example compile for 3.0 (#11523) * [TD-13558]: taos shell refactor add taosTools as submodule * add tools/taos-tools * add more client interface for taosTools compile * update taos-tools * update taos-tools * refactor shell * [TD-13558]: taos shell test speed * [TD-13558]: taos -n startup works * taos -n rpc works * taos -n server works * cleanup code since no endPort in 3.0 * update taos-tools * [TD-13558]: taos -C works * improve taos shell -c WIP * update taos-tools * add demoapi.c * adjust show databases result for 3.0 * test: add platform logic * add nchar * adjust taos_fetch_lengths * print fields * remove show databases check from insert cases * fix lua example compile for 3.0 still not work --- examples/lua/build.sh | 2 +- examples/lua/lua_connector.c | 140 +++++------------------------------ 2 files changed, 19 insertions(+), 123 deletions(-) diff --git a/examples/lua/build.sh b/examples/lua/build.sh index 9d00c68425..1e6fef632c 100755 --- a/examples/lua/build.sh +++ b/examples/lua/build.sh @@ -4,5 +4,5 @@ if [ "$lua_header_installed" = "0" ]; then sudo apt install -y liblua5.3-dev fi -gcc -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 +gcc -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 -I../../include/client diff --git a/examples/lua/lua_connector.c b/examples/lua/lua_connector.c index 76634ed254..3c13b196b9 100644 --- a/examples/lua/lua_connector.c +++ b/examples/lua/lua_connector.c @@ -1,11 +1,11 @@ -#include -#include -#include +#include #include #include -#include #include -#include "../../../include/client/taos.h" +#include +#include +#include +#include "taos.h" struct cb_param{ lua_State* state; @@ -28,14 +28,14 @@ static int l_connect(lua_State *L){ luaL_checktype(L, 1, LUA_TTABLE); - lua_getfield(L,1,"host"); + lua_getfield(L, 1,"host"); if (lua_isstring(L,-1)){ host = lua_tostring(L, -1); // printf("host = %s\n", host); } lua_getfield(L, 1, "port"); - if (lua_isinteger(L,-1)){ + if (lua_isinteger(L, -1)){ port = lua_tointeger(L, -1); //printf("port = %d\n", port); } @@ -60,8 +60,6 @@ static int l_connect(lua_State *L){ lua_settop(L,0); - taos_init(); - lua_newtable(L); int table_index = lua_gettop(L); @@ -102,7 +100,7 @@ static int l_query(lua_State *L){ printf("failed, reason:%s\n", taos_errstr(result)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, taos_errstr(result)); lua_setfield(L, table_index, "error"); return 1; @@ -113,7 +111,6 @@ static int l_query(lua_State *L){ int rows = 0; int num_fields = taos_field_count(result); const TAOS_FIELD *fields = taos_fetch_fields(result); - //char temp[256]; const int affectRows = taos_affected_rows(result); // printf(" affect rows:%d\r\n", affectRows); @@ -122,7 +119,7 @@ static int l_query(lua_State *L){ lua_pushinteger(L, affectRows); lua_setfield(L, table_index, "affected"); lua_newtable(L); - + while ((row = taos_fetch_row(result))) { //printf("row index:%d\n",rows); rows++; @@ -136,17 +133,21 @@ static int l_query(lua_State *L){ } lua_pushstring(L,fields[i].name); - + int32_t* length = taos_fetch_lengths(result); switch (fields[i].type) { + case TSDB_DATA_TYPE_UTINYINT: case TSDB_DATA_TYPE_TINYINT: lua_pushinteger(L,*((char *)row[i])); break; + case TSDB_DATA_TYPE_USMALLINT: case TSDB_DATA_TYPE_SMALLINT: lua_pushinteger(L,*((short *)row[i])); break; + case TSDB_DATA_TYPE_UINT: case TSDB_DATA_TYPE_INT: lua_pushinteger(L,*((int *)row[i])); break; + case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_BIGINT: lua_pushinteger(L,*((int64_t *)row[i])); break; @@ -156,9 +157,11 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_DOUBLE: lua_pushnumber(L,*((double *)row[i])); break; + case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - lua_pushstring(L,(char *)row[i]); + //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]); + lua_pushlstring(L,(char *)row[i], length[i]); break; case TSDB_DATA_TYPE_TIMESTAMP: lua_pushinteger(L,*((int64_t *)row[i])); @@ -166,6 +169,7 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_BOOL: lua_pushinteger(L,*((char *)row[i])); break; + case TSDB_DATA_TYPE_NULL: default: lua_pushnil(L); break; @@ -235,112 +239,6 @@ static int l_async_query(lua_State *L){ return 1; } -void stream_cb(void *param, TAOS_RES *result, TAOS_ROW row){ - struct cb_param* p = (struct cb_param*) param; - TAOS_FIELD *fields = taos_fetch_fields(result); - int numFields = taos_num_fields(result); - - // printf("\nnumfields:%d\n", numFields); - //printf("\n\r-----------------------------------------------------------------------------------\n"); - - lua_State *L = p->state; - lua_rawgeti(L, LUA_REGISTRYINDEX, p->callback); - - lua_newtable(L); - - for (int i = 0; i < numFields; ++i) { - if (row[i] == NULL) { - continue; - } - - lua_pushstring(L,fields[i].name); - - switch (fields[i].type) { - case TSDB_DATA_TYPE_TINYINT: - lua_pushinteger(L,*((char *)row[i])); - break; - case TSDB_DATA_TYPE_SMALLINT: - lua_pushinteger(L,*((short *)row[i])); - break; - case TSDB_DATA_TYPE_INT: - lua_pushinteger(L,*((int *)row[i])); - break; - case TSDB_DATA_TYPE_BIGINT: - lua_pushinteger(L,*((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_FLOAT: - lua_pushnumber(L,*((float *)row[i])); - break; - case TSDB_DATA_TYPE_DOUBLE: - lua_pushnumber(L,*((double *)row[i])); - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - lua_pushstring(L,(char *)row[i]); - break; - case TSDB_DATA_TYPE_TIMESTAMP: - lua_pushinteger(L,*((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_BOOL: - lua_pushinteger(L,*((char *)row[i])); - break; - default: - lua_pushnil(L); - break; - } - - lua_settable(L, -3); - } - - lua_call(L, 1, 0); - - // printf("-----------------------------------------------------------------------------------\n\r"); -} - -static int l_open_stream(lua_State *L){ - int r = luaL_ref(L, LUA_REGISTRYINDEX); - TAOS * taos = (TAOS*)lua_topointer(L,1); - const char * sqlstr = lua_tostring(L,2); - int stime = luaL_checknumber(L,3); - - lua_newtable(L); - int table_index = lua_gettop(L); - - struct cb_param *p = malloc(sizeof(struct cb_param)); - p->state = L; - p->callback=r; - // printf("r:%d, L:%d\n",r,L); - void * s = taos_open_stream(taos,sqlstr,stream_cb,stime,p,NULL); - if (s == NULL) { - printf("failed to open stream, reason:%s\n", taos_errstr(taos)); - free(p); - lua_pushnumber(L, -1); - lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); - lua_setfield(L, table_index, "error"); - lua_pushlightuserdata(L,NULL); - lua_setfield(L, table_index, "stream"); - }else{ - // printf("success to open stream\n"); - lua_pushnumber(L, 0); - lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); - lua_setfield(L, table_index, "error"); - p->stream = s; - lua_pushlightuserdata(L,p); - lua_setfield(L, table_index, "stream");//stream has different content in lua and c. - } - - return 1; -} - -static int l_close_stream(lua_State *L){ - //TODO:get stream and free cb_param - struct cb_param *p = lua_touserdata(L,1); - taos_close_stream(p->stream); - free(p); - return 0; -} static int l_close(lua_State *L){ TAOS *taos= (TAOS*)lua_topointer(L,1); @@ -367,8 +265,6 @@ static const struct luaL_Reg lib[] = { {"query", l_query}, {"query_a",l_async_query}, {"close", l_close}, - {"open_stream", l_open_stream}, - {"close_stream", l_close_stream}, {NULL, NULL} }; From 1e73923c4dd7fb1cbf404574d0bf1f70d6f58e94 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:31:08 +0800 Subject: [PATCH 33/60] test: reopen userTest --- .../dnode/mnode/impl/test/user/CMakeLists.txt | 10 +- source/dnode/mnode/impl/test/user/user.cpp | 121 ++---------------- 2 files changed, 17 insertions(+), 114 deletions(-) diff --git a/source/dnode/mnode/impl/test/user/CMakeLists.txt b/source/dnode/mnode/impl/test/user/CMakeLists.txt index c6aeef7221..b39ea0e73f 100644 --- a/source/dnode/mnode/impl/test/user/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/user/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. USER_SRC) -add_executable(mnode_test_user ${USER_SRC}) +aux_source_directory(. MNODE_USER_TEST_SRC) +add_executable(userTest ${MNODE_USER_TEST_SRC}) target_link_libraries( - mnode_test_user + userTest PUBLIC sut ) add_test( - NAME mnode_test_user - COMMAND mnode_test_user + NAME userTest + COMMAND userTest ) diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp index 97a144fdee..4e7f3c0213 100644 --- a/source/dnode/mnode/impl/test/user/user.cpp +++ b/source/dnode/mnode/impl/test/user/user.cpp @@ -26,21 +26,8 @@ class MndTestUser : public ::testing::Test { Testbase MndTestUser::test; TEST_F(MndTestUser, 01_Show_User) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "privilege"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "account"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestUser, 02_Create_User) { @@ -99,18 +86,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -125,8 +102,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -144,18 +120,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -170,8 +136,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -191,8 +156,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -437,8 +401,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -497,10 +460,7 @@ TEST_F(MndTestUser, 05_Drop_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -533,25 +493,9 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SAlterUserReq alterReq = {0}; alterReq.alterType = TSDB_ALTER_USER_PASSWD; @@ -567,25 +511,8 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SDropUserReq dropReq = {0}; strcpy(dropReq.user, "u1"); @@ -599,37 +526,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - // restart test.Restart(); taosMsleep(1000); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } From 367064591a7401249baf98b4087cf07af5d56c56 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 13:40:50 +0800 Subject: [PATCH 34/60] refactor(driver): refactor c driver and remove redundant codes. --- include/libs/parser/parser.h | 1 + source/client/inc/clientInt.h | 6 +++--- source/client/src/client.c | 0 source/client/src/clientEnv.c | 10 +++++----- source/client/src/clientImpl.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 source/client/src/client.c diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index fef624288a..02cd073226 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -57,6 +57,7 @@ typedef struct SQuery { SNode* pRoot; int32_t numOfResCols; SSchema* pResSchema; + int8_t precision; SCmdMsgInfo* pCmdMsg; int32_t msgType; SArray* pDbList; diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 32668356ee..6af1fd6016 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -204,11 +204,11 @@ typedef struct SRequestObj { uint64_t requestId; int32_t type; // request type STscObj* pTscObj; - char* pDb; + char* pDb; // current database string char* sqlstr; // sql string int32_t sqlLen; int64_t self; - char* msgBuf; + char* msgBuf; // error msg buffer int32_t code; SArray* dbList; SArray* tableList; @@ -276,8 +276,8 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj* void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); void doSetOneRowPtr(SReqResultInfo* pResultInfo); -int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, bool convertUcs4); void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols); +void setResPrecision(SReqResultInfo* pResInfo, int32_t precision); int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4); // --- heartbeat diff --git a/source/client/src/client.c b/source/client/src/client.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index a258fd305e..8efee9bffb 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -27,10 +27,10 @@ #include "ttime.h" #define TSC_VAR_NOT_RELEASE 1 -#define TSC_VAR_RELEASED 0 +#define TSC_VAR_RELEASED 0 SAppInfo appInfo; -int32_t clientReqRefPool = -1; +int32_t clientReqRefPool = -1; int32_t clientConnRefPool = -1; static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; @@ -48,8 +48,8 @@ static void registerRequest(SRequestObj *pRequest) { if (pTscObj->pAppInfo) { SInstanceSummary *pSummary = &pTscObj->pAppInfo->summary; - int32_t total = atomic_add_fetch_64(&pSummary->totalRequests, 1); - int32_t currentInst = atomic_add_fetch_64(&pSummary->currentRequests, 1); + int32_t total = atomic_add_fetch_64((int64_t*)&pSummary->totalRequests, 1); + int32_t currentInst = atomic_add_fetch_64((int64_t*)&pSummary->currentRequests, 1); tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64 ", current:%d, app current:%d, total:%d, reqId:0x%" PRIx64, pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); @@ -62,7 +62,7 @@ static void deregisterRequest(SRequestObj *pRequest) { STscObj * pTscObj = pRequest->pTscObj; SInstanceSummary *pActivity = &pTscObj->pAppInfo->summary; - int32_t currentInst = atomic_sub_fetch_64(&pActivity->currentRequests, 1); + int32_t currentInst = atomic_sub_fetch_64((int64_t*)&pActivity->currentRequests, 1); int32_t num = atomic_sub_fetch_32(&pTscObj->numOfReqs, 1); int64_t duration = taosGetTimestampUs() - pRequest->metric.start; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b3615c208c..85e3979477 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -229,7 +229,7 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra } void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols) { - assert(pSchema != NULL && numOfCols > 0); + ASSERT(pSchema != NULL && numOfCols > 0); pResInfo->numOfCols = numOfCols; pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); From eaa6cd56a68e91a28530a9e105553a2c82aff70c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 13:42:03 +0800 Subject: [PATCH 35/60] enh(query): add an new internal api to extract query result timestamp precision before the query response received from dnode. --- source/client/src/clientImpl.c | 9 +++++++++ source/libs/parser/src/parTranslater.c | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 85e3979477..a64fa13dd8 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -175,6 +175,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery) { if (TSDB_CODE_SUCCESS == code) { if ((*pQuery)->haveResultSet) { setResSchemaInfo(&pRequest->body.resInfo, (*pQuery)->pResSchema, (*pQuery)->numOfResCols); + setResPrecision(&pRequest->body.resInfo, (*pQuery)->precision); } TSWAP(pRequest->dbList, (*pQuery)->pDbList, SArray*); @@ -253,6 +254,14 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t } } +void setResPrecision(SReqResultInfo* pResInfo, int32_t precision) { + if (precision != TSDB_TIME_PRECISION_MILLI && precision != TSDB_TIME_PRECISION_MICRO && precision != TSDB_TIME_PRECISION_NANO) { + return; + } + + pResInfo->precision = precision; +} + int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList) { void* pTransporter = pRequest->pTscObj->pAppInfo->pTransporter; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 250c6c2fd1..f89f5fbb22 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2198,6 +2198,10 @@ static int32_t extractSelectResultSchema(const SSelectStmt* pSelect, int32_t* nu return TSDB_CODE_SUCCESS; } +static int8_t extractResultTsPrecision(const SSelectStmt* pSelect) { + return pSelect->precision; +} + static int32_t extractExplainResultSchema(int32_t* numOfCols, SSchema** pSchema) { *numOfCols = 1; *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); @@ -2219,19 +2223,19 @@ static int32_t extractDescribeResultSchema(int32_t* numOfCols, SSchema** pSchema (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; (*pSchema)[0].bytes = DESCRIBE_RESULT_FIELD_LEN; - strcpy((*pSchema)[0].name, "Field"); + strcpy((*pSchema)[0].name, "field"); (*pSchema)[1].type = TSDB_DATA_TYPE_BINARY; (*pSchema)[1].bytes = DESCRIBE_RESULT_TYPE_LEN; - strcpy((*pSchema)[1].name, "Type"); + strcpy((*pSchema)[1].name, "type"); (*pSchema)[2].type = TSDB_DATA_TYPE_INT; (*pSchema)[2].bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; - strcpy((*pSchema)[2].name, "Length"); + strcpy((*pSchema)[2].name, "length"); (*pSchema)[3].type = TSDB_DATA_TYPE_BINARY; (*pSchema)[3].bytes = DESCRIBE_RESULT_NOTE_LEN; - strcpy((*pSchema)[3].name, "Note"); + strcpy((*pSchema)[3].name, "note"); return TSDB_CODE_SUCCESS; } @@ -2912,6 +2916,8 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { if (TSDB_CODE_SUCCESS != extractResultSchema(pQuery->pRoot, &pQuery->numOfResCols, &pQuery->pResSchema)) { return TSDB_CODE_OUT_OF_MEMORY; } + + pQuery->precision = extractResultTsPrecision((SSelectStmt*) pQuery->pRoot); } if (NULL != pCxt->pDbs) { From 1592ea69d5ab71f8cfc303359078dba429b526a1 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 05:47:57 +0000 Subject: [PATCH 36/60] refact vnod --- source/dnode/vnode/src/inc/vnd.h | 6 +- source/dnode/vnode/src/inc/vnodeInt.h | 6 ++ source/dnode/vnode/src/vnd/vnodeCfg.c | 84 ----------------------- source/dnode/vnode/src/vnd/vnodeCommit.c | 87 +++++++++++++++++++++++- source/dnode/vnode/src/vnd/vnodeOpen.c | 13 +++- 5 files changed, 106 insertions(+), 90 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 55b69a9e6e..913fec64ed 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -31,8 +31,6 @@ extern "C" { // clang-format on // vnodeCfg ==================== -int vnodeSaveCfg(const char* dir, const SVnodeCfg* pCfg); -int vnodeCommitCfg(const char* dir); // vnodeModule ==================== int vnodeScheduleTask(int (*execute)(void*), void* arg); @@ -42,6 +40,10 @@ int vnodeQueryOpen(SVnode* pVnode); void vnodeQueryClose(SVnode* pVnode); int vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); +// vnodeCommit ==================== +int vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); +int vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); + #if 1 // SVBufPool int vnodeOpenBufPool(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index f988df01cb..b0b87665ed 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -43,6 +43,7 @@ extern "C" { #endif +typedef struct SVnodeInfo SVnodeInfo; typedef struct SMeta SMeta; typedef struct STsdb STsdb; typedef struct STQ STQ; @@ -72,6 +73,11 @@ struct SVState { int64_t applied; }; +struct SVnodeInfo { + SVnodeCfg config; + SVState state; +}; + struct SVnode { int32_t vgId; char* path; diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 8da9950aa7..34b983c20c 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,12 +15,6 @@ #include "vnodeInt.h" -#define VND_INFO_FNAME "vnode.json" -#define VND_INFO_FNAME_TMP "vnode_tmp.json" - -static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len); -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg); - const SVnodeCfg vnodeCfgDefault = { .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; @@ -29,84 +23,6 @@ int vnodeCheckCfg(const SVnodeCfg *pCfg) { return 0; } -int vnodeSaveCfg(const char *dir, const SVnodeCfg *pCfg) { - char fname[TSDB_FILENAME_LEN]; - TdFilePtr pFile; - uint8_t *data; - int len; - - snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); - - // encode info - data = NULL; - len = 0; - - if (vnodeEncodeInfo(pCfg, &data, &len) < 0) { - return -1; - } - - // save info to a vnode_tmp.json - pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - return -1; - } - - if (taosWriteFile(pFile, data, len) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - goto _err; - } - - if (taosFsyncFile(pFile) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - goto _err; - } - - taosCloseFile(&pFile); - - // free info binary - taosMemoryFree(data); - - vInfo("vgId: %d vnode info is saved, fname: %s", pCfg->vgId, fname); - - return 0; - -_err: - taosCloseFile(&pFile); - taosMemoryFree(data); - return -1; -} - -int vnodeCommitCfg(const char *dir) { - char fname[TSDB_FILENAME_LEN]; - char tfname[TSDB_FILENAME_LEN]; - - snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); - snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); - - if (taosRenameFile(tfname, fname) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - return -1; - } - - return 0; -} - -int vnodeLoadCfg(const char *dir) { - // TODO - return 0; -} - -static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len) { - // TODO - return 0; -} - -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg) { - // TODO - return 0; -} - #if 1 //====================================================================== void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { memcpy((void *)pDest, (void *)pSrc, sizeof(SVnodeCfg)); diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index b4c3725a5e..fc74ee9253 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -15,11 +15,86 @@ #include "vnodeInt.h" +#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME_TMP "vnode_tmp.json" + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len); +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); static int vnodeCommit(void *arg); static void vnodeWaitCommit(SVnode *pVnode); +int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile; + uint8_t *data; + int len; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + // encode info + data = NULL; + len = 0; + + if (vnodeEncodeInfo(pInfo, &data, &len) < 0) { + return -1; + } + + // save info to a vnode_tmp.json + pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosWriteFile(pFile, data, len) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + if (taosFsyncFile(pFile) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // free info binary + taosMemoryFree(data); + + vInfo("vgId: %d vnode info is saved, fname: %s", pInfo->config.vgId, fname); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(data); + return -1; +} + +int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + char tfname[TSDB_FILENAME_LEN]; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + if (taosRenameFile(tfname, fname) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + vInfo("vgId: %d vnode info is committed", pInfo->config.vgId); + + return 0; +} + +int vnodeLoadInfo(const char *dir) { + // TODO + return 0; +} + int vnodeAsyncCommit(SVnode *pVnode) { vnodeWaitCommit(pVnode); @@ -60,4 +135,14 @@ static int vnodeEndCommit(SVnode *pVnode) { return 0; } -static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } \ No newline at end of file +static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len) { + // TODO + return 0; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { + // TODO + return 0; +} diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 6729f7ce0c..5fa14f6018 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -21,7 +21,8 @@ static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { - char dir[TSDB_FILENAME_LEN]; + SVnodeInfo info = {0}; + char dir[TSDB_FILENAME_LEN]; // TODO: check if directory exists @@ -32,9 +33,15 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { } // create vnode env - tfsMkdir(pTfs, path); + if (tfsMkdir(pTfs, path) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); - if (vnodeSaveCfg(dir, pCfg) < 0 || vnodeCommitCfg(dir) < 0) { + info.config = *pCfg; + + if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) { vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); return -1; } From 2b7ec5743cc2ce3759b576b978bf0f61169bd42d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:57:32 +0800 Subject: [PATCH 37/60] test: reopen transTest --- source/dnode/mnode/impl/inc/mndDb.h | 2 +- source/dnode/mnode/impl/src/mndDb.c | 4 +- source/dnode/mnode/impl/src/mndShow.c | 9 ++- source/dnode/mnode/impl/src/mndTrans.c | 50 ++++++------- .../mnode/impl/test/trans/CMakeLists.txt | 10 +-- source/dnode/mnode/impl/test/trans/trans.cpp | 75 ++++--------------- 6 files changed, 56 insertions(+), 94 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index c0b25d74d1..146c6e2523 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -27,7 +27,7 @@ void mndCleanupDb(SMnode *pMnode); SDbObj *mndAcquireDb(SMnode *pMnode, const char *db); void mndReleaseDb(SMnode *pMnode, SDbObj *pDb); int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, void **ppRsp, int32_t *pRspLen); -char *mnGetDbStr(char *src); +char *mndGetDbStr(char *src); int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUseDbReq *pReq); #ifdef __cplusplus diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3db4e9870e..2ea95f8f8d 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1340,7 +1340,7 @@ SYNC_DB_OVER: return code; } -char *mnGetDbStr(char *src) { +char *mndGetDbStr(char *src) { char *pos = strstr(src, TS_PATH_DELIMITER); if (pos != NULL) ++pos; @@ -1355,7 +1355,7 @@ static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, in int32_t cols = 0; char* buf = taosMemoryMalloc(pShow->bytes[cols]); - char *name = mnGetDbStr(pDb->name); + char *name = mndGetDbStr(pDb->name); if (name != NULL) { STR_WITH_MAXSIZE_TO_VARSTR(buf, name, pShow->bytes[cols]); } else { diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 617cebf61d..1a14c94640 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -131,6 +131,13 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { req.type = retrieveReq.type; strncpy(req.db, retrieveReq.db, tListLen(req.db)); + STableMetaRsp *pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + if (pMeta == NULL) { + terrno = TSDB_CODE_MND_INVALID_INFOS_TBL; + mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); + return -1; + } + pShow = mndCreateShowObj(pMnode, &req); if (pShow == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -138,7 +145,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { return -1; } - pShow->pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + pShow->pMeta = pMeta; pShow->numOfColumns = pShow->pMeta->numOfColumns; int32_t offset = 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 537ddc03c3..59fe7d16b9 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -58,7 +58,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans); static int32_t mndProcessTransReq(SNodeMsg *pReq); static int32_t mndProcessKillTransReq(SNodeMsg *pReq); -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter); int32_t mndInitTrans(SMnode *pMnode) { @@ -73,7 +73,7 @@ int32_t mndInitTrans(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq); mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq); -// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans); return sdbSetTable(pMnode->pSdb, table); } @@ -1259,7 +1259,7 @@ void mndTransPullup(SMnode *pMnode) { sdbWriteFile(pMnode->pSdb); } -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -1273,34 +1273,34 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pTrans->id; - cols++; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransStr(pTrans->stage)); - cols++; + char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)stage, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - char *name = mnGetDbStr(pTrans->dbname); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]); - cols++; + char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)dbname, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransType(pTrans->transType)); - cols++; + char transType[TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndTransType(pTrans->transType), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)transType, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->lastExecTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, pTrans->lastError); - cols++; + char lastError[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, pTrans->lastError, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)lastError, false); numOfRows++; sdbRelease(pSdb, pTrans); diff --git a/source/dnode/mnode/impl/test/trans/CMakeLists.txt b/source/dnode/mnode/impl/test/trans/CMakeLists.txt index d7c9756794..fa0ef9f263 100644 --- a/source/dnode/mnode/impl/test/trans/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/trans/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TRANS_SRC) -add_executable(mnode_test_trans ${TRANS_SRC}) +aux_source_directory(. MNODE_TRANS_TEST_SRC) +add_executable(transTest ${MNODE_TRANS_TEST_SRC}) target_link_libraries( - mnode_test_trans + transTest PUBLIC sut ) add_test( - NAME mnode_test_trans - COMMAND mnode_test_trans + NAME transTest + COMMAND transTest ) diff --git a/source/dnode/mnode/impl/test/trans/trans.cpp b/source/dnode/mnode/impl/test/trans/trans.cpp index 560b30d13c..bcf6fe8536 100644 --- a/source/dnode/mnode/impl/test/trans/trans.cpp +++ b/source/dnode/mnode/impl/test/trans/trans.cpp @@ -26,11 +26,11 @@ class MndTestTrans : public ::testing::Test { } static void KillThenRestartServer() { - char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; + char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; TdFilePtr pFile = taosOpenFile(file, TD_FILE_READ); - int32_t size = 3 * 1024 * 1024; - void* buffer = taosMemoryMalloc(size); - int32_t readLen = taosReadFile(pFile, buffer, size); + int32_t size = 3 * 1024 * 1024; + void* buffer = taosMemoryMalloc(size); + int32_t readLen = taosReadFile(pFile, buffer, size); if (readLen < 0 || readLen == size) { ASSERT(1); } @@ -65,18 +65,7 @@ TestServer MndTestTrans::server2; TEST_F(MndTestTrans, 00_Create_User_Crash) { { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, "stage"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "db"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE, "type"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_exec_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_ERROR_LEN - 1 + VARSTR_HEADER_SIZE, "last_error"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -109,26 +98,13 @@ TEST_F(MndTestTrans, 01_Create_User_Crash) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); KillThenRestartServer(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { @@ -144,9 +120,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -163,9 +137,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_QNODE_ALREADY_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -185,8 +157,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -208,18 +179,8 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { { // show trans - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - test.SendShowRetrieveReq(); - + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(4); - CheckTimestamp(); - CheckBinary("undoAction", TSDB_TRANS_STAGE_LEN); - CheckBinary("", TSDB_DB_NAME_LEN - 1); - CheckBinary("create-qnode", TSDB_TRANS_TYPE_LEN); - CheckTimestamp(); - CheckBinary("Unable to establish connection", TSDB_TRANS_ERROR_LEN - 1); } // kill trans @@ -238,8 +199,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { // show trans { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -258,11 +218,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_NETWORK_UNAVAIL); } - uInfo("======== kill and restart server") - KillThenRestartServer(); + uInfo("======== kill and restart server") KillThenRestartServer(); - uInfo("======== server2 start") - server2.DoStart(); + uInfo("======== server2 start") server2.DoStart(); uInfo("======== server2 started") @@ -286,14 +244,11 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_NE(retry, retryMax); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } } - // create db // partial create stb // drop db failed From 81016a98cec04b8d61358455a1b7a9c74f2d88aa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:58:08 +0800 Subject: [PATCH 38/60] test: reopen topicTest --- source/dnode/mnode/impl/test/topic/CMakeLists.txt | 10 +++++----- source/dnode/mnode/impl/test/topic/topic.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/test/topic/CMakeLists.txt b/source/dnode/mnode/impl/test/topic/CMakeLists.txt index 63a77713d6..076228ec9d 100644 --- a/source/dnode/mnode/impl/test/topic/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/topic/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TOPIC_SRC) -add_executable(mnode_test_topic ${TOPIC_SRC}) +aux_source_directory(. MNODE_TOPIC_TEST_SRC) +add_executable(topicTest ${MNODE_TOPIC_TEST_SRC}) target_link_libraries( - mnode_test_topic + topicTest PUBLIC sut ) add_test( - NAME mnode_test_topic - COMMAND mnode_test_topic + NAME topicTest + COMMAND topicTest ) diff --git a/source/dnode/mnode/impl/test/topic/topic.cpp b/source/dnode/mnode/impl/test/topic/topic.cpp index 2111d61e3f..ee47a3c8b4 100644 --- a/source/dnode/mnode/impl/test/topic/topic.cpp +++ b/source/dnode/mnode/impl/test/topic/topic.cpp @@ -101,7 +101,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_EQ(pRsp->code, 0); } - { test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, ""); } + { test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, ""); } { int32_t contLen = 0; @@ -128,7 +128,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); CHECK_META("show topics", 3); CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); @@ -145,7 +145,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -169,7 +169,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_TOPIC_NOT_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } From ef1a0683385bc4173c3089d936ac2caf3017db8e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:00:59 +0800 Subject: [PATCH 39/60] test: reopen stbTest --- .../dnode/mnode/impl/test/stb/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/stb/stb.cpp | 78 +++---------------- 2 files changed, 15 insertions(+), 71 deletions(-) diff --git a/source/dnode/mnode/impl/test/stb/CMakeLists.txt b/source/dnode/mnode/impl/test/stb/CMakeLists.txt index 70e20d3411..d2fe387997 100644 --- a/source/dnode/mnode/impl/test/stb/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/stb/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_stb -# COMMAND mnode_test_stb -#) +add_test( + NAME stbTest + COMMAND stbTest +) diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp index f45c0795cd..f8f8799c9f 100644 --- a/source/dnode/mnode/impl/test/stb/stb.cpp +++ b/source/dnode/mnode/impl/test/stb/stb.cpp @@ -43,7 +43,7 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -314,19 +314,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "columns"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "tags"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } // ----- meta ------ @@ -407,15 +396,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -432,9 +414,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 0); } @@ -496,13 +476,7 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(4); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); } { @@ -542,13 +516,8 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(2); } { @@ -611,13 +580,8 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -668,13 +632,8 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -734,13 +693,8 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(3); - CheckInt32(3); } { @@ -799,13 +753,8 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -862,13 +811,8 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { From 684db8eba818e8f735d7cf1b8ab0193a1982dbe6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 14:01:43 +0800 Subject: [PATCH 40/60] refactor(query): refactor some variable name and macro definitions. --- include/libs/function/function.h | 9 ++--- source/client/inc/clientInt.h | 8 ++++ source/libs/executor/src/executorimpl.c | 53 ++++++++----------------- source/libs/executor/src/scanoperator.c | 6 +-- source/libs/function/src/taggfunction.c | 38 +++++++++--------- 5 files changed, 50 insertions(+), 64 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 9fa89f0415..1303a1fb6a 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -110,7 +110,6 @@ typedef struct SFileBlockInfo { #define FUNCTION_COV 38 typedef struct SResultRowEntryInfo { -// int8_t hasResult:6; // result generated, not NULL value bool initialized:1; // output buffer has been initialized bool complete:1; // query has completed uint8_t isNullRes:6; // the result is null @@ -119,10 +118,10 @@ typedef struct SResultRowEntryInfo { // determine the real data need to calculated the result enum { - BLK_DATA_NO_NEEDED = 0x0, - BLK_DATA_STATIS_NEEDED = 0x1, - BLK_DATA_ALL_NEEDED = 0x3, - BLK_DATA_DISCARD = 0x4, // discard current data block since it is not qualified for filter + BLK_DATA_NOT_LOAD = 0x0, + BLK_DATA_SMA_LOAD = 0x1, + BLK_DATA_DATA_LOAD = 0x3, + BLK_DATA_FILTEROUT = 0x4, // discard current data block since it is not qualified for filter }; enum { diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 5f99af5460..772ff5e69a 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -46,6 +46,14 @@ extern "C" { #define ERROR_MSG_BUF_DEFAULT_SIZE 512 #define HEARTBEAT_INTERVAL 1500 // ms +enum { + RES_TYPE__QUERY = 1, + RES_TYPE__TMQ, +}; + +#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) + typedef struct SAppInstInfo SAppInstInfo; typedef struct { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 20b7169895..c911aef45f 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2004,7 +2004,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) { bool hasFirstLastFunc = false; bool hasOtherFunc = false; - if (status == BLK_DATA_ALL_NEEDED || status == BLK_DATA_DISCARD) { + if (status == BLK_DATA_DATA_LOAD || status == BLK_DATA_FILTEROUT) { return status; } @@ -2023,11 +2023,11 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) { } } - if (hasFirstLastFunc && status == BLK_DATA_NO_NEEDED) { + if (hasFirstLastFunc && status == BLK_DATA_NOT_LOAD) { if (!hasOtherFunc) { - return BLK_DATA_DISCARD; + return BLK_DATA_FILTEROUT; } else { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } } @@ -2360,7 +2360,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, SVarian static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock) { SqlFunctionCtx* pCtx = pTableScanInfo->pCtx; - uint32_t status = BLK_DATA_NO_NEEDED; + uint32_t status = BLK_DATA_NOT_LOAD; int32_t numOfOutput = pTableScanInfo->numOfOutput; for (int32_t i = 0; i < numOfOutput; ++i) { @@ -2369,11 +2369,11 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData // group by + first/last should not apply the first/last block filter if (functionId < 0) { - status |= BLK_DATA_ALL_NEEDED; + status |= BLK_DATA_DATA_LOAD; return status; } else { // status |= aAggs[functionId].dataReqFunc(&pTableScanInfo->pCtx[i], &pBlock->info.window, colId); - // if ((status & BLK_DATA_ALL_NEEDED) == BLK_DATA_ALL_NEEDED) { + // if ((status & BLK_DATA_DATA_LOAD) == BLK_DATA_DATA_LOAD) { // return status; // } } @@ -2384,7 +2384,7 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, uint32_t* status) { - *status = BLK_DATA_NO_NEEDED; + *status = BLK_DATA_NOT_LOAD; pBlock->pDataBlock = NULL; pBlock->pBlockAgg = NULL; @@ -2397,36 +2397,15 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc pCost->totalBlocks += 1; pCost->totalRows += pBlock->info.rows; #if 0 - if (pRuntimeEnv->pTsBuf != NULL) { - (*status) = BLK_DATA_ALL_NEEDED; - - if (pQueryAttr->stableQuery) { // todo refactor - SExprInfo* pExprInfo = &pTableScanInfo->pExpr[0]; - int16_t tagId = (int16_t)pExprInfo->base.param[0].i; - SColumnInfo* pColInfo = doGetTagColumnInfoById(pQueryAttr->tagColList, pQueryAttr->numOfTags, tagId); - - // compare tag first - SVariant t = {0}; - doSetTagValueInParam(pRuntimeEnv->current->pTable, tagId, &t, pColInfo->type, pColInfo->bytes); - setTimestampListJoinInfo(pRuntimeEnv, &t, pRuntimeEnv->current); - - STSElem elem = tsBufGetElem(pRuntimeEnv->pTsBuf); - if (!tsBufIsValidElem(&elem) || (tsBufIsValidElem(&elem) && (taosVariantCompare(&t, elem.tag) != 0))) { - (*status) = BLK_DATA_DISCARD; - return TSDB_CODE_SUCCESS; - } - } - } - // Calculate all time windows that are overlapping or contain current data block. // If current data block is contained by all possible time window, do not load current data block. if (/*pQueryAttr->pFilters || */pQueryAttr->groupbyColumn || pQueryAttr->sw.gap > 0 || (QUERY_IS_INTERVAL_QUERY(pQueryAttr) && overlapWithTimeWindow(pTaskInfo, &pBlock->info))) { - (*status) = BLK_DATA_ALL_NEEDED; + (*status) = BLK_DATA_DATA_LOAD; } // check if this data block is required to load - if ((*status) != BLK_DATA_ALL_NEEDED) { + if ((*status) != BLK_DATA_DATA_LOAD) { bool needFilter = true; // the pCtx[i] result is belonged to previous time window since the outputBuf has not been set yet, @@ -2458,18 +2437,18 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc if (needFilter) { (*status) = doFilterByBlockTimeWindow(pTableScanInfo, pBlock); } else { - (*status) = BLK_DATA_ALL_NEEDED; + (*status) = BLK_DATA_DATA_LOAD; } } SDataBlockInfo* pBlockInfo = &pBlock->info; // *status = updateBlockLoadStatus(pRuntimeEnv->pQueryAttr, *status); - if ((*status) == BLK_DATA_NO_NEEDED || (*status) == BLK_DATA_DISCARD) { + if ((*status) == BLK_DATA_NOT_LOAD || (*status) == BLK_DATA_FILTEROUT) { //qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey, // pBlockInfo->window.ekey, pBlockInfo->rows); pCost->discardBlocks += 1; - } else if ((*status) == BLK_DATA_STATIS_NEEDED) { + } else if ((*status) == BLK_DATA_SMA_LOAD) { // this function never returns error? pCost->loadBlockStatis += 1; // tsdbRetrieveDataBlockStatisInfo(pTableScanInfo->pTsdbReadHandle, &pBlock->pBlockAgg); @@ -2479,7 +2458,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc pCost->totalCheckedRows += pBlock->info.rows; } } else { - assert((*status) == BLK_DATA_ALL_NEEDED); + assert((*status) == BLK_DATA_DATA_LOAD); // load the data block statistics to perform further filter pCost->loadBlockStatis += 1; @@ -2511,7 +2490,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc pCost->discardBlocks += 1; //qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, // pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); - (*status) = BLK_DATA_DISCARD; + (*status) = BLK_DATA_FILTEROUT; return TSDB_CODE_SUCCESS; } } @@ -2523,7 +2502,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc // pCost->discardBlocks += 1; // qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey, // pBlockInfo->window.ekey, pBlockInfo->rows); -// (*status) = BLK_DATA_DISCARD; +// (*status) = BLK_DATA_FILTEROUT; // return TSDB_CODE_SUCCESS; // } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 0286b6e6e9..901bfde6a4 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -73,7 +73,7 @@ int32_t loadDataBlock(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableScanInfo, pCost->totalCheckedRows += pBlock->info.rows; pCost->loadBlocks += 1; - *status = BLK_DATA_ALL_NEEDED; + *status = BLK_DATA_DATA_LOAD; SArray* pCols = tsdbRetrieveDataBlock(pTableScanInfo->dataReader, NULL); if (pCols == NULL) { @@ -138,7 +138,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator, bool* newgroup) { // } // this function never returns error? - uint32_t status = BLK_DATA_ALL_NEEDED; + uint32_t status = BLK_DATA_DATA_LOAD; int32_t code = loadDataBlock(pTaskInfo, pTableScanInfo, pBlock, &status); // int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status); if (code != TSDB_CODE_SUCCESS) { @@ -146,7 +146,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator, bool* newgroup) { } // current block is ignored according to filter result by block statistics data, continue load the next block - if (status == BLK_DATA_DISCARD || pBlock->info.rows == 0) { + if (status == BLK_DATA_FILTEROUT || pBlock->info.rows == 0) { continue; } diff --git a/source/libs/function/src/taggfunction.c b/source/libs/function/src/taggfunction.c index 60566d00d8..e001ef4071 100644 --- a/source/libs/function/src/taggfunction.c +++ b/source/libs/function/src/taggfunction.c @@ -557,14 +557,14 @@ static void count_func_merge(SqlFunctionCtx *pCtx) { */ int32_t countRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } else { - return BLK_DATA_STATIS_NEEDED; + return BLK_DATA_SMA_LOAD; } } int32_t noDataRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } #define LIST_ADD_N_DOUBLE_FLOAT(x, ctx, p, t, numOfElem, tsdbType) \ do { \ @@ -743,76 +743,76 @@ static void sum_func_merge(SqlFunctionCtx *pCtx) { } static int32_t statisRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { - return BLK_DATA_STATIS_NEEDED; + return BLK_DATA_SMA_LOAD; } static int32_t dataBlockRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } // todo: if column in current data block are null, opt for this case static int32_t firstFuncRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { if (pCtx->order == TSDB_ORDER_DESC) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } // no result for first query, data block is required if (GET_RES_INFO(pCtx) == NULL || GET_RES_INFO(pCtx)->numOfRes <= 0) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } else { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } } static int32_t lastFuncRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { if (pCtx->order != pCtx->param[0].i) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } if (GET_RES_INFO(pCtx) == NULL || GET_RES_INFO(pCtx)->numOfRes <= 0) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } else { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } } static int32_t firstDistFuncRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { if (pCtx->order == TSDB_ORDER_DESC) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } // not initialized yet, it is the first block, load it. if (pCtx->pOutput == NULL) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } // the pCtx should be set to current Ctx and output buffer before call this function. Otherwise, pCtx->pOutput is // the previous windowRes output buffer, not current unloaded block. In this case, the following filter is invalid SFirstLastInfo *pInfo = (SFirstLastInfo*) (pCtx->pOutput + pCtx->inputBytes); if (pInfo->hasResult != DATA_SET_FLAG) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } else { // data in current block is not earlier than current result - return (pInfo->ts <= w->skey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED; + return (pInfo->ts <= w->skey) ? BLK_DATA_NOT_LOAD : BLK_DATA_DATA_LOAD; } } static int32_t lastDistFuncRequired(SqlFunctionCtx *pCtx, STimeWindow* w, int32_t colId) { if (pCtx->order != pCtx->param[0].i) { - return BLK_DATA_NO_NEEDED; + return BLK_DATA_NOT_LOAD; } // not initialized yet, it is the first block, load it. if (pCtx->pOutput == NULL) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } // the pCtx should be set to current Ctx and output buffer before call this function. Otherwise, pCtx->pOutput is // the previous windowRes output buffer, not current unloaded block. In this case, the following filter is invalid SFirstLastInfo *pInfo = (SFirstLastInfo*) (pCtx->pOutput + pCtx->inputBytes); if (pInfo->hasResult != DATA_SET_FLAG) { - return BLK_DATA_ALL_NEEDED; + return BLK_DATA_DATA_LOAD; } else { - return (pInfo->ts > w->ekey) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED; + return (pInfo->ts > w->ekey) ? BLK_DATA_NOT_LOAD : BLK_DATA_DATA_LOAD; } } From ad3675daed5c826e7ba77698f5c7be621b785fad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 14:13:29 +0800 Subject: [PATCH 41/60] test: fix an typo in session.sim script. --- tests/script/tsim/query/session.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index 3aee838625..d4920ea255 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -288,7 +288,7 @@ endi print ================> syntax error check not active ================> reactive sql_error select * from dev_001 session(ts,1w) -sql select count(*) from st session(ts,1w) +sql_error select count(*) from st session(ts,1w) sql_error select count(*) from dev_001 group by tagtype session(ts,1w) sql select count(*) from dev_001 session(ts,1n) sql select count(*) from dev_001 session(ts,1y) From 6e753618fb736ef90664b10818c43f2bb86c239f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:20:50 +0800 Subject: [PATCH 42/60] test: reopen mnode unitest --- source/dnode/mnode/impl/test/CMakeLists.txt | 26 ++++++++++----------- source/dnode/mnode/impl/test/show/show.cpp | 8 +++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 9b669b303a..15f2aed22a 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -1,17 +1,17 @@ enable_testing() -#add_subdirectory(user) add_subdirectory(acct) -#add_subdirectory(trans) -#add_subdirectory(qnode) -#add_subdirectory(snode) add_subdirectory(bnode) -#add_subdirectory(show) -#add_subdirectory(profile) -#add_subdirectory(dnode) -#add_subdirectory(mnode) -#add_subdirectory(db) -#add_subdirectory(stb) -#add_subdirectory(sma) -#add_subdirectory(func) -#add_subdirectory(topic) +add_subdirectory(db) +add_subdirectory(dnode) +add_subdirectory(func) +add_subdirectory(mnode) +add_subdirectory(profile) +add_subdirectory(qnode) +add_subdirectory(show) +add_subdirectory(sma) +add_subdirectory(snode) +add_subdirectory(stb) +add_subdirectory(topic) +add_subdirectory(trans) +add_subdirectory(user) diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 5b8c186ccf..201a42e3ef 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -34,9 +34,9 @@ TEST_F(MndTestShow, 01_ShowMsg_InvalidMsgMax) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { @@ -48,9 +48,9 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 03_ShowMsg_Conn) { From 694df11ff101ccd4ce2736c600e2c8ec0e90512c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:27:04 +0000 Subject: [PATCH 43/60] refact vnode --- source/dnode/vnode/src/inc/vnodeInt.h | 1 + source/dnode/vnode/src/vnd/vnodeCommit.c | 137 +++++++++++++++++++++-- source/dnode/vnode/src/vnd/vnodeOpen.c | 2 + 3 files changed, 130 insertions(+), 10 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index b0b87665ed..e95878b04e 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -27,6 +27,7 @@ #include "tdbInt.h" #include "tfs.h" #include "tglobal.h" +#include "tjson.h" #include "tlist.h" #include "tlockfree.h" #include "tlosertree.h" diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index fc74ee9253..b4bce9e350 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -18,7 +18,7 @@ #define VND_INFO_FNAME "vnode.json" #define VND_INFO_FNAME_TMP "vnode_tmp.json" -static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len); +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); @@ -28,16 +28,14 @@ static void vnodeWaitCommit(SVnode *pVnode); int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { char fname[TSDB_FILENAME_LEN]; TdFilePtr pFile; - uint8_t *data; - int len; + char *data; snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); // encode info data = NULL; - len = 0; - if (vnodeEncodeInfo(pInfo, &data, &len) < 0) { + if (vnodeEncodeInfo(pInfo, &data) < 0) { return -1; } @@ -48,7 +46,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { return -1; } - if (taosWriteFile(pFile, data, len) < 0) { + if (taosWriteFile(pFile, data, strlen(data)) < 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } @@ -137,12 +135,131 @@ static int vnodeEndCommit(SVnode *pVnode) { static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } -static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len) { - // TODO +static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { + const SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonAddIntegerToObject(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + return 0; } -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { - // TODO +static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { + SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonGetNumberValue(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonGetNumberValue(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; + if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + return 0; } + +static int vnodeEncodeState(const void *pObj, SJson *pJson) { + const SVState *pState = (SVState *)pObj; + + if (tjsonAddIntegerToObject(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeDecodeState(const SJson *pJson, void *pObj) { + SVState *pState = (SVState *)pObj; + + if (tjsonGetNumberValue(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData) { + SJson *pJson; + char *pData; + + *ppData = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonAddObject(pJson, "config", vnodeEncodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonAddObject(pJson, "state", vnodeEncodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + pData = tjsonToString(pJson); + if (pData == NULL) { + goto _err; + } + + tjsonDelete(pJson); + + *ppData = pData; + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { + SJson *pJson = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonToObject(pJson, "config", vnodeDecodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonToObject(pJson, "state", vnodeDecodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + tjsonDelete(pJson); + + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 5fa14f6018..241c26ab1c 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -46,6 +46,8 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { return -1; } + vInfo("vgId: %d vnode is created", pCfg->vgId); + return 0; } From e96f0fa42935d6aff7cb24d2c362f4a20e3b214f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:31:54 +0800 Subject: [PATCH 44/60] fix: the bug found by CI --- source/dnode/mnode/impl/test/profile/profile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index b9b21ebed9..2c3be2135b 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -46,7 +46,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { EXPECT_EQ(connectRsp.acctId, 1); EXPECT_GT(connectRsp.clusterId, 0); - EXPECT_EQ(connectRsp.connId, 1); + EXPECT_NE(connectRsp.connId, 0); EXPECT_EQ(connectRsp.superUser, 1); EXPECT_EQ(connectRsp.epSet.inUse, 0); @@ -82,7 +82,8 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) { SClientHbBatchReq batchReq = {0}; batchReq.reqs = taosArrayInit(0, sizeof(SClientHbReq)); SClientHbReq req = {0}; - req.connKey = {.connId = 123, .hbType = CONN_TYPE__TMQ}; + req.connKey.tscRid = 123; + req.connKey.connType = CONN_TYPE__TMQ; req.info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); SKv kv = {0}; kv.key = 123; From 83c8be30880f81471a1e737450b5db6f3061e16c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:38:18 +0000 Subject: [PATCH 45/60] refact --- source/dnode/vnode/inc/vnode.h | 6 ++--- source/dnode/vnode/src/tsdb/tsdbCommit.c | 31 +++++++++++----------- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 24 ++++++++--------- source/dnode/vnode/src/tsdb/tsdbOptions.c | 6 ++--- source/dnode/vnode/src/tsdb/tsdbRead.c | 10 +++---- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 14 +++++----- source/dnode/vnode/src/tsdb/tsdbSma.c | 10 ++++--- source/dnode/vnode/src/vnd/vnodeCommit.c | 12 ++++----- 9 files changed, 59 insertions(+), 56 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 25c6ffc1ad..e42311fa9c 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -124,9 +124,9 @@ struct STsdbCfg { int8_t precision; int8_t update; int8_t compression; - int32_t daysPerFile; - int32_t minRowsPerFileBlock; - int32_t maxRowsPerFileBlock; + int32_t days; + int32_t minRows; + int32_t maxRows; int32_t keep; int32_t keep1; int32_t keep2; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index eb32663387..8cbe3c9005 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -55,7 +55,7 @@ typedef struct { #define TSDB_COMMIT_BUF(ch) TSDB_READ_BUF(&((ch)->readh)) #define TSDB_COMMIT_COMP_BUF(ch) TSDB_READ_COMP_BUF(&((ch)->readh)) #define TSDB_COMMIT_EXBUF(ch) TSDB_READ_EXBUF(&((ch)->readh)) -#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRowsPerFileBlock) +#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRows) #define TSDB_COMMIT_TXN_VERSION(ch) FS_TXN_VERSION(REPO_FS(TSDB_COMMIT_REPO(ch))) static void tsdbStartCommit(STsdb *pRepo); @@ -222,9 +222,9 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) { maxKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; pRtn->minKey = minKey; - pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->daysPerFile, pCfg->precision)); + pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision)); + pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->days, pCfg->precision)); + pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->days, pCfg->precision)); tsdbDebug("vgId:%d now:%" PRId64 " minKey:%" PRId64 " minFid:%d, midFid:%d, maxFid:%d", REPO_ID(pRepo), now, minKey, pRtn->minFid, pRtn->midFid, pRtn->maxFid); } @@ -286,7 +286,7 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdb *pRepo) { return -1; } - pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRows); if (pCommith->pDataCols == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyCommitH(pCommith); @@ -319,7 +319,7 @@ static int tsdbNextCommitFid(SCommitH *pCommith) { if (nextKey == TSDB_DATA_TIMESTAMP_NULL) { continue; } else { - int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->daysPerFile, pCfg->precision)); + int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->days, pCfg->precision)); if (fid == TSDB_IVLD_FID || fid > tfid) { fid = tfid; } @@ -346,7 +346,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) { ASSERT(pSet == NULL || pSet->fid == fid); tsdbResetCommitFile(pCommith); - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); // Set and open files if (tsdbSetAndOpenCommitFile(pCommith, pSet, fid) < 0) { @@ -1210,8 +1210,8 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF int64_t offset = 0, offsetAggr = 0; int rowsToWrite = pDataCols->numOfRows; - ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRowsPerFileBlock); - ASSERT((!isLast) || rowsToWrite < pCfg->minRowsPerFileBlock); + ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRows); + ASSERT((!isLast) || rowsToWrite < pCfg->minRows); // Make buffer space if (tsdbMakeRoom(ppBuf, tsdbBlockStatisSize(pDataCols->numOfCols, SBlockVerLatest)) < 0) { @@ -1460,7 +1460,7 @@ static int tsdbCommitMemData(SCommitH *pCommith, SCommitIter *pIter, TSKEY keyLi if (pCommith->pDataCols->numOfRows <= 0) break; - if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRowsPerFileBlock) { + if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRows) { pDFile = TSDB_COMMIT_DATA_FILE(pCommith); isLast = false; } else { @@ -1619,7 +1619,7 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols if (pCommith->pDataCols->numOfRows == 0) break; if (isLastOneBlock) { - if (pCommith->pDataCols->numOfRows < pCfg->minRowsPerFileBlock) { + if (pCommith->pDataCols->numOfRows < pCfg->minRows) { pDFile = TSDB_COMMIT_LAST_FILE(pCommith); isLast = true; } else { @@ -1667,7 +1667,8 @@ static void tsdbLoadAndMergeFromCache(SDataCols *pDataCols, int *iter, SCommitIt if (tdGetColDataOfRow(&sVal, pDataCols->cols + i, *iter, pDataCols->bitmapMode) < 0) { TASSERT(0); } - tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, pTarget->bitmapMode); + tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, + pTarget->bitmapMode); } ++pTarget->numOfRows; @@ -1774,11 +1775,11 @@ static bool tsdbCanAddSubBlock(SCommitH *pCommith, SBlock *pBlock, SMergeInfo *p ASSERT(mergeRows > 0); - if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRowsPerFileBlock) { + if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRows) { if (pBlock->last) { - if (pCommith->isLFileSame && mergeRows < pCfg->minRowsPerFileBlock) return true; + if (pCommith->isLFileSame && mergeRows < pCfg->minRows) return true; } else { - if (pCommith->isDFileSame && mergeRows <= pCfg->maxRowsPerFileBlock) return true; + if (pCommith->isDFileSame && mergeRows <= pCfg->maxRows) return true; } } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index bd3888864d..ca363fdc1f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -191,7 +191,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) { // ================== STsdbFS STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) { int keep = pCfg->keep; - int days = pCfg->daysPerFile; + int days = pCfg->days; int maxFSet = TSDB_MAX_FSETS(keep, days); STsdbFS *pfs; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 5a477e646c..a682715c2c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -19,9 +19,9 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg); static int tsdbMemTableInsertTbData(STsdb *pRepo, SSubmitBlk *pBlock, int32_t *pAffectedRows); static STbData *tsdbNewTbData(tb_uid_t uid); static void tsdbFreeTbData(STbData *pTbData); -static char * tsdbGetTsTupleKey(const void *data); +static char *tsdbGetTsTupleKey(const void *data); static int tsdbTbDataComp(const void *arg1, const void *arg2); -static char * tsdbTbDataGetUid(const void *arg); +static char *tsdbTbDataGetUid(const void *arg); static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema **ppSchema, STSRow *row); STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) { @@ -74,7 +74,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) { } int tsdbMemTableInsert(STsdb *pTsdb, STsdbMemTable *pMemTable, SSubmitReq *pMsg, SSubmitRsp *pRsp) { - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitMsgIter msgIter = {0}; int32_t affectedrows = 0, numOfRows = 0; @@ -119,12 +119,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey TKEY *filterKeys, int nFilterKeys, bool keepDup, SMergeInfo *pMergeInfo) { ASSERT(maxRowsToRead > 0 && nFilterKeys >= 0); if (pIter == NULL) return 0; - STSchema * pSchema = NULL; + STSchema *pSchema = NULL; TSKEY rowKey = 0; TSKEY fKey = 0; bool isRowDel = false; int filterIter = 0; - STSRow * row = NULL; + STSRow *row = NULL; SMergeInfo mInfo; if (pMergeInfo == NULL) pMergeInfo = &mInfo; @@ -259,12 +259,12 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { ASSERT(pMsg != NULL); // STsdbMeta * pMeta = pTsdb->tsdbMeta; SSubmitMsgIter msgIter = {0}; - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitBlkIter blkIter = {0}; - STSRow * row = NULL; + STSRow *row = NULL; TSKEY now = taosGetTimestamp(pTsdb->config.precision); TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep; - TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.daysPerFile; + TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.days; terrno = TSDB_CODE_SUCCESS; pMsg->length = htonl(pMsg->length); @@ -332,9 +332,9 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p // STable *pTable = NULL; SSubmitBlkIter blkIter = {0}; STsdbMemTable *pMemTable = pTsdb->mem; - void * tptr; - STbData * pTbData; - STSRow * row; + void *tptr; + STbData *pTbData; + STSRow *row; TSKEY keyMin; TSKEY keyMax; @@ -504,7 +504,7 @@ int tsdbInsertDataToMemTable(STsdbMemTable *pMemTable, SSubmitReq *pMsg) { #include "tskiplist.h" #define TSDB_DATA_SKIPLIST_LEVEL 5 -#define TSDB_MAX_INSERT_BATCH 512 +#define TSDB_MAX_INSERT_BATCH 512 typedef struct { int32_t totalLen; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index 2c57a7406e..c3555cc835 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -17,9 +17,9 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .lruCacheSize = 0, - .daysPerFile = 10, - .minRowsPerFileBlock = 100, - .maxRowsPerFileBlock = 4096, + .days = 10, + .minRows = 100, + .maxRows = 4096, .keep = 3650, .keep1 = 3650, .keep2 = 3650, diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 9509dfa462..e5da0e3c37 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -404,7 +404,7 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond, pReadHandle->defaultLoadColumn = getDefaultLoadColumns(pReadHandle, true); } - pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRowsPerFileBlock); + pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRows); if (pReadHandle->pDataCols == NULL) { tsdbError("%p failed to malloc buf for pDataCols, %s", pReadHandle, pReadHandle->idStr); terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; @@ -2199,7 +2199,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ASCENDING_TRAVERSE(pTsdbReadHandle->order) && win.skey > pTsdbReadHandle->window.ekey) || @@ -2295,7 +2295,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* // find the start data block in file pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); @@ -2321,7 +2321,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ascTraverse && win.skey > pTsdbReadHandle->window.ekey) || @@ -2396,7 +2396,7 @@ static int32_t getDataBlocksInFiles(STsdbReadHandle* pTsdbReadHandle, bool* exis if (!pTsdbReadHandle->locateStart) { pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index e31ede09cc..0b5a53dd9c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -43,14 +43,14 @@ int tsdbInitReadH(SReadH *pReadh, STsdb *pRepo) { return -1; } - pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[0] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); return -1; } - pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[1] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); @@ -276,8 +276,8 @@ int tsdbLoadBlockData(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo) { return 0; } -int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, - int numOfColsIds, bool mergeBitmap) { +int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, int numOfColsIds, + bool mergeBitmap) { ASSERT(pBlock->numOfSubBlocks > 0); int8_t update = pReadh->pRepo->config.update; @@ -513,7 +513,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -710,7 +710,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -836,7 +836,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc } if (tsdbCheckAndDecodeColumnData(pDataCol, pReadh->pBuf, pBlockCol->len, pBlockCol->blen, pBlock->algorithm, - pBlock->numOfRows, tLenBitmap, pCfg->maxRowsPerFileBlock, pReadh->pCBuf, + pBlock->numOfRows, tLenBitmap, pCfg->maxRows, pReadh->pCBuf, (int32_t)taosTSizeof(pReadh->pCBuf)) < 0) { tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), pBlockCol->colId, offset); diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 7de5a0d5a9..7abdf22073 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -106,7 +106,8 @@ struct SSmaStat { // expired window static int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t version); -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version); +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version); static int32_t tsdbInitSmaStat(SSmaStat **pSmaStat); static void *tsdbFreeSmaStatItem(SSmaStatItem *pSmaStatItem); static int32_t tsdbDestroySmaState(SSmaStat *pSmaStat); @@ -197,7 +198,7 @@ static SPoolMem *openPool() { static void clearPool(SPoolMem *pPool) { if (!pPool) return; - + SPoolMem *pMem; do { @@ -544,7 +545,8 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { return TSDB_CODE_SUCCESS; }; -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version) { +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version) { SSmaStatItem *pItem = taosHashGet(pItemsHash, &indexUid, sizeof(indexUid)); if (pItem == NULL) { // TODO: use TSDB_SMA_STAT_EXPIRED and update by stream computing later @@ -946,7 +948,7 @@ static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t */ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLevel) { STsdbCfg *pCfg = REPO_CFG(pTsdb); - int32_t daysPerFile = pCfg->daysPerFile; + int32_t daysPerFile = pCfg->days; if (storageLevel == SMA_STORAGE_LEVEL_TSDB) { int32_t days = SMA_STORAGE_TSDB_TIMES * (interval / tsTickPerDay[pCfg->precision]); diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index b4bce9e350..c8323c30b9 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -151,9 +151,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; @@ -178,9 +178,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; - if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; - if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; From aa266dea4170a4ad0fb48911f19e420bf2cd44dc Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:47:39 +0000 Subject: [PATCH 46/60] refact vnode --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 4 ++-- source/dnode/vnode/inc/vnode.h | 4 ++-- source/dnode/vnode/src/tsdb/tsdbCommit.c | 6 +++--- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 2 +- source/dnode/vnode/src/tsdb/tsdbOptions.c | 4 ++-- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- source/dnode/vnode/src/vnd/vnodeCommit.c | 12 ++++++------ 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 484b6646b5..bebb437cfe 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -91,9 +91,9 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->keep = pCreate->daysToKeep0; pCfg->streamMode = pCreate->streamMode; pCfg->isWeak = true; - pCfg->tsdbCfg.keep = pCreate->daysToKeep0; - pCfg->tsdbCfg.keep1 = pCreate->daysToKeep2; pCfg->tsdbCfg.keep2 = pCreate->daysToKeep0; + pCfg->tsdbCfg.keep0 = pCreate->daysToKeep2; + pCfg->tsdbCfg.keep1 = pCreate->daysToKeep0; pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; pCfg->tsdbCfg.retentions = pCreate->pRetensions; pCfg->metaCfg.lruSize = pCreate->cacheBlockSize; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index e42311fa9c..303376dba4 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -127,9 +127,9 @@ struct STsdbCfg { int32_t days; int32_t minRows; int32_t maxRows; - int32_t keep; - int32_t keep1; int32_t keep2; + int32_t keep0; + int32_t keep1; uint64_t lruCacheSize; SArray *retentions; }; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 8cbe3c9005..a1edb7cd9c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -217,9 +217,9 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) { TSKEY minKey, midKey, maxKey, now; now = taosGetTimestamp(pCfg->precision); - minKey = now - pCfg->keep * tsTickPerDay[pCfg->precision]; - midKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; - maxKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + minKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; + midKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + maxKey = now - pCfg->keep0 * tsTickPerDay[pCfg->precision]; pRtn->minKey = minKey; pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision)); diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index ca363fdc1f..866c02cbb3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -190,7 +190,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) { // ================== STsdbFS STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) { - int keep = pCfg->keep; + int keep = pCfg->keep2; int days = pCfg->days; int maxFSet = TSDB_MAX_FSETS(keep, days); STsdbFS *pfs; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index a682715c2c..5f401c9b2b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -263,7 +263,7 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { SSubmitBlkIter blkIter = {0}; STSRow *row = NULL; TSKEY now = taosGetTimestamp(pTsdb->config.precision); - TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep; + TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep2; TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.days; terrno = TSDB_CODE_SUCCESS; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index c3555cc835..3560c9feaa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -20,9 +20,9 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .days = 10, .minRows = 100, .maxRows = 4096, - .keep = 3650, - .keep1 = 3650, .keep2 = 3650, + .keep0 = 3650, + .keep1 = 3650, .update = 0, .compression = TWO_STAGE_COMP}; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index e5da0e3c37..1314ef7d1e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -314,7 +314,7 @@ static int64_t getEarliestValidTimestamp(STsdb* pTsdb) { STsdbCfg* pCfg = &pTsdb->config; int64_t now = taosGetTimestamp(pCfg->precision); - return now - (tsTickPerDay[pCfg->precision] * pCfg->keep) + 1; // needs to add one tick + return now - (tsTickPerDay[pCfg->precision] * pCfg->keep2) + 1; // needs to add one tick } static void setQueryTimewindow(STsdbReadHandle* pTsdbReadHandle, STsdbQueryCond* pCond) { diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index c8323c30b9..ec071c44e3 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -154,9 +154,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -181,9 +181,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; From 98b98c8b851cb07a5e83208083dc714a10c1f891 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 07:07:44 +0000 Subject: [PATCH 47/60] refact vnode --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 10 ++++ source/dnode/vnode/src/inc/vnd.h | 1 + source/dnode/vnode/src/vnd/vnodeCommit.c | 64 +++++++++++++++++---- 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index bebb437cfe..925197d708 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -121,6 +121,8 @@ static void vmGenerateWrapperCfg(SVnodesMgmt *pMgmt, SCreateVnodeReq *pCreate, S int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { SRpcMsg *pReq = &pMsg->rpcMsg; SCreateVnodeReq createReq = {0}; + char path[TSDB_FILENAME_LEN]; + if (tDeserializeSCreateVnodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; @@ -143,6 +145,14 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { return -1; } + // create vnode + snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vnodeCfg.vgId); + if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) { + tFreeSCreateVnodeReq(&createReq); + dError("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr()); + return -1; + } + SMsgCb msgCb = pMgmt->pDnode->data.msgCb; msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 913fec64ed..cb40900e81 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -43,6 +43,7 @@ int vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); // vnodeCommit ==================== int vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); int vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); +int vnodeLoadInfo(const char* dir, SVnodeInfo* pInfo); #if 1 // SVBufPool diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index ec071c44e3..fa249d3ba1 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -19,7 +19,7 @@ #define VND_INFO_FNAME_TMP "vnode_tmp.json" static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); static int vnodeCommit(void *arg); @@ -88,9 +88,53 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { return 0; } -int vnodeLoadInfo(const char *dir) { - // TODO +int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile = NULL; + char *pData = NULL; + int64_t size; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + + // read info + pFile = taosOpenFile(fname, TD_FILE_READ); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosFStatFile(pFile, &size, NULL) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + pData = taosMemoryMalloc(size); + if (pData == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + if (taosReadFile(pFile, pData, size) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // decode info + if (vnodeDecodeInfo(pData, pInfo) < 0) { + taosMemoryFree(pData); + return -1; + } + + taosMemoryFree(pData); + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(pData); + return -1; } int vnodeAsyncCommit(SVnode *pVnode) { @@ -154,9 +198,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -181,9 +225,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -239,7 +283,7 @@ _err: return -1; } -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo) { SJson *pJson = NULL; pJson = tjsonCreateObject(); From bc178c247df5c1a6fe1fdb38375c7aeafee82288 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 07:49:33 +0000 Subject: [PATCH 48/60] fix a bug --- source/libs/scheduler/src/scheduler.c | 75 +++++++++++++-------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 93bc16a7a2..9b652f2795 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -14,12 +14,12 @@ */ #include "catalog.h" +#include "command.h" #include "query.h" #include "schedulerInt.h" #include "tmsg.h" #include "tref.h" #include "trpc.h" -#include "command.h" SSchedulerMgmt schMgmt = {0}; @@ -68,8 +68,8 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel * } int32_t schInitJob(SSchJob **pSchJob, SQueryPlan *pDag, void *transport, SArray *pNodeList, const char *sql, - int64_t startTs, bool syncSchedule) { - int32_t code = 0; + int64_t startTs, bool syncSchedule) { + int32_t code = 0; SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); if (NULL == pJob) { qError("QID:%" PRIx64 " calloc %d failed", pDag->queryId, (int32_t)sizeof(SSchJob)); @@ -141,7 +141,6 @@ _return: SCH_RET(code); } - void schFreeRpcCtx(SRpcCtx *pCtx) { if (NULL == pCtx) { return; @@ -1047,12 +1046,12 @@ _return: int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRsp *pRsp) { SCH_TASK_DLOG("got explain rsp, rows:%d, complete:%d", htonl(pRsp->numOfRows), pRsp->completed); - + atomic_store_32(&pJob->resNumOfRows, htonl(pRsp->numOfRows)); atomic_store_ptr(&pJob->resData, pRsp); SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCCEED); - + schProcessOnDataFetched(pJob); return TSDB_CODE_SUCCESS; @@ -1146,7 +1145,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch if (NULL == msg) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } - + if (!SCH_IS_EXPLAIN_JOB(pJob)) { SCH_TASK_ELOG("invalid msg received for none explain query, msg type:%s", TMSG_INFO(msgType)); SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); @@ -1180,13 +1179,13 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch } if (SCH_IS_EXPLAIN_JOB(pJob)) { - if (rsp->completed) { + if (rsp->completed) { SRetrieveTableRsp *pRsp = NULL; SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); } - + return TSDB_CODE_SUCCESS; } @@ -1238,23 +1237,24 @@ _return: } int32_t schGetTaskFromTaskList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { - int32_t s = taosHashGetSize(pTaskList); - if (s <= 0) { - return TSDB_CODE_SUCCESS; - } - - SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); - if (NULL == task || NULL == (*task)) { - return TSDB_CODE_SUCCESS; - } + int32_t s = taosHashGetSize(pTaskList); + if (s <= 0) { + return TSDB_CODE_SUCCESS; + } - *pTask = *task; + SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); + if (NULL == task || NULL == (*task)) { + return TSDB_CODE_SUCCESS; + } - return TSDB_CODE_SUCCESS; + *pTask = *task; + + return TSDB_CODE_SUCCESS; } int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCode) { - if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || taosArrayGetSize(pTask->execNodes) <= 0) { + if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || + taosArrayGetSize(pTask->execNodes) <= 0) { return TSDB_CODE_SUCCESS; } @@ -1264,7 +1264,6 @@ int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCo return TSDB_CODE_SUCCESS; } - int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { int32_t code = 0; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; @@ -1282,13 +1281,15 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in if (TDMT_VND_EXPLAIN_RSP == msgType) { schGetTaskFromTaskList(pJob->succTasks, pParam->taskId, &pTask); } else { - SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } } - + if (NULL == pTask) { - SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } @@ -1444,7 +1445,7 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { } int32_t schGenerateTaskCallBackAHandle(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SMsgSendInfo **pMsgSendInfo) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == msgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1565,7 +1566,7 @@ _return: } int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *pReadyMsgSendInfo = NULL; SMsgSendInfo *pExplainMsgSendInfo = NULL; @@ -1578,7 +1579,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_RES_READY, &pReadyMsgSendInfo)); SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_EXPLAIN, &pExplainMsgSendInfo)); - int32_t msgType = TDMT_VND_RES_READY_RSP; + int32_t msgType = TDMT_VND_RES_READY_RSP; SRpcCtxVal ctxVal = {.val = pReadyMsgSendInfo, .clone = schCloneSMsgSendInfo, .freeFunc = schFreeRpcCtxVal}; if (taosHashPut(pCtx->args, &msgType, sizeof(msgType), &ctxVal, sizeof(ctxVal))) { SCH_TASK_ELOG("taosHashPut msg %d to rpcCtx failed", msgType); @@ -1599,7 +1600,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { _return: taosHashCleanup(pCtx->args); - + if (pReadyMsgSendInfo) { taosMemoryFreeClear(pReadyMsgSendInfo->param); taosMemoryFreeClear(pReadyMsgSendInfo); @@ -1818,7 +1819,7 @@ _return: taosMemoryFreeClear(pMsgSendInfo->param); taosMemoryFreeClear(pMsgSendInfo); } - + SCH_RET(code); } @@ -2319,7 +2320,7 @@ _return: } int32_t schExecStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, - bool syncSchedule) { + bool syncSchedule) { qDebug("QID:0x%" PRIx64 " job started", pDag->queryId); int32_t code = 0; @@ -2608,7 +2609,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { SCH_ERR_JRET(schFetchFromRemote(pJob)); tsem_wait(&pJob->rspSem); - } + } } else { SCH_JOB_ELOG("job status error for fetch, status:%s", jobTaskStatusStr(status)); SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR); @@ -2670,11 +2671,11 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { for (int32_t i = pJob->levelNum - 1; i >= 0; --i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); - + for (int32_t m = 0; m < pLevel->taskNum; ++m) { - SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); SQuerySubDesc subDesc = {.tid = pTask->taskId, .status = pTask->status}; - + taosArrayPush(pSub, &subDesc); } } @@ -2682,7 +2683,6 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { return TSDB_CODE_SUCCESS; } - int32_t scheduleCancelJob(int64_t job) { SSchJob *pJob = schAcquireJob(job); if (NULL == pJob) { @@ -2738,11 +2738,10 @@ void schedulerDestroy(void) { while (pJob) { taosRemoveRef(schMgmt.jobRef, pJob->refId); - pJob = taosIterateRef(schMgmt.jobRef, pJob->refId); + pJob = taosIterateRef(schMgmt.jobRef, pJob); } taosCloseRef(schMgmt.jobRef); schMgmt.jobRef = 0; } } - From e61d176305593323a950b35e0b26bec68a8550cd Mon Sep 17 00:00:00 2001 From: cpwu Date: Fri, 15 Apr 2022 16:48:19 +0800 Subject: [PATCH 49/60] fix stddev.case --- tests/script/tsim/query/stddev.sim | 515 +++++++++++++++++++++++------ 1 file changed, 408 insertions(+), 107 deletions(-) diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim index 70a9719b40..74bc444da2 100644 --- a/tests/script/tsim/query/stddev.sim +++ b/tests/script/tsim/query/stddev.sim @@ -1,17 +1,16 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start $loop_cnt = 0 check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + sql show dnodes print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 if $data00 != 1 then @@ -23,108 +22,410 @@ endi sql connect -$dbPrefix = db -$tbPrefix = ctb -$mtPrefix = stb -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select stddev(tbcol) from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step3 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print ===> select stddev(tbcol) from $tb where ts <= $ms -sql select stddev(tbcol) from $tb where ts <= $ms -print ====> $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1.414213562 then - return -1 -endi - -print =============== step4 -sql select stddev(tbcol) as b from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step5 -sql select _wstartts, stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - print expect 0.000000000, actual: $data01 - return -1 -endi - -sql select _wstartts, stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then - return -1 -endi - -print =============== step6 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -sql select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi - -print $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 - -if $rows != 5 then - print expect 5, actual: $rows - return -1 -endi - -print =============== clear -sql drop database $db +print =============== create database +sql create database db sql show databases +if $rows != 3 then + return -1 +endi + +sql use db + +print =============== create super table and child table +sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int) +sql show stables +print $rows $data00 $data01 $data02 if $rows != 1 then return -1 endi +sql create table ct1 using stb1 tags ( 1 ) +sql create table ct2 using stb1 tags ( 2 ) +sql create table ct3 using stb1 tags ( 3 ) +sql create table ct4 using stb1 tags ( 4 ) +sql show tables +print $rows $data00 $data10 $data20 +if $rows != 4 then + return -1 +endi + +sql create table t1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + +print =============== insert data into child table ct1 (s) +sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a ) +sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a ) + +print =============== insert data into child table ct4 (y) +sql insert into ct4 values ( '2019-01-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2019-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct4 values ( '2019-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct4 values ( '2020-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct4 values ( '2020-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct4 values ( '2020-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct4 values ( '2020-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2021-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct4 values ( '2021-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into ct4 values ( '2021-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into ct4 values ( '2022-02-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) +sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) + +print =============== insert data into child table t1 +sql insert into t1 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into t1 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into t1 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into t1 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into t1 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into t1 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into t1 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into t1 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into t1 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) + +print ================ start query ====================== + +print =============== step1 +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) +sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print ===> $rows +if $rows != 4 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) +sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +# print ===> $rows +# if $rows != 3 then +# return -1 +# endi + +print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +# print ===> $rows +# if $rows != 3 then +# return -1 +# endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +#================================================= +print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready_0: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready_0 +endi + +print =============== step2 after wal +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) +sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print ===> $rows +if $rows != 4 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) +sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =============== clear +sql drop database db +sql show databases +if $rows != 2 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 911c81d230cd8c622c8018284d6797965baf6cd9 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 15 Apr 2022 17:12:31 +0800 Subject: [PATCH 50/60] fix scheduler quit issue --- source/libs/scheduler/src/scheduler.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 9b652f2795..4e59e1bea6 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2734,11 +2734,14 @@ void schedulerFreeTaskList(SArray *taskList) { void schedulerDestroy(void) { if (schMgmt.jobRef) { SSchJob *pJob = taosIterateRef(schMgmt.jobRef, 0); - + int64_t refId = 0; + while (pJob) { + refId = pJob->refId; + taosRemoveRef(schMgmt.jobRef, pJob->refId); - pJob = taosIterateRef(schMgmt.jobRef, pJob); + pJob = taosIterateRef(schMgmt.jobRef, refId); } taosCloseRef(schMgmt.jobRef); From 5029cd67b2275789b9a79682b30785bd1fa19b22 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 18:06:49 +0800 Subject: [PATCH 51/60] ehn(query): add the file data block load optimization check. --- include/libs/function/functionMgt.h | 8 +++--- source/libs/executor/inc/executil.h | 4 --- source/libs/executor/inc/executorimpl.h | 10 ++------ source/libs/executor/src/executorimpl.c | 30 ++++++++++------------ source/libs/executor/src/scanoperator.c | 14 ++++++---- source/libs/function/src/builtinsimpl.c | 4 +-- source/libs/function/src/functionMgt.c | 4 +-- source/libs/planner/src/planLogicCreater.c | 2 +- source/libs/planner/src/planOptimizer.c | 14 +++++----- 9 files changed, 41 insertions(+), 49 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index a471de3147..992b99df60 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -139,10 +139,10 @@ bool fmIsSpecialDataRequiredFunc(int32_t funcId); bool fmIsDynamicScanOptimizedFunc(int32_t funcId); typedef enum EFuncDataRequired { - FUNC_DATA_REQUIRED_ALL_NEEDED = 1, - FUNC_DATA_REQUIRED_STATIS_NEEDED, - FUNC_DATA_REQUIRED_NO_NEEDED, - FUNC_DATA_REQUIRED_DISCARD + FUNC_DATA_REQUIRED_DATA_LOAD = 1, + FUNC_DATA_REQUIRED_STATIS_LOAD, + FUNC_DATA_REQUIRED_NOT_LOAD, + FUNC_DATA_REQUIRED_FILTEROUT, } EFuncDataRequired; EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow); diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index 8d88b94d6c..1f3c003dfb 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -42,10 +42,6 @@ #define curTimeWindowIndex(_winres) ((_winres)->curIndex) -struct SColumnFilterElem; - -typedef bool (*__filter_func_t)(struct SColumnFilterElem* pFilter, const char* val1, const char* val2, int16_t type); - typedef struct SGroupResInfo { int32_t totalGroup; int32_t currentGroup; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 78bc6947cd..ea2939055e 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -38,8 +38,6 @@ extern "C" { #include "tpagedbuf.h" #include "tmsg.h" -struct SColumnFilterElem; - typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order); #define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) @@ -225,8 +223,6 @@ typedef struct STaskRuntimeEnv { void* qinfo; uint8_t scanFlag; // denotes reversed scan of data or not void* pTsdbReadHandle; - - int32_t prevGroupId; // previous executed group id bool enableGroupData; SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file SHashObj* pResultRowHashTable; // quick locate the window object for each result @@ -241,8 +237,6 @@ typedef struct STaskRuntimeEnv { char* tagVal; // tag value of current data block struct SScalarFunctionSupport* scalarSup; - - SSDataBlock* outputBuf; STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure struct SOperatorInfo* proot; SGroupResInfo groupResInfo; @@ -250,7 +244,6 @@ typedef struct STaskRuntimeEnv { STableQueryInfo* current; SResultInfo resultInfo; - SHashObj* pTableRetrieveTsMap; struct SUdfInfo* pUdfInfo; } STaskRuntimeEnv; @@ -350,6 +343,7 @@ typedef struct STableScanInfo { int64_t elapsedTime; int32_t prevGroupId; // previous table group id int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan + int32_t dataBlockLoadFlag; } STableScanInfo; typedef struct STagScanInfo { @@ -616,7 +610,7 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowCellInfoOffset); SOperatorInfo* createExchangeOperatorInfo(const SNodeList* pSources, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfCols, int32_t repeatTime, +SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfCols, int32_t dataLoadFlag, int32_t repeatTime, int32_t reverseTime, SArray* pColMatchInfo, SSDataBlock* pResBlock, SNode* pCondition, SExecTaskInfo* pTaskInfo); SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index c911aef45f..cfa17ecd3c 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -271,7 +271,7 @@ static int compareRowData(const void* a, const void* b, const void* userData) { } // setup the output buffer for each operator -SSDataBlock* createOutputBuf_rv1(SDataBlockDescNode* pNode) { +SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) { int32_t numOfCols = LIST_LENGTH(pNode->pSlots); SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); @@ -6518,8 +6518,6 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator, bool* newgroup) { SOperatorInfo* createTagScanOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput) { STagScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STagScanInfo)); - // pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pResultInfo->capacity); - size_t numOfGroup = GET_NUM_OF_TABLEGROUP(pRuntimeEnv); assert(numOfGroup == 0 || numOfGroup == 1); @@ -6747,13 +6745,13 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols); - SSDataBlock* pResBlock = createOutputBuf_rv1(pScanPhyNode->node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc); - return createTableScanOperatorInfo(pDataReader, pScanPhyNode->order, numOfCols, pScanPhyNode->count, + return createTableScanOperatorInfo(pDataReader, pScanPhyNode->order, numOfCols, dataLoadFlag, pScanPhyNode->count, pScanPhyNode->reverse, pColList, pResBlock, pScanPhyNode->node.pConditions, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) { SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pPhyNode; - SSDataBlock* pResBlock = createOutputBuf_rv1(pExchange->node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pExchange->node.pOutputDataBlockDesc); return createExchangeOperatorInfo(pExchange->pSrcEndPoints, pResBlock, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) { SScanPhysiNode* pScanPhyNode = (SScanPhysiNode*)pPhyNode; // simple child table. @@ -6761,7 +6759,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo int32_t code = doCreateTableGroup(pHandle->meta, pScanPhyNode->tableType, pScanPhyNode->uid, pTableGroupInfo, queryId, taskId); SArray* tableIdList = extractTableIdList(pTableGroupInfo); - SSDataBlock* pResBlock = createOutputBuf_rv1(pScanPhyNode->node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc); int32_t numOfCols = 0; SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols); @@ -6770,7 +6768,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo return pOperator; } else if (QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN == type) { SSystemTableScanPhysiNode* pSysScanPhyNode = (SSystemTableScanPhysiNode*)pPhyNode; - SSDataBlock* pResBlock = createOutputBuf_rv1(pSysScanPhyNode->scan.node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pSysScanPhyNode->scan.node.pOutputDataBlockDesc); struct SScanPhysiNode* pScanNode = &pSysScanPhyNode->scan; SArray* colList = extractScanColumnId(pScanNode->pScanCols); @@ -6799,14 +6797,14 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SProjectPhysiNode* pProjPhyNode = (SProjectPhysiNode*) pPhyNode; SExprInfo* pExprInfo = createExprInfo(pProjPhyNode->pProjections, NULL, &num); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SLimit limit = {.limit = pProjPhyNode->limit, .offset = pProjPhyNode->offset}; SLimit slimit = {.limit = pProjPhyNode->slimit, .offset = pProjPhyNode->soffset}; pOptr = createProjectOperatorInfo(ops[0], pExprInfo, num, pResBlock, &limit, &slimit, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_AGG == type) { SAggPhysiNode* pAggNode = (SAggPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pAggNode->pAggFuncs, pAggNode->pGroupKeys, &num); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SExprInfo* pScalarExprInfo = NULL; int32_t numOfScalarExpr = 0; @@ -6824,7 +6822,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SIntervalPhysiNode* pIntervalPhyNode = (SIntervalPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &num); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SInterval interval = { .interval = pIntervalPhyNode->interval, @@ -6840,7 +6838,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) { SSortPhysiNode* pSortPhyNode = (SSortPhysiNode*)pPhyNode; - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SArray* info = createSortInfo(pSortPhyNode->pSortKeys, pSortPhyNode->pTargets); SArray* slotMap = createIndexMap(pSortPhyNode->pTargets); pOptr = createSortOperatorInfo(ops[0], pResBlock, info, slotMap, pTaskInfo); @@ -6848,12 +6846,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode; SExprInfo* pExprInfo = createExprInfo(pSessionNode->window.pFuncs, NULL, &num); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); pOptr = createSessionAggOperatorInfo(ops[0], pExprInfo, num, pResBlock, pSessionNode->gap, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_PARTITION == type) { SPartitionPhysiNode* pPartNode = (SPartitionPhysiNode*) pPhyNode; SArray* pColList = extractPartitionColInfo(pPartNode->pPartitionKeys); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SExprInfo* pExprInfo = createExprInfo(pPartNode->pTargets, NULL, &num); pOptr = createPartitionOperatorInfo(ops[0], pExprInfo, num, pResBlock, pColList, pTaskInfo, NULL); @@ -6861,11 +6859,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SStateWinodwPhysiNode* pStateNode = (SStateWinodwPhysiNode*) pPhyNode; SExprInfo* pExprInfo = createExprInfo(pStateNode->window.pFuncs, NULL, &num); - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); pOptr = createStatewindowOperatorInfo(ops[0], pExprInfo, num, pResBlock, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_JOIN == type) { SJoinPhysiNode* pJoinNode = (SJoinPhysiNode*) pPhyNode; - SSDataBlock* pResBlock = createOutputBuf_rv1(pPhyNode->pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc); SExprInfo* pExprInfo = createExprInfo(pJoinNode->pTargets, NULL, &num); pOptr = createJoinOperatorInfo(ops, size, pExprInfo, num, pResBlock, pJoinNode->pOnConditions, pTaskInfo); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 901bfde6a4..a2e68e34f1 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -64,16 +64,19 @@ static void setupQueryRangeForReverseScan(STableScanInfo* pTableScanInfo) { #endif } -int32_t loadDataBlock(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, uint32_t* status) { +int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, uint32_t* status) { + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + STableScanInfo* pInfo = pOperator->info; + STaskCostInfo* pCost = &pTaskInfo->cost; pCost->totalBlocks += 1; + pCost->loadBlocks += 1; + pCost->totalRows += pBlock->info.rows; - pCost->totalCheckedRows += pBlock->info.rows; - pCost->loadBlocks += 1; - *status = BLK_DATA_DATA_LOAD; + *status = pInfo->dataBlockLoadFlag; SArray* pCols = tsdbRetrieveDataBlock(pTableScanInfo->dataReader, NULL); if (pCols == NULL) { @@ -217,7 +220,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) { return p; } -SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfOutput, +SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfOutput, int32_t dataLoadFlag, int32_t repeatTime, int32_t reverseTime, SArray* pColMatchInfo, SSDataBlock* pResBlock, SNode* pCondition, SExecTaskInfo* pTaskInfo) { assert(repeatTime > 0); @@ -232,6 +235,7 @@ SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, return NULL; } + pInfo->dataBlockLoadFlag= dataLoadFlag; pInfo->pResBlock = pResBlock; pInfo->pFilterNode = pCondition; pInfo->dataReader = pTsdbReadHandle; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 50c65439c0..71e8bcc842 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -58,9 +58,9 @@ void functionFinalize(SqlFunctionCtx *pCtx) { EFuncDataRequired countDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow) { SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0); if (QUERY_NODE_COLUMN == nodeType(pParam) && PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pParam)->colId) { - return FUNC_DATA_REQUIRED_NO_NEEDED; + return FUNC_DATA_REQUIRED_NOT_LOAD; } - return FUNC_DATA_REQUIRED_STATIS_NEEDED; + return FUNC_DATA_REQUIRED_STATIS_LOAD; } bool getCountFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index aec75a0365..d0af3487ce 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -78,10 +78,10 @@ int32_t fmGetFuncResultType(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow) { if (pFunc->funcId < 0 || pFunc->funcId >= funcMgtBuiltinsNum) { - return FUNC_DATA_REQUIRED_ALL_NEEDED; + return FUNC_DATA_REQUIRED_DATA_LOAD; } if (NULL == funcMgtBuiltins[pFunc->funcId].dataRequiredFunc) { - return FUNC_DATA_REQUIRED_ALL_NEEDED; + return FUNC_DATA_REQUIRED_DATA_LOAD; } return funcMgtBuiltins[pFunc->funcId].dataRequiredFunc(pFunc, pTimeWindow); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 3c60b62434..fd0d2758bf 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -200,7 +200,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect strcpy(pScan->tableName.tname, pRealTable->table.tableName); pScan->showRewrite = pCxt->pPlanCxt->showRewrite; pScan->ratio = pRealTable->ratio; - pScan->dataRequired = FUNC_DATA_REQUIRED_ALL_NEEDED; + pScan->dataRequired = FUNC_DATA_REQUIRED_DATA_LOAD; // set columns to scan SNodeList* pCols = NULL; diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 19e6718fe8..a8513bf376 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -125,12 +125,12 @@ static int32_t osdMatch(SOptimizeContext* pCxt, SLogicNode* pLogicNode, SOsdInfo static EFuncDataRequired osdPromoteDataRequired(EFuncDataRequired l , EFuncDataRequired r) { switch (l) { - case FUNC_DATA_REQUIRED_ALL_NEEDED: + case FUNC_DATA_REQUIRED_DATA_LOAD: return l; - case FUNC_DATA_REQUIRED_STATIS_NEEDED: - return FUNC_DATA_REQUIRED_ALL_NEEDED == r ? r : l; - case FUNC_DATA_REQUIRED_NO_NEEDED: - return FUNC_DATA_REQUIRED_DISCARD == r ? l : r; + case FUNC_DATA_REQUIRED_STATIS_LOAD: + return FUNC_DATA_REQUIRED_DATA_LOAD == r ? r : l; + case FUNC_DATA_REQUIRED_NOT_LOAD: + return FUNC_DATA_REQUIRED_FILTEROUT == r ? l : r; default: break; } @@ -139,9 +139,9 @@ static EFuncDataRequired osdPromoteDataRequired(EFuncDataRequired l , EFuncDataR static int32_t osdGetDataRequired(SNodeList* pFuncs) { if (NULL == pFuncs) { - return FUNC_DATA_REQUIRED_ALL_NEEDED; + return FUNC_DATA_REQUIRED_DATA_LOAD; } - EFuncDataRequired dataRequired = FUNC_DATA_REQUIRED_DISCARD; + EFuncDataRequired dataRequired = FUNC_DATA_REQUIRED_FILTEROUT; SNode* pFunc = NULL; FOREACH(pFunc, pFuncs) { dataRequired = osdPromoteDataRequired(dataRequired, fmFuncDataRequired((SFunctionNode*)pFunc, NULL)); From 078c48a50a7ff449f21ab8604250a2eed3154e78 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 15 Apr 2022 18:25:24 +0800 Subject: [PATCH 52/60] other:fix syntax error. --- source/libs/executor/src/executorimpl.c | 5 +++-- source/libs/executor/src/scanoperator.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index cfa17ecd3c..3e2f95a27c 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -6737,9 +6737,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo int32_t type = nodeType(pPhyNode); if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == type) { SScanPhysiNode* pScanPhyNode = (SScanPhysiNode*)pPhyNode; + STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode* ) pPhyNode; int32_t numOfCols = 0; - tsdbReaderT pDataReader = doCreateDataReader((STableScanPhysiNode*)pPhyNode, pHandle, pTableGroupInfo, (uint64_t)queryId, taskId); + tsdbReaderT pDataReader = doCreateDataReader(pTableScanNode, pHandle, pTableGroupInfo, (uint64_t)queryId, taskId); if (pDataReader == NULL) { return NULL; } @@ -6747,7 +6748,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols); SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc); - return createTableScanOperatorInfo(pDataReader, pScanPhyNode->order, numOfCols, dataLoadFlag, pScanPhyNode->count, + return createTableScanOperatorInfo(pDataReader, pScanPhyNode->order, numOfCols, pTableScanNode->dataRequired, pScanPhyNode->count, pScanPhyNode->reverse, pColList, pResBlock, pScanPhyNode->node.pConditions, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) { SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pPhyNode; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a2e68e34f1..3de9d9020e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -142,7 +142,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator, bool* newgroup) { // this function never returns error? uint32_t status = BLK_DATA_DATA_LOAD; - int32_t code = loadDataBlock(pTaskInfo, pTableScanInfo, pBlock, &status); + int32_t code = loadDataBlock(pOperator, pTableScanInfo, pBlock, &status); // int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status); if (code != TSDB_CODE_SUCCESS) { longjmp(pOperator->pTaskInfo->env, code); From ba1f3f781584ded7f71eff59c95aa518cf15edc2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 18:30:01 +0800 Subject: [PATCH 53/60] feat: CREATE STREAM statement implement, and syntax of JSON data type implement. --- include/common/ttokendef.h | 118 +- include/libs/function/functionMgt.h | 1 + include/libs/nodes/cmdnodes.h | 27 + include/libs/nodes/nodes.h | 7 + source/common/src/ttypes.c | 4 +- source/dnode/mnode/impl/src/mndInfoSchema.c | 2 +- source/libs/function/inc/builtins.h | 1 + source/libs/function/src/builtins.c | 34 +- source/libs/function/src/functionMgt.c | 4 + source/libs/nodes/src/nodesUtilFuncs.c | 25 + source/libs/parser/inc/parAst.h | 6 +- source/libs/parser/inc/sql.y | 52 +- source/libs/parser/src/parAstCreater.c | 51 +- source/libs/parser/src/parTokenizer.c | 18 +- source/libs/parser/src/parTranslater.c | 181 +- source/libs/parser/src/sql.c | 4405 ++++++++++--------- source/libs/parser/test/parserAstTest.cpp | 36 +- source/libs/parser/test/parserTestMain.cpp | 23 + source/libs/parser/test/parserTestUtil.h | 16 + 19 files changed, 2758 insertions(+), 2253 deletions(-) create mode 100644 source/libs/parser/test/parserTestUtil.h diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 23dd4b38ff..47f2303246 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -171,60 +171,69 @@ #define TK_BUFSIZE 153 #define TK_STREAM 154 #define TK_INTO 155 -#define TK_KILL 156 -#define TK_CONNECTION 157 -#define TK_MERGE 158 -#define TK_VGROUP 159 -#define TK_REDISTRIBUTE 160 -#define TK_SPLIT 161 -#define TK_SYNCDB 162 -#define TK_NULL 163 -#define TK_FIRST 164 -#define TK_LAST 165 -#define TK_CAST 166 -#define TK_NOW 167 -#define TK_TODAY 168 -#define TK_ROWTS 169 -#define TK_TBNAME 170 -#define TK_QSTARTTS 171 -#define TK_QENDTS 172 -#define TK_WSTARTTS 173 -#define TK_WENDTS 174 -#define TK_WDURATION 175 -#define TK_BETWEEN 176 -#define TK_IS 177 -#define TK_NK_LT 178 -#define TK_NK_GT 179 -#define TK_NK_LE 180 -#define TK_NK_GE 181 -#define TK_NK_NE 182 -#define TK_MATCH 183 -#define TK_NMATCH 184 -#define TK_JOIN 185 -#define TK_INNER 186 -#define TK_SELECT 187 -#define TK_DISTINCT 188 -#define TK_WHERE 189 -#define TK_PARTITION 190 -#define TK_BY 191 -#define TK_SESSION 192 -#define TK_STATE_WINDOW 193 -#define TK_SLIDING 194 -#define TK_FILL 195 -#define TK_VALUE 196 -#define TK_NONE 197 -#define TK_PREV 198 -#define TK_LINEAR 199 -#define TK_NEXT 200 -#define TK_GROUP 201 -#define TK_HAVING 202 -#define TK_ORDER 203 -#define TK_SLIMIT 204 -#define TK_SOFFSET 205 -#define TK_LIMIT 206 -#define TK_OFFSET 207 -#define TK_ASC 208 -#define TK_NULLS 209 +#define TK_TRIGGER 156 +#define TK_AT_ONCE 157 +#define TK_WINDOW_CLOSE 158 +#define TK_WATERMARK 159 +#define TK_KILL 160 +#define TK_CONNECTION 161 +#define TK_MERGE 162 +#define TK_VGROUP 163 +#define TK_REDISTRIBUTE 164 +#define TK_SPLIT 165 +#define TK_SYNCDB 166 +#define TK_NULL 167 +#define TK_NK_QUESTION 168 +#define TK_NK_ARROW 169 +#define TK_NOW 170 +#define TK_TODAY 171 +#define TK_ROWTS 172 +#define TK_TBNAME 173 +#define TK_QSTARTTS 174 +#define TK_QENDTS 175 +#define TK_WSTARTTS 176 +#define TK_WENDTS 177 +#define TK_WDURATION 178 +#define TK_CAST 179 +#define TK_COUNT 180 +#define TK_FIRST 181 +#define TK_LAST 182 +#define TK_LAST_ROW 183 +#define TK_BETWEEN 184 +#define TK_IS 185 +#define TK_NK_LT 186 +#define TK_NK_GT 187 +#define TK_NK_LE 188 +#define TK_NK_GE 189 +#define TK_NK_NE 190 +#define TK_MATCH 191 +#define TK_NMATCH 192 +#define TK_CONTAINS 193 +#define TK_JOIN 194 +#define TK_INNER 195 +#define TK_SELECT 196 +#define TK_DISTINCT 197 +#define TK_WHERE 198 +#define TK_PARTITION 199 +#define TK_BY 200 +#define TK_SESSION 201 +#define TK_STATE_WINDOW 202 +#define TK_SLIDING 203 +#define TK_FILL 204 +#define TK_VALUE 205 +#define TK_NONE 206 +#define TK_PREV 207 +#define TK_LINEAR 208 +#define TK_NEXT 209 +#define TK_GROUP 210 +#define TK_HAVING 211 +#define TK_ORDER 212 +#define TK_SLIMIT 213 +#define TK_SOFFSET 214 +#define TK_LIMIT 215 +#define TK_OFFSET 216 +#define TK_ASC 217 +#define TK_NULLS 218 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -233,7 +242,6 @@ #define TK_NK_OCT 304 // oct number #define TK_NK_BIN 305 // bin format data 0b111 #define TK_NK_FILE 306 -#define TK_NK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query #define TK_NK_BITNOT 501 #define TK_INSERT 502 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index a471de3147..dc5bdc62e5 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -137,6 +137,7 @@ bool fmIsWindowPseudoColumnFunc(int32_t funcId); bool fmIsWindowClauseFunc(int32_t funcId); bool fmIsSpecialDataRequiredFunc(int32_t funcId); bool fmIsDynamicScanOptimizedFunc(int32_t funcId); +bool fmIsMultiResFunc(int32_t funcId); typedef enum EFuncDataRequired { FUNC_DATA_REQUIRED_ALL_NEEDED = 1, diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e1a63bd66b..6810b63f4e 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -272,6 +272,33 @@ typedef struct SKillStmt { int32_t targetId; } SKillStmt; +typedef enum EStreamTriggerType { + STREAM_TRIGGER_AT_ONCE = 1, + STREAM_TRIGGER_WINDOW_CLOSE +} EStreamTriggerType; + +typedef struct SStreamOptions { + ENodeType type; + EStreamTriggerType triggerType; + SNode* pWatermark; +} SStreamOptions; + +typedef struct SCreateStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + char targetDbName[TSDB_DB_NAME_LEN]; + char targetTabName[TSDB_TABLE_NAME_LEN]; + bool ignoreExists; + SStreamOptions* pOptions; + SNode* pQuery; +} SCreateStreamStmt; + +typedef struct SDropStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + bool ignoreNotExists; +} SDropStreamStmt; + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 02636a178e..8db93ee5f9 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -80,6 +80,7 @@ typedef enum ENodeType { QUERY_NODE_TABLE_OPTIONS, QUERY_NODE_INDEX_OPTIONS, QUERY_NODE_EXPLAIN_OPTIONS, + QUERY_NODE_STREAM_OPTIONS, // Statement nodes are used in parser and planner module. QUERY_NODE_SET_OPERATOR, @@ -151,6 +152,12 @@ typedef enum ENodeType { QUERY_NODE_SHOW_CONNECTIONS_STMT, QUERY_NODE_SHOW_QUERIES_STMT, QUERY_NODE_SHOW_VNODES_STMT, + QUERY_NODE_SHOW_APPS_STMT, + QUERY_NODE_SHOW_SCORES_STMT, + QUERY_NODE_SHOW_VARIABLE_STMT, + QUERY_NODE_SHOW_CREATE_DATABASE_STMT, + QUERY_NODE_SHOW_CREATE_TABLE_STMT, + QUERY_NODE_SHOW_CREATE_STABLE_STMT, QUERY_NODE_KILL_CONNECTION_STMT, QUERY_NODE_KILL_QUERY_STMT, diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index ef75adeb5d..cb8746c963 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -377,7 +377,7 @@ tDataTypeDescriptor tDataTypes[15] = { getStatics_i64}, {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", 0, 0, tsCompressFloat, tsDecompressFloat, getStatics_f}, {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", 0, 0, tsCompressDouble, tsDecompressDouble, getStatics_d}, - {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, + {TSDB_DATA_TYPE_VARCHAR, 6, 0, "VARCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", INT64_MIN, INT64_MAX, tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_nchr}, @@ -402,7 +402,7 @@ char tTokenTypeSwitcher[13] = { TSDB_DATA_TYPE_DOUBLE, // TK_DOUBLE TSDB_DATA_TYPE_BINARY, // TK_STRING TSDB_DATA_TYPE_BIGINT, // TK_TIMESTAMP - TSDB_DATA_TYPE_BINARY, // TK_BINARY + TSDB_DATA_TYPE_VARCHAR, // TK_BINARY TSDB_DATA_TYPE_NCHAR, // TK_NCHAR }; diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index c21a6e61df..b935939160 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -81,7 +81,7 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "wallevel", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, + {.name = "wal", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 814076fc34..fb36c9d978 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -37,6 +37,7 @@ extern "C" { #define FUNC_MGT_WINDOW_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(8) #define FUNC_MGT_SPECIAL_DATA_REQUIRED FUNC_MGT_FUNC_CLASSIFICATION_MASK(9) #define FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED FUNC_MGT_FUNC_CLASSIFICATION_MASK(10) +#define FUNC_MGT_MULTI_RES_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(11) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 49504b2cd4..9d434222ff 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -203,9 +203,9 @@ static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len } static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // first(*)/first(col_list) has been rewritten as first(col) + // first(col_list) will be rewritten as first(col) if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + return TSDB_CODE_SUCCESS; } SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); @@ -370,6 +370,20 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le return TSDB_CODE_SUCCESS; } +static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + SExprNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); + if (QUERY_NODE_VALUE != nodeType(pPara) || (!IS_VAR_DATA_TYPE(pPara->resType.type))) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes, .type = TSDB_DATA_TYPE_JSON}; + return TSDB_CODE_SUCCESS; +} + const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "count", @@ -475,7 +489,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last_row", .type = FUNCTION_TYPE_LAST_ROW, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateLastRow, .getEnvFunc = getMinmaxFuncEnv, .initFunc = maxFunctionSetup, @@ -485,7 +499,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "first", .type = FUNCTION_TYPE_FIRST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -495,7 +509,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last", .type = FUNCTION_TYPE_LAST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -861,6 +875,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .initFunc = NULL, .sprocessFunc = winDurFunction, .finalizeFunc = NULL + }, + { + .name = "to_json", + .type = FUNCTION_TYPE_TO_JSON, + .classification = FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateToJson, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = NULL, + .finalizeFunc = NULL } }; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index aec75a0365..9bcbbb5d5a 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -138,6 +138,10 @@ bool fmIsDynamicScanOptimizedFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED); } +bool fmIsMultiResFunc(int32_t funcId) { + return isSpecificClassifyFunc(funcId, FUNC_MGT_MULTI_RES_FUNC); +} + void fmFuncMgtDestroy() { void* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index e1a486d8b1..d4457a056e 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -84,6 +84,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SIndexOptions)); case QUERY_NODE_EXPLAIN_OPTIONS: return makeNode(type, sizeof(SExplainOptions)); + case QUERY_NODE_STREAM_OPTIONS: + return makeNode(type, sizeof(SStreamOptions)); case QUERY_NODE_SET_OPERATOR: return makeNode(type, sizeof(SSetOperator)); case QUERY_NODE_SELECT_STMT: @@ -146,6 +148,19 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SDescribeStmt)); case QUERY_NODE_RESET_QUERY_CACHE_STMT: return makeNode(type, sizeof(SNode)); + case QUERY_NODE_COMPACT_STMT: + case QUERY_NODE_CREATE_FUNCTION_STMT: + case QUERY_NODE_DROP_FUNCTION_STMT: + break; + case QUERY_NODE_CREATE_STREAM_STMT: + return makeNode(type, sizeof(SCreateStreamStmt)); + case QUERY_NODE_DROP_STREAM_STMT: + return makeNode(type, sizeof(SDropStreamStmt)); + case QUERY_NODE_MERGE_VGROUP_STMT: + case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: + case QUERY_NODE_SPLIT_VGROUP_STMT: + case QUERY_NODE_SYNCDB_STMT: + break; case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: @@ -169,7 +184,16 @@ SNodeptr nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_CONFIGS_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: case QUERY_NODE_SHOW_VNODES_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return makeNode(type, sizeof(SShowStmt)); + case QUERY_NODE_KILL_CONNECTION_STMT: + case QUERY_NODE_KILL_QUERY_STMT: + return makeNode(type, sizeof(SKillStmt)); case QUERY_NODE_LOGIC_PLAN_SCAN: return makeNode(type, sizeof(SScanLogicNode)); case QUERY_NODE_LOGIC_PLAN_JOIN: @@ -675,6 +699,7 @@ int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode) { if (NULL != pList->pTail) { pList->pTail->pNext = p; } + p->pPrev = pList->pTail; pList->pTail = p; ++(pList->length); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 1fa3a18668..160bc8e075 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -86,6 +86,7 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt); SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, const SToken* pAlias); SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); @@ -165,8 +166,9 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups); SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName); -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery); -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName); +SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery); +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName); SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2); SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 3c3cea8ea3..132a746828 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -293,6 +293,7 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. table_options(A) ::= . { A = createTableOptions(pCxt); } table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { ((STableOptions*)B)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C); A = B; } table_options(A) ::= table_options(B) KEEP integer_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } +table_options(A) ::= table_options(B) KEEP variable_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { ((STableOptions*)B)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { ((STableOptions*)B)->pSma = C; A = B; } table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { ((STableOptions*)B)->pFuncs = C; A = B; } @@ -306,6 +307,7 @@ alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). %destructor alter_table_option { } alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } +alter_table_option(A) ::= KEEP variable_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } %type col_name_list { SNodeList* } @@ -424,8 +426,17 @@ bufsize_opt(A) ::= . bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = strtol(B.z, NULL, 10); } /************************************************ create/drop stream **************************************************/ -cmd ::= CREATE STREAM stream_name(A) INTO table_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateStreamStmt(pCxt, &A, &B, C); } -cmd ::= DROP STREAM stream_name(A). { pCxt->pRootNode = createDropStreamStmt(pCxt, &A); } +cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) + stream_options(B) into_opt(C) AS query_expression(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, B, C, D); } +cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); } + +into_opt(A) ::= . { A = NULL; } +into_opt(A) ::= INTO full_table_name(B). { A = B; } + +stream_options(A) ::= . { A = createStreamOptions(pCxt); } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } @@ -455,6 +466,7 @@ literal(A) ::= NK_BOOL(B). literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); } literal(A) ::= duration_literal(B). { A = B; } literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } +literal(A) ::= NK_QUESTION(B). { A = createRawExprNode(pCxt, &B, createPlaceholderValueNode(pCxt)); } duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); } @@ -501,8 +513,6 @@ column_name(A) ::= NK_ID(B). %type function_name { SToken } %destructor function_name { } function_name(A) ::= NK_ID(B). { A = B; } -function_name(A) ::= FIRST(B). { A = B; } -function_name(A) ::= LAST(B). { A = B; } %type table_alias { SToken } %destructor table_alias { } @@ -530,12 +540,9 @@ stream_name(A) ::= NK_ID(B). /************************************************ expression **********************************************************/ expression(A) ::= literal(B). { A = B; } -//expression(A) ::= NK_QUESTION(B). { A = B; } expression(A) ::= pseudo_column(B). { A = B; } expression(A) ::= column_reference(B). { A = B; } -expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } -expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); } -expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } +expression(A) ::= function_expression(B). { A = B; } //expression(A) ::= case_expression(B). { A = B; } expression(A) ::= subquery(B). { A = B; } expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); } @@ -572,6 +579,10 @@ expression(A) ::= expression(B) NK_REM expression(C). SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } +expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). { + SToken s = getTokenFromRawExprNode(pCxt, B); + A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C))); + } %type expression_list { SNodeList* } %destructor expression_list { nodesDestroyList($$); } @@ -591,6 +602,30 @@ pseudo_column(A) ::= WSTARTTS(B). pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } + +%type star_func { SToken } +%destructor star_func { } +star_func(A) ::= COUNT(B). { A = B; } +star_func(A) ::= FIRST(B). { A = B; } +star_func(A) ::= LAST(B). { A = B; } +star_func(A) ::= LAST_ROW(B). { A = B; } + +%type star_func_para_list { SNodeList* } +%destructor star_func_para_list { nodesDestroyList($$); } +star_func_para_list(A) ::= NK_STAR(B). { A = createNodeList(pCxt, createColumnNode(pCxt, NULL, &B)); } +star_func_para_list(A) ::= other_para_list(B). { A = B; } + +%type other_para_list { SNodeList* } +%destructor other_para_list { nodesDestroyList($$); } +other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); } +other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); } + +star_func_para(A) ::= expression(B). { A = releaseRawExprNode(pCxt, B); } +star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); } + /************************************************ predicate ***********************************************************/ predicate(A) ::= expression(B) compare_op(C) expression(D). { SToken s = getTokenFromRawExprNode(pCxt, B); @@ -634,6 +669,7 @@ compare_op(A) ::= LIKE. compare_op(A) ::= NOT LIKE. { A = OP_TYPE_NOT_LIKE; } compare_op(A) ::= MATCH. { A = OP_TYPE_MATCH; } compare_op(A) ::= NMATCH. { A = OP_TYPE_NMATCH; } +compare_op(A) ::= CONTAINS. { A = OP_TYPE_JSON_CONTAINS; } %type in_op { EOperatorType } %destructor in_op { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index accf99606a..e229cfc751 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -305,6 +305,13 @@ SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) { return (SNode*)val; } +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt) { + SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + CHECK_OUT_OF_MEM(val); + // todo + return (SNode*)val; +} + SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2) { SLogicConditionNode* cond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); CHECK_OUT_OF_MEM(cond); @@ -911,6 +918,18 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S return (SNode*)pStmt; } +SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SHOW_CREATE_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { + SNode* pStmt = nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) { char password[TSDB_USET_PASSWORD_LEN] = {0}; if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { @@ -1142,16 +1161,34 @@ SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName) return pStmt; } -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); - CHECK_OUT_OF_MEM(pStmt); - return pStmt; +SNode* createStreamOptions(SAstCreateContext* pCxt) { + SStreamOptions* pOptions = nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); + CHECK_OUT_OF_MEM(pOptions); + pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + return (SNode*)pOptions; } -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery) { + SCreateStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); - return pStmt; + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + if (NULL != pRealTable) { + strcpy(pStmt->targetDbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->targetTabName, ((SRealTableNode*)pRealTable)->table.tableName); + nodesDestroyNode(pRealTable); + } + pStmt->ignoreExists = ignoreExists; + pStmt->pOptions = (SStreamOptions*)pOptions; + pStmt->pQuery = pQuery; + return (SNode*)pStmt; +} + +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName) { + SDropStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + pStmt->ignoreNotExists = ignoreNotExists; + return (SNode*)pStmt; } SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 0493771b61..618d5ccf48 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -39,6 +39,7 @@ static SKeyword keywordTable[] = { {"APPS", TK_APPS}, {"AS", TK_AS}, {"ASC", TK_ASC}, + {"AT_ONCE", TK_AT_ONCE}, {"BETWEEN", TK_BETWEEN}, {"BINARY", TK_BINARY}, {"BIGINT", TK_BIGINT}, @@ -57,6 +58,7 @@ static SKeyword keywordTable[] = { {"CONNS", TK_CONNS}, {"CONNECTION", TK_CONNECTION}, {"CONNECTIONS", TK_CONNECTIONS}, + {"COUNT", TK_COUNT}, {"CREATE", TK_CREATE}, {"DATABASE", TK_DATABASE}, {"DATABASES", TK_DATABASES}, @@ -100,6 +102,7 @@ static SKeyword keywordTable[] = { {"KEEP", TK_KEEP}, {"KILL", TK_KILL}, {"LAST", TK_LAST}, + {"LAST_ROW", TK_LAST_ROW}, {"LICENCE", TK_LICENCE}, {"LIKE", TK_LIKE}, {"LIMIT", TK_LIMIT}, @@ -132,10 +135,8 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -145,7 +146,6 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -178,6 +178,7 @@ static SKeyword keywordTable[] = { {"TODAY", TK_TODAY}, {"TOPIC", TK_TOPIC}, {"TOPICS", TK_TOPICS}, + {"TRIGGER", TK_TRIGGER}, {"TSERIES", TK_TSERIES}, {"TTL", TK_TTL}, {"UNION", TK_UNION}, @@ -194,9 +195,14 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, + {"WATERMARK", TK_WATERMARK}, + {"WHERE", TK_WHERE}, + {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, + {"_QENDTS", TK_QENDTS}, + {"_QSTARTTS", TK_QSTARTTS}, + {"_ROWTS", TK_ROWTS}, {"_WDURATION", TK_WDURATION}, {"_WENDTS", TK_WENDTS}, - {"WHERE", TK_WHERE}, {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, @@ -260,7 +266,6 @@ static SKeyword keywordTable[] = { // {"RESTRICT", TK_RESTRICT}, // {"ROW", TK_ROW}, // {"STATEMENT", TK_STATEMENT}, - // {"TRIGGER", TK_TRIGGER}, // {"VIEW", TK_VIEW}, // {"SEMI", TK_SEMI}, // {"PARTITIONS", TK_PARTITIONS}, @@ -345,6 +350,9 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { } *tokenId = TK_NK_COMMENT; return i; + } else if (z[1] == '>') { + *tokenId = TK_NK_ARROW; + return 2; } *tokenId = TK_NK_MINUS; return 1; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 250c6c2fd1..90a4e4e40e 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -770,71 +770,47 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { return TSDB_CODE_SUCCESS; } -static bool isFirstLastFunc(SFunctionNode* pFunc) { - return (FUNCTION_TYPE_FIRST == pFunc->funcType || FUNCTION_TYPE_LAST == pFunc->funcType); -} - -static bool isFirstLastStar(SNode* pNode) { - if (QUERY_NODE_FUNCTION != nodeType(pNode) || !isFirstLastFunc((SFunctionNode*)pNode)) { +static bool isMultiResFunc(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || !fmIsMultiResFunc(((SFunctionNode*)pNode)->funcId)) { return false; } SNodeList* pParameterList = ((SFunctionNode*)pNode)->pParameterList; - if (LIST_LENGTH(pParameterList) != 1) { - return false; + if (LIST_LENGTH(pParameterList) > 1) { + return true; } SNode* pParam = nodesListGetNode(pParameterList, 0); return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false); } -static SNode* createFirstLastFunc(SFunctionNode* pSrcFunc, SColumnNode* pCol) { +static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } pFunc->pParameterList = nodesMakeList(); - if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListAppend(pFunc->pParameterList, pCol)) { + if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListStrictAppend(pFunc->pParameterList, nodesCloneNode(pExpr))) { nodesDestroyNode(pFunc); return NULL; } - pFunc->node.resType = pCol->node.resType; + pFunc->node.resType = pExpr->resType; pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), - (FUNCTION_TYPE_FIRST == pSrcFunc->funcType ? "first(%s)" : "last(%s)"), pCol->colName); + if (QUERY_NODE_COLUMN == nodeType(pExpr)) { + SColumnNode* pCol = (SColumnNode*)pExpr; + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + } else { + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + } return (SNode*)pFunc; } -static int32_t createFirstLastAllCols(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { - SNodeList* pCols = NULL; - if (TSDB_CODE_SUCCESS != createAllColumns(pCxt, &pCols)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SNodeList* pFuncs = nodesMakeList(); - if (NULL == pFuncs) { - return TSDB_CODE_OUT_OF_MEMORY; - } - SNode* pCol = NULL; - FOREACH(pCol, pCols) { - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pFuncs, createFirstLastFunc(pSrcFunc, (SColumnNode*)pCol))) { - nodesDestroyNode(pFuncs); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - *pOutput = pFuncs; - return TSDB_CODE_SUCCESS; -} - -static bool isTableStar(SNode* pNode) { - return (QUERY_NODE_COLUMN == nodeType(pNode)) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); -} - static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { - *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + *pOutput = nodesMakeList(); + } if (NULL == *pOutput) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } @@ -858,15 +834,90 @@ static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SN return TSDB_CODE_SUCCESS; } +static bool isStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static bool isTableStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' != ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrcParas, SNodeList** pOutput) { + int32_t code = TSDB_CODE_SUCCESS; + + SNodeList* pExprs = NULL; + SNode* pPara = NULL; + FOREACH(pPara, pSrcParas) { + if (isStar(pPara)) { + code = createAllColumns(pCxt, &pExprs); + // The syntax definition ensures that * and other parameters do not appear at the same time + break; + } else if (isTableStar(pPara)) { + code = createTableAllCols(pCxt, (SColumnNode*)pPara, &pExprs); + } else { + code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pExprs; + } else { + nodesDestroyList(pExprs); + } + + return code; +} + +static int32_t createMultiResFuncs(SFunctionNode* pSrcFunc, SNodeList* pExprs, SNodeList** pOutput) { + SNodeList* pFuncs = nodesMakeList(); + if (NULL == pFuncs) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pExpr = NULL; + FOREACH(pExpr, pExprs) { + code = nodesListStrictAppend(pFuncs, createMultiResFunc(pSrcFunc, (SExprNode*)pExpr)); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pFuncs; + } else { + nodesDestroyList(pFuncs); + } + + return code; +} + +static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { + SNodeList* pExprs = NULL; + int32_t code = createMultiResFuncsParas(pCxt, pSrcFunc->pParameterList, &pExprs); + if (TSDB_CODE_SUCCESS == code) { + code = createMultiResFuncs(pSrcFunc, pExprs, pOutput); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pExprs); + } + + return code; +} + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pProjectionList) { // select * ... return createAllColumns(pCxt, &pSelect->pProjectionList); } else { SNode* pNode = NULL; WHERE_EACH(pNode, pSelect->pProjectionList) { - if (isFirstLastStar(pNode)) { + if (isMultiResFunc(pNode)) { SNodeList* pFuncs = NULL; - if (TSDB_CODE_SUCCESS != createFirstLastAllCols(pCxt, (SFunctionNode*)pNode, &pFuncs)) { + if (TSDB_CODE_SUCCESS != createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs)) { return TSDB_CODE_OUT_OF_MEMORY; } INSERT_LIST(pSelect->pProjectionList, pFuncs); @@ -2067,6 +2118,46 @@ static int32_t translateKillQuery(STranslateContext* pCxt, SKillStmt* pStmt) { return buildCmdMsg(pCxt, TDMT_MND_KILL_QUERY, (FSerializeFunc)tSerializeSKillQueryReq, &killReq); } +static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SCMCreateStreamReq createReq = {0}; + + createReq.igExists = pStmt->ignoreExists; + + SName name = {.type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId}; + strcpy(name.dbname, pCxt->pParseCxt->db); + strcpy(name.tname, pStmt->streamName); + tNameExtractFullName(&name, createReq.name); + + if ('\0' != pStmt->targetTabName[0]) { + strcpy(name.dbname, pStmt->targetDbName); + strcpy(name.tname, pStmt->targetTabName); + tNameExtractFullName(&name, createReq.outputSTbName); + } + + int32_t code = translateQuery(pCxt, pStmt->pQuery); + if (TSDB_CODE_SUCCESS == code) { + code = nodesNodeToString(pStmt->pQuery, false, &createReq.ast, NULL); + } + + if (TSDB_CODE_SUCCESS == code) { + createReq.sql = strdup(pCxt->pParseCxt->pSql); + if (NULL == createReq.sql) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, &createReq); + } + + tFreeSCMCreateStreamReq(&createReq); + return code; +} + +static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) { + // todo + return TSDB_CODE_SUCCESS; +} static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { int32_t code = TSDB_CODE_SUCCESS; @@ -2160,6 +2251,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_KILL_QUERY_STMT: code = translateKillQuery(pCxt, (SKillStmt*)pNode); break; + case QUERY_NODE_CREATE_STREAM_STMT: + code = translateCreateStream(pCxt, (SCreateStreamStmt*)pNode); + break; + case QUERY_NODE_DROP_STREAM_STMT: + code = translateDropStream(pCxt, (SDropStreamStmt*)pNode); + break; default: break; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index d3f5af3eb2..587d17fd8e 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 316 +#define YYNOCODE 332 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy21; - EFillMode yy22; - EOperatorType yy84; - bool yy121; - SDataType yy160; - ENullOrder yy281; - SToken yy409; - int32_t yy452; - SNodeList* yy488; - SNode* yy504; - EOrder yy522; - EJoinType yy556; + SNodeList* yy64; + int32_t yy116; + SNode* yy192; + ENullOrder yy225; + bool yy273; + SAlterOption yy277; + SToken yy353; + EFillMode yy358; + EJoinType yy372; + EOperatorType yy412; + EOrder yy530; + SDataType yy536; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 550 -#define YYNRULE 411 -#define YYNTOKEN 210 -#define YY_MAX_SHIFT 549 -#define YY_MIN_SHIFTREDUCE 810 -#define YY_MAX_SHIFTREDUCE 1220 -#define YY_ERROR_ACTION 1221 -#define YY_ACCEPT_ACTION 1222 -#define YY_NO_ACTION 1223 -#define YY_MIN_REDUCE 1224 -#define YY_MAX_REDUCE 1634 +#define YYNSTATE 566 +#define YYNRULE 431 +#define YYNTOKEN 219 +#define YY_MAX_SHIFT 565 +#define YY_MIN_SHIFTREDUCE 839 +#define YY_MAX_SHIFTREDUCE 1269 +#define YY_ERROR_ACTION 1270 +#define YY_ACCEPT_ACTION 1271 +#define YY_NO_ACTION 1272 +#define YY_MIN_REDUCE 1273 +#define YY_MAX_REDUCE 1703 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,487 +209,541 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1556) +#define YY_ACTTAB_COUNT (1905) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 452, 258, 1485, 270, 275, 452, 1434, 25, 195, 313, - /* 10 */ 465, 1435, 30, 28, 1481, 1488, 307, 1501, 1485, 311, - /* 20 */ 267, 1485, 1055, 1613, 1335, 32, 31, 29, 27, 26, - /* 30 */ 1481, 1487, 21, 1481, 1487, 1344, 1612, 1078, 1053, 239, - /* 40 */ 1611, 1518, 32, 31, 29, 27, 26, 1613, 447, 464, - /* 50 */ 11, 30, 28, 1163, 118, 407, 1236, 1060, 451, 267, - /* 60 */ 132, 1055, 1472, 1162, 1611, 30, 28, 435, 165, 1472, - /* 70 */ 431, 1075, 373, 267, 1, 1055, 465, 1053, 69, 1502, - /* 80 */ 1503, 1507, 1552, 542, 541, 73, 241, 1548, 1177, 11, - /* 90 */ 1501, 1053, 370, 1518, 375, 101, 1060, 546, 1613, 408, - /* 100 */ 447, 1344, 446, 11, 32, 31, 29, 27, 26, 1054, - /* 110 */ 1060, 132, 23, 1, 1518, 1611, 32, 31, 29, 27, - /* 120 */ 26, 434, 32, 31, 29, 27, 26, 1, 99, 119, - /* 130 */ 1613, 451, 424, 1302, 123, 1472, 546, 433, 128, 1559, - /* 140 */ 1560, 1077, 1564, 132, 464, 1384, 1056, 1611, 1054, 278, - /* 150 */ 546, 70, 1502, 1503, 1507, 1552, 1425, 1427, 349, 260, - /* 160 */ 1548, 127, 1054, 1059, 1079, 1080, 449, 1106, 1107, 1108, - /* 170 */ 1109, 1110, 1111, 1112, 1113, 1114, 29, 27, 26, 1094, - /* 180 */ 1580, 1079, 1080, 1222, 425, 1056, 85, 133, 1276, 84, - /* 190 */ 83, 82, 81, 80, 79, 78, 77, 76, 12, 1056, - /* 200 */ 382, 381, 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, - /* 210 */ 1110, 1111, 1112, 1113, 1114, 1118, 1059, 1079, 1080, 449, - /* 220 */ 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 30, - /* 230 */ 28, 1217, 442, 398, 1501, 53, 283, 267, 133, 1055, - /* 240 */ 384, 465, 378, 306, 1247, 305, 383, 1161, 97, 98, - /* 250 */ 73, 379, 377, 1322, 380, 1053, 1339, 376, 1518, 32, - /* 260 */ 31, 29, 27, 26, 1613, 434, 1344, 1613, 30, 28, - /* 270 */ 450, 1246, 1055, 133, 1060, 451, 267, 132, 1055, 1472, - /* 280 */ 132, 1611, 30, 28, 1611, 133, 421, 1501, 1053, 1472, - /* 290 */ 267, 7, 1055, 138, 1053, 70, 1502, 1503, 1507, 1552, - /* 300 */ 1216, 464, 349, 260, 1548, 127, 465, 1060, 1053, 1224, - /* 310 */ 898, 1518, 396, 1060, 546, 312, 1472, 191, 447, 51, - /* 320 */ 9, 8, 50, 414, 1579, 394, 1054, 1060, 451, 900, - /* 330 */ 7, 1344, 1472, 94, 93, 92, 91, 90, 89, 88, - /* 340 */ 87, 86, 426, 422, 7, 1225, 271, 546, 71, 1502, - /* 350 */ 1503, 1507, 1552, 546, 116, 12, 1551, 1548, 847, 1054, - /* 360 */ 846, 335, 1346, 1056, 500, 1054, 85, 546, 443, 84, - /* 370 */ 83, 82, 81, 80, 79, 78, 77, 76, 848, 1054, - /* 380 */ 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, - /* 390 */ 1112, 1113, 1114, 431, 1139, 1391, 1056, 32, 31, 29, - /* 400 */ 27, 26, 1056, 384, 133, 378, 1426, 142, 141, 383, - /* 410 */ 1245, 53, 98, 1059, 379, 377, 1056, 380, 101, 1059, - /* 420 */ 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, - /* 430 */ 1113, 1114, 1340, 1059, 1079, 1080, 449, 1106, 1107, 1108, - /* 440 */ 1109, 1110, 1111, 1112, 1113, 1114, 30, 28, 238, 438, - /* 450 */ 1075, 99, 1566, 1566, 267, 1472, 1055, 328, 60, 1422, - /* 460 */ 340, 129, 1559, 1560, 1244, 1564, 140, 1187, 133, 341, - /* 470 */ 1563, 1562, 1053, 32, 31, 29, 27, 26, 1076, 1337, - /* 480 */ 936, 488, 487, 486, 940, 485, 942, 943, 484, 945, - /* 490 */ 481, 1060, 951, 478, 953, 954, 475, 472, 389, 1391, - /* 500 */ 418, 1185, 1186, 1188, 1189, 257, 1391, 465, 1, 1472, - /* 510 */ 1389, 242, 465, 397, 431, 465, 320, 1390, 1243, 1571, - /* 520 */ 1158, 321, 1391, 115, 348, 465, 502, 167, 272, 1081, - /* 530 */ 392, 546, 1344, 1389, 1341, 386, 1094, 1344, 1082, 101, - /* 540 */ 1344, 166, 339, 1054, 1126, 334, 333, 332, 331, 330, - /* 550 */ 1344, 327, 326, 325, 324, 323, 319, 318, 317, 316, - /* 560 */ 315, 314, 1273, 1472, 117, 465, 503, 43, 1316, 223, - /* 570 */ 42, 66, 99, 1566, 462, 32, 31, 29, 27, 26, - /* 580 */ 1056, 221, 130, 1559, 1560, 102, 1564, 465, 6, 1242, - /* 590 */ 1344, 1561, 1336, 1127, 143, 491, 463, 1059, 1079, 1080, - /* 600 */ 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, - /* 610 */ 465, 1131, 1344, 242, 522, 521, 520, 519, 282, 209, - /* 620 */ 518, 517, 516, 103, 511, 510, 509, 508, 507, 506, - /* 630 */ 505, 504, 109, 1128, 1472, 1344, 549, 24, 265, 1121, - /* 640 */ 1122, 1123, 1124, 1125, 1129, 1130, 1126, 190, 1320, 437, - /* 650 */ 214, 1132, 277, 96, 1241, 1240, 176, 68, 280, 538, - /* 660 */ 116, 534, 530, 526, 213, 1391, 116, 846, 1346, 1239, - /* 670 */ 1238, 279, 515, 513, 1346, 251, 1389, 22, 1170, 1235, - /* 680 */ 116, 1234, 439, 368, 1077, 49, 48, 310, 1347, 137, - /* 690 */ 67, 1233, 1333, 207, 304, 1127, 298, 500, 1329, 1472, - /* 700 */ 1472, 165, 247, 465, 296, 373, 292, 288, 134, 1492, - /* 710 */ 1232, 300, 281, 1131, 1472, 1472, 1461, 252, 1231, 250, - /* 720 */ 249, 1490, 372, 461, 1472, 1501, 1472, 375, 1344, 1230, - /* 730 */ 1229, 1158, 1228, 133, 217, 1227, 1472, 1374, 1263, 24, - /* 740 */ 265, 1121, 1122, 1123, 1124, 1125, 1129, 1130, 1063, 1518, - /* 750 */ 1258, 413, 290, 514, 172, 1472, 447, 301, 1331, 158, - /* 760 */ 385, 1501, 156, 1472, 160, 162, 451, 159, 161, 1039, - /* 770 */ 1472, 169, 387, 1501, 1472, 1472, 164, 1472, 1256, 163, - /* 780 */ 1472, 9, 8, 1219, 1220, 1518, 70, 1502, 1503, 1507, - /* 790 */ 1552, 65, 447, 1327, 260, 1548, 1625, 1518, 406, 107, - /* 800 */ 390, 62, 451, 410, 447, 1586, 1472, 45, 179, 1062, - /* 810 */ 170, 1184, 181, 34, 451, 1501, 440, 1133, 1472, 1066, - /* 820 */ 448, 1501, 70, 1502, 1503, 1507, 1552, 490, 1237, 34, - /* 830 */ 260, 1548, 1625, 1090, 70, 1502, 1503, 1507, 1552, 1518, - /* 840 */ 192, 1609, 260, 1548, 1625, 1518, 447, 34, 1303, 419, - /* 850 */ 198, 1022, 447, 1570, 200, 95, 451, 344, 153, 457, - /* 860 */ 1472, 126, 451, 1385, 105, 435, 1472, 366, 206, 362, - /* 870 */ 358, 354, 152, 1501, 405, 185, 229, 1502, 1503, 1507, - /* 880 */ 1065, 872, 71, 1502, 1503, 1507, 1552, 367, 107, 45, - /* 890 */ 445, 1548, 929, 924, 1582, 470, 1613, 1518, 54, 957, - /* 900 */ 873, 150, 432, 105, 447, 1519, 106, 961, 107, 132, - /* 910 */ 967, 105, 966, 1611, 451, 108, 1075, 194, 1472, 2, - /* 920 */ 1501, 285, 289, 246, 248, 898, 1031, 215, 322, 139, - /* 930 */ 1424, 329, 337, 336, 120, 1502, 1503, 1507, 338, 342, - /* 940 */ 1086, 343, 1085, 431, 1518, 1084, 345, 145, 346, 347, - /* 950 */ 148, 447, 52, 350, 151, 1083, 369, 399, 149, 371, - /* 960 */ 122, 451, 146, 75, 1334, 1472, 401, 155, 101, 1330, - /* 970 */ 374, 256, 436, 1626, 400, 1501, 157, 110, 171, 144, - /* 980 */ 111, 71, 1502, 1503, 1507, 1552, 1332, 435, 1328, 112, - /* 990 */ 1549, 113, 402, 174, 1082, 274, 273, 409, 420, 1518, - /* 1000 */ 412, 99, 1501, 411, 1593, 1068, 447, 177, 455, 1592, - /* 1010 */ 1501, 188, 1559, 430, 1060, 429, 451, 5, 1613, 1583, - /* 1020 */ 1472, 1061, 417, 266, 180, 259, 1518, 423, 428, 100, - /* 1030 */ 4, 132, 416, 447, 1518, 1611, 234, 1502, 1503, 1507, - /* 1040 */ 1060, 447, 1158, 451, 1501, 1081, 1567, 1472, 35, 441, - /* 1050 */ 415, 451, 1501, 125, 1573, 1472, 261, 1501, 187, 444, - /* 1060 */ 186, 184, 17, 234, 1502, 1503, 1507, 1610, 1518, 1534, - /* 1070 */ 1433, 233, 1502, 1503, 1507, 447, 1518, 193, 453, 454, - /* 1080 */ 466, 1518, 1432, 447, 269, 451, 1501, 1628, 447, 1472, - /* 1090 */ 458, 460, 1064, 451, 459, 202, 204, 1472, 451, 216, - /* 1100 */ 264, 59, 1472, 427, 1345, 120, 1502, 1503, 1507, 61, - /* 1110 */ 1518, 1501, 468, 234, 1502, 1503, 1507, 447, 226, 1502, - /* 1120 */ 1503, 1507, 497, 218, 1317, 212, 545, 451, 41, 1069, - /* 1130 */ 220, 1472, 224, 225, 268, 1518, 1466, 222, 1465, 284, - /* 1140 */ 1462, 286, 447, 287, 1627, 1049, 1072, 234, 1502, 1503, - /* 1150 */ 1507, 1050, 451, 135, 291, 1460, 1472, 1501, 293, 295, - /* 1160 */ 294, 1459, 297, 1458, 299, 1501, 1449, 136, 302, 303, - /* 1170 */ 1034, 1443, 232, 1502, 1503, 1507, 1033, 1442, 308, 1441, - /* 1180 */ 309, 1518, 1440, 1005, 1417, 1416, 1415, 1414, 447, 1518, - /* 1190 */ 1413, 1412, 1411, 1501, 104, 1401, 447, 1410, 451, 1501, - /* 1200 */ 1007, 1395, 1472, 1409, 1408, 1407, 451, 1406, 1405, 1404, - /* 1210 */ 1472, 1403, 1402, 1400, 1399, 1398, 1397, 1518, 235, 1502, - /* 1220 */ 1503, 1507, 1396, 1518, 447, 1394, 227, 1502, 1503, 1507, - /* 1230 */ 447, 1393, 1392, 1275, 451, 1457, 1451, 1439, 1472, 1430, - /* 1240 */ 451, 147, 1323, 1274, 1472, 1501, 352, 865, 1272, 353, - /* 1250 */ 1501, 1270, 1268, 356, 236, 1502, 1503, 1507, 1501, 351, - /* 1260 */ 228, 1502, 1503, 1507, 355, 359, 357, 361, 1266, 1518, - /* 1270 */ 360, 365, 1255, 1254, 1518, 1251, 447, 364, 363, 1325, - /* 1280 */ 154, 447, 1518, 974, 972, 74, 451, 1324, 897, 447, - /* 1290 */ 1472, 451, 896, 895, 894, 1472, 891, 890, 1264, 451, - /* 1300 */ 1501, 514, 253, 1472, 1259, 254, 237, 1502, 1503, 1507, - /* 1310 */ 388, 1515, 1502, 1503, 1507, 512, 1257, 255, 1250, 1514, - /* 1320 */ 1502, 1503, 1507, 391, 1518, 1501, 1249, 393, 395, 72, - /* 1330 */ 1456, 447, 1041, 1450, 1501, 168, 403, 1438, 1437, 114, - /* 1340 */ 1429, 451, 173, 55, 14, 1472, 1490, 3, 34, 1518, - /* 1350 */ 15, 189, 39, 124, 36, 10, 447, 44, 1518, 178, - /* 1360 */ 121, 244, 1502, 1503, 1507, 447, 451, 404, 1183, 57, - /* 1370 */ 1472, 182, 183, 1205, 19, 451, 38, 1176, 1155, 1472, - /* 1380 */ 175, 56, 20, 1154, 37, 1210, 1513, 1502, 1503, 1507, - /* 1390 */ 16, 1204, 262, 1209, 1208, 245, 1502, 1503, 1507, 263, - /* 1400 */ 8, 131, 1501, 196, 1092, 33, 13, 1501, 1428, 1091, - /* 1410 */ 18, 203, 1119, 1501, 197, 205, 1181, 199, 201, 46, - /* 1420 */ 58, 1070, 40, 469, 456, 276, 1518, 1321, 1489, 473, - /* 1430 */ 476, 1518, 1319, 447, 62, 208, 467, 1518, 447, 958, - /* 1440 */ 471, 479, 955, 451, 447, 474, 477, 1472, 451, 952, - /* 1450 */ 946, 480, 1472, 944, 451, 482, 483, 950, 1472, 1501, - /* 1460 */ 935, 949, 948, 243, 1502, 1503, 1507, 489, 240, 1502, - /* 1470 */ 1503, 1507, 947, 969, 230, 1502, 1503, 1507, 63, 968, - /* 1480 */ 47, 64, 965, 1518, 963, 863, 499, 904, 210, 211, - /* 1490 */ 447, 501, 496, 210, 886, 885, 884, 496, 883, 882, - /* 1500 */ 451, 881, 880, 879, 1472, 901, 899, 876, 875, 874, - /* 1510 */ 871, 870, 869, 868, 498, 1271, 523, 1269, 524, 498, - /* 1520 */ 231, 1502, 1503, 1507, 527, 528, 525, 529, 1267, 531, - /* 1530 */ 532, 533, 1265, 495, 494, 493, 535, 492, 495, 494, - /* 1540 */ 493, 536, 492, 537, 1253, 539, 540, 1252, 1248, 543, - /* 1550 */ 544, 1223, 1057, 219, 547, 548, + /* 0 */ 268, 1543, 285, 1573, 1557, 317, 26, 203, 53, 123, + /* 10 */ 464, 1285, 33, 31, 480, 1539, 1546, 1543, 288, 1543, + /* 20 */ 277, 99, 1092, 77, 479, 1476, 1478, 69, 1573, 1388, + /* 30 */ 380, 1539, 1545, 1539, 1545, 444, 1442, 409, 1090, 1393, + /* 40 */ 1117, 105, 267, 1682, 434, 463, 1370, 1440, 1385, 1529, + /* 50 */ 12, 33, 31, 1212, 1557, 121, 136, 1098, 359, 277, + /* 60 */ 1680, 1092, 441, 1396, 143, 1113, 1682, 73, 1558, 466, + /* 70 */ 1560, 1561, 462, 479, 1, 1682, 1621, 1090, 1573, 1681, + /* 80 */ 270, 1617, 131, 1680, 323, 464, 927, 104, 136, 12, + /* 90 */ 51, 1473, 1680, 50, 199, 463, 1098, 562, 145, 1529, + /* 100 */ 424, 1648, 33, 31, 445, 929, 445, 106, 281, 1091, + /* 110 */ 277, 511, 1092, 1, 248, 1115, 121, 72, 1558, 466, + /* 120 */ 1560, 1561, 462, 102, 1395, 480, 1621, 36, 1090, 467, + /* 130 */ 249, 1617, 280, 514, 321, 1485, 562, 196, 1628, 440, + /* 140 */ 12, 439, 1682, 876, 1682, 875, 1093, 1098, 1091, 1384, + /* 150 */ 1393, 1176, 510, 509, 508, 136, 507, 136, 198, 1680, + /* 160 */ 1557, 1680, 124, 877, 1, 516, 1351, 1096, 1097, 1181, + /* 170 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 180 */ 1153, 1154, 1155, 1156, 1573, 1093, 395, 562, 389, 55, + /* 190 */ 266, 464, 394, 174, 1529, 101, 137, 390, 388, 1091, + /* 200 */ 391, 463, 1296, 23, 435, 1529, 1096, 1097, 425, 1141, + /* 210 */ 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, 1153, + /* 220 */ 1154, 1155, 1156, 246, 1558, 466, 1560, 1561, 462, 33, + /* 230 */ 31, 34, 32, 30, 29, 28, 1093, 277, 53, 1092, + /* 240 */ 287, 137, 34, 32, 30, 29, 28, 1529, 121, 137, + /* 250 */ 34, 32, 30, 29, 28, 1090, 1395, 1096, 1097, 1389, + /* 260 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 270 */ 1153, 1154, 1155, 1156, 1098, 33, 31, 1157, 479, 480, + /* 280 */ 250, 1371, 316, 277, 315, 1092, 1322, 308, 322, 87, + /* 290 */ 1550, 7, 86, 85, 84, 83, 82, 81, 80, 79, + /* 300 */ 78, 1090, 1548, 480, 1393, 1128, 310, 34, 32, 30, + /* 310 */ 29, 28, 77, 1174, 562, 1369, 431, 100, 1442, 387, + /* 320 */ 1098, 383, 558, 557, 282, 137, 1091, 1236, 1393, 1440, + /* 330 */ 359, 260, 36, 137, 30, 29, 28, 7, 538, 537, + /* 340 */ 536, 535, 292, 386, 534, 533, 532, 107, 527, 526, + /* 350 */ 525, 524, 523, 522, 521, 520, 114, 100, 9, 8, + /* 360 */ 562, 383, 1175, 1093, 516, 428, 1234, 1235, 1237, 1238, + /* 370 */ 1226, 225, 1091, 261, 1423, 259, 258, 1266, 382, 345, + /* 380 */ 1180, 436, 432, 386, 1096, 1097, 1116, 1141, 1142, 1143, + /* 390 */ 1144, 1145, 1146, 1147, 1148, 1149, 459, 1153, 1154, 1155, + /* 400 */ 1156, 1271, 33, 31, 441, 1325, 385, 384, 1295, 1093, + /* 410 */ 277, 875, 1092, 137, 25, 275, 1169, 1170, 1171, 1172, + /* 420 */ 1173, 1177, 1178, 1179, 1118, 147, 146, 378, 1090, 104, + /* 430 */ 1096, 1097, 1188, 1141, 1142, 1143, 1144, 1145, 1146, 1147, + /* 440 */ 1148, 1149, 459, 1153, 1154, 1155, 1156, 1098, 33, 31, + /* 450 */ 284, 283, 480, 1529, 293, 1265, 277, 395, 1092, 389, + /* 460 */ 1106, 330, 506, 394, 7, 102, 101, 1312, 390, 388, + /* 470 */ 62, 391, 448, 480, 1090, 1442, 1099, 1393, 443, 132, + /* 480 */ 1628, 1629, 331, 1633, 530, 127, 1477, 562, 311, 396, + /* 490 */ 22, 1386, 1682, 1098, 1294, 1098, 1434, 480, 1393, 1091, + /* 500 */ 34, 32, 30, 29, 28, 136, 358, 393, 392, 1680, + /* 510 */ 1, 965, 503, 502, 501, 969, 500, 971, 972, 499, + /* 520 */ 974, 496, 1393, 980, 493, 982, 983, 490, 487, 247, + /* 530 */ 1293, 1113, 290, 562, 480, 481, 1093, 449, 338, 1529, + /* 540 */ 121, 350, 184, 1390, 519, 1091, 1365, 1102, 1395, 1292, + /* 550 */ 351, 34, 32, 30, 29, 28, 1291, 1096, 1097, 1393, + /* 560 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 570 */ 1153, 1154, 1155, 1156, 452, 1529, 1290, 480, 513, 512, + /* 580 */ 1289, 1442, 1093, 6, 1107, 24, 1510, 531, 529, 250, + /* 590 */ 1640, 1207, 1441, 1114, 1529, 34, 32, 30, 29, 28, + /* 600 */ 518, 1529, 1393, 1096, 1097, 1110, 1141, 1142, 1143, 1144, + /* 610 */ 1145, 1146, 1147, 1148, 1149, 459, 1153, 1154, 1155, 1156, + /* 620 */ 1557, 1529, 1174, 349, 1288, 1529, 344, 343, 342, 341, + /* 630 */ 340, 416, 337, 336, 335, 334, 333, 329, 328, 327, + /* 640 */ 326, 325, 324, 1635, 1573, 122, 1287, 1211, 480, 480, + /* 650 */ 231, 444, 34, 32, 30, 29, 28, 477, 478, 1635, + /* 660 */ 112, 463, 229, 1518, 420, 1529, 1632, 1635, 480, 1529, + /* 670 */ 480, 1175, 1368, 1393, 1393, 148, 1273, 217, 417, 291, + /* 680 */ 450, 447, 1631, 73, 1558, 466, 1560, 1561, 462, 1180, + /* 690 */ 1630, 1529, 1621, 1393, 456, 1393, 270, 1617, 131, 300, + /* 700 */ 96, 95, 94, 93, 92, 91, 90, 89, 88, 1382, + /* 710 */ 34, 32, 30, 29, 28, 1128, 1284, 1649, 1274, 453, + /* 720 */ 1283, 407, 418, 25, 275, 1169, 1170, 1171, 1172, 1173, + /* 730 */ 1177, 1178, 1179, 106, 405, 1207, 1307, 511, 71, 87, + /* 740 */ 1557, 1282, 86, 85, 84, 83, 82, 81, 80, 79, + /* 750 */ 78, 1442, 1281, 1280, 1305, 1279, 1278, 289, 398, 514, + /* 760 */ 1682, 1529, 1440, 467, 1573, 1529, 49, 48, 320, 1486, + /* 770 */ 142, 464, 1378, 136, 1277, 314, 401, 1680, 510, 509, + /* 780 */ 508, 463, 507, 1276, 47, 1529, 1529, 256, 1233, 306, + /* 790 */ 1557, 302, 298, 139, 1092, 1380, 1219, 1529, 1529, 441, + /* 800 */ 1529, 1529, 1115, 73, 1558, 466, 1560, 1561, 462, 1162, + /* 810 */ 1090, 1166, 1621, 901, 1573, 1115, 270, 1617, 1694, 1529, + /* 820 */ 1352, 464, 165, 137, 104, 163, 1101, 1655, 1529, 1098, + /* 830 */ 167, 463, 902, 166, 169, 1529, 120, 168, 171, 1557, + /* 840 */ 1210, 170, 1078, 1079, 1376, 187, 177, 9, 8, 189, + /* 850 */ 1268, 1269, 458, 73, 1558, 466, 1560, 1561, 462, 505, + /* 860 */ 102, 35, 1621, 1573, 1100, 1182, 270, 1617, 1694, 562, + /* 870 */ 464, 1286, 200, 565, 133, 1628, 1629, 1678, 1633, 35, + /* 880 */ 463, 1091, 35, 1150, 1529, 429, 1053, 221, 1557, 206, + /* 890 */ 98, 109, 1435, 208, 410, 472, 554, 1104, 550, 546, + /* 900 */ 542, 220, 73, 1558, 466, 1560, 1561, 462, 193, 110, + /* 910 */ 112, 1621, 1573, 214, 958, 270, 1617, 1694, 1093, 464, + /* 920 */ 47, 441, 377, 1651, 953, 1574, 1639, 70, 442, 463, + /* 930 */ 215, 202, 400, 1529, 2, 1103, 1113, 485, 445, 1096, + /* 940 */ 1097, 986, 295, 299, 255, 1062, 104, 408, 927, 1557, + /* 950 */ 222, 238, 1558, 466, 1560, 1561, 462, 257, 110, 111, + /* 960 */ 476, 173, 990, 997, 403, 332, 1475, 112, 110, 397, + /* 970 */ 144, 996, 113, 1573, 68, 172, 1682, 339, 346, 347, + /* 980 */ 464, 348, 102, 352, 64, 1122, 353, 1557, 423, 136, + /* 990 */ 463, 180, 149, 1680, 1529, 354, 134, 1628, 1629, 1121, + /* 1000 */ 1633, 45, 355, 152, 44, 1120, 1070, 357, 176, 155, + /* 1010 */ 356, 1573, 74, 1558, 466, 1560, 1561, 462, 464, 52, + /* 1020 */ 360, 1621, 1119, 158, 379, 1620, 1617, 381, 463, 1383, + /* 1030 */ 162, 1379, 1529, 164, 97, 1098, 265, 1557, 1514, 411, + /* 1040 */ 115, 223, 116, 1381, 1377, 117, 1557, 419, 118, 175, + /* 1050 */ 74, 1558, 466, 1560, 1561, 462, 412, 179, 421, 1621, + /* 1060 */ 182, 1573, 1118, 455, 1617, 430, 415, 1662, 461, 1661, + /* 1070 */ 1573, 422, 470, 5, 438, 1652, 427, 464, 463, 426, + /* 1080 */ 1642, 185, 1529, 192, 188, 160, 269, 463, 130, 4, + /* 1090 */ 433, 1529, 129, 1557, 376, 103, 372, 368, 364, 159, + /* 1100 */ 245, 1558, 466, 1560, 1561, 462, 460, 457, 1593, 125, + /* 1110 */ 1558, 466, 1560, 1561, 462, 1207, 1117, 1573, 1636, 37, + /* 1120 */ 271, 454, 195, 194, 464, 54, 451, 16, 157, 1602, + /* 1130 */ 473, 1484, 468, 63, 463, 1697, 1483, 469, 1529, 279, + /* 1140 */ 1679, 474, 201, 210, 212, 475, 224, 1394, 61, 1557, + /* 1150 */ 483, 1366, 446, 1695, 226, 561, 74, 1558, 466, 1560, + /* 1160 */ 1561, 462, 219, 43, 232, 1621, 228, 230, 1523, 233, + /* 1170 */ 1618, 128, 1522, 1573, 294, 1519, 296, 1557, 297, 1086, + /* 1180 */ 464, 1087, 140, 301, 1517, 156, 303, 151, 305, 153, + /* 1190 */ 463, 304, 1516, 307, 1529, 1515, 309, 1500, 141, 312, + /* 1200 */ 313, 1573, 1065, 1064, 1494, 1493, 150, 318, 464, 319, + /* 1210 */ 1492, 1491, 241, 1558, 466, 1560, 1561, 462, 463, 1036, + /* 1220 */ 1468, 1467, 1529, 1466, 1465, 1464, 1463, 1462, 1461, 1557, + /* 1230 */ 1460, 1459, 1458, 1457, 1456, 1557, 108, 1452, 1451, 1450, + /* 1240 */ 125, 1558, 466, 1560, 1561, 462, 1455, 1454, 1453, 437, + /* 1250 */ 1449, 1448, 1447, 1573, 1446, 1445, 1444, 1038, 1443, 1573, + /* 1260 */ 464, 1324, 1508, 1502, 1490, 1481, 461, 1372, 894, 1323, + /* 1270 */ 463, 1321, 154, 1319, 1529, 1317, 463, 274, 361, 362, + /* 1280 */ 1529, 1315, 1304, 365, 1696, 366, 1557, 363, 1303, 1300, + /* 1290 */ 1374, 369, 246, 1558, 466, 1560, 1561, 462, 245, 1558, + /* 1300 */ 466, 1560, 1561, 462, 370, 76, 1594, 1002, 374, 367, + /* 1310 */ 1573, 1373, 373, 371, 1557, 1005, 926, 464, 925, 375, + /* 1320 */ 1313, 924, 161, 262, 923, 920, 1308, 463, 528, 919, + /* 1330 */ 530, 1529, 263, 399, 276, 1306, 264, 402, 1573, 404, + /* 1340 */ 1298, 406, 75, 1507, 46, 464, 1299, 1072, 1501, 246, + /* 1350 */ 1558, 466, 1560, 1561, 462, 463, 413, 414, 119, 1529, + /* 1360 */ 1489, 1557, 278, 1488, 1480, 13, 56, 181, 3, 35, + /* 1370 */ 186, 41, 1557, 14, 191, 21, 126, 246, 1558, 466, + /* 1380 */ 1560, 1561, 462, 1232, 38, 1573, 190, 20, 58, 11, + /* 1390 */ 1225, 1548, 464, 1204, 1254, 178, 1573, 57, 39, 1253, + /* 1400 */ 1203, 15, 463, 464, 1259, 272, 1529, 197, 1258, 1257, + /* 1410 */ 1557, 273, 183, 463, 135, 8, 17, 1529, 138, 1152, + /* 1420 */ 1136, 27, 40, 10, 234, 1558, 466, 1560, 1561, 462, + /* 1430 */ 1151, 18, 1479, 19, 1573, 240, 1558, 466, 1560, 1561, + /* 1440 */ 462, 464, 471, 205, 204, 211, 64, 1230, 207, 209, + /* 1450 */ 59, 463, 60, 1108, 42, 1529, 484, 987, 1557, 286, + /* 1460 */ 486, 488, 482, 1167, 1557, 1547, 213, 216, 984, 489, + /* 1470 */ 964, 981, 491, 242, 1558, 466, 1560, 1561, 462, 492, + /* 1480 */ 494, 975, 1573, 495, 497, 465, 973, 979, 1573, 464, + /* 1490 */ 498, 978, 999, 977, 504, 464, 65, 995, 976, 463, + /* 1500 */ 998, 66, 67, 1529, 992, 463, 892, 515, 933, 1529, + /* 1510 */ 517, 218, 908, 915, 914, 1557, 913, 912, 911, 910, + /* 1520 */ 930, 235, 1558, 466, 1560, 1561, 462, 243, 1558, 466, + /* 1530 */ 1560, 1561, 462, 909, 928, 905, 904, 903, 900, 1573, + /* 1540 */ 899, 898, 897, 1320, 539, 540, 464, 1318, 541, 543, + /* 1550 */ 544, 545, 1316, 547, 548, 549, 463, 551, 552, 553, + /* 1560 */ 1529, 1557, 1314, 1302, 555, 556, 1301, 1297, 559, 560, + /* 1570 */ 564, 1094, 1557, 227, 563, 1272, 1272, 1272, 236, 1558, + /* 1580 */ 466, 1560, 1561, 462, 1272, 1573, 1272, 1272, 1272, 1272, + /* 1590 */ 1272, 1272, 464, 1272, 1272, 1272, 1573, 1272, 1272, 1272, + /* 1600 */ 1272, 1272, 463, 464, 1272, 1272, 1529, 1272, 1272, 1272, + /* 1610 */ 1272, 1272, 1272, 463, 1272, 1272, 1272, 1529, 1272, 1557, + /* 1620 */ 1272, 1272, 1272, 1272, 244, 1558, 466, 1560, 1561, 462, + /* 1630 */ 1272, 1272, 1272, 1272, 1272, 237, 1558, 466, 1560, 1561, + /* 1640 */ 462, 1272, 1272, 1573, 1272, 1272, 1272, 1557, 1272, 1272, + /* 1650 */ 464, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1660 */ 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, + /* 1670 */ 1272, 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, + /* 1680 */ 1272, 1272, 1569, 1558, 466, 1560, 1561, 462, 463, 1272, + /* 1690 */ 1272, 1272, 1529, 1272, 1272, 1272, 1557, 1272, 1272, 1272, + /* 1700 */ 1272, 1272, 1272, 1272, 1272, 1557, 1272, 1272, 1272, 1272, + /* 1710 */ 1568, 1558, 466, 1560, 1561, 462, 1272, 1272, 1272, 1272, + /* 1720 */ 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, 1573, + /* 1730 */ 1272, 1272, 1272, 1272, 1272, 1272, 464, 463, 1272, 1272, + /* 1740 */ 1272, 1529, 1272, 1272, 1272, 1272, 463, 1272, 1272, 1272, + /* 1750 */ 1529, 1557, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1567, + /* 1760 */ 1558, 466, 1560, 1561, 462, 1272, 1272, 1272, 253, 1558, + /* 1770 */ 466, 1560, 1561, 462, 1272, 1573, 1272, 1272, 1272, 1557, + /* 1780 */ 1272, 1272, 464, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1790 */ 1272, 1272, 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, + /* 1800 */ 1272, 1272, 1272, 1573, 1272, 1272, 1272, 1272, 1557, 1272, + /* 1810 */ 464, 1272, 1272, 1272, 252, 1558, 466, 1560, 1561, 462, + /* 1820 */ 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, + /* 1830 */ 1272, 1272, 1573, 1272, 1272, 1272, 1557, 1272, 1272, 464, + /* 1840 */ 1272, 1272, 254, 1558, 466, 1560, 1561, 462, 1272, 463, + /* 1850 */ 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1860 */ 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, 1272, + /* 1870 */ 1272, 251, 1558, 466, 1560, 1561, 462, 463, 1272, 1272, + /* 1880 */ 1272, 1529, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1890 */ 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 239, + /* 1900 */ 1558, 466, 1560, 1561, 462, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 254, 241, 258, 257, 241, 254, 260, 279, 280, 219, - /* 10 */ 219, 260, 12, 13, 270, 271, 263, 213, 258, 228, - /* 20 */ 20, 258, 22, 294, 213, 12, 13, 14, 15, 16, - /* 30 */ 270, 271, 2, 270, 271, 244, 307, 20, 38, 249, - /* 40 */ 311, 237, 12, 13, 14, 15, 16, 294, 244, 20, - /* 50 */ 50, 12, 13, 14, 212, 219, 214, 57, 254, 20, - /* 60 */ 307, 22, 258, 4, 311, 12, 13, 263, 61, 258, - /* 70 */ 219, 20, 65, 20, 74, 22, 219, 38, 274, 275, - /* 80 */ 276, 277, 278, 216, 217, 228, 282, 283, 75, 50, - /* 90 */ 213, 38, 235, 237, 87, 244, 57, 97, 294, 263, - /* 100 */ 244, 244, 50, 50, 12, 13, 14, 15, 16, 109, - /* 110 */ 57, 307, 2, 74, 237, 311, 12, 13, 14, 15, - /* 120 */ 16, 244, 12, 13, 14, 15, 16, 74, 277, 222, - /* 130 */ 294, 254, 276, 226, 236, 258, 97, 286, 287, 288, - /* 140 */ 289, 20, 291, 307, 20, 247, 146, 311, 109, 246, - /* 150 */ 97, 274, 275, 276, 277, 278, 253, 254, 49, 282, - /* 160 */ 283, 284, 109, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 173, 174, 175, 14, 15, 16, 75, - /* 180 */ 303, 164, 165, 210, 20, 146, 21, 187, 0, 24, - /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 74, 146, - /* 200 */ 223, 224, 163, 164, 165, 166, 167, 168, 169, 170, - /* 210 */ 171, 172, 173, 174, 175, 163, 163, 164, 165, 166, - /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 175, 12, - /* 230 */ 13, 139, 71, 263, 213, 221, 263, 20, 187, 22, - /* 240 */ 52, 219, 54, 145, 213, 147, 58, 188, 234, 61, - /* 250 */ 228, 63, 64, 0, 66, 38, 242, 235, 237, 12, - /* 260 */ 13, 14, 15, 16, 294, 244, 244, 294, 12, 13, - /* 270 */ 14, 213, 22, 187, 57, 254, 20, 307, 22, 258, - /* 280 */ 307, 311, 12, 13, 311, 187, 136, 213, 38, 258, - /* 290 */ 20, 74, 22, 47, 38, 274, 275, 276, 277, 278, - /* 300 */ 208, 20, 49, 282, 283, 284, 219, 57, 38, 0, - /* 310 */ 38, 237, 21, 57, 97, 228, 258, 296, 244, 73, - /* 320 */ 1, 2, 76, 302, 303, 34, 109, 57, 254, 57, - /* 330 */ 74, 244, 258, 24, 25, 26, 27, 28, 29, 30, - /* 340 */ 31, 32, 192, 193, 74, 0, 229, 97, 274, 275, - /* 350 */ 276, 277, 278, 97, 237, 74, 282, 283, 20, 109, - /* 360 */ 22, 67, 245, 146, 49, 109, 21, 97, 207, 24, - /* 370 */ 25, 26, 27, 28, 29, 30, 31, 32, 40, 109, - /* 380 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 390 */ 173, 174, 175, 219, 75, 237, 146, 12, 13, 14, - /* 400 */ 15, 16, 146, 52, 187, 54, 248, 113, 114, 58, - /* 410 */ 213, 221, 61, 163, 63, 64, 146, 66, 244, 163, - /* 420 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - /* 430 */ 174, 175, 242, 163, 164, 165, 166, 167, 168, 169, - /* 440 */ 170, 171, 172, 173, 174, 175, 12, 13, 18, 3, - /* 450 */ 20, 277, 272, 272, 20, 258, 22, 27, 218, 244, - /* 460 */ 30, 287, 288, 289, 213, 291, 251, 163, 187, 39, - /* 470 */ 290, 290, 38, 12, 13, 14, 15, 16, 20, 239, - /* 480 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - /* 490 */ 98, 57, 100, 101, 102, 103, 104, 105, 4, 237, - /* 500 */ 196, 197, 198, 199, 200, 243, 237, 219, 74, 258, - /* 510 */ 248, 50, 219, 19, 219, 219, 228, 248, 213, 185, - /* 520 */ 186, 228, 237, 138, 228, 219, 57, 33, 243, 20, - /* 530 */ 36, 97, 244, 248, 228, 41, 75, 244, 20, 244, - /* 540 */ 244, 47, 112, 109, 83, 115, 116, 117, 118, 119, - /* 550 */ 244, 121, 122, 123, 124, 125, 126, 127, 128, 129, - /* 560 */ 130, 131, 0, 258, 18, 219, 225, 73, 227, 23, - /* 570 */ 76, 218, 277, 272, 228, 12, 13, 14, 15, 16, - /* 580 */ 146, 35, 287, 288, 289, 232, 291, 219, 43, 213, - /* 590 */ 244, 290, 239, 132, 48, 85, 228, 163, 164, 165, - /* 600 */ 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - /* 610 */ 219, 150, 244, 50, 52, 53, 54, 55, 56, 228, - /* 620 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 630 */ 68, 69, 70, 132, 258, 244, 19, 176, 177, 178, - /* 640 */ 179, 180, 181, 182, 183, 184, 83, 138, 0, 203, - /* 650 */ 33, 150, 229, 36, 213, 213, 138, 111, 229, 42, - /* 660 */ 237, 44, 45, 46, 47, 237, 237, 22, 245, 213, - /* 670 */ 213, 243, 223, 224, 245, 35, 248, 176, 14, 213, - /* 680 */ 237, 213, 71, 38, 20, 139, 140, 141, 245, 143, - /* 690 */ 73, 213, 238, 76, 148, 132, 142, 49, 238, 258, - /* 700 */ 258, 61, 156, 219, 158, 65, 160, 161, 162, 74, - /* 710 */ 213, 157, 228, 150, 258, 258, 0, 77, 213, 79, - /* 720 */ 80, 86, 82, 106, 258, 213, 258, 87, 244, 213, - /* 730 */ 213, 186, 213, 187, 230, 213, 258, 233, 0, 176, - /* 740 */ 177, 178, 179, 180, 181, 182, 183, 184, 38, 237, - /* 750 */ 0, 134, 36, 71, 137, 258, 244, 75, 238, 78, - /* 760 */ 22, 213, 81, 258, 78, 78, 254, 81, 81, 152, - /* 770 */ 258, 154, 22, 213, 258, 258, 78, 258, 0, 81, - /* 780 */ 258, 1, 2, 164, 165, 237, 274, 275, 276, 277, - /* 790 */ 278, 74, 244, 238, 282, 283, 284, 237, 266, 71, - /* 800 */ 22, 84, 254, 75, 244, 293, 258, 71, 71, 38, - /* 810 */ 238, 75, 75, 71, 254, 213, 205, 75, 258, 109, - /* 820 */ 238, 213, 274, 275, 276, 277, 278, 238, 214, 71, - /* 830 */ 282, 283, 284, 75, 274, 275, 276, 277, 278, 237, - /* 840 */ 314, 293, 282, 283, 284, 237, 244, 71, 226, 305, - /* 850 */ 71, 75, 244, 293, 75, 71, 254, 254, 33, 75, - /* 860 */ 258, 36, 254, 247, 71, 263, 258, 42, 75, 44, - /* 870 */ 45, 46, 47, 213, 254, 299, 274, 275, 276, 277, - /* 880 */ 109, 38, 274, 275, 276, 277, 278, 216, 71, 71, - /* 890 */ 282, 283, 75, 75, 273, 71, 294, 237, 73, 75, - /* 900 */ 57, 76, 292, 71, 244, 237, 71, 75, 71, 307, - /* 910 */ 75, 71, 75, 311, 254, 75, 20, 308, 258, 295, - /* 920 */ 213, 219, 36, 269, 223, 38, 144, 264, 219, 120, - /* 930 */ 219, 252, 132, 250, 274, 275, 276, 277, 250, 219, - /* 940 */ 20, 268, 20, 219, 237, 20, 262, 221, 244, 255, - /* 950 */ 221, 244, 221, 219, 221, 20, 215, 244, 133, 237, - /* 960 */ 135, 254, 137, 219, 237, 258, 153, 237, 244, 237, - /* 970 */ 223, 215, 312, 313, 268, 213, 237, 237, 218, 154, - /* 980 */ 237, 274, 275, 276, 277, 278, 237, 263, 237, 237, - /* 990 */ 283, 237, 267, 218, 20, 12, 13, 262, 195, 237, - /* 1000 */ 255, 277, 213, 244, 304, 22, 244, 259, 194, 304, - /* 1010 */ 213, 287, 288, 289, 57, 291, 254, 202, 294, 273, - /* 1020 */ 258, 38, 258, 261, 259, 258, 237, 258, 201, 244, - /* 1030 */ 189, 307, 190, 244, 237, 311, 274, 275, 276, 277, - /* 1040 */ 57, 244, 186, 254, 213, 20, 272, 258, 120, 204, - /* 1050 */ 261, 254, 213, 298, 301, 258, 209, 213, 285, 206, - /* 1060 */ 297, 300, 74, 274, 275, 276, 277, 310, 237, 281, - /* 1070 */ 259, 274, 275, 276, 277, 244, 237, 309, 258, 258, - /* 1080 */ 97, 237, 259, 244, 258, 254, 213, 315, 244, 258, - /* 1090 */ 135, 255, 109, 254, 256, 244, 218, 258, 254, 233, - /* 1100 */ 261, 218, 258, 306, 244, 274, 275, 276, 277, 74, - /* 1110 */ 237, 213, 240, 274, 275, 276, 277, 244, 274, 275, - /* 1120 */ 276, 277, 223, 219, 227, 218, 215, 254, 265, 146, - /* 1130 */ 220, 258, 231, 231, 261, 237, 0, 211, 0, 64, - /* 1140 */ 0, 38, 244, 159, 313, 38, 163, 274, 275, 276, - /* 1150 */ 277, 38, 254, 38, 159, 0, 258, 213, 38, 159, - /* 1160 */ 38, 0, 38, 0, 38, 213, 0, 74, 150, 149, - /* 1170 */ 109, 0, 274, 275, 276, 277, 146, 0, 53, 0, - /* 1180 */ 142, 237, 0, 86, 0, 0, 0, 0, 244, 237, - /* 1190 */ 0, 0, 0, 213, 120, 0, 244, 0, 254, 213, - /* 1200 */ 22, 0, 258, 0, 0, 0, 254, 0, 0, 0, - /* 1210 */ 258, 0, 0, 0, 0, 0, 0, 237, 274, 275, - /* 1220 */ 276, 277, 0, 237, 244, 0, 274, 275, 276, 277, - /* 1230 */ 244, 0, 0, 0, 254, 0, 0, 0, 258, 0, - /* 1240 */ 254, 43, 0, 0, 258, 213, 36, 51, 0, 43, - /* 1250 */ 213, 0, 0, 36, 274, 275, 276, 277, 213, 38, - /* 1260 */ 274, 275, 276, 277, 38, 38, 43, 43, 0, 237, - /* 1270 */ 36, 43, 0, 0, 237, 0, 244, 36, 38, 0, - /* 1280 */ 81, 244, 237, 38, 22, 83, 254, 0, 38, 244, - /* 1290 */ 258, 254, 38, 38, 38, 258, 38, 38, 0, 254, - /* 1300 */ 213, 71, 22, 258, 0, 22, 274, 275, 276, 277, - /* 1310 */ 39, 274, 275, 276, 277, 71, 0, 22, 0, 274, - /* 1320 */ 275, 276, 277, 38, 237, 213, 0, 22, 22, 20, - /* 1330 */ 0, 244, 38, 0, 213, 155, 22, 0, 0, 151, - /* 1340 */ 0, 254, 43, 74, 191, 258, 86, 71, 71, 237, - /* 1350 */ 191, 86, 71, 135, 185, 191, 244, 138, 237, 75, - /* 1360 */ 74, 274, 275, 276, 277, 244, 254, 138, 75, 4, - /* 1370 */ 258, 74, 71, 38, 74, 254, 138, 75, 75, 258, - /* 1380 */ 133, 74, 71, 75, 71, 75, 274, 275, 276, 277, - /* 1390 */ 71, 38, 38, 38, 38, 274, 275, 276, 277, 38, - /* 1400 */ 2, 86, 213, 86, 75, 74, 74, 213, 0, 75, - /* 1410 */ 74, 43, 163, 213, 75, 133, 75, 74, 74, 74, - /* 1420 */ 74, 22, 74, 38, 136, 38, 237, 0, 86, 38, - /* 1430 */ 38, 237, 0, 244, 84, 86, 85, 237, 244, 75, - /* 1440 */ 74, 38, 75, 254, 244, 74, 74, 258, 254, 75, - /* 1450 */ 75, 74, 258, 75, 254, 38, 74, 99, 258, 213, - /* 1460 */ 22, 99, 99, 274, 275, 276, 277, 87, 274, 275, - /* 1470 */ 276, 277, 99, 38, 274, 275, 276, 277, 74, 109, - /* 1480 */ 74, 74, 38, 237, 22, 51, 50, 57, 61, 71, - /* 1490 */ 244, 72, 65, 61, 38, 38, 38, 65, 38, 38, - /* 1500 */ 254, 38, 38, 22, 258, 57, 38, 38, 38, 38, - /* 1510 */ 38, 38, 38, 38, 87, 0, 38, 0, 36, 87, - /* 1520 */ 274, 275, 276, 277, 38, 36, 43, 43, 0, 38, - /* 1530 */ 36, 43, 0, 106, 107, 108, 38, 110, 106, 107, - /* 1540 */ 108, 36, 110, 43, 0, 38, 37, 0, 0, 22, - /* 1550 */ 21, 316, 22, 22, 21, 20, 316, 316, 316, 316, - /* 1560 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1570 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1580 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1590 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1600 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1610 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1620 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1630 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1640 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1650 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1660 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1670 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1680 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1690 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1700 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1710 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1720 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1730 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1740 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1750 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1760 */ 316, 316, 316, 316, 316, 316, + /* 0 */ 250, 267, 250, 246, 222, 272, 295, 296, 230, 221, + /* 10 */ 253, 223, 12, 13, 228, 281, 282, 267, 255, 267, + /* 20 */ 20, 243, 22, 237, 20, 262, 263, 227, 246, 251, + /* 30 */ 244, 281, 282, 281, 282, 253, 246, 272, 38, 253, + /* 40 */ 20, 241, 252, 310, 287, 263, 0, 257, 248, 267, + /* 50 */ 50, 12, 13, 14, 222, 246, 323, 57, 49, 20, + /* 60 */ 327, 22, 228, 254, 47, 20, 310, 285, 286, 287, + /* 70 */ 288, 289, 290, 20, 74, 310, 294, 38, 246, 323, + /* 80 */ 298, 299, 300, 327, 228, 253, 38, 253, 323, 50, + /* 90 */ 73, 253, 327, 76, 312, 263, 57, 97, 260, 267, + /* 100 */ 318, 319, 12, 13, 272, 57, 272, 61, 238, 109, + /* 110 */ 20, 65, 22, 74, 258, 20, 246, 285, 286, 287, + /* 120 */ 288, 289, 290, 289, 254, 228, 294, 74, 38, 263, + /* 130 */ 298, 299, 266, 87, 237, 269, 97, 303, 304, 305, + /* 140 */ 50, 307, 310, 20, 310, 22, 146, 57, 109, 222, + /* 150 */ 253, 132, 106, 107, 108, 323, 110, 323, 138, 327, + /* 160 */ 222, 327, 231, 40, 74, 49, 235, 167, 168, 150, + /* 170 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 180 */ 180, 181, 182, 183, 246, 146, 52, 97, 54, 155, + /* 190 */ 156, 253, 58, 159, 267, 61, 196, 63, 64, 109, + /* 200 */ 66, 263, 222, 184, 20, 267, 167, 168, 270, 170, + /* 210 */ 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + /* 220 */ 181, 182, 183, 285, 286, 287, 288, 289, 290, 12, + /* 230 */ 13, 12, 13, 14, 15, 16, 146, 20, 230, 22, + /* 240 */ 238, 196, 12, 13, 14, 15, 16, 267, 246, 196, + /* 250 */ 12, 13, 14, 15, 16, 38, 254, 167, 168, 251, + /* 260 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 270 */ 180, 181, 182, 183, 57, 12, 13, 14, 20, 228, + /* 280 */ 50, 0, 145, 20, 147, 22, 0, 142, 237, 21, + /* 290 */ 74, 74, 24, 25, 26, 27, 28, 29, 30, 31, + /* 300 */ 32, 38, 86, 228, 253, 75, 161, 12, 13, 14, + /* 310 */ 15, 16, 237, 83, 97, 0, 136, 61, 246, 244, + /* 320 */ 57, 65, 225, 226, 252, 196, 109, 167, 253, 257, + /* 330 */ 49, 35, 74, 196, 14, 15, 16, 74, 52, 53, + /* 340 */ 54, 55, 56, 87, 58, 59, 60, 61, 62, 63, + /* 350 */ 64, 65, 66, 67, 68, 69, 70, 61, 1, 2, + /* 360 */ 97, 65, 132, 146, 49, 205, 206, 207, 208, 209, + /* 370 */ 75, 239, 109, 77, 242, 79, 80, 139, 82, 67, + /* 380 */ 150, 201, 202, 87, 167, 168, 20, 170, 171, 172, + /* 390 */ 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + /* 400 */ 183, 219, 12, 13, 228, 0, 232, 233, 222, 146, + /* 410 */ 20, 22, 22, 196, 184, 185, 186, 187, 188, 189, + /* 420 */ 190, 191, 192, 193, 20, 113, 114, 38, 38, 253, + /* 430 */ 167, 168, 75, 170, 171, 172, 173, 174, 175, 176, + /* 440 */ 177, 178, 179, 180, 181, 182, 183, 57, 12, 13, + /* 450 */ 12, 13, 228, 267, 272, 217, 20, 52, 22, 54, + /* 460 */ 22, 237, 85, 58, 74, 289, 61, 0, 63, 64, + /* 470 */ 227, 66, 3, 228, 38, 246, 38, 253, 302, 303, + /* 480 */ 304, 305, 237, 307, 71, 245, 257, 97, 75, 22, + /* 490 */ 2, 248, 310, 57, 222, 57, 256, 228, 253, 109, + /* 500 */ 12, 13, 14, 15, 16, 323, 237, 232, 233, 327, + /* 510 */ 74, 88, 89, 90, 91, 92, 93, 94, 95, 96, + /* 520 */ 97, 98, 253, 100, 101, 102, 103, 104, 105, 18, + /* 530 */ 222, 20, 238, 97, 228, 97, 146, 71, 27, 267, + /* 540 */ 246, 30, 138, 237, 234, 109, 236, 109, 254, 222, + /* 550 */ 39, 12, 13, 14, 15, 16, 222, 167, 168, 253, + /* 560 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 570 */ 180, 181, 182, 183, 71, 267, 222, 228, 232, 233, + /* 580 */ 222, 246, 146, 43, 146, 2, 237, 232, 233, 50, + /* 590 */ 194, 195, 257, 20, 267, 12, 13, 14, 15, 16, + /* 600 */ 57, 267, 253, 167, 168, 167, 170, 171, 172, 173, + /* 610 */ 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + /* 620 */ 222, 267, 83, 112, 222, 267, 115, 116, 117, 118, + /* 630 */ 119, 275, 121, 122, 123, 124, 125, 126, 127, 128, + /* 640 */ 129, 130, 131, 283, 246, 18, 222, 4, 228, 228, + /* 650 */ 23, 253, 12, 13, 14, 15, 16, 237, 237, 283, + /* 660 */ 71, 263, 35, 0, 75, 267, 306, 283, 228, 267, + /* 670 */ 228, 132, 0, 253, 253, 48, 0, 237, 228, 237, + /* 680 */ 214, 212, 306, 285, 286, 287, 288, 289, 290, 150, + /* 690 */ 306, 267, 294, 253, 50, 253, 298, 299, 300, 36, + /* 700 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 247, + /* 710 */ 12, 13, 14, 15, 16, 75, 222, 319, 0, 216, + /* 720 */ 222, 21, 272, 184, 185, 186, 187, 188, 189, 190, + /* 730 */ 191, 192, 193, 61, 34, 195, 0, 65, 111, 21, + /* 740 */ 222, 222, 24, 25, 26, 27, 28, 29, 30, 31, + /* 750 */ 32, 246, 222, 222, 0, 222, 222, 252, 22, 87, + /* 760 */ 310, 267, 257, 263, 246, 267, 139, 140, 141, 269, + /* 770 */ 143, 253, 247, 323, 222, 148, 22, 327, 106, 107, + /* 780 */ 108, 263, 110, 222, 71, 267, 267, 160, 75, 162, + /* 790 */ 222, 164, 165, 166, 22, 247, 14, 267, 267, 228, + /* 800 */ 267, 267, 20, 285, 286, 287, 288, 289, 290, 14, + /* 810 */ 38, 167, 294, 38, 246, 20, 298, 299, 300, 267, + /* 820 */ 235, 253, 78, 196, 253, 81, 38, 309, 267, 57, + /* 830 */ 78, 263, 57, 81, 78, 267, 138, 81, 78, 222, + /* 840 */ 197, 81, 157, 158, 247, 71, 247, 1, 2, 75, + /* 850 */ 181, 182, 247, 285, 286, 287, 288, 289, 290, 247, + /* 860 */ 289, 71, 294, 246, 38, 75, 298, 299, 300, 97, + /* 870 */ 253, 223, 330, 19, 303, 304, 305, 309, 307, 71, + /* 880 */ 263, 109, 71, 75, 267, 321, 75, 33, 222, 71, + /* 890 */ 36, 71, 256, 75, 279, 75, 42, 109, 44, 45, + /* 900 */ 46, 47, 285, 286, 287, 288, 289, 290, 315, 71, + /* 910 */ 71, 294, 246, 75, 75, 298, 299, 300, 146, 253, + /* 920 */ 71, 228, 225, 284, 75, 246, 309, 73, 308, 263, + /* 930 */ 76, 324, 4, 267, 311, 109, 20, 71, 272, 167, + /* 940 */ 168, 75, 228, 36, 280, 144, 253, 19, 38, 222, + /* 950 */ 273, 285, 286, 287, 288, 289, 290, 232, 71, 71, + /* 960 */ 106, 33, 75, 75, 36, 228, 228, 71, 71, 41, + /* 970 */ 120, 75, 75, 246, 74, 47, 310, 261, 259, 132, + /* 980 */ 253, 259, 289, 228, 84, 20, 277, 222, 134, 323, + /* 990 */ 263, 137, 230, 327, 267, 263, 303, 304, 305, 20, + /* 1000 */ 307, 73, 271, 230, 76, 20, 152, 264, 154, 230, + /* 1010 */ 253, 246, 285, 286, 287, 288, 289, 290, 253, 230, + /* 1020 */ 228, 294, 20, 230, 224, 298, 299, 246, 263, 246, + /* 1030 */ 246, 246, 267, 246, 228, 57, 224, 222, 267, 153, + /* 1040 */ 246, 277, 246, 246, 246, 246, 222, 271, 246, 227, + /* 1050 */ 285, 286, 287, 288, 289, 290, 276, 227, 253, 294, + /* 1060 */ 227, 246, 20, 298, 299, 204, 263, 320, 253, 320, + /* 1070 */ 246, 264, 203, 211, 210, 284, 267, 253, 263, 199, + /* 1080 */ 317, 268, 267, 316, 268, 33, 267, 263, 36, 198, + /* 1090 */ 267, 267, 314, 222, 42, 253, 44, 45, 46, 47, + /* 1100 */ 285, 286, 287, 288, 289, 290, 291, 292, 293, 285, + /* 1110 */ 286, 287, 288, 289, 290, 195, 20, 246, 283, 120, + /* 1120 */ 218, 215, 301, 313, 253, 73, 213, 74, 76, 297, + /* 1130 */ 135, 268, 267, 74, 263, 331, 268, 267, 267, 267, + /* 1140 */ 326, 265, 325, 253, 227, 264, 242, 253, 227, 222, + /* 1150 */ 249, 236, 328, 329, 228, 224, 285, 286, 287, 288, + /* 1160 */ 289, 290, 227, 274, 240, 294, 229, 220, 0, 240, + /* 1170 */ 299, 278, 0, 246, 64, 0, 38, 222, 163, 38, + /* 1180 */ 253, 38, 38, 163, 0, 133, 38, 135, 163, 137, + /* 1190 */ 263, 38, 0, 38, 267, 0, 38, 0, 74, 150, + /* 1200 */ 149, 246, 109, 146, 0, 0, 154, 53, 253, 142, + /* 1210 */ 0, 0, 285, 286, 287, 288, 289, 290, 263, 86, + /* 1220 */ 0, 0, 267, 0, 0, 0, 0, 0, 0, 222, + /* 1230 */ 0, 0, 0, 0, 0, 222, 120, 0, 0, 0, + /* 1240 */ 285, 286, 287, 288, 289, 290, 0, 0, 0, 322, + /* 1250 */ 0, 0, 0, 246, 0, 0, 0, 22, 0, 246, + /* 1260 */ 253, 0, 0, 0, 0, 0, 253, 0, 51, 0, + /* 1270 */ 263, 0, 43, 0, 267, 0, 263, 270, 38, 36, + /* 1280 */ 267, 0, 0, 38, 329, 36, 222, 43, 0, 0, + /* 1290 */ 0, 38, 285, 286, 287, 288, 289, 290, 285, 286, + /* 1300 */ 287, 288, 289, 290, 36, 83, 293, 22, 36, 43, + /* 1310 */ 246, 0, 38, 43, 222, 38, 38, 253, 38, 43, + /* 1320 */ 0, 38, 81, 22, 38, 38, 0, 263, 71, 38, + /* 1330 */ 71, 267, 22, 39, 270, 0, 22, 38, 246, 22, + /* 1340 */ 0, 22, 20, 0, 138, 253, 0, 38, 0, 285, + /* 1350 */ 286, 287, 288, 289, 290, 263, 22, 138, 151, 267, + /* 1360 */ 0, 222, 270, 0, 0, 200, 74, 43, 71, 71, + /* 1370 */ 75, 71, 222, 200, 71, 71, 74, 285, 286, 287, + /* 1380 */ 288, 289, 290, 75, 194, 246, 74, 74, 4, 200, + /* 1390 */ 75, 86, 253, 75, 38, 135, 246, 74, 71, 38, + /* 1400 */ 75, 71, 263, 253, 75, 38, 267, 86, 38, 38, + /* 1410 */ 222, 38, 133, 263, 86, 2, 71, 267, 86, 75, + /* 1420 */ 22, 74, 138, 74, 285, 286, 287, 288, 289, 290, + /* 1430 */ 75, 74, 0, 74, 246, 285, 286, 287, 288, 289, + /* 1440 */ 290, 253, 136, 75, 86, 43, 84, 75, 74, 74, + /* 1450 */ 74, 263, 74, 22, 74, 267, 38, 75, 222, 38, + /* 1460 */ 74, 38, 85, 167, 222, 86, 133, 86, 75, 74, + /* 1470 */ 22, 75, 38, 285, 286, 287, 288, 289, 290, 74, + /* 1480 */ 38, 75, 246, 74, 38, 169, 75, 99, 246, 253, + /* 1490 */ 74, 99, 38, 99, 87, 253, 74, 38, 99, 263, + /* 1500 */ 109, 74, 74, 267, 22, 263, 51, 50, 57, 267, + /* 1510 */ 72, 71, 22, 38, 38, 222, 38, 38, 38, 38, + /* 1520 */ 57, 285, 286, 287, 288, 289, 290, 285, 286, 287, + /* 1530 */ 288, 289, 290, 38, 38, 38, 38, 38, 38, 246, + /* 1540 */ 38, 38, 38, 0, 38, 36, 253, 0, 43, 38, + /* 1550 */ 36, 43, 0, 38, 36, 43, 263, 38, 36, 43, + /* 1560 */ 267, 222, 0, 0, 38, 37, 0, 0, 22, 21, + /* 1570 */ 20, 22, 222, 22, 21, 332, 332, 332, 285, 286, + /* 1580 */ 287, 288, 289, 290, 332, 246, 332, 332, 332, 332, + /* 1590 */ 332, 332, 253, 332, 332, 332, 246, 332, 332, 332, + /* 1600 */ 332, 332, 263, 253, 332, 332, 267, 332, 332, 332, + /* 1610 */ 332, 332, 332, 263, 332, 332, 332, 267, 332, 222, + /* 1620 */ 332, 332, 332, 332, 285, 286, 287, 288, 289, 290, + /* 1630 */ 332, 332, 332, 332, 332, 285, 286, 287, 288, 289, + /* 1640 */ 290, 332, 332, 246, 332, 332, 332, 222, 332, 332, + /* 1650 */ 253, 332, 332, 332, 332, 332, 332, 332, 332, 332, + /* 1660 */ 263, 332, 332, 332, 267, 332, 332, 332, 332, 332, + /* 1670 */ 332, 246, 332, 332, 332, 332, 332, 332, 253, 332, + /* 1680 */ 332, 332, 285, 286, 287, 288, 289, 290, 263, 332, + /* 1690 */ 332, 332, 267, 332, 332, 332, 222, 332, 332, 332, + /* 1700 */ 332, 332, 332, 332, 332, 222, 332, 332, 332, 332, + /* 1710 */ 285, 286, 287, 288, 289, 290, 332, 332, 332, 332, + /* 1720 */ 246, 332, 332, 332, 332, 332, 332, 253, 332, 246, + /* 1730 */ 332, 332, 332, 332, 332, 332, 253, 263, 332, 332, + /* 1740 */ 332, 267, 332, 332, 332, 332, 263, 332, 332, 332, + /* 1750 */ 267, 222, 332, 332, 332, 332, 332, 332, 332, 285, + /* 1760 */ 286, 287, 288, 289, 290, 332, 332, 332, 285, 286, + /* 1770 */ 287, 288, 289, 290, 332, 246, 332, 332, 332, 222, + /* 1780 */ 332, 332, 253, 332, 332, 332, 332, 332, 332, 332, + /* 1790 */ 332, 332, 263, 332, 332, 332, 267, 332, 332, 332, + /* 1800 */ 332, 332, 332, 246, 332, 332, 332, 332, 222, 332, + /* 1810 */ 253, 332, 332, 332, 285, 286, 287, 288, 289, 290, + /* 1820 */ 263, 332, 332, 332, 267, 332, 332, 332, 332, 332, + /* 1830 */ 332, 332, 246, 332, 332, 332, 222, 332, 332, 253, + /* 1840 */ 332, 332, 285, 286, 287, 288, 289, 290, 332, 263, + /* 1850 */ 332, 332, 332, 267, 332, 332, 332, 332, 332, 332, + /* 1860 */ 246, 332, 332, 332, 332, 332, 332, 253, 332, 332, + /* 1870 */ 332, 285, 286, 287, 288, 289, 290, 263, 332, 332, + /* 1880 */ 332, 267, 332, 332, 332, 332, 332, 332, 332, 332, + /* 1890 */ 332, 332, 332, 332, 332, 332, 332, 332, 332, 285, + /* 1900 */ 286, 287, 288, 289, 290, }; -#define YY_SHIFT_COUNT (549) +#define YY_SHIFT_COUNT (565) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1548) +#define YY_SHIFT_MAX (1567) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 546, 0, 39, 53, 53, 53, 53, 217, 53, 53, - /* 10 */ 270, 434, 281, 256, 270, 270, 270, 270, 270, 270, - /* 20 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 30 */ 270, 270, 270, 270, 270, 124, 124, 124, 51, 983, - /* 40 */ 983, 98, 29, 29, 86, 983, 17, 17, 29, 29, - /* 50 */ 29, 29, 29, 29, 109, 121, 164, 86, 121, 29, - /* 60 */ 29, 121, 29, 121, 121, 121, 29, 315, 430, 461, - /* 70 */ 563, 563, 165, 640, 250, 351, 250, 250, 250, 250, - /* 80 */ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - /* 90 */ 250, 250, 250, 250, 250, 17, 338, 253, 272, 509, - /* 100 */ 509, 509, 648, 272, 458, 121, 121, 121, 510, 469, - /* 110 */ 392, 392, 392, 392, 392, 392, 392, 617, 345, 188, - /* 120 */ 92, 304, 17, 7, 17, 150, 645, 518, 334, 545, - /* 130 */ 334, 664, 446, 59, 896, 886, 887, 782, 896, 896, - /* 140 */ 809, 800, 800, 896, 920, 922, 109, 458, 925, 109, - /* 150 */ 109, 896, 109, 935, 121, 121, 121, 121, 121, 121, - /* 160 */ 121, 121, 121, 121, 121, 887, 896, 935, 458, 920, - /* 170 */ 813, 922, 315, 458, 925, 315, 974, 803, 814, 957, - /* 180 */ 803, 814, 957, 957, 815, 827, 842, 841, 856, 458, - /* 190 */ 1025, 928, 847, 853, 845, 988, 121, 814, 957, 957, - /* 200 */ 814, 957, 955, 458, 925, 315, 510, 315, 458, 1035, - /* 210 */ 887, 469, 896, 315, 935, 1556, 1556, 1556, 1556, 1556, - /* 220 */ 562, 825, 309, 494, 1427, 1432, 13, 30, 110, 104, - /* 230 */ 385, 247, 247, 247, 247, 247, 247, 247, 246, 294, - /* 240 */ 162, 319, 501, 162, 162, 162, 716, 554, 682, 681, - /* 250 */ 686, 687, 698, 738, 750, 778, 291, 728, 736, 737, - /* 260 */ 780, 619, 611, 161, 742, 52, 758, 635, 776, 779, - /* 270 */ 784, 793, 817, 710, 771, 818, 824, 832, 835, 837, - /* 280 */ 840, 717, 843, 1136, 1138, 1075, 1140, 1103, 984, 1107, - /* 290 */ 1113, 1115, 995, 1155, 1120, 1122, 1000, 1161, 1124, 1163, - /* 300 */ 1126, 1166, 1093, 1018, 1020, 1061, 1030, 1171, 1177, 1125, - /* 310 */ 1038, 1179, 1182, 1097, 1184, 1185, 1186, 1187, 1190, 1191, - /* 320 */ 1192, 1197, 1203, 1204, 1205, 1207, 1208, 1209, 1211, 1212, - /* 330 */ 1074, 1195, 1213, 1214, 1215, 1216, 1222, 1178, 1201, 1225, - /* 340 */ 1231, 1232, 1233, 1235, 1236, 1237, 1239, 1198, 1242, 1196, - /* 350 */ 1243, 1248, 1221, 1210, 1206, 1251, 1226, 1217, 1223, 1252, - /* 360 */ 1227, 1234, 1224, 1268, 1240, 1241, 1228, 1272, 1273, 1275, - /* 370 */ 1279, 1202, 1199, 1245, 1230, 1262, 1287, 1250, 1254, 1255, - /* 380 */ 1256, 1244, 1230, 1258, 1259, 1298, 1280, 1304, 1283, 1271, - /* 390 */ 1316, 1295, 1285, 1318, 1305, 1326, 1306, 1309, 1330, 1219, - /* 400 */ 1180, 1294, 1333, 1188, 1314, 1229, 1218, 1337, 1338, 1238, - /* 410 */ 1340, 1269, 1299, 1247, 1276, 1277, 1153, 1284, 1281, 1293, - /* 420 */ 1286, 1297, 1300, 1302, 1301, 1260, 1307, 1311, 1159, 1303, - /* 430 */ 1308, 1265, 1169, 1313, 1315, 1310, 1319, 1164, 1365, 1335, - /* 440 */ 1353, 1354, 1355, 1356, 1361, 1398, 1249, 1317, 1329, 1331, - /* 450 */ 1334, 1332, 1336, 1339, 1341, 1343, 1344, 1288, 1345, 1408, - /* 460 */ 1368, 1282, 1346, 1350, 1342, 1349, 1399, 1348, 1351, 1364, - /* 470 */ 1385, 1387, 1366, 1367, 1391, 1371, 1374, 1392, 1372, 1375, - /* 480 */ 1403, 1377, 1378, 1417, 1382, 1358, 1362, 1363, 1373, 1438, - /* 490 */ 1380, 1404, 1435, 1370, 1406, 1407, 1444, 1230, 1462, 1434, - /* 500 */ 1436, 1430, 1419, 1418, 1456, 1457, 1458, 1460, 1461, 1463, - /* 510 */ 1464, 1481, 1448, 1244, 1468, 1230, 1469, 1470, 1471, 1472, - /* 520 */ 1473, 1474, 1475, 1515, 1478, 1482, 1483, 1517, 1486, 1489, - /* 530 */ 1484, 1528, 1491, 1494, 1488, 1532, 1498, 1505, 1500, 1544, - /* 540 */ 1507, 1509, 1547, 1548, 1527, 1529, 1530, 1531, 1533, 1535, + /* 0 */ 627, 0, 39, 90, 90, 90, 90, 217, 90, 90, + /* 10 */ 263, 390, 436, 390, 390, 390, 390, 390, 390, 390, + /* 20 */ 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, + /* 30 */ 390, 390, 390, 390, 390, 390, 53, 258, 258, 258, + /* 40 */ 45, 438, 438, 137, 4, 4, 129, 438, 4, 4, + /* 50 */ 4, 4, 4, 4, 9, 4, 95, 184, 129, 366, + /* 60 */ 95, 4, 4, 95, 4, 95, 366, 95, 95, 4, + /* 70 */ 116, 511, 230, 539, 539, 268, 772, 296, 772, 772, + /* 80 */ 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, + /* 90 */ 772, 772, 772, 772, 772, 772, 772, 134, 123, 281, + /* 100 */ 48, 48, 20, 20, 20, 315, 48, 48, 573, 366, + /* 110 */ 95, 95, 95, 377, 543, 423, 423, 423, 423, 423, + /* 120 */ 423, 423, 854, 718, 405, 238, 160, 256, 34, 180, + /* 130 */ 389, 404, 396, 540, 396, 782, 469, 643, 795, 916, + /* 140 */ 907, 910, 801, 916, 916, 850, 847, 847, 916, 965, + /* 150 */ 9, 366, 979, 9, 573, 985, 9, 9, 916, 9, + /* 160 */ 1002, 95, 95, 95, 95, 95, 95, 95, 95, 95, + /* 170 */ 95, 95, 916, 1002, 978, 965, 116, 886, 366, 979, + /* 180 */ 116, 573, 985, 116, 1042, 861, 869, 978, 861, 869, + /* 190 */ 978, 978, 862, 864, 880, 891, 920, 573, 1096, 999, + /* 200 */ 902, 906, 913, 1053, 95, 869, 978, 978, 869, 978, + /* 210 */ 995, 573, 985, 116, 377, 116, 573, 1059, 543, 916, + /* 220 */ 116, 1002, 1905, 1905, 1905, 1905, 1905, 1905, 286, 1052, + /* 230 */ 676, 928, 46, 672, 295, 488, 583, 698, 640, 219, + /* 240 */ 219, 219, 219, 219, 219, 219, 219, 17, 312, 357, + /* 250 */ 19, 320, 320, 320, 320, 663, 145, 413, 744, 752, + /* 260 */ 756, 760, 467, 736, 754, 700, 685, 589, 713, 774, + /* 270 */ 846, 669, 466, 503, 790, 644, 808, 216, 811, 818, + /* 280 */ 820, 838, 839, 788, 826, 849, 866, 887, 888, 896, + /* 290 */ 897, 900, 775, 1168, 1172, 1110, 1175, 1138, 1015, 1141, + /* 300 */ 1143, 1144, 1020, 1184, 1148, 1153, 1025, 1192, 1155, 1195, + /* 310 */ 1158, 1197, 1124, 1049, 1051, 1093, 1057, 1204, 1205, 1154, + /* 320 */ 1067, 1210, 1211, 1133, 1220, 1221, 1223, 1224, 1225, 1226, + /* 330 */ 1227, 1228, 1230, 1231, 1232, 1233, 1234, 1246, 1247, 1248, + /* 340 */ 1116, 1237, 1238, 1239, 1250, 1251, 1252, 1235, 1254, 1255, + /* 350 */ 1256, 1258, 1261, 1262, 1263, 1264, 1265, 1229, 1267, 1217, + /* 360 */ 1269, 1271, 1240, 1243, 1244, 1273, 1245, 1249, 1266, 1275, + /* 370 */ 1253, 1268, 1270, 1281, 1274, 1272, 1276, 1282, 1288, 1289, + /* 380 */ 1290, 1222, 1241, 1277, 1257, 1259, 1285, 1311, 1278, 1280, + /* 390 */ 1283, 1286, 1257, 1259, 1287, 1291, 1320, 1301, 1326, 1310, + /* 400 */ 1294, 1335, 1314, 1299, 1346, 1317, 1340, 1319, 1322, 1343, + /* 410 */ 1206, 1309, 1348, 1207, 1334, 1219, 1260, 1360, 1363, 1284, + /* 420 */ 1364, 1292, 1324, 1279, 1297, 1298, 1165, 1295, 1300, 1308, + /* 430 */ 1302, 1312, 1313, 1315, 1303, 1305, 1323, 1304, 1173, 1318, + /* 440 */ 1325, 1321, 1190, 1327, 1328, 1329, 1330, 1189, 1384, 1356, + /* 450 */ 1361, 1367, 1370, 1371, 1373, 1413, 1296, 1345, 1344, 1347, + /* 460 */ 1355, 1332, 1349, 1357, 1358, 1398, 1316, 1359, 1368, 1372, + /* 470 */ 1374, 1375, 1306, 1376, 1432, 1402, 1333, 1378, 1362, 1379, + /* 480 */ 1381, 1431, 1380, 1377, 1382, 1418, 1421, 1386, 1393, 1423, + /* 490 */ 1395, 1396, 1434, 1405, 1406, 1442, 1409, 1411, 1446, 1416, + /* 500 */ 1388, 1392, 1394, 1399, 1448, 1407, 1422, 1454, 1391, 1427, + /* 510 */ 1428, 1459, 1257, 1259, 1482, 1455, 1457, 1451, 1438, 1440, + /* 520 */ 1475, 1476, 1478, 1479, 1480, 1481, 1495, 1490, 1463, 1257, + /* 530 */ 1496, 1259, 1497, 1498, 1499, 1500, 1502, 1503, 1504, 1543, + /* 540 */ 1506, 1509, 1505, 1547, 1511, 1514, 1508, 1552, 1515, 1518, + /* 550 */ 1512, 1562, 1519, 1522, 1516, 1563, 1526, 1528, 1566, 1567, + /* 560 */ 1546, 1548, 1549, 1551, 1553, 1550, }; -#define YY_REDUCE_COUNT (219) -#define YY_REDUCE_MIN (-272) -#define YY_REDUCE_MAX (1246) +#define YY_REDUCE_COUNT (227) +#define YY_REDUCE_MIN (-289) +#define YY_REDUCE_MAX (1614) static const short yy_reduce_ofst[] = { - /* 0 */ -27, -196, 21, -123, 512, 548, 560, 602, 74, 608, - /* 10 */ 660, 707, 724, 762, 789, 797, 831, 839, 873, 844, - /* 20 */ 898, 944, 952, 980, 986, 1032, 1037, 1045, 1087, 1112, - /* 30 */ 1121, 1189, 1194, 1200, 1246, -149, 174, 295, -164, -240, - /* 40 */ -237, -247, -143, 22, -30, -256, -254, -97, -209, 87, - /* 50 */ 288, 293, 296, 306, 14, 262, -144, -271, 117, 346, - /* 60 */ 368, 285, 391, 423, 428, 429, 484, 353, -210, -272, - /* 70 */ -272, -272, -158, -102, -189, -93, 31, 58, 197, 251, - /* 80 */ 305, 376, 441, 442, 456, 457, 466, 468, 478, 497, - /* 90 */ 505, 516, 517, 519, 522, -249, -133, 190, -23, 180, - /* 100 */ 181, 301, 240, 449, 215, 443, 158, 269, 504, 341, - /* 110 */ 454, 460, 520, 555, 572, 582, 589, 532, 614, 622, - /* 120 */ 526, 544, 603, 616, 620, 576, 671, 621, 610, 610, - /* 130 */ 610, 668, 609, 624, 702, 654, 701, 663, 709, 711, - /* 140 */ 679, 683, 688, 720, 673, 684, 726, 704, 694, 729, - /* 150 */ 731, 734, 733, 741, 722, 727, 730, 732, 739, 740, - /* 160 */ 743, 749, 751, 752, 754, 747, 744, 756, 713, 706, - /* 170 */ 725, 735, 760, 759, 745, 775, 746, 700, 748, 764, - /* 180 */ 705, 765, 767, 769, 753, 761, 755, 763, 610, 785, - /* 190 */ 774, 773, 772, 757, 768, 788, 668, 811, 820, 821, - /* 200 */ 823, 826, 838, 851, 836, 878, 866, 883, 860, 872, - /* 210 */ 899, 897, 904, 907, 911, 863, 901, 902, 910, 926, + /* 0 */ 182, -168, -218, 398, 518, 568, 617, 666, 727, 765, + /* 10 */ 815, 824, 871, -62, 927, 955, 1007, 1013, 1064, 1092, + /* 20 */ 1139, 1150, 1188, 1236, 1242, 1293, 1339, 1350, 1397, 1425, + /* 30 */ 1474, 1483, 1529, 1557, 1586, 1614, -166, 176, 571, 693, + /* 40 */ 450, -250, -248, -267, -214, 75, -235, -266, -103, 51, + /* 50 */ 224, 245, 269, 306, -222, 349, -210, -243, -244, -134, + /* 60 */ -130, 420, 421, 72, 440, 2, -237, 505, 294, 442, + /* 70 */ -200, -144, -289, -289, -289, -212, -73, 240, -20, 186, + /* 80 */ 272, 308, 327, 334, 354, 358, 402, 424, 494, 498, + /* 90 */ 519, 530, 531, 533, 534, 552, 561, -69, 97, 8, + /* 100 */ 174, 275, 360, 376, 384, 243, 346, 355, -162, 500, + /* 110 */ -191, 229, 335, 132, 310, 462, 525, 548, 597, 599, + /* 120 */ 605, 612, 356, 648, 585, 542, 564, 636, 615, 593, + /* 130 */ 697, 639, 620, 620, 620, 679, 607, 623, 679, 714, + /* 140 */ 664, 725, 677, 737, 738, 716, 719, 722, 755, 709, + /* 150 */ 762, 732, 731, 773, 757, 743, 779, 789, 792, 793, + /* 160 */ 800, 781, 783, 784, 785, 787, 794, 796, 797, 798, + /* 170 */ 799, 802, 806, 812, 771, 764, 822, 780, 803, 776, + /* 180 */ 830, 805, 807, 833, 791, 747, 813, 809, 749, 816, + /* 190 */ 819, 823, 763, 767, 778, 810, 620, 842, 835, 821, + /* 200 */ 804, 814, 817, 832, 679, 863, 865, 870, 868, 872, + /* 210 */ 876, 890, 881, 917, 904, 921, 894, 901, 915, 926, + /* 220 */ 935, 931, 889, 893, 924, 929, 937, 947, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 10 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 20 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 30 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 40 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 50 */ 1221, 1221, 1221, 1221, 1280, 1221, 1221, 1221, 1221, 1221, - /* 60 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1278, 1418, 1221, - /* 70 */ 1554, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 80 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 90 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1280, 1221, 1565, - /* 100 */ 1565, 1565, 1278, 1221, 1221, 1221, 1221, 1221, 1373, 1221, - /* 110 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1452, 1221, 1221, - /* 120 */ 1629, 1221, 1221, 1326, 1221, 1589, 1221, 1581, 1557, 1571, - /* 130 */ 1558, 1221, 1614, 1574, 1221, 1221, 1221, 1444, 1221, 1221, - /* 140 */ 1423, 1420, 1420, 1221, 1221, 1221, 1280, 1221, 1221, 1280, - /* 150 */ 1280, 1221, 1280, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 160 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 170 */ 1454, 1221, 1278, 1221, 1221, 1278, 1221, 1596, 1594, 1221, - /* 180 */ 1596, 1594, 1221, 1221, 1608, 1604, 1587, 1585, 1571, 1221, - /* 190 */ 1221, 1221, 1632, 1620, 1616, 1221, 1221, 1594, 1221, 1221, - /* 200 */ 1594, 1221, 1431, 1221, 1221, 1278, 1221, 1278, 1221, 1342, - /* 210 */ 1221, 1221, 1221, 1278, 1221, 1446, 1376, 1376, 1281, 1226, - /* 220 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 230 */ 1221, 1517, 1607, 1606, 1516, 1531, 1530, 1529, 1221, 1221, - /* 240 */ 1511, 1221, 1221, 1512, 1510, 1509, 1221, 1221, 1221, 1221, - /* 250 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 260 */ 1555, 1221, 1617, 1621, 1221, 1221, 1221, 1491, 1221, 1221, - /* 270 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 280 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 290 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 300 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 310 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 320 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 330 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 340 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 350 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 360 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 370 */ 1221, 1221, 1221, 1221, 1387, 1221, 1221, 1221, 1221, 1221, - /* 380 */ 1221, 1307, 1306, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 390 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 400 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 410 */ 1221, 1221, 1221, 1221, 1578, 1588, 1221, 1221, 1221, 1221, - /* 420 */ 1221, 1221, 1221, 1221, 1221, 1491, 1221, 1605, 1221, 1564, - /* 430 */ 1560, 1221, 1221, 1556, 1221, 1221, 1615, 1221, 1221, 1221, - /* 440 */ 1221, 1221, 1221, 1221, 1221, 1550, 1221, 1221, 1221, 1221, - /* 450 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 460 */ 1221, 1221, 1221, 1221, 1490, 1221, 1221, 1221, 1221, 1221, - /* 470 */ 1221, 1221, 1370, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 480 */ 1221, 1221, 1221, 1221, 1221, 1355, 1353, 1352, 1351, 1221, - /* 490 */ 1348, 1221, 1221, 1221, 1221, 1221, 1221, 1378, 1221, 1221, - /* 500 */ 1221, 1221, 1221, 1301, 1221, 1221, 1221, 1221, 1221, 1221, - /* 510 */ 1221, 1221, 1221, 1292, 1221, 1291, 1221, 1221, 1221, 1221, - /* 520 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 530 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 540 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 0 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 10 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 20 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 30 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 40 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 50 */ 1270, 1270, 1270, 1270, 1329, 1270, 1270, 1270, 1270, 1270, + /* 60 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 70 */ 1327, 1469, 1270, 1623, 1270, 1270, 1270, 1270, 1270, 1270, + /* 80 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 90 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1329, + /* 100 */ 1270, 1270, 1634, 1634, 1634, 1327, 1270, 1270, 1270, 1270, + /* 110 */ 1270, 1270, 1270, 1422, 1270, 1270, 1270, 1270, 1270, 1270, + /* 120 */ 1270, 1270, 1503, 1270, 1270, 1698, 1270, 1375, 1509, 1658, + /* 130 */ 1270, 1650, 1626, 1640, 1627, 1270, 1683, 1643, 1270, 1270, + /* 140 */ 1270, 1270, 1495, 1270, 1270, 1474, 1471, 1471, 1270, 1270, + /* 150 */ 1329, 1270, 1270, 1329, 1270, 1270, 1329, 1329, 1270, 1329, + /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 170 */ 1270, 1270, 1270, 1270, 1270, 1270, 1327, 1505, 1270, 1270, + /* 180 */ 1327, 1270, 1270, 1327, 1270, 1665, 1663, 1270, 1665, 1663, + /* 190 */ 1270, 1270, 1677, 1673, 1656, 1654, 1640, 1270, 1270, 1270, + /* 200 */ 1701, 1689, 1685, 1270, 1270, 1663, 1270, 1270, 1663, 1270, + /* 210 */ 1482, 1270, 1270, 1327, 1270, 1327, 1270, 1391, 1270, 1270, + /* 220 */ 1327, 1270, 1497, 1511, 1425, 1425, 1330, 1275, 1270, 1270, + /* 230 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1572, + /* 240 */ 1676, 1675, 1599, 1598, 1597, 1595, 1571, 1270, 1270, 1270, + /* 250 */ 1270, 1565, 1566, 1564, 1563, 1270, 1270, 1270, 1270, 1270, + /* 260 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 270 */ 1624, 1270, 1686, 1690, 1270, 1270, 1270, 1549, 1270, 1270, + /* 280 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 290 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 300 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 310 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 320 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 330 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 340 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 350 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 360 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 370 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 380 */ 1270, 1270, 1270, 1270, 1438, 1437, 1270, 1270, 1270, 1270, + /* 390 */ 1270, 1270, 1356, 1355, 1270, 1270, 1270, 1270, 1270, 1270, + /* 400 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 410 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 420 */ 1270, 1270, 1270, 1270, 1647, 1657, 1270, 1270, 1270, 1270, + /* 430 */ 1270, 1270, 1270, 1270, 1270, 1549, 1270, 1674, 1270, 1633, + /* 440 */ 1629, 1270, 1270, 1625, 1270, 1270, 1684, 1270, 1270, 1270, + /* 450 */ 1270, 1270, 1270, 1270, 1270, 1619, 1270, 1592, 1270, 1270, + /* 460 */ 1270, 1270, 1270, 1270, 1270, 1270, 1559, 1270, 1270, 1270, + /* 470 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1548, + /* 480 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1419, 1270, 1270, + /* 490 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 500 */ 1404, 1402, 1401, 1400, 1270, 1397, 1270, 1270, 1270, 1270, + /* 510 */ 1270, 1270, 1428, 1427, 1270, 1270, 1270, 1270, 1270, 1350, + /* 520 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1341, + /* 530 */ 1270, 1340, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 540 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 550 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 560 */ 1270, 1270, 1270, 1270, 1270, 1270, }; /********** End of lemon-generated parsing tables *****************************/ @@ -952,166 +1006,182 @@ static const char *const yyTokenName[] = { /* 153 */ "BUFSIZE", /* 154 */ "STREAM", /* 155 */ "INTO", - /* 156 */ "KILL", - /* 157 */ "CONNECTION", - /* 158 */ "MERGE", - /* 159 */ "VGROUP", - /* 160 */ "REDISTRIBUTE", - /* 161 */ "SPLIT", - /* 162 */ "SYNCDB", - /* 163 */ "NULL", - /* 164 */ "FIRST", - /* 165 */ "LAST", - /* 166 */ "CAST", - /* 167 */ "NOW", - /* 168 */ "TODAY", - /* 169 */ "ROWTS", - /* 170 */ "TBNAME", - /* 171 */ "QSTARTTS", - /* 172 */ "QENDTS", - /* 173 */ "WSTARTTS", - /* 174 */ "WENDTS", - /* 175 */ "WDURATION", - /* 176 */ "BETWEEN", - /* 177 */ "IS", - /* 178 */ "NK_LT", - /* 179 */ "NK_GT", - /* 180 */ "NK_LE", - /* 181 */ "NK_GE", - /* 182 */ "NK_NE", - /* 183 */ "MATCH", - /* 184 */ "NMATCH", - /* 185 */ "JOIN", - /* 186 */ "INNER", - /* 187 */ "SELECT", - /* 188 */ "DISTINCT", - /* 189 */ "WHERE", - /* 190 */ "PARTITION", - /* 191 */ "BY", - /* 192 */ "SESSION", - /* 193 */ "STATE_WINDOW", - /* 194 */ "SLIDING", - /* 195 */ "FILL", - /* 196 */ "VALUE", - /* 197 */ "NONE", - /* 198 */ "PREV", - /* 199 */ "LINEAR", - /* 200 */ "NEXT", - /* 201 */ "GROUP", - /* 202 */ "HAVING", - /* 203 */ "ORDER", - /* 204 */ "SLIMIT", - /* 205 */ "SOFFSET", - /* 206 */ "LIMIT", - /* 207 */ "OFFSET", - /* 208 */ "ASC", - /* 209 */ "NULLS", - /* 210 */ "cmd", - /* 211 */ "account_options", - /* 212 */ "alter_account_options", - /* 213 */ "literal", - /* 214 */ "alter_account_option", - /* 215 */ "user_name", - /* 216 */ "dnode_endpoint", - /* 217 */ "dnode_host_name", - /* 218 */ "not_exists_opt", - /* 219 */ "db_name", - /* 220 */ "db_options", - /* 221 */ "exists_opt", - /* 222 */ "alter_db_options", - /* 223 */ "integer_list", - /* 224 */ "variable_list", - /* 225 */ "retention_list", - /* 226 */ "alter_db_option", - /* 227 */ "retention", - /* 228 */ "full_table_name", - /* 229 */ "column_def_list", - /* 230 */ "tags_def_opt", - /* 231 */ "table_options", - /* 232 */ "multi_create_clause", - /* 233 */ "tags_def", - /* 234 */ "multi_drop_clause", - /* 235 */ "alter_table_clause", - /* 236 */ "alter_table_options", - /* 237 */ "column_name", - /* 238 */ "type_name", - /* 239 */ "create_subtable_clause", - /* 240 */ "specific_tags_opt", - /* 241 */ "literal_list", - /* 242 */ "drop_table_clause", - /* 243 */ "col_name_list", - /* 244 */ "table_name", - /* 245 */ "column_def", - /* 246 */ "func_name_list", - /* 247 */ "alter_table_option", - /* 248 */ "col_name", - /* 249 */ "db_name_cond_opt", - /* 250 */ "like_pattern_opt", - /* 251 */ "table_name_cond", - /* 252 */ "from_db_opt", - /* 253 */ "func_name", - /* 254 */ "function_name", - /* 255 */ "index_name", - /* 256 */ "index_options", - /* 257 */ "func_list", - /* 258 */ "duration_literal", - /* 259 */ "sliding_opt", - /* 260 */ "func", - /* 261 */ "expression_list", - /* 262 */ "topic_name", - /* 263 */ "query_expression", - /* 264 */ "analyze_opt", - /* 265 */ "explain_options", - /* 266 */ "agg_func_opt", - /* 267 */ "bufsize_opt", - /* 268 */ "stream_name", - /* 269 */ "dnode_list", - /* 270 */ "signed", - /* 271 */ "signed_literal", - /* 272 */ "table_alias", - /* 273 */ "column_alias", - /* 274 */ "expression", - /* 275 */ "pseudo_column", - /* 276 */ "column_reference", - /* 277 */ "subquery", - /* 278 */ "predicate", - /* 279 */ "compare_op", - /* 280 */ "in_op", - /* 281 */ "in_predicate_value", - /* 282 */ "boolean_value_expression", - /* 283 */ "boolean_primary", - /* 284 */ "common_expression", - /* 285 */ "from_clause", - /* 286 */ "table_reference_list", - /* 287 */ "table_reference", - /* 288 */ "table_primary", - /* 289 */ "joined_table", - /* 290 */ "alias_opt", - /* 291 */ "parenthesized_joined_table", - /* 292 */ "join_type", - /* 293 */ "search_condition", - /* 294 */ "query_specification", - /* 295 */ "set_quantifier_opt", - /* 296 */ "select_list", - /* 297 */ "where_clause_opt", - /* 298 */ "partition_by_clause_opt", - /* 299 */ "twindow_clause_opt", - /* 300 */ "group_by_clause_opt", - /* 301 */ "having_clause_opt", - /* 302 */ "select_sublist", - /* 303 */ "select_item", - /* 304 */ "fill_opt", - /* 305 */ "fill_mode", - /* 306 */ "group_by_list", - /* 307 */ "query_expression_body", - /* 308 */ "order_by_clause_opt", - /* 309 */ "slimit_clause_opt", - /* 310 */ "limit_clause_opt", - /* 311 */ "query_primary", - /* 312 */ "sort_specification_list", - /* 313 */ "sort_specification", - /* 314 */ "ordering_specification_opt", - /* 315 */ "null_ordering_opt", + /* 156 */ "TRIGGER", + /* 157 */ "AT_ONCE", + /* 158 */ "WINDOW_CLOSE", + /* 159 */ "WATERMARK", + /* 160 */ "KILL", + /* 161 */ "CONNECTION", + /* 162 */ "MERGE", + /* 163 */ "VGROUP", + /* 164 */ "REDISTRIBUTE", + /* 165 */ "SPLIT", + /* 166 */ "SYNCDB", + /* 167 */ "NULL", + /* 168 */ "NK_QUESTION", + /* 169 */ "NK_ARROW", + /* 170 */ "NOW", + /* 171 */ "TODAY", + /* 172 */ "ROWTS", + /* 173 */ "TBNAME", + /* 174 */ "QSTARTTS", + /* 175 */ "QENDTS", + /* 176 */ "WSTARTTS", + /* 177 */ "WENDTS", + /* 178 */ "WDURATION", + /* 179 */ "CAST", + /* 180 */ "COUNT", + /* 181 */ "FIRST", + /* 182 */ "LAST", + /* 183 */ "LAST_ROW", + /* 184 */ "BETWEEN", + /* 185 */ "IS", + /* 186 */ "NK_LT", + /* 187 */ "NK_GT", + /* 188 */ "NK_LE", + /* 189 */ "NK_GE", + /* 190 */ "NK_NE", + /* 191 */ "MATCH", + /* 192 */ "NMATCH", + /* 193 */ "CONTAINS", + /* 194 */ "JOIN", + /* 195 */ "INNER", + /* 196 */ "SELECT", + /* 197 */ "DISTINCT", + /* 198 */ "WHERE", + /* 199 */ "PARTITION", + /* 200 */ "BY", + /* 201 */ "SESSION", + /* 202 */ "STATE_WINDOW", + /* 203 */ "SLIDING", + /* 204 */ "FILL", + /* 205 */ "VALUE", + /* 206 */ "NONE", + /* 207 */ "PREV", + /* 208 */ "LINEAR", + /* 209 */ "NEXT", + /* 210 */ "GROUP", + /* 211 */ "HAVING", + /* 212 */ "ORDER", + /* 213 */ "SLIMIT", + /* 214 */ "SOFFSET", + /* 215 */ "LIMIT", + /* 216 */ "OFFSET", + /* 217 */ "ASC", + /* 218 */ "NULLS", + /* 219 */ "cmd", + /* 220 */ "account_options", + /* 221 */ "alter_account_options", + /* 222 */ "literal", + /* 223 */ "alter_account_option", + /* 224 */ "user_name", + /* 225 */ "dnode_endpoint", + /* 226 */ "dnode_host_name", + /* 227 */ "not_exists_opt", + /* 228 */ "db_name", + /* 229 */ "db_options", + /* 230 */ "exists_opt", + /* 231 */ "alter_db_options", + /* 232 */ "integer_list", + /* 233 */ "variable_list", + /* 234 */ "retention_list", + /* 235 */ "alter_db_option", + /* 236 */ "retention", + /* 237 */ "full_table_name", + /* 238 */ "column_def_list", + /* 239 */ "tags_def_opt", + /* 240 */ "table_options", + /* 241 */ "multi_create_clause", + /* 242 */ "tags_def", + /* 243 */ "multi_drop_clause", + /* 244 */ "alter_table_clause", + /* 245 */ "alter_table_options", + /* 246 */ "column_name", + /* 247 */ "type_name", + /* 248 */ "create_subtable_clause", + /* 249 */ "specific_tags_opt", + /* 250 */ "literal_list", + /* 251 */ "drop_table_clause", + /* 252 */ "col_name_list", + /* 253 */ "table_name", + /* 254 */ "column_def", + /* 255 */ "func_name_list", + /* 256 */ "alter_table_option", + /* 257 */ "col_name", + /* 258 */ "db_name_cond_opt", + /* 259 */ "like_pattern_opt", + /* 260 */ "table_name_cond", + /* 261 */ "from_db_opt", + /* 262 */ "func_name", + /* 263 */ "function_name", + /* 264 */ "index_name", + /* 265 */ "index_options", + /* 266 */ "func_list", + /* 267 */ "duration_literal", + /* 268 */ "sliding_opt", + /* 269 */ "func", + /* 270 */ "expression_list", + /* 271 */ "topic_name", + /* 272 */ "query_expression", + /* 273 */ "analyze_opt", + /* 274 */ "explain_options", + /* 275 */ "agg_func_opt", + /* 276 */ "bufsize_opt", + /* 277 */ "stream_name", + /* 278 */ "stream_options", + /* 279 */ "into_opt", + /* 280 */ "dnode_list", + /* 281 */ "signed", + /* 282 */ "signed_literal", + /* 283 */ "table_alias", + /* 284 */ "column_alias", + /* 285 */ "expression", + /* 286 */ "pseudo_column", + /* 287 */ "column_reference", + /* 288 */ "function_expression", + /* 289 */ "subquery", + /* 290 */ "star_func", + /* 291 */ "star_func_para_list", + /* 292 */ "other_para_list", + /* 293 */ "star_func_para", + /* 294 */ "predicate", + /* 295 */ "compare_op", + /* 296 */ "in_op", + /* 297 */ "in_predicate_value", + /* 298 */ "boolean_value_expression", + /* 299 */ "boolean_primary", + /* 300 */ "common_expression", + /* 301 */ "from_clause", + /* 302 */ "table_reference_list", + /* 303 */ "table_reference", + /* 304 */ "table_primary", + /* 305 */ "joined_table", + /* 306 */ "alias_opt", + /* 307 */ "parenthesized_joined_table", + /* 308 */ "join_type", + /* 309 */ "search_condition", + /* 310 */ "query_specification", + /* 311 */ "set_quantifier_opt", + /* 312 */ "select_list", + /* 313 */ "where_clause_opt", + /* 314 */ "partition_by_clause_opt", + /* 315 */ "twindow_clause_opt", + /* 316 */ "group_by_clause_opt", + /* 317 */ "having_clause_opt", + /* 318 */ "select_sublist", + /* 319 */ "select_item", + /* 320 */ "fill_opt", + /* 321 */ "fill_mode", + /* 322 */ "group_by_list", + /* 323 */ "query_expression_body", + /* 324 */ "order_by_clause_opt", + /* 325 */ "slimit_clause_opt", + /* 326 */ "limit_clause_opt", + /* 327 */ "query_primary", + /* 328 */ "sort_specification_list", + /* 329 */ "sort_specification", + /* 330 */ "ordering_specification_opt", + /* 331 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1274,262 +1344,282 @@ static const char *const yyRuleName[] = { /* 152 */ "table_options ::=", /* 153 */ "table_options ::= table_options COMMENT NK_STRING", /* 154 */ "table_options ::= table_options KEEP integer_list", - /* 155 */ "table_options ::= table_options TTL NK_INTEGER", - /* 156 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 157 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 158 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 159 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 160 */ "alter_table_options ::= alter_table_option", - /* 161 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 162 */ "alter_table_option ::= COMMENT NK_STRING", - /* 163 */ "alter_table_option ::= KEEP integer_list", - /* 164 */ "alter_table_option ::= TTL NK_INTEGER", - /* 165 */ "col_name_list ::= col_name", - /* 166 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 167 */ "col_name ::= column_name", - /* 168 */ "cmd ::= SHOW DNODES", - /* 169 */ "cmd ::= SHOW USERS", - /* 170 */ "cmd ::= SHOW DATABASES", - /* 171 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 172 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 173 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 174 */ "cmd ::= SHOW MNODES", - /* 175 */ "cmd ::= SHOW MODULES", - /* 176 */ "cmd ::= SHOW QNODES", - /* 177 */ "cmd ::= SHOW FUNCTIONS", - /* 178 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 179 */ "cmd ::= SHOW STREAMS", - /* 180 */ "cmd ::= SHOW ACCOUNTS", - /* 181 */ "cmd ::= SHOW APPS", - /* 182 */ "cmd ::= SHOW CONNECTIONS", - /* 183 */ "cmd ::= SHOW LICENCE", - /* 184 */ "cmd ::= SHOW GRANTS", - /* 185 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 186 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 187 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 188 */ "cmd ::= SHOW QUERIES", - /* 189 */ "cmd ::= SHOW SCORES", - /* 190 */ "cmd ::= SHOW TOPICS", - /* 191 */ "cmd ::= SHOW VARIABLES", - /* 192 */ "cmd ::= SHOW BNODES", - /* 193 */ "cmd ::= SHOW SNODES", - /* 194 */ "db_name_cond_opt ::=", - /* 195 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 196 */ "like_pattern_opt ::=", - /* 197 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 198 */ "table_name_cond ::= table_name", - /* 199 */ "from_db_opt ::=", - /* 200 */ "from_db_opt ::= FROM db_name", - /* 201 */ "func_name_list ::= func_name", - /* 202 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 203 */ "func_name ::= function_name", - /* 204 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 205 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 206 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 207 */ "index_options ::=", - /* 208 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 209 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 210 */ "func_list ::= func", - /* 211 */ "func_list ::= func_list NK_COMMA func", - /* 212 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 213 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 214 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 215 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 216 */ "cmd ::= DESC full_table_name", - /* 217 */ "cmd ::= DESCRIBE full_table_name", - /* 218 */ "cmd ::= RESET QUERY CACHE", - /* 219 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 220 */ "analyze_opt ::=", - /* 221 */ "analyze_opt ::= ANALYZE", - /* 222 */ "explain_options ::=", - /* 223 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 224 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 225 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 226 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 227 */ "cmd ::= DROP FUNCTION function_name", - /* 228 */ "agg_func_opt ::=", - /* 229 */ "agg_func_opt ::= AGGREGATE", - /* 230 */ "bufsize_opt ::=", - /* 231 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 232 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", - /* 233 */ "cmd ::= DROP STREAM stream_name", - /* 234 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 235 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 236 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 237 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 238 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 239 */ "dnode_list ::= DNODE NK_INTEGER", - /* 240 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 241 */ "cmd ::= SYNCDB db_name REPLICA", - /* 242 */ "cmd ::= query_expression", - /* 243 */ "literal ::= NK_INTEGER", - /* 244 */ "literal ::= NK_FLOAT", - /* 245 */ "literal ::= NK_STRING", - /* 246 */ "literal ::= NK_BOOL", - /* 247 */ "literal ::= TIMESTAMP NK_STRING", - /* 248 */ "literal ::= duration_literal", - /* 249 */ "literal ::= NULL", - /* 250 */ "duration_literal ::= NK_VARIABLE", - /* 251 */ "signed ::= NK_INTEGER", - /* 252 */ "signed ::= NK_PLUS NK_INTEGER", - /* 253 */ "signed ::= NK_MINUS NK_INTEGER", - /* 254 */ "signed ::= NK_FLOAT", - /* 255 */ "signed ::= NK_PLUS NK_FLOAT", - /* 256 */ "signed ::= NK_MINUS NK_FLOAT", - /* 257 */ "signed_literal ::= signed", - /* 258 */ "signed_literal ::= NK_STRING", - /* 259 */ "signed_literal ::= NK_BOOL", - /* 260 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 261 */ "signed_literal ::= duration_literal", - /* 262 */ "signed_literal ::= NULL", - /* 263 */ "literal_list ::= signed_literal", - /* 264 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 265 */ "db_name ::= NK_ID", - /* 266 */ "table_name ::= NK_ID", - /* 267 */ "column_name ::= NK_ID", - /* 268 */ "function_name ::= NK_ID", - /* 269 */ "function_name ::= FIRST", - /* 270 */ "function_name ::= LAST", - /* 271 */ "table_alias ::= NK_ID", - /* 272 */ "column_alias ::= NK_ID", - /* 273 */ "user_name ::= NK_ID", - /* 274 */ "index_name ::= NK_ID", - /* 275 */ "topic_name ::= NK_ID", - /* 276 */ "stream_name ::= NK_ID", - /* 277 */ "expression ::= literal", - /* 278 */ "expression ::= pseudo_column", - /* 279 */ "expression ::= column_reference", - /* 280 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 281 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 282 */ "expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 283 */ "expression ::= subquery", - /* 284 */ "expression ::= NK_LP expression NK_RP", - /* 285 */ "expression ::= NK_PLUS expression", - /* 286 */ "expression ::= NK_MINUS expression", - /* 287 */ "expression ::= expression NK_PLUS expression", - /* 288 */ "expression ::= expression NK_MINUS expression", - /* 289 */ "expression ::= expression NK_STAR expression", - /* 290 */ "expression ::= expression NK_SLASH expression", - /* 291 */ "expression ::= expression NK_REM expression", - /* 292 */ "expression_list ::= expression", - /* 293 */ "expression_list ::= expression_list NK_COMMA expression", - /* 294 */ "column_reference ::= column_name", - /* 295 */ "column_reference ::= table_name NK_DOT column_name", - /* 296 */ "pseudo_column ::= NOW", - /* 297 */ "pseudo_column ::= TODAY", - /* 298 */ "pseudo_column ::= ROWTS", - /* 299 */ "pseudo_column ::= TBNAME", - /* 300 */ "pseudo_column ::= QSTARTTS", - /* 301 */ "pseudo_column ::= QENDTS", - /* 302 */ "pseudo_column ::= WSTARTTS", - /* 303 */ "pseudo_column ::= WENDTS", - /* 304 */ "pseudo_column ::= WDURATION", - /* 305 */ "predicate ::= expression compare_op expression", - /* 306 */ "predicate ::= expression BETWEEN expression AND expression", - /* 307 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 308 */ "predicate ::= expression IS NULL", - /* 309 */ "predicate ::= expression IS NOT NULL", - /* 310 */ "predicate ::= expression in_op in_predicate_value", - /* 311 */ "compare_op ::= NK_LT", - /* 312 */ "compare_op ::= NK_GT", - /* 313 */ "compare_op ::= NK_LE", - /* 314 */ "compare_op ::= NK_GE", - /* 315 */ "compare_op ::= NK_NE", - /* 316 */ "compare_op ::= NK_EQ", - /* 317 */ "compare_op ::= LIKE", - /* 318 */ "compare_op ::= NOT LIKE", - /* 319 */ "compare_op ::= MATCH", - /* 320 */ "compare_op ::= NMATCH", - /* 321 */ "in_op ::= IN", - /* 322 */ "in_op ::= NOT IN", - /* 323 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 324 */ "boolean_value_expression ::= boolean_primary", - /* 325 */ "boolean_value_expression ::= NOT boolean_primary", - /* 326 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 327 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 328 */ "boolean_primary ::= predicate", - /* 329 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 330 */ "common_expression ::= expression", - /* 331 */ "common_expression ::= boolean_value_expression", - /* 332 */ "from_clause ::= FROM table_reference_list", - /* 333 */ "table_reference_list ::= table_reference", - /* 334 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 335 */ "table_reference ::= table_primary", - /* 336 */ "table_reference ::= joined_table", - /* 337 */ "table_primary ::= table_name alias_opt", - /* 338 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 339 */ "table_primary ::= subquery alias_opt", - /* 340 */ "table_primary ::= parenthesized_joined_table", - /* 341 */ "alias_opt ::=", - /* 342 */ "alias_opt ::= table_alias", - /* 343 */ "alias_opt ::= AS table_alias", - /* 344 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 345 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 346 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 347 */ "join_type ::=", - /* 348 */ "join_type ::= INNER", - /* 349 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 350 */ "set_quantifier_opt ::=", - /* 351 */ "set_quantifier_opt ::= DISTINCT", - /* 352 */ "set_quantifier_opt ::= ALL", - /* 353 */ "select_list ::= NK_STAR", - /* 354 */ "select_list ::= select_sublist", - /* 355 */ "select_sublist ::= select_item", - /* 356 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 357 */ "select_item ::= common_expression", - /* 358 */ "select_item ::= common_expression column_alias", - /* 359 */ "select_item ::= common_expression AS column_alias", - /* 360 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 361 */ "where_clause_opt ::=", - /* 362 */ "where_clause_opt ::= WHERE search_condition", - /* 363 */ "partition_by_clause_opt ::=", - /* 364 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 365 */ "twindow_clause_opt ::=", - /* 366 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 367 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 370 */ "sliding_opt ::=", - /* 371 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 372 */ "fill_opt ::=", - /* 373 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 374 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 375 */ "fill_mode ::= NONE", - /* 376 */ "fill_mode ::= PREV", - /* 377 */ "fill_mode ::= NULL", - /* 378 */ "fill_mode ::= LINEAR", - /* 379 */ "fill_mode ::= NEXT", - /* 380 */ "group_by_clause_opt ::=", - /* 381 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 382 */ "group_by_list ::= expression", - /* 383 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 384 */ "having_clause_opt ::=", - /* 385 */ "having_clause_opt ::= HAVING search_condition", - /* 386 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 387 */ "query_expression_body ::= query_primary", - /* 388 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 389 */ "query_primary ::= query_specification", - /* 390 */ "order_by_clause_opt ::=", - /* 391 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 392 */ "slimit_clause_opt ::=", - /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 396 */ "limit_clause_opt ::=", - /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 400 */ "subquery ::= NK_LP query_expression NK_RP", - /* 401 */ "search_condition ::= common_expression", - /* 402 */ "sort_specification_list ::= sort_specification", - /* 403 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 404 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 405 */ "ordering_specification_opt ::=", - /* 406 */ "ordering_specification_opt ::= ASC", - /* 407 */ "ordering_specification_opt ::= DESC", - /* 408 */ "null_ordering_opt ::=", - /* 409 */ "null_ordering_opt ::= NULLS FIRST", - /* 410 */ "null_ordering_opt ::= NULLS LAST", + /* 155 */ "table_options ::= table_options KEEP variable_list", + /* 156 */ "table_options ::= table_options TTL NK_INTEGER", + /* 157 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 158 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 159 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 160 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 161 */ "alter_table_options ::= alter_table_option", + /* 162 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 163 */ "alter_table_option ::= COMMENT NK_STRING", + /* 164 */ "alter_table_option ::= KEEP integer_list", + /* 165 */ "alter_table_option ::= KEEP variable_list", + /* 166 */ "alter_table_option ::= TTL NK_INTEGER", + /* 167 */ "col_name_list ::= col_name", + /* 168 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 169 */ "col_name ::= column_name", + /* 170 */ "cmd ::= SHOW DNODES", + /* 171 */ "cmd ::= SHOW USERS", + /* 172 */ "cmd ::= SHOW DATABASES", + /* 173 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 174 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 175 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 176 */ "cmd ::= SHOW MNODES", + /* 177 */ "cmd ::= SHOW MODULES", + /* 178 */ "cmd ::= SHOW QNODES", + /* 179 */ "cmd ::= SHOW FUNCTIONS", + /* 180 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 181 */ "cmd ::= SHOW STREAMS", + /* 182 */ "cmd ::= SHOW ACCOUNTS", + /* 183 */ "cmd ::= SHOW APPS", + /* 184 */ "cmd ::= SHOW CONNECTIONS", + /* 185 */ "cmd ::= SHOW LICENCE", + /* 186 */ "cmd ::= SHOW GRANTS", + /* 187 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 188 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 189 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 190 */ "cmd ::= SHOW QUERIES", + /* 191 */ "cmd ::= SHOW SCORES", + /* 192 */ "cmd ::= SHOW TOPICS", + /* 193 */ "cmd ::= SHOW VARIABLES", + /* 194 */ "cmd ::= SHOW BNODES", + /* 195 */ "cmd ::= SHOW SNODES", + /* 196 */ "db_name_cond_opt ::=", + /* 197 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 198 */ "like_pattern_opt ::=", + /* 199 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 200 */ "table_name_cond ::= table_name", + /* 201 */ "from_db_opt ::=", + /* 202 */ "from_db_opt ::= FROM db_name", + /* 203 */ "func_name_list ::= func_name", + /* 204 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 205 */ "func_name ::= function_name", + /* 206 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 207 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 208 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 209 */ "index_options ::=", + /* 210 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 211 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 212 */ "func_list ::= func", + /* 213 */ "func_list ::= func_list NK_COMMA func", + /* 214 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 215 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 216 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 217 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 218 */ "cmd ::= DESC full_table_name", + /* 219 */ "cmd ::= DESCRIBE full_table_name", + /* 220 */ "cmd ::= RESET QUERY CACHE", + /* 221 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 222 */ "analyze_opt ::=", + /* 223 */ "analyze_opt ::= ANALYZE", + /* 224 */ "explain_options ::=", + /* 225 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 226 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 227 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 228 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 229 */ "cmd ::= DROP FUNCTION function_name", + /* 230 */ "agg_func_opt ::=", + /* 231 */ "agg_func_opt ::= AGGREGATE", + /* 232 */ "bufsize_opt ::=", + /* 233 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 234 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 235 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 236 */ "into_opt ::=", + /* 237 */ "into_opt ::= INTO full_table_name", + /* 238 */ "stream_options ::=", + /* 239 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 240 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 241 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 242 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 243 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 244 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 245 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 246 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 247 */ "dnode_list ::= DNODE NK_INTEGER", + /* 248 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 249 */ "cmd ::= SYNCDB db_name REPLICA", + /* 250 */ "cmd ::= query_expression", + /* 251 */ "literal ::= NK_INTEGER", + /* 252 */ "literal ::= NK_FLOAT", + /* 253 */ "literal ::= NK_STRING", + /* 254 */ "literal ::= NK_BOOL", + /* 255 */ "literal ::= TIMESTAMP NK_STRING", + /* 256 */ "literal ::= duration_literal", + /* 257 */ "literal ::= NULL", + /* 258 */ "literal ::= NK_QUESTION", + /* 259 */ "duration_literal ::= NK_VARIABLE", + /* 260 */ "signed ::= NK_INTEGER", + /* 261 */ "signed ::= NK_PLUS NK_INTEGER", + /* 262 */ "signed ::= NK_MINUS NK_INTEGER", + /* 263 */ "signed ::= NK_FLOAT", + /* 264 */ "signed ::= NK_PLUS NK_FLOAT", + /* 265 */ "signed ::= NK_MINUS NK_FLOAT", + /* 266 */ "signed_literal ::= signed", + /* 267 */ "signed_literal ::= NK_STRING", + /* 268 */ "signed_literal ::= NK_BOOL", + /* 269 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 270 */ "signed_literal ::= duration_literal", + /* 271 */ "signed_literal ::= NULL", + /* 272 */ "literal_list ::= signed_literal", + /* 273 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 274 */ "db_name ::= NK_ID", + /* 275 */ "table_name ::= NK_ID", + /* 276 */ "column_name ::= NK_ID", + /* 277 */ "function_name ::= NK_ID", + /* 278 */ "table_alias ::= NK_ID", + /* 279 */ "column_alias ::= NK_ID", + /* 280 */ "user_name ::= NK_ID", + /* 281 */ "index_name ::= NK_ID", + /* 282 */ "topic_name ::= NK_ID", + /* 283 */ "stream_name ::= NK_ID", + /* 284 */ "expression ::= literal", + /* 285 */ "expression ::= pseudo_column", + /* 286 */ "expression ::= column_reference", + /* 287 */ "expression ::= function_expression", + /* 288 */ "expression ::= subquery", + /* 289 */ "expression ::= NK_LP expression NK_RP", + /* 290 */ "expression ::= NK_PLUS expression", + /* 291 */ "expression ::= NK_MINUS expression", + /* 292 */ "expression ::= expression NK_PLUS expression", + /* 293 */ "expression ::= expression NK_MINUS expression", + /* 294 */ "expression ::= expression NK_STAR expression", + /* 295 */ "expression ::= expression NK_SLASH expression", + /* 296 */ "expression ::= expression NK_REM expression", + /* 297 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 298 */ "expression_list ::= expression", + /* 299 */ "expression_list ::= expression_list NK_COMMA expression", + /* 300 */ "column_reference ::= column_name", + /* 301 */ "column_reference ::= table_name NK_DOT column_name", + /* 302 */ "pseudo_column ::= NOW", + /* 303 */ "pseudo_column ::= TODAY", + /* 304 */ "pseudo_column ::= ROWTS", + /* 305 */ "pseudo_column ::= TBNAME", + /* 306 */ "pseudo_column ::= QSTARTTS", + /* 307 */ "pseudo_column ::= QENDTS", + /* 308 */ "pseudo_column ::= WSTARTTS", + /* 309 */ "pseudo_column ::= WENDTS", + /* 310 */ "pseudo_column ::= WDURATION", + /* 311 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 312 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 313 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 314 */ "star_func ::= COUNT", + /* 315 */ "star_func ::= FIRST", + /* 316 */ "star_func ::= LAST", + /* 317 */ "star_func ::= LAST_ROW", + /* 318 */ "star_func_para_list ::= NK_STAR", + /* 319 */ "star_func_para_list ::= other_para_list", + /* 320 */ "other_para_list ::= star_func_para", + /* 321 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 322 */ "star_func_para ::= expression", + /* 323 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 324 */ "predicate ::= expression compare_op expression", + /* 325 */ "predicate ::= expression BETWEEN expression AND expression", + /* 326 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 327 */ "predicate ::= expression IS NULL", + /* 328 */ "predicate ::= expression IS NOT NULL", + /* 329 */ "predicate ::= expression in_op in_predicate_value", + /* 330 */ "compare_op ::= NK_LT", + /* 331 */ "compare_op ::= NK_GT", + /* 332 */ "compare_op ::= NK_LE", + /* 333 */ "compare_op ::= NK_GE", + /* 334 */ "compare_op ::= NK_NE", + /* 335 */ "compare_op ::= NK_EQ", + /* 336 */ "compare_op ::= LIKE", + /* 337 */ "compare_op ::= NOT LIKE", + /* 338 */ "compare_op ::= MATCH", + /* 339 */ "compare_op ::= NMATCH", + /* 340 */ "compare_op ::= CONTAINS", + /* 341 */ "in_op ::= IN", + /* 342 */ "in_op ::= NOT IN", + /* 343 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 344 */ "boolean_value_expression ::= boolean_primary", + /* 345 */ "boolean_value_expression ::= NOT boolean_primary", + /* 346 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 347 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 348 */ "boolean_primary ::= predicate", + /* 349 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 350 */ "common_expression ::= expression", + /* 351 */ "common_expression ::= boolean_value_expression", + /* 352 */ "from_clause ::= FROM table_reference_list", + /* 353 */ "table_reference_list ::= table_reference", + /* 354 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 355 */ "table_reference ::= table_primary", + /* 356 */ "table_reference ::= joined_table", + /* 357 */ "table_primary ::= table_name alias_opt", + /* 358 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 359 */ "table_primary ::= subquery alias_opt", + /* 360 */ "table_primary ::= parenthesized_joined_table", + /* 361 */ "alias_opt ::=", + /* 362 */ "alias_opt ::= table_alias", + /* 363 */ "alias_opt ::= AS table_alias", + /* 364 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 365 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 366 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 367 */ "join_type ::=", + /* 368 */ "join_type ::= INNER", + /* 369 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 370 */ "set_quantifier_opt ::=", + /* 371 */ "set_quantifier_opt ::= DISTINCT", + /* 372 */ "set_quantifier_opt ::= ALL", + /* 373 */ "select_list ::= NK_STAR", + /* 374 */ "select_list ::= select_sublist", + /* 375 */ "select_sublist ::= select_item", + /* 376 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 377 */ "select_item ::= common_expression", + /* 378 */ "select_item ::= common_expression column_alias", + /* 379 */ "select_item ::= common_expression AS column_alias", + /* 380 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 381 */ "where_clause_opt ::=", + /* 382 */ "where_clause_opt ::= WHERE search_condition", + /* 383 */ "partition_by_clause_opt ::=", + /* 384 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 385 */ "twindow_clause_opt ::=", + /* 386 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 387 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 388 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 389 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 390 */ "sliding_opt ::=", + /* 391 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 392 */ "fill_opt ::=", + /* 393 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 394 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 395 */ "fill_mode ::= NONE", + /* 396 */ "fill_mode ::= PREV", + /* 397 */ "fill_mode ::= NULL", + /* 398 */ "fill_mode ::= LINEAR", + /* 399 */ "fill_mode ::= NEXT", + /* 400 */ "group_by_clause_opt ::=", + /* 401 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 402 */ "group_by_list ::= expression", + /* 403 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 404 */ "having_clause_opt ::=", + /* 405 */ "having_clause_opt ::= HAVING search_condition", + /* 406 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 407 */ "query_expression_body ::= query_primary", + /* 408 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 409 */ "query_primary ::= query_specification", + /* 410 */ "order_by_clause_opt ::=", + /* 411 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 412 */ "slimit_clause_opt ::=", + /* 413 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 414 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 415 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 416 */ "limit_clause_opt ::=", + /* 417 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 418 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 419 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 420 */ "subquery ::= NK_LP query_expression NK_RP", + /* 421 */ "search_condition ::= common_expression", + /* 422 */ "sort_specification_list ::= sort_specification", + /* 423 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 424 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 425 */ "ordering_specification_opt ::=", + /* 426 */ "ordering_specification_opt ::= ASC", + /* 427 */ "ordering_specification_opt ::= DESC", + /* 428 */ "null_ordering_opt ::=", + /* 429 */ "null_ordering_opt ::= NULLS FIRST", + /* 430 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1656,156 +1746,163 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 210: /* cmd */ - case 213: /* literal */ - case 220: /* db_options */ - case 222: /* alter_db_options */ - case 227: /* retention */ - case 228: /* full_table_name */ - case 231: /* table_options */ - case 235: /* alter_table_clause */ - case 236: /* alter_table_options */ - case 239: /* create_subtable_clause */ - case 242: /* drop_table_clause */ - case 245: /* column_def */ - case 248: /* col_name */ - case 249: /* db_name_cond_opt */ - case 250: /* like_pattern_opt */ - case 251: /* table_name_cond */ - case 252: /* from_db_opt */ - case 253: /* func_name */ - case 256: /* index_options */ - case 258: /* duration_literal */ - case 259: /* sliding_opt */ - case 260: /* func */ - case 263: /* query_expression */ - case 265: /* explain_options */ - case 270: /* signed */ - case 271: /* signed_literal */ - case 274: /* expression */ - case 275: /* pseudo_column */ - case 276: /* column_reference */ - case 277: /* subquery */ - case 278: /* predicate */ - case 281: /* in_predicate_value */ - case 282: /* boolean_value_expression */ - case 283: /* boolean_primary */ - case 284: /* common_expression */ - case 285: /* from_clause */ - case 286: /* table_reference_list */ - case 287: /* table_reference */ - case 288: /* table_primary */ - case 289: /* joined_table */ - case 291: /* parenthesized_joined_table */ - case 293: /* search_condition */ - case 294: /* query_specification */ - case 297: /* where_clause_opt */ - case 299: /* twindow_clause_opt */ - case 301: /* having_clause_opt */ - case 303: /* select_item */ - case 304: /* fill_opt */ - case 307: /* query_expression_body */ - case 309: /* slimit_clause_opt */ - case 310: /* limit_clause_opt */ - case 311: /* query_primary */ - case 313: /* sort_specification */ + case 219: /* cmd */ + case 222: /* literal */ + case 229: /* db_options */ + case 231: /* alter_db_options */ + case 236: /* retention */ + case 237: /* full_table_name */ + case 240: /* table_options */ + case 244: /* alter_table_clause */ + case 245: /* alter_table_options */ + case 248: /* create_subtable_clause */ + case 251: /* drop_table_clause */ + case 254: /* column_def */ + case 257: /* col_name */ + case 258: /* db_name_cond_opt */ + case 259: /* like_pattern_opt */ + case 260: /* table_name_cond */ + case 261: /* from_db_opt */ + case 262: /* func_name */ + case 265: /* index_options */ + case 267: /* duration_literal */ + case 268: /* sliding_opt */ + case 269: /* func */ + case 272: /* query_expression */ + case 274: /* explain_options */ + case 278: /* stream_options */ + case 279: /* into_opt */ + case 281: /* signed */ + case 282: /* signed_literal */ + case 285: /* expression */ + case 286: /* pseudo_column */ + case 287: /* column_reference */ + case 288: /* function_expression */ + case 289: /* subquery */ + case 293: /* star_func_para */ + case 294: /* predicate */ + case 297: /* in_predicate_value */ + case 298: /* boolean_value_expression */ + case 299: /* boolean_primary */ + case 300: /* common_expression */ + case 301: /* from_clause */ + case 302: /* table_reference_list */ + case 303: /* table_reference */ + case 304: /* table_primary */ + case 305: /* joined_table */ + case 307: /* parenthesized_joined_table */ + case 309: /* search_condition */ + case 310: /* query_specification */ + case 313: /* where_clause_opt */ + case 315: /* twindow_clause_opt */ + case 317: /* having_clause_opt */ + case 319: /* select_item */ + case 320: /* fill_opt */ + case 323: /* query_expression_body */ + case 325: /* slimit_clause_opt */ + case 326: /* limit_clause_opt */ + case 327: /* query_primary */ + case 329: /* sort_specification */ { - nodesDestroyNode((yypminor->yy504)); + nodesDestroyNode((yypminor->yy192)); } break; - case 211: /* account_options */ - case 212: /* alter_account_options */ - case 214: /* alter_account_option */ - case 267: /* bufsize_opt */ + case 220: /* account_options */ + case 221: /* alter_account_options */ + case 223: /* alter_account_option */ + case 276: /* bufsize_opt */ { } break; - case 215: /* user_name */ - case 216: /* dnode_endpoint */ - case 217: /* dnode_host_name */ - case 219: /* db_name */ - case 237: /* column_name */ - case 244: /* table_name */ - case 254: /* function_name */ - case 255: /* index_name */ - case 262: /* topic_name */ - case 268: /* stream_name */ - case 272: /* table_alias */ - case 273: /* column_alias */ - case 290: /* alias_opt */ + case 224: /* user_name */ + case 225: /* dnode_endpoint */ + case 226: /* dnode_host_name */ + case 228: /* db_name */ + case 246: /* column_name */ + case 253: /* table_name */ + case 263: /* function_name */ + case 264: /* index_name */ + case 271: /* topic_name */ + case 277: /* stream_name */ + case 283: /* table_alias */ + case 284: /* column_alias */ + case 290: /* star_func */ + case 306: /* alias_opt */ { } break; - case 218: /* not_exists_opt */ - case 221: /* exists_opt */ - case 264: /* analyze_opt */ - case 266: /* agg_func_opt */ - case 295: /* set_quantifier_opt */ + case 227: /* not_exists_opt */ + case 230: /* exists_opt */ + case 273: /* analyze_opt */ + case 275: /* agg_func_opt */ + case 311: /* set_quantifier_opt */ { } break; - case 223: /* integer_list */ - case 224: /* variable_list */ - case 225: /* retention_list */ - case 229: /* column_def_list */ - case 230: /* tags_def_opt */ - case 232: /* multi_create_clause */ - case 233: /* tags_def */ - case 234: /* multi_drop_clause */ - case 240: /* specific_tags_opt */ - case 241: /* literal_list */ - case 243: /* col_name_list */ - case 246: /* func_name_list */ - case 257: /* func_list */ - case 261: /* expression_list */ - case 269: /* dnode_list */ - case 296: /* select_list */ - case 298: /* partition_by_clause_opt */ - case 300: /* group_by_clause_opt */ - case 302: /* select_sublist */ - case 306: /* group_by_list */ - case 308: /* order_by_clause_opt */ - case 312: /* sort_specification_list */ + case 232: /* integer_list */ + case 233: /* variable_list */ + case 234: /* retention_list */ + case 238: /* column_def_list */ + case 239: /* tags_def_opt */ + case 241: /* multi_create_clause */ + case 242: /* tags_def */ + case 243: /* multi_drop_clause */ + case 249: /* specific_tags_opt */ + case 250: /* literal_list */ + case 252: /* col_name_list */ + case 255: /* func_name_list */ + case 266: /* func_list */ + case 270: /* expression_list */ + case 280: /* dnode_list */ + case 291: /* star_func_para_list */ + case 292: /* other_para_list */ + case 312: /* select_list */ + case 314: /* partition_by_clause_opt */ + case 316: /* group_by_clause_opt */ + case 318: /* select_sublist */ + case 322: /* group_by_list */ + case 324: /* order_by_clause_opt */ + case 328: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy488)); + nodesDestroyList((yypminor->yy64)); } break; - case 226: /* alter_db_option */ - case 247: /* alter_table_option */ + case 235: /* alter_db_option */ + case 256: /* alter_table_option */ { } break; - case 238: /* type_name */ + case 247: /* type_name */ { } break; - case 279: /* compare_op */ - case 280: /* in_op */ + case 295: /* compare_op */ + case 296: /* in_op */ { } break; - case 292: /* join_type */ + case 308: /* join_type */ { } break; - case 305: /* fill_mode */ + case 321: /* fill_mode */ { } break; - case 314: /* ordering_specification_opt */ + case 330: /* ordering_specification_opt */ { } break; - case 315: /* null_ordering_opt */ + case 331: /* null_ordering_opt */ { } @@ -2104,417 +2201,437 @@ 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[] = { - { 210, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 210, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 211, 0 }, /* (2) account_options ::= */ - { 211, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 211, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 211, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 211, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 211, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 211, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 211, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 211, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 211, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 212, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 212, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 214, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 214, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 214, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 214, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 214, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 214, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 214, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 214, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 214, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 214, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 210, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 210, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 210, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 210, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 210, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 210, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 210, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 210, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 210, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 210, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 210, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 210, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 216, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 217, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 217, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 210, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 210, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 210, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 210, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ - { 210, -2 }, /* (51) cmd ::= USE db_name */ - { 210, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 218, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ - { 218, 0 }, /* (54) not_exists_opt ::= */ - { 221, -2 }, /* (55) exists_opt ::= IF EXISTS */ - { 221, 0 }, /* (56) exists_opt ::= */ - { 220, 0 }, /* (57) db_options ::= */ - { 220, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ - { 220, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ - { 220, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ - { 220, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ - { 220, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ - { 220, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ - { 220, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ - { 220, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ - { 220, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ - { 220, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ - { 220, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ - { 220, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ - { 220, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ - { 220, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ - { 220, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ - { 220, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ - { 220, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ - { 220, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 220, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 220, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ - { 222, -1 }, /* (78) alter_db_options ::= alter_db_option */ - { 222, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ - { 226, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ - { 226, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ - { 226, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ - { 226, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ - { 226, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ - { 226, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ - { 226, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ - { 226, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ - { 223, -1 }, /* (88) integer_list ::= NK_INTEGER */ - { 223, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 224, -1 }, /* (90) variable_list ::= NK_VARIABLE */ - { 224, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 225, -1 }, /* (92) retention_list ::= retention */ - { 225, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ - { 227, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 210, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 210, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ - { 210, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 210, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ - { 210, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ - { 210, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ - { 210, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ - { 235, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ - { 235, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 235, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 235, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 235, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 235, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 235, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 235, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 235, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 235, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 232, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ - { 232, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 239, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 234, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ - { 234, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 242, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ - { 240, 0 }, /* (118) specific_tags_opt ::= */ - { 240, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 228, -1 }, /* (120) full_table_name ::= table_name */ - { 228, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ - { 229, -1 }, /* (122) column_def_list ::= column_def */ - { 229, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ - { 245, -2 }, /* (124) column_def ::= column_name type_name */ - { 245, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ - { 238, -1 }, /* (126) type_name ::= BOOL */ - { 238, -1 }, /* (127) type_name ::= TINYINT */ - { 238, -1 }, /* (128) type_name ::= SMALLINT */ - { 238, -1 }, /* (129) type_name ::= INT */ - { 238, -1 }, /* (130) type_name ::= INTEGER */ - { 238, -1 }, /* (131) type_name ::= BIGINT */ - { 238, -1 }, /* (132) type_name ::= FLOAT */ - { 238, -1 }, /* (133) type_name ::= DOUBLE */ - { 238, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (135) type_name ::= TIMESTAMP */ - { 238, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 238, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ - { 238, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ - { 238, -2 }, /* (139) type_name ::= INT UNSIGNED */ - { 238, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ - { 238, -1 }, /* (141) type_name ::= JSON */ - { 238, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (143) type_name ::= MEDIUMBLOB */ - { 238, -1 }, /* (144) type_name ::= BLOB */ - { 238, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (146) type_name ::= DECIMAL */ - { 238, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 238, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 230, 0 }, /* (149) tags_def_opt ::= */ - { 230, -1 }, /* (150) tags_def_opt ::= tags_def */ - { 233, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 231, 0 }, /* (152) table_options ::= */ - { 231, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ - { 231, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ - { 231, -3 }, /* (155) table_options ::= table_options TTL NK_INTEGER */ - { 231, -5 }, /* (156) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 231, -5 }, /* (157) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 231, -3 }, /* (158) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 231, -3 }, /* (159) table_options ::= table_options DELAY NK_INTEGER */ - { 236, -1 }, /* (160) alter_table_options ::= alter_table_option */ - { 236, -2 }, /* (161) alter_table_options ::= alter_table_options alter_table_option */ - { 247, -2 }, /* (162) alter_table_option ::= COMMENT NK_STRING */ - { 247, -2 }, /* (163) alter_table_option ::= KEEP integer_list */ - { 247, -2 }, /* (164) alter_table_option ::= TTL NK_INTEGER */ - { 243, -1 }, /* (165) col_name_list ::= col_name */ - { 243, -3 }, /* (166) col_name_list ::= col_name_list NK_COMMA col_name */ - { 248, -1 }, /* (167) col_name ::= column_name */ - { 210, -2 }, /* (168) cmd ::= SHOW DNODES */ - { 210, -2 }, /* (169) cmd ::= SHOW USERS */ - { 210, -2 }, /* (170) cmd ::= SHOW DATABASES */ - { 210, -4 }, /* (171) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 210, -4 }, /* (172) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 210, -3 }, /* (173) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 210, -2 }, /* (174) cmd ::= SHOW MNODES */ - { 210, -2 }, /* (175) cmd ::= SHOW MODULES */ - { 210, -2 }, /* (176) cmd ::= SHOW QNODES */ - { 210, -2 }, /* (177) cmd ::= SHOW FUNCTIONS */ - { 210, -5 }, /* (178) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 210, -2 }, /* (179) cmd ::= SHOW STREAMS */ - { 210, -2 }, /* (180) cmd ::= SHOW ACCOUNTS */ - { 210, -2 }, /* (181) cmd ::= SHOW APPS */ - { 210, -2 }, /* (182) cmd ::= SHOW CONNECTIONS */ - { 210, -2 }, /* (183) cmd ::= SHOW LICENCE */ - { 210, -2 }, /* (184) cmd ::= SHOW GRANTS */ - { 210, -4 }, /* (185) cmd ::= SHOW CREATE DATABASE db_name */ - { 210, -4 }, /* (186) cmd ::= SHOW CREATE TABLE full_table_name */ - { 210, -4 }, /* (187) cmd ::= SHOW CREATE STABLE full_table_name */ - { 210, -2 }, /* (188) cmd ::= SHOW QUERIES */ - { 210, -2 }, /* (189) cmd ::= SHOW SCORES */ - { 210, -2 }, /* (190) cmd ::= SHOW TOPICS */ - { 210, -2 }, /* (191) cmd ::= SHOW VARIABLES */ - { 210, -2 }, /* (192) cmd ::= SHOW BNODES */ - { 210, -2 }, /* (193) cmd ::= SHOW SNODES */ - { 249, 0 }, /* (194) db_name_cond_opt ::= */ - { 249, -2 }, /* (195) db_name_cond_opt ::= db_name NK_DOT */ - { 250, 0 }, /* (196) like_pattern_opt ::= */ - { 250, -2 }, /* (197) like_pattern_opt ::= LIKE NK_STRING */ - { 251, -1 }, /* (198) table_name_cond ::= table_name */ - { 252, 0 }, /* (199) from_db_opt ::= */ - { 252, -2 }, /* (200) from_db_opt ::= FROM db_name */ - { 246, -1 }, /* (201) func_name_list ::= func_name */ - { 246, -3 }, /* (202) func_name_list ::= func_name_list NK_COMMA col_name */ - { 253, -1 }, /* (203) func_name ::= function_name */ - { 210, -8 }, /* (204) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 210, -10 }, /* (205) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 210, -6 }, /* (206) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 256, 0 }, /* (207) index_options ::= */ - { 256, -9 }, /* (208) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 256, -11 }, /* (209) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 257, -1 }, /* (210) func_list ::= func */ - { 257, -3 }, /* (211) func_list ::= func_list NK_COMMA func */ - { 260, -4 }, /* (212) func ::= function_name NK_LP expression_list NK_RP */ - { 210, -6 }, /* (213) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 210, -6 }, /* (214) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 210, -4 }, /* (215) cmd ::= DROP TOPIC exists_opt topic_name */ - { 210, -2 }, /* (216) cmd ::= DESC full_table_name */ - { 210, -2 }, /* (217) cmd ::= DESCRIBE full_table_name */ - { 210, -3 }, /* (218) cmd ::= RESET QUERY CACHE */ - { 210, -4 }, /* (219) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 264, 0 }, /* (220) analyze_opt ::= */ - { 264, -1 }, /* (221) analyze_opt ::= ANALYZE */ - { 265, 0 }, /* (222) explain_options ::= */ - { 265, -3 }, /* (223) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 265, -3 }, /* (224) explain_options ::= explain_options RATIO NK_FLOAT */ - { 210, -6 }, /* (225) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 210, -9 }, /* (226) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 210, -3 }, /* (227) cmd ::= DROP FUNCTION function_name */ - { 266, 0 }, /* (228) agg_func_opt ::= */ - { 266, -1 }, /* (229) agg_func_opt ::= AGGREGATE */ - { 267, 0 }, /* (230) bufsize_opt ::= */ - { 267, -2 }, /* (231) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 210, -7 }, /* (232) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ - { 210, -3 }, /* (233) cmd ::= DROP STREAM stream_name */ - { 210, -3 }, /* (234) cmd ::= KILL CONNECTION NK_INTEGER */ - { 210, -3 }, /* (235) cmd ::= KILL QUERY NK_INTEGER */ - { 210, -4 }, /* (236) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 210, -4 }, /* (237) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 210, -3 }, /* (238) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 269, -2 }, /* (239) dnode_list ::= DNODE NK_INTEGER */ - { 269, -3 }, /* (240) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 210, -3 }, /* (241) cmd ::= SYNCDB db_name REPLICA */ - { 210, -1 }, /* (242) cmd ::= query_expression */ - { 213, -1 }, /* (243) literal ::= NK_INTEGER */ - { 213, -1 }, /* (244) literal ::= NK_FLOAT */ - { 213, -1 }, /* (245) literal ::= NK_STRING */ - { 213, -1 }, /* (246) literal ::= NK_BOOL */ - { 213, -2 }, /* (247) literal ::= TIMESTAMP NK_STRING */ - { 213, -1 }, /* (248) literal ::= duration_literal */ - { 213, -1 }, /* (249) literal ::= NULL */ - { 258, -1 }, /* (250) duration_literal ::= NK_VARIABLE */ - { 270, -1 }, /* (251) signed ::= NK_INTEGER */ - { 270, -2 }, /* (252) signed ::= NK_PLUS NK_INTEGER */ - { 270, -2 }, /* (253) signed ::= NK_MINUS NK_INTEGER */ - { 270, -1 }, /* (254) signed ::= NK_FLOAT */ - { 270, -2 }, /* (255) signed ::= NK_PLUS NK_FLOAT */ - { 270, -2 }, /* (256) signed ::= NK_MINUS NK_FLOAT */ - { 271, -1 }, /* (257) signed_literal ::= signed */ - { 271, -1 }, /* (258) signed_literal ::= NK_STRING */ - { 271, -1 }, /* (259) signed_literal ::= NK_BOOL */ - { 271, -2 }, /* (260) signed_literal ::= TIMESTAMP NK_STRING */ - { 271, -1 }, /* (261) signed_literal ::= duration_literal */ - { 271, -1 }, /* (262) signed_literal ::= NULL */ - { 241, -1 }, /* (263) literal_list ::= signed_literal */ - { 241, -3 }, /* (264) literal_list ::= literal_list NK_COMMA signed_literal */ - { 219, -1 }, /* (265) db_name ::= NK_ID */ - { 244, -1 }, /* (266) table_name ::= NK_ID */ - { 237, -1 }, /* (267) column_name ::= NK_ID */ - { 254, -1 }, /* (268) function_name ::= NK_ID */ - { 254, -1 }, /* (269) function_name ::= FIRST */ - { 254, -1 }, /* (270) function_name ::= LAST */ - { 272, -1 }, /* (271) table_alias ::= NK_ID */ - { 273, -1 }, /* (272) column_alias ::= NK_ID */ - { 215, -1 }, /* (273) user_name ::= NK_ID */ - { 255, -1 }, /* (274) index_name ::= NK_ID */ - { 262, -1 }, /* (275) topic_name ::= NK_ID */ - { 268, -1 }, /* (276) stream_name ::= NK_ID */ - { 274, -1 }, /* (277) expression ::= literal */ - { 274, -1 }, /* (278) expression ::= pseudo_column */ - { 274, -1 }, /* (279) expression ::= column_reference */ - { 274, -4 }, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ - { 274, -4 }, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 274, -6 }, /* (282) expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 274, -1 }, /* (283) expression ::= subquery */ - { 274, -3 }, /* (284) expression ::= NK_LP expression NK_RP */ - { 274, -2 }, /* (285) expression ::= NK_PLUS expression */ - { 274, -2 }, /* (286) expression ::= NK_MINUS expression */ - { 274, -3 }, /* (287) expression ::= expression NK_PLUS expression */ - { 274, -3 }, /* (288) expression ::= expression NK_MINUS expression */ - { 274, -3 }, /* (289) expression ::= expression NK_STAR expression */ - { 274, -3 }, /* (290) expression ::= expression NK_SLASH expression */ - { 274, -3 }, /* (291) expression ::= expression NK_REM expression */ - { 261, -1 }, /* (292) expression_list ::= expression */ - { 261, -3 }, /* (293) expression_list ::= expression_list NK_COMMA expression */ - { 276, -1 }, /* (294) column_reference ::= column_name */ - { 276, -3 }, /* (295) column_reference ::= table_name NK_DOT column_name */ - { 275, -1 }, /* (296) pseudo_column ::= NOW */ - { 275, -1 }, /* (297) pseudo_column ::= TODAY */ - { 275, -1 }, /* (298) pseudo_column ::= ROWTS */ - { 275, -1 }, /* (299) pseudo_column ::= TBNAME */ - { 275, -1 }, /* (300) pseudo_column ::= QSTARTTS */ - { 275, -1 }, /* (301) pseudo_column ::= QENDTS */ - { 275, -1 }, /* (302) pseudo_column ::= WSTARTTS */ - { 275, -1 }, /* (303) pseudo_column ::= WENDTS */ - { 275, -1 }, /* (304) pseudo_column ::= WDURATION */ - { 278, -3 }, /* (305) predicate ::= expression compare_op expression */ - { 278, -5 }, /* (306) predicate ::= expression BETWEEN expression AND expression */ - { 278, -6 }, /* (307) predicate ::= expression NOT BETWEEN expression AND expression */ - { 278, -3 }, /* (308) predicate ::= expression IS NULL */ - { 278, -4 }, /* (309) predicate ::= expression IS NOT NULL */ - { 278, -3 }, /* (310) predicate ::= expression in_op in_predicate_value */ - { 279, -1 }, /* (311) compare_op ::= NK_LT */ - { 279, -1 }, /* (312) compare_op ::= NK_GT */ - { 279, -1 }, /* (313) compare_op ::= NK_LE */ - { 279, -1 }, /* (314) compare_op ::= NK_GE */ - { 279, -1 }, /* (315) compare_op ::= NK_NE */ - { 279, -1 }, /* (316) compare_op ::= NK_EQ */ - { 279, -1 }, /* (317) compare_op ::= LIKE */ - { 279, -2 }, /* (318) compare_op ::= NOT LIKE */ - { 279, -1 }, /* (319) compare_op ::= MATCH */ - { 279, -1 }, /* (320) compare_op ::= NMATCH */ - { 280, -1 }, /* (321) in_op ::= IN */ - { 280, -2 }, /* (322) in_op ::= NOT IN */ - { 281, -3 }, /* (323) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 282, -1 }, /* (324) boolean_value_expression ::= boolean_primary */ - { 282, -2 }, /* (325) boolean_value_expression ::= NOT boolean_primary */ - { 282, -3 }, /* (326) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 282, -3 }, /* (327) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 283, -1 }, /* (328) boolean_primary ::= predicate */ - { 283, -3 }, /* (329) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 284, -1 }, /* (330) common_expression ::= expression */ - { 284, -1 }, /* (331) common_expression ::= boolean_value_expression */ - { 285, -2 }, /* (332) from_clause ::= FROM table_reference_list */ - { 286, -1 }, /* (333) table_reference_list ::= table_reference */ - { 286, -3 }, /* (334) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 287, -1 }, /* (335) table_reference ::= table_primary */ - { 287, -1 }, /* (336) table_reference ::= joined_table */ - { 288, -2 }, /* (337) table_primary ::= table_name alias_opt */ - { 288, -4 }, /* (338) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 288, -2 }, /* (339) table_primary ::= subquery alias_opt */ - { 288, -1 }, /* (340) table_primary ::= parenthesized_joined_table */ - { 290, 0 }, /* (341) alias_opt ::= */ - { 290, -1 }, /* (342) alias_opt ::= table_alias */ - { 290, -2 }, /* (343) alias_opt ::= AS table_alias */ - { 291, -3 }, /* (344) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 291, -3 }, /* (345) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 289, -6 }, /* (346) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 292, 0 }, /* (347) join_type ::= */ - { 292, -1 }, /* (348) join_type ::= INNER */ - { 294, -9 }, /* (349) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 295, 0 }, /* (350) set_quantifier_opt ::= */ - { 295, -1 }, /* (351) set_quantifier_opt ::= DISTINCT */ - { 295, -1 }, /* (352) set_quantifier_opt ::= ALL */ - { 296, -1 }, /* (353) select_list ::= NK_STAR */ - { 296, -1 }, /* (354) select_list ::= select_sublist */ - { 302, -1 }, /* (355) select_sublist ::= select_item */ - { 302, -3 }, /* (356) select_sublist ::= select_sublist NK_COMMA select_item */ - { 303, -1 }, /* (357) select_item ::= common_expression */ - { 303, -2 }, /* (358) select_item ::= common_expression column_alias */ - { 303, -3 }, /* (359) select_item ::= common_expression AS column_alias */ - { 303, -3 }, /* (360) select_item ::= table_name NK_DOT NK_STAR */ - { 297, 0 }, /* (361) where_clause_opt ::= */ - { 297, -2 }, /* (362) where_clause_opt ::= WHERE search_condition */ - { 298, 0 }, /* (363) partition_by_clause_opt ::= */ - { 298, -3 }, /* (364) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 299, 0 }, /* (365) twindow_clause_opt ::= */ - { 299, -6 }, /* (366) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 299, -4 }, /* (367) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 299, -6 }, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 299, -8 }, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 259, 0 }, /* (370) sliding_opt ::= */ - { 259, -4 }, /* (371) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 304, 0 }, /* (372) fill_opt ::= */ - { 304, -4 }, /* (373) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 304, -6 }, /* (374) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 305, -1 }, /* (375) fill_mode ::= NONE */ - { 305, -1 }, /* (376) fill_mode ::= PREV */ - { 305, -1 }, /* (377) fill_mode ::= NULL */ - { 305, -1 }, /* (378) fill_mode ::= LINEAR */ - { 305, -1 }, /* (379) fill_mode ::= NEXT */ - { 300, 0 }, /* (380) group_by_clause_opt ::= */ - { 300, -3 }, /* (381) group_by_clause_opt ::= GROUP BY group_by_list */ - { 306, -1 }, /* (382) group_by_list ::= expression */ - { 306, -3 }, /* (383) group_by_list ::= group_by_list NK_COMMA expression */ - { 301, 0 }, /* (384) having_clause_opt ::= */ - { 301, -2 }, /* (385) having_clause_opt ::= HAVING search_condition */ - { 263, -4 }, /* (386) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 307, -1 }, /* (387) query_expression_body ::= query_primary */ - { 307, -4 }, /* (388) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 311, -1 }, /* (389) query_primary ::= query_specification */ - { 308, 0 }, /* (390) order_by_clause_opt ::= */ - { 308, -3 }, /* (391) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 309, 0 }, /* (392) slimit_clause_opt ::= */ - { 309, -2 }, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 309, -4 }, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 309, -4 }, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 310, 0 }, /* (396) limit_clause_opt ::= */ - { 310, -2 }, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 310, -4 }, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 310, -4 }, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 277, -3 }, /* (400) subquery ::= NK_LP query_expression NK_RP */ - { 293, -1 }, /* (401) search_condition ::= common_expression */ - { 312, -1 }, /* (402) sort_specification_list ::= sort_specification */ - { 312, -3 }, /* (403) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 313, -3 }, /* (404) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 314, 0 }, /* (405) ordering_specification_opt ::= */ - { 314, -1 }, /* (406) ordering_specification_opt ::= ASC */ - { 314, -1 }, /* (407) ordering_specification_opt ::= DESC */ - { 315, 0 }, /* (408) null_ordering_opt ::= */ - { 315, -2 }, /* (409) null_ordering_opt ::= NULLS FIRST */ - { 315, -2 }, /* (410) null_ordering_opt ::= NULLS LAST */ + { 219, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 219, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 220, 0 }, /* (2) account_options ::= */ + { 220, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 220, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 220, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 220, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 220, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 220, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 220, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 220, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 220, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 221, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 221, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 223, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 223, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 223, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 223, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 223, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 223, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 223, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 223, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 223, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 223, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 219, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 219, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 219, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 219, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 219, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 219, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 219, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 219, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 219, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 219, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 219, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 219, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 225, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 226, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 226, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 219, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 219, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 219, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 219, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ + { 219, -2 }, /* (51) cmd ::= USE db_name */ + { 219, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 227, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ + { 227, 0 }, /* (54) not_exists_opt ::= */ + { 230, -2 }, /* (55) exists_opt ::= IF EXISTS */ + { 230, 0 }, /* (56) exists_opt ::= */ + { 229, 0 }, /* (57) db_options ::= */ + { 229, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ + { 229, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ + { 229, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ + { 229, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ + { 229, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ + { 229, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ + { 229, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ + { 229, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ + { 229, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ + { 229, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ + { 229, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ + { 229, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ + { 229, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ + { 229, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ + { 229, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ + { 229, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ + { 229, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ + { 229, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 229, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 229, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ + { 231, -1 }, /* (78) alter_db_options ::= alter_db_option */ + { 231, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ + { 235, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ + { 235, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ + { 235, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ + { 235, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ + { 235, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ + { 235, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ + { 235, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ + { 235, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ + { 232, -1 }, /* (88) integer_list ::= NK_INTEGER */ + { 232, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 233, -1 }, /* (90) variable_list ::= NK_VARIABLE */ + { 233, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 234, -1 }, /* (92) retention_list ::= retention */ + { 234, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ + { 236, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 219, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 219, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ + { 219, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 219, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ + { 219, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ + { 219, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ + { 219, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ + { 244, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ + { 244, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 244, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 244, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 244, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 244, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 244, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 244, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 244, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 244, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 241, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ + { 241, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 248, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 243, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ + { 243, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 251, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ + { 249, 0 }, /* (118) specific_tags_opt ::= */ + { 249, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 237, -1 }, /* (120) full_table_name ::= table_name */ + { 237, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ + { 238, -1 }, /* (122) column_def_list ::= column_def */ + { 238, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ + { 254, -2 }, /* (124) column_def ::= column_name type_name */ + { 254, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ + { 247, -1 }, /* (126) type_name ::= BOOL */ + { 247, -1 }, /* (127) type_name ::= TINYINT */ + { 247, -1 }, /* (128) type_name ::= SMALLINT */ + { 247, -1 }, /* (129) type_name ::= INT */ + { 247, -1 }, /* (130) type_name ::= INTEGER */ + { 247, -1 }, /* (131) type_name ::= BIGINT */ + { 247, -1 }, /* (132) type_name ::= FLOAT */ + { 247, -1 }, /* (133) type_name ::= DOUBLE */ + { 247, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (135) type_name ::= TIMESTAMP */ + { 247, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 247, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ + { 247, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ + { 247, -2 }, /* (139) type_name ::= INT UNSIGNED */ + { 247, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ + { 247, -1 }, /* (141) type_name ::= JSON */ + { 247, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (143) type_name ::= MEDIUMBLOB */ + { 247, -1 }, /* (144) type_name ::= BLOB */ + { 247, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (146) type_name ::= DECIMAL */ + { 247, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 247, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 239, 0 }, /* (149) tags_def_opt ::= */ + { 239, -1 }, /* (150) tags_def_opt ::= tags_def */ + { 242, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 240, 0 }, /* (152) table_options ::= */ + { 240, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ + { 240, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ + { 240, -3 }, /* (155) table_options ::= table_options KEEP variable_list */ + { 240, -3 }, /* (156) table_options ::= table_options TTL NK_INTEGER */ + { 240, -5 }, /* (157) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 240, -5 }, /* (158) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 240, -3 }, /* (159) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 240, -3 }, /* (160) table_options ::= table_options DELAY NK_INTEGER */ + { 245, -1 }, /* (161) alter_table_options ::= alter_table_option */ + { 245, -2 }, /* (162) alter_table_options ::= alter_table_options alter_table_option */ + { 256, -2 }, /* (163) alter_table_option ::= COMMENT NK_STRING */ + { 256, -2 }, /* (164) alter_table_option ::= KEEP integer_list */ + { 256, -2 }, /* (165) alter_table_option ::= KEEP variable_list */ + { 256, -2 }, /* (166) alter_table_option ::= TTL NK_INTEGER */ + { 252, -1 }, /* (167) col_name_list ::= col_name */ + { 252, -3 }, /* (168) col_name_list ::= col_name_list NK_COMMA col_name */ + { 257, -1 }, /* (169) col_name ::= column_name */ + { 219, -2 }, /* (170) cmd ::= SHOW DNODES */ + { 219, -2 }, /* (171) cmd ::= SHOW USERS */ + { 219, -2 }, /* (172) cmd ::= SHOW DATABASES */ + { 219, -4 }, /* (173) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 219, -4 }, /* (174) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 219, -3 }, /* (175) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 219, -2 }, /* (176) cmd ::= SHOW MNODES */ + { 219, -2 }, /* (177) cmd ::= SHOW MODULES */ + { 219, -2 }, /* (178) cmd ::= SHOW QNODES */ + { 219, -2 }, /* (179) cmd ::= SHOW FUNCTIONS */ + { 219, -5 }, /* (180) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 219, -2 }, /* (181) cmd ::= SHOW STREAMS */ + { 219, -2 }, /* (182) cmd ::= SHOW ACCOUNTS */ + { 219, -2 }, /* (183) cmd ::= SHOW APPS */ + { 219, -2 }, /* (184) cmd ::= SHOW CONNECTIONS */ + { 219, -2 }, /* (185) cmd ::= SHOW LICENCE */ + { 219, -2 }, /* (186) cmd ::= SHOW GRANTS */ + { 219, -4 }, /* (187) cmd ::= SHOW CREATE DATABASE db_name */ + { 219, -4 }, /* (188) cmd ::= SHOW CREATE TABLE full_table_name */ + { 219, -4 }, /* (189) cmd ::= SHOW CREATE STABLE full_table_name */ + { 219, -2 }, /* (190) cmd ::= SHOW QUERIES */ + { 219, -2 }, /* (191) cmd ::= SHOW SCORES */ + { 219, -2 }, /* (192) cmd ::= SHOW TOPICS */ + { 219, -2 }, /* (193) cmd ::= SHOW VARIABLES */ + { 219, -2 }, /* (194) cmd ::= SHOW BNODES */ + { 219, -2 }, /* (195) cmd ::= SHOW SNODES */ + { 258, 0 }, /* (196) db_name_cond_opt ::= */ + { 258, -2 }, /* (197) db_name_cond_opt ::= db_name NK_DOT */ + { 259, 0 }, /* (198) like_pattern_opt ::= */ + { 259, -2 }, /* (199) like_pattern_opt ::= LIKE NK_STRING */ + { 260, -1 }, /* (200) table_name_cond ::= table_name */ + { 261, 0 }, /* (201) from_db_opt ::= */ + { 261, -2 }, /* (202) from_db_opt ::= FROM db_name */ + { 255, -1 }, /* (203) func_name_list ::= func_name */ + { 255, -3 }, /* (204) func_name_list ::= func_name_list NK_COMMA col_name */ + { 262, -1 }, /* (205) func_name ::= function_name */ + { 219, -8 }, /* (206) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 219, -10 }, /* (207) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 219, -6 }, /* (208) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 265, 0 }, /* (209) index_options ::= */ + { 265, -9 }, /* (210) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 265, -11 }, /* (211) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 266, -1 }, /* (212) func_list ::= func */ + { 266, -3 }, /* (213) func_list ::= func_list NK_COMMA func */ + { 269, -4 }, /* (214) func ::= function_name NK_LP expression_list NK_RP */ + { 219, -6 }, /* (215) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 219, -6 }, /* (216) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 219, -4 }, /* (217) cmd ::= DROP TOPIC exists_opt topic_name */ + { 219, -2 }, /* (218) cmd ::= DESC full_table_name */ + { 219, -2 }, /* (219) cmd ::= DESCRIBE full_table_name */ + { 219, -3 }, /* (220) cmd ::= RESET QUERY CACHE */ + { 219, -4 }, /* (221) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 273, 0 }, /* (222) analyze_opt ::= */ + { 273, -1 }, /* (223) analyze_opt ::= ANALYZE */ + { 274, 0 }, /* (224) explain_options ::= */ + { 274, -3 }, /* (225) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 274, -3 }, /* (226) explain_options ::= explain_options RATIO NK_FLOAT */ + { 219, -6 }, /* (227) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 219, -9 }, /* (228) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 219, -3 }, /* (229) cmd ::= DROP FUNCTION function_name */ + { 275, 0 }, /* (230) agg_func_opt ::= */ + { 275, -1 }, /* (231) agg_func_opt ::= AGGREGATE */ + { 276, 0 }, /* (232) bufsize_opt ::= */ + { 276, -2 }, /* (233) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 219, -8 }, /* (234) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 219, -4 }, /* (235) cmd ::= DROP STREAM exists_opt stream_name */ + { 279, 0 }, /* (236) into_opt ::= */ + { 279, -2 }, /* (237) into_opt ::= INTO full_table_name */ + { 278, 0 }, /* (238) stream_options ::= */ + { 278, -3 }, /* (239) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 278, -3 }, /* (240) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 278, -3 }, /* (241) stream_options ::= stream_options WATERMARK duration_literal */ + { 219, -3 }, /* (242) cmd ::= KILL CONNECTION NK_INTEGER */ + { 219, -3 }, /* (243) cmd ::= KILL QUERY NK_INTEGER */ + { 219, -4 }, /* (244) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 219, -4 }, /* (245) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 219, -3 }, /* (246) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 280, -2 }, /* (247) dnode_list ::= DNODE NK_INTEGER */ + { 280, -3 }, /* (248) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 219, -3 }, /* (249) cmd ::= SYNCDB db_name REPLICA */ + { 219, -1 }, /* (250) cmd ::= query_expression */ + { 222, -1 }, /* (251) literal ::= NK_INTEGER */ + { 222, -1 }, /* (252) literal ::= NK_FLOAT */ + { 222, -1 }, /* (253) literal ::= NK_STRING */ + { 222, -1 }, /* (254) literal ::= NK_BOOL */ + { 222, -2 }, /* (255) literal ::= TIMESTAMP NK_STRING */ + { 222, -1 }, /* (256) literal ::= duration_literal */ + { 222, -1 }, /* (257) literal ::= NULL */ + { 222, -1 }, /* (258) literal ::= NK_QUESTION */ + { 267, -1 }, /* (259) duration_literal ::= NK_VARIABLE */ + { 281, -1 }, /* (260) signed ::= NK_INTEGER */ + { 281, -2 }, /* (261) signed ::= NK_PLUS NK_INTEGER */ + { 281, -2 }, /* (262) signed ::= NK_MINUS NK_INTEGER */ + { 281, -1 }, /* (263) signed ::= NK_FLOAT */ + { 281, -2 }, /* (264) signed ::= NK_PLUS NK_FLOAT */ + { 281, -2 }, /* (265) signed ::= NK_MINUS NK_FLOAT */ + { 282, -1 }, /* (266) signed_literal ::= signed */ + { 282, -1 }, /* (267) signed_literal ::= NK_STRING */ + { 282, -1 }, /* (268) signed_literal ::= NK_BOOL */ + { 282, -2 }, /* (269) signed_literal ::= TIMESTAMP NK_STRING */ + { 282, -1 }, /* (270) signed_literal ::= duration_literal */ + { 282, -1 }, /* (271) signed_literal ::= NULL */ + { 250, -1 }, /* (272) literal_list ::= signed_literal */ + { 250, -3 }, /* (273) literal_list ::= literal_list NK_COMMA signed_literal */ + { 228, -1 }, /* (274) db_name ::= NK_ID */ + { 253, -1 }, /* (275) table_name ::= NK_ID */ + { 246, -1 }, /* (276) column_name ::= NK_ID */ + { 263, -1 }, /* (277) function_name ::= NK_ID */ + { 283, -1 }, /* (278) table_alias ::= NK_ID */ + { 284, -1 }, /* (279) column_alias ::= NK_ID */ + { 224, -1 }, /* (280) user_name ::= NK_ID */ + { 264, -1 }, /* (281) index_name ::= NK_ID */ + { 271, -1 }, /* (282) topic_name ::= NK_ID */ + { 277, -1 }, /* (283) stream_name ::= NK_ID */ + { 285, -1 }, /* (284) expression ::= literal */ + { 285, -1 }, /* (285) expression ::= pseudo_column */ + { 285, -1 }, /* (286) expression ::= column_reference */ + { 285, -1 }, /* (287) expression ::= function_expression */ + { 285, -1 }, /* (288) expression ::= subquery */ + { 285, -3 }, /* (289) expression ::= NK_LP expression NK_RP */ + { 285, -2 }, /* (290) expression ::= NK_PLUS expression */ + { 285, -2 }, /* (291) expression ::= NK_MINUS expression */ + { 285, -3 }, /* (292) expression ::= expression NK_PLUS expression */ + { 285, -3 }, /* (293) expression ::= expression NK_MINUS expression */ + { 285, -3 }, /* (294) expression ::= expression NK_STAR expression */ + { 285, -3 }, /* (295) expression ::= expression NK_SLASH expression */ + { 285, -3 }, /* (296) expression ::= expression NK_REM expression */ + { 285, -3 }, /* (297) expression ::= column_reference NK_ARROW NK_STRING */ + { 270, -1 }, /* (298) expression_list ::= expression */ + { 270, -3 }, /* (299) expression_list ::= expression_list NK_COMMA expression */ + { 287, -1 }, /* (300) column_reference ::= column_name */ + { 287, -3 }, /* (301) column_reference ::= table_name NK_DOT column_name */ + { 286, -1 }, /* (302) pseudo_column ::= NOW */ + { 286, -1 }, /* (303) pseudo_column ::= TODAY */ + { 286, -1 }, /* (304) pseudo_column ::= ROWTS */ + { 286, -1 }, /* (305) pseudo_column ::= TBNAME */ + { 286, -1 }, /* (306) pseudo_column ::= QSTARTTS */ + { 286, -1 }, /* (307) pseudo_column ::= QENDTS */ + { 286, -1 }, /* (308) pseudo_column ::= WSTARTTS */ + { 286, -1 }, /* (309) pseudo_column ::= WENDTS */ + { 286, -1 }, /* (310) pseudo_column ::= WDURATION */ + { 288, -4 }, /* (311) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 288, -4 }, /* (312) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 288, -6 }, /* (313) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 290, -1 }, /* (314) star_func ::= COUNT */ + { 290, -1 }, /* (315) star_func ::= FIRST */ + { 290, -1 }, /* (316) star_func ::= LAST */ + { 290, -1 }, /* (317) star_func ::= LAST_ROW */ + { 291, -1 }, /* (318) star_func_para_list ::= NK_STAR */ + { 291, -1 }, /* (319) star_func_para_list ::= other_para_list */ + { 292, -1 }, /* (320) other_para_list ::= star_func_para */ + { 292, -3 }, /* (321) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 293, -1 }, /* (322) star_func_para ::= expression */ + { 293, -3 }, /* (323) star_func_para ::= table_name NK_DOT NK_STAR */ + { 294, -3 }, /* (324) predicate ::= expression compare_op expression */ + { 294, -5 }, /* (325) predicate ::= expression BETWEEN expression AND expression */ + { 294, -6 }, /* (326) predicate ::= expression NOT BETWEEN expression AND expression */ + { 294, -3 }, /* (327) predicate ::= expression IS NULL */ + { 294, -4 }, /* (328) predicate ::= expression IS NOT NULL */ + { 294, -3 }, /* (329) predicate ::= expression in_op in_predicate_value */ + { 295, -1 }, /* (330) compare_op ::= NK_LT */ + { 295, -1 }, /* (331) compare_op ::= NK_GT */ + { 295, -1 }, /* (332) compare_op ::= NK_LE */ + { 295, -1 }, /* (333) compare_op ::= NK_GE */ + { 295, -1 }, /* (334) compare_op ::= NK_NE */ + { 295, -1 }, /* (335) compare_op ::= NK_EQ */ + { 295, -1 }, /* (336) compare_op ::= LIKE */ + { 295, -2 }, /* (337) compare_op ::= NOT LIKE */ + { 295, -1 }, /* (338) compare_op ::= MATCH */ + { 295, -1 }, /* (339) compare_op ::= NMATCH */ + { 295, -1 }, /* (340) compare_op ::= CONTAINS */ + { 296, -1 }, /* (341) in_op ::= IN */ + { 296, -2 }, /* (342) in_op ::= NOT IN */ + { 297, -3 }, /* (343) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 298, -1 }, /* (344) boolean_value_expression ::= boolean_primary */ + { 298, -2 }, /* (345) boolean_value_expression ::= NOT boolean_primary */ + { 298, -3 }, /* (346) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 298, -3 }, /* (347) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 299, -1 }, /* (348) boolean_primary ::= predicate */ + { 299, -3 }, /* (349) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 300, -1 }, /* (350) common_expression ::= expression */ + { 300, -1 }, /* (351) common_expression ::= boolean_value_expression */ + { 301, -2 }, /* (352) from_clause ::= FROM table_reference_list */ + { 302, -1 }, /* (353) table_reference_list ::= table_reference */ + { 302, -3 }, /* (354) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 303, -1 }, /* (355) table_reference ::= table_primary */ + { 303, -1 }, /* (356) table_reference ::= joined_table */ + { 304, -2 }, /* (357) table_primary ::= table_name alias_opt */ + { 304, -4 }, /* (358) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 304, -2 }, /* (359) table_primary ::= subquery alias_opt */ + { 304, -1 }, /* (360) table_primary ::= parenthesized_joined_table */ + { 306, 0 }, /* (361) alias_opt ::= */ + { 306, -1 }, /* (362) alias_opt ::= table_alias */ + { 306, -2 }, /* (363) alias_opt ::= AS table_alias */ + { 307, -3 }, /* (364) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 307, -3 }, /* (365) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 305, -6 }, /* (366) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 308, 0 }, /* (367) join_type ::= */ + { 308, -1 }, /* (368) join_type ::= INNER */ + { 310, -9 }, /* (369) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 311, 0 }, /* (370) set_quantifier_opt ::= */ + { 311, -1 }, /* (371) set_quantifier_opt ::= DISTINCT */ + { 311, -1 }, /* (372) set_quantifier_opt ::= ALL */ + { 312, -1 }, /* (373) select_list ::= NK_STAR */ + { 312, -1 }, /* (374) select_list ::= select_sublist */ + { 318, -1 }, /* (375) select_sublist ::= select_item */ + { 318, -3 }, /* (376) select_sublist ::= select_sublist NK_COMMA select_item */ + { 319, -1 }, /* (377) select_item ::= common_expression */ + { 319, -2 }, /* (378) select_item ::= common_expression column_alias */ + { 319, -3 }, /* (379) select_item ::= common_expression AS column_alias */ + { 319, -3 }, /* (380) select_item ::= table_name NK_DOT NK_STAR */ + { 313, 0 }, /* (381) where_clause_opt ::= */ + { 313, -2 }, /* (382) where_clause_opt ::= WHERE search_condition */ + { 314, 0 }, /* (383) partition_by_clause_opt ::= */ + { 314, -3 }, /* (384) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 315, 0 }, /* (385) twindow_clause_opt ::= */ + { 315, -6 }, /* (386) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 315, -4 }, /* (387) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 315, -6 }, /* (388) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 315, -8 }, /* (389) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 268, 0 }, /* (390) sliding_opt ::= */ + { 268, -4 }, /* (391) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 320, 0 }, /* (392) fill_opt ::= */ + { 320, -4 }, /* (393) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 320, -6 }, /* (394) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 321, -1 }, /* (395) fill_mode ::= NONE */ + { 321, -1 }, /* (396) fill_mode ::= PREV */ + { 321, -1 }, /* (397) fill_mode ::= NULL */ + { 321, -1 }, /* (398) fill_mode ::= LINEAR */ + { 321, -1 }, /* (399) fill_mode ::= NEXT */ + { 316, 0 }, /* (400) group_by_clause_opt ::= */ + { 316, -3 }, /* (401) group_by_clause_opt ::= GROUP BY group_by_list */ + { 322, -1 }, /* (402) group_by_list ::= expression */ + { 322, -3 }, /* (403) group_by_list ::= group_by_list NK_COMMA expression */ + { 317, 0 }, /* (404) having_clause_opt ::= */ + { 317, -2 }, /* (405) having_clause_opt ::= HAVING search_condition */ + { 272, -4 }, /* (406) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 323, -1 }, /* (407) query_expression_body ::= query_primary */ + { 323, -4 }, /* (408) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 327, -1 }, /* (409) query_primary ::= query_specification */ + { 324, 0 }, /* (410) order_by_clause_opt ::= */ + { 324, -3 }, /* (411) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 325, 0 }, /* (412) slimit_clause_opt ::= */ + { 325, -2 }, /* (413) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 325, -4 }, /* (414) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 325, -4 }, /* (415) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 326, 0 }, /* (416) limit_clause_opt ::= */ + { 326, -2 }, /* (417) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 326, -4 }, /* (418) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 326, -4 }, /* (419) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 289, -3 }, /* (420) subquery ::= NK_LP query_expression NK_RP */ + { 309, -1 }, /* (421) search_condition ::= common_expression */ + { 328, -1 }, /* (422) sort_specification_list ::= sort_specification */ + { 328, -3 }, /* (423) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 329, -3 }, /* (424) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 330, 0 }, /* (425) ordering_specification_opt ::= */ + { 330, -1 }, /* (426) ordering_specification_opt ::= ASC */ + { 330, -1 }, /* (427) ordering_specification_opt ::= DESC */ + { 331, 0 }, /* (428) null_ordering_opt ::= */ + { 331, -2 }, /* (429) null_ordering_opt ::= NULLS FIRST */ + { 331, -2 }, /* (430) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2603,11 +2720,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,211,&yymsp[0].minor); + yy_destructor(yypParser,220,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,212,&yymsp[0].minor); + yy_destructor(yypParser,221,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2621,20 +2738,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,211,&yymsp[-2].minor); +{ yy_destructor(yypParser,220,&yymsp[-2].minor); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,214,&yymsp[0].minor); +{ yy_destructor(yypParser,223,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,212,&yymsp[-1].minor); +{ yy_destructor(yypParser,221,&yymsp[-1].minor); { } - yy_destructor(yypParser,214,&yymsp[0].minor); + yy_destructor(yypParser,223,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2648,31 +2765,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy353); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy409, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy353, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy353); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2689,20 +2806,22 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 265: /* db_name ::= NK_ID */ yytestcase(yyruleno==265); - case 266: /* table_name ::= NK_ID */ yytestcase(yyruleno==266); - case 267: /* column_name ::= NK_ID */ yytestcase(yyruleno==267); - case 268: /* function_name ::= NK_ID */ yytestcase(yyruleno==268); - case 269: /* function_name ::= FIRST */ yytestcase(yyruleno==269); - case 270: /* function_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* table_alias ::= NK_ID */ yytestcase(yyruleno==271); - case 272: /* column_alias ::= NK_ID */ yytestcase(yyruleno==272); - case 273: /* user_name ::= NK_ID */ yytestcase(yyruleno==273); - case 274: /* index_name ::= NK_ID */ yytestcase(yyruleno==274); - case 275: /* topic_name ::= NK_ID */ yytestcase(yyruleno==275); - case 276: /* stream_name ::= NK_ID */ yytestcase(yyruleno==276); -{ yylhsminor.yy409 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 274: /* db_name ::= NK_ID */ yytestcase(yyruleno==274); + case 275: /* table_name ::= NK_ID */ yytestcase(yyruleno==275); + case 276: /* column_name ::= NK_ID */ yytestcase(yyruleno==276); + case 277: /* function_name ::= NK_ID */ yytestcase(yyruleno==277); + case 278: /* table_alias ::= NK_ID */ yytestcase(yyruleno==278); + case 279: /* column_alias ::= NK_ID */ yytestcase(yyruleno==279); + case 280: /* user_name ::= NK_ID */ yytestcase(yyruleno==280); + case 281: /* index_name ::= NK_ID */ yytestcase(yyruleno==281); + case 282: /* topic_name ::= NK_ID */ yytestcase(yyruleno==282); + case 283: /* stream_name ::= NK_ID */ yytestcase(yyruleno==283); + case 314: /* star_func ::= COUNT */ yytestcase(yyruleno==314); + case 315: /* star_func ::= FIRST */ yytestcase(yyruleno==315); + case 316: /* star_func ::= LAST */ yytestcase(yyruleno==316); + case 317: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==317); +{ yylhsminor.yy353 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy353 = yylhsminor.yy353; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2735,1083 +2854,1123 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 49: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy121, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy273, &yymsp[-1].minor.yy353, yymsp[0].minor.yy192); } break; case 50: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; case 51: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } break; case 52: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy192); } break; case 53: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy121 = true; } +{ yymsp[-2].minor.yy273 = true; } break; case 54: /* not_exists_opt ::= */ case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); - case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); - case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); - case 350: /* set_quantifier_opt ::= */ yytestcase(yyruleno==350); -{ yymsp[1].minor.yy121 = false; } + case 222: /* analyze_opt ::= */ yytestcase(yyruleno==222); + case 230: /* agg_func_opt ::= */ yytestcase(yyruleno==230); + case 370: /* set_quantifier_opt ::= */ yytestcase(yyruleno==370); +{ yymsp[1].minor.yy273 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy121 = true; } +{ yymsp[-1].minor.yy273 = true; } break; case 57: /* db_options ::= */ -{ yymsp[1].minor.yy504 = createDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy192 = createDatabaseOptions(pCxt); } break; case 58: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 59: /* db_options ::= db_options CACHE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 60: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 61: /* db_options ::= db_options COMP NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 62: /* db_options ::= db_options DAYS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 63: /* db_options ::= db_options DAYS NK_VARIABLE */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 64: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 65: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 66: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 67: /* db_options ::= db_options KEEP integer_list */ case 68: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==68); -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pKeep = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 69: /* db_options ::= db_options PRECISION NK_STRING */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 70: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 71: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 72: /* db_options ::= db_options TTL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 73: /* db_options ::= db_options WAL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 74: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 75: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 76: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 77: /* db_options ::= db_options RETENTIONS retention_list */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pRetentions = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pRetentions = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 78: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy504 = createDatabaseOptions(pCxt); yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createDatabaseOptions(pCxt); yylhsminor.yy192 = setDatabaseAlterOption(pCxt, yylhsminor.yy192, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; case 79: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy192, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 80: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 81: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 82: /* alter_db_option ::= KEEP integer_list */ case 83: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==83); -{ yymsp[-1].minor.yy21.type = DB_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } +{ yymsp[-1].minor.yy277.type = DB_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy64; } break; case 84: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_WAL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_WAL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 85: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 86: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 87: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 88: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 89: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 240: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==240); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 248: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==248); +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 90: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy488 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 91: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 92: /* retention_list ::= retention */ case 112: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==112); case 115: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==115); case 122: /* column_def_list ::= column_def */ yytestcase(yyruleno==122); - case 165: /* col_name_list ::= col_name */ yytestcase(yyruleno==165); - case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); - case 210: /* func_list ::= func */ yytestcase(yyruleno==210); - case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); - case 355: /* select_sublist ::= select_item */ yytestcase(yyruleno==355); - case 402: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==402); -{ yylhsminor.yy488 = createNodeList(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 167: /* col_name_list ::= col_name */ yytestcase(yyruleno==167); + case 203: /* func_name_list ::= func_name */ yytestcase(yyruleno==203); + case 212: /* func_list ::= func */ yytestcase(yyruleno==212); + case 272: /* literal_list ::= signed_literal */ yytestcase(yyruleno==272); + case 320: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==320); + case 375: /* select_sublist ::= select_item */ yytestcase(yyruleno==375); + case 422: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==422); +{ yylhsminor.yy64 = createNodeList(pCxt, yymsp[0].minor.yy192); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 93: /* retention_list ::= retention_list NK_COMMA retention */ case 123: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==123); - case 166: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==166); - case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); - case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); - case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); - case 356: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==356); - case 403: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==403); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 168: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==168); + case 204: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==204); + case 213: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==213); + case 273: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==273); + case 321: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==321); + case 376: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==376); + case 423: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==423); +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, yymsp[0].minor.yy192); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 94: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy504 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 95: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 97: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==97); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy121, yymsp[-5].minor.yy504, yymsp[-3].minor.yy488, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy273, yymsp[-5].minor.yy192, yymsp[-3].minor.yy64, yymsp[-1].minor.yy64, yymsp[0].minor.yy192); } break; case 96: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy64); } break; case 98: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy64); } break; case 99: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy192); } break; case 100: /* cmd ::= ALTER TABLE alter_table_clause */ case 101: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==101); - case 242: /* cmd ::= query_expression */ yytestcase(yyruleno==242); -{ pCxt->pRootNode = yymsp[0].minor.yy504; } + case 250: /* cmd ::= query_expression */ yytestcase(yyruleno==250); +{ pCxt->pRootNode = yymsp[0].minor.yy192; } break; case 102: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy504 = createAlterTableOption(pCxt, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableOption(pCxt, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 103: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 104: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy192, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 105: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 106: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 107: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 108: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy192, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 109: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 110: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 111: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy504 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy504, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy192, &yymsp[-2].minor.yy353, yymsp[0].minor.yy192); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; case 113: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 116: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==116); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-1].minor.yy64, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy64 = yylhsminor.yy64; break; case 114: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy504 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy121, yymsp[-7].minor.yy504, yymsp[-5].minor.yy504, yymsp[-4].minor.yy488, yymsp[-1].minor.yy488); } - yymsp[-8].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy273, yymsp[-7].minor.yy192, yymsp[-5].minor.yy192, yymsp[-4].minor.yy64, yymsp[-1].minor.yy64); } + yymsp[-8].minor.yy192 = yylhsminor.yy192; break; case 117: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy504 = createDropTableClause(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createDropTableClause(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 363: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==363); - case 380: /* group_by_clause_opt ::= */ yytestcase(yyruleno==380); - case 390: /* order_by_clause_opt ::= */ yytestcase(yyruleno==390); -{ yymsp[1].minor.yy488 = NULL; } + case 383: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==383); + case 400: /* group_by_clause_opt ::= */ yytestcase(yyruleno==400); + case 410: /* order_by_clause_opt ::= */ yytestcase(yyruleno==410); +{ yymsp[1].minor.yy64 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-2].minor.yy64 = yymsp[-1].minor.yy64; } break; case 120: /* full_table_name ::= table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy353, NULL); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; case 121: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createRealTableNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, NULL); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 124: /* column_def ::= column_name type_name */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160, NULL); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536, NULL); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 125: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-2].minor.yy536, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 126: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 127: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 128: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 129: /* type_name ::= INT */ case 130: /* type_name ::= INTEGER */ yytestcase(yyruleno==130); -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_INT); } break; case 131: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 132: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 133: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 134: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 135: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 136: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 137: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 138: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 139: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 140: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 141: /* type_name ::= JSON */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 142: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 143: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 144: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 145: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 147: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 148: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 354: /* select_list ::= select_sublist */ yytestcase(yyruleno==354); -{ yylhsminor.yy488 = yymsp[0].minor.yy488; } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 319: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==319); + case 374: /* select_list ::= select_sublist */ yytestcase(yyruleno==374); +{ yylhsminor.yy64 = yymsp[0].minor.yy64; } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 151: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-3].minor.yy64 = yymsp[-1].minor.yy64; } break; case 152: /* table_options ::= */ -{ yymsp[1].minor.yy504 = createTableOptions(pCxt); } +{ yymsp[1].minor.yy192 = createTableOptions(pCxt); } break; case 153: /* table_options ::= table_options COMMENT NK_STRING */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((STableOptions*)yymsp[-2].minor.yy192)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 154: /* table_options ::= table_options KEEP integer_list */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 155: /* table_options ::= table_options KEEP variable_list */ yytestcase(yyruleno==155); +{ ((STableOptions*)yymsp[-2].minor.yy192)->pKeep = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 155: /* table_options ::= table_options TTL NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 156: /* table_options ::= table_options TTL NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 156: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pSma = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 157: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy192)->pSma = yymsp[-1].minor.yy64; yylhsminor.yy192 = yymsp[-4].minor.yy192; } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 157: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pFuncs = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 158: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy192)->pFuncs = yymsp[-1].minor.yy64; yylhsminor.yy192 = yymsp[-4].minor.yy192; } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 158: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 159: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 159: /* table_options ::= table_options DELAY NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 160: /* table_options ::= table_options DELAY NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 160: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy504 = createTableOptions(pCxt); yylhsminor.yy504 = setTableAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 161: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy192 = createTableOptions(pCxt); yylhsminor.yy192 = setTableAlterOption(pCxt, yylhsminor.yy192, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 161: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy504 = setTableAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 162: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy192 = setTableAlterOption(pCxt, yymsp[-1].minor.yy192, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 162: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 163: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 163: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } + case 164: /* alter_table_option ::= KEEP integer_list */ + case 165: /* alter_table_option ::= KEEP variable_list */ yytestcase(yyruleno==165); +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy64; } break; - case 164: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 166: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 167: /* col_name ::= column_name */ -{ yylhsminor.yy504 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 169: /* col_name ::= column_name */ +{ yylhsminor.yy192 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 168: /* cmd ::= SHOW DNODES */ + case 170: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 169: /* cmd ::= SHOW USERS */ + case 171: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 170: /* cmd ::= SHOW DATABASES */ + case 172: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 171: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 173: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 172: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 174: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 173: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy504, NULL); } + case 175: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy192, NULL); } break; - case 174: /* cmd ::= SHOW MNODES */ + case 176: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 175: /* cmd ::= SHOW MODULES */ + case 177: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 176: /* cmd ::= SHOW QNODES */ + case 178: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 177: /* cmd ::= SHOW FUNCTIONS */ + case 179: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 178: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 180: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 179: /* cmd ::= SHOW STREAMS */ + case 181: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 180: /* cmd ::= SHOW ACCOUNTS */ + case 182: /* cmd ::= SHOW ACCOUNTS */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 181: /* cmd ::= SHOW APPS */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } + case 183: /* cmd ::= SHOW APPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } break; - case 182: /* cmd ::= SHOW CONNECTIONS */ + case 184: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; - case 183: /* cmd ::= SHOW LICENCE */ - case 184: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==184); + case 185: /* cmd ::= SHOW LICENCE */ + case 186: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==186); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 185: /* cmd ::= SHOW CREATE DATABASE db_name */ -// { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy29); } + case 187: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } break; - case 186: /* cmd ::= SHOW CREATE TABLE full_table_name */ -// { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy182); } + case 188: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy192); } break; - case 187: /* cmd ::= SHOW CREATE STABLE full_table_name */ -// { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy182); } + case 189: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy192); } break; - case 188: /* cmd ::= SHOW QUERIES */ + case 190: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 189: /* cmd ::= SHOW SCORES */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } + case 191: /* cmd ::= SHOW SCORES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 190: /* cmd ::= SHOW TOPICS */ + case 192: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 191: /* cmd ::= SHOW VARIABLES */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } + case 193: /* cmd ::= SHOW VARIABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 192: /* cmd ::= SHOW BNODES */ + case 194: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); } break; - case 193: /* cmd ::= SHOW SNODES */ + case 195: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); } break; - case 194: /* db_name_cond_opt ::= */ - case 199: /* from_db_opt ::= */ yytestcase(yyruleno==199); -{ yymsp[1].minor.yy504 = createDefaultDatabaseCondValue(pCxt); } + case 196: /* db_name_cond_opt ::= */ + case 201: /* from_db_opt ::= */ yytestcase(yyruleno==201); +{ yymsp[1].minor.yy192 = createDefaultDatabaseCondValue(pCxt); } break; - case 195: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 197: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 196: /* like_pattern_opt ::= */ - case 207: /* index_options ::= */ yytestcase(yyruleno==207); - case 361: /* where_clause_opt ::= */ yytestcase(yyruleno==361); - case 365: /* twindow_clause_opt ::= */ yytestcase(yyruleno==365); - case 370: /* sliding_opt ::= */ yytestcase(yyruleno==370); - case 372: /* fill_opt ::= */ yytestcase(yyruleno==372); - case 384: /* having_clause_opt ::= */ yytestcase(yyruleno==384); - case 392: /* slimit_clause_opt ::= */ yytestcase(yyruleno==392); - case 396: /* limit_clause_opt ::= */ yytestcase(yyruleno==396); -{ yymsp[1].minor.yy504 = NULL; } + case 198: /* like_pattern_opt ::= */ + case 209: /* index_options ::= */ yytestcase(yyruleno==209); + case 236: /* into_opt ::= */ yytestcase(yyruleno==236); + case 381: /* where_clause_opt ::= */ yytestcase(yyruleno==381); + case 385: /* twindow_clause_opt ::= */ yytestcase(yyruleno==385); + case 390: /* sliding_opt ::= */ yytestcase(yyruleno==390); + case 392: /* fill_opt ::= */ yytestcase(yyruleno==392); + case 404: /* having_clause_opt ::= */ yytestcase(yyruleno==404); + case 412: /* slimit_clause_opt ::= */ yytestcase(yyruleno==412); + case 416: /* limit_clause_opt ::= */ yytestcase(yyruleno==416); +{ yymsp[1].minor.yy192 = NULL; } break; - case 197: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 199: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 198: /* table_name_cond ::= table_name */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 200: /* table_name_cond ::= table_name */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy353); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 200: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } + case 202: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy353); } break; - case 203: /* func_name ::= function_name */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 205: /* func_name ::= function_name */ +{ yylhsminor.yy192 = createFunctionNode(pCxt, &yymsp[0].minor.yy353, NULL); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 204: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy121, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, NULL, yymsp[0].minor.yy504); } + case 206: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy273, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, NULL, yymsp[0].minor.yy192); } break; - case 205: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488, NULL); } + case 207: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy273, &yymsp[-5].minor.yy353, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64, NULL); } break; - case 206: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409); } + case 208: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); } break; - case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy504 = createIndexOption(pCxt, yymsp[-6].minor.yy488, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL, yymsp[0].minor.yy504); } + case 210: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy192 = createIndexOption(pCxt, yymsp[-6].minor.yy64, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), NULL, yymsp[0].minor.yy192); } break; - case 209: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy504 = createIndexOption(pCxt, yymsp[-8].minor.yy488, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[0].minor.yy504); } + case 211: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ +{ yymsp[-10].minor.yy192 = createIndexOption(pCxt, yymsp[-8].minor.yy64, releaseRawExprNode(pCxt, yymsp[-4].minor.yy192), releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), yymsp[0].minor.yy192); } break; - case 212: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 214: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy192 = createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504, NULL); } + case 215: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, yymsp[0].minor.yy192, NULL); } break; - case 214: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, NULL, &yymsp[0].minor.yy409); } + case 216: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, NULL, &yymsp[0].minor.yy353); } break; - case 215: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } + case 217: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; - case 216: /* cmd ::= DESC full_table_name */ - case 217: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==217); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy504); } + case 218: /* cmd ::= DESC full_table_name */ + case 219: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==219); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy192); } break; - case 218: /* cmd ::= RESET QUERY CACHE */ + case 220: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 219: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy121, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 221: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy273, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 221: /* analyze_opt ::= ANALYZE */ - case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); - case 351: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==351); -{ yymsp[0].minor.yy121 = true; } + case 223: /* analyze_opt ::= ANALYZE */ + case 231: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==231); + case 371: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==371); +{ yymsp[0].minor.yy273 = true; } break; - case 222: /* explain_options ::= */ -{ yymsp[1].minor.yy504 = createDefaultExplainOptions(pCxt); } + case 224: /* explain_options ::= */ +{ yymsp[1].minor.yy192 = createDefaultExplainOptions(pCxt); } break; - case 223: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy504 = setExplainVerbose(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 225: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy192 = setExplainVerbose(pCxt, yymsp[-2].minor.yy192, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 224: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy504 = setExplainRatio(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 226: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy192 = setExplainRatio(pCxt, yymsp[-2].minor.yy192, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 225: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy488); } + case 227: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy64); } break; - case 226: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy160, yymsp[0].minor.yy452); } + case 228: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy273, &yymsp[-5].minor.yy353, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy536, yymsp[0].minor.yy116); } break; - case 227: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy409); } + case 229: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy353); } break; - case 230: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy452 = 0; } + case 232: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy116 = 0; } break; - case 231: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy452 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 233: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy116 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 232: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy409, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } + case 234: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy273, &yymsp[-4].minor.yy353, yymsp[-3].minor.yy192, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 233: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy409); } + case 235: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; - case 234: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 237: /* into_opt ::= INTO full_table_name */ + case 352: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==352); + case 382: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==382); + case 405: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==405); +{ yymsp[-1].minor.yy192 = yymsp[0].minor.yy192; } + break; + case 238: /* stream_options ::= */ +{ yymsp[1].minor.yy192 = createStreamOptions(pCxt); } + break; + case 239: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 240: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 241: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy192); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 242: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 235: /* cmd ::= KILL QUERY NK_INTEGER */ + case 243: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 236: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 244: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 237: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy488); } + case 245: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy64); } break; - case 238: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 246: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 239: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 247: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy64 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 241: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy409); } + case 249: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy353); } break; - case 243: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 251: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 244: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 252: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 245: /* literal ::= NK_STRING */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 253: /* literal ::= NK_STRING */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 246: /* literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 254: /* literal ::= NK_BOOL */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 247: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 255: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 248: /* literal ::= duration_literal */ - case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); - case 277: /* expression ::= literal */ yytestcase(yyruleno==277); - case 278: /* expression ::= pseudo_column */ yytestcase(yyruleno==278); - case 279: /* expression ::= column_reference */ yytestcase(yyruleno==279); - case 283: /* expression ::= subquery */ yytestcase(yyruleno==283); - case 324: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==324); - case 328: /* boolean_primary ::= predicate */ yytestcase(yyruleno==328); - case 330: /* common_expression ::= expression */ yytestcase(yyruleno==330); - case 331: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==331); - case 333: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==333); - case 335: /* table_reference ::= table_primary */ yytestcase(yyruleno==335); - case 336: /* table_reference ::= joined_table */ yytestcase(yyruleno==336); - case 340: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==340); - case 387: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==387); - case 389: /* query_primary ::= query_specification */ yytestcase(yyruleno==389); -{ yylhsminor.yy504 = yymsp[0].minor.yy504; } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 256: /* literal ::= duration_literal */ + case 266: /* signed_literal ::= signed */ yytestcase(yyruleno==266); + case 284: /* expression ::= literal */ yytestcase(yyruleno==284); + case 285: /* expression ::= pseudo_column */ yytestcase(yyruleno==285); + case 286: /* expression ::= column_reference */ yytestcase(yyruleno==286); + case 287: /* expression ::= function_expression */ yytestcase(yyruleno==287); + case 288: /* expression ::= subquery */ yytestcase(yyruleno==288); + case 344: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==344); + case 348: /* boolean_primary ::= predicate */ yytestcase(yyruleno==348); + case 350: /* common_expression ::= expression */ yytestcase(yyruleno==350); + case 351: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==351); + case 353: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==353); + case 355: /* table_reference ::= table_primary */ yytestcase(yyruleno==355); + case 356: /* table_reference ::= joined_table */ yytestcase(yyruleno==356); + case 360: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==360); + case 407: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==407); + case 409: /* query_primary ::= query_specification */ yytestcase(yyruleno==409); +{ yylhsminor.yy192 = yymsp[0].minor.yy192; } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 249: /* literal ::= NULL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 257: /* literal ::= NULL */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 250: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 258: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 251: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 259: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 252: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 260: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 253: /* signed ::= NK_MINUS NK_INTEGER */ + case 261: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 262: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 254: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 263: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 255: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 264: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 256: /* signed ::= NK_MINUS NK_FLOAT */ + case 265: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 258: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 267: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 259: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 268: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 260: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 269: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 261: /* signed_literal ::= duration_literal */ - case 357: /* select_item ::= common_expression */ yytestcase(yyruleno==357); - case 401: /* search_condition ::= common_expression */ yytestcase(yyruleno==401); -{ yylhsminor.yy504 = releaseRawExprNode(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 270: /* signed_literal ::= duration_literal */ + case 322: /* star_func_para ::= expression */ yytestcase(yyruleno==322); + case 377: /* select_item ::= common_expression */ yytestcase(yyruleno==377); + case 421: /* search_condition ::= common_expression */ yytestcase(yyruleno==421); +{ yylhsminor.yy192 = releaseRawExprNode(pCxt, yymsp[0].minor.yy192); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 262: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 271: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 280: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 289: /* expression ::= NK_LP expression NK_RP */ + case 349: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==349); +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 281: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; - break; - case 282: /* expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy160)); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; - break; - case 284: /* expression ::= NK_LP expression NK_RP */ - case 329: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==329); -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 285: /* expression ::= NK_PLUS expression */ + case 290: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 286: /* expression ::= NK_MINUS expression */ + case 291: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy192), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 287: /* expression ::= expression NK_PLUS expression */ + case 292: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 288: /* expression ::= expression NK_MINUS expression */ + case 293: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 289: /* expression ::= expression NK_STAR expression */ + case 294: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 290: /* expression ::= expression NK_SLASH expression */ + case 295: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 291: /* expression ::= expression NK_REM expression */ + case 296: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 292: /* expression_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; - break; - case 293: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 294: /* column_reference ::= column_name */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy409, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 295: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 296: /* pseudo_column ::= NOW */ - case 297: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==297); - case 298: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==298); - case 299: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==299); - case 300: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==302); - case 303: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==303); - case 304: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==304); -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 305: /* predicate ::= expression compare_op expression */ - case 310: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==310); + case 297: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy84, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 306: /* predicate ::= expression BETWEEN expression AND expression */ + case 298: /* expression_list ::= expression */ +{ yylhsminor.yy64 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; + break; + case 299: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; + break; + case 300: /* column_reference ::= column_name */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy353, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; + break; + case 301: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 302: /* pseudo_column ::= NOW */ + case 303: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==303); + case 304: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==304); + case 305: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==305); + case 306: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==306); + case 307: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==307); + case 308: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==308); + case 309: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==309); + case 310: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==310); +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; + break; + case 311: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 312: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==312); +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64)); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; + break; + case 313: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), yymsp[-1].minor.yy536)); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; + break; + case 318: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy64 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; + break; + case 323: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 380: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==380); +{ yylhsminor.yy192 = createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 324: /* predicate ::= expression compare_op expression */ + case 329: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==329); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy412, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 307: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 325: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy192), releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 308: /* predicate ::= expression IS NULL */ + case 326: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[-5].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; - case 309: /* predicate ::= expression IS NOT NULL */ + case 327: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), NULL)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 311: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_THAN; } - break; - case 312: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_THAN; } - break; - case 313: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_EQUAL; } - break; - case 314: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_EQUAL; } - break; - case 315: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy84 = OP_TYPE_NOT_EQUAL; } - break; - case 316: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy84 = OP_TYPE_EQUAL; } - break; - case 317: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LIKE; } - break; - case 318: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_LIKE; } - break; - case 319: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_MATCH; } - break; - case 320: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_NMATCH; } - break; - case 321: /* in_op ::= IN */ -{ yymsp[0].minor.yy84 = OP_TYPE_IN; } - break; - case 322: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_IN; } - break; - case 323: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 325: /* boolean_value_expression ::= NOT boolean_primary */ + case 328: /* predicate ::= expression IS NOT NULL */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 326: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 330: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy412 = OP_TYPE_LOWER_THAN; } + break; + case 331: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy412 = OP_TYPE_GREATER_THAN; } + break; + case 332: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy412 = OP_TYPE_LOWER_EQUAL; } + break; + case 333: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy412 = OP_TYPE_GREATER_EQUAL; } + break; + case 334: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy412 = OP_TYPE_NOT_EQUAL; } + break; + case 335: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy412 = OP_TYPE_EQUAL; } + break; + case 336: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy412 = OP_TYPE_LIKE; } + break; + case 337: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy412 = OP_TYPE_NOT_LIKE; } + break; + case 338: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy412 = OP_TYPE_MATCH; } + break; + case 339: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy412 = OP_TYPE_NMATCH; } + break; + case 340: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy412 = OP_TYPE_JSON_CONTAINS; } + break; + case 341: /* in_op ::= IN */ +{ yymsp[0].minor.yy412 = OP_TYPE_IN; } + break; + case 342: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy412 = OP_TYPE_NOT_IN; } + break; + case 343: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 345: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy192), NULL)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 327: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 346: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 332: /* from_clause ::= FROM table_reference_list */ - case 362: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==362); - case 385: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==385); -{ yymsp[-1].minor.yy504 = yymsp[0].minor.yy504; } + case 347: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); + } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 334: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy504, yymsp[0].minor.yy504, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 354: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy192 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy192, yymsp[0].minor.yy192, NULL); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 337: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 357: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy192 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 338: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 358: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy192 = createRealTableNode(pCxt, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 339: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy504 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 359: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy192 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 341: /* alias_opt ::= */ -{ yymsp[1].minor.yy409 = nil_token; } + case 361: /* alias_opt ::= */ +{ yymsp[1].minor.yy353 = nil_token; } break; - case 342: /* alias_opt ::= table_alias */ -{ yylhsminor.yy409 = yymsp[0].minor.yy409; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 362: /* alias_opt ::= table_alias */ +{ yylhsminor.yy353 = yymsp[0].minor.yy353; } + yymsp[0].minor.yy353 = yylhsminor.yy353; break; - case 343: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy409 = yymsp[0].minor.yy409; } + case 363: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy353 = yymsp[0].minor.yy353; } break; - case 344: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 345: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==345); -{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } + case 364: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 365: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==365); +{ yymsp[-2].minor.yy192 = yymsp[-1].minor.yy192; } break; - case 346: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, yymsp[-4].minor.yy556, yymsp[-5].minor.yy504, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + case 366: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy192 = createJoinTableNode(pCxt, yymsp[-4].minor.yy372, yymsp[-5].minor.yy192, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; - case 347: /* join_type ::= */ -{ yymsp[1].minor.yy556 = JOIN_TYPE_INNER; } + case 367: /* join_type ::= */ +{ yymsp[1].minor.yy372 = JOIN_TYPE_INNER; } break; - case 348: /* join_type ::= INNER */ -{ yymsp[0].minor.yy556 = JOIN_TYPE_INNER; } + case 368: /* join_type ::= INNER */ +{ yymsp[0].minor.yy372 = JOIN_TYPE_INNER; } break; - case 349: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 369: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy504 = createSelectStmt(pCxt, yymsp[-7].minor.yy121, yymsp[-6].minor.yy488, yymsp[-5].minor.yy504); - yymsp[-8].minor.yy504 = addWhereClause(pCxt, yymsp[-8].minor.yy504, yymsp[-4].minor.yy504); - yymsp[-8].minor.yy504 = addPartitionByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-3].minor.yy488); - yymsp[-8].minor.yy504 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy504, yymsp[-2].minor.yy504); - yymsp[-8].minor.yy504 = addGroupByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-1].minor.yy488); - yymsp[-8].minor.yy504 = addHavingClause(pCxt, yymsp[-8].minor.yy504, yymsp[0].minor.yy504); + yymsp[-8].minor.yy192 = createSelectStmt(pCxt, yymsp[-7].minor.yy273, yymsp[-6].minor.yy64, yymsp[-5].minor.yy192); + yymsp[-8].minor.yy192 = addWhereClause(pCxt, yymsp[-8].minor.yy192, yymsp[-4].minor.yy192); + yymsp[-8].minor.yy192 = addPartitionByClause(pCxt, yymsp[-8].minor.yy192, yymsp[-3].minor.yy64); + yymsp[-8].minor.yy192 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy192, yymsp[-2].minor.yy192); + yymsp[-8].minor.yy192 = addGroupByClause(pCxt, yymsp[-8].minor.yy192, yymsp[-1].minor.yy64); + yymsp[-8].minor.yy192 = addHavingClause(pCxt, yymsp[-8].minor.yy192, yymsp[0].minor.yy192); } break; - case 352: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy121 = false; } + case 372: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy273 = false; } break; - case 353: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy488 = NULL; } + case 373: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy64 = NULL; } break; - case 358: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 378: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy192 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 359: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 379: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy192 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 360: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy504 = createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 384: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 401: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==401); + case 411: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==411); +{ yymsp[-2].minor.yy64 = yymsp[0].minor.yy64; } break; - case 364: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 381: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==381); - case 391: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==391); -{ yymsp[-2].minor.yy488 = yymsp[0].minor.yy488; } + case 386: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy192 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } break; - case 366: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy504 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 387: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy192 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } break; - case 367: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy504 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 388: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy192 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), NULL, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 389: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy192 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy192), releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 391: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy192 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy192); } break; - case 371: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy504 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy504); } + case 393: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy192 = createFillNode(pCxt, yymsp[-1].minor.yy358, NULL); } break; - case 373: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy504 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); } + case 394: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy192 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); } break; - case 374: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy504 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } + case 395: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy358 = FILL_MODE_NONE; } break; - case 375: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy22 = FILL_MODE_NONE; } + case 396: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy358 = FILL_MODE_PREV; } break; - case 376: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy22 = FILL_MODE_PREV; } + case 397: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy358 = FILL_MODE_NULL; } break; - case 377: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy22 = FILL_MODE_NULL; } + case 398: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy358 = FILL_MODE_LINEAR; } break; - case 378: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; } + case 399: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy358 = FILL_MODE_NEXT; } break; - case 379: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; } + case 402: /* group_by_list ::= expression */ +{ yylhsminor.yy64 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; - case 382: /* group_by_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 403: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; - case 383: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 386: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 406: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy504 = addOrderByClause(pCxt, yymsp[-3].minor.yy504, yymsp[-2].minor.yy488); - yylhsminor.yy504 = addSlimitClause(pCxt, yylhsminor.yy504, yymsp[-1].minor.yy504); - yylhsminor.yy504 = addLimitClause(pCxt, yylhsminor.yy504, yymsp[0].minor.yy504); + yylhsminor.yy192 = addOrderByClause(pCxt, yymsp[-3].minor.yy192, yymsp[-2].minor.yy64); + yylhsminor.yy192 = addSlimitClause(pCxt, yylhsminor.yy192, yymsp[-1].minor.yy192); + yylhsminor.yy192 = addLimitClause(pCxt, yylhsminor.yy192, yymsp[0].minor.yy192); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 388: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy504 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 408: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy192 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==397); -{ yymsp[-1].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 413: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 417: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==417); +{ yymsp[-1].minor.yy192 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==398); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 414: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 418: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==418); +{ yymsp[-3].minor.yy192 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==399); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 415: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 419: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==419); +{ yymsp[-3].minor.yy192 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 400: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy504); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 420: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy192); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 404: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy504 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[-1].minor.yy522, yymsp[0].minor.yy281); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 424: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy192 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), yymsp[-1].minor.yy530, yymsp[0].minor.yy225); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 405: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy522 = ORDER_ASC; } + case 425: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy530 = ORDER_ASC; } break; - case 406: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy522 = ORDER_ASC; } + case 426: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy530 = ORDER_ASC; } break; - case 407: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy522 = ORDER_DESC; } + case 427: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy530 = ORDER_DESC; } break; - case 408: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy281 = NULL_ORDER_DEFAULT; } + case 428: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy225 = NULL_ORDER_DEFAULT; } break; - case 409: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_FIRST; } + case 429: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy225 = NULL_ORDER_FIRST; } break; - case 410: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_LAST; } + case 430: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy225 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parserAstTest.cpp b/source/libs/parser/test/parserAstTest.cpp index 149c317bd4..5fc4e777c1 100644 --- a/source/libs/parser/test/parserAstTest.cpp +++ b/source/libs/parser/test/parserAstTest.cpp @@ -18,6 +18,7 @@ #include +#include "parserTestUtil.h" #include "parInt.h" using namespace std; @@ -44,7 +45,7 @@ protected: query_ = nullptr; bool res = runImpl(parseCode, translateCode); qDestroyQuery(query_); - if (1/*!res*/) { + if (!res || g_isDump) { dump(); } return res; @@ -57,7 +58,7 @@ private: int32_t code = parse(&cxt_, &query_); if (code != TSDB_CODE_SUCCESS) { parseErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == parseCode); + return (code == parseCode); } if (TSDB_CODE_SUCCESS != parseCode) { return false; @@ -66,7 +67,7 @@ private: code = translate(&cxt_, query_); if (code != TSDB_CODE_SUCCESS) { translateErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == translateCode); + return (code == translateCode); } translatedAstStr_ = toString(query_->pRoot); code = calculateConstant(&cxt_, query_); @@ -243,6 +244,19 @@ TEST_F(ParserTest, selectPseudoColumn) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, selectMultiResFunc) { + setDatabase("root", "test"); + + // bind("SELECT last(*), first(*), last_row(*) FROM t1"); + // ASSERT_TRUE(run()); + + bind("SELECT last(c1, c2), first(t1.*), last_row(c3) FROM t1"); + ASSERT_TRUE(run()); + + bind("SELECT last(t2.*), first(t1.c1, t2.*), last_row(t1.*, t2.*) FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, selectClause) { setDatabase("root", "test"); @@ -726,6 +740,22 @@ TEST_F(ParserTest, dropTopic) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, createStream) { + setDatabase("root", "test"); + + bind("create stream s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream s1 into st1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 trigger window_close watermark 10s into st1 as select * from t1"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, explain) { setDatabase("root", "test"); diff --git a/source/libs/parser/test/parserTestMain.cpp b/source/libs/parser/test/parserTestMain.cpp index 9a9711ca96..8cd69418b9 100644 --- a/source/libs/parser/test/parserTestMain.cpp +++ b/source/libs/parser/test/parserTestMain.cpp @@ -15,12 +15,16 @@ #include +#include #include #include "mockCatalog.h" +#include "parserTestUtil.h" #include "parToken.h" #include "functionMgt.h" +bool g_isDump = false; + class ParserEnv : public testing::Environment { public: virtual void SetUp() { @@ -38,8 +42,27 @@ public: virtual ~ParserEnv() {} }; +static void parseArg(int argc, char* argv[]) { + int opt = 0; + const char *optstring = ""; + static struct option long_options[] = { + {"dump", no_argument, NULL, 'd'}, + {0, 0, 0, 0} + }; + while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { + switch (opt) { + case 'd': + g_isDump = true; + break; + default: + break; + } + } +} + int main(int argc, char* argv[]) { testing::AddGlobalTestEnvironment(new ParserEnv()); testing::InitGoogleTest(&argc, argv); + parseArg(argc, argv); return RUN_ALL_TESTS(); } diff --git a/source/libs/parser/test/parserTestUtil.h b/source/libs/parser/test/parserTestUtil.h new file mode 100644 index 0000000000..f5efed50a8 --- /dev/null +++ b/source/libs/parser/test/parserTestUtil.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +extern bool g_isDump; \ No newline at end of file From 34c9947a531e89c304e48e44824e1ed9ea7c2bef Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 15 Apr 2022 18:38:41 +0800 Subject: [PATCH 54/60] feat(tsdb): set bitmap len 0 for primary TS column --- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index e31ede09cc..064086b442 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -606,9 +606,10 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat if (tsdbMakeRoom((void **)(&TSDB_READ_COMP_BUF(pReadh)), zsize) < 0) return -1; } - if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, pBlockCol->blen, - pBlock->algorithm, pBlock->numOfRows, tLenBitmap, pDataCols->maxPoints, - TSDB_READ_COMP_BUF(pReadh), (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { + if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, + pBlockCol ? pBlockCol->blen : 0, pBlock->algorithm, pBlock->numOfRows, + tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh), + (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %u", TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset); return -1; @@ -747,6 +748,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { // load the key row blockCol.colId = colId; TD_SET_COL_ROWS_NORM(&blockCol); // default is NORM for the primary key column + blockCol.blen = 0; blockCol.len = pBlock->keyLen; blockCol.type = pDataCol->type; blockCol.offset = TSDB_KEY_COL_OFFSET; From 01ea38586d6154171f9af5766868848f0ab18386 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 19:22:11 +0800 Subject: [PATCH 55/60] feat: CREATE STREAM statement implement, and syntax of JSON data type implement. --- source/libs/parser/inc/sql.y | 18 +++--- source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 60 +++++++++++++------ .../libs/parser/test/mockCatalogService.cpp | 2 +- source/libs/planner/src/planOptimizer.c | 2 +- source/libs/planner/test/plannerTest.cpp | 12 ++-- 6 files changed, 60 insertions(+), 35 deletions(-) diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 132a746828..e1d5597e3b 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -592,15 +592,15 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 618d5ccf48..af2b831b93 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -51,6 +51,7 @@ static SKeyword keywordTable[] = { {"BY", TK_BY}, {"CACHE", TK_CACHE}, {"CACHELAST", TK_CACHELAST}, + {"CAST", TK_CAST}, {"COLUMN", TK_COLUMN}, {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 90a4e4e40e..f1f2f591a8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -807,31 +807,32 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { return (SNode*)pFunc; } -static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { - if (NULL == *pOutput) { - *pOutput = nodesMakeList(); - } - if (NULL == *pOutput) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); - } - bool foundTable = false; +static int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput) { SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel); size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); - if (0 == strcmp(pTable->tableAlias, pCol->tableAlias)) { - int32_t code = createColumnNodeByTable(pCxt, pTable, *pOutput); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - foundTable = true; - break; + if (NULL == pTableAlias || 0 == strcmp(pTable->tableAlias, pTableAlias)) { + *pOutput = pTable; + return TSDB_CODE_SUCCESS; } } - if (!foundTable) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pTableAlias); +} + +static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, pCol->tableAlias, &pTable); + if (TSDB_CODE_SUCCESS == code && NULL == *pOutput) { + *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); + } } - return TSDB_CODE_SUCCESS; + if (TSDB_CODE_SUCCESS == code) { + code = createColumnNodeByTable(pCxt, pTable, *pOutput); + } + return code; } static bool isStar(SNode* pNode) { @@ -909,6 +910,24 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod return code; } +static bool isCountStar(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode)) { + return false; + } + SNode* pPara = nodesListGetNode(((SFunctionNode*)pNode)->pParameterList, 0); + return (QUERY_NODE_COLUMN == nodeType(pPara) && 0 == strcmp(((SColumnNode*)pPara)->colName, "*")); +} + +static int32_t rewriteCountStar(STranslateContext* pCxt, SFunctionNode* pCount) { + SColumnNode* pCol = nodesListGetNode(pCount->pParameterList, 0); + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, ('\0' == pCol->tableAlias[0] ? NULL : pCol->tableAlias), &pTable); + if (TSDB_CODE_SUCCESS == code && QUERY_NODE_REAL_TABLE == nodeType(pTable)) { + setColumnInfoBySchema((SRealTableNode*)pTable, ((SRealTableNode*)pTable)->pMeta->schema, false, pCol); + } + return code; +} + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pProjectionList) { // select * ... return createAllColumns(pCxt, &pSelect->pProjectionList); @@ -931,6 +950,11 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { INSERT_LIST(pSelect->pProjectionList, pCols); ERASE_NODE(pSelect->pProjectionList); continue; + } else if (isCountStar(pNode)) { + int32_t code = rewriteCountStar(pCxt, (SFunctionNode*)pNode); + if (TSDB_CODE_SUCCESS != code) { + return code; + } } WHERE_NEXT; } diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 3da3678563..3ef0eaed42 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -264,7 +264,7 @@ private: } std::string ftToString(int16_t colid, int16_t numOfColumns) const { - return (0 == colid ? "column" : (colid <= numOfColumns ? "tag" : "column")); + return (0 == colid ? "column" : (colid < numOfColumns ? "column" : "tag")); } STableMeta* getTableSchemaMeta(const std::string& db, const std::string& tbname) const { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 19e6718fe8..0be7c42467 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -64,7 +64,7 @@ static bool osdMayBeOptimized(SLogicNode* pNode) { return false; } if (NULL == pNode->pParent || - (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) && QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode->pParent))) { + (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) && QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent))) { return false; } return true; diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 48aa89eae6..14fa36a958 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -196,14 +196,14 @@ TEST_F(PlannerTest, selectGroupBy) { bind("SELECT count(*) FROM t1"); ASSERT_TRUE(run()); - // bind("SELECT c1, max(c3), min(c2), count(*) FROM t1 GROUP BY c1"); - // ASSERT_TRUE(run()); + bind("SELECT c1, max(c3), min(c3), count(*) FROM t1 GROUP BY c1"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); + ASSERT_TRUE(run()); } TEST_F(PlannerTest, selectSubquery) { From 3e1c4cc268633823d01e8f16e37d1a345b4ff07c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:07:35 +0800 Subject: [PATCH 56/60] complie error --- source/libs/parser/src/parTranslater.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2d1535e439..4fe3d24b8a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -799,9 +799,9 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { strcpy(pFunc->functionName, pSrcFunc->functionName); if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); } return (SNode*)pFunc; From 7b35c455d0f1ff810d79b9f90b58ea1fb94cf9c6 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 15 Apr 2022 20:12:34 +0800 Subject: [PATCH 57/60] fix(grant): change dongle lib. --- cmake/cmake.define | 6 ------ source/dnode/mgmt/implement/CMakeLists.txt | 10 +--------- source/dnode/mnode/impl/CMakeLists.txt | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index 53d25e1097..e875a0d306 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -3,12 +3,6 @@ cmake_minimum_required(VERSION 3.16) if (NOT DEFINED TD_GRANT) SET(TD_GRANT FALSE) endif() -if (NOT DEFINED TD_USB_DONGLE) - SET(TD_USB_DONGLE FALSE) -endif() -IF (TD_GRANT) - ADD_DEFINITIONS(-D_GRANT) -ENDIF () IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) diff --git a/source/dnode/mgmt/implement/CMakeLists.txt b/source/dnode/mgmt/implement/CMakeLists.txt index 26c14edc77..fbe7530395 100644 --- a/source/dnode/mgmt/implement/CMakeLists.txt +++ b/source/dnode/mgmt/implement/CMakeLists.txt @@ -6,12 +6,4 @@ target_link_libraries( target_include_directories( dnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) - -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(dnode grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(dnode usb_dongle) -else() -ENDIF () \ No newline at end of file +) \ No newline at end of file diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 8cb5e2a528..a4bd12a7f7 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -12,8 +12,8 @@ target_link_libraries( IF (TD_GRANT) TARGET_LINK_LIBRARIES(mnode grant) ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(mnode usb_dongle) +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) ENDIF () if(${BUILD_TEST}) From acb4a0445956590c61c4141e2d9a1ad2d69d8e3b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:17:56 +0800 Subject: [PATCH 58/60] complie error --- source/libs/parser/src/parTranslater.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 4fe3d24b8a..c51ec31b81 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -797,12 +797,15 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); + char buf[TSDB_FUNC_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN]; + int32_t len = 0; if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); } + strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); return (SNode*)pFunc; } From f406c4e31d806981e08a726f3a4b42233c3bc288 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:31:21 +0800 Subject: [PATCH 59/60] complie error --- source/libs/parser/src/parTranslater.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c51ec31b81..dc1338be68 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -914,7 +914,7 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod } static bool isCountStar(SNode* pNode) { - if (QUERY_NODE_FUNCTION != nodeType(pNode)) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || 1 != LIST_LENGTH(((SFunctionNode*)pNode)->pParameterList)) { return false; } SNode* pPara = nodesListGetNode(((SFunctionNode*)pNode)->pParameterList, 0); From fa6e18e283c1a4a3a77319b41eaf2adda41e2819 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 15 Apr 2022 20:32:52 +0800 Subject: [PATCH 60/60] [test: support valgrind run all sim cases, and save valgrind log file] --- tests/script/runAllSimCases.sh | 66 +++++++++++++++++++++++++++-- tests/script/sh/exec.sh | 9 ++-- tests/script/test.sh | 2 +- tests/script/tsim/insert/basic0.sim | 2 +- 4 files changed, 70 insertions(+), 9 deletions(-) diff --git a/tests/script/runAllSimCases.sh b/tests/script/runAllSimCases.sh index e1eea1cc38..70f2f86115 100755 --- a/tests/script/runAllSimCases.sh +++ b/tests/script/runAllSimCases.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash ################################################## # @@ -8,13 +8,73 @@ set -e #set -x +VALGRIND=0 +LOG_BK_DIR=/data/valgrind_log_backup # 192.168.0.203 +while getopts "v:r" arg +do + case $arg in + v) + VALGRIND=1 + ;; + r) + LOG_BK_DIR=$(echo $OPTARG) + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +echo "VALGRIND: $VALGRIND, LOG_BK_DIR: $LOG_BK_DIR" + +CURRENT_DIR=`pwd` +TSIM_LOG_DIR=$CURRENT_DIR/../../sim/tsim/log +TAOSD_LOG_DIR=$CURRENT_DIR/../../sim + +echo "tsim log dir: $TSIM_LOG_DIR" +echo "taosd log dir: $TAOSD_LOG_DIR" + +if [[ $VALGRIND -eq 1 ]]; then + if [ -d ${LOG_BK_DIR} ]; then + rm -rf ${LOG_BK_DIR}/* + else + mkdir -p $LOG_BK_DIR/ + fi +fi while read line do firstChar=`echo ${line:0:1}` if [[ -n "$line" ]] && [[ $firstChar != "#" ]]; then - echo "======== $line ========" - $line + if [[ $VALGRIND -eq 1 ]]; then + echo "======== $line -v ========" + $line -v + + # move all valgrind log files of the sim case to valgrind back dir + # get current sim case name for + result=`echo ${line%sim*}` + result=`echo ${result#*/}` + result=`echo ${result#*/}` + result=`echo ${result////-}` + tsimLogFile=valgrind-${result}sim.log + + echo "cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} " + cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} + cp ${TAOSD_LOG_DIR}/dnode1/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode2/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode3/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode4/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode5/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode6/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode7/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode8/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode9/log/valgrind*.log ${LOG_BK_DIR}/ ||: + + else + echo "======== $line ========" + $line + fi fi done < ./jenkins/basic.txt diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index 50ded73555..606f778920 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -97,13 +97,14 @@ if [ "$CLEAR_OPTION" = "clear" ]; then fi if [ "$EXEC_OPTON" = "start" ]; then - echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR - + #echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR if [ "$VALGRIND_OPTION" = "true" ]; then TT=`date +%s` - mkdir ${LOG_DIR}/${TT} - nohup valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & + #mkdir ${LOG_DIR}/${TT} + echo "nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" + nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & else + echo "nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & fi diff --git a/tests/script/test.sh b/tests/script/test.sh index f5a9e4187b..27fa4933e0 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -126,7 +126,7 @@ if [ -n "$FILE_NAME" ]; then echo "------------------------------------------------------------------------" if [ $VALGRIND -eq 1 ]; then echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v - valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v + valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${LOG_DIR}/valgrind-tsim.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else if [[ $MULTIPROCESS -eq 1 ]];then echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 1ae8b372dc..94bd0f1ecf 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -537,4 +537,4 @@ endi #endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT