From b8391fad62eb5d23544f7218a272685325e40aea Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 12 Apr 2022 19:10:52 +0800 Subject: [PATCH 01/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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 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 11/14] 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 e499587d64a9e03c3207917aae0615707e8ea895 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 15 Apr 2022 10:34:28 +0800 Subject: [PATCH 12/14] 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 66ea2d6bdc45db3933922301b08c3a5dee8dd02b Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 15 Apr 2022 10:49:00 +0800 Subject: [PATCH 13/14] 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 85496cbb4c74a2009b59a2be2d3fc873d7a0707f Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 15 Apr 2022 13:17:25 +0800 Subject: [PATCH 14/14] 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} };